From e4c0ecf86b7db94014cde331cd43b6443f993be7 Mon Sep 17 00:00:00 2001 From: Christopher Warrington Date: Tue, 5 Sep 2017 18:27:02 -0700 Subject: [PATCH] Guard against min/max macros in tests too --- test/unittest/itoatest.cpp | 4 ++-- test/unittest/readertest.cpp | 2 +- test/unittest/strtodtest.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/unittest/itoatest.cpp b/test/unittest/itoatest.cpp index 2f66bedc..f41edeb7 100644 --- a/test/unittest/itoatest.cpp +++ b/test/unittest/itoatest.cpp @@ -70,8 +70,8 @@ template static void Verify(void(*f)(T, char*), char* (*g)(T, char*)) { // Boundary cases VerifyValue(0, f, g); - VerifyValue(std::numeric_limits::min(), f, g); - VerifyValue(std::numeric_limits::max(), f, g); + VerifyValue((std::numeric_limits::min)(), f, g); + VerifyValue((std::numeric_limits::max)(), f, g); // 2^n - 1, 2^n, 10^n - 1, 10^n until overflow for (int power = 2; power <= 10; power += 8) { diff --git a/test/unittest/readertest.cpp b/test/unittest/readertest.cpp index 5078f524..dad33d69 100644 --- a/test/unittest/readertest.cpp +++ b/test/unittest/readertest.cpp @@ -415,7 +415,7 @@ TEST(Reader, ParseNumber_NormalPrecisionError) { uint64_t bias1 = e.ToBias(); uint64_t bias2 = a.ToBias(); double ulp = static_cast(bias1 >= bias2 ? bias1 - bias2 : bias2 - bias1); - ulpMax = std::max(ulpMax, ulp); + ulpMax = (std::max)(ulpMax, ulp); ulpSum += ulp; } printf("ULP Average = %g, Max = %g \n", ulpSum / count, ulpMax); diff --git a/test/unittest/strtodtest.cpp b/test/unittest/strtodtest.cpp index cde836c7..807f8872 100644 --- a/test/unittest/strtodtest.cpp +++ b/test/unittest/strtodtest.cpp @@ -91,7 +91,7 @@ TEST(Strtod, CheckApproximationCase) { } // Remove common power of two factor from all three scaled values - int common_Exp2 = std::min(dS_Exp2, std::min(bS_Exp2, hS_Exp2)); + int common_Exp2 = (std::min)(dS_Exp2, (std::min)(bS_Exp2, hS_Exp2)); dS_Exp2 -= common_Exp2; bS_Exp2 -= common_Exp2; hS_Exp2 -= common_Exp2;