From 6e334a595c758fd99cbea506fba7167c7f229e0b Mon Sep 17 00:00:00 2001 From: Olga Khlopkova Date: Tue, 10 Dec 2019 17:35:37 +0300 Subject: [PATCH] [Routing] Integration test for mini-roundabouts. --- .../routing_integration_tests/CMakeLists.txt | 1 + .../roundabouts_tests.cpp | 42 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 routing/routing_integration_tests/roundabouts_tests.cpp diff --git a/routing/routing_integration_tests/CMakeLists.txt b/routing/routing_integration_tests/CMakeLists.txt index a629a0e099..5444776df1 100644 --- a/routing/routing_integration_tests/CMakeLists.txt +++ b/routing/routing_integration_tests/CMakeLists.txt @@ -15,6 +15,7 @@ set( online_cross_tests.cpp pedestrian_route_test.cpp road_graph_tests.cpp + roundabouts_tests.cpp route_test.cpp routing_test_tools.cpp routing_test_tools.hpp diff --git a/routing/routing_integration_tests/roundabouts_tests.cpp b/routing/routing_integration_tests/roundabouts_tests.cpp new file mode 100644 index 0000000000..1fc3f2bc07 --- /dev/null +++ b/routing/routing_integration_tests/roundabouts_tests.cpp @@ -0,0 +1,42 @@ +#include "testing/testing.hpp" + +#include "routing/routing_integration_tests/routing_test_tools.hpp" + +#include "routing/route.hpp" +#include "routing/routing_callbacks.hpp" + +#include "geometry/latlon.hpp" + +#include + +using namespace routing; + +namespace +{ +struct RouteData +{ + ms::LatLon m_start; + ms::LatLon m_finish; + double m_routeLengthM; +}; + +UNIT_TEST(MiniRoundabout_CalculateRoute) +{ + std::vector const routesWithMiniRoundabouts{ + {{51.45609, 0.05974}, {51.45562, 0.06005}, 61.3}, + {{51.49746, -0.40027}, {51.49746, -0.40111}, 63.1}, + {{55.98700, -3.38256}, {55.98665, -3.38260}, 43.6}, + {{52.22163, 21.09296}, {52.22189, 21.09286}, 41.5}}; + + for (auto const & route : routesWithMiniRoundabouts) + { + TRouteResult const routeResult = integration::CalculateRoute( + integration::GetVehicleComponents(VehicleType::Car), mercator::FromLatLon(route.m_start), + {0.0, 0.0}, mercator::FromLatLon(route.m_finish)); + + TEST_EQUAL(routeResult.second, RouterResultCode::NoError, ()); + + integration::TestRouteLength(*routeResult.first, route.m_routeLengthM); + } +} +} // namespace