R4 (one way down) R1 J2--------J3 -1 ^ v ^ v R0 *---J0----*---J1----* 0 ^ v ^ v R2 J4--------J5 1 R3 (one way up) y x: 0 1 2 3 4
| 130 | // x: 0 1 2 3 4 |
| 131 | // |
| 132 | UNIT_TEST(EdgesTest) |
| 133 | { |
| 134 | unique_ptr<TestGeometryLoader> loader = make_unique<TestGeometryLoader>(); |
| 135 | loader->AddRoad(0 /* featureId */, false, 1.0 /* speed */, |
| 136 | RoadGeometry::Points({{0.0, 0.0}, {1.0, 0.0}, {2.0, 0.0}, {3.0, 0.0}, {4.0, 0.0}})); |
| 137 | loader->AddRoad(1 /* featureId */, false, 1.0 /* speed */, RoadGeometry::Points({{1.0, -1.0}, {3.0, -1.0}})); |
| 138 | loader->AddRoad(2 /* featureId */, false, 1.0 /* speed */, RoadGeometry::Points({{1.0, -1.0}, {3.0, -1.0}})); |
| 139 | loader->AddRoad(3 /* featureId */, true, 1.0 /* speed */, |
| 140 | RoadGeometry::Points({{1.0, 1.0}, {1.0, 0.0}, {1.0, -1.0}})); |
| 141 | loader->AddRoad(4 /* featureId */, true, 1.0 /* speed */, |
| 142 | RoadGeometry::Points({{3.0, -1.0}, {3.0, 0.0}, {3.0, 1.0}})); |
| 143 | |
| 144 | traffic::TrafficCache const trafficCache; |
| 145 | IndexGraph graph(make_shared<Geometry>(std::move(loader)), CreateEstimatorForCar(trafficCache)); |
| 146 | |
| 147 | vector<Joint> joints; |
| 148 | joints.emplace_back(MakeJoint({{0, 1}, {3, 1}})); // J0 |
| 149 | joints.emplace_back(MakeJoint({{0, 3}, {4, 1}})); // J1 |
| 150 | joints.emplace_back(MakeJoint({{1, 0}, {3, 2}})); // J2 |
| 151 | joints.emplace_back(MakeJoint({{1, 1}, {4, 0}})); // J3 |
| 152 | joints.emplace_back(MakeJoint({{2, 0}, {3, 0}})); // J4 |
| 153 | joints.emplace_back(MakeJoint({{2, 1}, {4, 2}})); // J5 |
| 154 | graph.Import(joints); |
| 155 | |
| 156 | TestOutgoingEdges(graph, {kTestNumMwmId, 0 /* featureId */, 0 /* segmentIdx */, true /* forward */}, |
| 157 | {{kTestNumMwmId, 0, 0, false}, {kTestNumMwmId, 0, 1, true}, {kTestNumMwmId, 3, 1, true}}); |
| 158 | TestIngoingEdges(graph, {kTestNumMwmId, 0, 0, true}, {{kTestNumMwmId, 0, 0, false}}); |
| 159 | TestOutgoingEdges(graph, {kTestNumMwmId, 0, 0, false}, {{kTestNumMwmId, 0, 0, true}}); |
| 160 | TestIngoingEdges(graph, {kTestNumMwmId, 0, 0, false}, |
| 161 | {{kTestNumMwmId, 0, 0, true}, {kTestNumMwmId, 0, 1, false}, {kTestNumMwmId, 3, 0, true}}); |
| 162 | |
| 163 | TestOutgoingEdges(graph, {kTestNumMwmId, 0, 2, true}, |
| 164 | {{kTestNumMwmId, 0, 2, false}, {kTestNumMwmId, 0, 3, true}, {kTestNumMwmId, 4, 1, true}}); |
| 165 | TestIngoingEdges(graph, {kTestNumMwmId, 0, 2, true}, {{kTestNumMwmId, 0, 1, true}}); |
| 166 | TestOutgoingEdges(graph, {kTestNumMwmId, 0, 2, false}, {{kTestNumMwmId, 0, 1, false}}); |
| 167 | TestIngoingEdges(graph, {kTestNumMwmId, 0, 2, false}, |
| 168 | {{kTestNumMwmId, 0, 2, true}, {kTestNumMwmId, 0, 3, false}, {kTestNumMwmId, 4, 0, true}}); |
| 169 | |
| 170 | TestOutgoingEdges(graph, {kTestNumMwmId, 3, 0, true}, |
| 171 | {{kTestNumMwmId, 3, 1, true}, {kTestNumMwmId, 0, 0, false}, {kTestNumMwmId, 0, 1, true}}); |
| 172 | TestIngoingEdges(graph, {kTestNumMwmId, 3, 0, true}, {{kTestNumMwmId, 2, 0, false}}); |
| 173 | |
| 174 | TestOutgoingEdges(graph, {kTestNumMwmId, 4, 1, true}, {{kTestNumMwmId, 2, 0, false}}); |
| 175 | TestIngoingEdges(graph, {kTestNumMwmId, 4, 1, true}, |
| 176 | {{kTestNumMwmId, 4, 0, true}, {kTestNumMwmId, 0, 2, true}, {kTestNumMwmId, 0, 3, false}}); |
| 177 | } |
| 178 | |
| 179 | // Roads R1: |
| 180 | // |
nothing calls this directly
no test coverage detected