Skip to content

Commit 330e6a5

Browse files
committed
codecheck: helper functions public, use in test
Signed-off-by: Steve Peters <scpeters@openrobotics.org>
1 parent b763472 commit 330e6a5

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

src/parser_urdf.hh

+6-6
Original file line numberDiff line numberDiff line change
@@ -68,15 +68,15 @@ namespace sdf
6868
/// \return True if _filename is a URDF model.
6969
public: static bool IsURDF(const std::string &_filename);
7070

71-
/// things that do not belong in urdf but should be mapped into sdf
72-
/// @todo: do this using sdf definitions, not hard coded stuff
73-
private: void ParseSDFExtension(TiXmlDocument &_urdfXml);
74-
7571
/// list extensions for debugging
76-
private: void ListSDFExtensions();
72+
public: void ListSDFExtensions();
7773

7874
/// list extensions for debugging
79-
private: void ListSDFExtensions(const std::string &_reference);
75+
public: void ListSDFExtensions(const std::string &_reference);
76+
77+
/// things that do not belong in urdf but should be mapped into sdf
78+
/// @todo: do this using sdf definitions, not hard coded stuff
79+
private: void ParseSDFExtension(TiXmlDocument &_urdfXml);
8080
};
8181
}
8282
}

src/parser_urdf_TEST.cc

+15
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ TEST(URDFParser, ParseRobotMaterialBlank)
173173

174174
auto materialElem = visualElem->FirstChildElement("material");
175175
ASSERT_EQ(nullptr, materialElem);
176+
177+
parser.ListSDFExtensions();
178+
parser.ListSDFExtensions("link");
176179
}
177180

178181
/////////////////////////////////////////////////
@@ -220,6 +223,9 @@ TEST(URDFParser, ParseRobotMaterialName)
220223
ASSERT_NE(nullptr, uriElem);
221224
EXPECT_EQ("file://media/materials/scripts/gazebo.material",
222225
std::string(uriElem->GetText()));
226+
227+
parser.ListSDFExtensions();
228+
parser.ListSDFExtensions("link");
223229
}
224230

225231
/////////////////////////////////////////////////
@@ -309,6 +315,9 @@ TEST(URDFParser, ParseGazeboLinkFactors)
309315

310316
// For the last element, check that it is exactly what we expect
311317
EXPECT_EQ(tmp->FirstChild()->ValueStr(), it->second[i]);
318+
319+
parser_.ListSDFExtensions();
320+
parser_.ListSDFExtensions("wheel_left_link");
312321
}
313322
}
314323

@@ -332,6 +341,9 @@ TEST(URDFParser, ParseGazeboInvalidDampingFactor)
332341
doc.Parse(stream.str().c_str());
333342
ASSERT_THROW(TiXmlDocument sdf_result = parser_.InitModelDoc(&doc),
334343
std::invalid_argument);
344+
345+
parser_.ListSDFExtensions();
346+
parser_.ListSDFExtensions("link");
335347
}
336348

337349
/////////////////////////////////////////////////
@@ -414,6 +426,9 @@ TEST(URDFParser, ParseGazeboJointElements)
414426

415427
// For the last element, check that it is exactly what we expect
416428
EXPECT_EQ(tmp->FirstChild()->ValueStr(), it->second[i]);
429+
430+
parser_.ListSDFExtensions();
431+
parser_.ListSDFExtensions("head_j0");
417432
}
418433
}
419434

0 commit comments

Comments
 (0)