Lines Matching refs:failure
70 // This function calls a test subroutine, catches the fatal failure it
73 // Calls a subrountine that yields a fatal failure.
76 // Catches the fatal failure and aborts the test.
116 // Tests catching a fatal failure in a subroutine.
118 printf("(expecting a failure that x should be 1)\n");
123 // Tests catching a fatal failure in a nested subroutine.
125 printf("(expecting a failure that x should be 1)\n");
127 // Calls a subrountine that yields a fatal failure.
130 // Catches the fatal failure and aborts the test.
142 printf("(expecting a failure on false)\n");
143 EXPECT_TRUE(false); // Generates a nonfatal failure
180 ADD_FAILURE() << "This failure is expected, and shouldn't have a trace.";
184 // After SCOPED_TRACE(), a failure in the current scope should contain
186 ADD_FAILURE() << "This failure is expected, and should have a trace.";
191 ADD_FAILURE() << "This failure is expected, and shouldn't have a trace.";
228 << "This failure is expected, and should contain trace point A.";
232 << "This failure is expected, and should contain trace point A and B.";
236 ADD_FAILURE() << "This failure is expected, and should "
241 ADD_FAILURE() << "This failure is expected, and should "
257 // | generates failure #1
261 // generates failure #2 |
264 // waits for n3 | generates failure #3
266 // | generates failure #4
269 // generates failure #5 | finishes
271 // generates failure #6 |
285 << "Expected failure #1 (in thread B, only trace B alive).";
290 << "Expected failure #3 (in thread B, trace A & B both alive).";
293 << "Expected failure #4 (in thread B, only trace A alive).";
309 << "Expected failure #2 (in thread A, trace A & B both alive).";
314 << "Expected failure #5 (in thread A, only trace A alive).";
317 << "Expected failure #6 (in thread A, no trace alive).";
350 ADD_FAILURE() << "Expected failure #1, in the test fixture c'tor.";
354 ADD_FAILURE() << "Expected failure #5, in the test fixture d'tor.";
358 ADD_FAILURE() << "Expected failure #2, in SetUp().";
362 ADD_FAILURE() << "Expected failure #4, in TearDown.";
367 ADD_FAILURE() << "Expected failure #3, in the test body.";
379 ADD_FAILURE() << "Expected failure #2, in the test fixture d'tor.";
383 ADD_FAILURE() << "UNEXPECTED failure in SetUp(). "
385 << "had a fatal failure.";
389 ADD_FAILURE() << "UNEXPECTED failure in TearDown(). "
391 << "had a fatal failure.";
396 FAIL() << "Expected failure #1, in the test fixture c'tor.";
401 ADD_FAILURE() << "UNEXPECTED failure in the test body. "
403 << "had a fatal failure.";
415 ADD_FAILURE() << "Expected failure #1, in SetUp().";
419 FAIL() << "Expected failure #3, in TearDown().";
423 FAIL() << "Expected failure #4, in the test fixture d'tor.";
428 FAIL() << "Expected failure #2, in the test function.";
440 FAIL() << "Expected failure #1, in SetUp().";
444 FAIL() << "Expected failure #2, in TearDown().";
448 FAIL() << "Expected failure #3, in the test fixture d'tor.";
453 FAIL() << "UNEXPECTED failure in the test function. "
458 ADD_FAILURE_AT("foo.cc", 42) << "Expected failure in foo.cc";
595 EXPECT_EQ(1, global_integer) << "Expected non-fatal failure.";
596 }, "Expected non-fatal failure.");
606 EXPECT_EQ(m, n) << "Expected non-fatal failure.";
607 }, "Expected non-fatal failure.");
611 // one non-fatal failure and no fatal failure.
614 ADD_FAILURE() << "Expected non-fatal failure.";
615 }, "Expected non-fatal failure.");
619 // non-fatal failure.
621 printf("(expecting a failure)\n");
629 printf("(expecting a failure)\n");
631 ADD_FAILURE() << "Expected non-fatal failure 1.";
632 ADD_FAILURE() << "Expected non-fatal failure 2.";
637 // failure.
639 printf("(expecting a failure)\n");
641 FAIL() << "Expected fatal failure.";
648 printf("(expecting a failure)\n");
659 printf("(expecting a failure)\n");
674 ASSERT_EQ(1, global_integer) << "Expected fatal failure.";
675 }, "Expected fatal failure.");
684 ASSERT_EQ(0, n) << "Expected fatal failure.";
685 }, "Expected fatal failure.");
689 // one fatal failure and no non-fatal failure.
692 FAIL() << "Expected fatal failure.";
693 }, "Expected fatal failure.");
697 // failure.
699 printf("(expecting a failure)\n");
704 // A helper for generating a fatal failure.
706 FAIL() << "Expected fatal failure.";
712 printf("(expecting a failure)\n");
720 // failure.
722 printf("(expecting a failure)\n");
724 ADD_FAILURE() << "Expected non-fatal failure.";
731 printf("(expecting a failure)\n");
742 printf("(expecting a failure)\n");
766 TYPED_TEST(TypedTest, Failure) {
767 EXPECT_EQ(1, TypeParam()) << "Expected failure";
785 TYPED_TEST_P(TypedTestP, Failure) {
786 EXPECT_EQ(1U, TypeParam()) << "Expected failure";
789 REGISTER_TYPED_TEST_CASE_P(TypedTestP, Success, Failure);
844 // Tests various failure conditions of
852 static void AddFailure(FailureMode failure) {
853 if (failure == FATAL_FAILURE) {
854 FAIL() << "Expected fatal failure.";
856 ADD_FAILURE() << "Expected non-fatal failure.";
862 // Expected fatal failure, but succeeds.
863 printf("(expecting 1 failure)\n");
864 EXPECT_FATAL_FAILURE(SUCCEED(), "Expected fatal failure.");
865 // Expected fatal failure, but got a non-fatal failure.
866 printf("(expecting 1 failure)\n");
868 "failure.");
870 printf("(expecting 1 failure)\n");
871 EXPECT_FATAL_FAILURE(AddFailure(FATAL_FAILURE), "Some other fatal failure "
876 // Expected non-fatal failure, but succeeds.
877 printf("(expecting 1 failure)\n");
878 EXPECT_NONFATAL_FAILURE(SUCCEED(), "Expected non-fatal failure.");
879 // Expected non-fatal failure, but got a fatal failure.
880 printf("(expecting 1 failure)\n");
881 EXPECT_NONFATAL_FAILURE(AddFailure(FATAL_FAILURE), "Expected fatal failure.");
883 printf("(expecting 1 failure)\n");
885 "failure.");
892 static void AddFailureInOtherThread(FailureMode failure) {
893 ThreadWithParam<FailureMode> thread(&AddFailure, failure, NULL);
902 "Expected fatal failure.");
909 "Expected non-fatal failure.");
933 // Expected fatal failure, but succeeds.
934 printf("(expecting 1 failure)\n");
935 EXPECT_FATAL_FAILURE_ON_ALL_THREADS(SUCCEED(), "Expected fatal failure.");
936 // Expected fatal failure, but got a non-fatal failure.
937 printf("(expecting 1 failure)\n");
939 "Expected non-fatal failure.");
941 printf("(expecting 1 failure)\n");
943 "Some other fatal failure expected.");
947 // Expected non-fatal failure, but succeeds.
948 printf("(expecting 1 failure)\n");
950 "failure.");
951 // Expected non-fatal failure, but got a fatal failure.
952 printf("(expecting 1 failure)\n");
954 "Expected fatal failure.");
956 printf("(expecting 1 failure)\n");
958 "Some other non-fatal failure.");
972 FAIL() << "Expected fatal failure.";
984 ADD_FAILURE() << "Expected non-fatal failure.";