diff options
Diffstat (limited to 'third_party/jpeg-xl/lib/jpegli/testing.h')
-rw-r--r-- | third_party/jpeg-xl/lib/jpegli/testing.h | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/third_party/jpeg-xl/lib/jpegli/testing.h b/third_party/jpeg-xl/lib/jpegli/testing.h index 873a0171e7..6a6e0ca638 100644 --- a/third_party/jpeg-xl/lib/jpegli/testing.h +++ b/third_party/jpeg-xl/lib/jpegli/testing.h @@ -6,15 +6,7 @@ #ifndef LIB_JPEGLI_TESTING_H_ #define LIB_JPEGLI_TESTING_H_ -// GTest/GMock specific macros / wrappers. - -// gmock unconditionally redefines those macros (to wrong values). -// Lets include it only here and mitigate the problem. -#pragma push_macro("PRIdS") -#pragma push_macro("PRIuS") -#include "gmock/gmock.h" -#pragma pop_macro("PRIuS") -#pragma pop_macro("PRIdS") +// GTest specific macros / wrappers. #include "gtest/gtest.h" @@ -28,8 +20,12 @@ // Ensures that we don't make our test bounds too lax, effectively disabling the // tests. -MATCHER_P(IsSlightlyBelow, max, "") { - return max * 0.75 <= arg && arg <= max * 1.0; -} +#define EXPECT_SLIGHTLY_BELOW(A, E) \ + { \ + double _actual = (A); \ + double _expected = (E); \ + EXPECT_LE(_actual, _expected); \ + EXPECT_GE(_actual, 0.75 * _expected); \ + } #endif // LIB_JPEGLI_TESTING_H_ |