Skip to content

Commit d585f6d

Browse files
committed
Test new feature
1 parent 8df4d6d commit d585f6d

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

test/mobility/Test_graph.cpp

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,35 @@ TEST_CASE("RoadNetwork") {
159159
CHECK_EQ(graph.nRoundabouts(), 1);
160160
CHECK_EQ(graph.nTrafficLights(), 0);
161161
}
162+
THEN("Road types are set") {
163+
int nHighways = 0, nPrimary = 0, nSecondary = 0, nTertiary = 0,
164+
nResidential = 0;
165+
for (auto const& [_, pEdge] : graph.edges()) {
166+
if (!pEdge->roadType().has_value()) {
167+
continue;
168+
}
169+
switch (pEdge->roadType().value()) {
170+
case RoadType::HIGHWAY:
171+
++nHighways;
172+
break;
173+
case RoadType::PRIMARY:
174+
++nPrimary;
175+
break;
176+
case RoadType::SECONDARY:
177+
++nSecondary;
178+
break;
179+
case RoadType::TERTIARY:
180+
++nTertiary;
181+
break;
182+
case RoadType::RESIDENTIAL:
183+
++nResidential;
184+
break;
185+
default:
186+
break;
187+
}
188+
}
189+
CHECK_GT(nHighways + nPrimary + nSecondary + nTertiary + nResidential, 0);
190+
}
162191
RoadNetwork graph2;
163192
graph2.importEdges((DATA_FOLDER / "postua_edges.geojson").string());
164193
THEN("Sizes are correct also with geojson") {

0 commit comments

Comments
 (0)