From 5792d7f06a7f322a44886fbd38d87ab5ca84d9c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sat, 20 Oct 2018 14:40:52 +0200 Subject: [PATCH] Math: fun with printing NaNs :( --- src/Magnum/Math/Test/Matrix3Test.cpp | 18 ++++++++++++++++++ src/Magnum/Math/Test/Matrix4Test.cpp | 22 ++++++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/src/Magnum/Math/Test/Matrix3Test.cpp b/src/Magnum/Math/Test/Matrix3Test.cpp index edbf6d293..225217490 100644 --- a/src/Magnum/Math/Test/Matrix3Test.cpp +++ b/src/Magnum/Math/Test/Matrix3Test.cpp @@ -462,6 +462,23 @@ void Matrix3Test::rotationPartNotOrthogonal() { Matrix3::shearingX(1.5f).rotation(); Matrix3::scaling(Vector2::yScale(0.0f)).rotation(); + #if defined(CORRADE_TARGET_APPLE) || (defined(CORRADE_TARGET_WINDOWS) && defined(__MINGW32__)) || defined(CORRADE_TARGET_ANDROID) + CORRADE_COMPARE(out.str(), + "Math::Matrix3::rotation(): the normalized rotation part is not orthogonal:\n" + "Matrix(1, 0.83205,\n" + " 0, 0.5547)\n" + "Math::Matrix3::rotation(): the normalized rotation part is not orthogonal:\n" + "Matrix(1, nan,\n" + " 0, nan)\n"); + #elif defined(CORRADE_TARGET_WINDOWS) && defined(_MSC_VER) + CORRADE_COMPARE(out.str(), + "Math::Matrix3::rotation(): the normalized rotation part is not orthogonal:\n" + "Matrix(1, 0.83205,\n" + " 0, 0.5547)\n" + "Math::Matrix3::rotation(): the normalized rotation part is not orthogonal:\n" + "Matrix(1, -nan(ind),\n" + " 0, -nan(ind))\n"); + #else CORRADE_COMPARE(out.str(), "Math::Matrix3::rotation(): the normalized rotation part is not orthogonal:\n" "Matrix(1, 0.83205,\n" @@ -469,6 +486,7 @@ void Matrix3Test::rotationPartNotOrthogonal() { "Math::Matrix3::rotation(): the normalized rotation part is not orthogonal:\n" "Matrix(1, -nan,\n" " 0, -nan)\n"); + #endif } void Matrix3Test::rotationNormalizedPart() { diff --git a/src/Magnum/Math/Test/Matrix4Test.cpp b/src/Magnum/Math/Test/Matrix4Test.cpp index 5cbf0279f..aab4cb787 100644 --- a/src/Magnum/Math/Test/Matrix4Test.cpp +++ b/src/Magnum/Math/Test/Matrix4Test.cpp @@ -617,6 +617,27 @@ void Matrix4Test::rotationPartNotOrthogonal() { Matrix4::shearingXY(1.5f, 0.0f).rotation(); Matrix4::scaling(Vector3::yScale(0.0f)).rotation(); + #if defined(CORRADE_TARGET_APPLE) || (defined(CORRADE_TARGET_WINDOWS) && defined(__MINGW32__)) || defined(CORRADE_TARGET_ANDROID) + CORRADE_COMPARE(out.str(), + "Math::Matrix4::rotation(): the normalized rotation part is not orthogonal:\n" + "Matrix(1, 0, 0.83205,\n" + " 0, 1, 0,\n" + " 0, 0, 0.5547)\n" + "Math::Matrix4::rotation(): the normalized rotation part is not orthogonal:\n" + "Matrix(1, nan, 0,\n" + " 0, nan, 0,\n" + " 0, nan, 1)\n"); + #elif defined(CORRADE_TARGET_WINDOWS) && defined(_MSC_VER) + CORRADE_COMPARE(out.str(), + "Math::Matrix4::rotation(): the normalized rotation part is not orthogonal:\n" + "Matrix(1, 0, 0.83205,\n" + " 0, 1, 0,\n" + " 0, 0, 0.5547)\n" + "Math::Matrix4::rotation(): the normalized rotation part is not orthogonal:\n" + "Matrix(1, -nan(ind), 0,\n" + " 0, -nan(ind), 0,\n" + " 0, -nan(ind), 1)\n"); + #else CORRADE_COMPARE(out.str(), "Math::Matrix4::rotation(): the normalized rotation part is not orthogonal:\n" "Matrix(1, 0, 0.83205,\n" @@ -626,6 +647,7 @@ void Matrix4Test::rotationPartNotOrthogonal() { "Matrix(1, -nan, 0,\n" " 0, -nan, 0,\n" " 0, -nan, 1)\n"); + #endif } void Matrix4Test::rotationNormalizedPart() {