コード例 #1
0
    def testUpCol1(self):
        row = self.ran.randint(2, 5)
        new = algo.shiftUp(row, 1, 1, self.seat.copy())

        def check(old, new):
            for i in range(6):
                for j in range(1, 7):
                    if old[i][j] != new[i][j]:
                        return False
            return [new[i][0] for i in range(6)] == [8, 15, 22, 29, 1, 0]

        self.assertTrue(check(self.seat, new))
コード例 #2
0
    def testUpCol7(self):
        row = self.ran.randint(2, 5)
        new = algo.shiftUp(row, 7, 1, self.seat.copy())

        def check(old, new):
            for i in range(6):
                for j in range(7):
                    if j != 6:
                        if old[i][j] != new[i][j]:
                            return False
            return [new[i][6] for i in range(6)] == [14, 21, 28, 35, 7, 0]

        self.assertTrue(check(self.seat, new))
コード例 #3
0
    def testUpCol6(self):
        row = self.ran.randint(2, 5)
        new = algo.shiftUp(row, 6, 1, self.seat.copy())

        def check(old, new):
            for i in range(6):
                for j in range(7):
                    if j != 5:
                        if old[i][j] != new[i][j]:
                            return False
            return [new[i][5] for i in range(6)] == [13, 20, 27, 34, 6, 0]

        self.assertTrue(check(self.seat, new))
コード例 #4
0
    def testUpCol5(self):
        row = self.ran.randint(2, 6)
        new = algo.shiftUp(row, 5, 1, self.seat.copy())

        def check(old, new):
            for i in range(6):
                for j in range(7):
                    if j != 4:
                        if old[i][j] != new[i][j]:
                            return False
            return [new[i][4] for i in range(6)] == [12, 19, 26, 33, 38, 5]

        self.assertTrue(check(self.seat, new))
コード例 #5
0
    def testUpCol4(self):
        row = self.ran.randint(2, 6)
        new = algo.shiftUp(row, 4, 1, self.seat.copy())

        def check(old, new):
            for i in range(6):
                for j in range(7):
                    if j != 3:
                        if old[i][j] != new[i][j]:
                            return False
            return [new[i][3] for i in range(6)] == [11, 18, 25, 32, 37, 4]

        self.assertTrue(check(self.seat, new))
コード例 #6
0
    def testUpCol3(self):
        row = self.ran.randint(2, 6)
        new = algo.shiftUp(row, 3, 1, self.seat.copy())

        def check(old, new):
            for i in range(6):
                for j in range(7):
                    if j != 2:
                        if old[i][j] != new[i][j]:
                            return False
            return [new[i][2] for i in range(6)] == [10, 17, 24, 31, 36, 3]

        self.assertTrue(check(self.seat, new))
コード例 #7
0
    def testUpCol2(self):
        row = self.ran.randint(2, 5)
        new = algo.shiftUp(row, 2, 1, self.seat.copy())

        def check(old, new):
            for i in range(6):
                for j in range(7):
                    if j != 1:
                        if old[i][j] != new[i][j]:
                            return False
            return [new[i][1] for i in range(6)] == [9, 16, 23, 30, 2, 0]

        self.assertTrue(check(self.seat, new))
コード例 #8
0
 def testUpperBound(self):
     new = algo.shiftUp(1, 1, 1, self.seat.copy())
     self.assertEqual(self.seat, new)