Example #1
0
def test_within_bounds_false():
    """
    Tests that within bounds returns true when position in the grid
    """

    env = Environment(10, 10, 0, 0)
    assert not env.within_bounds((1, -1))
    assert not env.within_bounds((10, 4))
    assert not env.within_bounds((-5, 4))
    assert not env.within_bounds((5, 14))
Example #2
0
def test_within_bounds_true():
    """
    Tests that within bounds returns true when position in the grid
    """

    env = Environment(10, 10, 0, 0)
    assert env.within_bounds((5, 5))
Example #3
0
def test_closest_mushroom_returns_in_bounds():
    """
    Check that the closest mushroom is correctly returned
    """

    env = Environment(10, 10, 1, 1)
    pos = env.closest_mushroom((5, 5))
    assert env.within_bounds(pos)