tests: Add explicit margin to Approx in tests_pose

To avoid an issue with catch2::Approx defaults applied around 0
See https://github.com/catchorg/Catch2/issues/1079
This commit is contained in:
Mateo de Mayo 2022-07-05 11:59:27 -03:00
parent 217c9749dc
commit d0b00c7d23

View file

@ -56,11 +56,12 @@ TEST_CASE("Pose interpolation works")
struct xrt_pose res = {};
math_pose_interpolate(&a, &b, 0.5, &res);
CHECK(res.position.x == Approx(0));
CHECK(res.position.y == Approx(0));
CHECK(res.position.z == Approx(0));
CHECK(res.orientation.x == Approx(0));
CHECK(res.orientation.x == Approx(0));
CHECK(res.orientation.y == Approx(0));
CHECK(res.orientation.w == Approx(1));
float e = std::numeric_limits<float>::epsilon();
CHECK(res.position.x == Approx(0).margin(e));
CHECK(res.position.y == Approx(0).margin(e));
CHECK(res.position.z == Approx(0).margin(e));
CHECK(res.orientation.x == Approx(0).margin(e));
CHECK(res.orientation.x == Approx(0).margin(e));
CHECK(res.orientation.y == Approx(0).margin(e));
CHECK(res.orientation.w == Approx(1).margin(e));
}