Repo created

This commit is contained in:
Fr4nz D13trich 2025-11-22 13:58:55 +01:00
parent 4af19165ec
commit 68073add76
12458 changed files with 12350765 additions and 2 deletions

View file

@ -0,0 +1,17 @@
project(routing_quality_tests)
set(SRC
barriers_tests.cpp
bigger_roads_tests.cpp
ferry_tests.cpp
is_built_tests.cpp
leaps_postprocessing_tests.cpp
passby_roads_tests.cpp
waypoints_tests.cpp
)
omim_add_test(${PROJECT_NAME} ${SRC})
target_link_libraries(${PROJECT_NAME}
routing_quality
)

View file

@ -0,0 +1,41 @@
#include "testing/testing.hpp"
#include "routing/routing_quality/waypoints.hpp"
using namespace routing_quality;
// There is a category of barriers through which no road must be built:
// ice roads (highway = ice_road).
// And there is a category of barriers through which the road should be built:
// fords (highway = ford).
// Tests on this kind of cases are grouped in this file.
namespace
{
UNIT_TEST(RoutingQuality_Broad_Node_Jamaica)
{
TEST(CheckCarRoute({17.94727, -76.25429} /* start */, {17.94499, -76.25459} /* finish */,
{{{17.945150, -76.25442}}} /* reference point */),
());
}
UNIT_TEST(RoutingQuality_Broad_Way_Jamaica)
{
TEST(CheckCarRoute({18.10260, -76.98374} /* start */, {18.10031, -76.98374} /* finish */,
{{{18.10078, -76.98412}}} /* reference point */),
());
}
UNIT_TEST(RoutingQuality_Broad_Node_Spain)
{
TEST(CheckCarRoute({41.95027, -0.54596} /* start */, {56.98358, 9.77815} /* finish */,
{{{41.95026, -0.54562}}} /* reference point */),
());
}
UNIT_TEST(RoutingQuality_Broad_Node_Norway)
{
TEST(CheckCarRoute({56.20247, 8.77519} /* start */, {56.19732, 8.79190} /* finish */,
{{{56.20172, 8.77879}}} /* reference point */),
());
}
} // namespace

View file

@ -0,0 +1,131 @@
#include "testing/testing.hpp"
#include "routing/routing_quality/waypoints.hpp"
using namespace routing_quality;
// Test on preferring better but longer roads should be grouped in this file.
namespace
{
// Secondary should be preferred against residential.
UNIT_TEST(RoutingQuality_RussiaMoscowTushino)
{
TEST(CheckCarRoute({55.84367, 37.44724} /* start */, {55.85489, 37.43784} /* finish */,
{{{55.84343, 37.43949}}} /* reference track */),
());
}
UNIT_TEST(RoutingQuality_TurkeyIzmirArea)
{
TEST(CheckCarRoute({38.80146, 26.97696} /* start */, {39.0837, 26.90977} /* finish */,
{{{39.08124, 27.11829}}} /* reference track */),
());
}
UNIT_TEST(RoutingQuality_BosniaAndHerzegovina)
{
TEST(CheckCarRoute({42.71401, 18.30412} /* start */, {42.95101, 18.08966} /* finish */,
{{{42.88222, 17.9919}}} /* reference track */),
());
}
UNIT_TEST(RoutingQuality_CzechiaPrague)
{
TEST(CheckCarRoute({50.10159, 14.43324} /* start */, {50.20976, 14.43361} /* finish */,
{{{50.15078, 14.49205}}} /* reference track */),
());
}
UNIT_TEST(RoutingQuality_FinlandHelsinki)
{
TEST(CheckCarRoute({60.16741, 24.94255} /* start */, {64.13182, 28.38784} /* finish */,
{{{60.95453, 25.6951}}} /* reference track */),
());
}
UNIT_TEST(RoutingQuality_USAOklahoma)
{
TEST(CheckCarRoute({35.39166, -97.55402} /* start */, {35.38452, -97.5742} /* finish */,
{{{35.39912, -97.57622}}} /* reference track */),
());
}
UNIT_TEST(RoutingQuality_IranSouth)
{
TEST(CheckCarRoute({32.45088, 51.76419} /* start */, {32.97067, 51.50399} /* finish */,
{{{32.67021, 51.64323}, {32.68752, 51.63387}},
{{32.67021, 51.64323}, {32.7501, 51.64661}}} /* reference track */),
());
}
UNIT_TEST(RoutingQuality_EindhovenNetherlands)
{
TEST(CheckCarRoute({50.91974, 5.33535} /* start */, {51.92532, 5.49066} /* finish */,
{{{51.42016, 5.42881}, {51.44316, 5.42723}}} /* reference track */),
());
}
UNIT_TEST(RoutingQuality_GeteborgasSweden)
{
TEST(CheckCarRoute({57.77064, 11.88079} /* start */, {57.71231, 11.93157} /* finish */,
{{{57.74912, 11.87343}}} /* reference track */),
());
}
UNIT_TEST(RoutingQuality_CigilTurkey)
{
TEST(CheckCarRoute({38.48175, 27.12952} /* start */, {38.47558, 27.06765} /* finish */,
{{{38.4898049, 27.1016266}}} /* reference track */),
());
}
UNIT_TEST(RoutingQuality_KatowicePoland)
{
TEST(CheckCarRoute({50.37282, 18.75667} /* start */, {50.83499, 19.14612} /* finish */,
{{{50.422229, 19.04746}}} /* reference track */),
());
}
UNIT_TEST(RoutingQuality_KrasnoyarskBratsk)
{
TEST(CheckCarRoute({56.009, 92.873} /* start */, {56.163, 101.611} /* finish */,
{{{55.89285, 97.99953}, {54.59928, 100.60402}}} /* reference track */),
());
}
UNIT_TEST(RoutingQuality_VoronezhSochi)
{
TEST(CheckCarRoute({51.65487, 39.21293} /* start */, {43.58547, 39.72311} /* finish */,
{{{46.14169, 39.85306},
{45.17069, 39.10869},
{45.02157, 39.12510},
{44.54344, 38.95853}}} /* reference track */),
());
}
UNIT_TEST(RoutingQuality_BerlinkaWarsawPoland)
{
TEST(CheckCarRoute({54.41616, 20.05675} /* start */, {52.18937, 20.94026} /* finish */,
{{{54.24278, 19.66106},
{54.13679, 19.45166},
{54.06452, 19.62416},
{53.69769, 19.98204},
{53.11194, 20.40002},
{52.62966, 20.38488}}} /* reference track */),
());
}
UNIT_TEST(RoutingQuality_MosOblBadPaving)
{
TEST(CheckCarRoute({55.92961, 36.04081} /* start */, {55.93567, 36.0533} /* finish */,
{{{55.92321, 36.04630}}} /* reference track */),
());
}
UNIT_TEST(RoutingQuality_LatviaUnpaved)
{
TEST(CheckCarRoute({56.62992, 25.77175} /* start */, {56.61453, 25.78400} /* finish */,
{{{56.62377, 25.81015}, {56.61755, 25.80894}}} /* reference track */),
());
}
} // namespace

View file

@ -0,0 +1,133 @@
#include "testing/testing.hpp"
#include "routing/routing_quality/waypoints.hpp"
using namespace routing_quality;
namespace
{
UNIT_TEST(Ferry_RoutingQuality_FinlandBridgeInsteadOfFerry)
{
TEST(CheckCarRoute({56.11155, 12.81101} /* start */, {55.59857, 12.3069} /* finish */,
{{{55.56602, 12.88537}}} /* reference track */),
());
}
// TODO: This test doesn't pass because routing::RouteWeight::operator<
// prefer roads with less number of barriers. It will be more useful to consider
// barriers only with access=no/private/etc tag.
// UNIT_TEST(Ferry_RoutingQuality_RussiaToCrimeaFerry)
//{
// // From Russia to Crimea
// TEST(CheckCarRoute({45.34123, 36.67679} /* start */, {45.36479, 36.62194} /* finish */,
// {{{45.3532, 36.64912}}} /* reference track */),
// ());
//}
UNIT_TEST(Ferry_RoutingQuality_RussiaFromCrimeaFerry)
{
TEST(CheckCarRoute({45.36479, 36.62194} /* start */, {45.34123, 36.67679} /* finish */,
{{{45.3532, 36.64912}}} /* reference track */),
());
}
// For tests Ferry_RoutingQuality_1 - Ferry_RoutingQuality_15
// Look at: https://confluence.mail.ru/display/MAPSME/Ferries for more details.
UNIT_TEST(Ferry_RoutingQuality_1)
{
TEST(CheckCarRoute({67.89425, 13.00747} /* start */, {67.28024, 14.37397} /* finish */,
{{{67.60291, 13.65267}}} /* reference track */),
());
}
UNIT_TEST(Ferry_RoutingQuality_2)
{
TEST(CheckCarRoute({51.91347, 5.24265} /* start */, {51.98885, 5.20058} /* finish */,
{{{51.97494, 5.10631}}} /* reference track */),
());
}
UNIT_TEST(Ferry_RoutingQuality_3)
{
TEST(CheckCarRoute({50.68323, 7.15683} /* start */, {50.58042, 7.32259} /* finish */,
{{{50.72206, 7.14872}, {50.70747, 7.17801}}} /* reference track */),
());
}
UNIT_TEST(Ferry_RoutingQuality_4)
{
TEST(CheckCarRoute({49.37098, 0.84813} /* start */, {49.47950, 0.80918} /* finish */,
{{{49.36829, 0.81359}, {49.41177, 0.79639}}} /* reference track */),
());
}
UNIT_TEST(Ferry_RoutingQuality_5)
{
TEST(CheckCarRoute({53.59885, 9.32285} /* start */, {53.93504, 9.48396} /* finish */,
{{{53.55170, 9.89848}}} /* reference track */),
());
}
UNIT_TEST(Ferry_RoutingQuality_6)
{
TEST(CheckCarRoute({48.268548, 21.483862} /* start */, {48.24756, 21.54246} /* finish */,
{{{48.32574, 21.56094}}} /* reference track */),
());
}
UNIT_TEST(Ferry_RoutingQuality_7)
{
TEST(CheckCarRoute({52.09319, 25.96368} /* start */, {52.02190, 25.98767} /* finish */,
{{{52.08914, 26.13001}}} /* reference track */),
());
}
UNIT_TEST(Ferry_RoutingQuality_8)
{
TEST(CheckCarRoute({53.36914, 17.95644} /* start */, {53.46632, 18.01876} /* finish */,
{{{53.31395, 17.98559}}} /* reference track */),
());
}
UNIT_TEST(Ferry_RoutingQuality_9)
{
TEST(CheckCarRoute({52.57264, 14.83948} /* start */, {52.74278, 14.95435} /* finish */,
{{{52.65097, 14.99906}}} /* reference track */),
());
}
UNIT_TEST(Ferry_RoutingQuality_10)
{
TEST(CheckCarRoute({63.33900, 10.27831} /* start */, {63.33338, 10.22694} /* finish */,
{{{63.32261, 10.26896}}} /* reference track */),
());
}
UNIT_TEST(Ferry_RoutingQuality_11)
{
TEST(CheckCarRoute({56.51167, 10.28726} /* start */, {56.57695, 10.11188} /* finish */,
{{{56.44610, 10.26030}}} /* reference track */),
());
}
UNIT_TEST(Ferry_RoutingQuality_13)
{
TEST(CheckCarRoute({51.53923, 11.78523} /* start */, {51.62372, 11.86635} /* finish */,
{{{51.50772, 11.94096}}} /* reference track */),
());
}
UNIT_TEST(Ferry_RoutingQuality_14)
{
TEST(CheckCarRoute({52.68467, 16.24031} /* start */, {52.74559, 16.27202} /* finish */,
{{{52.71631, 16.37917}}} /* reference track */),
());
}
UNIT_TEST(Ferry_RoutingQuality_15)
{
TEST(CheckCarRoute({48.29162, 22.21412} /* start */, {48.27409, 22.46155} /* finish */,
{{{48.43306, 22.23317}}} /* reference track */),
());
}
} // namespace

View file

@ -0,0 +1,37 @@
#include "testing/testing.hpp"
#include "routing/routing_quality/waypoints.hpp"
using namespace routing_quality;
// Tests on availability to build route.
namespace
{
// Test on building route from and to Bilbau Airport.
UNIT_TEST(RoutingQuality_BilbauAirport)
{
// From Bilbau Airport.
TEST(CheckCarRoute({43.3017, -2.9151} /* start */, {43.27637, -2.86924} /* finish */,
{{{43.27759, -2.87367}}} /* reference track */),
());
// To Bilbau Airport.
TEST(CheckCarRoute({43.27651, -2.86918} /* start */, {43.2805, -2.87853} /* finish */,
{{{43.27788, -2.87385}}} /* reference track */),
());
}
// Test on building route from and to Fairbanks International Airport.
UNIT_TEST(RoutingQuality_FairbanksAirport)
{
// From Fairbanks International Airport.
TEST(CheckCarRoute({64.81398, -147.85897} /* start */, {64.85873, -147.69372} /* finish */,
{{{64.85886, -147.70319}}} /* reference track */),
());
// To Fairbanks International Airport.
TEST(CheckCarRoute({64.85893, -147.69438} /* start */, {64.81398, -147.85897} /* finish */,
{{{64.85825, -147.71106}}} /* reference track */),
());
}
} // namespace

View file

@ -0,0 +1,99 @@
#include "testing/testing.hpp"
#include "routing/vehicle_mask.hpp"
#include "routing/routing_quality/waypoints.hpp"
#include <utility>
#include <vector>
namespace leaps_postprocessing_tests
{
using namespace routing;
using namespace routing_quality;
using namespace std;
UNIT_TEST(RoutingQuality_NoLoop_Canada)
{
TEST(!CheckCarRoute({53.53540, -113.50798} /* start */, {69.44402, -133.03189} /* finish */,
{{{61.74073, -121.21379}}} /* reference point */),
());
}
UNIT_TEST(RoutingQuality_NoLoop_ZhitomirTver)
{
TEST(!CheckCarRoute({50.94928, 28.64163} /* start */, {54.50750, 30.47854} /* finish */,
{{{51.62925, 29.08458}}} /* reference point */),
());
}
UNIT_TEST(RoutingQuality_NoLoop_MacedoniaMontenegro_1)
{
TEST(!CheckCarRoute({42.02901, 21.44826} /* start */, {42.77394, 18.94886} /* finish */,
{{{42.66290, 20.20949}}} /* reference point */),
());
}
UNIT_TEST(RoutingQuality_NoLoop_MacedoniaMontenegro_2)
{
TEST(!CheckCarRoute({41.14033, 22.50236} /* start */, {42.42424, 18.77128} /* finish */,
{{{42.66181, 20.28980}}} /* reference point */),
());
}
UNIT_TEST(RoutingQuality_NoLoop_MacedoniaMontenegro_3)
{
TEST(!CheckCarRoute({42.00375, 21.50582} /* start */, {42.14698, 19.04367} /* finish */,
{{{42.69257, 20.08659}}} /* reference point */),
());
}
UNIT_TEST(RoutingQuality_NoLoop_AbkhaziaDonetsk)
{
TEST(!CheckCarRoute({43.17286, 40.39015} /* start */, {48.01587, 37.80132} /* finish */,
{{{47.69821, 38.67685}}} /* reference point */),
());
}
UNIT_TEST(RoutingQuality_NoLoop_RussiaKomiChuvashia)
{
TEST(!CheckCarRoute({60.175920, 49.641070} /* start */, {56.077370, 47.875380} /* finish */,
{{{56.16673, 47.80223}}} /* reference point */),
());
}
UNIT_TEST(RoutingQuality_NoLoop_SaratovMoscow)
{
TEST(!CheckCarRoute({51.54151, 46.23666} /* start */, {56.12105, 37.61638} /* finish */,
{{{55.91385, 37.58531}}} /* reference point */),
());
}
UNIT_TEST(RoutingQuality_NoLoop_BucharestMontenegro)
{
TEST(!CheckCarRoute({44.41418, 26.11567} /* start */, {42.80962, 19.50849} /* finish */,
{{{42.66125, 20.26862}}} /* reference point */),
());
}
UNIT_TEST(RoutingQuality_NoLoop_RyazanOblastGorshkovo)
{
TEST(!CheckCarRoute({54.30282, 38.93610} /* start */, {56.37584, 37.40839} /* finish */,
{{{55.91318, 37.58136}}} /* reference point */),
());
}
UNIT_TEST(RoutingQuality_NoLoop_BulgariaEastMontenegro)
{
TEST(!CheckCarRoute({42.82058, 27.87946} /* start */, {42.42889, 18.70008} /* finish */,
{{{42.70045, 20.11199}}} /* reference point */),
());
}
UNIT_TEST(RoutingQuality_NoLoop_SkopjeMontenegro)
{
TEST(!CheckCarRoute({41.99137, 21.44921} /* start */, {42.25520, 18.89884} /* finish */,
{{{42.68296, 20.18158}}} /* reference point */),
());
}
} // namespace leaps_postprocessing_tests

View file

@ -0,0 +1,149 @@
#include "testing/testing.hpp"
#include "routing/routing_quality/waypoints.hpp"
using namespace routing_quality;
// In most cases a passby road should be preferred in case of going pass a city.
// Test on such cases should be grouped in this file.
namespace
{
UNIT_TEST(RoutingQuality_RussiaZelegonrad2Domodedovo)
{
// From Zelenograd to Domodedovo. MKAD should be preferred.
TEST(CheckCarRoute({55.98301, 37.21141} /* start */, {55.42081, 37.89361} /* finish */,
{{{55.99751, 37.23804}, // Through M-11 and MKAD.
{56.00719, 37.28533},
{55.88759, 37.48068},
{55.83513, 37.39569}},
{{55.99775, 37.24941}, // Through M-10 and MKAD.
{55.88627, 37.43915},
{55.86882, 37.40784},
{55.58645, 37.71672},
{55.57855, 37.75468}}} /* reference tracks */),
());
}
UNIT_TEST(RoutingQuality_BelarusKobrin)
{
// Test on using a passby road around Kobirn.
TEST(CheckCarRoute({52.18429, 24.20225} /* start */, {52.24404, 24.45842} /* finish */,
{{{52.18694, 24.39903}}} /* reference point */),
());
}
UNIT_TEST(RoutingQuality_BelarusBobruisk)
{
TEST(CheckCarRoute({53.24596, 28.93816} /* start */, {53.04386, 29.58098} /* finish */,
{{{53.24592, 29.29409}}} /* reference point */),
());
}
UNIT_TEST(RoutingQuality_RussiaStPetersburg)
{
TEST(CheckCarRoute({60.08634, 30.10277} /* start */, {59.94584, 30.57703} /* finish */,
{{{60.03478, 30.44084}}} /* reference point */),
());
}
UNIT_TEST(RoutingQuality_BelarusMinsk)
{
TEST(CheckCarRoute({53.75958, 28.005} /* start */, {54.03957, 26.83097} /* finish */,
{{{53.70668, 27.4487}}} /* reference point */),
());
}
UNIT_TEST(RoutingQuality_BelarusMinskMKAD)
{
TEST(CheckCarRoute({53.81784, 27.76789} /* start */, {53.94655, 27.36398} /* finish */,
{{{53.95037, 27.65361}}} /* reference point */),
());
}
UNIT_TEST(RoutingQuality_EnglandLondon)
{
TEST(CheckCarRoute({51.90356, -0.20133} /* start */, {51.23253, -0.33076} /* finish */,
{{{51.57098, -0.53503}}} /* reference point */),
());
}
// After map update to 190719 the route starts go throw Chernigov instead of using
// passby way. It should be fix and the test should be uncommented.
// UNIT_TEST(RoutingQuality_UkraineChernigov)
//{
// TEST(CheckCarRoute({51.29419, 31.25718} /* start */, {51.62678, 31.21787} /* finish */,
// {{{51.48362, 31.18757}}} /* reference point */),
// ());
//}
UNIT_TEST(RoutingQuality_PolandSiedlce)
{
TEST(CheckCarRoute({52.17525, 22.19702} /* start */, {52.119802, 22.35855} /* finish */,
{{{52.14355, 22.231}}} /* reference point */),
());
}
UNIT_TEST(RoutingQuality_HungarySzolnok)
{
TEST(CheckCarRoute({47.18462, 20.04432} /* start */, {47.17919, 20.33486} /* finish */,
{{{47.14467, 20.17032}}} /* reference point */),
());
}
UNIT_TEST(RoutingQuality_USATexasAbilene)
{
TEST(CheckCarRoute({32.46041, -99.93058} /* start */, {32.43085, -99.59475} /* finish */,
{{{32.49038, -99.7269}}} /* reference point */),
());
}
UNIT_TEST(RoutingQuality_ItalyParma)
{
TEST(CheckCarRoute({44.81937, 10.2403} /* start */, {44.78228, 10.38824} /* finish */,
{{{44.81625, 10.34545}}} /* reference point */),
());
}
UNIT_TEST(RoutingQuality_SlovenijaLjubljana)
{
TEST(CheckCarRoute({45.99272, 14.59186} /* start */, {46.10318, 14.46829} /* finish */,
{{{46.04449, 14.44669}}} /* reference point */),
());
}
// TODO: Uncomment this test when correct city boundaries or crossroads will be ready.
// UNIT_TEST(RoutingQuality_FrancePoitiers)
//{
// TEST(CheckCarRoute({46.63612, 0.35762} /* start */, {46.49, 0.36787} /* finish */,
// {{{46.58706, 0.39232}}} /* reference point */),
// ());
//}
UNIT_TEST(RoutingQuality_FranceLoudun)
{
TEST(CheckCarRoute({47.03437, 0.04437} /* start */, {46.97887, 0.09692} /* finish */,
{{{47.00307, 0.06713}}} /* reference point */),
());
}
UNIT_TEST(RoutingQuality_FranceDoueIaFontaine)
{
TEST(CheckCarRoute({47.22972, -0.30962} /* start */, {47.17023, -0.2185} /* finish */,
{{{47.19117, -0.31334}}} /* reference point */),
());
}
UNIT_TEST(RoutingQuality_BelgiumBrussel)
{
TEST(CheckCarRoute({50.88374, 4.2195} /* start */, {50.91494, 4.38122} /* finish */,
{{{50.91727, 4.36858}}} /* reference point */),
());
}
UNIT_TEST(RoutingQuality_SouthernDenmarkPastUnclassified)
{
TEST(CheckCarRoute({55.44681, 10.29} /* start */, {55.45877, 10.26456} /* finish */,
{{{55.45505, 10.26972}}} /* reference point */),
());
}
} // namespace

View file

@ -0,0 +1,37 @@
#include "testing/testing.hpp"
#include "routing/vehicle_mask.hpp"
#include "routing/routing_quality/waypoints.hpp"
#include <utility>
#include <vector>
namespace waypoins_tests
{
using namespace routing;
using namespace routing_quality;
using namespace std;
UNIT_TEST(RoutingQuality_CompareSmoke)
{
// From office to Aseeva 6.
TEST(CheckCarRoute({55.79723, 37.53777} /* start */, {55.80634, 37.52886} /* finish */,
{{{55.79676, 37.54138},
{55.79914, 37.53582},
{55.80353, 37.52478},
{55.80556, 37.52770}}} /* reference track */),
());
}
UNIT_TEST(RoutingQuality_Sokol2Mayakovskaya)
{
// From Sokol to Mayakovskaya through Leningradsky Avenue but not through its alternate.
Params params(VehicleType::Car, {55.80432, 37.51603} /* start */, {55.77019, 37.59558} /* finish */);
// All points lie on the alternate so the result should be 0.
ReferenceRoutes waypoints = {{{55.79599, 37.54114}, {55.78142, 37.57364}, {55.77863, 37.57989}}};
TEST_EQUAL(CheckWaypoints(params, std::move(waypoints)), 0.0, ());
}
} // namespace waypoins_tests