Junctions
| 170 | |
| 171 | // Junctions |
| 172 | static 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 | |
| 206 | static void test_road_links(boost::optional<Map>& map) { |
| 207 |