def testDownCol1(self): row = self.ran.randint(1, 4) new = algo.shiftDown(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)] == [29, 1, 8, 15, 22, 0] self.assertTrue(check(self.seat, new))
def testDownCol7(self): row = self.ran.randint(1, 4) new = algo.shiftDown(row, 7, 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][6] for i in range(6)] == [35, 7, 14, 21, 28, 0] self.assertTrue(check(self.seat, new))
def testDownCol5(self): row = self.ran.randint(1, 5) new = algo.shiftDown(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)] == [38, 5, 12, 19, 26, 33] self.assertTrue(check(self.seat, new))
def testDownCol4(self): row = self.ran.randint(1, 5) new = algo.shiftDown(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)] == [37, 4, 11, 18, 25, 32] self.assertTrue(check(self.seat, new))
def testDownCol3(self): row = self.ran.randint(1, 5) new = algo.shiftDown(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)] == [36, 3, 10, 17, 24, 31] self.assertTrue(check(self.seat, new))
def testDownCol2(self): row = self.ran.randint(1, 4) new = algo.shiftDown(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)] == [30, 2, 9, 16, 23, 0] self.assertTrue(check(self.seat, new))
def testCenterLowerBound(self): new = algo.shiftDown(6, 3, 1, self.seat.copy()) self.assertEqual(self.seat, new)
def testRightLowerBound(self): new = algo.shiftDown(5, 7, 1, self.seat.copy()) self.assertEqual(self.seat, new)