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.
This commit is contained in:
Chris Thrasher 2023-06-22 12:12:50 -06:00
parent cc0f760bbf
commit b9f56f79f0

View File

@ -3,6 +3,7 @@
// Other 1st party headers
#include <SFML/Graphics/CircleShape.hpp>
#include <catch2/catch_approx.hpp>
#include <catch2/catch_test_macros.hpp>
#include <SystemUtil.hpp>
@ -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")