diff --git a/tests/unit_tests.cpp b/tests/unit_tests.cpp index 990971d..f087f48 100644 --- a/tests/unit_tests.cpp +++ b/tests/unit_tests.cpp @@ -3,6 +3,8 @@ #include "just_gtfs/just_gtfs.h" +#include + using namespace gtfs; TEST_SUITE_BEGIN("Handling time GTFS fields"); @@ -291,7 +293,6 @@ TEST_CASE("Calendar dates") CHECK_EQ(calendar_records_range.first->date, Date(2007, 06, 04)); CHECK_EQ(calendar_records_range.first->exception_type, CalendarDateException::Removed); - CHECK_EQ(calendar_records_range.first, calendar_records_range.second); } TEST_CASE("Read GTFS feed") @@ -332,7 +333,7 @@ TEST_CASE("Agency") CHECK_EQ(agencies[0].agency_timezone, "America/Los_Angeles"); const auto agency = feed.get_agency("DTA"); - //CHECK(agency); + CHECK_EQ(agency.agency_name, "Demo Transit Authority"); REQUIRE_EQ(feed.write_agencies("data/output_feed"), ResultCode::OK); Feed feed_copy("data/output_feed"); @@ -356,8 +357,9 @@ TEST_CASE("Routes") CHECK(routes[0].route_color.empty()); CHECK(routes[0].route_desc.empty()); - //const auto & route = feed.get_route("AB"); - //CHECK(route); + const auto & route = feed.get_route("AB"); + CHECK_EQ(route.agency_id, "DTA"); + CHECK_EQ(route.route_type, RouteType::Bus); } TEST_CASE("Trips") @@ -376,9 +378,8 @@ TEST_CASE("Trips") CHECK_EQ(trips[0].service_id, "FULLW"); CHECK_EQ(trips[0].trip_id, "AB1"); - //const auto & trip = feed.get_trip("AB1"); - //REQUIRE(trip); - // CHECK(trip.value().trip_short_name.empty()); + const auto & trip = feed.get_trip("AB1"); + CHECK(trip.trip_short_name.empty()); } TEST_CASE("Stops") @@ -398,8 +399,8 @@ TEST_CASE("Stops") CHECK_EQ(stops[0].location_type, StopLocationType::StopOrPlatform); CHECK(stops[0].zone_id.empty()); - //auto const & stop = feed.get_stop("FUR_CREEK_RES"); - //REQUIRE(stop); + auto const & stop = feed.get_stop("FUR_CREEK_RES"); + CHECK_EQ(stop.stop_name, "Furnace Creek Resort (Demo)"); } TEST_CASE("StopTimes") @@ -420,7 +421,10 @@ TEST_CASE("StopTimes") CHECK_EQ(stop_times[0].drop_off_type, StopTimeBoarding::RegularlyScheduled); CHECK_EQ(feed.get_stop_times_for_stop("STAGECOACH").size(), 3); - // CHECK_EQ(feed.get_stop_times_for_trip("STBA").size(), 2); + + CHECK_EQ(std::distance(feed.get_stop_times_for_trip("STBA").first, + feed.get_stop_times_for_trip("STBA").second), + 2); } TEST_CASE("Shapes") @@ -436,9 +440,8 @@ TEST_CASE("Shapes") CHECK_EQ(shapes[0].shape_pt_sequence, 50017); CHECK_EQ(shapes[0].shape_dist_traveled, 12669); - //const auto & shape = feed.get_shape("10237"); - - // CHECK_EQ(shape.size(), 4); + const auto & shape = feed.get_shape("10237"); + CHECK_EQ(std::distance(shape.first, shape.second), 4); } TEST_CASE("Calendar")