Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor clean up of tests #1289

Merged
merged 1 commit into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions src/JointAxis_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ TEST(DOMJointAxis, ToElement)
sdf::ElementPtr xyzElem = elem->GetElement("xyz", errors);
ASSERT_TRUE(errors.empty());
gz::math::Vector3d xyz = elem->Get<gz::math::Vector3d>(
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<std::string>(
errors, "expressed_in");
ASSERT_TRUE(errors.empty());
Expand All @@ -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<double>(errors, "damping", damping).first;
ASSERT_TRUE(errors.empty());
EXPECT_DOUBLE_EQ(0.2, damping);

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

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

double springStiffness;
double springStiffness = 0;
springStiffness = dynElem->Get<double>(
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<double>(errors, "lower", lower).first;
ASSERT_TRUE(errors.empty());
EXPECT_DOUBLE_EQ(-10.8, lower);

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

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

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

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

double dissipation;
double dissipation = 0;
dissipation = limitElem->Get<double>(
errors, "dissipation", dissipation).first;
ASSERT_TRUE(errors.empty());
Expand Down
2 changes: 1 addition & 1 deletion test/integration/toml_parser.hh
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down