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

Function UNIT_CLASS_TEST

libs/routing/routing_tests/index_graph_test.cpp:629–648  ·  view source on GitHub ↗

This test checks that the route from Start to Finish doesn't make an extra loop in F0. If it was so the route time had been much more.

Source from the content-addressed store, hash-verified

627// This test checks that the route from Start to Finish doesn't make an extra loop in F0.
628// If it was so the route time had been much more.
629UNIT_CLASS_TEST(RestrictionTest, LoopGraph)
630{
631 Init(BuildLoopGraph());
632 auto start = MakeFakeEnding(1 /* featureId */, 0 /* segmentIdx */, m2::PointD(0.0002, 0), *m_graph);
633 auto finish = MakeFakeEnding(2, 0, m2::PointD(0.00005, 0.0004), *m_graph);
634
635 vector<Segment> const expectedRoute = {{kTestNumMwmId, 1, 0, true}, {kTestNumMwmId, 0, 0, true},
636 {kTestNumMwmId, 0, 1, true}, {kTestNumMwmId, 0, 8, false},
637 {kTestNumMwmId, 0, 7, false}, {kTestNumMwmId, 0, 6, false},
638 {kTestNumMwmId, 2, 0, true}};
639
640 auto const expectedWeight = mercator::DistanceOnEarth({0.0002, 0.0}, {0.0002, 0.0001}) / KmphToMps(100.0) +
641 mercator::DistanceOnEarth({0.0002, 0.0001}, {0.00015, 0.0001}) / KmphToMps(100.0) +
642 mercator::DistanceOnEarth({0.00015, 0.0001}, {0.0001, 0.0001}) / KmphToMps(100.0) +
643 mercator::DistanceOnEarth({0.0001, 0.0001}, {0.00005, 0.00015}) / KmphToMps(100.0) +
644 mercator::DistanceOnEarth({0.00005, 0.00015}, {0.00005, 0.0002}) / KmphToMps(100.0) +
645 mercator::DistanceOnEarth({0.00005, 0.0002}, {0.00005, 0.0003}) / KmphToMps(100.0) +
646 mercator::DistanceOnEarth({0.00005, 0.0003}, {0.00005, 0.0004}) / KmphToMps(100.0);
647 TestRoute(start, finish, expectedRoute.size(), &expectedRoute, expectedWeight, *m_graph);
648}
649
650UNIT_TEST(IndexGraph_OnlyTopology_1)
651{

Callers

nothing calls this directly

Calls 7

BuildLoopGraphFunction · 0.85
KmphToMpsFunction · 0.85
TestRouteFunction · 0.85
MakeFakeEndingFunction · 0.70
InitFunction · 0.50
DistanceOnEarthFunction · 0.50
sizeMethod · 0.45

Tested by

no test coverage detected