Backed out 3 changesets (bug 1790375) for causing wd failures on fetch_error.py....
[gecko.git] / third_party / jpeg-xl / lib / jpegli / testing.h
blob873a0171e7adacef9283ca3ef96770def2d32c4b
1 // Copyright (c) the JPEG XL Project Authors. All rights reserved.
2 //
3 // Use of this source code is governed by a BSD-style
4 // license that can be found in the LICENSE file.
6 #ifndef LIB_JPEGLI_TESTING_H_
7 #define LIB_JPEGLI_TESTING_H_
9 // GTest/GMock specific macros / wrappers.
11 // gmock unconditionally redefines those macros (to wrong values).
12 // Lets include it only here and mitigate the problem.
13 #pragma push_macro("PRIdS")
14 #pragma push_macro("PRIuS")
15 #include "gmock/gmock.h"
16 #pragma pop_macro("PRIuS")
17 #pragma pop_macro("PRIdS")
19 #include "gtest/gtest.h"
21 // googletest before 1.10 didn't define INSTANTIATE_TEST_SUITE_P() but instead
22 // used INSTANTIATE_TEST_CASE_P which is now deprecated.
23 #ifdef INSTANTIATE_TEST_SUITE_P
24 #define JPEGLI_INSTANTIATE_TEST_SUITE_P INSTANTIATE_TEST_SUITE_P
25 #else
26 #define JPEGLI_INSTANTIATE_TEST_SUITE_P INSTANTIATE_TEST_CASE_P
27 #endif
29 // Ensures that we don't make our test bounds too lax, effectively disabling the
30 // tests.
31 MATCHER_P(IsSlightlyBelow, max, "") {
32 return max * 0.75 <= arg && arg <= max * 1.0;
35 #endif // LIB_JPEGLI_TESTING_H_