Skip to content

Commit

Permalink
properly propagate epsilon values
Browse files Browse the repository at this point in the history
  • Loading branch information
Schmluk committed Sep 9, 2024
1 parent fb660ba commit 99d4887
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions config_utilities/test/src/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ bool expectEqual(const YAML::Node& a, const YAML::Node& b, double epsilon) {
return false;
}
for (size_t i = 0; i < a.size(); ++i) {
EXPECT_TRUE(expectEqual(a[i], b[i]));
if (!expectEqual(a[i], b[i])) {
EXPECT_TRUE(expectEqual(a[i], b[i], epsilon));
if (!expectEqual(a[i], b[i], epsilon)) {
return false;
}
}
Expand All @@ -79,8 +79,8 @@ bool expectEqual(const YAML::Node& a, const YAML::Node& b, double epsilon) {
ADD_FAILURE() << "Key '" << key << "' not found in b.";
return false;
}
EXPECT_TRUE(expectEqual(kv_pair.second, b[key]));
if (!expectEqual(kv_pair.second, b[key])) {
EXPECT_TRUE(expectEqual(kv_pair.second, b[key], epsilon));
if (!expectEqual(kv_pair.second, b[key], epsilon)) {
return false;
}
}
Expand Down
2 changes: 1 addition & 1 deletion config_utilities/test/tests/field_input_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ name: DefaultConfig
lower_exclusive: true
)";
// Epect near equal for floating point values.
expectEqual(info, YAML::Load(expected), 1e-4);
expectEqual(info, YAML::Load(expected), 1e-6);
}

} // namespace config::test

0 comments on commit 99d4887

Please sign in to comment.