Beispiel #1
0
def test_is_inside_returns_true_for_corner_location():
    """ Test is_inside """
    maze = Maze(maze_size=7)
    assert maze.is_inside(BoardLocation(maze.maze_size-1, maze.maze_size-1))
    assert maze.is_inside(BoardLocation(0, maze.maze_size-1))
    maze = Maze(maze_size=9)
    assert maze.is_inside(BoardLocation(maze.maze_size-1, 3))
    assert maze.is_inside(BoardLocation(4, maze.maze_size-1))
Beispiel #2
0
def test_is_inside_returns_true_for_inside_location():
    """ Test is_inside """
    maze = Maze(maze_size=7)
    assert maze.is_inside(BoardLocation(3, 3))
    assert maze.is_inside(BoardLocation(1, 5))
    maze = Maze(maze_size=9)
    assert maze.is_inside(BoardLocation(7, 7))
    assert maze.is_inside(BoardLocation(7, 1))
Beispiel #3
0
def test_is_inside_returns_false_for_outside_locations():
    """ Test is_inside """
    maze = Maze(maze_size=7)
    assert not maze.is_inside(BoardLocation(-1, 4))
    assert not maze.is_inside(BoardLocation(maze.maze_size, 2))
    assert not maze.is_inside(BoardLocation(0, 14))
    assert not maze.is_inside(BoardLocation(14, -14))
    assert not maze.is_inside(BoardLocation(7, 7))
    maze = Maze(maze_size=9)
    assert not maze.is_inside(BoardLocation(14, -14))
    assert not maze.is_inside(BoardLocation(5, 9))