diff --git a/src/Magnum/Animation/Test/EasingTest.cpp b/src/Magnum/Animation/Test/EasingTest.cpp index 9679c42d8..ff2d86cd5 100644 --- a/src/Magnum/Animation/Test/EasingTest.cpp +++ b/src/Magnum/Animation/Test/EasingTest.cpp @@ -257,6 +257,18 @@ EasingTest::EasingTest() { enum: std::size_t { PropertyVerificationStepCount = 50 }; +template struct BoundsLimits; +template<> struct BoundsLimits { + static Float min() { return 0.0f; } + static Float max() { return 1.0f; } +}; +template<> struct BoundsLimits { + /* Doubles very slightly overflow the bounds in release builds for some + of the functions, have some epsilon there */ + static Double min() { return 0.0 - Math::TypeTraits::epsilon(); } + static Double max() { return 1.0 + Math::TypeTraits::epsilon(); } +}; + template void EasingTest::bounds() { auto&& data = BoundsData[testCaseInstanceId()]; setTestCaseDescription(data.name); @@ -265,8 +277,8 @@ template void EasingTest::bounds() { T scale = T(1.0)/T(PropertyVerificationStepCount - 1); for(std::size_t i = 0; i != PropertyVerificationStepCount; ++i) { T t = i*scale; - CORRADE_COMPARE_AS(FunctionFor::function(data)(t), T(0.0), TestSuite::Compare::GreaterOrEqual); - CORRADE_COMPARE_AS(FunctionFor::function(data)(t), T(1.0), TestSuite::Compare::LessOrEqual); + CORRADE_COMPARE_AS(FunctionFor::function(data)(t), BoundsLimits::min(), TestSuite::Compare::GreaterOrEqual); + CORRADE_COMPARE_AS(FunctionFor::function(data)(t), BoundsLimits::max(), TestSuite::Compare::LessOrEqual); } }