35#ifndef GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
36#define GTEST_INCLUDE_GTEST_GTEST_PRED_IMPL_H_
72#define GTEST_ASSERT_(expression, on_failure) \
73 GTEST_AMBIGUOUS_ELSE_BLOCKER_ \
74 if (const ::testing::AssertionResult gtest_ar = (expression)) \
77 on_failure(gtest_ar.failure_message())
82template <
typename Pred,
91 << e1 <<
") evaluates to false, where"
92 <<
"\n" << e1 <<
" evaluates to " << v1;
97#define GTEST_PRED_FORMAT1_(pred_format, v1, on_failure)\
98 GTEST_ASSERT_(pred_format(#v1, v1), \
103#define GTEST_PRED1_(pred, v1, on_failure)\
104 GTEST_ASSERT_(::testing::AssertPred1Helper(#pred, \
110#define EXPECT_PRED_FORMAT1(pred_format, v1) \
111 GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_NONFATAL_FAILURE_)
112#define EXPECT_PRED1(pred, v1) \
113 GTEST_PRED1_(pred, v1, GTEST_NONFATAL_FAILURE_)
114#define ASSERT_PRED_FORMAT1(pred_format, v1) \
115 GTEST_PRED_FORMAT1_(pred_format, v1, GTEST_FATAL_FAILURE_)
116#define ASSERT_PRED1(pred, v1) \
117 GTEST_PRED1_(pred, v1, GTEST_FATAL_FAILURE_)
123template <
typename Pred,
136 << e2 <<
") evaluates to false, where"
137 <<
"\n" << e1 <<
" evaluates to " << v1
138 <<
"\n" << e2 <<
" evaluates to " << v2;
143#define GTEST_PRED_FORMAT2_(pred_format, v1, v2, on_failure)\
144 GTEST_ASSERT_(pred_format(#v1, #v2, v1, v2), \
149#define GTEST_PRED2_(pred, v1, v2, on_failure)\
150 GTEST_ASSERT_(::testing::AssertPred2Helper(#pred, \
158#define EXPECT_PRED_FORMAT2(pred_format, v1, v2) \
159 GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_NONFATAL_FAILURE_)
160#define EXPECT_PRED2(pred, v1, v2) \
161 GTEST_PRED2_(pred, v1, v2, GTEST_NONFATAL_FAILURE_)
162#define ASSERT_PRED_FORMAT2(pred_format, v1, v2) \
163 GTEST_PRED_FORMAT2_(pred_format, v1, v2, GTEST_FATAL_FAILURE_)
164#define ASSERT_PRED2(pred, v1, v2) \
165 GTEST_PRED2_(pred, v1, v2, GTEST_FATAL_FAILURE_)
171template <
typename Pred,
188 << e3 <<
") evaluates to false, where"
189 <<
"\n" << e1 <<
" evaluates to " << v1
190 <<
"\n" << e2 <<
" evaluates to " << v2
191 <<
"\n" << e3 <<
" evaluates to " << v3;
196#define GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, on_failure)\
197 GTEST_ASSERT_(pred_format(#v1, #v2, #v3, v1, v2, v3), \
202#define GTEST_PRED3_(pred, v1, v2, v3, on_failure)\
203 GTEST_ASSERT_(::testing::AssertPred3Helper(#pred, \
213#define EXPECT_PRED_FORMAT3(pred_format, v1, v2, v3) \
214 GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
215#define EXPECT_PRED3(pred, v1, v2, v3) \
216 GTEST_PRED3_(pred, v1, v2, v3, GTEST_NONFATAL_FAILURE_)
217#define ASSERT_PRED_FORMAT3(pred_format, v1, v2, v3) \
218 GTEST_PRED_FORMAT3_(pred_format, v1, v2, v3, GTEST_FATAL_FAILURE_)
219#define ASSERT_PRED3(pred, v1, v2, v3) \
220 GTEST_PRED3_(pred, v1, v2, v3, GTEST_FATAL_FAILURE_)
226template <
typename Pred,
247 << e4 <<
") evaluates to false, where"
248 <<
"\n" << e1 <<
" evaluates to " << v1
249 <<
"\n" << e2 <<
" evaluates to " << v2
250 <<
"\n" << e3 <<
" evaluates to " << v3
251 <<
"\n" << e4 <<
" evaluates to " << v4;
256#define GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, on_failure)\
257 GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, v1, v2, v3, v4), \
262#define GTEST_PRED4_(pred, v1, v2, v3, v4, on_failure)\
263 GTEST_ASSERT_(::testing::AssertPred4Helper(#pred, \
275#define EXPECT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
276 GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
277#define EXPECT_PRED4(pred, v1, v2, v3, v4) \
278 GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_NONFATAL_FAILURE_)
279#define ASSERT_PRED_FORMAT4(pred_format, v1, v2, v3, v4) \
280 GTEST_PRED_FORMAT4_(pred_format, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
281#define ASSERT_PRED4(pred, v1, v2, v3, v4) \
282 GTEST_PRED4_(pred, v1, v2, v3, v4, GTEST_FATAL_FAILURE_)
288template <
typename Pred,
313 << e5 <<
") evaluates to false, where"
314 <<
"\n" << e1 <<
" evaluates to " << v1
315 <<
"\n" << e2 <<
" evaluates to " << v2
316 <<
"\n" << e3 <<
" evaluates to " << v3
317 <<
"\n" << e4 <<
" evaluates to " << v4
318 <<
"\n" << e5 <<
" evaluates to " << v5;
323#define GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, on_failure)\
324 GTEST_ASSERT_(pred_format(#v1, #v2, #v3, #v4, #v5, v1, v2, v3, v4, v5), \
329#define GTEST_PRED5_(pred, v1, v2, v3, v4, v5, on_failure)\
330 GTEST_ASSERT_(::testing::AssertPred5Helper(#pred, \
344#define EXPECT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
345 GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
346#define EXPECT_PRED5(pred, v1, v2, v3, v4, v5) \
347 GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_NONFATAL_FAILURE_)
348#define ASSERT_PRED_FORMAT5(pred_format, v1, v2, v3, v4, v5) \
349 GTEST_PRED_FORMAT5_(pred_format, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
350#define ASSERT_PRED5(pred, v1, v2, v3, v4, v5) \
351 GTEST_PRED5_(pred, v1, v2, v3, v4, v5, GTEST_FATAL_FAILURE_)
GTEST_API_ AssertionResult AssertionFailure()
AssertionResult AssertPred1Helper(const char *pred_text, const char *e1, Pred pred, const T1 &v1)
AssertionResult AssertPred2Helper(const char *pred_text, const char *e1, const char *e2, Pred pred, const T1 &v1, const T2 &v2)
GTEST_API_ AssertionResult AssertionSuccess()
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)
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)
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)