Skip to content

Commit 4253575

Browse files
clalancetterhaschke
authored andcommitted
Add in tests for new, more restrictive parsing.
Signed-off-by: Chris Lalancette <[email protected]>
1 parent 595a948 commit 4253575

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

urdf_parser/test/urdf_unit_test.cpp

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ TEST(URDF_UNIT_TEST, parse_link_doubles)
272272
EXPECT_EQ(0.908, urdf->links_["l1"]->inertial->izz);
273273
}
274274

275-
276275
TEST(URDF_UNIT_TEST, parse_color_doubles)
277276
{
278277
std::string joint_str =
@@ -346,6 +345,26 @@ TEST(URDF_UNIT_TEST, parse_color_doubles)
346345
EXPECT_EQ(0.908, urdf->links_["l1"]->inertial->izz);
347346
}
348347

348+
TEST(URDF_UNIT_TEST, material_no_name)
349+
{
350+
std::string joint_str =
351+
"<robot name=\"test\">"
352+
" <material/>"
353+
" <link name=\"l1\"/>"
354+
"</robot>";
355+
urdf::ModelInterfaceSharedPtr urdf = urdf::parseURDF(joint_str);
356+
ASSERT_EQ(nullptr, urdf);
357+
}
358+
359+
TEST(URDF_UNIT_TEST, link_no_name)
360+
{
361+
std::string joint_str =
362+
"<robot name=\"test\">"
363+
" <link/>"
364+
"</robot>";
365+
urdf::ModelInterfaceSharedPtr urdf = urdf::parseURDF(joint_str);
366+
ASSERT_EQ(nullptr, urdf);
367+
}
349368

350369
int main(int argc, char **argv)
351370
{

0 commit comments

Comments
 (0)