def test_board_should_yield_starting_positions(): # given description = [['u']] Position(0, 0) # when board = Board(description) # then assert next(board.starting_positions()) == Position(0, 0)
def positions_on_board(): Position.max_x = 3 Position.max_y = 3 return [ Position(2, 2), Position(0, 0), Position(0, 3), Position(3, 0), Position(3, 3) ]
def positions_not_on_board(): Position.max_x = 3 Position.max_y = 3 return [ Position(4, 3), Position(3, 4), Position(4, 4), Position(-1, 4), Position(2, -1) ]
def test_board_gets_direction_for_position(): # given description = [['u']] position = Position(0, 0) # when board = Board(description) # then assert board[position] == Direction.from_symbol('u')
def test_board_should_clear_visited_directions(): # given description = [['u']] position = Position(0, 0) # when board = Board(description) board[position].is_visited = True board.clear_visited_directions() # then assert board[position].is_visited is False
def positions_should_increment_when_direction_added(): position = Position(0, 0) position += Direction(1, 0) assert position == Position(1, 0)
def positions_should_be_equal_when_the_same_coordinates(): assert Position(0, 0) == Position(0, 0)
def start_pos(): return Position(0, 0)