From d0b00c7d235c244f88973ccc3be944e808a5fd97 Mon Sep 17 00:00:00 2001 From: Mateo de Mayo Date: Tue, 5 Jul 2022 11:59:27 -0300 Subject: [PATCH] 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 --- tests/tests_pose.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/tests/tests_pose.cpp b/tests/tests_pose.cpp index 98bbd1b4d..0fdaa2289 100644 --- a/tests/tests_pose.cpp +++ b/tests/tests_pose.cpp @@ -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::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)); }