1 // Copyright 2006, Google Inc.
2 // All rights reserved.
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are
8 // * Redistributions of source code must retain the above copyright
9 // notice, this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above
11 // copyright notice, this list of conditions and the following disclaimer
12 // in the documentation and/or other materials provided with the
14 // * Neither the name of Google Inc. nor the names of its
15 // contributors may be used to endorse or promote products derived from
16 // this software without specific prior written permission.
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 // This file is AUTOMATICALLY GENERATED on 11/05/2019 by command
31 // 'gen_gtest_pred_impl.py 5'. DO NOT EDIT BY HAND!
33 // Regression test for gtest_pred_impl.h
35 // This file is generated by a script and quite long. If you intend to
36 // learn how Google Test works by reading its unit tests, read
37 // gtest_unittest.cc instead.
39 // This is intended as a regression test for the Google Test predicate
40 // assertions. We compile it as part of the gtest_unittest target
41 // only to keep the implementation tidy and compact, as it is quite
42 // involved to set up the stage for testing Google Test using Google
45 // Currently, gtest_unittest takes ~11 seconds to run in the testing
46 // daemon. In the future, if it grows too large and needs much more
47 // time to finish, we should consider separating this file into a
48 // stand-alone regression test.
52 #include "gtest/gtest.h"
53 #include "gtest/gtest-spi.h"
55 // A user-defined data type.
57 explicit Bool(int val
) : value(val
!= 0) {}
59 bool operator>(int n
) const { return value
> Bool(n
).value
; }
61 Bool
operator+(const Bool
& rhs
) const { return Bool(value
+ rhs
.value
); }
63 bool operator==(const Bool
& rhs
) const { return value
== rhs
.value
; }
68 // Enables Bool to be used in assertions.
69 std::ostream
& operator<<(std::ostream
& os
, const Bool
& x
) {
70 return os
<< (x
.value
? "true" : "false");
73 // Sample functions/functors for testing unary predicate assertions.
75 // A unary predicate function.
76 template <typename T1
>
77 bool PredFunction1(T1 v1
) {
81 // The following two functions are needed because a compiler doesn't have
82 // a context yet to know which template function must be instantiated.
83 bool PredFunction1Int(int v1
) {
86 bool PredFunction1Bool(Bool v1
) {
90 // A unary predicate functor.
92 template <typename T1
>
93 bool operator()(const T1
& v1
) {
98 // A unary predicate-formatter function.
99 template <typename T1
>
100 testing::AssertionResult
PredFormatFunction1(const char* e1
,
102 if (PredFunction1(v1
))
103 return testing::AssertionSuccess();
105 return testing::AssertionFailure()
107 << " is expected to be positive, but evaluates to "
111 // A unary predicate-formatter functor.
112 struct PredFormatFunctor1
{
113 template <typename T1
>
114 testing::AssertionResult
operator()(const char* e1
,
115 const T1
& v1
) const {
116 return PredFormatFunction1(e1
, v1
);
120 // Tests for {EXPECT|ASSERT}_PRED_FORMAT1.
122 class Predicate1Test
: public testing::Test
{
124 void SetUp() override
{
125 expected_to_finish_
= true;
130 void TearDown() override
{
131 // Verifies that each of the predicate's arguments was evaluated
134 "The predicate assertion didn't evaluate argument 2 "
137 // Verifies that the control flow in the test function is expected.
138 if (expected_to_finish_
&& !finished_
) {
139 FAIL() << "The predicate assertion unexpactedly aborted the test.";
140 } else if (!expected_to_finish_
&& finished_
) {
141 FAIL() << "The failed predicate assertion didn't abort the test "
146 // true if and only if the test function is expected to run to finish.
147 static bool expected_to_finish_
;
149 // true if and only if the test function did run to finish.
150 static bool finished_
;
155 bool Predicate1Test::expected_to_finish_
;
156 bool Predicate1Test::finished_
;
157 int Predicate1Test::n1_
;
159 typedef Predicate1Test EXPECT_PRED_FORMAT1Test
;
160 typedef Predicate1Test ASSERT_PRED_FORMAT1Test
;
161 typedef Predicate1Test EXPECT_PRED1Test
;
162 typedef Predicate1Test ASSERT_PRED1Test
;
164 // Tests a successful EXPECT_PRED1 where the
165 // predicate-formatter is a function on a built-in type (int).
166 TEST_F(EXPECT_PRED1Test
, FunctionOnBuiltInTypeSuccess
) {
167 EXPECT_PRED1(PredFunction1Int
,
172 // Tests a successful EXPECT_PRED1 where the
173 // predicate-formatter is a function on a user-defined type (Bool).
174 TEST_F(EXPECT_PRED1Test
, FunctionOnUserTypeSuccess
) {
175 EXPECT_PRED1(PredFunction1Bool
,
180 // Tests a successful EXPECT_PRED1 where the
181 // predicate-formatter is a functor on a built-in type (int).
182 TEST_F(EXPECT_PRED1Test
, FunctorOnBuiltInTypeSuccess
) {
183 EXPECT_PRED1(PredFunctor1(),
188 // Tests a successful EXPECT_PRED1 where the
189 // predicate-formatter is a functor on a user-defined type (Bool).
190 TEST_F(EXPECT_PRED1Test
, FunctorOnUserTypeSuccess
) {
191 EXPECT_PRED1(PredFunctor1(),
196 // Tests a failed EXPECT_PRED1 where the
197 // predicate-formatter is a function on a built-in type (int).
198 TEST_F(EXPECT_PRED1Test
, FunctionOnBuiltInTypeFailure
) {
199 EXPECT_NONFATAL_FAILURE({ // NOLINT
200 EXPECT_PRED1(PredFunction1Int
,
206 // Tests a failed EXPECT_PRED1 where the
207 // predicate-formatter is a function on a user-defined type (Bool).
208 TEST_F(EXPECT_PRED1Test
, FunctionOnUserTypeFailure
) {
209 EXPECT_NONFATAL_FAILURE({ // NOLINT
210 EXPECT_PRED1(PredFunction1Bool
,
216 // Tests a failed EXPECT_PRED1 where the
217 // predicate-formatter is a functor on a built-in type (int).
218 TEST_F(EXPECT_PRED1Test
, FunctorOnBuiltInTypeFailure
) {
219 EXPECT_NONFATAL_FAILURE({ // NOLINT
220 EXPECT_PRED1(PredFunctor1(),
226 // Tests a failed EXPECT_PRED1 where the
227 // predicate-formatter is a functor on a user-defined type (Bool).
228 TEST_F(EXPECT_PRED1Test
, FunctorOnUserTypeFailure
) {
229 EXPECT_NONFATAL_FAILURE({ // NOLINT
230 EXPECT_PRED1(PredFunctor1(),
236 // Tests a successful ASSERT_PRED1 where the
237 // predicate-formatter is a function on a built-in type (int).
238 TEST_F(ASSERT_PRED1Test
, FunctionOnBuiltInTypeSuccess
) {
239 ASSERT_PRED1(PredFunction1Int
,
244 // Tests a successful ASSERT_PRED1 where the
245 // predicate-formatter is a function on a user-defined type (Bool).
246 TEST_F(ASSERT_PRED1Test
, FunctionOnUserTypeSuccess
) {
247 ASSERT_PRED1(PredFunction1Bool
,
252 // Tests a successful ASSERT_PRED1 where the
253 // predicate-formatter is a functor on a built-in type (int).
254 TEST_F(ASSERT_PRED1Test
, FunctorOnBuiltInTypeSuccess
) {
255 ASSERT_PRED1(PredFunctor1(),
260 // Tests a successful ASSERT_PRED1 where the
261 // predicate-formatter is a functor on a user-defined type (Bool).
262 TEST_F(ASSERT_PRED1Test
, FunctorOnUserTypeSuccess
) {
263 ASSERT_PRED1(PredFunctor1(),
268 // Tests a failed ASSERT_PRED1 where the
269 // predicate-formatter is a function on a built-in type (int).
270 TEST_F(ASSERT_PRED1Test
, FunctionOnBuiltInTypeFailure
) {
271 expected_to_finish_
= false;
272 EXPECT_FATAL_FAILURE({ // NOLINT
273 ASSERT_PRED1(PredFunction1Int
,
279 // Tests a failed ASSERT_PRED1 where the
280 // predicate-formatter is a function on a user-defined type (Bool).
281 TEST_F(ASSERT_PRED1Test
, FunctionOnUserTypeFailure
) {
282 expected_to_finish_
= false;
283 EXPECT_FATAL_FAILURE({ // NOLINT
284 ASSERT_PRED1(PredFunction1Bool
,
290 // Tests a failed ASSERT_PRED1 where the
291 // predicate-formatter is a functor on a built-in type (int).
292 TEST_F(ASSERT_PRED1Test
, FunctorOnBuiltInTypeFailure
) {
293 expected_to_finish_
= false;
294 EXPECT_FATAL_FAILURE({ // NOLINT
295 ASSERT_PRED1(PredFunctor1(),
301 // Tests a failed ASSERT_PRED1 where the
302 // predicate-formatter is a functor on a user-defined type (Bool).
303 TEST_F(ASSERT_PRED1Test
, FunctorOnUserTypeFailure
) {
304 expected_to_finish_
= false;
305 EXPECT_FATAL_FAILURE({ // NOLINT
306 ASSERT_PRED1(PredFunctor1(),
312 // Tests a successful EXPECT_PRED_FORMAT1 where the
313 // predicate-formatter is a function on a built-in type (int).
314 TEST_F(EXPECT_PRED_FORMAT1Test
, FunctionOnBuiltInTypeSuccess
) {
315 EXPECT_PRED_FORMAT1(PredFormatFunction1
,
320 // Tests a successful EXPECT_PRED_FORMAT1 where the
321 // predicate-formatter is a function on a user-defined type (Bool).
322 TEST_F(EXPECT_PRED_FORMAT1Test
, FunctionOnUserTypeSuccess
) {
323 EXPECT_PRED_FORMAT1(PredFormatFunction1
,
328 // Tests a successful EXPECT_PRED_FORMAT1 where the
329 // predicate-formatter is a functor on a built-in type (int).
330 TEST_F(EXPECT_PRED_FORMAT1Test
, FunctorOnBuiltInTypeSuccess
) {
331 EXPECT_PRED_FORMAT1(PredFormatFunctor1(),
336 // Tests a successful EXPECT_PRED_FORMAT1 where the
337 // predicate-formatter is a functor on a user-defined type (Bool).
338 TEST_F(EXPECT_PRED_FORMAT1Test
, FunctorOnUserTypeSuccess
) {
339 EXPECT_PRED_FORMAT1(PredFormatFunctor1(),
344 // Tests a failed EXPECT_PRED_FORMAT1 where the
345 // predicate-formatter is a function on a built-in type (int).
346 TEST_F(EXPECT_PRED_FORMAT1Test
, FunctionOnBuiltInTypeFailure
) {
347 EXPECT_NONFATAL_FAILURE({ // NOLINT
348 EXPECT_PRED_FORMAT1(PredFormatFunction1
,
354 // Tests a failed EXPECT_PRED_FORMAT1 where the
355 // predicate-formatter is a function on a user-defined type (Bool).
356 TEST_F(EXPECT_PRED_FORMAT1Test
, FunctionOnUserTypeFailure
) {
357 EXPECT_NONFATAL_FAILURE({ // NOLINT
358 EXPECT_PRED_FORMAT1(PredFormatFunction1
,
364 // Tests a failed EXPECT_PRED_FORMAT1 where the
365 // predicate-formatter is a functor on a built-in type (int).
366 TEST_F(EXPECT_PRED_FORMAT1Test
, FunctorOnBuiltInTypeFailure
) {
367 EXPECT_NONFATAL_FAILURE({ // NOLINT
368 EXPECT_PRED_FORMAT1(PredFormatFunctor1(),
374 // Tests a failed EXPECT_PRED_FORMAT1 where the
375 // predicate-formatter is a functor on a user-defined type (Bool).
376 TEST_F(EXPECT_PRED_FORMAT1Test
, FunctorOnUserTypeFailure
) {
377 EXPECT_NONFATAL_FAILURE({ // NOLINT
378 EXPECT_PRED_FORMAT1(PredFormatFunctor1(),
384 // Tests a successful ASSERT_PRED_FORMAT1 where the
385 // predicate-formatter is a function on a built-in type (int).
386 TEST_F(ASSERT_PRED_FORMAT1Test
, FunctionOnBuiltInTypeSuccess
) {
387 ASSERT_PRED_FORMAT1(PredFormatFunction1
,
392 // Tests a successful ASSERT_PRED_FORMAT1 where the
393 // predicate-formatter is a function on a user-defined type (Bool).
394 TEST_F(ASSERT_PRED_FORMAT1Test
, FunctionOnUserTypeSuccess
) {
395 ASSERT_PRED_FORMAT1(PredFormatFunction1
,
400 // Tests a successful ASSERT_PRED_FORMAT1 where the
401 // predicate-formatter is a functor on a built-in type (int).
402 TEST_F(ASSERT_PRED_FORMAT1Test
, FunctorOnBuiltInTypeSuccess
) {
403 ASSERT_PRED_FORMAT1(PredFormatFunctor1(),
408 // Tests a successful ASSERT_PRED_FORMAT1 where the
409 // predicate-formatter is a functor on a user-defined type (Bool).
410 TEST_F(ASSERT_PRED_FORMAT1Test
, FunctorOnUserTypeSuccess
) {
411 ASSERT_PRED_FORMAT1(PredFormatFunctor1(),
416 // Tests a failed ASSERT_PRED_FORMAT1 where the
417 // predicate-formatter is a function on a built-in type (int).
418 TEST_F(ASSERT_PRED_FORMAT1Test
, FunctionOnBuiltInTypeFailure
) {
419 expected_to_finish_
= false;
420 EXPECT_FATAL_FAILURE({ // NOLINT
421 ASSERT_PRED_FORMAT1(PredFormatFunction1
,
427 // Tests a failed ASSERT_PRED_FORMAT1 where the
428 // predicate-formatter is a function on a user-defined type (Bool).
429 TEST_F(ASSERT_PRED_FORMAT1Test
, FunctionOnUserTypeFailure
) {
430 expected_to_finish_
= false;
431 EXPECT_FATAL_FAILURE({ // NOLINT
432 ASSERT_PRED_FORMAT1(PredFormatFunction1
,
438 // Tests a failed ASSERT_PRED_FORMAT1 where the
439 // predicate-formatter is a functor on a built-in type (int).
440 TEST_F(ASSERT_PRED_FORMAT1Test
, FunctorOnBuiltInTypeFailure
) {
441 expected_to_finish_
= false;
442 EXPECT_FATAL_FAILURE({ // NOLINT
443 ASSERT_PRED_FORMAT1(PredFormatFunctor1(),
449 // Tests a failed ASSERT_PRED_FORMAT1 where the
450 // predicate-formatter is a functor on a user-defined type (Bool).
451 TEST_F(ASSERT_PRED_FORMAT1Test
, FunctorOnUserTypeFailure
) {
452 expected_to_finish_
= false;
453 EXPECT_FATAL_FAILURE({ // NOLINT
454 ASSERT_PRED_FORMAT1(PredFormatFunctor1(),
459 // Sample functions/functors for testing binary predicate assertions.
461 // A binary predicate function.
462 template <typename T1
, typename T2
>
463 bool PredFunction2(T1 v1
, T2 v2
) {
467 // The following two functions are needed because a compiler doesn't have
468 // a context yet to know which template function must be instantiated.
469 bool PredFunction2Int(int v1
, int v2
) {
472 bool PredFunction2Bool(Bool v1
, Bool v2
) {
476 // A binary predicate functor.
477 struct PredFunctor2
{
478 template <typename T1
, typename T2
>
479 bool operator()(const T1
& v1
,
485 // A binary predicate-formatter function.
486 template <typename T1
, typename T2
>
487 testing::AssertionResult
PredFormatFunction2(const char* e1
,
491 if (PredFunction2(v1
, v2
))
492 return testing::AssertionSuccess();
494 return testing::AssertionFailure()
496 << " is expected to be positive, but evaluates to "
500 // A binary predicate-formatter functor.
501 struct PredFormatFunctor2
{
502 template <typename T1
, typename T2
>
503 testing::AssertionResult
operator()(const char* e1
,
506 const T2
& v2
) const {
507 return PredFormatFunction2(e1
, e2
, v1
, v2
);
511 // Tests for {EXPECT|ASSERT}_PRED_FORMAT2.
513 class Predicate2Test
: public testing::Test
{
515 void SetUp() override
{
516 expected_to_finish_
= true;
521 void TearDown() override
{
522 // Verifies that each of the predicate's arguments was evaluated
525 "The predicate assertion didn't evaluate argument 2 "
528 "The predicate assertion didn't evaluate argument 3 "
531 // Verifies that the control flow in the test function is expected.
532 if (expected_to_finish_
&& !finished_
) {
533 FAIL() << "The predicate assertion unexpactedly aborted the test.";
534 } else if (!expected_to_finish_
&& finished_
) {
535 FAIL() << "The failed predicate assertion didn't abort the test "
540 // true if and only if the test function is expected to run to finish.
541 static bool expected_to_finish_
;
543 // true if and only if the test function did run to finish.
544 static bool finished_
;
550 bool Predicate2Test::expected_to_finish_
;
551 bool Predicate2Test::finished_
;
552 int Predicate2Test::n1_
;
553 int Predicate2Test::n2_
;
555 typedef Predicate2Test EXPECT_PRED_FORMAT2Test
;
556 typedef Predicate2Test ASSERT_PRED_FORMAT2Test
;
557 typedef Predicate2Test EXPECT_PRED2Test
;
558 typedef Predicate2Test ASSERT_PRED2Test
;
560 // Tests a successful EXPECT_PRED2 where the
561 // predicate-formatter is a function on a built-in type (int).
562 TEST_F(EXPECT_PRED2Test
, FunctionOnBuiltInTypeSuccess
) {
563 EXPECT_PRED2(PredFunction2Int
,
569 // Tests a successful EXPECT_PRED2 where the
570 // predicate-formatter is a function on a user-defined type (Bool).
571 TEST_F(EXPECT_PRED2Test
, FunctionOnUserTypeSuccess
) {
572 EXPECT_PRED2(PredFunction2Bool
,
578 // Tests a successful EXPECT_PRED2 where the
579 // predicate-formatter is a functor on a built-in type (int).
580 TEST_F(EXPECT_PRED2Test
, FunctorOnBuiltInTypeSuccess
) {
581 EXPECT_PRED2(PredFunctor2(),
587 // Tests a successful EXPECT_PRED2 where the
588 // predicate-formatter is a functor on a user-defined type (Bool).
589 TEST_F(EXPECT_PRED2Test
, FunctorOnUserTypeSuccess
) {
590 EXPECT_PRED2(PredFunctor2(),
596 // Tests a failed EXPECT_PRED2 where the
597 // predicate-formatter is a function on a built-in type (int).
598 TEST_F(EXPECT_PRED2Test
, FunctionOnBuiltInTypeFailure
) {
599 EXPECT_NONFATAL_FAILURE({ // NOLINT
600 EXPECT_PRED2(PredFunction2Int
,
607 // Tests a failed EXPECT_PRED2 where the
608 // predicate-formatter is a function on a user-defined type (Bool).
609 TEST_F(EXPECT_PRED2Test
, FunctionOnUserTypeFailure
) {
610 EXPECT_NONFATAL_FAILURE({ // NOLINT
611 EXPECT_PRED2(PredFunction2Bool
,
618 // Tests a failed EXPECT_PRED2 where the
619 // predicate-formatter is a functor on a built-in type (int).
620 TEST_F(EXPECT_PRED2Test
, FunctorOnBuiltInTypeFailure
) {
621 EXPECT_NONFATAL_FAILURE({ // NOLINT
622 EXPECT_PRED2(PredFunctor2(),
629 // Tests a failed EXPECT_PRED2 where the
630 // predicate-formatter is a functor on a user-defined type (Bool).
631 TEST_F(EXPECT_PRED2Test
, FunctorOnUserTypeFailure
) {
632 EXPECT_NONFATAL_FAILURE({ // NOLINT
633 EXPECT_PRED2(PredFunctor2(),
640 // Tests a successful ASSERT_PRED2 where the
641 // predicate-formatter is a function on a built-in type (int).
642 TEST_F(ASSERT_PRED2Test
, FunctionOnBuiltInTypeSuccess
) {
643 ASSERT_PRED2(PredFunction2Int
,
649 // Tests a successful ASSERT_PRED2 where the
650 // predicate-formatter is a function on a user-defined type (Bool).
651 TEST_F(ASSERT_PRED2Test
, FunctionOnUserTypeSuccess
) {
652 ASSERT_PRED2(PredFunction2Bool
,
658 // Tests a successful ASSERT_PRED2 where the
659 // predicate-formatter is a functor on a built-in type (int).
660 TEST_F(ASSERT_PRED2Test
, FunctorOnBuiltInTypeSuccess
) {
661 ASSERT_PRED2(PredFunctor2(),
667 // Tests a successful ASSERT_PRED2 where the
668 // predicate-formatter is a functor on a user-defined type (Bool).
669 TEST_F(ASSERT_PRED2Test
, FunctorOnUserTypeSuccess
) {
670 ASSERT_PRED2(PredFunctor2(),
676 // Tests a failed ASSERT_PRED2 where the
677 // predicate-formatter is a function on a built-in type (int).
678 TEST_F(ASSERT_PRED2Test
, FunctionOnBuiltInTypeFailure
) {
679 expected_to_finish_
= false;
680 EXPECT_FATAL_FAILURE({ // NOLINT
681 ASSERT_PRED2(PredFunction2Int
,
688 // Tests a failed ASSERT_PRED2 where the
689 // predicate-formatter is a function on a user-defined type (Bool).
690 TEST_F(ASSERT_PRED2Test
, FunctionOnUserTypeFailure
) {
691 expected_to_finish_
= false;
692 EXPECT_FATAL_FAILURE({ // NOLINT
693 ASSERT_PRED2(PredFunction2Bool
,
700 // Tests a failed ASSERT_PRED2 where the
701 // predicate-formatter is a functor on a built-in type (int).
702 TEST_F(ASSERT_PRED2Test
, FunctorOnBuiltInTypeFailure
) {
703 expected_to_finish_
= false;
704 EXPECT_FATAL_FAILURE({ // NOLINT
705 ASSERT_PRED2(PredFunctor2(),
712 // Tests a failed ASSERT_PRED2 where the
713 // predicate-formatter is a functor on a user-defined type (Bool).
714 TEST_F(ASSERT_PRED2Test
, FunctorOnUserTypeFailure
) {
715 expected_to_finish_
= false;
716 EXPECT_FATAL_FAILURE({ // NOLINT
717 ASSERT_PRED2(PredFunctor2(),
724 // Tests a successful EXPECT_PRED_FORMAT2 where the
725 // predicate-formatter is a function on a built-in type (int).
726 TEST_F(EXPECT_PRED_FORMAT2Test
, FunctionOnBuiltInTypeSuccess
) {
727 EXPECT_PRED_FORMAT2(PredFormatFunction2
,
733 // Tests a successful EXPECT_PRED_FORMAT2 where the
734 // predicate-formatter is a function on a user-defined type (Bool).
735 TEST_F(EXPECT_PRED_FORMAT2Test
, FunctionOnUserTypeSuccess
) {
736 EXPECT_PRED_FORMAT2(PredFormatFunction2
,
742 // Tests a successful EXPECT_PRED_FORMAT2 where the
743 // predicate-formatter is a functor on a built-in type (int).
744 TEST_F(EXPECT_PRED_FORMAT2Test
, FunctorOnBuiltInTypeSuccess
) {
745 EXPECT_PRED_FORMAT2(PredFormatFunctor2(),
751 // Tests a successful EXPECT_PRED_FORMAT2 where the
752 // predicate-formatter is a functor on a user-defined type (Bool).
753 TEST_F(EXPECT_PRED_FORMAT2Test
, FunctorOnUserTypeSuccess
) {
754 EXPECT_PRED_FORMAT2(PredFormatFunctor2(),
760 // Tests a failed EXPECT_PRED_FORMAT2 where the
761 // predicate-formatter is a function on a built-in type (int).
762 TEST_F(EXPECT_PRED_FORMAT2Test
, FunctionOnBuiltInTypeFailure
) {
763 EXPECT_NONFATAL_FAILURE({ // NOLINT
764 EXPECT_PRED_FORMAT2(PredFormatFunction2
,
771 // Tests a failed EXPECT_PRED_FORMAT2 where the
772 // predicate-formatter is a function on a user-defined type (Bool).
773 TEST_F(EXPECT_PRED_FORMAT2Test
, FunctionOnUserTypeFailure
) {
774 EXPECT_NONFATAL_FAILURE({ // NOLINT
775 EXPECT_PRED_FORMAT2(PredFormatFunction2
,
782 // Tests a failed EXPECT_PRED_FORMAT2 where the
783 // predicate-formatter is a functor on a built-in type (int).
784 TEST_F(EXPECT_PRED_FORMAT2Test
, FunctorOnBuiltInTypeFailure
) {
785 EXPECT_NONFATAL_FAILURE({ // NOLINT
786 EXPECT_PRED_FORMAT2(PredFormatFunctor2(),
793 // Tests a failed EXPECT_PRED_FORMAT2 where the
794 // predicate-formatter is a functor on a user-defined type (Bool).
795 TEST_F(EXPECT_PRED_FORMAT2Test
, FunctorOnUserTypeFailure
) {
796 EXPECT_NONFATAL_FAILURE({ // NOLINT
797 EXPECT_PRED_FORMAT2(PredFormatFunctor2(),
804 // Tests a successful ASSERT_PRED_FORMAT2 where the
805 // predicate-formatter is a function on a built-in type (int).
806 TEST_F(ASSERT_PRED_FORMAT2Test
, FunctionOnBuiltInTypeSuccess
) {
807 ASSERT_PRED_FORMAT2(PredFormatFunction2
,
813 // Tests a successful ASSERT_PRED_FORMAT2 where the
814 // predicate-formatter is a function on a user-defined type (Bool).
815 TEST_F(ASSERT_PRED_FORMAT2Test
, FunctionOnUserTypeSuccess
) {
816 ASSERT_PRED_FORMAT2(PredFormatFunction2
,
822 // Tests a successful ASSERT_PRED_FORMAT2 where the
823 // predicate-formatter is a functor on a built-in type (int).
824 TEST_F(ASSERT_PRED_FORMAT2Test
, FunctorOnBuiltInTypeSuccess
) {
825 ASSERT_PRED_FORMAT2(PredFormatFunctor2(),
831 // Tests a successful ASSERT_PRED_FORMAT2 where the
832 // predicate-formatter is a functor on a user-defined type (Bool).
833 TEST_F(ASSERT_PRED_FORMAT2Test
, FunctorOnUserTypeSuccess
) {
834 ASSERT_PRED_FORMAT2(PredFormatFunctor2(),
840 // Tests a failed ASSERT_PRED_FORMAT2 where the
841 // predicate-formatter is a function on a built-in type (int).
842 TEST_F(ASSERT_PRED_FORMAT2Test
, FunctionOnBuiltInTypeFailure
) {
843 expected_to_finish_
= false;
844 EXPECT_FATAL_FAILURE({ // NOLINT
845 ASSERT_PRED_FORMAT2(PredFormatFunction2
,
852 // Tests a failed ASSERT_PRED_FORMAT2 where the
853 // predicate-formatter is a function on a user-defined type (Bool).
854 TEST_F(ASSERT_PRED_FORMAT2Test
, FunctionOnUserTypeFailure
) {
855 expected_to_finish_
= false;
856 EXPECT_FATAL_FAILURE({ // NOLINT
857 ASSERT_PRED_FORMAT2(PredFormatFunction2
,
864 // Tests a failed ASSERT_PRED_FORMAT2 where the
865 // predicate-formatter is a functor on a built-in type (int).
866 TEST_F(ASSERT_PRED_FORMAT2Test
, FunctorOnBuiltInTypeFailure
) {
867 expected_to_finish_
= false;
868 EXPECT_FATAL_FAILURE({ // NOLINT
869 ASSERT_PRED_FORMAT2(PredFormatFunctor2(),
876 // Tests a failed ASSERT_PRED_FORMAT2 where the
877 // predicate-formatter is a functor on a user-defined type (Bool).
878 TEST_F(ASSERT_PRED_FORMAT2Test
, FunctorOnUserTypeFailure
) {
879 expected_to_finish_
= false;
880 EXPECT_FATAL_FAILURE({ // NOLINT
881 ASSERT_PRED_FORMAT2(PredFormatFunctor2(),
887 // Sample functions/functors for testing ternary predicate assertions.
889 // A ternary predicate function.
890 template <typename T1
, typename T2
, typename T3
>
891 bool PredFunction3(T1 v1
, T2 v2
, T3 v3
) {
892 return v1
+ v2
+ v3
> 0;
895 // The following two functions are needed because a compiler doesn't have
896 // a context yet to know which template function must be instantiated.
897 bool PredFunction3Int(int v1
, int v2
, int v3
) {
898 return v1
+ v2
+ v3
> 0;
900 bool PredFunction3Bool(Bool v1
, Bool v2
, Bool v3
) {
901 return v1
+ v2
+ v3
> 0;
904 // A ternary predicate functor.
905 struct PredFunctor3
{
906 template <typename T1
, typename T2
, typename T3
>
907 bool operator()(const T1
& v1
,
910 return v1
+ v2
+ v3
> 0;
914 // A ternary predicate-formatter function.
915 template <typename T1
, typename T2
, typename T3
>
916 testing::AssertionResult
PredFormatFunction3(const char* e1
,
922 if (PredFunction3(v1
, v2
, v3
))
923 return testing::AssertionSuccess();
925 return testing::AssertionFailure()
926 << e1
<< " + " << e2
<< " + " << e3
927 << " is expected to be positive, but evaluates to "
928 << v1
+ v2
+ v3
<< ".";
931 // A ternary predicate-formatter functor.
932 struct PredFormatFunctor3
{
933 template <typename T1
, typename T2
, typename T3
>
934 testing::AssertionResult
operator()(const char* e1
,
939 const T3
& v3
) const {
940 return PredFormatFunction3(e1
, e2
, e3
, v1
, v2
, v3
);
944 // Tests for {EXPECT|ASSERT}_PRED_FORMAT3.
946 class Predicate3Test
: public testing::Test
{
948 void SetUp() override
{
949 expected_to_finish_
= true;
954 void TearDown() override
{
955 // Verifies that each of the predicate's arguments was evaluated
958 "The predicate assertion didn't evaluate argument 2 "
961 "The predicate assertion didn't evaluate argument 3 "
964 "The predicate assertion didn't evaluate argument 4 "
967 // Verifies that the control flow in the test function is expected.
968 if (expected_to_finish_
&& !finished_
) {
969 FAIL() << "The predicate assertion unexpactedly aborted the test.";
970 } else if (!expected_to_finish_
&& finished_
) {
971 FAIL() << "The failed predicate assertion didn't abort the test "
976 // true if and only if the test function is expected to run to finish.
977 static bool expected_to_finish_
;
979 // true if and only if the test function did run to finish.
980 static bool finished_
;
987 bool Predicate3Test::expected_to_finish_
;
988 bool Predicate3Test::finished_
;
989 int Predicate3Test::n1_
;
990 int Predicate3Test::n2_
;
991 int Predicate3Test::n3_
;
993 typedef Predicate3Test EXPECT_PRED_FORMAT3Test
;
994 typedef Predicate3Test ASSERT_PRED_FORMAT3Test
;
995 typedef Predicate3Test EXPECT_PRED3Test
;
996 typedef Predicate3Test ASSERT_PRED3Test
;
998 // Tests a successful EXPECT_PRED3 where the
999 // predicate-formatter is a function on a built-in type (int).
1000 TEST_F(EXPECT_PRED3Test
, FunctionOnBuiltInTypeSuccess
) {
1001 EXPECT_PRED3(PredFunction3Int
,
1008 // Tests a successful EXPECT_PRED3 where the
1009 // predicate-formatter is a function on a user-defined type (Bool).
1010 TEST_F(EXPECT_PRED3Test
, FunctionOnUserTypeSuccess
) {
1011 EXPECT_PRED3(PredFunction3Bool
,
1018 // Tests a successful EXPECT_PRED3 where the
1019 // predicate-formatter is a functor on a built-in type (int).
1020 TEST_F(EXPECT_PRED3Test
, FunctorOnBuiltInTypeSuccess
) {
1021 EXPECT_PRED3(PredFunctor3(),
1028 // Tests a successful EXPECT_PRED3 where the
1029 // predicate-formatter is a functor on a user-defined type (Bool).
1030 TEST_F(EXPECT_PRED3Test
, FunctorOnUserTypeSuccess
) {
1031 EXPECT_PRED3(PredFunctor3(),
1038 // Tests a failed EXPECT_PRED3 where the
1039 // predicate-formatter is a function on a built-in type (int).
1040 TEST_F(EXPECT_PRED3Test
, FunctionOnBuiltInTypeFailure
) {
1041 EXPECT_NONFATAL_FAILURE({ // NOLINT
1042 EXPECT_PRED3(PredFunction3Int
,
1050 // Tests a failed EXPECT_PRED3 where the
1051 // predicate-formatter is a function on a user-defined type (Bool).
1052 TEST_F(EXPECT_PRED3Test
, FunctionOnUserTypeFailure
) {
1053 EXPECT_NONFATAL_FAILURE({ // NOLINT
1054 EXPECT_PRED3(PredFunction3Bool
,
1062 // Tests a failed EXPECT_PRED3 where the
1063 // predicate-formatter is a functor on a built-in type (int).
1064 TEST_F(EXPECT_PRED3Test
, FunctorOnBuiltInTypeFailure
) {
1065 EXPECT_NONFATAL_FAILURE({ // NOLINT
1066 EXPECT_PRED3(PredFunctor3(),
1074 // Tests a failed EXPECT_PRED3 where the
1075 // predicate-formatter is a functor on a user-defined type (Bool).
1076 TEST_F(EXPECT_PRED3Test
, FunctorOnUserTypeFailure
) {
1077 EXPECT_NONFATAL_FAILURE({ // NOLINT
1078 EXPECT_PRED3(PredFunctor3(),
1086 // Tests a successful ASSERT_PRED3 where the
1087 // predicate-formatter is a function on a built-in type (int).
1088 TEST_F(ASSERT_PRED3Test
, FunctionOnBuiltInTypeSuccess
) {
1089 ASSERT_PRED3(PredFunction3Int
,
1096 // Tests a successful ASSERT_PRED3 where the
1097 // predicate-formatter is a function on a user-defined type (Bool).
1098 TEST_F(ASSERT_PRED3Test
, FunctionOnUserTypeSuccess
) {
1099 ASSERT_PRED3(PredFunction3Bool
,
1106 // Tests a successful ASSERT_PRED3 where the
1107 // predicate-formatter is a functor on a built-in type (int).
1108 TEST_F(ASSERT_PRED3Test
, FunctorOnBuiltInTypeSuccess
) {
1109 ASSERT_PRED3(PredFunctor3(),
1116 // Tests a successful ASSERT_PRED3 where the
1117 // predicate-formatter is a functor on a user-defined type (Bool).
1118 TEST_F(ASSERT_PRED3Test
, FunctorOnUserTypeSuccess
) {
1119 ASSERT_PRED3(PredFunctor3(),
1126 // Tests a failed ASSERT_PRED3 where the
1127 // predicate-formatter is a function on a built-in type (int).
1128 TEST_F(ASSERT_PRED3Test
, FunctionOnBuiltInTypeFailure
) {
1129 expected_to_finish_
= false;
1130 EXPECT_FATAL_FAILURE({ // NOLINT
1131 ASSERT_PRED3(PredFunction3Int
,
1139 // Tests a failed ASSERT_PRED3 where the
1140 // predicate-formatter is a function on a user-defined type (Bool).
1141 TEST_F(ASSERT_PRED3Test
, FunctionOnUserTypeFailure
) {
1142 expected_to_finish_
= false;
1143 EXPECT_FATAL_FAILURE({ // NOLINT
1144 ASSERT_PRED3(PredFunction3Bool
,
1152 // Tests a failed ASSERT_PRED3 where the
1153 // predicate-formatter is a functor on a built-in type (int).
1154 TEST_F(ASSERT_PRED3Test
, FunctorOnBuiltInTypeFailure
) {
1155 expected_to_finish_
= false;
1156 EXPECT_FATAL_FAILURE({ // NOLINT
1157 ASSERT_PRED3(PredFunctor3(),
1165 // Tests a failed ASSERT_PRED3 where the
1166 // predicate-formatter is a functor on a user-defined type (Bool).
1167 TEST_F(ASSERT_PRED3Test
, FunctorOnUserTypeFailure
) {
1168 expected_to_finish_
= false;
1169 EXPECT_FATAL_FAILURE({ // NOLINT
1170 ASSERT_PRED3(PredFunctor3(),
1178 // Tests a successful EXPECT_PRED_FORMAT3 where the
1179 // predicate-formatter is a function on a built-in type (int).
1180 TEST_F(EXPECT_PRED_FORMAT3Test
, FunctionOnBuiltInTypeSuccess
) {
1181 EXPECT_PRED_FORMAT3(PredFormatFunction3
,
1188 // Tests a successful EXPECT_PRED_FORMAT3 where the
1189 // predicate-formatter is a function on a user-defined type (Bool).
1190 TEST_F(EXPECT_PRED_FORMAT3Test
, FunctionOnUserTypeSuccess
) {
1191 EXPECT_PRED_FORMAT3(PredFormatFunction3
,
1198 // Tests a successful EXPECT_PRED_FORMAT3 where the
1199 // predicate-formatter is a functor on a built-in type (int).
1200 TEST_F(EXPECT_PRED_FORMAT3Test
, FunctorOnBuiltInTypeSuccess
) {
1201 EXPECT_PRED_FORMAT3(PredFormatFunctor3(),
1208 // Tests a successful EXPECT_PRED_FORMAT3 where the
1209 // predicate-formatter is a functor on a user-defined type (Bool).
1210 TEST_F(EXPECT_PRED_FORMAT3Test
, FunctorOnUserTypeSuccess
) {
1211 EXPECT_PRED_FORMAT3(PredFormatFunctor3(),
1218 // Tests a failed EXPECT_PRED_FORMAT3 where the
1219 // predicate-formatter is a function on a built-in type (int).
1220 TEST_F(EXPECT_PRED_FORMAT3Test
, FunctionOnBuiltInTypeFailure
) {
1221 EXPECT_NONFATAL_FAILURE({ // NOLINT
1222 EXPECT_PRED_FORMAT3(PredFormatFunction3
,
1230 // Tests a failed EXPECT_PRED_FORMAT3 where the
1231 // predicate-formatter is a function on a user-defined type (Bool).
1232 TEST_F(EXPECT_PRED_FORMAT3Test
, FunctionOnUserTypeFailure
) {
1233 EXPECT_NONFATAL_FAILURE({ // NOLINT
1234 EXPECT_PRED_FORMAT3(PredFormatFunction3
,
1242 // Tests a failed EXPECT_PRED_FORMAT3 where the
1243 // predicate-formatter is a functor on a built-in type (int).
1244 TEST_F(EXPECT_PRED_FORMAT3Test
, FunctorOnBuiltInTypeFailure
) {
1245 EXPECT_NONFATAL_FAILURE({ // NOLINT
1246 EXPECT_PRED_FORMAT3(PredFormatFunctor3(),
1254 // Tests a failed EXPECT_PRED_FORMAT3 where the
1255 // predicate-formatter is a functor on a user-defined type (Bool).
1256 TEST_F(EXPECT_PRED_FORMAT3Test
, FunctorOnUserTypeFailure
) {
1257 EXPECT_NONFATAL_FAILURE({ // NOLINT
1258 EXPECT_PRED_FORMAT3(PredFormatFunctor3(),
1266 // Tests a successful ASSERT_PRED_FORMAT3 where the
1267 // predicate-formatter is a function on a built-in type (int).
1268 TEST_F(ASSERT_PRED_FORMAT3Test
, FunctionOnBuiltInTypeSuccess
) {
1269 ASSERT_PRED_FORMAT3(PredFormatFunction3
,
1276 // Tests a successful ASSERT_PRED_FORMAT3 where the
1277 // predicate-formatter is a function on a user-defined type (Bool).
1278 TEST_F(ASSERT_PRED_FORMAT3Test
, FunctionOnUserTypeSuccess
) {
1279 ASSERT_PRED_FORMAT3(PredFormatFunction3
,
1286 // Tests a successful ASSERT_PRED_FORMAT3 where the
1287 // predicate-formatter is a functor on a built-in type (int).
1288 TEST_F(ASSERT_PRED_FORMAT3Test
, FunctorOnBuiltInTypeSuccess
) {
1289 ASSERT_PRED_FORMAT3(PredFormatFunctor3(),
1296 // Tests a successful ASSERT_PRED_FORMAT3 where the
1297 // predicate-formatter is a functor on a user-defined type (Bool).
1298 TEST_F(ASSERT_PRED_FORMAT3Test
, FunctorOnUserTypeSuccess
) {
1299 ASSERT_PRED_FORMAT3(PredFormatFunctor3(),
1306 // Tests a failed ASSERT_PRED_FORMAT3 where the
1307 // predicate-formatter is a function on a built-in type (int).
1308 TEST_F(ASSERT_PRED_FORMAT3Test
, FunctionOnBuiltInTypeFailure
) {
1309 expected_to_finish_
= false;
1310 EXPECT_FATAL_FAILURE({ // NOLINT
1311 ASSERT_PRED_FORMAT3(PredFormatFunction3
,
1319 // Tests a failed ASSERT_PRED_FORMAT3 where the
1320 // predicate-formatter is a function on a user-defined type (Bool).
1321 TEST_F(ASSERT_PRED_FORMAT3Test
, FunctionOnUserTypeFailure
) {
1322 expected_to_finish_
= false;
1323 EXPECT_FATAL_FAILURE({ // NOLINT
1324 ASSERT_PRED_FORMAT3(PredFormatFunction3
,
1332 // Tests a failed ASSERT_PRED_FORMAT3 where the
1333 // predicate-formatter is a functor on a built-in type (int).
1334 TEST_F(ASSERT_PRED_FORMAT3Test
, FunctorOnBuiltInTypeFailure
) {
1335 expected_to_finish_
= false;
1336 EXPECT_FATAL_FAILURE({ // NOLINT
1337 ASSERT_PRED_FORMAT3(PredFormatFunctor3(),
1345 // Tests a failed ASSERT_PRED_FORMAT3 where the
1346 // predicate-formatter is a functor on a user-defined type (Bool).
1347 TEST_F(ASSERT_PRED_FORMAT3Test
, FunctorOnUserTypeFailure
) {
1348 expected_to_finish_
= false;
1349 EXPECT_FATAL_FAILURE({ // NOLINT
1350 ASSERT_PRED_FORMAT3(PredFormatFunctor3(),
1357 // Sample functions/functors for testing 4-ary predicate assertions.
1359 // A 4-ary predicate function.
1360 template <typename T1
, typename T2
, typename T3
, typename T4
>
1361 bool PredFunction4(T1 v1
, T2 v2
, T3 v3
, T4 v4
) {
1362 return v1
+ v2
+ v3
+ v4
> 0;
1365 // The following two functions are needed because a compiler doesn't have
1366 // a context yet to know which template function must be instantiated.
1367 bool PredFunction4Int(int v1
, int v2
, int v3
, int v4
) {
1368 return v1
+ v2
+ v3
+ v4
> 0;
1370 bool PredFunction4Bool(Bool v1
, Bool v2
, Bool v3
, Bool v4
) {
1371 return v1
+ v2
+ v3
+ v4
> 0;
1374 // A 4-ary predicate functor.
1375 struct PredFunctor4
{
1376 template <typename T1
, typename T2
, typename T3
, typename T4
>
1377 bool operator()(const T1
& v1
,
1381 return v1
+ v2
+ v3
+ v4
> 0;
1385 // A 4-ary predicate-formatter function.
1386 template <typename T1
, typename T2
, typename T3
, typename T4
>
1387 testing::AssertionResult
PredFormatFunction4(const char* e1
,
1395 if (PredFunction4(v1
, v2
, v3
, v4
))
1396 return testing::AssertionSuccess();
1398 return testing::AssertionFailure()
1399 << e1
<< " + " << e2
<< " + " << e3
<< " + " << e4
1400 << " is expected to be positive, but evaluates to "
1401 << v1
+ v2
+ v3
+ v4
<< ".";
1404 // A 4-ary predicate-formatter functor.
1405 struct PredFormatFunctor4
{
1406 template <typename T1
, typename T2
, typename T3
, typename T4
>
1407 testing::AssertionResult
operator()(const char* e1
,
1414 const T4
& v4
) const {
1415 return PredFormatFunction4(e1
, e2
, e3
, e4
, v1
, v2
, v3
, v4
);
1419 // Tests for {EXPECT|ASSERT}_PRED_FORMAT4.
1421 class Predicate4Test
: public testing::Test
{
1423 void SetUp() override
{
1424 expected_to_finish_
= true;
1426 n1_
= n2_
= n3_
= n4_
= 0;
1429 void TearDown() override
{
1430 // Verifies that each of the predicate's arguments was evaluated
1432 EXPECT_EQ(1, n1_
) <<
1433 "The predicate assertion didn't evaluate argument 2 "
1435 EXPECT_EQ(1, n2_
) <<
1436 "The predicate assertion didn't evaluate argument 3 "
1438 EXPECT_EQ(1, n3_
) <<
1439 "The predicate assertion didn't evaluate argument 4 "
1441 EXPECT_EQ(1, n4_
) <<
1442 "The predicate assertion didn't evaluate argument 5 "
1445 // Verifies that the control flow in the test function is expected.
1446 if (expected_to_finish_
&& !finished_
) {
1447 FAIL() << "The predicate assertion unexpactedly aborted the test.";
1448 } else if (!expected_to_finish_
&& finished_
) {
1449 FAIL() << "The failed predicate assertion didn't abort the test "
1454 // true if and only if the test function is expected to run to finish.
1455 static bool expected_to_finish_
;
1457 // true if and only if the test function did run to finish.
1458 static bool finished_
;
1466 bool Predicate4Test::expected_to_finish_
;
1467 bool Predicate4Test::finished_
;
1468 int Predicate4Test::n1_
;
1469 int Predicate4Test::n2_
;
1470 int Predicate4Test::n3_
;
1471 int Predicate4Test::n4_
;
1473 typedef Predicate4Test EXPECT_PRED_FORMAT4Test
;
1474 typedef Predicate4Test ASSERT_PRED_FORMAT4Test
;
1475 typedef Predicate4Test EXPECT_PRED4Test
;
1476 typedef Predicate4Test ASSERT_PRED4Test
;
1478 // Tests a successful EXPECT_PRED4 where the
1479 // predicate-formatter is a function on a built-in type (int).
1480 TEST_F(EXPECT_PRED4Test
, FunctionOnBuiltInTypeSuccess
) {
1481 EXPECT_PRED4(PredFunction4Int
,
1489 // Tests a successful EXPECT_PRED4 where the
1490 // predicate-formatter is a function on a user-defined type (Bool).
1491 TEST_F(EXPECT_PRED4Test
, FunctionOnUserTypeSuccess
) {
1492 EXPECT_PRED4(PredFunction4Bool
,
1500 // Tests a successful EXPECT_PRED4 where the
1501 // predicate-formatter is a functor on a built-in type (int).
1502 TEST_F(EXPECT_PRED4Test
, FunctorOnBuiltInTypeSuccess
) {
1503 EXPECT_PRED4(PredFunctor4(),
1511 // Tests a successful EXPECT_PRED4 where the
1512 // predicate-formatter is a functor on a user-defined type (Bool).
1513 TEST_F(EXPECT_PRED4Test
, FunctorOnUserTypeSuccess
) {
1514 EXPECT_PRED4(PredFunctor4(),
1522 // Tests a failed EXPECT_PRED4 where the
1523 // predicate-formatter is a function on a built-in type (int).
1524 TEST_F(EXPECT_PRED4Test
, FunctionOnBuiltInTypeFailure
) {
1525 EXPECT_NONFATAL_FAILURE({ // NOLINT
1526 EXPECT_PRED4(PredFunction4Int
,
1535 // Tests a failed EXPECT_PRED4 where the
1536 // predicate-formatter is a function on a user-defined type (Bool).
1537 TEST_F(EXPECT_PRED4Test
, FunctionOnUserTypeFailure
) {
1538 EXPECT_NONFATAL_FAILURE({ // NOLINT
1539 EXPECT_PRED4(PredFunction4Bool
,
1548 // Tests a failed EXPECT_PRED4 where the
1549 // predicate-formatter is a functor on a built-in type (int).
1550 TEST_F(EXPECT_PRED4Test
, FunctorOnBuiltInTypeFailure
) {
1551 EXPECT_NONFATAL_FAILURE({ // NOLINT
1552 EXPECT_PRED4(PredFunctor4(),
1561 // Tests a failed EXPECT_PRED4 where the
1562 // predicate-formatter is a functor on a user-defined type (Bool).
1563 TEST_F(EXPECT_PRED4Test
, FunctorOnUserTypeFailure
) {
1564 EXPECT_NONFATAL_FAILURE({ // NOLINT
1565 EXPECT_PRED4(PredFunctor4(),
1574 // Tests a successful ASSERT_PRED4 where the
1575 // predicate-formatter is a function on a built-in type (int).
1576 TEST_F(ASSERT_PRED4Test
, FunctionOnBuiltInTypeSuccess
) {
1577 ASSERT_PRED4(PredFunction4Int
,
1585 // Tests a successful ASSERT_PRED4 where the
1586 // predicate-formatter is a function on a user-defined type (Bool).
1587 TEST_F(ASSERT_PRED4Test
, FunctionOnUserTypeSuccess
) {
1588 ASSERT_PRED4(PredFunction4Bool
,
1596 // Tests a successful ASSERT_PRED4 where the
1597 // predicate-formatter is a functor on a built-in type (int).
1598 TEST_F(ASSERT_PRED4Test
, FunctorOnBuiltInTypeSuccess
) {
1599 ASSERT_PRED4(PredFunctor4(),
1607 // Tests a successful ASSERT_PRED4 where the
1608 // predicate-formatter is a functor on a user-defined type (Bool).
1609 TEST_F(ASSERT_PRED4Test
, FunctorOnUserTypeSuccess
) {
1610 ASSERT_PRED4(PredFunctor4(),
1618 // Tests a failed ASSERT_PRED4 where the
1619 // predicate-formatter is a function on a built-in type (int).
1620 TEST_F(ASSERT_PRED4Test
, FunctionOnBuiltInTypeFailure
) {
1621 expected_to_finish_
= false;
1622 EXPECT_FATAL_FAILURE({ // NOLINT
1623 ASSERT_PRED4(PredFunction4Int
,
1632 // Tests a failed ASSERT_PRED4 where the
1633 // predicate-formatter is a function on a user-defined type (Bool).
1634 TEST_F(ASSERT_PRED4Test
, FunctionOnUserTypeFailure
) {
1635 expected_to_finish_
= false;
1636 EXPECT_FATAL_FAILURE({ // NOLINT
1637 ASSERT_PRED4(PredFunction4Bool
,
1646 // Tests a failed ASSERT_PRED4 where the
1647 // predicate-formatter is a functor on a built-in type (int).
1648 TEST_F(ASSERT_PRED4Test
, FunctorOnBuiltInTypeFailure
) {
1649 expected_to_finish_
= false;
1650 EXPECT_FATAL_FAILURE({ // NOLINT
1651 ASSERT_PRED4(PredFunctor4(),
1660 // Tests a failed ASSERT_PRED4 where the
1661 // predicate-formatter is a functor on a user-defined type (Bool).
1662 TEST_F(ASSERT_PRED4Test
, FunctorOnUserTypeFailure
) {
1663 expected_to_finish_
= false;
1664 EXPECT_FATAL_FAILURE({ // NOLINT
1665 ASSERT_PRED4(PredFunctor4(),
1674 // Tests a successful EXPECT_PRED_FORMAT4 where the
1675 // predicate-formatter is a function on a built-in type (int).
1676 TEST_F(EXPECT_PRED_FORMAT4Test
, FunctionOnBuiltInTypeSuccess
) {
1677 EXPECT_PRED_FORMAT4(PredFormatFunction4
,
1685 // Tests a successful EXPECT_PRED_FORMAT4 where the
1686 // predicate-formatter is a function on a user-defined type (Bool).
1687 TEST_F(EXPECT_PRED_FORMAT4Test
, FunctionOnUserTypeSuccess
) {
1688 EXPECT_PRED_FORMAT4(PredFormatFunction4
,
1696 // Tests a successful EXPECT_PRED_FORMAT4 where the
1697 // predicate-formatter is a functor on a built-in type (int).
1698 TEST_F(EXPECT_PRED_FORMAT4Test
, FunctorOnBuiltInTypeSuccess
) {
1699 EXPECT_PRED_FORMAT4(PredFormatFunctor4(),
1707 // Tests a successful EXPECT_PRED_FORMAT4 where the
1708 // predicate-formatter is a functor on a user-defined type (Bool).
1709 TEST_F(EXPECT_PRED_FORMAT4Test
, FunctorOnUserTypeSuccess
) {
1710 EXPECT_PRED_FORMAT4(PredFormatFunctor4(),
1718 // Tests a failed EXPECT_PRED_FORMAT4 where the
1719 // predicate-formatter is a function on a built-in type (int).
1720 TEST_F(EXPECT_PRED_FORMAT4Test
, FunctionOnBuiltInTypeFailure
) {
1721 EXPECT_NONFATAL_FAILURE({ // NOLINT
1722 EXPECT_PRED_FORMAT4(PredFormatFunction4
,
1731 // Tests a failed EXPECT_PRED_FORMAT4 where the
1732 // predicate-formatter is a function on a user-defined type (Bool).
1733 TEST_F(EXPECT_PRED_FORMAT4Test
, FunctionOnUserTypeFailure
) {
1734 EXPECT_NONFATAL_FAILURE({ // NOLINT
1735 EXPECT_PRED_FORMAT4(PredFormatFunction4
,
1744 // Tests a failed EXPECT_PRED_FORMAT4 where the
1745 // predicate-formatter is a functor on a built-in type (int).
1746 TEST_F(EXPECT_PRED_FORMAT4Test
, FunctorOnBuiltInTypeFailure
) {
1747 EXPECT_NONFATAL_FAILURE({ // NOLINT
1748 EXPECT_PRED_FORMAT4(PredFormatFunctor4(),
1757 // Tests a failed EXPECT_PRED_FORMAT4 where the
1758 // predicate-formatter is a functor on a user-defined type (Bool).
1759 TEST_F(EXPECT_PRED_FORMAT4Test
, FunctorOnUserTypeFailure
) {
1760 EXPECT_NONFATAL_FAILURE({ // NOLINT
1761 EXPECT_PRED_FORMAT4(PredFormatFunctor4(),
1770 // Tests a successful ASSERT_PRED_FORMAT4 where the
1771 // predicate-formatter is a function on a built-in type (int).
1772 TEST_F(ASSERT_PRED_FORMAT4Test
, FunctionOnBuiltInTypeSuccess
) {
1773 ASSERT_PRED_FORMAT4(PredFormatFunction4
,
1781 // Tests a successful ASSERT_PRED_FORMAT4 where the
1782 // predicate-formatter is a function on a user-defined type (Bool).
1783 TEST_F(ASSERT_PRED_FORMAT4Test
, FunctionOnUserTypeSuccess
) {
1784 ASSERT_PRED_FORMAT4(PredFormatFunction4
,
1792 // Tests a successful ASSERT_PRED_FORMAT4 where the
1793 // predicate-formatter is a functor on a built-in type (int).
1794 TEST_F(ASSERT_PRED_FORMAT4Test
, FunctorOnBuiltInTypeSuccess
) {
1795 ASSERT_PRED_FORMAT4(PredFormatFunctor4(),
1803 // Tests a successful ASSERT_PRED_FORMAT4 where the
1804 // predicate-formatter is a functor on a user-defined type (Bool).
1805 TEST_F(ASSERT_PRED_FORMAT4Test
, FunctorOnUserTypeSuccess
) {
1806 ASSERT_PRED_FORMAT4(PredFormatFunctor4(),
1814 // Tests a failed ASSERT_PRED_FORMAT4 where the
1815 // predicate-formatter is a function on a built-in type (int).
1816 TEST_F(ASSERT_PRED_FORMAT4Test
, FunctionOnBuiltInTypeFailure
) {
1817 expected_to_finish_
= false;
1818 EXPECT_FATAL_FAILURE({ // NOLINT
1819 ASSERT_PRED_FORMAT4(PredFormatFunction4
,
1828 // Tests a failed ASSERT_PRED_FORMAT4 where the
1829 // predicate-formatter is a function on a user-defined type (Bool).
1830 TEST_F(ASSERT_PRED_FORMAT4Test
, FunctionOnUserTypeFailure
) {
1831 expected_to_finish_
= false;
1832 EXPECT_FATAL_FAILURE({ // NOLINT
1833 ASSERT_PRED_FORMAT4(PredFormatFunction4
,
1842 // Tests a failed ASSERT_PRED_FORMAT4 where the
1843 // predicate-formatter is a functor on a built-in type (int).
1844 TEST_F(ASSERT_PRED_FORMAT4Test
, FunctorOnBuiltInTypeFailure
) {
1845 expected_to_finish_
= false;
1846 EXPECT_FATAL_FAILURE({ // NOLINT
1847 ASSERT_PRED_FORMAT4(PredFormatFunctor4(),
1856 // Tests a failed ASSERT_PRED_FORMAT4 where the
1857 // predicate-formatter is a functor on a user-defined type (Bool).
1858 TEST_F(ASSERT_PRED_FORMAT4Test
, FunctorOnUserTypeFailure
) {
1859 expected_to_finish_
= false;
1860 EXPECT_FATAL_FAILURE({ // NOLINT
1861 ASSERT_PRED_FORMAT4(PredFormatFunctor4(),
1869 // Sample functions/functors for testing 5-ary predicate assertions.
1871 // A 5-ary predicate function.
1872 template <typename T1
, typename T2
, typename T3
, typename T4
, typename T5
>
1873 bool PredFunction5(T1 v1
, T2 v2
, T3 v3
, T4 v4
, T5 v5
) {
1874 return v1
+ v2
+ v3
+ v4
+ v5
> 0;
1877 // The following two functions are needed because a compiler doesn't have
1878 // a context yet to know which template function must be instantiated.
1879 bool PredFunction5Int(int v1
, int v2
, int v3
, int v4
, int v5
) {
1880 return v1
+ v2
+ v3
+ v4
+ v5
> 0;
1882 bool PredFunction5Bool(Bool v1
, Bool v2
, Bool v3
, Bool v4
, Bool v5
) {
1883 return v1
+ v2
+ v3
+ v4
+ v5
> 0;
1886 // A 5-ary predicate functor.
1887 struct PredFunctor5
{
1888 template <typename T1
, typename T2
, typename T3
, typename T4
, typename T5
>
1889 bool operator()(const T1
& v1
,
1894 return v1
+ v2
+ v3
+ v4
+ v5
> 0;
1898 // A 5-ary predicate-formatter function.
1899 template <typename T1
, typename T2
, typename T3
, typename T4
, typename T5
>
1900 testing::AssertionResult
PredFormatFunction5(const char* e1
,
1910 if (PredFunction5(v1
, v2
, v3
, v4
, v5
))
1911 return testing::AssertionSuccess();
1913 return testing::AssertionFailure()
1914 << e1
<< " + " << e2
<< " + " << e3
<< " + " << e4
<< " + " << e5
1915 << " is expected to be positive, but evaluates to "
1916 << v1
+ v2
+ v3
+ v4
+ v5
<< ".";
1919 // A 5-ary predicate-formatter functor.
1920 struct PredFormatFunctor5
{
1921 template <typename T1
, typename T2
, typename T3
, typename T4
, typename T5
>
1922 testing::AssertionResult
operator()(const char* e1
,
1931 const T5
& v5
) const {
1932 return PredFormatFunction5(e1
, e2
, e3
, e4
, e5
, v1
, v2
, v3
, v4
, v5
);
1936 // Tests for {EXPECT|ASSERT}_PRED_FORMAT5.
1938 class Predicate5Test
: public testing::Test
{
1940 void SetUp() override
{
1941 expected_to_finish_
= true;
1943 n1_
= n2_
= n3_
= n4_
= n5_
= 0;
1946 void TearDown() override
{
1947 // Verifies that each of the predicate's arguments was evaluated
1949 EXPECT_EQ(1, n1_
) <<
1950 "The predicate assertion didn't evaluate argument 2 "
1952 EXPECT_EQ(1, n2_
) <<
1953 "The predicate assertion didn't evaluate argument 3 "
1955 EXPECT_EQ(1, n3_
) <<
1956 "The predicate assertion didn't evaluate argument 4 "
1958 EXPECT_EQ(1, n4_
) <<
1959 "The predicate assertion didn't evaluate argument 5 "
1961 EXPECT_EQ(1, n5_
) <<
1962 "The predicate assertion didn't evaluate argument 6 "
1965 // Verifies that the control flow in the test function is expected.
1966 if (expected_to_finish_
&& !finished_
) {
1967 FAIL() << "The predicate assertion unexpactedly aborted the test.";
1968 } else if (!expected_to_finish_
&& finished_
) {
1969 FAIL() << "The failed predicate assertion didn't abort the test "
1974 // true if and only if the test function is expected to run to finish.
1975 static bool expected_to_finish_
;
1977 // true if and only if the test function did run to finish.
1978 static bool finished_
;
1987 bool Predicate5Test::expected_to_finish_
;
1988 bool Predicate5Test::finished_
;
1989 int Predicate5Test::n1_
;
1990 int Predicate5Test::n2_
;
1991 int Predicate5Test::n3_
;
1992 int Predicate5Test::n4_
;
1993 int Predicate5Test::n5_
;
1995 typedef Predicate5Test EXPECT_PRED_FORMAT5Test
;
1996 typedef Predicate5Test ASSERT_PRED_FORMAT5Test
;
1997 typedef Predicate5Test EXPECT_PRED5Test
;
1998 typedef Predicate5Test ASSERT_PRED5Test
;
2000 // Tests a successful EXPECT_PRED5 where the
2001 // predicate-formatter is a function on a built-in type (int).
2002 TEST_F(EXPECT_PRED5Test
, FunctionOnBuiltInTypeSuccess
) {
2003 EXPECT_PRED5(PredFunction5Int
,
2012 // Tests a successful EXPECT_PRED5 where the
2013 // predicate-formatter is a function on a user-defined type (Bool).
2014 TEST_F(EXPECT_PRED5Test
, FunctionOnUserTypeSuccess
) {
2015 EXPECT_PRED5(PredFunction5Bool
,
2024 // Tests a successful EXPECT_PRED5 where the
2025 // predicate-formatter is a functor on a built-in type (int).
2026 TEST_F(EXPECT_PRED5Test
, FunctorOnBuiltInTypeSuccess
) {
2027 EXPECT_PRED5(PredFunctor5(),
2036 // Tests a successful EXPECT_PRED5 where the
2037 // predicate-formatter is a functor on a user-defined type (Bool).
2038 TEST_F(EXPECT_PRED5Test
, FunctorOnUserTypeSuccess
) {
2039 EXPECT_PRED5(PredFunctor5(),
2048 // Tests a failed EXPECT_PRED5 where the
2049 // predicate-formatter is a function on a built-in type (int).
2050 TEST_F(EXPECT_PRED5Test
, FunctionOnBuiltInTypeFailure
) {
2051 EXPECT_NONFATAL_FAILURE({ // NOLINT
2052 EXPECT_PRED5(PredFunction5Int
,
2062 // Tests a failed EXPECT_PRED5 where the
2063 // predicate-formatter is a function on a user-defined type (Bool).
2064 TEST_F(EXPECT_PRED5Test
, FunctionOnUserTypeFailure
) {
2065 EXPECT_NONFATAL_FAILURE({ // NOLINT
2066 EXPECT_PRED5(PredFunction5Bool
,
2076 // Tests a failed EXPECT_PRED5 where the
2077 // predicate-formatter is a functor on a built-in type (int).
2078 TEST_F(EXPECT_PRED5Test
, FunctorOnBuiltInTypeFailure
) {
2079 EXPECT_NONFATAL_FAILURE({ // NOLINT
2080 EXPECT_PRED5(PredFunctor5(),
2090 // Tests a failed EXPECT_PRED5 where the
2091 // predicate-formatter is a functor on a user-defined type (Bool).
2092 TEST_F(EXPECT_PRED5Test
, FunctorOnUserTypeFailure
) {
2093 EXPECT_NONFATAL_FAILURE({ // NOLINT
2094 EXPECT_PRED5(PredFunctor5(),
2104 // Tests a successful ASSERT_PRED5 where the
2105 // predicate-formatter is a function on a built-in type (int).
2106 TEST_F(ASSERT_PRED5Test
, FunctionOnBuiltInTypeSuccess
) {
2107 ASSERT_PRED5(PredFunction5Int
,
2116 // Tests a successful ASSERT_PRED5 where the
2117 // predicate-formatter is a function on a user-defined type (Bool).
2118 TEST_F(ASSERT_PRED5Test
, FunctionOnUserTypeSuccess
) {
2119 ASSERT_PRED5(PredFunction5Bool
,
2128 // Tests a successful ASSERT_PRED5 where the
2129 // predicate-formatter is a functor on a built-in type (int).
2130 TEST_F(ASSERT_PRED5Test
, FunctorOnBuiltInTypeSuccess
) {
2131 ASSERT_PRED5(PredFunctor5(),
2140 // Tests a successful ASSERT_PRED5 where the
2141 // predicate-formatter is a functor on a user-defined type (Bool).
2142 TEST_F(ASSERT_PRED5Test
, FunctorOnUserTypeSuccess
) {
2143 ASSERT_PRED5(PredFunctor5(),
2152 // Tests a failed ASSERT_PRED5 where the
2153 // predicate-formatter is a function on a built-in type (int).
2154 TEST_F(ASSERT_PRED5Test
, FunctionOnBuiltInTypeFailure
) {
2155 expected_to_finish_
= false;
2156 EXPECT_FATAL_FAILURE({ // NOLINT
2157 ASSERT_PRED5(PredFunction5Int
,
2167 // Tests a failed ASSERT_PRED5 where the
2168 // predicate-formatter is a function on a user-defined type (Bool).
2169 TEST_F(ASSERT_PRED5Test
, FunctionOnUserTypeFailure
) {
2170 expected_to_finish_
= false;
2171 EXPECT_FATAL_FAILURE({ // NOLINT
2172 ASSERT_PRED5(PredFunction5Bool
,
2182 // Tests a failed ASSERT_PRED5 where the
2183 // predicate-formatter is a functor on a built-in type (int).
2184 TEST_F(ASSERT_PRED5Test
, FunctorOnBuiltInTypeFailure
) {
2185 expected_to_finish_
= false;
2186 EXPECT_FATAL_FAILURE({ // NOLINT
2187 ASSERT_PRED5(PredFunctor5(),
2197 // Tests a failed ASSERT_PRED5 where the
2198 // predicate-formatter is a functor on a user-defined type (Bool).
2199 TEST_F(ASSERT_PRED5Test
, FunctorOnUserTypeFailure
) {
2200 expected_to_finish_
= false;
2201 EXPECT_FATAL_FAILURE({ // NOLINT
2202 ASSERT_PRED5(PredFunctor5(),
2212 // Tests a successful EXPECT_PRED_FORMAT5 where the
2213 // predicate-formatter is a function on a built-in type (int).
2214 TEST_F(EXPECT_PRED_FORMAT5Test
, FunctionOnBuiltInTypeSuccess
) {
2215 EXPECT_PRED_FORMAT5(PredFormatFunction5
,
2224 // Tests a successful EXPECT_PRED_FORMAT5 where the
2225 // predicate-formatter is a function on a user-defined type (Bool).
2226 TEST_F(EXPECT_PRED_FORMAT5Test
, FunctionOnUserTypeSuccess
) {
2227 EXPECT_PRED_FORMAT5(PredFormatFunction5
,
2236 // Tests a successful EXPECT_PRED_FORMAT5 where the
2237 // predicate-formatter is a functor on a built-in type (int).
2238 TEST_F(EXPECT_PRED_FORMAT5Test
, FunctorOnBuiltInTypeSuccess
) {
2239 EXPECT_PRED_FORMAT5(PredFormatFunctor5(),
2248 // Tests a successful EXPECT_PRED_FORMAT5 where the
2249 // predicate-formatter is a functor on a user-defined type (Bool).
2250 TEST_F(EXPECT_PRED_FORMAT5Test
, FunctorOnUserTypeSuccess
) {
2251 EXPECT_PRED_FORMAT5(PredFormatFunctor5(),
2260 // Tests a failed EXPECT_PRED_FORMAT5 where the
2261 // predicate-formatter is a function on a built-in type (int).
2262 TEST_F(EXPECT_PRED_FORMAT5Test
, FunctionOnBuiltInTypeFailure
) {
2263 EXPECT_NONFATAL_FAILURE({ // NOLINT
2264 EXPECT_PRED_FORMAT5(PredFormatFunction5
,
2274 // Tests a failed EXPECT_PRED_FORMAT5 where the
2275 // predicate-formatter is a function on a user-defined type (Bool).
2276 TEST_F(EXPECT_PRED_FORMAT5Test
, FunctionOnUserTypeFailure
) {
2277 EXPECT_NONFATAL_FAILURE({ // NOLINT
2278 EXPECT_PRED_FORMAT5(PredFormatFunction5
,
2288 // Tests a failed EXPECT_PRED_FORMAT5 where the
2289 // predicate-formatter is a functor on a built-in type (int).
2290 TEST_F(EXPECT_PRED_FORMAT5Test
, FunctorOnBuiltInTypeFailure
) {
2291 EXPECT_NONFATAL_FAILURE({ // NOLINT
2292 EXPECT_PRED_FORMAT5(PredFormatFunctor5(),
2302 // Tests a failed EXPECT_PRED_FORMAT5 where the
2303 // predicate-formatter is a functor on a user-defined type (Bool).
2304 TEST_F(EXPECT_PRED_FORMAT5Test
, FunctorOnUserTypeFailure
) {
2305 EXPECT_NONFATAL_FAILURE({ // NOLINT
2306 EXPECT_PRED_FORMAT5(PredFormatFunctor5(),
2316 // Tests a successful ASSERT_PRED_FORMAT5 where the
2317 // predicate-formatter is a function on a built-in type (int).
2318 TEST_F(ASSERT_PRED_FORMAT5Test
, FunctionOnBuiltInTypeSuccess
) {
2319 ASSERT_PRED_FORMAT5(PredFormatFunction5
,
2328 // Tests a successful ASSERT_PRED_FORMAT5 where the
2329 // predicate-formatter is a function on a user-defined type (Bool).
2330 TEST_F(ASSERT_PRED_FORMAT5Test
, FunctionOnUserTypeSuccess
) {
2331 ASSERT_PRED_FORMAT5(PredFormatFunction5
,
2340 // Tests a successful ASSERT_PRED_FORMAT5 where the
2341 // predicate-formatter is a functor on a built-in type (int).
2342 TEST_F(ASSERT_PRED_FORMAT5Test
, FunctorOnBuiltInTypeSuccess
) {
2343 ASSERT_PRED_FORMAT5(PredFormatFunctor5(),
2352 // Tests a successful ASSERT_PRED_FORMAT5 where the
2353 // predicate-formatter is a functor on a user-defined type (Bool).
2354 TEST_F(ASSERT_PRED_FORMAT5Test
, FunctorOnUserTypeSuccess
) {
2355 ASSERT_PRED_FORMAT5(PredFormatFunctor5(),
2364 // Tests a failed ASSERT_PRED_FORMAT5 where the
2365 // predicate-formatter is a function on a built-in type (int).
2366 TEST_F(ASSERT_PRED_FORMAT5Test
, FunctionOnBuiltInTypeFailure
) {
2367 expected_to_finish_
= false;
2368 EXPECT_FATAL_FAILURE({ // NOLINT
2369 ASSERT_PRED_FORMAT5(PredFormatFunction5
,
2379 // Tests a failed ASSERT_PRED_FORMAT5 where the
2380 // predicate-formatter is a function on a user-defined type (Bool).
2381 TEST_F(ASSERT_PRED_FORMAT5Test
, FunctionOnUserTypeFailure
) {
2382 expected_to_finish_
= false;
2383 EXPECT_FATAL_FAILURE({ // NOLINT
2384 ASSERT_PRED_FORMAT5(PredFormatFunction5
,
2394 // Tests a failed ASSERT_PRED_FORMAT5 where the
2395 // predicate-formatter is a functor on a built-in type (int).
2396 TEST_F(ASSERT_PRED_FORMAT5Test
, FunctorOnBuiltInTypeFailure
) {
2397 expected_to_finish_
= false;
2398 EXPECT_FATAL_FAILURE({ // NOLINT
2399 ASSERT_PRED_FORMAT5(PredFormatFunctor5(),
2409 // Tests a failed ASSERT_PRED_FORMAT5 where the
2410 // predicate-formatter is a functor on a user-defined type (Bool).
2411 TEST_F(ASSERT_PRED_FORMAT5Test
, FunctorOnUserTypeFailure
) {
2412 expected_to_finish_
= false;
2413 EXPECT_FATAL_FAILURE({ // NOLINT
2414 ASSERT_PRED_FORMAT5(PredFormatFunctor5(),