MCPcopy Create free account
hub / github.com/AdaCompNUS/summit / test_junctions

Function test_junctions

LibCarla/source/test/client/test_opendrive.cpp:172–204  ·  view source on GitHub ↗

Junctions

Source from the content-addressed store, hash-verified

170
171// Junctions
172static void test_junctions(const pugi::xml_document &xml, boost::optional<Map>& map) {
173 pugi::xml_node open_drive_node = xml.child("OpenDRIVE");
174
175 // Check total number of junctions
176 auto& junctions = map->GetMap().GetJunctions();
177 auto total_junctions_parser = std::distance(open_drive_node.children("junction").begin(), open_drive_node.children("junction").end());
178
179 ASSERT_EQ(junctions.size(), total_junctions_parser);
180
181 for (pugi::xml_node junction_node : open_drive_node.children("junction")) {
182 // Check total number of connections
183 auto total_connections_parser = std::distance(junction_node.children("connection").begin(), junction_node.children("connection").end());
184
185 JuncId junction_id = junction_node.attribute("id").as_int();
186 auto& junction = junctions.find(junction_id)->second;
187
188 auto& connections = junction.GetConnections();
189
190 ASSERT_EQ(connections.size(), total_connections_parser);
191
192 for (pugi::xml_node connection_node : junction_node.children("connection")) {
193 auto total_lane_links_parser = std::distance(connection_node.children("laneLink").begin(), connection_node.children("laneLink").end());
194
195 ConId connection_id = connection_node.attribute("id").as_uint();
196 auto& connection = connections.find(connection_id)->second;
197
198 auto& lane_links = connection.lane_links;
199
200 ASSERT_EQ(lane_links.size(), total_lane_links_parser);
201
202 }
203 }
204}
205
206static void test_road_links(boost::optional<Map>& map) {
207

Callers 1

TESTFunction · 0.85

Calls 10

childMethod · 0.80
childrenMethod · 0.80
as_intMethod · 0.80
attributeMethod · 0.80
GetConnectionsMethod · 0.80
as_uintMethod · 0.80
GetMapMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected