def test_cell_sum(self): game_board = GameBoard() self.assertFalse(game_board.check_for_win()) game_board.set_cell(3,1) game_board.set_cell(5,1) game_board.set_cell(7,1) self.assertTrue(game_board.check_for_win())
def test_cell_sum(self): game_board = GameBoard() game_board.set_cell(1,1) game_board.set_cell(2,3) game_board.set_cell(3,5) cell_list = [1,2,3] self.assertEquals(game_board.sum_cells(cell_list), 9)
def test_find_empty_cell(self): game_board = GameBoard() game_board.set_cell(1,1) game_board.set_cell(2,1) cell_list = [1,2,3] cell = game_board.get_empty_cell(cell_list) print game_board self.assertTrue(cell,3)
def test_computer_player(self): game_board = GameBoard() computerplayer = ComputerPlayer("Computer",game_board,1) name = computerplayer.name # Set first two cells and should return last cell game_board.set_cell(1,4) game_board.set_cell(2,4) cell_list = [1,2,3] cell = computerplayer.get_best_empty_cell(cell_list) self.assertEquals(cell,3) # Set last two cells and should return first cell game_board.set_cell(5,4) game_board.set_cell(6,4) cell_list = [4,5,6] cell = computerplayer.get_best_empty_cell(cell_list) self.assertEquals(cell,4)
def test_get_cell(self): game_board = GameBoard() game_board.set_cell(3,1) self.assertEquals(game_board.get_cell(3), 1)
def test_set_cell(self): game_board = GameBoard() game_board.set_cell(3,1) self.assertFalse(game_board.is_cell_empty(3))