UTurn integration test.

This commit is contained in:
Lev Dragunov 2015-11-17 19:07:10 +03:00
parent 95632ac11f
commit 135a8b2b15
3 changed files with 24 additions and 5 deletions

View file

@ -23,7 +23,7 @@ UNIT_TEST(RussiaMoscowLenigradskiy39UturnTurnTest)
integration::GetNthTurn(route, 0)
.TestValid()
.TestOneOfDirections({TurnDirection::TurnSlightLeft, TurnDirection::TurnLeft});
.TestDirection(TurnDirection::UTurnLeft);
integration::GetNthTurn(route, 1)
.TestValid()
.TestDirection(TurnDirection::TurnRight);
@ -138,6 +138,22 @@ UNIT_TEST(RussiaMoscowTTKKashirskoeShosseOutTurnTest)
{TurnDirection::TurnSlightRight, TurnDirection::TurnRight});
}
UNIT_TEST(RussiaMoscowSchelkovskoeShosseUTurnTest)
{
TRouteResult const routeResult = integration::CalculateRoute(
integration::GetOsrmComponents(),
MercatorBounds::FromLatLon(55.80967, 37.78037), {0., 0.},
MercatorBounds::FromLatLon(55.80955, 37.78056));
Route const & route = *routeResult.first;
IRouter::ResultCode const result = routeResult.second;
TEST_EQUAL(result, IRouter::NoError, ());
integration::TestTurnCount(route, 1);
// Checking a turn in case going from a not-link to a link
integration::GetNthTurn(route, 0).TestValid().TestDirection(TurnDirection::UTurnLeft);
}
UNIT_TEST(RussiaMoscowPankratevskiPerBolshaySuharedskazPloschadTurnTest)
{
TRouteResult const routeResult = integration::CalculateRoute(
@ -345,8 +361,8 @@ UNIT_TEST(RussiaMoscowLeningradskiyPrptToTheCenterUTurnTest)
IRouter::ResultCode const result = routeResult.second;
TEST_EQUAL(result, IRouter::NoError, ());
integration::TestTurnCount(route, 2);
integration::GetNthTurn(route, 0).TestValid().TestDirection(TurnDirection::TurnLeft);
integration::TestTurnCount(route, 1);
integration::GetNthTurn(route, 0).TestValid().TestDirection(TurnDirection::UTurnLeft);
}
// Test case: checking that no unnecessary turn on a serpentine road.

View file

@ -890,7 +890,7 @@ void GetTurnDirection(Index const & index, RoutingMapping & mapping, TurnInfo &
size_t CheckUTurnOnRoute(vector<LoadedPathSegment> const & segments, size_t currentSegment, TurnItem & turn)
{
size_t constexpr kUTurnLookAhead = 5;
size_t constexpr kUTurnLookAhead = 3;
double const kUTurnHeadingSensitivity = math::pi / 10.0;
ASSERT_GREATER(segments.size(), 1, ());
@ -930,6 +930,10 @@ size_t CheckUTurnOnRoute(vector<LoadedPathSegment> const & segments, size_t curr
turn.m_turn = TurnDirection::UTurnRight;
return ++i;
}
else
{
return 0;
}
}
}

View file

@ -148,6 +148,5 @@ void GetTurnDirection(Index const & index, RoutingMapping & mapping, turns::Turn
* Returns 0 otherwise.
*/
size_t CheckUTurnOnRoute(vector<LoadedPathSegment> const & segments, size_t currentSegment, TurnItem & turn);
} // namespace routing
} // namespace turns