googletest/googletest/test/googletest-output-test_.cc
Go to the documentation of this file.
1 // Copyright 2005, Google Inc.
2 // All rights reserved.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are
6 // met:
7 //
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
13 // distribution.
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.
17 //
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.
29 //
30 // The purpose of this file is to generate Google Test output under
31 // various conditions. The output will then be verified by
32 // googletest-output-test.py to ensure that Google Test generates the
33 // desired messages. Therefore, most tests in this file are MEANT TO
34 // FAIL.
35 
36 #include "gtest/gtest-spi.h"
37 #include "gtest/gtest.h"
38 #include "src/gtest-internal-inl.h"
39 
40 #include <stdlib.h>
41 
42 #if _MSC_VER
43 GTEST_DISABLE_MSC_WARNINGS_PUSH_(4127 /* conditional expression is constant */)
44 #endif // _MSC_VER
45 
46 #if GTEST_IS_THREADSAFE
49 
50 using testing::internal::Notification;
51 using testing::internal::ThreadWithParam;
52 #endif
53 
54 namespace posix = ::testing::internal::posix;
55 
56 // Tests catching fatal failures.
57 
58 // A subroutine used by the following test.
59 void TestEq1(int x) {
60  ASSERT_EQ(1, x);
61 }
62 
63 // This function calls a test subroutine, catches the fatal failure it
64 // generates, and then returns early.
66  // Calls a subrountine that yields a fatal failure.
67  TestEq1(2);
68 
69  // Catches the fatal failure and aborts the test.
70  //
71  // The testing::Test:: prefix is necessary when calling
72  // HasFatalFailure() outside of a TEST, TEST_F, or test fixture.
73  if (testing::Test::HasFatalFailure()) return;
74 
75  // If we get here, something is wrong.
76  FAIL() << "This should never be reached.";
77 }
78 
79 TEST(PassingTest, PassingTest1) {
80 }
81 
82 TEST(PassingTest, PassingTest2) {
83 }
84 
85 // Tests that parameters of failing parameterized tests are printed in the
86 // failing test summary.
87 class FailingParamTest : public testing::TestWithParam<int> {};
88 
90  EXPECT_EQ(1, GetParam());
91 }
92 
93 // This generates a test which will fail. Google Test is expected to print
94 // its parameter when it outputs the list of all failed tests.
95 INSTANTIATE_TEST_SUITE_P(PrintingFailingParams,
97  testing::Values(2));
98 
99 // Tests that an empty value for the test suite basename yields just
100 // the test name without any prior /
101 class EmptyBasenameParamInst : public testing::TestWithParam<int> {};
102 
103 TEST_P(EmptyBasenameParamInst, Passes) { EXPECT_EQ(1, GetParam()); }
104 
106 
107 static const char kGoldenString[] = "\"Line\0 1\"\nLine 2";
108 
109 TEST(NonfatalFailureTest, EscapesStringOperands) {
110  std::string actual = "actual \"string\"";
111  EXPECT_EQ(kGoldenString, actual);
112 
113  const char* golden = kGoldenString;
114  EXPECT_EQ(golden, actual);
115 }
116 
117 TEST(NonfatalFailureTest, DiffForLongStrings) {
118  std::string golden_str(kGoldenString, sizeof(kGoldenString) - 1);
119  EXPECT_EQ(golden_str, "Line 2");
120 }
121 
122 // Tests catching a fatal failure in a subroutine.
123 TEST(FatalFailureTest, FatalFailureInSubroutine) {
124  printf("(expecting a failure that x should be 1)\n");
125 
127 }
128 
129 // Tests catching a fatal failure in a nested subroutine.
130 TEST(FatalFailureTest, FatalFailureInNestedSubroutine) {
131  printf("(expecting a failure that x should be 1)\n");
132 
133  // Calls a subrountine that yields a fatal failure.
135 
136  // Catches the fatal failure and aborts the test.
137  //
138  // When calling HasFatalFailure() inside a TEST, TEST_F, or test
139  // fixture, the testing::Test:: prefix is not needed.
140  if (HasFatalFailure()) return;
141 
142  // If we get here, something is wrong.
143  FAIL() << "This should never be reached.";
144 }
145 
146 // Tests HasFatalFailure() after a failed EXPECT check.
147 TEST(FatalFailureTest, NonfatalFailureInSubroutine) {
148  printf("(expecting a failure on false)\n");
149  EXPECT_TRUE(false); // Generates a nonfatal failure
150  ASSERT_FALSE(HasFatalFailure()); // This should succeed.
151 }
152 
153 // Tests interleaving user logging and Google Test assertions.
154 TEST(LoggingTest, InterleavingLoggingAndAssertions) {
155  static const int a[4] = {
156  3, 9, 2, 6
157  };
158 
159  printf("(expecting 2 failures on (3) >= (a[i]))\n");
160  for (int i = 0; i < static_cast<int>(sizeof(a)/sizeof(*a)); i++) {
161  printf("i == %d\n", i);
162  EXPECT_GE(3, a[i]);
163  }
164 }
165 
166 // Tests the SCOPED_TRACE macro.
167 
168 // A helper function for testing SCOPED_TRACE.
169 void SubWithoutTrace(int n) {
170  EXPECT_EQ(1, n);
171  ASSERT_EQ(2, n);
172 }
173 
174 // Another helper function for testing SCOPED_TRACE.
175 void SubWithTrace(int n) {
176  SCOPED_TRACE(testing::Message() << "n = " << n);
177 
179 }
180 
181 TEST(SCOPED_TRACETest, AcceptedValues) {
182  SCOPED_TRACE("literal string");
183  SCOPED_TRACE(std::string("std::string"));
184  SCOPED_TRACE(1337); // streamable type
185  const char* null_value = nullptr;
186  SCOPED_TRACE(null_value);
187 
188  ADD_FAILURE() << "Just checking that all these values work fine.";
189 }
190 
191 // Tests that SCOPED_TRACE() obeys lexical scopes.
192 TEST(SCOPED_TRACETest, ObeysScopes) {
193  printf("(expected to fail)\n");
194 
195  // There should be no trace before SCOPED_TRACE() is invoked.
196  ADD_FAILURE() << "This failure is expected, and shouldn't have a trace.";
197 
198  {
199  SCOPED_TRACE("Expected trace");
200  // After SCOPED_TRACE(), a failure in the current scope should contain
201  // the trace.
202  ADD_FAILURE() << "This failure is expected, and should have a trace.";
203  }
204 
205  // Once the control leaves the scope of the SCOPED_TRACE(), there
206  // should be no trace again.
207  ADD_FAILURE() << "This failure is expected, and shouldn't have a trace.";
208 }
209 
210 // Tests that SCOPED_TRACE works inside a loop.
211 TEST(SCOPED_TRACETest, WorksInLoop) {
212  printf("(expected to fail)\n");
213 
214  for (int i = 1; i <= 2; i++) {
215  SCOPED_TRACE(testing::Message() << "i = " << i);
216 
218  }
219 }
220 
221 // Tests that SCOPED_TRACE works in a subroutine.
222 TEST(SCOPED_TRACETest, WorksInSubroutine) {
223  printf("(expected to fail)\n");
224 
225  SubWithTrace(1);
226  SubWithTrace(2);
227 }
228 
229 // Tests that SCOPED_TRACE can be nested.
230 TEST(SCOPED_TRACETest, CanBeNested) {
231  printf("(expected to fail)\n");
232 
233  SCOPED_TRACE(""); // A trace without a message.
234 
235  SubWithTrace(2);
236 }
237 
238 // Tests that multiple SCOPED_TRACEs can be used in the same scope.
239 TEST(SCOPED_TRACETest, CanBeRepeated) {
240  printf("(expected to fail)\n");
241 
242  SCOPED_TRACE("A");
243  ADD_FAILURE()
244  << "This failure is expected, and should contain trace point A.";
245 
246  SCOPED_TRACE("B");
247  ADD_FAILURE()
248  << "This failure is expected, and should contain trace point A and B.";
249 
250  {
251  SCOPED_TRACE("C");
252  ADD_FAILURE() << "This failure is expected, and should "
253  << "contain trace point A, B, and C.";
254  }
255 
256  SCOPED_TRACE("D");
257  ADD_FAILURE() << "This failure is expected, and should "
258  << "contain trace point A, B, and D.";
259 }
260 
261 #if GTEST_IS_THREADSAFE
262 // Tests that SCOPED_TRACE()s can be used concurrently from multiple
263 // threads. Namely, an assertion should be affected by
264 // SCOPED_TRACE()s in its own thread only.
265 
266 // Here's the sequence of actions that happen in the test:
267 //
268 // Thread A (main) | Thread B (spawned)
269 // ===============================|================================
270 // spawns thread B |
271 // -------------------------------+--------------------------------
272 // waits for n1 | SCOPED_TRACE("Trace B");
273 // | generates failure #1
274 // | notifies n1
275 // -------------------------------+--------------------------------
276 // SCOPED_TRACE("Trace A"); | waits for n2
277 // generates failure #2 |
278 // notifies n2 |
279 // -------------------------------|--------------------------------
280 // waits for n3 | generates failure #3
281 // | trace B dies
282 // | generates failure #4
283 // | notifies n3
284 // -------------------------------|--------------------------------
285 // generates failure #5 | finishes
286 // trace A dies |
287 // generates failure #6 |
288 // -------------------------------|--------------------------------
289 // waits for thread B to finish |
290 
291 struct CheckPoints {
292  Notification n1;
293  Notification n2;
294  Notification n3;
295 };
296 
297 static void ThreadWithScopedTrace(CheckPoints* check_points) {
298  {
299  SCOPED_TRACE("Trace B");
300  ADD_FAILURE()
301  << "Expected failure #1 (in thread B, only trace B alive).";
302  check_points->n1.Notify();
303  check_points->n2.WaitForNotification();
304 
305  ADD_FAILURE()
306  << "Expected failure #3 (in thread B, trace A & B both alive).";
307  } // Trace B dies here.
308  ADD_FAILURE()
309  << "Expected failure #4 (in thread B, only trace A alive).";
310  check_points->n3.Notify();
311 }
312 
313 TEST(SCOPED_TRACETest, WorksConcurrently) {
314  printf("(expecting 6 failures)\n");
315 
316  CheckPoints check_points;
317  ThreadWithParam<CheckPoints*> thread(&ThreadWithScopedTrace, &check_points,
318  nullptr);
319  check_points.n1.WaitForNotification();
320 
321  {
322  SCOPED_TRACE("Trace A");
323  ADD_FAILURE()
324  << "Expected failure #2 (in thread A, trace A & B both alive).";
325  check_points.n2.Notify();
326  check_points.n3.WaitForNotification();
327 
328  ADD_FAILURE()
329  << "Expected failure #5 (in thread A, only trace A alive).";
330  } // Trace A dies here.
331  ADD_FAILURE()
332  << "Expected failure #6 (in thread A, no trace alive).";
333  thread.Join();
334 }
335 #endif // GTEST_IS_THREADSAFE
336 
337 // Tests basic functionality of the ScopedTrace utility (most of its features
338 // are already tested in SCOPED_TRACETest).
339 TEST(ScopedTraceTest, WithExplicitFileAndLine) {
340  testing::ScopedTrace trace("explicit_file.cc", 123, "expected trace message");
341  ADD_FAILURE() << "Check that the trace is attached to a particular location.";
342 }
343 
344 TEST(DisabledTestsWarningTest,
345  DISABLED_AlsoRunDisabledTestsFlagSuppressesWarning) {
346  // This test body is intentionally empty. Its sole purpose is for
347  // verifying that the --gtest_also_run_disabled_tests flag
348  // suppresses the "YOU HAVE 12 DISABLED TESTS" warning at the end of
349  // the test output.
350 }
351 
352 // Tests using assertions outside of TEST and TEST_F.
353 //
354 // This function creates two failures intentionally.
355 void AdHocTest() {
356  printf("The non-test part of the code is expected to have 2 failures.\n\n");
357  EXPECT_TRUE(false);
358  EXPECT_EQ(2, 3);
359 }
360 
361 // Runs all TESTs, all TEST_Fs, and the ad hoc test.
362 int RunAllTests() {
363  AdHocTest();
364  return RUN_ALL_TESTS();
365 }
366 
367 // Tests non-fatal failures in the fixture constructor.
369  protected:
371  printf("(expecting 5 failures)\n");
372  ADD_FAILURE() << "Expected failure #1, in the test fixture c'tor.";
373  }
374 
376  ADD_FAILURE() << "Expected failure #5, in the test fixture d'tor.";
377  }
378 
379  void SetUp() override { ADD_FAILURE() << "Expected failure #2, in SetUp()."; }
380 
381  void TearDown() override {
382  ADD_FAILURE() << "Expected failure #4, in TearDown.";
383  }
384 };
385 
387  ADD_FAILURE() << "Expected failure #3, in the test body.";
388 }
389 
390 // Tests fatal failures in the fixture constructor.
392  protected:
394  printf("(expecting 2 failures)\n");
395  Init();
396  }
397 
399  ADD_FAILURE() << "Expected failure #2, in the test fixture d'tor.";
400  }
401 
402  void SetUp() override {
403  ADD_FAILURE() << "UNEXPECTED failure in SetUp(). "
404  << "We should never get here, as the test fixture c'tor "
405  << "had a fatal failure.";
406  }
407 
408  void TearDown() override {
409  ADD_FAILURE() << "UNEXPECTED failure in TearDown(). "
410  << "We should never get here, as the test fixture c'tor "
411  << "had a fatal failure.";
412  }
413 
414  private:
415  void Init() {
416  FAIL() << "Expected failure #1, in the test fixture c'tor.";
417  }
418 };
419 
421  ADD_FAILURE() << "UNEXPECTED failure in the test body. "
422  << "We should never get here, as the test fixture c'tor "
423  << "had a fatal failure.";
424 }
425 
426 // Tests non-fatal failures in SetUp().
428  protected:
430 
431  void SetUp() override {
432  printf("(expecting 4 failures)\n");
433  ADD_FAILURE() << "Expected failure #1, in SetUp().";
434  }
435 
436  void TearDown() override { FAIL() << "Expected failure #3, in TearDown()."; }
437 
438  private:
439  void Deinit() {
440  FAIL() << "Expected failure #4, in the test fixture d'tor.";
441  }
442 };
443 
445  FAIL() << "Expected failure #2, in the test function.";
446 }
447 
448 // Tests fatal failures in SetUp().
449 class FatalFailureInSetUpTest : public testing::Test {
450  protected:
452 
453  void SetUp() override {
454  printf("(expecting 3 failures)\n");
455  FAIL() << "Expected failure #1, in SetUp().";
456  }
457 
458  void TearDown() override { FAIL() << "Expected failure #2, in TearDown()."; }
459 
460  private:
461  void Deinit() {
462  FAIL() << "Expected failure #3, in the test fixture d'tor.";
463  }
464 };
465 
466 TEST_F(FatalFailureInSetUpTest, FailureInSetUp) {
467  FAIL() << "UNEXPECTED failure in the test function. "
468  << "We should never get here, as SetUp() failed.";
469 }
470 
471 TEST(AddFailureAtTest, MessageContainsSpecifiedFileAndLineNumber) {
472  ADD_FAILURE_AT("foo.cc", 42) << "Expected nonfatal failure in foo.cc";
473 }
474 
475 TEST(GtestFailAtTest, MessageContainsSpecifiedFileAndLineNumber) {
476  GTEST_FAIL_AT("foo.cc", 42) << "Expected fatal failure in foo.cc";
477 }
478 
479 // The MixedUpTestSuiteTest test case verifies that Google Test will fail a
480 // test if it uses a different fixture class than what other tests in
481 // the same test case use. It deliberately contains two fixture
482 // classes with the same name but defined in different namespaces.
483 
484 // The MixedUpTestSuiteWithSameTestNameTest test case verifies that
485 // when the user defines two tests with the same test case name AND
486 // same test name (but in different namespaces), the second test will
487 // fail.
488 
489 namespace foo {
490 
491 class MixedUpTestSuiteTest : public testing::Test {
492 };
493 
494 TEST_F(MixedUpTestSuiteTest, FirstTestFromNamespaceFoo) {}
495 TEST_F(MixedUpTestSuiteTest, SecondTestFromNamespaceFoo) {}
496 
497 class MixedUpTestSuiteWithSameTestNameTest : public testing::Test {
498 };
499 
500 TEST_F(MixedUpTestSuiteWithSameTestNameTest,
501  TheSecondTestWithThisNameShouldFail) {}
502 
503 } // namespace foo
504 
505 namespace bar {
506 
507 class MixedUpTestSuiteTest : public testing::Test {
508 };
509 
510 // The following two tests are expected to fail. We rely on the
511 // golden file to check that Google Test generates the right error message.
512 TEST_F(MixedUpTestSuiteTest, ThisShouldFail) {}
513 TEST_F(MixedUpTestSuiteTest, ThisShouldFailToo) {}
514 
515 class MixedUpTestSuiteWithSameTestNameTest : public testing::Test {
516 };
517 
518 // Expected to fail. We rely on the golden file to check that Google Test
519 // generates the right error message.
520 TEST_F(MixedUpTestSuiteWithSameTestNameTest,
521  TheSecondTestWithThisNameShouldFail) {}
522 
523 } // namespace bar
524 
525 // The following two test cases verify that Google Test catches the user
526 // error of mixing TEST and TEST_F in the same test case. The first
527 // test case checks the scenario where TEST_F appears before TEST, and
528 // the second one checks where TEST appears before TEST_F.
529 
531 };
532 
534 
535 // Expected to fail. We rely on the golden file to check that Google Test
536 // generates the right error message.
537 TEST(TEST_F_before_TEST_in_same_test_case, DefinedUsingTESTAndShouldFail) {}
538 
540 };
541 
543 
544 // Expected to fail. We rely on the golden file to check that Google Test
545 // generates the right error message.
546 TEST_F(TEST_before_TEST_F_in_same_test_case, DefinedUsingTEST_FAndShouldFail) {
547 }
548 
549 // Used for testing EXPECT_NONFATAL_FAILURE() and EXPECT_FATAL_FAILURE().
551 
552 // Tests that EXPECT_NONFATAL_FAILURE() can reference global variables.
553 TEST(ExpectNonfatalFailureTest, CanReferenceGlobalVariables) {
554  global_integer = 0;
556  EXPECT_EQ(1, global_integer) << "Expected non-fatal failure.";
557  }, "Expected non-fatal failure.");
558 }
559 
560 // Tests that EXPECT_NONFATAL_FAILURE() can reference local variables
561 // (static or not).
562 TEST(ExpectNonfatalFailureTest, CanReferenceLocalVariables) {
563  int m = 0;
564  static int n;
565  n = 1;
567  EXPECT_EQ(m, n) << "Expected non-fatal failure.";
568  }, "Expected non-fatal failure.");
569 }
570 
571 // Tests that EXPECT_NONFATAL_FAILURE() succeeds when there is exactly
572 // one non-fatal failure and no fatal failure.
573 TEST(ExpectNonfatalFailureTest, SucceedsWhenThereIsOneNonfatalFailure) {
575  ADD_FAILURE() << "Expected non-fatal failure.";
576  }, "Expected non-fatal failure.");
577 }
578 
579 // Tests that EXPECT_NONFATAL_FAILURE() fails when there is no
580 // non-fatal failure.
581 TEST(ExpectNonfatalFailureTest, FailsWhenThereIsNoNonfatalFailure) {
582  printf("(expecting a failure)\n");
584  }, "");
585 }
586 
587 // Tests that EXPECT_NONFATAL_FAILURE() fails when there are two
588 // non-fatal failures.
589 TEST(ExpectNonfatalFailureTest, FailsWhenThereAreTwoNonfatalFailures) {
590  printf("(expecting a failure)\n");
592  ADD_FAILURE() << "Expected non-fatal failure 1.";
593  ADD_FAILURE() << "Expected non-fatal failure 2.";
594  }, "");
595 }
596 
597 // Tests that EXPECT_NONFATAL_FAILURE() fails when there is one fatal
598 // failure.
599 TEST(ExpectNonfatalFailureTest, FailsWhenThereIsOneFatalFailure) {
600  printf("(expecting a failure)\n");
602  FAIL() << "Expected fatal failure.";
603  }, "");
604 }
605 
606 // Tests that EXPECT_NONFATAL_FAILURE() fails when the statement being
607 // tested returns.
608 TEST(ExpectNonfatalFailureTest, FailsWhenStatementReturns) {
609  printf("(expecting a failure)\n");
611  return;
612  }, "");
613 }
614 
615 #if GTEST_HAS_EXCEPTIONS
616 
617 // Tests that EXPECT_NONFATAL_FAILURE() fails when the statement being
618 // tested throws.
619 TEST(ExpectNonfatalFailureTest, FailsWhenStatementThrows) {
620  printf("(expecting a failure)\n");
621  try {
623  throw 0;
624  }, "");
625  } catch(int) { // NOLINT
626  }
627 }
628 
629 #endif // GTEST_HAS_EXCEPTIONS
630 
631 // Tests that EXPECT_FATAL_FAILURE() can reference global variables.
632 TEST(ExpectFatalFailureTest, CanReferenceGlobalVariables) {
633  global_integer = 0;
635  ASSERT_EQ(1, global_integer) << "Expected fatal failure.";
636  }, "Expected fatal failure.");
637 }
638 
639 // Tests that EXPECT_FATAL_FAILURE() can reference local static
640 // variables.
641 TEST(ExpectFatalFailureTest, CanReferenceLocalStaticVariables) {
642  static int n;
643  n = 1;
645  ASSERT_EQ(0, n) << "Expected fatal failure.";
646  }, "Expected fatal failure.");
647 }
648 
649 // Tests that EXPECT_FATAL_FAILURE() succeeds when there is exactly
650 // one fatal failure and no non-fatal failure.
651 TEST(ExpectFatalFailureTest, SucceedsWhenThereIsOneFatalFailure) {
653  FAIL() << "Expected fatal failure.";
654  }, "Expected fatal failure.");
655 }
656 
657 // Tests that EXPECT_FATAL_FAILURE() fails when there is no fatal
658 // failure.
659 TEST(ExpectFatalFailureTest, FailsWhenThereIsNoFatalFailure) {
660  printf("(expecting a failure)\n");
662  }, "");
663 }
664 
665 // A helper for generating a fatal failure.
666 void FatalFailure() {
667  FAIL() << "Expected fatal failure.";
668 }
669 
670 // Tests that EXPECT_FATAL_FAILURE() fails when there are two
671 // fatal failures.
672 TEST(ExpectFatalFailureTest, FailsWhenThereAreTwoFatalFailures) {
673  printf("(expecting a failure)\n");
675  FatalFailure();
676  FatalFailure();
677  }, "");
678 }
679 
680 // Tests that EXPECT_FATAL_FAILURE() fails when there is one non-fatal
681 // failure.
682 TEST(ExpectFatalFailureTest, FailsWhenThereIsOneNonfatalFailure) {
683  printf("(expecting a failure)\n");
685  ADD_FAILURE() << "Expected non-fatal failure.";
686  }, "");
687 }
688 
689 // Tests that EXPECT_FATAL_FAILURE() fails when the statement being
690 // tested returns.
691 TEST(ExpectFatalFailureTest, FailsWhenStatementReturns) {
692  printf("(expecting a failure)\n");
694  return;
695  }, "");
696 }
697 
698 #if GTEST_HAS_EXCEPTIONS
699 
700 // Tests that EXPECT_FATAL_FAILURE() fails when the statement being
701 // tested throws.
702 TEST(ExpectFatalFailureTest, FailsWhenStatementThrows) {
703  printf("(expecting a failure)\n");
704  try {
706  throw 0;
707  }, "");
708  } catch(int) { // NOLINT
709  }
710 }
711 
712 #endif // GTEST_HAS_EXCEPTIONS
713 
714 // This #ifdef block tests the output of value-parameterized tests.
715 
717  return info.param;
718 }
719 
720 class ParamTest : public testing::TestWithParam<std::string> {
721 };
722 
723 TEST_P(ParamTest, Success) {
724  EXPECT_EQ("a", GetParam());
725 }
726 
727 TEST_P(ParamTest, Failure) {
728  EXPECT_EQ("b", GetParam()) << "Expected failure";
729 }
730 
731 INSTANTIATE_TEST_SUITE_P(PrintingStrings,
732  ParamTest,
734  ParamNameFunc);
735 
736 // The case where a suite has INSTANTIATE_TEST_SUITE_P but not TEST_P.
737 using NoTests = ParamTest;
738 INSTANTIATE_TEST_SUITE_P(ThisIsOdd, NoTests, ::testing::Values("Hello"));
739 
740 // fails under kErrorOnUninstantiatedParameterizedTest=true
743 
744 // This would make the test failure from the above go away.
745 // INSTANTIATE_TEST_SUITE_P(Fix, DetectNotInstantiatedTest, testing::Values(1));
746 
747 template <typename T>
748 class TypedTest : public testing::Test {
749 };
750 
752 
754  EXPECT_EQ(0, TypeParam());
755 }
756 
758  EXPECT_EQ(1, TypeParam()) << "Expected failure";
759 }
760 
762 
763 template <typename T>
765 
767  public:
768  template <typename T>
769  static std::string GetName(int i) {
771  return std::string("char") + ::testing::PrintToString(i);
773  return std::string("int") + ::testing::PrintToString(i);
774  }
775 };
776 
778 
780 
782 
783 template <typename T>
784 class TypedTestP : public testing::Test {
785 };
786 
788 
790  EXPECT_EQ(0U, TypeParam());
791 }
792 
794  EXPECT_EQ(1U, TypeParam()) << "Expected failure";
795 }
796 
797 REGISTER_TYPED_TEST_SUITE_P(TypedTestP, Success, Failure);
798 
801 
803  public:
804  template <typename T>
805  static std::string GetName(int i) {
807  return std::string("unsignedChar") + ::testing::PrintToString(i);
808  }
810  return std::string("unsignedInt") + ::testing::PrintToString(i);
811  }
812  }
813 };
814 
817 
818 template <typename T>
822  TypeParam instantiate;
823  (void)instantiate;
824 }
826 
827 // kErrorOnUninstantiatedTypeParameterizedTest=true would make the above fail.
828 // Adding the following would make that test failure go away.
829 //
830 // typedef ::testing::Types<char, int, unsigned int> MyTypes;
831 // INSTANTIATE_TYPED_TEST_SUITE_P(All, DetectNotInstantiatedTypesTest, MyTypes);
832 
833 #if GTEST_HAS_DEATH_TEST
834 
835 // We rely on the golden file to verify that tests whose test case
836 // name ends with DeathTest are run first.
837 
838 TEST(ADeathTest, ShouldRunFirst) {
839 }
840 
841 // We rely on the golden file to verify that typed tests whose test
842 // case name ends with DeathTest are run first.
843 
844 template <typename T>
845 class ATypedDeathTest : public testing::Test {
846 };
847 
849 TYPED_TEST_SUITE(ATypedDeathTest, NumericTypes);
850 
851 TYPED_TEST(ATypedDeathTest, ShouldRunFirst) {
852 }
853 
854 
855 // We rely on the golden file to verify that type-parameterized tests
856 // whose test case name ends with DeathTest are run first.
857 
858 template <typename T>
859 class ATypeParamDeathTest : public testing::Test {
860 };
861 
862 TYPED_TEST_SUITE_P(ATypeParamDeathTest);
863 
864 TYPED_TEST_P(ATypeParamDeathTest, ShouldRunFirst) {
865 }
866 
867 REGISTER_TYPED_TEST_SUITE_P(ATypeParamDeathTest, ShouldRunFirst);
868 
869 INSTANTIATE_TYPED_TEST_SUITE_P(My, ATypeParamDeathTest, NumericTypes);
870 
871 #endif // GTEST_HAS_DEATH_TEST
872 
873 // Tests various failure conditions of
874 // EXPECT_{,NON}FATAL_FAILURE{,_ON_ALL_THREADS}.
875 class ExpectFailureTest : public testing::Test {
876  public: // Must be public and not protected due to a bug in g++ 3.4.2.
877  enum FailureMode {
880  };
881  static void AddFailure(FailureMode failure) {
882  if (failure == FATAL_FAILURE) {
883  FAIL() << "Expected fatal failure.";
884  } else {
885  ADD_FAILURE() << "Expected non-fatal failure.";
886  }
887  }
888 };
889 
890 TEST_F(ExpectFailureTest, ExpectFatalFailure) {
891  // Expected fatal failure, but succeeds.
892  printf("(expecting 1 failure)\n");
893  EXPECT_FATAL_FAILURE(SUCCEED(), "Expected fatal failure.");
894  // Expected fatal failure, but got a non-fatal failure.
895  printf("(expecting 1 failure)\n");
896  EXPECT_FATAL_FAILURE(AddFailure(NONFATAL_FAILURE), "Expected non-fatal "
897  "failure.");
898  // Wrong message.
899  printf("(expecting 1 failure)\n");
900  EXPECT_FATAL_FAILURE(AddFailure(FATAL_FAILURE), "Some other fatal failure "
901  "expected.");
902 }
903 
904 TEST_F(ExpectFailureTest, ExpectNonFatalFailure) {
905  // Expected non-fatal failure, but succeeds.
906  printf("(expecting 1 failure)\n");
907  EXPECT_NONFATAL_FAILURE(SUCCEED(), "Expected non-fatal failure.");
908  // Expected non-fatal failure, but got a fatal failure.
909  printf("(expecting 1 failure)\n");
910  EXPECT_NONFATAL_FAILURE(AddFailure(FATAL_FAILURE), "Expected fatal failure.");
911  // Wrong message.
912  printf("(expecting 1 failure)\n");
913  EXPECT_NONFATAL_FAILURE(AddFailure(NONFATAL_FAILURE), "Some other non-fatal "
914  "failure.");
915 }
916 
917 #if GTEST_IS_THREADSAFE
918 
919 class ExpectFailureWithThreadsTest : public ExpectFailureTest {
920  protected:
921  static void AddFailureInOtherThread(FailureMode failure) {
922  ThreadWithParam<FailureMode> thread(&AddFailure, failure, nullptr);
923  thread.Join();
924  }
925 };
926 
927 TEST_F(ExpectFailureWithThreadsTest, ExpectFatalFailure) {
928  // We only intercept the current thread.
929  printf("(expecting 2 failures)\n");
930  EXPECT_FATAL_FAILURE(AddFailureInOtherThread(FATAL_FAILURE),
931  "Expected fatal failure.");
932 }
933 
934 TEST_F(ExpectFailureWithThreadsTest, ExpectNonFatalFailure) {
935  // We only intercept the current thread.
936  printf("(expecting 2 failures)\n");
937  EXPECT_NONFATAL_FAILURE(AddFailureInOtherThread(NONFATAL_FAILURE),
938  "Expected non-fatal failure.");
939 }
940 
941 typedef ExpectFailureWithThreadsTest ScopedFakeTestPartResultReporterTest;
942 
943 // Tests that the ScopedFakeTestPartResultReporter only catches failures from
944 // the current thread if it is instantiated with INTERCEPT_ONLY_CURRENT_THREAD.
945 TEST_F(ScopedFakeTestPartResultReporterTest, InterceptOnlyCurrentThread) {
946  printf("(expecting 2 failures)\n");
947  TestPartResultArray results;
948  {
949  ScopedFakeTestPartResultReporter reporter(
950  ScopedFakeTestPartResultReporter::INTERCEPT_ONLY_CURRENT_THREAD,
951  &results);
952  AddFailureInOtherThread(FATAL_FAILURE);
953  AddFailureInOtherThread(NONFATAL_FAILURE);
954  }
955  // The two failures should not have been intercepted.
956  EXPECT_EQ(0, results.size()) << "This shouldn't fail.";
957 }
958 
959 #endif // GTEST_IS_THREADSAFE
960 
961 TEST_F(ExpectFailureTest, ExpectFatalFailureOnAllThreads) {
962  // Expected fatal failure, but succeeds.
963  printf("(expecting 1 failure)\n");
964  EXPECT_FATAL_FAILURE_ON_ALL_THREADS(SUCCEED(), "Expected fatal failure.");
965  // Expected fatal failure, but got a non-fatal failure.
966  printf("(expecting 1 failure)\n");
967  EXPECT_FATAL_FAILURE_ON_ALL_THREADS(AddFailure(NONFATAL_FAILURE),
968  "Expected non-fatal failure.");
969  // Wrong message.
970  printf("(expecting 1 failure)\n");
972  "Some other fatal failure expected.");
973 }
974 
975 TEST_F(ExpectFailureTest, ExpectNonFatalFailureOnAllThreads) {
976  // Expected non-fatal failure, but succeeds.
977  printf("(expecting 1 failure)\n");
978  EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(SUCCEED(), "Expected non-fatal "
979  "failure.");
980  // Expected non-fatal failure, but got a fatal failure.
981  printf("(expecting 1 failure)\n");
983  "Expected fatal failure.");
984  // Wrong message.
985  printf("(expecting 1 failure)\n");
986  EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(AddFailure(NONFATAL_FAILURE),
987  "Some other non-fatal failure.");
988 }
989 
990 class DynamicFixture : public testing::Test {
991  protected:
992  DynamicFixture() { printf("DynamicFixture()\n"); }
993  ~DynamicFixture() override { printf("~DynamicFixture()\n"); }
994  void SetUp() override { printf("DynamicFixture::SetUp\n"); }
995  void TearDown() override { printf("DynamicFixture::TearDown\n"); }
996 
997  static void SetUpTestSuite() { printf("DynamicFixture::SetUpTestSuite\n"); }
998  static void TearDownTestSuite() {
999  printf("DynamicFixture::TearDownTestSuite\n");
1000  }
1001 };
1002 
1003 template <bool Pass>
1004 class DynamicTest : public DynamicFixture {
1005  public:
1006  void TestBody() override { EXPECT_TRUE(Pass); }
1007 };
1008 
1010  // Register two tests with the same fixture correctly.
1012  "DynamicFixture", "DynamicTestPass", nullptr, nullptr, __FILE__,
1013  __LINE__, []() -> DynamicFixture* { return new DynamicTest<true>; }),
1015  "DynamicFixture", "DynamicTestFail", nullptr, nullptr, __FILE__,
1016  __LINE__, []() -> DynamicFixture* { return new DynamicTest<false>; }),
1017 
1018  // Register the same fixture with another name. That's fine.
1020  "DynamicFixtureAnotherName", "DynamicTestPass", nullptr, nullptr,
1021  __FILE__, __LINE__,
1022  []() -> DynamicFixture* { return new DynamicTest<true>; }),
1023 
1024  // Register two tests with the same fixture incorrectly.
1026  "BadDynamicFixture1", "FixtureBase", nullptr, nullptr, __FILE__,
1027  __LINE__, []() -> DynamicFixture* { return new DynamicTest<true>; }),
1029  "BadDynamicFixture1", "TestBase", nullptr, nullptr, __FILE__, __LINE__,
1030  []() -> testing::Test* { return new DynamicTest<true>; }),
1031 
1032  // Register two tests with the same fixture incorrectly by omitting the
1033  // return type.
1035  "BadDynamicFixture2", "FixtureBase", nullptr, nullptr, __FILE__,
1036  __LINE__, []() -> DynamicFixture* { return new DynamicTest<true>; }),
1037  testing::RegisterTest("BadDynamicFixture2", "Derived", nullptr, nullptr,
1038  __FILE__, __LINE__,
1039  []() { return new DynamicTest<true>; }));
1040 
1041 // Two test environments for testing testing::AddGlobalTestEnvironment().
1042 
1043 class FooEnvironment : public testing::Environment {
1044  public:
1045  void SetUp() override { printf("%s", "FooEnvironment::SetUp() called.\n"); }
1046 
1047  void TearDown() override {
1048  printf("%s", "FooEnvironment::TearDown() called.\n");
1049  FAIL() << "Expected fatal failure.";
1050  }
1051 };
1052 
1053 class BarEnvironment : public testing::Environment {
1054  public:
1055  void SetUp() override { printf("%s", "BarEnvironment::SetUp() called.\n"); }
1056 
1057  void TearDown() override {
1058  printf("%s", "BarEnvironment::TearDown() called.\n");
1059  ADD_FAILURE() << "Expected non-fatal failure.";
1060  }
1061 };
1062 
1064  public:
1065  static void SetUpTestSuite() { EXPECT_TRUE(false); }
1066 };
1068  std::abort();
1069 }
1070 
1071 // The main function.
1072 //
1073 // The idea is to use Google Test to run all the tests we have defined (some
1074 // of them are intended to fail), and then compare the test results
1075 // with the "golden" file.
1076 int main(int argc, char **argv) {
1077  GTEST_FLAG_SET(print_time, false);
1078 
1079  // We just run the tests, knowing some of them are intended to fail.
1080  // We will use a separate Python script to compare the output of
1081  // this program with the golden file.
1082 
1083  // It's hard to test InitGoogleTest() directly, as it has many
1084  // global side effects. The following line serves as a sanity test
1085  // for it.
1086  testing::InitGoogleTest(&argc, argv);
1087  bool internal_skip_environment_and_ad_hoc_tests =
1088  std::count(argv, argv + argc,
1089  std::string("internal_skip_environment_and_ad_hoc_tests")) > 0;
1090 
1091 #if GTEST_HAS_DEATH_TEST
1092  if (GTEST_FLAG_GET(internal_run_death_test) != "") {
1093  // Skip the usual output capturing if we're running as the child
1094  // process of an threadsafe-style death test.
1095 # if GTEST_OS_WINDOWS
1096  posix::FReopen("nul:", "w", stdout);
1097 # else
1098  posix::FReopen("/dev/null", "w", stdout);
1099 # endif // GTEST_OS_WINDOWS
1100  return RUN_ALL_TESTS();
1101  }
1102 #endif // GTEST_HAS_DEATH_TEST
1103 
1104  if (internal_skip_environment_and_ad_hoc_tests)
1105  return RUN_ALL_TESTS();
1106 
1107  // Registers two global test environments.
1108  // The golden file verifies that they are set up in the order they
1109  // are registered, and torn down in the reverse order.
1112 #if _MSC_VER
1114 #endif // _MSC_VER
1115  return RunAllTests();
1116 }
testing::TestParamInfo::param
ParamType param
Definition: bloaty/third_party/googletest/googletest/include/gtest/internal/gtest-param-util.h:60
TYPED_TEST
TYPED_TEST(TypedTest, Success)
Definition: googletest/googletest/test/googletest-output-test_.cc:753
ExpectFailureTest::FailureMode
FailureMode
Definition: bloaty/third_party/googletest/googletest/test/googletest-output-test_.cc:926
FooEnvironment::SetUp
void SetUp() override
Definition: googletest/googletest/test/googletest-output-test_.cc:1045
TYPED_TEST_SUITE
TYPED_TEST_SUITE(TypedTest, testing::Types< int >)
NonFatalFailureInSetUpTest::~NonFatalFailureInSetUpTest
~NonFatalFailureInSetUpTest() override
Definition: googletest/googletest/test/googletest-output-test_.cc:429
GTEST_FLAG_SET
#define GTEST_FLAG_SET(name, value)
Definition: googletest/googletest/include/gtest/internal/gtest-port.h:2219
INSTANTIATE_TYPED_TEST_SUITE_P
INSTANTIATE_TYPED_TEST_SUITE_P(Unsigned, TypedTestP, UnsignedTypes)
FatalFailureInSetUpTest
Definition: bloaty/third_party/googletest/googletest/test/googletest-output-test_.cc:449
TypedTestPNames
Definition: googletest/googletest/test/googletest-output-test_.cc:802
GTEST_DISABLE_MSC_WARNINGS_PUSH_
#define GTEST_DISABLE_MSC_WARNINGS_PUSH_(warnings)
Definition: bloaty/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:308
FooEnvironment
Definition: bloaty/third_party/googletest/googletest/test/googletest-output-test_.cc:1092
demumble_test.stdout
stdout
Definition: demumble_test.py:38
REGISTER_TYPED_TEST_SUITE_P
REGISTER_TYPED_TEST_SUITE_P(TypedTestP, Success, Failure)
EXPECT_FATAL_FAILURE_ON_ALL_THREADS
#define EXPECT_FATAL_FAILURE_ON_ALL_THREADS(statement, substr)
TEST_before_TEST_F_in_same_test_case
Definition: bloaty/third_party/googletest/googletest/test/googletest-output-test_.cc:596
DynamicFixture::TearDownTestSuite
static void TearDownTestSuite()
Definition: googletest/googletest/test/googletest-output-test_.cc:998
DynamicFixture::DynamicFixture
DynamicFixture()
Definition: googletest/googletest/test/googletest-output-test_.cc:992
FatalFailureInSetUpTest::Deinit
void Deinit()
Definition: bloaty/third_party/googletest/googletest/test/googletest-output-test_.cc:461
testing::ScopedFakeTestPartResultReporter
Definition: gmock-gtest-all.cc:124
EXPECT_FATAL_FAILURE
#define EXPECT_FATAL_FAILURE(statement, substr)
bar
Definition: bloaty/third_party/googletest/googletest/test/googletest-output-test_.cc:562
GTEST_FAIL_AT
#define GTEST_FAIL_AT(file, line)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:1923
ADD_FAILURE_AT
#define ADD_FAILURE_AT(file, line)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:1915
TYPED_TEST_SUITE_P
TYPED_TEST_SUITE_P(TypedTestP)
printf
_Use_decl_annotations_ int __cdecl printf(const char *_Format,...)
Definition: cs_driver.c:91
UnsignedTypes
testing::Types< unsigned char, unsigned int > UnsignedTypes
Definition: googletest/googletest/test/googletest-output-test_.cc:799
testing::internal::string
::std::string string
Definition: bloaty/third_party/protobuf/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:881
NonFatalFailureInFixtureConstructorTest::SetUp
void SetUp() override
Definition: googletest/googletest/test/googletest-output-test_.cc:379
testing::internal::posix::FReopen
FILE * FReopen(const char *path, const char *mode, FILE *stream)
Definition: bloaty/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:2037
foo
Definition: bloaty/third_party/googletest/googletest/test/googletest-output-test_.cc:546
testing::TestParamInfo
Definition: bloaty/third_party/googletest/googletest/include/gtest/internal/gtest-param-util.h:56
TEST_F
TEST_F(NonFatalFailureInFixtureConstructorTest, FailureInConstructor)
Definition: googletest/googletest/test/googletest-output-test_.cc:386
testing::TestPartResultArray
Definition: cares/cares/test/gmock-1.8.0/gtest/gtest.h:18351
a
int a
Definition: abseil-cpp/absl/container/internal/hash_policy_traits_test.cc:88
FatalFailureInFixtureConstructorTest::FatalFailureInFixtureConstructorTest
FatalFailureInFixtureConstructorTest()
Definition: googletest/googletest/test/googletest-output-test_.cc:393
ParamNameFunc
std::string ParamNameFunc(const testing::TestParamInfo< std::string > &info)
Definition: googletest/googletest/test/googletest-output-test_.cc:716
testing::Test::HasFatalFailure
static bool HasFatalFailure()
Definition: bloaty/third_party/googletest/googletest/src/gtest.cc:2527
dynamic_test
auto dynamic_test
Definition: googletest/googletest/test/googletest-output-test_.cc:1009
TypedTestNames
Definition: googletest/googletest/test/googletest-output-test_.cc:766
foo::TEST_F
TEST_F(MixedUpTestSuiteTest, FirstTestFromNamespaceFoo)
Definition: bloaty/third_party/googletest/googletest/test/googletest-output-test_.cc:551
FatalFailureInSetUpTest::~FatalFailureInSetUpTest
~FatalFailureInSetUpTest() override
Definition: googletest/googletest/test/googletest-output-test_.cc:451
ExpectFailureTest
Definition: bloaty/third_party/googletest/googletest/test/googletest-output-test_.cc:924
testing::RegisterTest
TestInfo * RegisterTest(const char *test_suite_name, const char *test_name, const char *type_param, const char *value_param, const char *file, int line, Factory factory)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:2437
testing::Message
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest-message.h:90
testing::Test
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:402
FooEnvironment::TearDown
void TearDown() override
Definition: googletest/googletest/test/googletest-output-test_.cc:1047
testing::AddGlobalTestEnvironment
Environment * AddGlobalTestEnvironment(Environment *env)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:1474
testing::TestWithParam
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:1883
global_integer
int global_integer
Definition: googletest/googletest/test/googletest-output-test_.cc:550
EXPECT_EQ
#define EXPECT_EQ(a, b)
Definition: iomgr/time_averaged_stats_test.cc:27
FailingParamTest
Definition: bloaty/third_party/googletest/googletest/test/googletest-output-test_.cc:87
DynamicFixture::TearDown
void TearDown() override
Definition: googletest/googletest/test/googletest-output-test_.cc:995
TypedTestWithNames
Definition: googletest/googletest/test/googletest-output-test_.cc:764
TEST
TEST(PassingTest, PassingTest1)
Definition: googletest/googletest/test/googletest-output-test_.cc:79
testing::internal::ProxyTypeList
Definition: googletest/googletest/include/gtest/internal/gtest-type-util.h:155
SCOPED_TRACE
#define SCOPED_TRACE(message)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:2264
TestSuiteThatFailsToSetUp::SetUpTestSuite
static void SetUpTestSuite()
Definition: googletest/googletest/test/googletest-output-test_.cc:1065
FatalFailureInSetUpTest::SetUp
void SetUp() override
Definition: googletest/googletest/test/googletest-output-test_.cc:453
grpc.beta.interfaces.FATAL_FAILURE
FATAL_FAILURE
Definition: interfaces.py:23
benchmarks.python.py_benchmark.results
list results
Definition: bloaty/third_party/protobuf/benchmarks/python/py_benchmark.py:145
NonFatalFailureInSetUpTest::SetUp
void SetUp() override
Definition: googletest/googletest/test/googletest-output-test_.cc:431
BarEnvironment::SetUp
void SetUp() override
Definition: googletest/googletest/test/googletest-output-test_.cc:1055
testing::Environment
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:1045
TypedTestPNames::GetName
static std::string GetName(int i)
Definition: googletest/googletest/test/googletest-output-test_.cc:805
bar::TEST_F
TEST_F(MixedUpTestSuiteTest, ThisShouldFail)
Definition: bloaty/third_party/googletest/googletest/test/googletest-output-test_.cc:569
TEST_P
TEST_P(FailingParamTest, Fails)
Definition: googletest/googletest/test/googletest-output-test_.cc:89
AdHocTest
void AdHocTest()
Definition: googletest/googletest/test/googletest-output-test_.cc:355
FAIL
@ FAIL
Definition: call_creds.cc:42
x
int x
Definition: bloaty/third_party/googletest/googlemock/test/gmock-matchers_test.cc:3610
NoTests
ParamTest NoTests
Definition: boringssl-with-bazel/src/third_party/googletest/test/googletest-output-test_.cc:737
EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS
#define EXPECT_NONFATAL_FAILURE_ON_ALL_THREADS(statement, substr)
DynamicFixture::SetUp
void SetUp() override
Definition: googletest/googletest/test/googletest-output-test_.cc:994
DynamicFixture
Definition: bloaty/third_party/googletest/googletest/test/googletest-output-test_.cc:1039
NonFatalFailureInFixtureConstructorTest
Definition: bloaty/third_party/googletest/googletest/test/googletest-output-test_.cc:368
RUN_ALL_TESTS
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:2471
ADD_FAILURE
#define ADD_FAILURE()
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:1911
TypedTest
Definition: bloaty/third_party/googletest/googletest/test/googletest-list-tests-unittest_.cc:116
ExpectFailureTest::FATAL_FAILURE
@ FATAL_FAILURE
Definition: bloaty/third_party/googletest/googletest/test/googletest-output-test_.cc:927
n
int n
Definition: abseil-cpp/absl/container/btree_test.cc:1080
TypedTestNames::GetName
static std::string GetName(int i)
Definition: googletest/googletest/test/googletest-output-test_.cc:769
FatalFailureInFixtureConstructorTest::SetUp
void SetUp() override
Definition: googletest/googletest/test/googletest-output-test_.cc:402
BarEnvironment
Definition: bloaty/third_party/googletest/googletest/test/googletest-output-test_.cc:1102
FatalFailureInFixtureConstructorTest::Init
void Init()
Definition: bloaty/third_party/googletest/googletest/test/googletest-output-test_.cc:415
testing::ScopedTrace
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:2214
TEST_F_before_TEST_in_same_test_case
Definition: bloaty/third_party/googletest/googletest/test/googletest-output-test_.cc:587
DynamicFixture::~DynamicFixture
~DynamicFixture() override
Definition: googletest/googletest/test/googletest-output-test_.cc:993
FatalFailureInSetUpTest::TearDown
void TearDown() override
Definition: googletest/googletest/test/googletest-output-test_.cc:458
FatalFailureInFixtureConstructorTest
Definition: bloaty/third_party/googletest/googletest/test/googletest-output-test_.cc:391
TYPED_TEST_P
TYPED_TEST_P(TypedTestP, Success)
Definition: googletest/googletest/test/googletest-output-test_.cc:789
DynamicTest::TestBody
void TestBody() override
Definition: googletest/googletest/test/googletest-output-test_.cc:1006
TestSuiteThatFailsToSetUp
Definition: googletest/googletest/test/googletest-output-test_.cc:1063
value
const char * value
Definition: hpack_parser_table.cc:165
testing::InitGoogleTest
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
Definition: bloaty/third_party/googletest/googletest/src/gtest.cc:6106
EmptyBasenameParamInst
Definition: bloaty/third_party/googletest/googletest/test/googletest-output-test_.cc:101
SubWithoutTrace
void SubWithoutTrace(int n)
Definition: googletest/googletest/test/googletest-output-test_.cc:169
NonFatalFailureInFixtureConstructorTest::TearDown
void TearDown() override
Definition: googletest/googletest/test/googletest-output-test_.cc:381
TypesForTestWithNames
testing::Types< char, int > TypesForTestWithNames
Definition: googletest/googletest/test/googletest-output-test_.cc:761
testing::Values
internal::ValueArray< T... > Values(T... v)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest-param-test.h:335
RunAllTests
int RunAllTests()
Definition: googletest/googletest/test/googletest-output-test_.cc:362
testing::internal::posix
Definition: bloaty/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:1963
SUCCEED
#define SUCCEED()
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:1939
count
int * count
Definition: bloaty/third_party/googletest/googlemock/test/gmock_stress_test.cc:96
INSTANTIATE_TEST_SUITE_P
INSTANTIATE_TEST_SUITE_P(PrintingFailingParams, FailingParamTest, testing::Values(2))
TypedTestP
Definition: googletest/googletest/test/googletest-output-test_.cc:784
NonFatalFailureInFixtureConstructorTest::NonFatalFailureInFixtureConstructorTest
NonFatalFailureInFixtureConstructorTest()
Definition: googletest/googletest/test/googletest-output-test_.cc:370
kGoldenString
static const char kGoldenString[]
Definition: googletest/googletest/test/googletest-output-test_.cc:107
ASSERT_FALSE
#define ASSERT_FALSE(condition)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:1976
NonFatalFailureInSetUpTest::TearDown
void TearDown() override
Definition: googletest/googletest/test/googletest-output-test_.cc:436
ExpectFailureTest::AddFailure
static void AddFailure(FailureMode failure)
Definition: googletest/googletest/test/googletest-output-test_.cc:881
EXPECT_GE
#define EXPECT_GE(val1, val2)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:2034
GTEST_DISABLE_MSC_WARNINGS_POP_
#define GTEST_DISABLE_MSC_WARNINGS_POP_()
Definition: bloaty/third_party/googletest/googletest/include/gtest/internal/gtest-port.h:309
EXPECT_TRUE
#define EXPECT_TRUE(condition)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:1967
ExpectFailureTest::NONFATAL_FAILURE
@ NONFATAL_FAILURE
Definition: bloaty/third_party/googletest/googletest/test/googletest-output-test_.cc:928
NonFatalFailureInSetUpTest
Definition: bloaty/third_party/googletest/googletest/test/googletest-output-test_.cc:427
FatalFailureInFixtureConstructorTest::TearDown
void TearDown() override
Definition: googletest/googletest/test/googletest-output-test_.cc:408
GTEST_FLAG_GET
#define GTEST_FLAG_GET(name)
Definition: googletest/googletest/include/gtest/internal/gtest-port.h:2218
SubWithTrace
void SubWithTrace(int n)
Definition: googletest/googletest/test/googletest-output-test_.cc:175
DynamicFixture::SetUpTestSuite
static void SetUpTestSuite()
Definition: googletest/googletest/test/googletest-output-test_.cc:997
NonFatalFailureInFixtureConstructorTest::~NonFatalFailureInFixtureConstructorTest
~NonFatalFailureInFixtureConstructorTest() override
Definition: googletest/googletest/test/googletest-output-test_.cc:375
EXPECT_NONFATAL_FAILURE
#define EXPECT_NONFATAL_FAILURE(statement, substr)
DetectNotInstantiatedTypesTest
Definition: googletest/googletest/test/googletest-output-test_.cc:819
BarEnvironment::TearDown
void TearDown() override
Definition: googletest/googletest/test/googletest-output-test_.cc:1057
FatalFailure
void FatalFailure()
Definition: googletest/googletest/test/googletest-output-test_.cc:666
regress.m
m
Definition: regress/regress.py:25
TestEq1
void TestEq1(int x)
Definition: googletest/googletest/test/googletest-output-test_.cc:59
NonFatalFailureInSetUpTest::Deinit
void Deinit()
Definition: bloaty/third_party/googletest/googletest/test/googletest-output-test_.cc:439
library1::NumericTypes
Types< int, long > NumericTypes
Definition: googletest/googletest/test/gtest-typed-test_test.cc:161
TryTestSubroutine
void TryTestSubroutine()
Definition: googletest/googletest/test/googletest-output-test_.cc:65
thread
static uv_thread_t thread
Definition: test-async-null-cb.c:29
DetectNotInstantiatedTest
Definition: boringssl-with-bazel/src/third_party/googletest/test/googletest-output-test_.cc:741
i
uint64_t i
Definition: abseil-cpp/absl/container/btree_benchmark.cc:230
main
int main(int argc, char **argv)
Definition: googletest/googletest/test/googletest-output-test_.cc:1076
ASSERT_EQ
#define ASSERT_EQ(val1, val2)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest.h:2056
FatalFailureInFixtureConstructorTest::~FatalFailureInFixtureConstructorTest
~FatalFailureInFixtureConstructorTest() override
Definition: googletest/googletest/test/googletest-output-test_.cc:398
testing::PrintToString
::std::string PrintToString(const T &value)
Definition: bloaty/third_party/googletest/googletest/include/gtest/gtest-printers.h:915
DynamicTest
Definition: bloaty/third_party/googletest/googletest/test/googletest-output-test_.cc:1053


grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:41