From 3a4a9ef1fc72c01d12f07c3ebf76d8929795ac8b Mon Sep 17 00:00:00 2001 From: Vladimir Byko-Ianko Date: Thu, 8 Feb 2018 18:32:36 +0300 Subject: [PATCH] Test fix. One point route near one way road. --- routing/index_graph_starter.cpp | 4 +++- .../routing_integration_tests/bicycle_turn_test.cpp | 13 +++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/routing/index_graph_starter.cpp b/routing/index_graph_starter.cpp index 22221bdf46..fc42001cb8 100644 --- a/routing/index_graph_starter.cpp +++ b/routing/index_graph_starter.cpp @@ -298,8 +298,10 @@ void IndexGraphStarter::AddEnding(FakeEnding const & thisEnding, FakeEnding cons otherJunction.GetPoint()); if (distBackToThis < distBackToOther) frontJunction = otherJunction; - else + else if (distBackToOther < distBackToThis) backJunction = otherJunction; + else + frontJunction = backJunction = otherJunction; } FakeVertex forwardPartOfReal(isStart ? projection.m_junction : backJunction, diff --git a/routing/routing_integration_tests/bicycle_turn_test.cpp b/routing/routing_integration_tests/bicycle_turn_test.cpp index f986bca74e..09f64b1f1e 100644 --- a/routing/routing_integration_tests/bicycle_turn_test.cpp +++ b/routing/routing_integration_tests/bicycle_turn_test.cpp @@ -80,8 +80,7 @@ UNIT_TEST(RussiaMoscowSalameiNerisNoUTurnBicycleWayTurnTest) integration::GetNthTurn(route, 0).TestValid().TestDirection(CarDirection::TurnRight); } -// Fails to build one-point route. -UNIT_TEST(RussiaMoscowSevTushinoParkBicycleOnePointTurnTest) +UNIT_TEST(RussiaMoscowSevTushinoParkBicycleOnePointOnewayRoadTurnTest) { m2::PointD const point = MercatorBounds::FromLatLon(55.8719, 37.4464); TRouteResult const routeResult = integration::CalculateRoute( @@ -91,6 +90,16 @@ UNIT_TEST(RussiaMoscowSevTushinoParkBicycleOnePointTurnTest) TEST_EQUAL(result, IRouter::IRouter::NoError, ()); } +UNIT_TEST(RussiaMoscowSevTushinoParkBicycleOnePointTwowayRoadTurnTest) +{ + m2::PointD const point = MercatorBounds::FromLatLon(55.87102, 37.44222); + TRouteResult const routeResult = integration::CalculateRoute( + integration::GetVehicleComponents(), point, {0.0, 0.0}, point); + + IRouter::ResultCode const result = routeResult.second; + TEST_EQUAL(result, IRouter::IRouter::NoError, ()); +} + UNIT_TEST(RussiaMoscowTatishchevaOnewayCarRoadTurnTest) { TRouteResult const routeResult =