def test_step():
    v = Vehicle(road=None, position=[0, 0], velocity=20, heading=0)
    for _ in range(2*FPS):
        v.step(dt=1/FPS)
    assert v.position[0] == pytest.approx(40)
    assert v.position[1] == pytest.approx(0)
    assert v.velocity == pytest.approx(20)
    assert v.heading == pytest.approx(0)
def test_act():
    v = Vehicle(road=None, position=[0, 0], velocity=20, heading=0)
    v.act({'acceleration': 1, 'steering': 0})
    for _ in range(1 * FPS):
        v.step(dt=1/FPS)
    assert v.velocity == pytest.approx(21)

    v.act({'acceleration': 0, 'steering': 0.5})
    for _ in range(1 * FPS):
        v.step(dt=1/FPS)
    assert v.velocity == pytest.approx(21)
    assert v.position[1] > 0
def test_brake():
    v = Vehicle(road=None, position=[0, 0], velocity=20, heading=0)
    for _ in range(10 * FPS):
        v.act({'acceleration': min(max(-1*v.velocity, -6), 6), 'steering': 0})
        v.step(dt=1/FPS)
    assert v.velocity == pytest.approx(0, abs=0.01)