From 226a7e01c993456cd883f50049aed14eb3c53075 Mon Sep 17 00:00:00 2001 From: tatiana-yan Date: Wed, 3 Mar 2021 12:12:30 +0300 Subject: [PATCH] [transit][world_feed] Add integration tests. --- .../world_feed_integration_tests.cpp | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/transit/world_feed/world_feed_integration_tests/world_feed_integration_tests.cpp b/transit/world_feed/world_feed_integration_tests/world_feed_integration_tests.cpp index 0a15befbd3..dd2158c058 100644 --- a/transit/world_feed/world_feed_integration_tests/world_feed_integration_tests.cpp +++ b/transit/world_feed/world_feed_integration_tests/world_feed_integration_tests.cpp @@ -74,6 +74,31 @@ public: TEST_EQUAL(m_globalFeed.m_edgesTransfers.m_data.size(), 0, ()); } + void ReadFeedWithMultipleShapeProjections() + { + gtfs::Feed feed(base::JoinPath(m_testPath, "feed_with_multiple_shape_projections")); + TEST_EQUAL(feed.read_feed().code, gtfs::ResultCode::OK, ()); + TEST(m_globalFeed.SetFeed(std::move(feed)), ()); + + TEST_EQUAL(m_globalFeed.m_networks.m_data.size(), 1, ()); + TEST_EQUAL(m_globalFeed.m_routes.m_data.size(), 1, ()); + TEST_EQUAL(m_globalFeed.m_lines.m_data.size(), 2, ()); + TEST_EQUAL(m_globalFeed.m_stops.m_data.size(), 16, ()); + TEST_EQUAL(m_globalFeed.m_shapes.m_data.size(), 1, ()); + TEST_EQUAL(m_globalFeed.m_gates.m_data.size(), 0, ()); + TEST_EQUAL(m_globalFeed.m_transfers.m_data.size(), 2, ()); + TEST_EQUAL(m_globalFeed.m_edges.m_data.size(), 27, ()); + TEST_EQUAL(m_globalFeed.m_edgesTransfers.m_data.size(), 2, ()); + } + + void ReadFeedWithWrongStopsOrder() + { + gtfs::Feed feed(base::JoinPath(m_testPath, "feed_with_wrong_stops_order")); + TEST_EQUAL(feed.read_feed().code, gtfs::ResultCode::OK, ()); + // Feed has wrong stops order (impossible for trip shape) and should be rejected. + TEST(!m_globalFeed.SetFeed(std::move(feed)), ()); + } + // Test for train itinerary that passes through 4 regions in Europe and consists of 4 stops // (each in separate mwm) and 1 route with 1 line. This line passes through 4 stops: // [1] Switzerland_Ticino -> [2] Switzerland_Eastern -> @@ -138,4 +163,14 @@ UNIT_CLASS_TEST(WorldFeedIntegrationTests, FeedWithLongItinerary) { SplitFeedIntoMultipleRegions(); } + +UNIT_CLASS_TEST(WorldFeedIntegrationTests, FeedWithMultipleShapeProjections) +{ + ReadFeedWithMultipleShapeProjections(); +} + +UNIT_CLASS_TEST(WorldFeedIntegrationTests, FeedWithWrongStopsOrder) +{ + ReadFeedWithWrongStopsOrder(); +} } // namespace transit