Skip to content

Commit

Permalink
Fix trivial warning on 24.04 for JointAxis_TEST.cc (gazebosim#1402)
Browse files Browse the repository at this point in the history
* Fix trivial warning on 24.04 for JointAxis_TEST.cc

---------

Signed-off-by: Jose Luis Rivero <[email protected]>
Co-authored-by: Steve Peters <[email protected]>
  • Loading branch information
j-rivero and scpeters authored Apr 22, 2024
1 parent 3e93e68 commit 2f2d8e1
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions src/JointAxis_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -226,58 +226,58 @@ TEST(DOMJointAxis, ToElement)
sdf::ElementPtr dynElem = elem->GetElement("dynamics", errors);
ASSERT_TRUE(errors.empty());

double damping = 0;
damping = dynElem->Get<double>(errors, "damping", damping).first;
double damping;
damping = dynElem->Get<double>(errors, "damping", 0.0).first;
ASSERT_TRUE(errors.empty());
EXPECT_DOUBLE_EQ(0.2, damping);

double friction = 0;
friction = dynElem->Get<double>(errors, "friction", friction).first;
double friction;
friction = dynElem->Get<double>(errors, "friction", 0.0).first;
ASSERT_TRUE(errors.empty());
EXPECT_DOUBLE_EQ(1.3, friction);

double springReference = 0;
double springReference;
springReference = dynElem->Get<double>(
errors, "spring_reference", springReference).first;
errors, "spring_reference", 0.0).first;
ASSERT_TRUE(errors.empty());
EXPECT_DOUBLE_EQ(2.4, springReference);

double springStiffness = 0;
double springStiffness;
springStiffness = dynElem->Get<double>(
errors, "spring_stiffness", springStiffness).first;
errors, "spring_stiffness", 0.0).first;
ASSERT_TRUE(errors.empty());
EXPECT_DOUBLE_EQ(-1.2, springStiffness);

// Check //axis/limit
sdf::ElementPtr limitElem = elem->GetElement("limit", errors);
double lower = 0;
lower = limitElem->Get<double>(errors, "lower", lower).first;
double lower;
lower = limitElem->Get<double>(errors, "lower", 0.0).first;
ASSERT_TRUE(errors.empty());
EXPECT_DOUBLE_EQ(-10.8, lower);

double upper = 0;
upper = limitElem->Get<double>(errors, "upper", upper).first;
double upper;
upper = limitElem->Get<double>(errors, "upper", 0.0).first;
ASSERT_TRUE(errors.empty());
EXPECT_DOUBLE_EQ(123.4, upper);

double effort = 0;
effort = limitElem->Get<double>(errors, "effort", effort).first;
double effort;
effort = limitElem->Get<double>(errors, "effort", 0.0).first;
ASSERT_TRUE(errors.empty());
EXPECT_DOUBLE_EQ(3.2, effort);

double maxVel = 0;
maxVel = limitElem->Get<double>(errors, "velocity", maxVel).first;
double maxVel;
maxVel = limitElem->Get<double>(errors, "velocity", 0.0).first;
ASSERT_TRUE(errors.empty());
EXPECT_DOUBLE_EQ(54.2, maxVel);

double stiffness = 0;
stiffness = limitElem->Get<double>(errors, "stiffness", stiffness).first;
double stiffness;
stiffness = limitElem->Get<double>(errors, "stiffness", 0.0).first;
ASSERT_TRUE(errors.empty());
EXPECT_DOUBLE_EQ(1e2, stiffness);

double dissipation = 0;
double dissipation;
dissipation = limitElem->Get<double>(
errors, "dissipation", dissipation).first;
errors, "dissipation", 0.0).first;
ASSERT_TRUE(errors.empty());
EXPECT_DOUBLE_EQ(1.5, dissipation);

Expand All @@ -286,31 +286,31 @@ TEST(DOMJointAxis, ToElement)
ASSERT_NE(nullptr, mimicElem);
std::string mimicJointName;
mimicJointName = mimicElem->Get<std::string>(
errors, "joint", mimicJointName).first;
errors, "joint", "").first;
ASSERT_TRUE(errors.empty());
EXPECT_EQ("test_joint", mimicJointName);

std::string mimicAxisName;
mimicAxisName = mimicElem->Get<std::string>(
errors, "axis", mimicAxisName).first;
errors, "axis", "").first;
ASSERT_TRUE(errors.empty());
EXPECT_EQ("axis2", mimicAxisName);

double multiplier;
multiplier = mimicElem->Get<double>(
errors, "multiplier", multiplier).first;
errors, "multiplier", 0.0).first;
ASSERT_TRUE(errors.empty());
EXPECT_DOUBLE_EQ(5.0, multiplier);

double offset;
offset = mimicElem->Get<double>(
errors, "offset", offset).first;
errors, "offset", 0.0).first;
ASSERT_TRUE(errors.empty());
EXPECT_DOUBLE_EQ(1.0, offset);

double reference;
reference = mimicElem->Get<double>(
errors, "reference", reference).first;
errors, "reference", 0.0).first;
ASSERT_TRUE(errors.empty());
EXPECT_DOUBLE_EQ(2.0, reference);

Expand Down

0 comments on commit 2f2d8e1

Please sign in to comment.