diff --git a/routing/routing_integration_tests/bicycle_route_test.cpp b/routing/routing_integration_tests/bicycle_route_test.cpp index 999c027323..d183da8b93 100644 --- a/routing/routing_integration_tests/bicycle_route_test.cpp +++ b/routing/routing_integration_tests/bicycle_route_test.cpp @@ -26,8 +26,8 @@ UNIT_TEST(RussiaMoscowNahimovskyLongRoute) UNIT_TEST(RussiaDomodedovoSteps) { integration::CalculateRouteAndTestRouteLength( - integration::GetBicycleComponents(), MercatorBounds::FromLatLon(55.44020, 37.77409), {0., 0.}, - MercatorBounds::FromLatLon(55.43972, 37.77254), 123.0); + integration::GetBicycleComponents(), MercatorBounds::FromLatLon(55.44010, 37.77416), {0., 0.}, + MercatorBounds::FromLatLon(55.43975, 37.77272), 123.0); } UNIT_TEST(SwedenStockholmCyclewayPriority) diff --git a/routing/routing_integration_tests/get_altitude_test.cpp b/routing/routing_integration_tests/get_altitude_test.cpp index 663fa87656..979b13ae54 100644 --- a/routing/routing_integration_tests/get_altitude_test.cpp +++ b/routing/routing_integration_tests/get_altitude_test.cpp @@ -29,6 +29,7 @@ void TestAltitudeOfAllMwmFeatures(string const & countryId, TAltitude const alti { Index index; platform::LocalCountryFile const country = platform::LocalCountryFile::MakeForTesting(countryId); + TEST_NOT_EQUAL(country.GetFiles(), MapOptions::Nothing, (country)); pair const regResult = index.RegisterMap(country); TEST_EQUAL(regResult.second, MwmSet::RegResult::Success, ()); diff --git a/routing/routing_integration_tests/route_test.cpp b/routing/routing_integration_tests/route_test.cpp index a163ffd4b1..60746f14d4 100644 --- a/routing/routing_integration_tests/route_test.cpp +++ b/routing/routing_integration_tests/route_test.cpp @@ -123,7 +123,7 @@ namespace UNIT_TEST(RussiaMoscowGerPanfilovtsev22SolodchaPravdiRouteTest) { integration::CalculateRouteAndTestRouteLength( - integration::GetCarComponents(), {37.409929478750627, 67.644798619710073}, {0., 0.}, + integration::GetCarComponents(), {37.409929478750627, 67.644798619710073}, {0., 0.}, {39.836562407458047, 65.774372510437971}, 239426.); } @@ -172,8 +172,8 @@ namespace UNIT_TEST(RussiaMoscowStartAtTwowayFeatureTest) { integration::CalculateRouteAndTestRouteLength( - integration::GetCarComponents(), MercatorBounds::FromLatLon(55.771, 37.5184), {0., 0.}, - MercatorBounds::FromLatLon(55.7718, 37.5178), 147.4); + integration::GetCarComponents(), MercatorBounds::FromLatLon(55.771, 37.5184), {0., 0.}, + MercatorBounds::FromLatLon(55.7718, 37.5178), 147.4); } // Strange map edits in Africa borders. Routing not linked now. @@ -274,8 +274,8 @@ namespace UNIT_TEST(RussiaMoscowLenigradskiy39GeroevPanfilovtsev22SubrouteTest) { TRouteResult const routeResult = integration::CalculateRoute( - integration::GetCarComponents(), MercatorBounds::FromLatLon(55.7971, 37.53804), {0., 0.}, - MercatorBounds::FromLatLon(55.8579, 37.40990)); + integration::GetCarComponents(), MercatorBounds::FromLatLon(55.7971, 37.53804), {0., 0.}, + MercatorBounds::FromLatLon(55.8579, 37.40990)); IRouter::ResultCode const result = routeResult.second; TEST_EQUAL(result, IRouter::NoError, ()); @@ -290,8 +290,8 @@ namespace UNIT_TEST(USALosAnglesAriaTwentyninePalmsHighwayTimeTest) { TRouteResult const routeResult = integration::CalculateRoute( - integration::GetCarComponents(), MercatorBounds::FromLatLon(34.0739, -115.3212), {0.0, 0.0}, - MercatorBounds::FromLatLon(34.0928, -115.5930)); + integration::GetCarComponents(), MercatorBounds::FromLatLon(34.0739, -115.3212), {0.0, 0.0}, + MercatorBounds::FromLatLon(34.0928, -115.5930)); Route const & route = *routeResult.first; IRouter::ResultCode const result = routeResult.second; TEST_EQUAL(result, IRouter::NoError, ()); diff --git a/routing/routing_integration_tests/routing_test_tools.cpp b/routing/routing_integration_tests/routing_test_tools.cpp index 037370423c..84c3fd9171 100644 --- a/routing/routing_integration_tests/routing_test_tools.cpp +++ b/routing/routing_integration_tests/routing_test_tools.cpp @@ -83,7 +83,8 @@ namespace integration unique_ptr CreateCarRouter(Index & index, storage::CountryInfoGetter const & infoGetter, traffic::TrafficCache const & trafficCache, - vector const & localFiles) + vector const & localFiles, + VehicleType vehicleType) { auto const countryFileGetter = [&infoGetter](m2::PointD const & pt) { return infoGetter.GetRegionCountryId(pt); @@ -101,8 +102,7 @@ namespace integration if (mwmId.GetInfo()->GetType() == MwmInfo::COUNTRY && countryFile.GetName() != "minsk-pass") numMwmIds->RegisterFile(countryFile); } - - auto vehicleType = VehicleType::Car; + auto indexRouter = make_unique(vehicleType, CountryParentNameGetterFn(), countryFileGetter, getMwmRectByName, numMwmIds, MakeNumMwmTree(*numMwmIds, infoGetter), trafficCache, index); @@ -130,13 +130,13 @@ namespace integration return unique_ptr(move(router)); } - class CarRouterComponents : public IRouterComponents + class VehicleRouterComponents : public IRouterComponents { public: - CarRouterComponents(vector const & localFiles) + VehicleRouterComponents(vector const & localFiles, VehicleType vehicleType) : IRouterComponents(localFiles) , m_indexRouter(CreateCarRouter(m_featuresFetcher->GetIndex(), *m_infoGetter, m_trafficCache, - localFiles)) + localFiles, vehicleType)) { } @@ -147,40 +147,7 @@ namespace integration unique_ptr m_indexRouter; }; - class PedestrianRouterComponents : public IRouterComponents - { - public: - PedestrianRouterComponents(vector const & localFiles) - : IRouterComponents(localFiles) - , m_router(CreateAStarRouter(m_featuresFetcher->GetIndex(), *m_infoGetter, localFiles, - CreatePedestrianAStarBidirectionalRouter)) - { - } - - IRouter * GetRouter() const override { return m_router.get(); } - - private: - unique_ptr m_router; - }; - - class BicycleRouterComponents : public IRouterComponents - { - public: - BicycleRouterComponents(vector const & localFiles) - : IRouterComponents(localFiles) - , m_router(CreateAStarRouter(m_featuresFetcher->GetIndex(), *m_infoGetter, localFiles, - CreateBicycleAStarBidirectionalRouter)) - { - } - - IRouter * GetRouter() const override { return m_router.get(); } - - private: - unique_ptr m_router; - }; - - template - shared_ptr CreateAllMapsComponents() + shared_ptr CreateAllMapsComponents(VehicleType vehicleType) { // Setting stored paths from testingmain.cpp Platform & pl = GetPlatform(); @@ -198,26 +165,26 @@ namespace integration for (auto & file : localFiles) file.SyncWithDisk(); ASSERT(!localFiles.empty(), ()); - return shared_ptr(new TRouterComponents(localFiles)); + return make_shared(localFiles, vehicleType); } IRouterComponents & GetCarComponents() { - static auto const instance = CreateAllMapsComponents(); + static auto const instance = CreateAllMapsComponents(VehicleType::Car); ASSERT(instance, ()); return *instance; } IRouterComponents & GetPedestrianComponents() { - static auto const instance = CreateAllMapsComponents(); + static auto const instance = CreateAllMapsComponents(VehicleType::Pedestrian); ASSERT(instance, ()); return *instance; } IRouterComponents & GetBicycleComponents() { - static auto const instance = CreateAllMapsComponents(); + static auto const instance = CreateAllMapsComponents(VehicleType::Bicycle); ASSERT(instance, ()); return *instance; } diff --git a/routing/routing_integration_tests/turn_test.cpp b/routing/routing_integration_tests/turn_test.cpp index 1c81dadbce..14263c7c29 100644 --- a/routing/routing_integration_tests/turn_test.cpp +++ b/routing/routing_integration_tests/turn_test.cpp @@ -103,9 +103,9 @@ UNIT_TEST(RussiaMoscowSalameiNerisUturnTurnTest) UNIT_TEST(RussiaMoscowTrikotagniAndPohodniRoundaboutTurnTest) { TRouteResult const routeResult = integration::CalculateRoute( - integration::GetCarComponents(), - MercatorBounds::FromLatLon(55.83118, 37.40515), {0., 0.}, - MercatorBounds::FromLatLon(55.83384, 37.40521)); + integration::GetCarComponents(), + MercatorBounds::FromLatLon(55.83118, 37.40515), {0., 0.}, + MercatorBounds::FromLatLon(55.83384, 37.40521)); Route const & route = *routeResult.first; IRouter::ResultCode const result = routeResult.second;