From 6b10a650694b5eddc9fdaf2c0eb0d9492cf741c3 Mon Sep 17 00:00:00 2001 From: Vladimir Byko-Ianko Date: Mon, 24 Jun 2019 15:54:54 +0300 Subject: [PATCH] [routing] routing integration tests on hwtag=nocar. --- .../routing_integration_tests/route_test.cpp | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/routing/routing_integration_tests/route_test.cpp b/routing/routing_integration_tests/route_test.cpp index 1abf9cb1b4..8cdeece2a5 100644 --- a/routing/routing_integration_tests/route_test.cpp +++ b/routing/routing_integration_tests/route_test.cpp @@ -471,4 +471,27 @@ namespace MercatorBounds::FromLatLon(55.991845, 37.215312), 799.0); } */ + + // Test that fake segments are not built from start to roads with hwtag=nocar for car routing. + UNIT_TEST(SpainBilbaoAirportNoCarTest) + { + TRouteResult routeResult = + integration::CalculateRoute(integration::GetVehicleComponents(VehicleType::Car), + MercatorBounds::FromLatLon(43.29969, -2.91312), {0., 0.}, + MercatorBounds::FromLatLon(43.29904, -2.9108)); + TEST_EQUAL(routeResult.second, RouterResultCode::NoError, ()); + + CHECK(routeResult.first, ()); + Route const & route = *(routeResult.first); + std::vector const & routeSegments = route.GetRouteSegments(); + TEST_GREATER(routeSegments.size(), 2, ()); + + // Note. routeSegments[0] is a start segment(point). routeSegments[1] is a fake segment + // which goes from the route start to a segment of the road graph. + // routeSegments[1].GetDistFromBeginningMeters() is the length of the first fake segment. + // Start point is located near a road with hwtag=no. + // So if routeSegments[1].GetDistFromBeginningMeters() is long enough the segment + // with hwtag=no is no used. + TEST_GREATER(routeSegments[1].GetDistFromBeginningMeters(), 20.0, ()); + } } // namespace