Exemplo n.º 1
0
    def testBuildSpiralMinimum2(self):
        expected = [[1, 2]]

        builder = SpiralArrayBuilder(rows=1, cols=2)
        actual = builder.createSpiralArray()

        self.assertEqual(expected, actual)
Exemplo n.º 2
0
    def testBuildSpiral1(self):
        expected = [[1, 2],
                    [4, 3]]

        builder = SpiralArrayBuilder(rows=2, cols=2)
        actual = builder.createSpiralArray()
        self.assertEqual(expected, actual)
Exemplo n.º 3
0
    def testBuildSpiral2(self):
        expected = [[1, 2, 3],
                    [8, 9, 4],
                    [7, 6, 5]]

        builder = SpiralArrayBuilder(rows=3, cols=3)
        actual = builder.createSpiralArray()
        self.assertEqual(expected, actual)
Exemplo n.º 4
0
    def testBuildSpiralMinimum3(self):
        expected = [[1],
                    [2],
                    [3]]

        builder = SpiralArrayBuilder(rows=3, cols=1)
        actual = builder.createSpiralArray()

        self.assertEqual(expected, actual)
Exemplo n.º 5
0
    def testBuildSpiral4(self):
        expected = [[1, 2, 3, 4, 5],
                    [14, 15, 16, 17, 6],
                    [13, 20, 19, 18, 7],
                    [12, 11, 10, 9, 8]]

        builder = SpiralArrayBuilder(rows=4, cols=5)
        actual = builder.createSpiralArray()
        self.assertEqual(expected, actual)