00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050 #include <iostream>
00051
00052 #include "gtest/gtest.h"
00053 #include "gtest/gtest-spi.h"
00054
00055
00056 struct Bool {
00057 explicit Bool(int val) : value(val != 0) {}
00058
00059 bool operator>(int n) const { return value > Bool(n).value; }
00060
00061 Bool operator+(const Bool& rhs) const { return Bool(value + rhs.value); }
00062
00063 bool operator==(const Bool& rhs) const { return value == rhs.value; }
00064
00065 bool value;
00066 };
00067
00068
00069 std::ostream& operator<<(std::ostream& os, const Bool& x) {
00070 return os << (x.value ? "true" : "false");
00071 }
00072
00073
00074
00075
00076 template <typename T1>
00077 bool PredFunction1(T1 v1) {
00078 return v1 > 0;
00079 }
00080
00081
00082
00083
00084 bool PredFunction1Int(int v1) {
00085 return v1 > 0;
00086 }
00087 bool PredFunction1Bool(Bool v1) {
00088 return v1 > 0;
00089 }
00090
00091
00092 struct PredFunctor1 {
00093 template <typename T1>
00094 bool operator()(const T1& v1) {
00095 return v1 > 0;
00096 }
00097 };
00098
00099
00100 template <typename T1>
00101 testing::AssertionResult PredFormatFunction1(const char* e1,
00102 const T1& v1) {
00103 if (PredFunction1(v1))
00104 return testing::AssertionSuccess();
00105
00106 return testing::AssertionFailure()
00107 << e1
00108 << " is expected to be positive, but evaluates to "
00109 << v1 << ".";
00110 }
00111
00112
00113 struct PredFormatFunctor1 {
00114 template <typename T1>
00115 testing::AssertionResult operator()(const char* e1,
00116 const T1& v1) const {
00117 return PredFormatFunction1(e1, v1);
00118 }
00119 };
00120
00121
00122
00123 class Predicate1Test : public testing::Test {
00124 protected:
00125 virtual void SetUp() {
00126 expected_to_finish_ = true;
00127 finished_ = false;
00128 n1_ = 0;
00129 }
00130
00131 virtual void TearDown() {
00132
00133
00134 EXPECT_EQ(1, n1_) <<
00135 "The predicate assertion didn't evaluate argument 2 "
00136 "exactly once.";
00137
00138
00139 if (expected_to_finish_ && !finished_) {
00140 FAIL() << "The predicate assertion unexpactedly aborted the test.";
00141 } else if (!expected_to_finish_ && finished_) {
00142 FAIL() << "The failed predicate assertion didn't abort the test "
00143 "as expected.";
00144 }
00145 }
00146
00147
00148 static bool expected_to_finish_;
00149
00150
00151 static bool finished_;
00152
00153 static int n1_;
00154 };
00155
00156 bool Predicate1Test::expected_to_finish_;
00157 bool Predicate1Test::finished_;
00158 int Predicate1Test::n1_;
00159
00160 typedef Predicate1Test EXPECT_PRED_FORMAT1Test;
00161 typedef Predicate1Test ASSERT_PRED_FORMAT1Test;
00162 typedef Predicate1Test EXPECT_PRED1Test;
00163 typedef Predicate1Test ASSERT_PRED1Test;
00164
00165
00166
00167 TEST_F(EXPECT_PRED1Test, FunctionOnBuiltInTypeSuccess) {
00168 EXPECT_PRED1(PredFunction1Int,
00169 ++n1_);
00170 finished_ = true;
00171 }
00172
00173
00174
00175 TEST_F(EXPECT_PRED1Test, FunctionOnUserTypeSuccess) {
00176 EXPECT_PRED1(PredFunction1Bool,
00177 Bool(++n1_));
00178 finished_ = true;
00179 }
00180
00181
00182
00183 TEST_F(EXPECT_PRED1Test, FunctorOnBuiltInTypeSuccess) {
00184 EXPECT_PRED1(PredFunctor1(),
00185 ++n1_);
00186 finished_ = true;
00187 }
00188
00189
00190
00191 TEST_F(EXPECT_PRED1Test, FunctorOnUserTypeSuccess) {
00192 EXPECT_PRED1(PredFunctor1(),
00193 Bool(++n1_));
00194 finished_ = true;
00195 }
00196
00197
00198
00199 TEST_F(EXPECT_PRED1Test, FunctionOnBuiltInTypeFailure) {
00200 EXPECT_NONFATAL_FAILURE({
00201 EXPECT_PRED1(PredFunction1Int,
00202 n1_++);
00203 finished_ = true;
00204 }, "");
00205 }
00206
00207
00208
00209 TEST_F(EXPECT_PRED1Test, FunctionOnUserTypeFailure) {
00210 EXPECT_NONFATAL_FAILURE({
00211 EXPECT_PRED1(PredFunction1Bool,
00212 Bool(n1_++));
00213 finished_ = true;
00214 }, "");
00215 }
00216
00217
00218
00219 TEST_F(EXPECT_PRED1Test, FunctorOnBuiltInTypeFailure) {
00220 EXPECT_NONFATAL_FAILURE({
00221 EXPECT_PRED1(PredFunctor1(),
00222 n1_++);
00223 finished_ = true;
00224 }, "");
00225 }
00226
00227
00228
00229 TEST_F(EXPECT_PRED1Test, FunctorOnUserTypeFailure) {
00230 EXPECT_NONFATAL_FAILURE({
00231 EXPECT_PRED1(PredFunctor1(),
00232 Bool(n1_++));
00233 finished_ = true;
00234 }, "");
00235 }
00236
00237
00238
00239 TEST_F(ASSERT_PRED1Test, FunctionOnBuiltInTypeSuccess) {
00240 ASSERT_PRED1(PredFunction1Int,
00241 ++n1_);
00242 finished_ = true;
00243 }
00244
00245
00246
00247 TEST_F(ASSERT_PRED1Test, FunctionOnUserTypeSuccess) {
00248 ASSERT_PRED1(PredFunction1Bool,
00249 Bool(++n1_));
00250 finished_ = true;
00251 }
00252
00253
00254
00255 TEST_F(ASSERT_PRED1Test, FunctorOnBuiltInTypeSuccess) {
00256 ASSERT_PRED1(PredFunctor1(),
00257 ++n1_);
00258 finished_ = true;
00259 }
00260
00261
00262
00263 TEST_F(ASSERT_PRED1Test, FunctorOnUserTypeSuccess) {
00264 ASSERT_PRED1(PredFunctor1(),
00265 Bool(++n1_));
00266 finished_ = true;
00267 }
00268
00269
00270
00271 TEST_F(ASSERT_PRED1Test, FunctionOnBuiltInTypeFailure) {
00272 expected_to_finish_ = false;
00273 EXPECT_FATAL_FAILURE({
00274 ASSERT_PRED1(PredFunction1Int,
00275 n1_++);
00276 finished_ = true;
00277 }, "");
00278 }
00279
00280
00281
00282 TEST_F(ASSERT_PRED1Test, FunctionOnUserTypeFailure) {
00283 expected_to_finish_ = false;
00284 EXPECT_FATAL_FAILURE({
00285 ASSERT_PRED1(PredFunction1Bool,
00286 Bool(n1_++));
00287 finished_ = true;
00288 }, "");
00289 }
00290
00291
00292
00293 TEST_F(ASSERT_PRED1Test, FunctorOnBuiltInTypeFailure) {
00294 expected_to_finish_ = false;
00295 EXPECT_FATAL_FAILURE({
00296 ASSERT_PRED1(PredFunctor1(),
00297 n1_++);
00298 finished_ = true;
00299 }, "");
00300 }
00301
00302
00303
00304 TEST_F(ASSERT_PRED1Test, FunctorOnUserTypeFailure) {
00305 expected_to_finish_ = false;
00306 EXPECT_FATAL_FAILURE({
00307 ASSERT_PRED1(PredFunctor1(),
00308 Bool(n1_++));
00309 finished_ = true;
00310 }, "");
00311 }
00312
00313
00314
00315 TEST_F(EXPECT_PRED_FORMAT1Test, FunctionOnBuiltInTypeSuccess) {
00316 EXPECT_PRED_FORMAT1(PredFormatFunction1,
00317 ++n1_);
00318 finished_ = true;
00319 }
00320
00321
00322
00323 TEST_F(EXPECT_PRED_FORMAT1Test, FunctionOnUserTypeSuccess) {
00324 EXPECT_PRED_FORMAT1(PredFormatFunction1,
00325 Bool(++n1_));
00326 finished_ = true;
00327 }
00328
00329
00330
00331 TEST_F(EXPECT_PRED_FORMAT1Test, FunctorOnBuiltInTypeSuccess) {
00332 EXPECT_PRED_FORMAT1(PredFormatFunctor1(),
00333 ++n1_);
00334 finished_ = true;
00335 }
00336
00337
00338
00339 TEST_F(EXPECT_PRED_FORMAT1Test, FunctorOnUserTypeSuccess) {
00340 EXPECT_PRED_FORMAT1(PredFormatFunctor1(),
00341 Bool(++n1_));
00342 finished_ = true;
00343 }
00344
00345
00346
00347 TEST_F(EXPECT_PRED_FORMAT1Test, FunctionOnBuiltInTypeFailure) {
00348 EXPECT_NONFATAL_FAILURE({
00349 EXPECT_PRED_FORMAT1(PredFormatFunction1,
00350 n1_++);
00351 finished_ = true;
00352 }, "");
00353 }
00354
00355
00356
00357 TEST_F(EXPECT_PRED_FORMAT1Test, FunctionOnUserTypeFailure) {
00358 EXPECT_NONFATAL_FAILURE({
00359 EXPECT_PRED_FORMAT1(PredFormatFunction1,
00360 Bool(n1_++));
00361 finished_ = true;
00362 }, "");
00363 }
00364
00365
00366
00367 TEST_F(EXPECT_PRED_FORMAT1Test, FunctorOnBuiltInTypeFailure) {
00368 EXPECT_NONFATAL_FAILURE({
00369 EXPECT_PRED_FORMAT1(PredFormatFunctor1(),
00370 n1_++);
00371 finished_ = true;
00372 }, "");
00373 }
00374
00375
00376
00377 TEST_F(EXPECT_PRED_FORMAT1Test, FunctorOnUserTypeFailure) {
00378 EXPECT_NONFATAL_FAILURE({
00379 EXPECT_PRED_FORMAT1(PredFormatFunctor1(),
00380 Bool(n1_++));
00381 finished_ = true;
00382 }, "");
00383 }
00384
00385
00386
00387 TEST_F(ASSERT_PRED_FORMAT1Test, FunctionOnBuiltInTypeSuccess) {
00388 ASSERT_PRED_FORMAT1(PredFormatFunction1,
00389 ++n1_);
00390 finished_ = true;
00391 }
00392
00393
00394
00395 TEST_F(ASSERT_PRED_FORMAT1Test, FunctionOnUserTypeSuccess) {
00396 ASSERT_PRED_FORMAT1(PredFormatFunction1,
00397 Bool(++n1_));
00398 finished_ = true;
00399 }
00400
00401
00402
00403 TEST_F(ASSERT_PRED_FORMAT1Test, FunctorOnBuiltInTypeSuccess) {
00404 ASSERT_PRED_FORMAT1(PredFormatFunctor1(),
00405 ++n1_);
00406 finished_ = true;
00407 }
00408
00409
00410
00411 TEST_F(ASSERT_PRED_FORMAT1Test, FunctorOnUserTypeSuccess) {
00412 ASSERT_PRED_FORMAT1(PredFormatFunctor1(),
00413 Bool(++n1_));
00414 finished_ = true;
00415 }
00416
00417
00418
00419 TEST_F(ASSERT_PRED_FORMAT1Test, FunctionOnBuiltInTypeFailure) {
00420 expected_to_finish_ = false;
00421 EXPECT_FATAL_FAILURE({
00422 ASSERT_PRED_FORMAT1(PredFormatFunction1,
00423 n1_++);
00424 finished_ = true;
00425 }, "");
00426 }
00427
00428
00429
00430 TEST_F(ASSERT_PRED_FORMAT1Test, FunctionOnUserTypeFailure) {
00431 expected_to_finish_ = false;
00432 EXPECT_FATAL_FAILURE({
00433 ASSERT_PRED_FORMAT1(PredFormatFunction1,
00434 Bool(n1_++));
00435 finished_ = true;
00436 }, "");
00437 }
00438
00439
00440
00441 TEST_F(ASSERT_PRED_FORMAT1Test, FunctorOnBuiltInTypeFailure) {
00442 expected_to_finish_ = false;
00443 EXPECT_FATAL_FAILURE({
00444 ASSERT_PRED_FORMAT1(PredFormatFunctor1(),
00445 n1_++);
00446 finished_ = true;
00447 }, "");
00448 }
00449
00450
00451
00452 TEST_F(ASSERT_PRED_FORMAT1Test, FunctorOnUserTypeFailure) {
00453 expected_to_finish_ = false;
00454 EXPECT_FATAL_FAILURE({
00455 ASSERT_PRED_FORMAT1(PredFormatFunctor1(),
00456 Bool(n1_++));
00457 finished_ = true;
00458 }, "");
00459 }
00460
00461
00462
00463 template <typename T1, typename T2>
00464 bool PredFunction2(T1 v1, T2 v2) {
00465 return v1 + v2 > 0;
00466 }
00467
00468
00469
00470
00471 bool PredFunction2Int(int v1, int v2) {
00472 return v1 + v2 > 0;
00473 }
00474 bool PredFunction2Bool(Bool v1, Bool v2) {
00475 return v1 + v2 > 0;
00476 }
00477
00478
00479 struct PredFunctor2 {
00480 template <typename T1, typename T2>
00481 bool operator()(const T1& v1,
00482 const T2& v2) {
00483 return v1 + v2 > 0;
00484 }
00485 };
00486
00487
00488 template <typename T1, typename T2>
00489 testing::AssertionResult PredFormatFunction2(const char* e1,
00490 const char* e2,
00491 const T1& v1,
00492 const T2& v2) {
00493 if (PredFunction2(v1, v2))
00494 return testing::AssertionSuccess();
00495
00496 return testing::AssertionFailure()
00497 << e1 << " + " << e2
00498 << " is expected to be positive, but evaluates to "
00499 << v1 + v2 << ".";
00500 }
00501
00502
00503 struct PredFormatFunctor2 {
00504 template <typename T1, typename T2>
00505 testing::AssertionResult operator()(const char* e1,
00506 const char* e2,
00507 const T1& v1,
00508 const T2& v2) const {
00509 return PredFormatFunction2(e1, e2, v1, v2);
00510 }
00511 };
00512
00513
00514
00515 class Predicate2Test : public testing::Test {
00516 protected:
00517 virtual void SetUp() {
00518 expected_to_finish_ = true;
00519 finished_ = false;
00520 n1_ = n2_ = 0;
00521 }
00522
00523 virtual void TearDown() {
00524
00525
00526 EXPECT_EQ(1, n1_) <<
00527 "The predicate assertion didn't evaluate argument 2 "
00528 "exactly once.";
00529 EXPECT_EQ(1, n2_) <<
00530 "The predicate assertion didn't evaluate argument 3 "
00531 "exactly once.";
00532
00533
00534 if (expected_to_finish_ && !finished_) {
00535 FAIL() << "The predicate assertion unexpactedly aborted the test.";
00536 } else if (!expected_to_finish_ && finished_) {
00537 FAIL() << "The failed predicate assertion didn't abort the test "
00538 "as expected.";
00539 }
00540 }
00541
00542
00543 static bool expected_to_finish_;
00544
00545
00546 static bool finished_;
00547
00548 static int n1_;
00549 static int n2_;
00550 };
00551
00552 bool Predicate2Test::expected_to_finish_;
00553 bool Predicate2Test::finished_;
00554 int Predicate2Test::n1_;
00555 int Predicate2Test::n2_;
00556
00557 typedef Predicate2Test EXPECT_PRED_FORMAT2Test;
00558 typedef Predicate2Test ASSERT_PRED_FORMAT2Test;
00559 typedef Predicate2Test EXPECT_PRED2Test;
00560 typedef Predicate2Test ASSERT_PRED2Test;
00561
00562
00563
00564 TEST_F(EXPECT_PRED2Test, FunctionOnBuiltInTypeSuccess) {
00565 EXPECT_PRED2(PredFunction2Int,
00566 ++n1_,
00567 ++n2_);
00568 finished_ = true;
00569 }
00570
00571
00572
00573 TEST_F(EXPECT_PRED2Test, FunctionOnUserTypeSuccess) {
00574 EXPECT_PRED2(PredFunction2Bool,
00575 Bool(++n1_),
00576 Bool(++n2_));
00577 finished_ = true;
00578 }
00579
00580
00581
00582 TEST_F(EXPECT_PRED2Test, FunctorOnBuiltInTypeSuccess) {
00583 EXPECT_PRED2(PredFunctor2(),
00584 ++n1_,
00585 ++n2_);
00586 finished_ = true;
00587 }
00588
00589
00590
00591 TEST_F(EXPECT_PRED2Test, FunctorOnUserTypeSuccess) {
00592 EXPECT_PRED2(PredFunctor2(),
00593 Bool(++n1_),
00594 Bool(++n2_));
00595 finished_ = true;
00596 }
00597
00598
00599
00600 TEST_F(EXPECT_PRED2Test, FunctionOnBuiltInTypeFailure) {
00601 EXPECT_NONFATAL_FAILURE({
00602 EXPECT_PRED2(PredFunction2Int,
00603 n1_++,
00604 n2_++);
00605 finished_ = true;
00606 }, "");
00607 }
00608
00609
00610
00611 TEST_F(EXPECT_PRED2Test, FunctionOnUserTypeFailure) {
00612 EXPECT_NONFATAL_FAILURE({
00613 EXPECT_PRED2(PredFunction2Bool,
00614 Bool(n1_++),
00615 Bool(n2_++));
00616 finished_ = true;
00617 }, "");
00618 }
00619
00620
00621
00622 TEST_F(EXPECT_PRED2Test, FunctorOnBuiltInTypeFailure) {
00623 EXPECT_NONFATAL_FAILURE({
00624 EXPECT_PRED2(PredFunctor2(),
00625 n1_++,
00626 n2_++);
00627 finished_ = true;
00628 }, "");
00629 }
00630
00631
00632
00633 TEST_F(EXPECT_PRED2Test, FunctorOnUserTypeFailure) {
00634 EXPECT_NONFATAL_FAILURE({
00635 EXPECT_PRED2(PredFunctor2(),
00636 Bool(n1_++),
00637 Bool(n2_++));
00638 finished_ = true;
00639 }, "");
00640 }
00641
00642
00643
00644 TEST_F(ASSERT_PRED2Test, FunctionOnBuiltInTypeSuccess) {
00645 ASSERT_PRED2(PredFunction2Int,
00646 ++n1_,
00647 ++n2_);
00648 finished_ = true;
00649 }
00650
00651
00652
00653 TEST_F(ASSERT_PRED2Test, FunctionOnUserTypeSuccess) {
00654 ASSERT_PRED2(PredFunction2Bool,
00655 Bool(++n1_),
00656 Bool(++n2_));
00657 finished_ = true;
00658 }
00659
00660
00661
00662 TEST_F(ASSERT_PRED2Test, FunctorOnBuiltInTypeSuccess) {
00663 ASSERT_PRED2(PredFunctor2(),
00664 ++n1_,
00665 ++n2_);
00666 finished_ = true;
00667 }
00668
00669
00670
00671 TEST_F(ASSERT_PRED2Test, FunctorOnUserTypeSuccess) {
00672 ASSERT_PRED2(PredFunctor2(),
00673 Bool(++n1_),
00674 Bool(++n2_));
00675 finished_ = true;
00676 }
00677
00678
00679
00680 TEST_F(ASSERT_PRED2Test, FunctionOnBuiltInTypeFailure) {
00681 expected_to_finish_ = false;
00682 EXPECT_FATAL_FAILURE({
00683 ASSERT_PRED2(PredFunction2Int,
00684 n1_++,
00685 n2_++);
00686 finished_ = true;
00687 }, "");
00688 }
00689
00690
00691
00692 TEST_F(ASSERT_PRED2Test, FunctionOnUserTypeFailure) {
00693 expected_to_finish_ = false;
00694 EXPECT_FATAL_FAILURE({
00695 ASSERT_PRED2(PredFunction2Bool,
00696 Bool(n1_++),
00697 Bool(n2_++));
00698 finished_ = true;
00699 }, "");
00700 }
00701
00702
00703
00704 TEST_F(ASSERT_PRED2Test, FunctorOnBuiltInTypeFailure) {
00705 expected_to_finish_ = false;
00706 EXPECT_FATAL_FAILURE({
00707 ASSERT_PRED2(PredFunctor2(),
00708 n1_++,
00709 n2_++);
00710 finished_ = true;
00711 }, "");
00712 }
00713
00714
00715
00716 TEST_F(ASSERT_PRED2Test, FunctorOnUserTypeFailure) {
00717 expected_to_finish_ = false;
00718 EXPECT_FATAL_FAILURE({
00719 ASSERT_PRED2(PredFunctor2(),
00720 Bool(n1_++),
00721 Bool(n2_++));
00722 finished_ = true;
00723 }, "");
00724 }
00725
00726
00727
00728 TEST_F(EXPECT_PRED_FORMAT2Test, FunctionOnBuiltInTypeSuccess) {
00729 EXPECT_PRED_FORMAT2(PredFormatFunction2,
00730 ++n1_,
00731 ++n2_);
00732 finished_ = true;
00733 }
00734
00735
00736
00737 TEST_F(EXPECT_PRED_FORMAT2Test, FunctionOnUserTypeSuccess) {
00738 EXPECT_PRED_FORMAT2(PredFormatFunction2,
00739 Bool(++n1_),
00740 Bool(++n2_));
00741 finished_ = true;
00742 }
00743
00744
00745
00746 TEST_F(EXPECT_PRED_FORMAT2Test, FunctorOnBuiltInTypeSuccess) {
00747 EXPECT_PRED_FORMAT2(PredFormatFunctor2(),
00748 ++n1_,
00749 ++n2_);
00750 finished_ = true;
00751 }
00752
00753
00754
00755 TEST_F(EXPECT_PRED_FORMAT2Test, FunctorOnUserTypeSuccess) {
00756 EXPECT_PRED_FORMAT2(PredFormatFunctor2(),
00757 Bool(++n1_),
00758 Bool(++n2_));
00759 finished_ = true;
00760 }
00761
00762
00763
00764 TEST_F(EXPECT_PRED_FORMAT2Test, FunctionOnBuiltInTypeFailure) {
00765 EXPECT_NONFATAL_FAILURE({
00766 EXPECT_PRED_FORMAT2(PredFormatFunction2,
00767 n1_++,
00768 n2_++);
00769 finished_ = true;
00770 }, "");
00771 }
00772
00773
00774
00775 TEST_F(EXPECT_PRED_FORMAT2Test, FunctionOnUserTypeFailure) {
00776 EXPECT_NONFATAL_FAILURE({
00777 EXPECT_PRED_FORMAT2(PredFormatFunction2,
00778 Bool(n1_++),
00779 Bool(n2_++));
00780 finished_ = true;
00781 }, "");
00782 }
00783
00784
00785
00786 TEST_F(EXPECT_PRED_FORMAT2Test, FunctorOnBuiltInTypeFailure) {
00787 EXPECT_NONFATAL_FAILURE({
00788 EXPECT_PRED_FORMAT2(PredFormatFunctor2(),
00789 n1_++,
00790 n2_++);
00791 finished_ = true;
00792 }, "");
00793 }
00794
00795
00796
00797 TEST_F(EXPECT_PRED_FORMAT2Test, FunctorOnUserTypeFailure) {
00798 EXPECT_NONFATAL_FAILURE({
00799 EXPECT_PRED_FORMAT2(PredFormatFunctor2(),
00800 Bool(n1_++),
00801 Bool(n2_++));
00802 finished_ = true;
00803 }, "");
00804 }
00805
00806
00807
00808 TEST_F(ASSERT_PRED_FORMAT2Test, FunctionOnBuiltInTypeSuccess) {
00809 ASSERT_PRED_FORMAT2(PredFormatFunction2,
00810 ++n1_,
00811 ++n2_);
00812 finished_ = true;
00813 }
00814
00815
00816
00817 TEST_F(ASSERT_PRED_FORMAT2Test, FunctionOnUserTypeSuccess) {
00818 ASSERT_PRED_FORMAT2(PredFormatFunction2,
00819 Bool(++n1_),
00820 Bool(++n2_));
00821 finished_ = true;
00822 }
00823
00824
00825
00826 TEST_F(ASSERT_PRED_FORMAT2Test, FunctorOnBuiltInTypeSuccess) {
00827 ASSERT_PRED_FORMAT2(PredFormatFunctor2(),
00828 ++n1_,
00829 ++n2_);
00830 finished_ = true;
00831 }
00832
00833
00834
00835 TEST_F(ASSERT_PRED_FORMAT2Test, FunctorOnUserTypeSuccess) {
00836 ASSERT_PRED_FORMAT2(PredFormatFunctor2(),
00837 Bool(++n1_),
00838 Bool(++n2_));
00839 finished_ = true;
00840 }
00841
00842
00843
00844 TEST_F(ASSERT_PRED_FORMAT2Test, FunctionOnBuiltInTypeFailure) {
00845 expected_to_finish_ = false;
00846 EXPECT_FATAL_FAILURE({
00847 ASSERT_PRED_FORMAT2(PredFormatFunction2,
00848 n1_++,
00849 n2_++);
00850 finished_ = true;
00851 }, "");
00852 }
00853
00854
00855
00856 TEST_F(ASSERT_PRED_FORMAT2Test, FunctionOnUserTypeFailure) {
00857 expected_to_finish_ = false;
00858 EXPECT_FATAL_FAILURE({
00859 ASSERT_PRED_FORMAT2(PredFormatFunction2,
00860 Bool(n1_++),
00861 Bool(n2_++));
00862 finished_ = true;
00863 }, "");
00864 }
00865
00866
00867
00868 TEST_F(ASSERT_PRED_FORMAT2Test, FunctorOnBuiltInTypeFailure) {
00869 expected_to_finish_ = false;
00870 EXPECT_FATAL_FAILURE({
00871 ASSERT_PRED_FORMAT2(PredFormatFunctor2(),
00872 n1_++,
00873 n2_++);
00874 finished_ = true;
00875 }, "");
00876 }
00877
00878
00879
00880 TEST_F(ASSERT_PRED_FORMAT2Test, FunctorOnUserTypeFailure) {
00881 expected_to_finish_ = false;
00882 EXPECT_FATAL_FAILURE({
00883 ASSERT_PRED_FORMAT2(PredFormatFunctor2(),
00884 Bool(n1_++),
00885 Bool(n2_++));
00886 finished_ = true;
00887 }, "");
00888 }
00889
00890
00891
00892 template <typename T1, typename T2, typename T3>
00893 bool PredFunction3(T1 v1, T2 v2, T3 v3) {
00894 return v1 + v2 + v3 > 0;
00895 }
00896
00897
00898
00899
00900 bool PredFunction3Int(int v1, int v2, int v3) {
00901 return v1 + v2 + v3 > 0;
00902 }
00903 bool PredFunction3Bool(Bool v1, Bool v2, Bool v3) {
00904 return v1 + v2 + v3 > 0;
00905 }
00906
00907
00908 struct PredFunctor3 {
00909 template <typename T1, typename T2, typename T3>
00910 bool operator()(const T1& v1,
00911 const T2& v2,
00912 const T3& v3) {
00913 return v1 + v2 + v3 > 0;
00914 }
00915 };
00916
00917
00918 template <typename T1, typename T2, typename T3>
00919 testing::AssertionResult PredFormatFunction3(const char* e1,
00920 const char* e2,
00921 const char* e3,
00922 const T1& v1,
00923 const T2& v2,
00924 const T3& v3) {
00925 if (PredFunction3(v1, v2, v3))
00926 return testing::AssertionSuccess();
00927
00928 return testing::AssertionFailure()
00929 << e1 << " + " << e2 << " + " << e3
00930 << " is expected to be positive, but evaluates to "
00931 << v1 + v2 + v3 << ".";
00932 }
00933
00934
00935 struct PredFormatFunctor3 {
00936 template <typename T1, typename T2, typename T3>
00937 testing::AssertionResult operator()(const char* e1,
00938 const char* e2,
00939 const char* e3,
00940 const T1& v1,
00941 const T2& v2,
00942 const T3& v3) const {
00943 return PredFormatFunction3(e1, e2, e3, v1, v2, v3);
00944 }
00945 };
00946
00947
00948
00949 class Predicate3Test : public testing::Test {
00950 protected:
00951 virtual void SetUp() {
00952 expected_to_finish_ = true;
00953 finished_ = false;
00954 n1_ = n2_ = n3_ = 0;
00955 }
00956
00957 virtual void TearDown() {
00958
00959
00960 EXPECT_EQ(1, n1_) <<
00961 "The predicate assertion didn't evaluate argument 2 "
00962 "exactly once.";
00963 EXPECT_EQ(1, n2_) <<
00964 "The predicate assertion didn't evaluate argument 3 "
00965 "exactly once.";
00966 EXPECT_EQ(1, n3_) <<
00967 "The predicate assertion didn't evaluate argument 4 "
00968 "exactly once.";
00969
00970
00971 if (expected_to_finish_ && !finished_) {
00972 FAIL() << "The predicate assertion unexpactedly aborted the test.";
00973 } else if (!expected_to_finish_ && finished_) {
00974 FAIL() << "The failed predicate assertion didn't abort the test "
00975 "as expected.";
00976 }
00977 }
00978
00979
00980 static bool expected_to_finish_;
00981
00982
00983 static bool finished_;
00984
00985 static int n1_;
00986 static int n2_;
00987 static int n3_;
00988 };
00989
00990 bool Predicate3Test::expected_to_finish_;
00991 bool Predicate3Test::finished_;
00992 int Predicate3Test::n1_;
00993 int Predicate3Test::n2_;
00994 int Predicate3Test::n3_;
00995
00996 typedef Predicate3Test EXPECT_PRED_FORMAT3Test;
00997 typedef Predicate3Test ASSERT_PRED_FORMAT3Test;
00998 typedef Predicate3Test EXPECT_PRED3Test;
00999 typedef Predicate3Test ASSERT_PRED3Test;
01000
01001
01002
01003 TEST_F(EXPECT_PRED3Test, FunctionOnBuiltInTypeSuccess) {
01004 EXPECT_PRED3(PredFunction3Int,
01005 ++n1_,
01006 ++n2_,
01007 ++n3_);
01008 finished_ = true;
01009 }
01010
01011
01012
01013 TEST_F(EXPECT_PRED3Test, FunctionOnUserTypeSuccess) {
01014 EXPECT_PRED3(PredFunction3Bool,
01015 Bool(++n1_),
01016 Bool(++n2_),
01017 Bool(++n3_));
01018 finished_ = true;
01019 }
01020
01021
01022
01023 TEST_F(EXPECT_PRED3Test, FunctorOnBuiltInTypeSuccess) {
01024 EXPECT_PRED3(PredFunctor3(),
01025 ++n1_,
01026 ++n2_,
01027 ++n3_);
01028 finished_ = true;
01029 }
01030
01031
01032
01033 TEST_F(EXPECT_PRED3Test, FunctorOnUserTypeSuccess) {
01034 EXPECT_PRED3(PredFunctor3(),
01035 Bool(++n1_),
01036 Bool(++n2_),
01037 Bool(++n3_));
01038 finished_ = true;
01039 }
01040
01041
01042
01043 TEST_F(EXPECT_PRED3Test, FunctionOnBuiltInTypeFailure) {
01044 EXPECT_NONFATAL_FAILURE({
01045 EXPECT_PRED3(PredFunction3Int,
01046 n1_++,
01047 n2_++,
01048 n3_++);
01049 finished_ = true;
01050 }, "");
01051 }
01052
01053
01054
01055 TEST_F(EXPECT_PRED3Test, FunctionOnUserTypeFailure) {
01056 EXPECT_NONFATAL_FAILURE({
01057 EXPECT_PRED3(PredFunction3Bool,
01058 Bool(n1_++),
01059 Bool(n2_++),
01060 Bool(n3_++));
01061 finished_ = true;
01062 }, "");
01063 }
01064
01065
01066
01067 TEST_F(EXPECT_PRED3Test, FunctorOnBuiltInTypeFailure) {
01068 EXPECT_NONFATAL_FAILURE({
01069 EXPECT_PRED3(PredFunctor3(),
01070 n1_++,
01071 n2_++,
01072 n3_++);
01073 finished_ = true;
01074 }, "");
01075 }
01076
01077
01078
01079 TEST_F(EXPECT_PRED3Test, FunctorOnUserTypeFailure) {
01080 EXPECT_NONFATAL_FAILURE({
01081 EXPECT_PRED3(PredFunctor3(),
01082 Bool(n1_++),
01083 Bool(n2_++),
01084 Bool(n3_++));
01085 finished_ = true;
01086 }, "");
01087 }
01088
01089
01090
01091 TEST_F(ASSERT_PRED3Test, FunctionOnBuiltInTypeSuccess) {
01092 ASSERT_PRED3(PredFunction3Int,
01093 ++n1_,
01094 ++n2_,
01095 ++n3_);
01096 finished_ = true;
01097 }
01098
01099
01100
01101 TEST_F(ASSERT_PRED3Test, FunctionOnUserTypeSuccess) {
01102 ASSERT_PRED3(PredFunction3Bool,
01103 Bool(++n1_),
01104 Bool(++n2_),
01105 Bool(++n3_));
01106 finished_ = true;
01107 }
01108
01109
01110
01111 TEST_F(ASSERT_PRED3Test, FunctorOnBuiltInTypeSuccess) {
01112 ASSERT_PRED3(PredFunctor3(),
01113 ++n1_,
01114 ++n2_,
01115 ++n3_);
01116 finished_ = true;
01117 }
01118
01119
01120
01121 TEST_F(ASSERT_PRED3Test, FunctorOnUserTypeSuccess) {
01122 ASSERT_PRED3(PredFunctor3(),
01123 Bool(++n1_),
01124 Bool(++n2_),
01125 Bool(++n3_));
01126 finished_ = true;
01127 }
01128
01129
01130
01131 TEST_F(ASSERT_PRED3Test, FunctionOnBuiltInTypeFailure) {
01132 expected_to_finish_ = false;
01133 EXPECT_FATAL_FAILURE({
01134 ASSERT_PRED3(PredFunction3Int,
01135 n1_++,
01136 n2_++,
01137 n3_++);
01138 finished_ = true;
01139 }, "");
01140 }
01141
01142
01143
01144 TEST_F(ASSERT_PRED3Test, FunctionOnUserTypeFailure) {
01145 expected_to_finish_ = false;
01146 EXPECT_FATAL_FAILURE({
01147 ASSERT_PRED3(PredFunction3Bool,
01148 Bool(n1_++),
01149 Bool(n2_++),
01150 Bool(n3_++));
01151 finished_ = true;
01152 }, "");
01153 }
01154
01155
01156
01157 TEST_F(ASSERT_PRED3Test, FunctorOnBuiltInTypeFailure) {
01158 expected_to_finish_ = false;
01159 EXPECT_FATAL_FAILURE({
01160 ASSERT_PRED3(PredFunctor3(),
01161 n1_++,
01162 n2_++,
01163 n3_++);
01164 finished_ = true;
01165 }, "");
01166 }
01167
01168
01169
01170 TEST_F(ASSERT_PRED3Test, FunctorOnUserTypeFailure) {
01171 expected_to_finish_ = false;
01172 EXPECT_FATAL_FAILURE({
01173 ASSERT_PRED3(PredFunctor3(),
01174 Bool(n1_++),
01175 Bool(n2_++),
01176 Bool(n3_++));
01177 finished_ = true;
01178 }, "");
01179 }
01180
01181
01182
01183 TEST_F(EXPECT_PRED_FORMAT3Test, FunctionOnBuiltInTypeSuccess) {
01184 EXPECT_PRED_FORMAT3(PredFormatFunction3,
01185 ++n1_,
01186 ++n2_,
01187 ++n3_);
01188 finished_ = true;
01189 }
01190
01191
01192
01193 TEST_F(EXPECT_PRED_FORMAT3Test, FunctionOnUserTypeSuccess) {
01194 EXPECT_PRED_FORMAT3(PredFormatFunction3,
01195 Bool(++n1_),
01196 Bool(++n2_),
01197 Bool(++n3_));
01198 finished_ = true;
01199 }
01200
01201
01202
01203 TEST_F(EXPECT_PRED_FORMAT3Test, FunctorOnBuiltInTypeSuccess) {
01204 EXPECT_PRED_FORMAT3(PredFormatFunctor3(),
01205 ++n1_,
01206 ++n2_,
01207 ++n3_);
01208 finished_ = true;
01209 }
01210
01211
01212
01213 TEST_F(EXPECT_PRED_FORMAT3Test, FunctorOnUserTypeSuccess) {
01214 EXPECT_PRED_FORMAT3(PredFormatFunctor3(),
01215 Bool(++n1_),
01216 Bool(++n2_),
01217 Bool(++n3_));
01218 finished_ = true;
01219 }
01220
01221
01222
01223 TEST_F(EXPECT_PRED_FORMAT3Test, FunctionOnBuiltInTypeFailure) {
01224 EXPECT_NONFATAL_FAILURE({
01225 EXPECT_PRED_FORMAT3(PredFormatFunction3,
01226 n1_++,
01227 n2_++,
01228 n3_++);
01229 finished_ = true;
01230 }, "");
01231 }
01232
01233
01234
01235 TEST_F(EXPECT_PRED_FORMAT3Test, FunctionOnUserTypeFailure) {
01236 EXPECT_NONFATAL_FAILURE({
01237 EXPECT_PRED_FORMAT3(PredFormatFunction3,
01238 Bool(n1_++),
01239 Bool(n2_++),
01240 Bool(n3_++));
01241 finished_ = true;
01242 }, "");
01243 }
01244
01245
01246
01247 TEST_F(EXPECT_PRED_FORMAT3Test, FunctorOnBuiltInTypeFailure) {
01248 EXPECT_NONFATAL_FAILURE({
01249 EXPECT_PRED_FORMAT3(PredFormatFunctor3(),
01250 n1_++,
01251 n2_++,
01252 n3_++);
01253 finished_ = true;
01254 }, "");
01255 }
01256
01257
01258
01259 TEST_F(EXPECT_PRED_FORMAT3Test, FunctorOnUserTypeFailure) {
01260 EXPECT_NONFATAL_FAILURE({
01261 EXPECT_PRED_FORMAT3(PredFormatFunctor3(),
01262 Bool(n1_++),
01263 Bool(n2_++),
01264 Bool(n3_++));
01265 finished_ = true;
01266 }, "");
01267 }
01268
01269
01270
01271 TEST_F(ASSERT_PRED_FORMAT3Test, FunctionOnBuiltInTypeSuccess) {
01272 ASSERT_PRED_FORMAT3(PredFormatFunction3,
01273 ++n1_,
01274 ++n2_,
01275 ++n3_);
01276 finished_ = true;
01277 }
01278
01279
01280
01281 TEST_F(ASSERT_PRED_FORMAT3Test, FunctionOnUserTypeSuccess) {
01282 ASSERT_PRED_FORMAT3(PredFormatFunction3,
01283 Bool(++n1_),
01284 Bool(++n2_),
01285 Bool(++n3_));
01286 finished_ = true;
01287 }
01288
01289
01290
01291 TEST_F(ASSERT_PRED_FORMAT3Test, FunctorOnBuiltInTypeSuccess) {
01292 ASSERT_PRED_FORMAT3(PredFormatFunctor3(),
01293 ++n1_,
01294 ++n2_,
01295 ++n3_);
01296 finished_ = true;
01297 }
01298
01299
01300
01301 TEST_F(ASSERT_PRED_FORMAT3Test, FunctorOnUserTypeSuccess) {
01302 ASSERT_PRED_FORMAT3(PredFormatFunctor3(),
01303 Bool(++n1_),
01304 Bool(++n2_),
01305 Bool(++n3_));
01306 finished_ = true;
01307 }
01308
01309
01310
01311 TEST_F(ASSERT_PRED_FORMAT3Test, FunctionOnBuiltInTypeFailure) {
01312 expected_to_finish_ = false;
01313 EXPECT_FATAL_FAILURE({
01314 ASSERT_PRED_FORMAT3(PredFormatFunction3,
01315 n1_++,
01316 n2_++,
01317 n3_++);
01318 finished_ = true;
01319 }, "");
01320 }
01321
01322
01323
01324 TEST_F(ASSERT_PRED_FORMAT3Test, FunctionOnUserTypeFailure) {
01325 expected_to_finish_ = false;
01326 EXPECT_FATAL_FAILURE({
01327 ASSERT_PRED_FORMAT3(PredFormatFunction3,
01328 Bool(n1_++),
01329 Bool(n2_++),
01330 Bool(n3_++));
01331 finished_ = true;
01332 }, "");
01333 }
01334
01335
01336
01337 TEST_F(ASSERT_PRED_FORMAT3Test, FunctorOnBuiltInTypeFailure) {
01338 expected_to_finish_ = false;
01339 EXPECT_FATAL_FAILURE({
01340 ASSERT_PRED_FORMAT3(PredFormatFunctor3(),
01341 n1_++,
01342 n2_++,
01343 n3_++);
01344 finished_ = true;
01345 }, "");
01346 }
01347
01348
01349
01350 TEST_F(ASSERT_PRED_FORMAT3Test, FunctorOnUserTypeFailure) {
01351 expected_to_finish_ = false;
01352 EXPECT_FATAL_FAILURE({
01353 ASSERT_PRED_FORMAT3(PredFormatFunctor3(),
01354 Bool(n1_++),
01355 Bool(n2_++),
01356 Bool(n3_++));
01357 finished_ = true;
01358 }, "");
01359 }
01360
01361
01362
01363 template <typename T1, typename T2, typename T3, typename T4>
01364 bool PredFunction4(T1 v1, T2 v2, T3 v3, T4 v4) {
01365 return v1 + v2 + v3 + v4 > 0;
01366 }
01367
01368
01369
01370
01371 bool PredFunction4Int(int v1, int v2, int v3, int v4) {
01372 return v1 + v2 + v3 + v4 > 0;
01373 }
01374 bool PredFunction4Bool(Bool v1, Bool v2, Bool v3, Bool v4) {
01375 return v1 + v2 + v3 + v4 > 0;
01376 }
01377
01378
01379 struct PredFunctor4 {
01380 template <typename T1, typename T2, typename T3, typename T4>
01381 bool operator()(const T1& v1,
01382 const T2& v2,
01383 const T3& v3,
01384 const T4& v4) {
01385 return v1 + v2 + v3 + v4 > 0;
01386 }
01387 };
01388
01389
01390 template <typename T1, typename T2, typename T3, typename T4>
01391 testing::AssertionResult PredFormatFunction4(const char* e1,
01392 const char* e2,
01393 const char* e3,
01394 const char* e4,
01395 const T1& v1,
01396 const T2& v2,
01397 const T3& v3,
01398 const T4& v4) {
01399 if (PredFunction4(v1, v2, v3, v4))
01400 return testing::AssertionSuccess();
01401
01402 return testing::AssertionFailure()
01403 << e1 << " + " << e2 << " + " << e3 << " + " << e4
01404 << " is expected to be positive, but evaluates to "
01405 << v1 + v2 + v3 + v4 << ".";
01406 }
01407
01408
01409 struct PredFormatFunctor4 {
01410 template <typename T1, typename T2, typename T3, typename T4>
01411 testing::AssertionResult operator()(const char* e1,
01412 const char* e2,
01413 const char* e3,
01414 const char* e4,
01415 const T1& v1,
01416 const T2& v2,
01417 const T3& v3,
01418 const T4& v4) const {
01419 return PredFormatFunction4(e1, e2, e3, e4, v1, v2, v3, v4);
01420 }
01421 };
01422
01423
01424
01425 class Predicate4Test : public testing::Test {
01426 protected:
01427 virtual void SetUp() {
01428 expected_to_finish_ = true;
01429 finished_ = false;
01430 n1_ = n2_ = n3_ = n4_ = 0;
01431 }
01432
01433 virtual void TearDown() {
01434
01435
01436 EXPECT_EQ(1, n1_) <<
01437 "The predicate assertion didn't evaluate argument 2 "
01438 "exactly once.";
01439 EXPECT_EQ(1, n2_) <<
01440 "The predicate assertion didn't evaluate argument 3 "
01441 "exactly once.";
01442 EXPECT_EQ(1, n3_) <<
01443 "The predicate assertion didn't evaluate argument 4 "
01444 "exactly once.";
01445 EXPECT_EQ(1, n4_) <<
01446 "The predicate assertion didn't evaluate argument 5 "
01447 "exactly once.";
01448
01449
01450 if (expected_to_finish_ && !finished_) {
01451 FAIL() << "The predicate assertion unexpactedly aborted the test.";
01452 } else if (!expected_to_finish_ && finished_) {
01453 FAIL() << "The failed predicate assertion didn't abort the test "
01454 "as expected.";
01455 }
01456 }
01457
01458
01459 static bool expected_to_finish_;
01460
01461
01462 static bool finished_;
01463
01464 static int n1_;
01465 static int n2_;
01466 static int n3_;
01467 static int n4_;
01468 };
01469
01470 bool Predicate4Test::expected_to_finish_;
01471 bool Predicate4Test::finished_;
01472 int Predicate4Test::n1_;
01473 int Predicate4Test::n2_;
01474 int Predicate4Test::n3_;
01475 int Predicate4Test::n4_;
01476
01477 typedef Predicate4Test EXPECT_PRED_FORMAT4Test;
01478 typedef Predicate4Test ASSERT_PRED_FORMAT4Test;
01479 typedef Predicate4Test EXPECT_PRED4Test;
01480 typedef Predicate4Test ASSERT_PRED4Test;
01481
01482
01483
01484 TEST_F(EXPECT_PRED4Test, FunctionOnBuiltInTypeSuccess) {
01485 EXPECT_PRED4(PredFunction4Int,
01486 ++n1_,
01487 ++n2_,
01488 ++n3_,
01489 ++n4_);
01490 finished_ = true;
01491 }
01492
01493
01494
01495 TEST_F(EXPECT_PRED4Test, FunctionOnUserTypeSuccess) {
01496 EXPECT_PRED4(PredFunction4Bool,
01497 Bool(++n1_),
01498 Bool(++n2_),
01499 Bool(++n3_),
01500 Bool(++n4_));
01501 finished_ = true;
01502 }
01503
01504
01505
01506 TEST_F(EXPECT_PRED4Test, FunctorOnBuiltInTypeSuccess) {
01507 EXPECT_PRED4(PredFunctor4(),
01508 ++n1_,
01509 ++n2_,
01510 ++n3_,
01511 ++n4_);
01512 finished_ = true;
01513 }
01514
01515
01516
01517 TEST_F(EXPECT_PRED4Test, FunctorOnUserTypeSuccess) {
01518 EXPECT_PRED4(PredFunctor4(),
01519 Bool(++n1_),
01520 Bool(++n2_),
01521 Bool(++n3_),
01522 Bool(++n4_));
01523 finished_ = true;
01524 }
01525
01526
01527
01528 TEST_F(EXPECT_PRED4Test, FunctionOnBuiltInTypeFailure) {
01529 EXPECT_NONFATAL_FAILURE({
01530 EXPECT_PRED4(PredFunction4Int,
01531 n1_++,
01532 n2_++,
01533 n3_++,
01534 n4_++);
01535 finished_ = true;
01536 }, "");
01537 }
01538
01539
01540
01541 TEST_F(EXPECT_PRED4Test, FunctionOnUserTypeFailure) {
01542 EXPECT_NONFATAL_FAILURE({
01543 EXPECT_PRED4(PredFunction4Bool,
01544 Bool(n1_++),
01545 Bool(n2_++),
01546 Bool(n3_++),
01547 Bool(n4_++));
01548 finished_ = true;
01549 }, "");
01550 }
01551
01552
01553
01554 TEST_F(EXPECT_PRED4Test, FunctorOnBuiltInTypeFailure) {
01555 EXPECT_NONFATAL_FAILURE({
01556 EXPECT_PRED4(PredFunctor4(),
01557 n1_++,
01558 n2_++,
01559 n3_++,
01560 n4_++);
01561 finished_ = true;
01562 }, "");
01563 }
01564
01565
01566
01567 TEST_F(EXPECT_PRED4Test, FunctorOnUserTypeFailure) {
01568 EXPECT_NONFATAL_FAILURE({
01569 EXPECT_PRED4(PredFunctor4(),
01570 Bool(n1_++),
01571 Bool(n2_++),
01572 Bool(n3_++),
01573 Bool(n4_++));
01574 finished_ = true;
01575 }, "");
01576 }
01577
01578
01579
01580 TEST_F(ASSERT_PRED4Test, FunctionOnBuiltInTypeSuccess) {
01581 ASSERT_PRED4(PredFunction4Int,
01582 ++n1_,
01583 ++n2_,
01584 ++n3_,
01585 ++n4_);
01586 finished_ = true;
01587 }
01588
01589
01590
01591 TEST_F(ASSERT_PRED4Test, FunctionOnUserTypeSuccess) {
01592 ASSERT_PRED4(PredFunction4Bool,
01593 Bool(++n1_),
01594 Bool(++n2_),
01595 Bool(++n3_),
01596 Bool(++n4_));
01597 finished_ = true;
01598 }
01599
01600
01601
01602 TEST_F(ASSERT_PRED4Test, FunctorOnBuiltInTypeSuccess) {
01603 ASSERT_PRED4(PredFunctor4(),
01604 ++n1_,
01605 ++n2_,
01606 ++n3_,
01607 ++n4_);
01608 finished_ = true;
01609 }
01610
01611
01612
01613 TEST_F(ASSERT_PRED4Test, FunctorOnUserTypeSuccess) {
01614 ASSERT_PRED4(PredFunctor4(),
01615 Bool(++n1_),
01616 Bool(++n2_),
01617 Bool(++n3_),
01618 Bool(++n4_));
01619 finished_ = true;
01620 }
01621
01622
01623
01624 TEST_F(ASSERT_PRED4Test, FunctionOnBuiltInTypeFailure) {
01625 expected_to_finish_ = false;
01626 EXPECT_FATAL_FAILURE({
01627 ASSERT_PRED4(PredFunction4Int,
01628 n1_++,
01629 n2_++,
01630 n3_++,
01631 n4_++);
01632 finished_ = true;
01633 }, "");
01634 }
01635
01636
01637
01638 TEST_F(ASSERT_PRED4Test, FunctionOnUserTypeFailure) {
01639 expected_to_finish_ = false;
01640 EXPECT_FATAL_FAILURE({
01641 ASSERT_PRED4(PredFunction4Bool,
01642 Bool(n1_++),
01643 Bool(n2_++),
01644 Bool(n3_++),
01645 Bool(n4_++));
01646 finished_ = true;
01647 }, "");
01648 }
01649
01650
01651
01652 TEST_F(ASSERT_PRED4Test, FunctorOnBuiltInTypeFailure) {
01653 expected_to_finish_ = false;
01654 EXPECT_FATAL_FAILURE({
01655 ASSERT_PRED4(PredFunctor4(),
01656 n1_++,
01657 n2_++,
01658 n3_++,
01659 n4_++);
01660 finished_ = true;
01661 }, "");
01662 }
01663
01664
01665
01666 TEST_F(ASSERT_PRED4Test, FunctorOnUserTypeFailure) {
01667 expected_to_finish_ = false;
01668 EXPECT_FATAL_FAILURE({
01669 ASSERT_PRED4(PredFunctor4(),
01670 Bool(n1_++),
01671 Bool(n2_++),
01672 Bool(n3_++),
01673 Bool(n4_++));
01674 finished_ = true;
01675 }, "");
01676 }
01677
01678
01679
01680 TEST_F(EXPECT_PRED_FORMAT4Test, FunctionOnBuiltInTypeSuccess) {
01681 EXPECT_PRED_FORMAT4(PredFormatFunction4,
01682 ++n1_,
01683 ++n2_,
01684 ++n3_,
01685 ++n4_);
01686 finished_ = true;
01687 }
01688
01689
01690
01691 TEST_F(EXPECT_PRED_FORMAT4Test, FunctionOnUserTypeSuccess) {
01692 EXPECT_PRED_FORMAT4(PredFormatFunction4,
01693 Bool(++n1_),
01694 Bool(++n2_),
01695 Bool(++n3_),
01696 Bool(++n4_));
01697 finished_ = true;
01698 }
01699
01700
01701
01702 TEST_F(EXPECT_PRED_FORMAT4Test, FunctorOnBuiltInTypeSuccess) {
01703 EXPECT_PRED_FORMAT4(PredFormatFunctor4(),
01704 ++n1_,
01705 ++n2_,
01706 ++n3_,
01707 ++n4_);
01708 finished_ = true;
01709 }
01710
01711
01712
01713 TEST_F(EXPECT_PRED_FORMAT4Test, FunctorOnUserTypeSuccess) {
01714 EXPECT_PRED_FORMAT4(PredFormatFunctor4(),
01715 Bool(++n1_),
01716 Bool(++n2_),
01717 Bool(++n3_),
01718 Bool(++n4_));
01719 finished_ = true;
01720 }
01721
01722
01723
01724 TEST_F(EXPECT_PRED_FORMAT4Test, FunctionOnBuiltInTypeFailure) {
01725 EXPECT_NONFATAL_FAILURE({
01726 EXPECT_PRED_FORMAT4(PredFormatFunction4,
01727 n1_++,
01728 n2_++,
01729 n3_++,
01730 n4_++);
01731 finished_ = true;
01732 }, "");
01733 }
01734
01735
01736
01737 TEST_F(EXPECT_PRED_FORMAT4Test, FunctionOnUserTypeFailure) {
01738 EXPECT_NONFATAL_FAILURE({
01739 EXPECT_PRED_FORMAT4(PredFormatFunction4,
01740 Bool(n1_++),
01741 Bool(n2_++),
01742 Bool(n3_++),
01743 Bool(n4_++));
01744 finished_ = true;
01745 }, "");
01746 }
01747
01748
01749
01750 TEST_F(EXPECT_PRED_FORMAT4Test, FunctorOnBuiltInTypeFailure) {
01751 EXPECT_NONFATAL_FAILURE({
01752 EXPECT_PRED_FORMAT4(PredFormatFunctor4(),
01753 n1_++,
01754 n2_++,
01755 n3_++,
01756 n4_++);
01757 finished_ = true;
01758 }, "");
01759 }
01760
01761
01762
01763 TEST_F(EXPECT_PRED_FORMAT4Test, FunctorOnUserTypeFailure) {
01764 EXPECT_NONFATAL_FAILURE({
01765 EXPECT_PRED_FORMAT4(PredFormatFunctor4(),
01766 Bool(n1_++),
01767 Bool(n2_++),
01768 Bool(n3_++),
01769 Bool(n4_++));
01770 finished_ = true;
01771 }, "");
01772 }
01773
01774
01775
01776 TEST_F(ASSERT_PRED_FORMAT4Test, FunctionOnBuiltInTypeSuccess) {
01777 ASSERT_PRED_FORMAT4(PredFormatFunction4,
01778 ++n1_,
01779 ++n2_,
01780 ++n3_,
01781 ++n4_);
01782 finished_ = true;
01783 }
01784
01785
01786
01787 TEST_F(ASSERT_PRED_FORMAT4Test, FunctionOnUserTypeSuccess) {
01788 ASSERT_PRED_FORMAT4(PredFormatFunction4,
01789 Bool(++n1_),
01790 Bool(++n2_),
01791 Bool(++n3_),
01792 Bool(++n4_));
01793 finished_ = true;
01794 }
01795
01796
01797
01798 TEST_F(ASSERT_PRED_FORMAT4Test, FunctorOnBuiltInTypeSuccess) {
01799 ASSERT_PRED_FORMAT4(PredFormatFunctor4(),
01800 ++n1_,
01801 ++n2_,
01802 ++n3_,
01803 ++n4_);
01804 finished_ = true;
01805 }
01806
01807
01808
01809 TEST_F(ASSERT_PRED_FORMAT4Test, FunctorOnUserTypeSuccess) {
01810 ASSERT_PRED_FORMAT4(PredFormatFunctor4(),
01811 Bool(++n1_),
01812 Bool(++n2_),
01813 Bool(++n3_),
01814 Bool(++n4_));
01815 finished_ = true;
01816 }
01817
01818
01819
01820 TEST_F(ASSERT_PRED_FORMAT4Test, FunctionOnBuiltInTypeFailure) {
01821 expected_to_finish_ = false;
01822 EXPECT_FATAL_FAILURE({
01823 ASSERT_PRED_FORMAT4(PredFormatFunction4,
01824 n1_++,
01825 n2_++,
01826 n3_++,
01827 n4_++);
01828 finished_ = true;
01829 }, "");
01830 }
01831
01832
01833
01834 TEST_F(ASSERT_PRED_FORMAT4Test, FunctionOnUserTypeFailure) {
01835 expected_to_finish_ = false;
01836 EXPECT_FATAL_FAILURE({
01837 ASSERT_PRED_FORMAT4(PredFormatFunction4,
01838 Bool(n1_++),
01839 Bool(n2_++),
01840 Bool(n3_++),
01841 Bool(n4_++));
01842 finished_ = true;
01843 }, "");
01844 }
01845
01846
01847
01848 TEST_F(ASSERT_PRED_FORMAT4Test, FunctorOnBuiltInTypeFailure) {
01849 expected_to_finish_ = false;
01850 EXPECT_FATAL_FAILURE({
01851 ASSERT_PRED_FORMAT4(PredFormatFunctor4(),
01852 n1_++,
01853 n2_++,
01854 n3_++,
01855 n4_++);
01856 finished_ = true;
01857 }, "");
01858 }
01859
01860
01861
01862 TEST_F(ASSERT_PRED_FORMAT4Test, FunctorOnUserTypeFailure) {
01863 expected_to_finish_ = false;
01864 EXPECT_FATAL_FAILURE({
01865 ASSERT_PRED_FORMAT4(PredFormatFunctor4(),
01866 Bool(n1_++),
01867 Bool(n2_++),
01868 Bool(n3_++),
01869 Bool(n4_++));
01870 finished_ = true;
01871 }, "");
01872 }
01873
01874
01875
01876 template <typename T1, typename T2, typename T3, typename T4, typename T5>
01877 bool PredFunction5(T1 v1, T2 v2, T3 v3, T4 v4, T5 v5) {
01878 return v1 + v2 + v3 + v4 + v5 > 0;
01879 }
01880
01881
01882
01883
01884 bool PredFunction5Int(int v1, int v2, int v3, int v4, int v5) {
01885 return v1 + v2 + v3 + v4 + v5 > 0;
01886 }
01887 bool PredFunction5Bool(Bool v1, Bool v2, Bool v3, Bool v4, Bool v5) {
01888 return v1 + v2 + v3 + v4 + v5 > 0;
01889 }
01890
01891
01892 struct PredFunctor5 {
01893 template <typename T1, typename T2, typename T3, typename T4, typename T5>
01894 bool operator()(const T1& v1,
01895 const T2& v2,
01896 const T3& v3,
01897 const T4& v4,
01898 const T5& v5) {
01899 return v1 + v2 + v3 + v4 + v5 > 0;
01900 }
01901 };
01902
01903
01904 template <typename T1, typename T2, typename T3, typename T4, typename T5>
01905 testing::AssertionResult PredFormatFunction5(const char* e1,
01906 const char* e2,
01907 const char* e3,
01908 const char* e4,
01909 const char* e5,
01910 const T1& v1,
01911 const T2& v2,
01912 const T3& v3,
01913 const T4& v4,
01914 const T5& v5) {
01915 if (PredFunction5(v1, v2, v3, v4, v5))
01916 return testing::AssertionSuccess();
01917
01918 return testing::AssertionFailure()
01919 << e1 << " + " << e2 << " + " << e3 << " + " << e4 << " + " << e5
01920 << " is expected to be positive, but evaluates to "
01921 << v1 + v2 + v3 + v4 + v5 << ".";
01922 }
01923
01924
01925 struct PredFormatFunctor5 {
01926 template <typename T1, typename T2, typename T3, typename T4, typename T5>
01927 testing::AssertionResult operator()(const char* e1,
01928 const char* e2,
01929 const char* e3,
01930 const char* e4,
01931 const char* e5,
01932 const T1& v1,
01933 const T2& v2,
01934 const T3& v3,
01935 const T4& v4,
01936 const T5& v5) const {
01937 return PredFormatFunction5(e1, e2, e3, e4, e5, v1, v2, v3, v4, v5);
01938 }
01939 };
01940
01941
01942
01943 class Predicate5Test : public testing::Test {
01944 protected:
01945 virtual void SetUp() {
01946 expected_to_finish_ = true;
01947 finished_ = false;
01948 n1_ = n2_ = n3_ = n4_ = n5_ = 0;
01949 }
01950
01951 virtual void TearDown() {
01952
01953
01954 EXPECT_EQ(1, n1_) <<
01955 "The predicate assertion didn't evaluate argument 2 "
01956 "exactly once.";
01957 EXPECT_EQ(1, n2_) <<
01958 "The predicate assertion didn't evaluate argument 3 "
01959 "exactly once.";
01960 EXPECT_EQ(1, n3_) <<
01961 "The predicate assertion didn't evaluate argument 4 "
01962 "exactly once.";
01963 EXPECT_EQ(1, n4_) <<
01964 "The predicate assertion didn't evaluate argument 5 "
01965 "exactly once.";
01966 EXPECT_EQ(1, n5_) <<
01967 "The predicate assertion didn't evaluate argument 6 "
01968 "exactly once.";
01969
01970
01971 if (expected_to_finish_ && !finished_) {
01972 FAIL() << "The predicate assertion unexpactedly aborted the test.";
01973 } else if (!expected_to_finish_ && finished_) {
01974 FAIL() << "The failed predicate assertion didn't abort the test "
01975 "as expected.";
01976 }
01977 }
01978
01979
01980 static bool expected_to_finish_;
01981
01982
01983 static bool finished_;
01984
01985 static int n1_;
01986 static int n2_;
01987 static int n3_;
01988 static int n4_;
01989 static int n5_;
01990 };
01991
01992 bool Predicate5Test::expected_to_finish_;
01993 bool Predicate5Test::finished_;
01994 int Predicate5Test::n1_;
01995 int Predicate5Test::n2_;
01996 int Predicate5Test::n3_;
01997 int Predicate5Test::n4_;
01998 int Predicate5Test::n5_;
01999
02000 typedef Predicate5Test EXPECT_PRED_FORMAT5Test;
02001 typedef Predicate5Test ASSERT_PRED_FORMAT5Test;
02002 typedef Predicate5Test EXPECT_PRED5Test;
02003 typedef Predicate5Test ASSERT_PRED5Test;
02004
02005
02006
02007 TEST_F(EXPECT_PRED5Test, FunctionOnBuiltInTypeSuccess) {
02008 EXPECT_PRED5(PredFunction5Int,
02009 ++n1_,
02010 ++n2_,
02011 ++n3_,
02012 ++n4_,
02013 ++n5_);
02014 finished_ = true;
02015 }
02016
02017
02018
02019 TEST_F(EXPECT_PRED5Test, FunctionOnUserTypeSuccess) {
02020 EXPECT_PRED5(PredFunction5Bool,
02021 Bool(++n1_),
02022 Bool(++n2_),
02023 Bool(++n3_),
02024 Bool(++n4_),
02025 Bool(++n5_));
02026 finished_ = true;
02027 }
02028
02029
02030
02031 TEST_F(EXPECT_PRED5Test, FunctorOnBuiltInTypeSuccess) {
02032 EXPECT_PRED5(PredFunctor5(),
02033 ++n1_,
02034 ++n2_,
02035 ++n3_,
02036 ++n4_,
02037 ++n5_);
02038 finished_ = true;
02039 }
02040
02041
02042
02043 TEST_F(EXPECT_PRED5Test, FunctorOnUserTypeSuccess) {
02044 EXPECT_PRED5(PredFunctor5(),
02045 Bool(++n1_),
02046 Bool(++n2_),
02047 Bool(++n3_),
02048 Bool(++n4_),
02049 Bool(++n5_));
02050 finished_ = true;
02051 }
02052
02053
02054
02055 TEST_F(EXPECT_PRED5Test, FunctionOnBuiltInTypeFailure) {
02056 EXPECT_NONFATAL_FAILURE({
02057 EXPECT_PRED5(PredFunction5Int,
02058 n1_++,
02059 n2_++,
02060 n3_++,
02061 n4_++,
02062 n5_++);
02063 finished_ = true;
02064 }, "");
02065 }
02066
02067
02068
02069 TEST_F(EXPECT_PRED5Test, FunctionOnUserTypeFailure) {
02070 EXPECT_NONFATAL_FAILURE({
02071 EXPECT_PRED5(PredFunction5Bool,
02072 Bool(n1_++),
02073 Bool(n2_++),
02074 Bool(n3_++),
02075 Bool(n4_++),
02076 Bool(n5_++));
02077 finished_ = true;
02078 }, "");
02079 }
02080
02081
02082
02083 TEST_F(EXPECT_PRED5Test, FunctorOnBuiltInTypeFailure) {
02084 EXPECT_NONFATAL_FAILURE({
02085 EXPECT_PRED5(PredFunctor5(),
02086 n1_++,
02087 n2_++,
02088 n3_++,
02089 n4_++,
02090 n5_++);
02091 finished_ = true;
02092 }, "");
02093 }
02094
02095
02096
02097 TEST_F(EXPECT_PRED5Test, FunctorOnUserTypeFailure) {
02098 EXPECT_NONFATAL_FAILURE({
02099 EXPECT_PRED5(PredFunctor5(),
02100 Bool(n1_++),
02101 Bool(n2_++),
02102 Bool(n3_++),
02103 Bool(n4_++),
02104 Bool(n5_++));
02105 finished_ = true;
02106 }, "");
02107 }
02108
02109
02110
02111 TEST_F(ASSERT_PRED5Test, FunctionOnBuiltInTypeSuccess) {
02112 ASSERT_PRED5(PredFunction5Int,
02113 ++n1_,
02114 ++n2_,
02115 ++n3_,
02116 ++n4_,
02117 ++n5_);
02118 finished_ = true;
02119 }
02120
02121
02122
02123 TEST_F(ASSERT_PRED5Test, FunctionOnUserTypeSuccess) {
02124 ASSERT_PRED5(PredFunction5Bool,
02125 Bool(++n1_),
02126 Bool(++n2_),
02127 Bool(++n3_),
02128 Bool(++n4_),
02129 Bool(++n5_));
02130 finished_ = true;
02131 }
02132
02133
02134
02135 TEST_F(ASSERT_PRED5Test, FunctorOnBuiltInTypeSuccess) {
02136 ASSERT_PRED5(PredFunctor5(),
02137 ++n1_,
02138 ++n2_,
02139 ++n3_,
02140 ++n4_,
02141 ++n5_);
02142 finished_ = true;
02143 }
02144
02145
02146
02147 TEST_F(ASSERT_PRED5Test, FunctorOnUserTypeSuccess) {
02148 ASSERT_PRED5(PredFunctor5(),
02149 Bool(++n1_),
02150 Bool(++n2_),
02151 Bool(++n3_),
02152 Bool(++n4_),
02153 Bool(++n5_));
02154 finished_ = true;
02155 }
02156
02157
02158
02159 TEST_F(ASSERT_PRED5Test, FunctionOnBuiltInTypeFailure) {
02160 expected_to_finish_ = false;
02161 EXPECT_FATAL_FAILURE({
02162 ASSERT_PRED5(PredFunction5Int,
02163 n1_++,
02164 n2_++,
02165 n3_++,
02166 n4_++,
02167 n5_++);
02168 finished_ = true;
02169 }, "");
02170 }
02171
02172
02173
02174 TEST_F(ASSERT_PRED5Test, FunctionOnUserTypeFailure) {
02175 expected_to_finish_ = false;
02176 EXPECT_FATAL_FAILURE({
02177 ASSERT_PRED5(PredFunction5Bool,
02178 Bool(n1_++),
02179 Bool(n2_++),
02180 Bool(n3_++),
02181 Bool(n4_++),
02182 Bool(n5_++));
02183 finished_ = true;
02184 }, "");
02185 }
02186
02187
02188
02189 TEST_F(ASSERT_PRED5Test, FunctorOnBuiltInTypeFailure) {
02190 expected_to_finish_ = false;
02191 EXPECT_FATAL_FAILURE({
02192 ASSERT_PRED5(PredFunctor5(),
02193 n1_++,
02194 n2_++,
02195 n3_++,
02196 n4_++,
02197 n5_++);
02198 finished_ = true;
02199 }, "");
02200 }
02201
02202
02203
02204 TEST_F(ASSERT_PRED5Test, FunctorOnUserTypeFailure) {
02205 expected_to_finish_ = false;
02206 EXPECT_FATAL_FAILURE({
02207 ASSERT_PRED5(PredFunctor5(),
02208 Bool(n1_++),
02209 Bool(n2_++),
02210 Bool(n3_++),
02211 Bool(n4_++),
02212 Bool(n5_++));
02213 finished_ = true;
02214 }, "");
02215 }
02216
02217
02218
02219 TEST_F(EXPECT_PRED_FORMAT5Test, FunctionOnBuiltInTypeSuccess) {
02220 EXPECT_PRED_FORMAT5(PredFormatFunction5,
02221 ++n1_,
02222 ++n2_,
02223 ++n3_,
02224 ++n4_,
02225 ++n5_);
02226 finished_ = true;
02227 }
02228
02229
02230
02231 TEST_F(EXPECT_PRED_FORMAT5Test, FunctionOnUserTypeSuccess) {
02232 EXPECT_PRED_FORMAT5(PredFormatFunction5,
02233 Bool(++n1_),
02234 Bool(++n2_),
02235 Bool(++n3_),
02236 Bool(++n4_),
02237 Bool(++n5_));
02238 finished_ = true;
02239 }
02240
02241
02242
02243 TEST_F(EXPECT_PRED_FORMAT5Test, FunctorOnBuiltInTypeSuccess) {
02244 EXPECT_PRED_FORMAT5(PredFormatFunctor5(),
02245 ++n1_,
02246 ++n2_,
02247 ++n3_,
02248 ++n4_,
02249 ++n5_);
02250 finished_ = true;
02251 }
02252
02253
02254
02255 TEST_F(EXPECT_PRED_FORMAT5Test, FunctorOnUserTypeSuccess) {
02256 EXPECT_PRED_FORMAT5(PredFormatFunctor5(),
02257 Bool(++n1_),
02258 Bool(++n2_),
02259 Bool(++n3_),
02260 Bool(++n4_),
02261 Bool(++n5_));
02262 finished_ = true;
02263 }
02264
02265
02266
02267 TEST_F(EXPECT_PRED_FORMAT5Test, FunctionOnBuiltInTypeFailure) {
02268 EXPECT_NONFATAL_FAILURE({
02269 EXPECT_PRED_FORMAT5(PredFormatFunction5,
02270 n1_++,
02271 n2_++,
02272 n3_++,
02273 n4_++,
02274 n5_++);
02275 finished_ = true;
02276 }, "");
02277 }
02278
02279
02280
02281 TEST_F(EXPECT_PRED_FORMAT5Test, FunctionOnUserTypeFailure) {
02282 EXPECT_NONFATAL_FAILURE({
02283 EXPECT_PRED_FORMAT5(PredFormatFunction5,
02284 Bool(n1_++),
02285 Bool(n2_++),
02286 Bool(n3_++),
02287 Bool(n4_++),
02288 Bool(n5_++));
02289 finished_ = true;
02290 }, "");
02291 }
02292
02293
02294
02295 TEST_F(EXPECT_PRED_FORMAT5Test, FunctorOnBuiltInTypeFailure) {
02296 EXPECT_NONFATAL_FAILURE({
02297 EXPECT_PRED_FORMAT5(PredFormatFunctor5(),
02298 n1_++,
02299 n2_++,
02300 n3_++,
02301 n4_++,
02302 n5_++);
02303 finished_ = true;
02304 }, "");
02305 }
02306
02307
02308
02309 TEST_F(EXPECT_PRED_FORMAT5Test, FunctorOnUserTypeFailure) {
02310 EXPECT_NONFATAL_FAILURE({
02311 EXPECT_PRED_FORMAT5(PredFormatFunctor5(),
02312 Bool(n1_++),
02313 Bool(n2_++),
02314 Bool(n3_++),
02315 Bool(n4_++),
02316 Bool(n5_++));
02317 finished_ = true;
02318 }, "");
02319 }
02320
02321
02322
02323 TEST_F(ASSERT_PRED_FORMAT5Test, FunctionOnBuiltInTypeSuccess) {
02324 ASSERT_PRED_FORMAT5(PredFormatFunction5,
02325 ++n1_,
02326 ++n2_,
02327 ++n3_,
02328 ++n4_,
02329 ++n5_);
02330 finished_ = true;
02331 }
02332
02333
02334
02335 TEST_F(ASSERT_PRED_FORMAT5Test, FunctionOnUserTypeSuccess) {
02336 ASSERT_PRED_FORMAT5(PredFormatFunction5,
02337 Bool(++n1_),
02338 Bool(++n2_),
02339 Bool(++n3_),
02340 Bool(++n4_),
02341 Bool(++n5_));
02342 finished_ = true;
02343 }
02344
02345
02346
02347 TEST_F(ASSERT_PRED_FORMAT5Test, FunctorOnBuiltInTypeSuccess) {
02348 ASSERT_PRED_FORMAT5(PredFormatFunctor5(),
02349 ++n1_,
02350 ++n2_,
02351 ++n3_,
02352 ++n4_,
02353 ++n5_);
02354 finished_ = true;
02355 }
02356
02357
02358
02359 TEST_F(ASSERT_PRED_FORMAT5Test, FunctorOnUserTypeSuccess) {
02360 ASSERT_PRED_FORMAT5(PredFormatFunctor5(),
02361 Bool(++n1_),
02362 Bool(++n2_),
02363 Bool(++n3_),
02364 Bool(++n4_),
02365 Bool(++n5_));
02366 finished_ = true;
02367 }
02368
02369
02370
02371 TEST_F(ASSERT_PRED_FORMAT5Test, FunctionOnBuiltInTypeFailure) {
02372 expected_to_finish_ = false;
02373 EXPECT_FATAL_FAILURE({
02374 ASSERT_PRED_FORMAT5(PredFormatFunction5,
02375 n1_++,
02376 n2_++,
02377 n3_++,
02378 n4_++,
02379 n5_++);
02380 finished_ = true;
02381 }, "");
02382 }
02383
02384
02385
02386 TEST_F(ASSERT_PRED_FORMAT5Test, FunctionOnUserTypeFailure) {
02387 expected_to_finish_ = false;
02388 EXPECT_FATAL_FAILURE({
02389 ASSERT_PRED_FORMAT5(PredFormatFunction5,
02390 Bool(n1_++),
02391 Bool(n2_++),
02392 Bool(n3_++),
02393 Bool(n4_++),
02394 Bool(n5_++));
02395 finished_ = true;
02396 }, "");
02397 }
02398
02399
02400
02401 TEST_F(ASSERT_PRED_FORMAT5Test, FunctorOnBuiltInTypeFailure) {
02402 expected_to_finish_ = false;
02403 EXPECT_FATAL_FAILURE({
02404 ASSERT_PRED_FORMAT5(PredFormatFunctor5(),
02405 n1_++,
02406 n2_++,
02407 n3_++,
02408 n4_++,
02409 n5_++);
02410 finished_ = true;
02411 }, "");
02412 }
02413
02414
02415
02416 TEST_F(ASSERT_PRED_FORMAT5Test, FunctorOnUserTypeFailure) {
02417 expected_to_finish_ = false;
02418 EXPECT_FATAL_FAILURE({
02419 ASSERT_PRED_FORMAT5(PredFormatFunctor5(),
02420 Bool(n1_++),
02421 Bool(n2_++),
02422 Bool(n3_++),
02423 Bool(n4_++),
02424 Bool(n5_++));
02425 finished_ = true;
02426 }, "");
02427 }