From 90b519c4d2493baf68f17b609112f8f5ce346b21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 17 Jan 2015 14:04:47 +0100 Subject: [PATCH] Math: improve Constants test, fix Clang compilation. --- src/Magnum/Math/Test/ConstantsTest.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Magnum/Math/Test/ConstantsTest.cpp b/src/Magnum/Math/Test/ConstantsTest.cpp index 2dc02c581..e68626dd9 100644 --- a/src/Magnum/Math/Test/ConstantsTest.cpp +++ b/src/Magnum/Math/Test/ConstantsTest.cpp @@ -23,6 +23,7 @@ DEALINGS IN THE SOFTWARE. */ +#include #include #include "Magnum/Math/Constants.h" @@ -77,10 +78,15 @@ template void ConstantsTest::_constants() { } template void ConstantsTest::_specials() { - constexpr T g = Constants::nan(); - CORRADE_VERIFY(g != g); + constexpr T a = Constants::nan(); + CORRADE_VERIFY(std::isnan(a)); + CORRADE_VERIFY(a != a); - constexpr T h = Constants::inf() - Constants::inf(); + constexpr T b = Constants::inf(); + CORRADE_VERIFY(std::isinf(b)); + + /* Clang complains that producing NaN is not constexpr */ + T h = Constants::inf() - Constants::inf(); CORRADE_VERIFY(h != h); }