Browse Source

DebugTools: update test to pass on clang-cl.

NaN printing strikes again.
pull/405/head
Vladimír Vondruš 6 years ago
parent
commit
dc56bf413a
  1. 34
      src/Magnum/DebugTools/Test/CompareImageTest.cpp

34
src/Magnum/DebugTools/Test/CompareImageTest.cpp

@ -510,7 +510,7 @@ void CompareImageTest::pixelDeltaSpecials() {
Implementation::printPixelDeltas(d, DeltaSpecials, ActualSpecials.format(), ActualSpecials.pixels(), ExpectedSpecials.pixels(), 1.5f, 0.5f, 10);
/* MSVC prints -nan(ind) instead of ±nan. But only sometimes. */
#ifdef _MSC_VER
#if defined(CORRADE_TARGET_MSVC) && !defined(CORRADE_TARGET_CLANG_CL)
CORRADE_COMPARE(out.str(), "\n"
" Pixels above max/mean threshold:\n"
" [5,0] Vector(-inf), expected Vector(inf) (Δ = inf)\n"
@ -675,7 +675,7 @@ void CompareImageTest::compareSpecials() {
/* Apple platforms, Android and MinGW32 don't print signed NaNs. This is
*not* a libc++ thing, tho -- libc++ on Linux prints signed NaNs. It used
to be with Emscripten too, but since 1.38.44 works the same as Linux. */
#if defined(CORRADE_TARGET_APPLE) || defined(CORRADE_TARGET_ANDROID) || defined(__MINGW32__)
#if defined(CORRADE_TARGET_APPLE) || defined(CORRADE_TARGET_ANDROID) || defined(CORRADE_TARGET_MINGW)
CORRADE_COMPARE(out.str(),
"Images a and b have both max and mean delta above threshold, actual 3.1/nan but at most 1.5/0.5 expected. Delta image:\n"
" |MMMM M ,M|\n"
@ -687,8 +687,21 @@ void CompareImageTest::compareSpecials() {
" [0,0] Vector(inf), expected Vector(1) (Δ = inf)\n"
" [8,0] Vector(3), expected Vector(-0.1) (Δ = 3.1)\n");
/* clang-cl prints -nan(ind) instead of ±nan, but differently than MSVC */
#elif defined(CORRADE_TARGET_CLANG_CL)
CORRADE_COMPARE(out.str(),
"Images a and b have both max and mean delta above threshold, actual 3.1/-nan(ind) but at most 1.5/0.5 expected. Delta image:\n"
" |MMMM M ,M|\n"
" Pixels above max/mean threshold:\n"
" [5,0] Vector(-inf), expected Vector(inf) (Δ = inf)\n"
" [3,0] Vector(0.3), expected Vector(nan) (Δ = nan)\n"
" [2,0] Vector(nan), expected Vector(0.3) (Δ = nan)\n"
" [1,0] Vector(0.3), expected Vector(-inf) (Δ = inf)\n"
" [0,0] Vector(inf), expected Vector(1) (Δ = inf)\n"
" [8,0] Vector(3), expected Vector(-0.1) (Δ = 3.1)\n");
/* MSVC prints -nan(ind) instead of ±nan. But only sometimes. */
#elif defined(_MSC_VER)
#elif defined(CORRADE_TARGET_MSVC)
CORRADE_COMPARE(out.str(),
"Images a and b have both max and mean delta above threshold, actual 3.1/-nan(ind) but at most 1.5/0.5 expected. Delta image:\n"
" |MMMM M ,M|\n"
@ -742,8 +755,21 @@ void CompareImageTest::compareSpecialsMeanOnly() {
" [0,0] Vector(inf), expected Vector(1) (Δ = inf)\n"
" [8,0] Vector(3), expected Vector(-0.1) (Δ = 3.1)\n");
/* clang-cl prints -nan(ind) instead of ±nan, but differently than MSVC */
#elif defined(CORRADE_TARGET_CLANG_CL)
CORRADE_COMPARE(out.str(),
"Images a and b have mean delta above threshold, actual -nan(ind) but at most 0.5 expected. Max delta 3.1 is within threshold 15. Delta image:\n"
" |MMMM M ,M|\n"
" Pixels above max/mean threshold:\n"
" [5,0] Vector(-inf), expected Vector(inf) (Δ = inf)\n"
" [3,0] Vector(0.3), expected Vector(nan) (Δ = nan)\n"
" [2,0] Vector(nan), expected Vector(0.3) (Δ = nan)\n"
" [1,0] Vector(0.3), expected Vector(-inf) (Δ = inf)\n"
" [0,0] Vector(inf), expected Vector(1) (Δ = inf)\n"
" [8,0] Vector(3), expected Vector(-0.1) (Δ = 3.1)\n");
/* MSVC prints -nan(ind) instead of ±nan. But only sometimes. */
#elif defined(CORRADE_TARGET_WINDOWS) && defined(_MSC_VER)
#elif defined(CORRADE_TARGET_MSVC)
CORRADE_COMPARE(out.str(),
"Images a and b have mean delta above threshold, actual -nan(ind) but at most 0.5 expected. Max delta 3.1 is within threshold 15. Delta image:\n"
" |MMMM M ,M|\n"

Loading…
Cancel
Save