def testWinsForVerticalTrue(self): b = hw.Board(7, 6) b.addMove(0, 'X') b.addMove(0, 'X') b.addMove(0, 'X') b.addMove(0, 'X') self.assertTrue(b.winsFor('X'), '** INCORRECT ** b does win for X')
def testAddMoveLastColumn(self): b = hw.Board(7, 6) b.addMove(6, 'X') answer1 = [[' '] * 7 for i in range(6)] answer1[5][6] = 'X' self.assertEqual(b.data, answer1, '** INCORRECT ** X should be in the lower right')
def testWinsForHorizontalTrue(self): b = hw.Board(7, 6) b.addMove(0, 'X') b.addMove(1, 'X') b.addMove(2, 'X') b.addMove(3, 'X') self.assertTrue(b.winsFor('X'), '** INCORRECT ** b does win for X')
def testIsFullTrue(self): b = hw.Board(2, 2) b.addMove(0, 'X') b.addMove(0, 'X') b.addMove(1, 'X') b.addMove(1, 'X') self.assertTrue(b.isFull(), '** INCORRECT ** b actually is full')
def testDelMove(self): b = hw.Board(7, 6) b.addMove(6, 'X') b.delMove(6) answer2 = [[' '] * 7 for i in range(6)] self.assertEqual(b.data, answer2, '** INCORRECT ** board should be empty')
def testIsFullFalse(self): b = hw.Board(2, 2) b.addMove(0, 'X') b.addMove(0, 'X') b.addMove(1, 'X') b.addMove(1, 'X') b.delMove(1) self.assertFalse(b.isFull(), '** INCORRECT ** b actually is not full')
def testWinsForDiagonalSWFalse(self): b = hw.Board(7, 6) b.addMove(0, 'X') b.addMove(1, 'O') b.addMove(1, 'X') b.addMove(2, 'O') b.addMove(2, 'X') b.addMove(2, 'X') b.addMove(3, 'X') b.addMove(3, 'O') b.addMove(3, 'X') self.assertFalse(b.winsFor('X'), '** INCORRECT ** b does not win for X')
def testWinsForDiagonalSETrue(self): print "\n\nTEST 8" b = hw.Board(7, 6) b.addMove(6, 'X') b.addMove(5, 'O') b.addMove(5, 'X') b.addMove(4, 'O') b.addMove(4, 'X') b.addMove(4, 'X') b.addMove(3, 'X') b.addMove(3, 'O') b.addMove(3, 'X') b.addMove(3, 'X') self.assertTrue(b.winsFor('X'), '** INCORRECT ** b does win for X')