summaryrefslogtreecommitdiffstats
path: root/third_party/jpeg-xl/lib/jpegli/testing.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:13:27 +0000
commit40a355a42d4a9444dc753c04c6608dade2f06a23 (patch)
tree871fc667d2de662f171103ce5ec067014ef85e61 /third_party/jpeg-xl/lib/jpegli/testing.h
parentAdding upstream version 124.0.1. (diff)
downloadfirefox-adbda400be353e676059e335c3c0aaf99e719475.tar.xz
firefox-adbda400be353e676059e335c3c0aaf99e719475.zip
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'third_party/jpeg-xl/lib/jpegli/testing.h')
-rw-r--r--third_party/jpeg-xl/lib/jpegli/testing.h20
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_