Skip to content

Commit

Permalink
codecheck: helper functions public, use in test
Browse files Browse the repository at this point in the history
Signed-off-by: Steve Peters <[email protected]>
  • Loading branch information
scpeters committed May 13, 2020
1 parent b763472 commit 330e6a5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/parser_urdf.hh
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,15 @@ namespace sdf
/// \return True if _filename is a URDF model.
public: static bool IsURDF(const std::string &_filename);

/// things that do not belong in urdf but should be mapped into sdf
/// @todo: do this using sdf definitions, not hard coded stuff
private: void ParseSDFExtension(TiXmlDocument &_urdfXml);

/// list extensions for debugging
private: void ListSDFExtensions();
public: void ListSDFExtensions();

/// list extensions for debugging
private: void ListSDFExtensions(const std::string &_reference);
public: void ListSDFExtensions(const std::string &_reference);

/// things that do not belong in urdf but should be mapped into sdf
/// @todo: do this using sdf definitions, not hard coded stuff
private: void ParseSDFExtension(TiXmlDocument &_urdfXml);
};
}
}
Expand Down
15 changes: 15 additions & 0 deletions src/parser_urdf_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,9 @@ TEST(URDFParser, ParseRobotMaterialBlank)

auto materialElem = visualElem->FirstChildElement("material");
ASSERT_EQ(nullptr, materialElem);

parser.ListSDFExtensions();
parser.ListSDFExtensions("link");
}

/////////////////////////////////////////////////
Expand Down Expand Up @@ -220,6 +223,9 @@ TEST(URDFParser, ParseRobotMaterialName)
ASSERT_NE(nullptr, uriElem);
EXPECT_EQ("file://media/materials/scripts/gazebo.material",
std::string(uriElem->GetText()));

parser.ListSDFExtensions();
parser.ListSDFExtensions("link");
}

/////////////////////////////////////////////////
Expand Down Expand Up @@ -309,6 +315,9 @@ TEST(URDFParser, ParseGazeboLinkFactors)

// For the last element, check that it is exactly what we expect
EXPECT_EQ(tmp->FirstChild()->ValueStr(), it->second[i]);

parser_.ListSDFExtensions();
parser_.ListSDFExtensions("wheel_left_link");
}
}

Expand All @@ -332,6 +341,9 @@ TEST(URDFParser, ParseGazeboInvalidDampingFactor)
doc.Parse(stream.str().c_str());
ASSERT_THROW(TiXmlDocument sdf_result = parser_.InitModelDoc(&doc),
std::invalid_argument);

parser_.ListSDFExtensions();
parser_.ListSDFExtensions("link");
}

/////////////////////////////////////////////////
Expand Down Expand Up @@ -414,6 +426,9 @@ TEST(URDFParser, ParseGazeboJointElements)

// For the last element, check that it is exactly what we expect
EXPECT_EQ(tmp->FirstChild()->ValueStr(), it->second[i]);

parser_.ListSDFExtensions();
parser_.ListSDFExtensions("head_j0");
}
}

Expand Down

0 comments on commit 330e6a5

Please sign in to comment.