Skip to content

Commit

Permalink
added CHECKS for Street::addVehicle()
Browse files Browse the repository at this point in the history
  • Loading branch information
Grufoony committed Jun 30, 2023
1 parent 7544787 commit aedf324
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1040,8 +1040,13 @@ TEST_CASE("Street") {
// VehicleType is added in the Vehicle test
// Create a street
Street s(0, 1, 10., 0);
// Add a vehicle
s.addVehicle(std::make_shared<Vehicle>(0));
auto v = std::make_shared<Vehicle>(0);
s.addVehicle(v);
// Check modified attributes of vehicle
CHECK(v->getPosition() == 1);
CHECK(v->getVelocity() == s.getVMax());
CHECK(v->getStreet() == 0);
CHECK(v->getTimePenalty() == static_cast<int>(10. / v->getVelocity()));
// Check the number of vehicles
CHECK(s.getNVehicles() == 1);
// Remove a vehicle
Expand Down

0 comments on commit aedf324

Please sign in to comment.