Adding tests on turn generation fixes which was made before.

This commit is contained in:
Vladimir Byko-Ianko 2015-02-19 08:47:37 +03:00 committed by Alex Zolotarev
parent f7429d2ce7
commit db0f5fcfdf

View file

@ -33,18 +33,146 @@ UNIT_TEST(RussiaMoscowSalameiNerisUturnTurnTest)
{
shared_ptr<integration::OsrmRouterComponents> routerComponents = integration::GetAllMaps();
RouteResultT const routeResult = integration::CalculateRoute(routerComponents, {37.395332276656617, 67.633925439079519},
{0., 0.}, {37.392503720352721, 67.61975260731343});
{0., 0.}, {37.392503720352721, 67.61975260731343});
shared_ptr<Route> const route = routeResult.first;
OsrmRouter::ResultCode const result = routeResult.second;
TEST_EQUAL(result, OsrmRouter::NoError, ());
integration::TestTurnCount(route, 4);
integration::GetNthTurn(route, 0).TestValid().TestPoint({37.388482521388539, 67.633382734905041}, 5.)
.TestOneOfDirections({turns::GoStraight, turns::TurnSlightRight});
.TestDirection(turns::TurnSlightRight);
integration::GetNthTurn(route, 1).TestValid().TestPoint({37.387117276989784, 67.633369323859881}).TestDirection(turns::TurnLeft);
integration::GetNthTurn(route, 2).TestValid().TestPoint({37.387380133475205, 67.632781920081243}).TestDirection(turns::TurnLeft);
integration::GetNthTurn(route, 3).TestValid().TestPoint({37.390526364673121, 67.633106467374461}).TestDirection(turns::TurnRight);
integration::TestTurnCount(route, 4);
integration::TestRouteLength(route, 1637.);
}
UNIT_TEST(RussiaMoscowTrikotagniAndPohodniRoundaboutTurnTest)
{
shared_ptr<integration::OsrmRouterComponents> routerComponents = integration::GetAllMaps();
RouteResultT const routeResult = integration::CalculateRoute(routerComponents, {37.405153751040686, 67.5971698246356},
{0., 0.}, {37.40521071657038, 67.601903779043795});
shared_ptr<Route> const route = routeResult.first;
OsrmRouter::ResultCode const result = routeResult.second;
TEST_EQUAL(result, OsrmRouter::NoError, ());
integration::TestTurnCount(route, 2);
integration::GetNthTurn(route, 0).TestValid().TestDirection(turns::EnterRoundAbout).TestRoundAboutExitNum(2);
integration::GetNthTurn(route, 1).TestValid().TestDirection(turns::LeaveRoundAbout);
integration::TestRouteLength(route, 387.);
}
UNIT_TEST(RussiaMoscowPlanetnaiTurnTest)
{
shared_ptr<integration::OsrmRouterComponents> routerComponents = integration::GetAllMaps();
RouteResultT const routeResult = integration::CalculateRoute(routerComponents, {37.546683164991776, 67.545511147376089},
{0., 0.}, {37.549153861529007, 67.54467404790482});
shared_ptr<Route> const route = routeResult.first;
OsrmRouter::ResultCode const result = routeResult.second;
TEST_EQUAL(result, OsrmRouter::NoError, ());
integration::TestTurnCount(route, 1);
integration::GetNthTurn(route, 0).TestValid().TestDirection(turns::TurnLeft);
integration::TestRouteLength(route, 214.);
}
UNIT_TEST(RussiaMoscowNoTurnsOnMKADTurnTest)
{
shared_ptr<integration::OsrmRouterComponents> routerComponents = integration::GetAllMaps();
RouteResultT const routeResult = integration::CalculateRoute(routerComponents, {37.391635636579785, 67.62455792789649},
{0., 0.}, {37.692547253527685, 67.127684414191762});
shared_ptr<Route> const route = routeResult.first;
OsrmRouter::ResultCode const result = routeResult.second;
TEST_EQUAL(result, OsrmRouter::NoError, ());
integration::TestTurnCount(route, 1);
integration::GetNthTurn(route, 0).TestValid().TestPoint({37.682761085650043, 67.140620702062705})
.TestOneOfDirections({turns::TurnSlightRight, turns::TurnRight});
integration::TestRouteLength(route, 43233.7);
}
UNIT_TEST(RussiaMoscowTTKKashirskoeShosseOutTurnTest)
{
shared_ptr<integration::OsrmRouterComponents> routerComponents = integration::GetAllMaps();
RouteResultT const routeResult = integration::CalculateRoute(routerComponents, {37.606320023648998, 67.36682695403141},
{0., 0.}, {37.621220025471168, 67.352441627022912});
shared_ptr<Route> const route = routeResult.first;
OsrmRouter::ResultCode const result = routeResult.second;
TEST_EQUAL(result, OsrmRouter::NoError, ());
integration::TestTurnCount(route, 2);
/// Checking turn in case going from not link to link
integration::GetNthTurn(route, 0).TestValid().TestOneOfDirections({turns::TurnSlightRight, turns::TurnRight});
/// Checking turn in case of ingoing edge(s)
integration::GetNthTurn(route, 1).TestValid().TestOneOfDirections({turns::TurnSlightRight, turns::TurnRight});
}
UNIT_TEST(RussiaMoscowPankratevskiPerBolshaySuharedskazPloschadTurnTest)
{
shared_ptr<integration::OsrmRouterComponents> routerComponents = integration::GetAllMaps();
RouteResultT const routeResult = integration::CalculateRoute(routerComponents, {37.635563528539393, 67.491460725721268},
{0., 0.}, {37.637054339197832, 67.491929797067371});
shared_ptr<Route> const route = routeResult.first;
OsrmRouter::ResultCode const result = routeResult.second;
TEST_EQUAL(result, OsrmRouter::NoError, ());
integration::TestTurnCount(route, 1);
integration::GetNthTurn(route, 0).TestValid().TestDirection(turns::TurnRight);
}
UNIT_TEST(RussiaMoscowMKADPutilkovskeShosseTurnTest)
{
shared_ptr<integration::OsrmRouterComponents> routerComponents = integration::GetAllMaps();
RouteResultT const routeResult = integration::CalculateRoute(routerComponents, {37.394141645624103, 67.63612831787222},
{0., 0.}, {37.391050708989461, 67.632454269643091});
shared_ptr<Route> const route = routeResult.first;
OsrmRouter::ResultCode const result = routeResult.second;
TEST_EQUAL(result, OsrmRouter::NoError, ());
integration::TestTurnCount(route, 1);
integration::GetNthTurn(route, 0).TestValid().TestOneOfDirections({turns::TurnSlightRight, turns::TurnRight});
}
UNIT_TEST(RussiaMoscowPetushkovaShodniaReverTurnTest)
{
shared_ptr<integration::OsrmRouterComponents> routerComponents = integration::GetAllMaps();
RouteResultT const routeResult = integration::CalculateRoute(routerComponents, {37.405917692164508, 67.614731601278493},
{0., 0.}, {37.408550782937482, 67.61160397953185});
shared_ptr<Route> const route = routeResult.first;
OsrmRouter::ResultCode const result = routeResult.second;
TEST_EQUAL(result, OsrmRouter::NoError, ());
integration::TestTurnCount(route, 0);
}
UNIT_TEST(RussiaHugeRoundaboutTurnTest)
{
shared_ptr<integration::OsrmRouterComponents> routerComponents = integration::GetAllMaps();
RouteResultT const routeResult = integration::CalculateRoute(routerComponents, {37.325810690728495, 67.544175542376436},
{0., 0.}, {37.325360456262153, 67.543013703414516});
shared_ptr<Route> const route = routeResult.first;
OsrmRouter::ResultCode const result = routeResult.second;
TEST_EQUAL(result, OsrmRouter::NoError, ());
integration::TestTurnCount(route, 2);
integration::GetNthTurn(route, 0).TestValid().TestDirection(turns::EnterRoundAbout).TestRoundAboutExitNum(5);
integration::GetNthTurn(route, 1).TestValid().TestDirection(turns::LeaveRoundAbout).TestRoundAboutExitNum(0);
}
UNIT_TEST(BelarusMiskProspNezavisimostiMKADTurnTest)
{
shared_ptr<integration::OsrmRouterComponents> routerComponents = integration::GetAllMaps();
RouteResultT const routeResult = integration::CalculateRoute(routerComponents, {27.658572046123947, 64.302533720228126},
{0., 0.}, {27.670461944729382, 64.307480201489582});
shared_ptr<Route> const route = routeResult.first;
OsrmRouter::ResultCode const result = routeResult.second;
TEST_EQUAL(result, OsrmRouter::NoError, ());
integration::TestTurnCount(route, 1);
integration::GetNthTurn(route, 0).TestValid().TestOneOfDirections({turns::TurnSlightRight, turns::TurnRight});
}