Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
testing::internal::PrettyUnitTestResultPrinter Class Reference
Inheritance diagram for testing::internal::PrettyUnitTestResultPrinter:
Collaboration diagram for testing::internal::PrettyUnitTestResultPrinter:

Public Member Functions

 PrettyUnitTestResultPrinter ()
 
virtual void OnTestProgramStart (const UnitTest &)
 
virtual void OnTestIterationStart (const UnitTest &unit_test, int iteration)
 
virtual void OnEnvironmentsSetUpStart (const UnitTest &unit_test)
 
virtual void OnEnvironmentsSetUpEnd (const UnitTest &)
 
virtual void OnTestCaseStart (const TestCase &test_case)
 
virtual void OnTestStart (const TestInfo &test_info)
 
virtual void OnTestPartResult (const TestPartResult &result)
 
virtual void OnTestEnd (const TestInfo &test_info)
 
virtual void OnTestCaseEnd (const TestCase &test_case)
 
virtual void OnEnvironmentsTearDownStart (const UnitTest &unit_test)
 
virtual void OnEnvironmentsTearDownEnd (const UnitTest &)
 
virtual void OnTestIterationEnd (const UnitTest &unit_test, int iteration)
 
virtual void OnTestProgramEnd (const UnitTest &)
 
- Public Member Functions inherited from testing::TestEventListener
virtual ~TestEventListener ()
 

Static Public Member Functions

static void PrintTestName (const char *test_case, const char *test)
 

Detailed Description

Definition at line 3073 of file gtest.cc.

Constructor & Destructor Documentation

◆ PrettyUnitTestResultPrinter()

testing::internal::PrettyUnitTestResultPrinter::PrettyUnitTestResultPrinter ( )
inline

Definition at line 3075 of file gtest.cc.

3075{}

Member Function Documentation

◆ OnEnvironmentsSetUpEnd()

virtual void testing::internal::PrettyUnitTestResultPrinter::OnEnvironmentsSetUpEnd ( const UnitTest & )
inlinevirtual

Implements testing::TestEventListener.

Definition at line 3084 of file gtest.cc.

3084{}

◆ OnEnvironmentsSetUpStart()

void testing::internal::PrettyUnitTestResultPrinter::OnEnvironmentsSetUpStart ( const UnitTest & unit_test)
virtual

Implements testing::TestEventListener.

Definition at line 3134 of file gtest.cc.

3135 {
3136 ColoredPrintf(COLOR_GREEN, "[----------] ");
3137 printf("Global test environment set-up.\n");
3138 fflush(stdout);
3139}
LOGGING_API void printf(Category category, const char *format,...)
Definition Logging.cpp:30

◆ OnEnvironmentsTearDownEnd()

virtual void testing::internal::PrettyUnitTestResultPrinter::OnEnvironmentsTearDownEnd ( const UnitTest & )
inlinevirtual

Implements testing::TestEventListener.

Definition at line 3091 of file gtest.cc.

3091{}

◆ OnEnvironmentsTearDownStart()

void testing::internal::PrettyUnitTestResultPrinter::OnEnvironmentsTearDownStart ( const UnitTest & unit_test)
virtual

Implements testing::TestEventListener.

Definition at line 3204 of file gtest.cc.

3205 {
3206 ColoredPrintf(COLOR_GREEN, "[----------] ");
3207 printf("Global test environment tear-down\n");
3208 fflush(stdout);
3209}

◆ OnTestCaseEnd()

void testing::internal::PrettyUnitTestResultPrinter::OnTestCaseEnd ( const TestCase & test_case)
virtual

Implements testing::TestEventListener.

Definition at line 3192 of file gtest.cc.

3192 {
3193 if (!GTEST_FLAG(print_time)) return;
3194
3195 const std::string counts =
3196 FormatCountableNoun(test_case.test_to_run_count(), "test", "tests");
3197 ColoredPrintf(COLOR_GREEN, "[----------] ");
3198 printf("%s from %s (%s ms total)\n\n",
3199 counts.c_str(), test_case.name(),
3200 internal::StreamableToString(test_case.elapsed_time()).c_str());
3201 fflush(stdout);
3202}
#define GTEST_FLAG(name)
std::string StreamableToString(const T &streamable)
Here is the call graph for this function:

◆ OnTestCaseStart()

void testing::internal::PrettyUnitTestResultPrinter::OnTestCaseStart ( const TestCase & test_case)
virtual

Implements testing::TestEventListener.

Definition at line 3141 of file gtest.cc.

3141 {
3142 const std::string counts =
3143 FormatCountableNoun(test_case.test_to_run_count(), "test", "tests");
3144 ColoredPrintf(COLOR_GREEN, "[----------] ");
3145 printf("%s from %s", counts.c_str(), test_case.name());
3146 if (test_case.type_param() == NULL) {
3147 printf("\n");
3148 } else {
3149 printf(", where %s = %s\n", kTypeParamLabel, test_case.type_param());
3150 }
3151 fflush(stdout);
3152}
Here is the call graph for this function:

◆ OnTestEnd()

void testing::internal::PrettyUnitTestResultPrinter::OnTestEnd ( const TestInfo & test_info)
virtual

Implements testing::TestEventListener.

Definition at line 3173 of file gtest.cc.

3173 {
3174 if (test_info.result()->Passed()) {
3175 ColoredPrintf(COLOR_GREEN, "[ OK ] ");
3176 } else {
3177 ColoredPrintf(COLOR_RED, "[ FAILED ] ");
3178 }
3179 PrintTestName(test_info.test_case_name(), test_info.name());
3180 if (test_info.result()->Failed())
3181 PrintFullTestCommentIfPresent(test_info);
3182
3183 if (GTEST_FLAG(print_time)) {
3185 test_info.result()->elapsed_time()).c_str());
3186 } else {
3187 printf("\n");
3188 }
3189 fflush(stdout);
3190}
static void PrintTestName(const char *test_case, const char *test)
Definition gtest.cc:3076
Here is the call graph for this function:

◆ OnTestIterationEnd()

void testing::internal::PrettyUnitTestResultPrinter::OnTestIterationEnd ( const UnitTest & unit_test,
int iteration )
virtual

Implements testing::TestEventListener.

Definition at line 3236 of file gtest.cc.

3237 {
3238 ColoredPrintf(COLOR_GREEN, "[==========] ");
3239 printf("%s from %s ran.",
3240 FormatTestCount(unit_test.test_to_run_count()).c_str(),
3241 FormatTestCaseCount(unit_test.test_case_to_run_count()).c_str());
3242 if (GTEST_FLAG(print_time)) {
3243 printf(" (%s ms total)",
3244 internal::StreamableToString(unit_test.elapsed_time()).c_str());
3245 }
3246 printf("\n");
3247 ColoredPrintf(COLOR_GREEN, "[ PASSED ] ");
3248 printf("%s.\n", FormatTestCount(unit_test.successful_test_count()).c_str());
3249
3250 int num_failures = unit_test.failed_test_count();
3251 if (!unit_test.Passed()) {
3252 const int failed_test_count = unit_test.failed_test_count();
3253 ColoredPrintf(COLOR_RED, "[ FAILED ] ");
3254 printf("%s, listed below:\n", FormatTestCount(failed_test_count).c_str());
3255 PrintFailedTests(unit_test);
3256 printf("\n%2d FAILED %s\n", num_failures,
3257 num_failures == 1 ? "TEST" : "TESTS");
3258 }
3259
3260 int num_disabled = unit_test.reportable_disabled_test_count();
3261 if (num_disabled && !GTEST_FLAG(also_run_disabled_tests)) {
3262 if (!num_failures) {
3263 printf("\n"); // Add a spacer if no FAILURE banner is displayed.
3264 }
3265 ColoredPrintf(COLOR_YELLOW,
3266 " YOU HAVE %d DISABLED %s\n\n",
3267 num_disabled,
3268 num_disabled == 1 ? "TEST" : "TESTS");
3269 }
3270 // Ensure that Google Test output is printed before, e.g., heapchecker output.
3271 fflush(stdout);
3272}
uint32_t num_failures
Here is the call graph for this function:

◆ OnTestIterationStart()

void testing::internal::PrettyUnitTestResultPrinter::OnTestIterationStart ( const UnitTest & unit_test,
int iteration )
virtual

Implements testing::TestEventListener.

Definition at line 3100 of file gtest.cc.

3101 {
3102 if (GTEST_FLAG(repeat) != 1)
3103 printf("\nRepeating all tests (iteration %d) . . .\n\n", iteration + 1);
3104
3105 const char* const filter = GTEST_FLAG(filter).c_str();
3106
3107 // Prints the filter if it's not *. This reminds the user that some
3108 // tests may be skipped.
3109 if (!String::CStringEquals(filter, kUniversalFilter)) {
3110 ColoredPrintf(COLOR_YELLOW,
3111 "Note: %s filter = %s\n", GTEST_NAME_, filter);
3112 }
3113
3114 if (internal::ShouldShard(kTestTotalShards, kTestShardIndex, false)) {
3115 const Int32 shard_index = Int32FromEnvOrDie(kTestShardIndex, -1);
3116 ColoredPrintf(COLOR_YELLOW,
3117 "Note: This is test shard %d of %s.\n",
3118 static_cast<int>(shard_index) + 1,
3119 internal::posix::GetEnv(kTestTotalShards));
3120 }
3121
3122 if (GTEST_FLAG(shuffle)) {
3123 ColoredPrintf(COLOR_YELLOW,
3124 "Note: Randomizing tests' orders with a seed of %d .\n",
3125 unit_test.random_seed());
3126 }
3127 ColoredPrintf(COLOR_GREEN, "[==========] ");
3128 printf("Running %s from %s.\n",
3129 FormatTestCount(unit_test.test_to_run_count()).c_str(),
3130 FormatTestCaseCount(unit_test.test_case_to_run_count()).c_str());
3131 fflush(stdout);
3132}
static bool CStringEquals(const char *lhs, const char *rhs)
Definition gtest.cc:908
#define GTEST_NAME_
Definition gtest-port.h:296
const char * GetEnv(const char *name)
GTEST_API_ bool ShouldShard(const char *total_shards_str, const char *shard_index_str, bool in_subprocess_for_death_test)
Definition gtest.cc:5128
TypeWithSize< 4 >::Int Int32
GTEST_API_ Int32 Int32FromEnvOrDie(const char *env_var, Int32 default_val)
Definition gtest.cc:5173
Here is the call graph for this function:

◆ OnTestPartResult()

void testing::internal::PrettyUnitTestResultPrinter::OnTestPartResult ( const TestPartResult & result)
virtual

Implements testing::TestEventListener.

Definition at line 3162 of file gtest.cc.

3163 {
3164 // If the test part succeeded, we don't need to do anything.
3165 if (result.type() == TestPartResult::kSuccess)
3166 return;
3167
3168 // Print failure message from the assertion (e.g. expected this and got that).
3169 PrintTestPartResult(result);
3170 fflush(stdout);
3171}

◆ OnTestProgramEnd()

virtual void testing::internal::PrettyUnitTestResultPrinter::OnTestProgramEnd ( const UnitTest & )
inlinevirtual

Implements testing::TestEventListener.

Definition at line 3093 of file gtest.cc.

3093{}

◆ OnTestProgramStart()

virtual void testing::internal::PrettyUnitTestResultPrinter::OnTestProgramStart ( const UnitTest & )
inlinevirtual

Implements testing::TestEventListener.

Definition at line 3081 of file gtest.cc.

3081{}

◆ OnTestStart()

void testing::internal::PrettyUnitTestResultPrinter::OnTestStart ( const TestInfo & test_info)
virtual

Implements testing::TestEventListener.

Definition at line 3154 of file gtest.cc.

3154 {
3155 ColoredPrintf(COLOR_GREEN, "[ RUN ] ");
3156 PrintTestName(test_info.test_case_name(), test_info.name());
3157 printf("\n");
3158 fflush(stdout);
3159}
Here is the call graph for this function:

◆ PrintTestName()

static void testing::internal::PrettyUnitTestResultPrinter::PrintTestName ( const char * test_case,
const char * test )
inlinestatic

Definition at line 3076 of file gtest.cc.

3076 {
3077 printf("%s.%s", test_case, test);
3078 }
Here is the caller graph for this function:

The documentation for this class was generated from the following file: