From 13a46b263c640f7f7c96334012a2377215ccf7d0 Mon Sep 17 00:00:00 2001 From: Anton Makouski Date: Tue, 17 May 2022 16:16:02 +0300 Subject: [PATCH] [Routing] Don't ignore service roads on small roundabouts Fixed #2570. Test added. Signed-off-by: Anton Makouski --- routing/car_directions.cpp | 4 +++- .../routing_integration_tests/turn_test.cpp | 24 +++++++++++++++++-- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/routing/car_directions.cpp b/routing/car_directions.cpp index 95fb33792e..184fab9e32 100644 --- a/routing/car_directions.cpp +++ b/routing/car_directions.cpp @@ -177,7 +177,9 @@ bool KeepRoundaboutTurnByHighwayClass(TurnCandidates const & possibleTurns, { if (t.m_segment == firstOutgoingSegment) continue; - if (t.m_highwayClass != HighwayClass::Service) + // For roundabouts of Tertiary and less significant class count every road. + // For more significant roundabouts - ignore service roads. + if (turnInfo.m_outgoing->m_highwayClass >= HighwayClass::Tertiary || t.m_highwayClass != HighwayClass::Service) return true; } return false; diff --git a/routing/routing_integration_tests/turn_test.cpp b/routing/routing_integration_tests/turn_test.cpp index 5729d1a4e7..8c251bfa64 100644 --- a/routing/routing_integration_tests/turn_test.cpp +++ b/routing/routing_integration_tests/turn_test.cpp @@ -246,7 +246,7 @@ UNIT_TEST(Russia_Moscow_PankratevskiPerBolshaySuharedskazPloschad_TurnTest) std::vector t; route.GetTurnsForTesting(t); - + integration::TestTurnCount(route, 5 /* expectedTurnCount */); integration::GetNthTurn(route, 0).TestValid().TestDirection(CarDirection::TurnRight); integration::GetNthTurn(route, 1).TestValid().TestDirection(CarDirection::TurnLeft); @@ -1096,7 +1096,7 @@ UNIT_TEST(Cyprus_NicosiaSchoolParking_TurnTest) integration::GetNthTurn(route, 0).TestValid().TestDirection(CarDirection::TurnSlightLeft); } -UNIT_TEST(Cyprus_NicosiaStartRoundAbout_TurnTest) +UNIT_TEST(Cyprus_NicosiaStartRoundabout_TurnTest) { // Start movement at roundabout. TRouteResult const routeResult = @@ -1118,6 +1118,26 @@ UNIT_TEST(Cyprus_NicosiaStartRoundAbout_TurnTest) integration::GetNthTurn(route, 2).TestValid().TestRoundAboutExitNum(3); } +UNIT_TEST(Cyprus_NicosiaSmallRoundabout_TurnTest) +{ + TRouteResult const routeResult = + integration::CalculateRoute(integration::GetVehicleComponents(VehicleType::Car), + mercator::FromLatLon(35.13103, 33.37222), {0., 0.}, + mercator::FromLatLon(35.13099, 33.37089)); + + Route const & route = *routeResult.first; + RouterResultCode const result = routeResult.second; + + // Issue #2570. + // Don't ignore exit to parking for this small roundabout. + TEST_EQUAL(result, RouterResultCode::NoError, ()); + integration::TestTurnCount(route, 2 /* expectedTurnCount */); + integration::GetNthTurn(route, 0).TestValid().TestDirection(CarDirection::EnterRoundAbout); + integration::GetNthTurn(route, 0).TestValid().TestRoundAboutExitNum(2); + integration::GetNthTurn(route, 1).TestValid().TestDirection(CarDirection::LeaveRoundAbout); + integration::GetNthTurn(route, 1).TestValid().TestRoundAboutExitNum(2); +} + UNIT_TEST(Cyprus_A1AlphaMega_TurnTest) { TRouteResult const routeResult =