From 2f2d8e13a23a7473b5903f1a0f8e74ad2c1e9344 Mon Sep 17 00:00:00 2001 From: Jose Luis Rivero Date: Mon, 22 Apr 2024 19:32:34 +0200 Subject: [PATCH] Fix trivial warning on 24.04 for JointAxis_TEST.cc (#1402) * Fix trivial warning on 24.04 for JointAxis_TEST.cc --------- Signed-off-by: Jose Luis Rivero Co-authored-by: Steve Peters --- src/JointAxis_TEST.cc | 50 +++++++++++++++++++++---------------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/src/JointAxis_TEST.cc b/src/JointAxis_TEST.cc index 0e04be6fd..bc612c689 100644 --- a/src/JointAxis_TEST.cc +++ b/src/JointAxis_TEST.cc @@ -226,58 +226,58 @@ TEST(DOMJointAxis, ToElement) sdf::ElementPtr dynElem = elem->GetElement("dynamics", errors); ASSERT_TRUE(errors.empty()); - double damping = 0; - damping = dynElem->Get(errors, "damping", damping).first; + double damping; + damping = dynElem->Get(errors, "damping", 0.0).first; ASSERT_TRUE(errors.empty()); EXPECT_DOUBLE_EQ(0.2, damping); - double friction = 0; - friction = dynElem->Get(errors, "friction", friction).first; + double friction; + friction = dynElem->Get(errors, "friction", 0.0).first; ASSERT_TRUE(errors.empty()); EXPECT_DOUBLE_EQ(1.3, friction); - double springReference = 0; + double springReference; springReference = dynElem->Get( - 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( - 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(errors, "lower", lower).first; + double lower; + lower = limitElem->Get(errors, "lower", 0.0).first; ASSERT_TRUE(errors.empty()); EXPECT_DOUBLE_EQ(-10.8, lower); - double upper = 0; - upper = limitElem->Get(errors, "upper", upper).first; + double upper; + upper = limitElem->Get(errors, "upper", 0.0).first; ASSERT_TRUE(errors.empty()); EXPECT_DOUBLE_EQ(123.4, upper); - double effort = 0; - effort = limitElem->Get(errors, "effort", effort).first; + double effort; + effort = limitElem->Get(errors, "effort", 0.0).first; ASSERT_TRUE(errors.empty()); EXPECT_DOUBLE_EQ(3.2, effort); - double maxVel = 0; - maxVel = limitElem->Get(errors, "velocity", maxVel).first; + double maxVel; + maxVel = limitElem->Get(errors, "velocity", 0.0).first; ASSERT_TRUE(errors.empty()); EXPECT_DOUBLE_EQ(54.2, maxVel); - double stiffness = 0; - stiffness = limitElem->Get(errors, "stiffness", stiffness).first; + double stiffness; + stiffness = limitElem->Get(errors, "stiffness", 0.0).first; ASSERT_TRUE(errors.empty()); EXPECT_DOUBLE_EQ(1e2, stiffness); - double dissipation = 0; + double dissipation; dissipation = limitElem->Get( - errors, "dissipation", dissipation).first; + errors, "dissipation", 0.0).first; ASSERT_TRUE(errors.empty()); EXPECT_DOUBLE_EQ(1.5, dissipation); @@ -286,31 +286,31 @@ TEST(DOMJointAxis, ToElement) ASSERT_NE(nullptr, mimicElem); std::string mimicJointName; mimicJointName = mimicElem->Get( - errors, "joint", mimicJointName).first; + errors, "joint", "").first; ASSERT_TRUE(errors.empty()); EXPECT_EQ("test_joint", mimicJointName); std::string mimicAxisName; mimicAxisName = mimicElem->Get( - errors, "axis", mimicAxisName).first; + errors, "axis", "").first; ASSERT_TRUE(errors.empty()); EXPECT_EQ("axis2", mimicAxisName); double multiplier; multiplier = mimicElem->Get( - errors, "multiplier", multiplier).first; + errors, "multiplier", 0.0).first; ASSERT_TRUE(errors.empty()); EXPECT_DOUBLE_EQ(5.0, multiplier); double offset; offset = mimicElem->Get( - errors, "offset", offset).first; + errors, "offset", 0.0).first; ASSERT_TRUE(errors.empty()); EXPECT_DOUBLE_EQ(1.0, offset); double reference; reference = mimicElem->Get( - errors, "reference", reference).first; + errors, "reference", 0.0).first; ASSERT_TRUE(errors.empty()); EXPECT_DOUBLE_EQ(2.0, reference);