From 54cbfb1ef417f644b8a783a6d8f2ac5be4825460 Mon Sep 17 00:00:00 2001 From: Vladimir Byko-Ianko Date: Thu, 19 Nov 2020 13:21:53 +0300 Subject: [PATCH] [routing] Adding two routing integration tests on two thread A* bidirectional routing. --- .../pedestrian_route_test.cpp | 10 ++++++++++ routing/routing_integration_tests/route_test.cpp | 11 +++++++++++ .../routing_integration_tests/routing_test_tools.cpp | 4 ++-- .../routing_integration_tests/routing_test_tools.hpp | 2 +- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/routing/routing_integration_tests/pedestrian_route_test.cpp b/routing/routing_integration_tests/pedestrian_route_test.cpp index d366f0f7e83..96508280575 100644 --- a/routing/routing_integration_tests/pedestrian_route_test.cpp +++ b/routing/routing_integration_tests/pedestrian_route_test.cpp @@ -581,3 +581,13 @@ UNIT_TEST(NoTurnOnForkingRoad2) TEST_EQUAL(t[0].m_pedestrianTurn, PedestrianDirection::TurnRight, ()); } + +// Test on two threads A* bidirectional routing. +UNIT_TEST(RussiaMoscowTarusaTwoThreads) +{ + integration::CalculateRouteAndTestRouteLength( + integration::GetVehicleComponents(VehicleType::Pedestrian), + mercator::FromLatLon(55.85779, 37.40948), {0.0, 0.0}, + mercator::FromLatLon(54.71961, 37.19449), 162575.0, 0.07 /* relativeError */, + true /* useTwoThreads */); +} diff --git a/routing/routing_integration_tests/route_test.cpp b/routing/routing_integration_tests/route_test.cpp index d91f3a4f3a7..e9649a8bd25 100644 --- a/routing/routing_integration_tests/route_test.cpp +++ b/routing/routing_integration_tests/route_test.cpp @@ -572,4 +572,15 @@ namespace integration::GetVehicleComponents(VehicleType::Car), mercator::FromLatLon(55.31103, 38.80954), {0., 0.}, mercator::FromLatLon(55.31155, 38.8217), 2489.8); } + + // Test on two threads A* bidirectional routing. + UNIT_TEST(RussiaMoscowStStPetersburgTwoThreads) + { + auto & vehicleComponents = integration::GetVehicleComponents(VehicleType::Car); + + integration::CalculateRouteAndTestRouteLength( + vehicleComponents, mercator::FromLatLon(55.74942, 37.62118), {0.0, 0.0}, + mercator::FromLatLon(59.9394, 30.31492), 706503.0, 0.07 /* relativeError */, + true /* useTwoThreads */); + } } // namespace diff --git a/routing/routing_integration_tests/routing_test_tools.cpp b/routing/routing_integration_tests/routing_test_tools.cpp index d8665ab4dda..ef8731ed17f 100644 --- a/routing/routing_integration_tests/routing_test_tools.cpp +++ b/routing/routing_integration_tests/routing_test_tools.cpp @@ -236,10 +236,10 @@ void CalculateRouteAndTestRouteLength(IRouterComponents const & routerComponents m2::PointD const & startPoint, m2::PointD const & startDirection, m2::PointD const & finalPoint, double expectedRouteMeters, - double relativeError /* = 0.07 */) + double relativeError /* = 0.07 */, bool useTwoThreads /* = false */) { TRouteResult routeResult = - CalculateRoute(routerComponents, startPoint, startDirection, finalPoint); + CalculateRoute(routerComponents, startPoint, startDirection, finalPoint, useTwoThreads); RouterResultCode const result = routeResult.second; TEST_EQUAL(result, RouterResultCode::NoError, ()); CHECK(routeResult.first, ()); diff --git a/routing/routing_integration_tests/routing_test_tools.hpp b/routing/routing_integration_tests/routing_test_tools.hpp index fcf09ddb560..6c8dd3043e1 100644 --- a/routing/routing_integration_tests/routing_test_tools.hpp +++ b/routing/routing_integration_tests/routing_test_tools.hpp @@ -129,7 +129,7 @@ void CalculateRouteAndTestRouteLength(IRouterComponents const & routerComponents m2::PointD const & startPoint, m2::PointD const & startDirection, m2::PointD const & finalPoint, double expectedRouteMeters, - double relativeError = 0.07); + double relativeError = 0.07, bool useTwoThreads = false); void CalculateRouteAndTestRouteTime(IRouterComponents const & routerComponents, m2::PointD const & startPoint,