From b9f56f79f03ae86a695756e699c89489d07149b3 Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Thu, 22 Jun 2023 12:12:50 -0600 Subject: [PATCH] Relax criteria for geometric center test Required to satisfy slight differences in how icpx handles floating point numbers. Only the x value of this vector required a larger tolerance than normal. Given how many floating point calculations are required to calculate geometric center, I'm not surprised to see such a modest deviation. --- test/Graphics/ConvexShape.test.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/Graphics/ConvexShape.test.cpp b/test/Graphics/ConvexShape.test.cpp index 1756cde52..50146ac7c 100644 --- a/test/Graphics/ConvexShape.test.cpp +++ b/test/Graphics/ConvexShape.test.cpp @@ -3,6 +3,7 @@ // Other 1st party headers #include +#include #include #include @@ -103,7 +104,8 @@ TEST_CASE("[Graphics] sf::ConvexShape") convex.setPoint(0, {-100000.f, 0.f}); convex.setPoint(1, {100000.f, 0.f}); convex.setPoint(2, {100000.f, 0.000001f}); - CHECK(convex.getGeometricCenter() == Approx(sf::Vector2f(100000.f / 3.f, 0.f))); + CHECK(convex.getGeometricCenter().x == Catch::Approx(100000. / 3.).margin(1e-2)); + CHECK(convex.getGeometricCenter().y == Catch::Approx(0).margin(1e-5)); } SECTION("Geometric center for aligned points")