improve portability of unit test code for windows compilers
This commit is contained in:
@ -9,6 +9,11 @@
|
|||||||
#include "fmtlib_format.cpp"
|
#include "fmtlib_format.cpp"
|
||||||
#include "fmtlib_os.cpp"
|
#include "fmtlib_os.cpp"
|
||||||
|
|
||||||
|
// Windows may define this as a macro
|
||||||
|
#if defined(max)
|
||||||
|
#undef max
|
||||||
|
#endif
|
||||||
|
|
||||||
TEST(ErrorStats, test)
|
TEST(ErrorStats, test)
|
||||||
{
|
{
|
||||||
ErrorStats stats;
|
ErrorStats stats;
|
||||||
|
|||||||
@ -48,7 +48,7 @@ inline static bool SimilarVec(Vector a, Vector b, int n, Scalar eps = 1.0e-06,
|
|||||||
Scalar ratio = 1.0e-06, Scalar ratio_denom = 1.0)
|
Scalar ratio = 1.0e-06, Scalar ratio_denom = 1.0)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < n; i++)
|
for (int i = 0; i < n; i++)
|
||||||
if (not Similar(a[i], b[i], eps, ratio, ratio_denom)) return false;
|
if (! Similar(a[i], b[i], eps, ratio, ratio_denom)) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +61,7 @@ inline static bool SimilarVecUnsigned(Vector a, Vector b, int n, Scalar eps = 1.
|
|||||||
return true;
|
return true;
|
||||||
else {
|
else {
|
||||||
for (int i = 0; i < n; i++)
|
for (int i = 0; i < n; i++)
|
||||||
if (not Similar(a[i], -b[i], eps, ratio, ratio_denom)) return false;
|
if (! Similar(a[i], -b[i], eps, ratio, ratio_denom)) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user