From fc8018172f2f52baaa90e4fd7ec60737df9db60f Mon Sep 17 00:00:00 2001 From: Shameek Ganguly Date: Tue, 6 Jun 2023 14:20:00 -0700 Subject: [PATCH] Minor clean up of tests Signed-off-by: Shameek Ganguly --- src/JointAxis_TEST.cc | 24 ++++++++++++------------ test/integration/toml_parser.hh | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/JointAxis_TEST.cc b/src/JointAxis_TEST.cc index b367ac01c..c34647b38 100644 --- a/src/JointAxis_TEST.cc +++ b/src/JointAxis_TEST.cc @@ -199,9 +199,9 @@ TEST(DOMJointAxis, ToElement) sdf::ElementPtr xyzElem = elem->GetElement("xyz", errors); ASSERT_TRUE(errors.empty()); gz::math::Vector3d xyz = elem->Get( - errors, "xyz", xyz).first; + errors, "xyz", gz::math::Vector3d()).first; ASSERT_TRUE(errors.empty()); - EXPECT_EQ(gz::math::Vector3d::UnitY, axis.Xyz()); + EXPECT_EQ(gz::math::Vector3d::UnitY, xyz); std::string expressedIn = elem->GetElement("xyz", errors)->Get( errors, "expressed_in"); ASSERT_TRUE(errors.empty()); @@ -210,55 +210,55 @@ TEST(DOMJointAxis, ToElement) sdf::ElementPtr dynElem = elem->GetElement("dynamics", errors); ASSERT_TRUE(errors.empty()); - double damping; + double damping = 0; damping = dynElem->Get(errors, "damping", damping).first; ASSERT_TRUE(errors.empty()); EXPECT_DOUBLE_EQ(0.2, damping); - double friction; + double friction = 0; friction = dynElem->Get(errors, "friction", friction).first; ASSERT_TRUE(errors.empty()); EXPECT_DOUBLE_EQ(1.3, friction); - double springReference; + double springReference = 0; springReference = dynElem->Get( errors, "spring_reference", springReference).first; ASSERT_TRUE(errors.empty()); EXPECT_DOUBLE_EQ(2.4, springReference); - double springStiffness; + double springStiffness = 0; springStiffness = dynElem->Get( errors, "spring_stiffness", springStiffness).first; ASSERT_TRUE(errors.empty()); EXPECT_DOUBLE_EQ(-1.2, springStiffness); sdf::ElementPtr limitElem = elem->GetElement("limit", errors); - double lower; + double lower = 0; lower = limitElem->Get(errors, "lower", lower).first; ASSERT_TRUE(errors.empty()); EXPECT_DOUBLE_EQ(-10.8, lower); - double upper; + double upper = 0; upper = limitElem->Get(errors, "upper", upper).first; ASSERT_TRUE(errors.empty()); EXPECT_DOUBLE_EQ(123.4, upper); - double effort; + double effort = 0; effort = limitElem->Get(errors, "effort", effort).first; ASSERT_TRUE(errors.empty()); EXPECT_DOUBLE_EQ(3.2, effort); - double maxVel; + double maxVel = 0; maxVel = limitElem->Get(errors, "velocity", maxVel).first; ASSERT_TRUE(errors.empty()); EXPECT_DOUBLE_EQ(54.2, maxVel); - double stiffness; + double stiffness = 0; stiffness = limitElem->Get(errors, "stiffness", stiffness).first; ASSERT_TRUE(errors.empty()); EXPECT_DOUBLE_EQ(1e2, stiffness); - double dissipation; + double dissipation = 0; dissipation = limitElem->Get( errors, "dissipation", dissipation).first; ASSERT_TRUE(errors.empty()); diff --git a/test/integration/toml_parser.hh b/test/integration/toml_parser.hh index f142aad7c..ee3f68ba1 100644 --- a/test/integration/toml_parser.hh +++ b/test/integration/toml_parser.hh @@ -136,7 +136,7 @@ struct Document: public Value Document parseToml(const std::string &_filePath, sdf::Errors &_errors) { std::fstream fs; - fs.open(_filePath); + fs.open(_filePath, std::fstream::in); if (!fs.good()) { _errors.emplace_back(sdf::ErrorCode::FILE_READ,