diff --git a/src/Magnum/Math/Test/TypeTraitsTest.cpp b/src/Magnum/Math/Test/TypeTraitsTest.cpp index df4a08b68..7f733e6ed 100644 --- a/src/Magnum/Math/Test/TypeTraitsTest.cpp +++ b/src/Magnum/Math/Test/TypeTraitsTest.cpp @@ -33,102 +33,71 @@ namespace Magnum { namespace Math { namespace Test { struct TypeTraitsTest: Corrade::TestSuite::Tester { explicit TypeTraitsTest(); - void equalsIntegral(); - void equalsFloatingPoint0(); - void equalsFloatingPoint1(); - void equalsFloatingPointLarge(); - void equalsFloatingPointInfinity(); - void equalsFloatingPointNaN(); - - private: - template void _equalsIntegral(); - template void _equalsFloatingPoint0(); - template void _equalsFloatingPoint1(); - template void _equalsFloatingPointLarge(); - template void _equalsFloatingPointInfinity(); - template void _equalsFloatingPointNaN(); + template void equalsIntegral(); + template void equalsFloatingPoint0(); + template void equalsFloatingPoint1(); + template void equalsFloatingPointLarge(); + template void equalsFloatingPointInfinity(); + template void equalsFloatingPointNaN(); }; TypeTraitsTest::TypeTraitsTest() { - addTests({&TypeTraitsTest::equalsIntegral, - &TypeTraitsTest::equalsFloatingPoint0, - &TypeTraitsTest::equalsFloatingPoint1, - &TypeTraitsTest::equalsFloatingPointLarge, - &TypeTraitsTest::equalsFloatingPointInfinity, - &TypeTraitsTest::equalsFloatingPointNaN}); + addTests({&TypeTraitsTest::equalsIntegral, + &TypeTraitsTest::equalsIntegral, + &TypeTraitsTest::equalsIntegral, + &TypeTraitsTest::equalsIntegral, + &TypeTraitsTest::equalsIntegral, + &TypeTraitsTest::equalsIntegral, + &TypeTraitsTest::equalsIntegral, + &TypeTraitsTest::equalsIntegral, + &TypeTraitsTest::equalsFloatingPoint0, + #ifndef MAGNUM_TARGET_GLES + &TypeTraitsTest::equalsFloatingPoint0, + #endif + &TypeTraitsTest::equalsFloatingPoint1, + #ifndef MAGNUM_TARGET_GLES + &TypeTraitsTest::equalsFloatingPoint1, + #endif + &TypeTraitsTest::equalsFloatingPointLarge, + #ifndef MAGNUM_TARGET_GLES + &TypeTraitsTest::equalsFloatingPointLarge, + #endif + &TypeTraitsTest::equalsFloatingPointInfinity, + #ifndef MAGNUM_TARGET_GLES + &TypeTraitsTest::equalsFloatingPointInfinity, + #endif + &TypeTraitsTest::equalsFloatingPointNaN, + #ifndef MAGNUM_TARGET_GLES + &TypeTraitsTest::equalsFloatingPointNaN + #endif + }); } -void TypeTraitsTest::equalsIntegral() { - _equalsIntegral(); - _equalsIntegral(); - _equalsIntegral(); - _equalsIntegral(); - _equalsIntegral(); - _equalsIntegral(); - _equalsIntegral(); - _equalsIntegral(); -} - -template void TypeTraitsTest::_equalsIntegral() { +template void TypeTraitsTest::equalsIntegral() { CORRADE_VERIFY(!TypeTraits::equals(1, 1+TypeTraits::epsilon())); } -void TypeTraitsTest::equalsFloatingPoint0() { - _equalsFloatingPoint0(); - #ifndef MAGNUM_TARGET_GLES - _equalsFloatingPoint0(); - #endif -} - -template void TypeTraitsTest::_equalsFloatingPoint0() { +template void TypeTraitsTest::equalsFloatingPoint0() { CORRADE_VERIFY(TypeTraits::equals(T(0)+TypeTraits::epsilon()/T(2), T(0))); CORRADE_VERIFY(!TypeTraits::equals(T(0)+TypeTraits::epsilon()*T(2), T(0))); } -void TypeTraitsTest::equalsFloatingPoint1() { - _equalsFloatingPoint1(); - #ifndef MAGNUM_TARGET_GLES - _equalsFloatingPoint1(); - #endif -} - -template void TypeTraitsTest::_equalsFloatingPoint1() { +template void TypeTraitsTest::equalsFloatingPoint1() { CORRADE_VERIFY(TypeTraits::equals(T(1)+TypeTraits::epsilon()/T(2), T(1))); CORRADE_VERIFY(!TypeTraits::equals(T(1)+TypeTraits::epsilon()*T(3), T(1))); } -void TypeTraitsTest::equalsFloatingPointLarge() { - _equalsFloatingPointLarge(); - #ifndef MAGNUM_TARGET_GLES - _equalsFloatingPointLarge(); - #endif -} - -template void TypeTraitsTest::_equalsFloatingPointLarge() { +template void TypeTraitsTest::equalsFloatingPointLarge() { CORRADE_VERIFY(TypeTraits::equals(T(25)+TypeTraits::epsilon()*T(2), T(25))); CORRADE_VERIFY(!TypeTraits::equals(T(25)+TypeTraits::epsilon()*T(75), T(25))); } -void TypeTraitsTest::equalsFloatingPointInfinity() { - _equalsFloatingPointInfinity(); - #ifndef MAGNUM_TARGET_GLES - _equalsFloatingPointInfinity(); - #endif -} - -template void TypeTraitsTest::_equalsFloatingPointInfinity() { +template void TypeTraitsTest::equalsFloatingPointInfinity() { CORRADE_VERIFY(TypeTraits::equals(Constants::inf(), Constants::inf())); } -void TypeTraitsTest::equalsFloatingPointNaN() { - _equalsFloatingPointNaN(); - #ifndef MAGNUM_TARGET_GLES - _equalsFloatingPointNaN(); - #endif -} - -template void TypeTraitsTest::_equalsFloatingPointNaN() { +template void TypeTraitsTest::equalsFloatingPointNaN() { CORRADE_VERIFY(!TypeTraits::equals(Constants::nan(), Constants::nan())); }