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

Function TestAStar

libs/routing/routing_tests/astar_algorithm_test.cpp:22–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20using Algorithm = AStarAlgorithm<uint32_t, SimpleEdge, double>;
21
22void TestAStar(UndirectedGraph & graph, vector<unsigned> const & expectedRoute, double const & expectedDistance)
23{
24 Algorithm algo;
25
26 Algorithm::ParamsForTests<> params(graph, 0u /* startVertex */, 4u /* finishVertex */);
27
28 RoutingResult<unsigned /* Vertex */, double /* Weight */> actualRoute;
29 TEST_EQUAL(Algorithm::Result::OK, algo.FindPath(params, actualRoute), ());
30 TEST_EQUAL(expectedRoute, actualRoute.m_path, ());
31 TEST_ALMOST_EQUAL_ULPS(expectedDistance, actualRoute.m_distance, ());
32
33 actualRoute.m_path.clear();
34 TEST_EQUAL(Algorithm::Result::OK, algo.FindPathBidirectional(params, actualRoute), ());
35 TEST_EQUAL(expectedRoute, actualRoute.m_path, ());
36 TEST_ALMOST_EQUAL_ULPS(expectedDistance, actualRoute.m_distance, ());
37}
38
39UNIT_TEST(AStarAlgorithm_Sample)
40{

Callers 1

UNIT_TESTFunction · 0.85

Calls 3

FindPathBidirectionalMethod · 0.80
FindPathMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected