MCPcopy Create free account
hub / github.com/Project-OSRM/osrm-backend / checkInstructions

Function checkInstructions

unit_tests/extractor/restriction_graph.cpp:47–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45bool operator!=(const instruction &lhs, const instruction &rhs) noexcept { return !(lhs == rhs); }
46
47void checkInstructions(RestrictionGraph::RestrictionRange restrictions,
48 std::vector<instruction> expected_instructions)
49{
50 std::vector<instruction> actual_instructions;
51 std::transform(restrictions.begin(),
52 restrictions.end(),
53 std::back_inserter(actual_instructions),
54 [](const auto &restriction) {
55 return instruction{restriction->turn_path.To(), bool(restriction->is_only)};
56 });
57 std::sort(actual_instructions.begin(),
58 actual_instructions.end(),
59 [](const auto &lhs, const auto &rhs)
60 { return (lhs.to < rhs.to) || (lhs.to == rhs.to && lhs.is_only); });
61 std::sort(expected_instructions.begin(),
62 expected_instructions.end(),
63 [](const auto &lhs, const auto &rhs)
64 { return (lhs.to < rhs.to) || (lhs.to == rhs.to && lhs.is_only); });
65
66 BOOST_REQUIRE_EQUAL_COLLECTIONS(actual_instructions.begin(),
67 actual_instructions.end(),
68 expected_instructions.begin(),
69 expected_instructions.end());
70}
71
72void checkEdges(RestrictionGraph::EdgeRange edges, std::vector<NodeID> expected_edges)
73{

Callers 1

checkNodeFunction · 0.85

Calls 3

beginMethod · 0.45
endMethod · 0.45
ToMethod · 0.45

Tested by

no test coverage detected