def test_apply_break_when_current_speed_is_less_than_tyre_friction(): # Arrange truck = Truck(color="Red", max_speed=50, acceleration=10, tyre_friction=30, max_cargo_weight=100) current_speed = 0 truck.start_engine() truck.accelerate() # Act truck.apply_brakes() # Assert assert truck.current_speed == current_speed
def test_apply_break_when_current_speed_with_different_acceleration_more_than_tyre_friction_returns_current_speed(): # Arrange truck = Truck(color="Red", max_speed=50, acceleration=10, tyre_friction=3, max_cargo_weight=100) current_speed = 27 truck.start_engine() truck.accelerate() truck.accelerate() truck.accelerate() # Act truck.apply_brakes() # Assert assert truck.current_speed == current_speed
def test_apply_brakes_when_truck_current_speed_is_more_than_tyre_friction_and_update_current_speed( ): # Arrange truck = Truck(color='Blue', max_speed=5, acceleration=4, tyre_friction=3, max_cargo_weight=1) truck.start_engine() truck.accelerate() # Act truck.apply_brakes() current_speed_value = 1 # Assert assert truck.current_speed == current_speed_value