From 5fd8d66fcd6f6ab65eee262190bbfb7e2cdb0b16 Mon Sep 17 00:00:00 2001 From: Vladimir Byko-Ianko Date: Thu, 1 Feb 2018 15:33:09 +0300 Subject: [PATCH] Adding test on uturn notification. --- .../bicycle_turn_test.cpp | 32 ++++++++++++++----- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/routing/routing_integration_tests/bicycle_turn_test.cpp b/routing/routing_integration_tests/bicycle_turn_test.cpp index e29ef59e51..981b566ad5 100644 --- a/routing/routing_integration_tests/bicycle_turn_test.cpp +++ b/routing/routing_integration_tests/bicycle_turn_test.cpp @@ -41,23 +41,39 @@ UNIT_TEST(RussiaMoscowGerPanfilovtsev22BicycleWayTurnTest) integration::GetNthTurn(route, 1).TestValid().TestDirection(CarDirection::TurnLeft); } -// Fails to generate direction. +// This test fails. The reason is DiscardTurnByIngoingAndOutgoingEdges() method which +// discard turn candidates at very beginning stage by marks which are possible to get +// effectively. After moving to IndexGraph all marks are possible to get efficiently. +// So DiscardTurnByIngoingAndOutgoingEdges() method should be removed. UNIT_TEST(RussiaMoscowSalameiNerisPossibleTurnCorrectionBicycleWayTurnTest) { TRouteResult const routeResult = integration::CalculateRoute(integration::GetVehicleComponents(), - MercatorBounds::FromLatLon(55.85777, 37.3679), {0.0, 0.0}, - MercatorBounds::FromLatLon(55.85579, 37.36867)); + MercatorBounds::FromLatLon(55.85833, 37.36783), {0.0, 0.0}, + MercatorBounds::FromLatLon(55.85364, 37.37318)); Route const & route = *routeResult.first; IRouter::ResultCode const result = routeResult.second; TEST_EQUAL(result, IRouter::NoError, ()); - integration::TestTurnCount(route, 1 /* expectedTurnCount */); - integration::GetNthTurn(route, 0).TestValid() - .TestOneOfDirections({CarDirection::GoStraight, - CarDirection::TurnSlightRight, - CarDirection::TurnRight}); + integration::TestTurnCount(route, 2 /* expectedTurnCount */); + integration::GetNthTurn(route, 0).TestValid().TestDirection(CarDirection::TurnRight); + integration::GetNthTurn(route, 1).TestValid().TestDirection(CarDirection::TurnLeft); +} + +// Test that there's no uturn notification in case of zero point edges on two way edges. +UNIT_TEST(RussiaMoscowSalameiNerisNoUTurnBicycleWayTurnTest) +{ + TRouteResult const routeResult = + integration::CalculateRoute(integration::GetVehicleComponents(), + MercatorBounds::FromLatLon(55.85839, 37.3677), {0.0, 0.0}, + MercatorBounds::FromLatLon(55.85765, 37.36793)); + + Route const & route = *routeResult.first; + IRouter::ResultCode const result = routeResult.second; + TEST_EQUAL(result, IRouter::NoError, ()); + + integration::TestTurnCount(route, 0 /* expectedTurnCount */); } // Fails to build one-point route.