lab_cards/amazonsplay/test/test_board.py

40 lines
985 B
Python

from unittest import TestCase
from board import Board
class TestBoard(TestCase):
def setUp(self):
self.board = Board()
self.tiny = Board()
self.tiny.state = [[3,0], [0,2]]
def test_board_size_is_correct(self):
self.assertEqual(len(self.board.state), 4)
def test_in_bounds_works(self):
bad = [
(-1, 1), (5, 1)
]
good = [
(2, 2), (0, 0), (3, 3)
]
for square in bad:
self.assertFalse(self.board.in_bounds(square))
for square in good:
self.assertTrue(self.board.in_bounds(square))
def test_get_initial_state(self):
def test_get_active_player_code(self):
def test_get_active_amazons_positions(self):
def test_possible_moves(self):
def test_get_successor_state(self, move_and_burn):
def test_get_possible_successor_states(self):
def test_is_empty(self, square):
def test_get_reachable_squares(self, amazon):