36 #ifndef GOOGLETEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
37 #define GOOGLETEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
39 #include "gtest/gtest.h"
75 #define GTEST_ASSERT_(expression, on_failure) \
76 GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
77 if (const ::testing::AssertionResult gtest_ar = (expression)) \
80 on_failure(gtest_ar.failure_message())
85 template <
typename Pred,
91 if (pred(v1))
return AssertionSuccess();
93 return AssertionFailure()
94 << pred_text <<
"(" << e1 <<
") evaluates to false, where"
101 #define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure)\
102 GTEST_ASSERT_(pred_format(#v1, v1), \
107 #define GTEST_PRED1_(pred, v1, on_failure)\
108 GTEST_ASSERT_(::testing::AssertPred1Helper(#pred, \
114 #define EXPECT_PRED_FORMAT1(pred_format, v1) \
115 GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_NONFATAL_FAILURE_)
116 #define EXPECT_PRED1(pred, v1) \
117 GTEST_PRED1_(pred, v1, GTEST_NONFATAL_FAILURE_)
118 #define ASSERT_PRED_FORMAT1(pred_format, v1) \
119 GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_FATAL_FAILURE_)
120 #define ASSERT_PRED1(pred, v1) \
121 GTEST_PRED1_(pred, v1, GTEST_FATAL_FAILURE_)
127 template <
typename Pred,
136 if (pred(v1, v2))
return AssertionSuccess();
138 return AssertionFailure()
139 << pred_text <<
"(" << e1 <<
", " << e2
140 <<
") evaluates to false, where"
148 #define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\
149 GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
154 #define GTEST_PRED2_(pred, v1, v2, on_failure)\
155 GTEST_ASSERT_(::testing::AssertPred2Helper(#pred, \
163 #define EXPECT_PRED_FORMAT2(pred_format, v1, v2) \
164 GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
165 #define EXPECT_PRED2(pred, v1, v2) \
166 GTEST_PRED2_(pred, v1, v2, GTEST_NONFATAL_FAILURE_)
167 #define ASSERT_PRED_FORMAT2(pred_format, v1, v2) \
168 GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_)
169 #define ASSERT_PRED2(pred, v1, v2) \
170 GTEST_PRED2_(pred, v1, v2, GTEST_FATAL_FAILURE_)
176 template <
typename Pred,
188 if (pred(v1, v2, v3))
return AssertionSuccess();
190 return AssertionFailure()
191 << pred_text <<
"(" << e1 <<
", " << e2 <<
", " << e3
192 <<
") evaluates to false, where"
201 #define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure)\
202 GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3), \
207 #define GTEST_PRED3_(pred, v1, v2, v3, on_failure)\
208 GTEST_ASSERT_(::testing::AssertPred3Helper(#pred, \
218 #define EXPECT_PRED_FORMAT3(pred_format, v1, v2, v3) \
219 GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
220 #define EXPECT_PRED3(pred, v1, v2, v3) \
221 GTEST_PRED3_(pred, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
222 #define ASSERT_PRED_FORMAT3(pred_format, v1, v2, v3) \
223 GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_FATAL_FAILURE_)
224 #define ASSERT_PRED3(pred, v1, v2, v3) \
225 GTEST_PRED3_(pred, v1, v2, v3, GTEST_FATAL_FAILURE_)
231 template <
typename Pred,
246 if (pred(v1, v2, v3, v4))
return AssertionSuccess();
248 return AssertionFailure()
249 << pred_text <<
"(" << e1 <<
", " << e2 <<
", " << e3 <<
", " << e4
250 <<
") evaluates to false, where"
260 #define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure)\
261 GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4), \
266 #define GTEST_PRED4_(pred, v1, v2, v3, v4, on_failure)\
267 GTEST_ASSERT_(::testing::AssertPred4Helper(#pred, \
279 #define EXPECT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
280 GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
281 #define EXPECT_PRED4(pred, v1, v2, v3, v4) \
282 GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
283 #define ASSERT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
284 GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
285 #define ASSERT_PRED4(pred, v1, v2, v3, v4) \
286 GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
292 template <
typename Pred,
310 if (pred(v1, v2, v3, v4, v5))
return AssertionSuccess();
312 return AssertionFailure()
313 << pred_text <<
"(" << e1 <<
", " << e2 <<
", " << e3 <<
", " << e4
314 <<
", " << e5 <<
") evaluates to false, where"
325 #define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure)\
326 GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5), \
331 #define GTEST_PRED5_(pred, v1, v2, v3, v4, v5, on_failure)\
332 GTEST_ASSERT_(::testing::AssertPred5Helper(#pred, \
346 #define EXPECT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
347 GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
348 #define EXPECT_PRED5(pred, v1, v2, v3, v4, v5) \
349 GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
350 #define ASSERT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
351 GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
352 #define ASSERT_PRED5(pred, v1, v2, v3, v4, v5) \
353 GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
Definition: cmake-build-debug/googletest-src/googlemock/include/gmock/gmock-actions.h:154
AssertionResult AssertPred1Helper(const char *pred_text, const char *e1, Pred pred, const T1 &v1)
Definition: cmake-build-debug/googletest-src/googletest/include/gtest/gtest_pred_impl.h:87
::std::string PrintToString(const T &value)
Definition: cmake-build-debug/googletest-src/googletest/include/gtest/gtest-printers.h:942
AssertionResult AssertPred2Helper(const char *pred_text, const char *e1, const char *e2, Pred pred, const T1 &v1, const T2 &v2)
Definition: cmake-build-debug/googletest-src/googletest/include/gtest/gtest_pred_impl.h:130
AssertionResult AssertPred3Helper(const char *pred_text, const char *e1, const char *e2, const char *e3, Pred pred, const T1 &v1, const T2 &v2, const T3 &v3)
Definition: cmake-build-debug/googletest-src/googletest/include/gtest/gtest_pred_impl.h:180
AssertionResult AssertPred5Helper(const char *pred_text, const char *e1, const char *e2, const char *e3, const char *e4, const char *e5, Pred pred, const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4, const T5 &v5)
Definition: cmake-build-debug/googletest-src/googletest/include/gtest/gtest_pred_impl.h:298
AssertionResult AssertPred4Helper(const char *pred_text, const char *e1, const char *e2, const char *e3, const char *e4, Pred pred, const T1 &v1, const T2 &v2, const T3 &v3, const T4 &v4)
Definition: cmake-build-debug/googletest-src/googletest/include/gtest/gtest_pred_impl.h:236