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

Function TestRoute

libs/routing/routing_tests/index_graph_test.cpp:52–82  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

50double constexpr kUnknownWeight = -1.0;
51
52void TestRoute(FakeEnding const & start, FakeEnding const & finish, size_t expectedLength,
53 vector<Segment> const * expectedRoute, double expectedWeight, WorldGraph & graph)
54{
55 auto starter = MakeStarter(start, finish, graph);
56 vector<Segment> route;
57 double timeSec;
58 auto const resultCode = CalculateRoute(*starter, route, timeSec);
59 TEST_EQUAL(resultCode, AlgorithmForIndexGraphStarter::Result::OK, ());
60
61 TEST_GREATER(route.size(), 2, ());
62
63 vector<Segment> noFakeRoute;
64 for (auto const & s : route)
65 {
66 auto real = s;
67 if (!starter->ConvertToReal(real))
68 continue;
69 noFakeRoute.push_back(real);
70 }
71
72 TEST_EQUAL(noFakeRoute.size(), expectedLength, ("route =", noFakeRoute));
73
74 if (expectedWeight != kUnknownWeight)
75 {
76 double constexpr kEpsilon = 0.01;
77 TEST(AlmostEqualRel(timeSec, expectedWeight, kEpsilon), ("Expected weight:", expectedWeight, "got:", timeSec));
78 }
79
80 if (expectedRoute)
81 TEST_EQUAL(noFakeRoute, *expectedRoute, ());
82}
83
84void TestEdges(IndexGraph & graph, Segment const & segment, vector<Segment> const & expectedTargets, bool isOutgoing)
85{

Callers 2

UNIT_TESTFunction · 0.85
UNIT_CLASS_TESTFunction · 0.85

Calls 7

MakeStarterFunction · 0.85
TESTFunction · 0.85
AlmostEqualRelFunction · 0.85
CalculateRouteFunction · 0.70
sizeMethod · 0.45
ConvertToRealMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected