MCPcopy Create free account
hub / github.com/comaps/comaps / UNIT_TEST

Function UNIT_TEST

libs/routing/routing_integration_tests/road_graph_tests.cpp:31–54  ·  view source on GitHub ↗

The test on combinatorial explosion of number of fake edges at FeaturesRoadGraph. It might happen when a lot of roads intersect at one point. For example, https://www.openstreetmap.org/#map=19/50.73197/-1.21295

Source from the content-addressed store, hash-verified

29// It might happen when a lot of roads intersect at one point. For example,
30// https://www.openstreetmap.org/#map=19/50.73197/-1.21295
31UNIT_TEST(FakeEdgesCombinatorialExplosion)
32{
33 classificator::Load();
34
35 std::vector<LocalCountryFile> localFiles;
36 GetAllLocalFiles(localFiles);
37 TEST(!localFiles.empty(), ());
38
39 FrozenDataSource dataSource;
40 for (auto const & file : localFiles)
41 dataSource.Register(file);
42
43 MwmDataSource routingSource(dataSource, nullptr /* numMwmIDs */);
44 FeaturesRoadGraph graph(routingSource, IRoadGraph::Mode::ObeyOnewayTag,
45 std::make_shared<CarModelFactory>(CountryParentNameGetterFn()));
46 geometry::PointWithAltitude const j(m2::PointD(mercator::FromLatLon(50.73208, -1.21279)),
47 geometry::kDefaultAltitudeMeters);
48 std::vector<std::pair<routing::Edge, geometry::PointWithAltitude>> sourceVicinity;
49 graph.FindClosestEdges(mercator::RectByCenterXYAndSizeInMeters(j.GetPoint(), FeaturesRoadGraph::kClosestEdgesRadiusM),
50 20 /* count */, sourceVicinity);
51 // In case of the combinatorial explosion mentioned above all the memory was consumed for
52 // FeaturesRoadGraph::m_fakeIngoingEdges and FeaturesRoadGraph::m_fakeOutgoingEdges fields.
53 graph.AddFakeEdges(j, sourceVicinity);
54}

Callers

nothing calls this directly

Calls 10

GetAllLocalFilesFunction · 0.85
TESTFunction · 0.85
RegisterMethod · 0.80
LoadFunction · 0.50
FromLatLonFunction · 0.50
emptyMethod · 0.45
FindClosestEdgesMethod · 0.45
GetPointMethod · 0.45
AddFakeEdgesMethod · 0.45

Tested by

no test coverage detected