@@ -1308,12 +1308,14 @@ TEST_CASE("Vehicle") {
13081308TEST_CASE (" Street" ) {
13091309 SUBCASE (" Constructor exceptions" ) {
13101310 /* This test tests if the constructor throws an exception
1311- The constructor should throw an exception if the length is negative or if
1312- the index is negative
1311+ The constructor should throw an exception one of the arguments is negative
13131312 GIVEN: the constructor is called with length -10 or index -1
13141313 WHEN: the Street is created
13151314 THEN: the function should throw an exception
13161315 */
1316+ CHECK_THROWS (Street (-3 , 1 , 1 ., 0 ));
1317+ CHECK_THROWS (Street (0 , -1 , 1 ., 0 ));
1318+ CHECK_THROWS (Street (-5 , -9 , 3 ., 0 ));
13171319 CHECK_THROWS (Street (0 , 1 , -10 ., 0 ));
13181320 CHECK_THROWS (Street (0 , 1 , 10 ., -1 ));
13191321 }
@@ -1342,6 +1344,18 @@ TEST_CASE("Street") {
13421344 CHECK (s.getVehicleDensity () == doctest::Approx (0 .));
13431345 CHECK (s.getNLanes () == 1 );
13441346 }
1347+ SUBCASE (" origin and destination" ) {
1348+ /* This test tests if the getOrigin and getDestination functions work
1349+ correctly The getOrigin function should return the origin of the street The
1350+ getDestination function should return the destination of the street
1351+ GIVEN: the constructor is called with origin 3 and destination 9
1352+ WHEN: the street is created
1353+ THEN: the street should have origin 0 and destination 1
1354+ */
1355+ Street s (3 , 9 , 10 ., 0 );
1356+ CHECK (s.getOrigin () == 3 );
1357+ CHECK (s.getDestination () == 9 );
1358+ }
13451359 SUBCASE (" setNLanes exception" ) {
13461360 /* This test tests if the setNLanes function throws an exception
13471361 The setNLanes function should throw an exception if the number of lanes is
0 commit comments