Guard against min/max macros in tests too

parent 6e38649e
...@@ -70,8 +70,8 @@ template <typename T> ...@@ -70,8 +70,8 @@ template <typename T>
static void Verify(void(*f)(T, char*), char* (*g)(T, char*)) { static void Verify(void(*f)(T, char*), char* (*g)(T, char*)) {
// Boundary cases // Boundary cases
VerifyValue<T>(0, f, g); VerifyValue<T>(0, f, g);
VerifyValue<T>(std::numeric_limits<T>::min(), f, g); VerifyValue<T>((std::numeric_limits<T>::min)(), f, g);
VerifyValue<T>(std::numeric_limits<T>::max(), f, g); VerifyValue<T>((std::numeric_limits<T>::max)(), f, g);
// 2^n - 1, 2^n, 10^n - 1, 10^n until overflow // 2^n - 1, 2^n, 10^n - 1, 10^n until overflow
for (int power = 2; power <= 10; power += 8) { for (int power = 2; power <= 10; power += 8) {
......
...@@ -415,7 +415,7 @@ TEST(Reader, ParseNumber_NormalPrecisionError) { ...@@ -415,7 +415,7 @@ TEST(Reader, ParseNumber_NormalPrecisionError) {
uint64_t bias1 = e.ToBias(); uint64_t bias1 = e.ToBias();
uint64_t bias2 = a.ToBias(); uint64_t bias2 = a.ToBias();
double ulp = static_cast<double>(bias1 >= bias2 ? bias1 - bias2 : bias2 - bias1); double ulp = static_cast<double>(bias1 >= bias2 ? bias1 - bias2 : bias2 - bias1);
ulpMax = std::max(ulpMax, ulp); ulpMax = (std::max)(ulpMax, ulp);
ulpSum += ulp; ulpSum += ulp;
} }
printf("ULP Average = %g, Max = %g \n", ulpSum / count, ulpMax); printf("ULP Average = %g, Max = %g \n", ulpSum / count, ulpMax);
......
...@@ -91,7 +91,7 @@ TEST(Strtod, CheckApproximationCase) { ...@@ -91,7 +91,7 @@ TEST(Strtod, CheckApproximationCase) {
} }
// Remove common power of two factor from all three scaled values // 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; dS_Exp2 -= common_Exp2;
bS_Exp2 -= common_Exp2; bS_Exp2 -= common_Exp2;
hS_Exp2 -= common_Exp2; hS_Exp2 -= common_Exp2;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment