Skip to content

Commit

Permalink
New tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mesozoic-drones committed Nov 9, 2023
1 parent 5e1e076 commit 8a53057
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions tests/unit_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

#include "just_gtfs/just_gtfs.h"

#include <iterator>

using namespace gtfs;

TEST_SUITE_BEGIN("Handling time GTFS fields");
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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");
Expand All @@ -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")
Expand All @@ -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")
Expand All @@ -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")
Expand All @@ -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")
Expand All @@ -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")
Expand Down

0 comments on commit 8a53057

Please sign in to comment.