| 4627 | } |
| 4628 | |
| 4629 | void PrettyUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test, |
| 4630 | int /*iteration*/) { |
| 4631 | ColoredPrintf(COLOR_GREEN, "[==========] "); |
| 4632 | printf("%s from %s ran.", |
| 4633 | FormatTestCount(unit_test.test_to_run_count()).c_str(), |
| 4634 | FormatTestCaseCount(unit_test.test_case_to_run_count()).c_str()); |
| 4635 | if (GTEST_FLAG(print_time)) { |
| 4636 | printf(" (%s ms total)", |
| 4637 | internal::StreamableToString(unit_test.elapsed_time()).c_str()); |
| 4638 | } |
| 4639 | printf("\n"); |
| 4640 | ColoredPrintf(COLOR_GREEN, "[ PASSED ] "); |
| 4641 | printf("%s.\n", FormatTestCount(unit_test.successful_test_count()).c_str()); |
| 4642 | |
| 4643 | int num_failures = unit_test.failed_test_count(); |
| 4644 | if (!unit_test.Passed()) { |
| 4645 | const int failed_test_count = unit_test.failed_test_count(); |
| 4646 | ColoredPrintf(COLOR_RED, "[ FAILED ] "); |
| 4647 | printf("%s, listed below:\n", FormatTestCount(failed_test_count).c_str()); |
| 4648 | PrintFailedTests(unit_test); |
| 4649 | printf("\n%2d FAILED %s\n", num_failures, |
| 4650 | num_failures == 1 ? "TEST" : "TESTS"); |
| 4651 | } |
| 4652 | |
| 4653 | int num_disabled = unit_test.reportable_disabled_test_count(); |
| 4654 | if (num_disabled && !GTEST_FLAG(also_run_disabled_tests)) { |
| 4655 | if (!num_failures) { |
| 4656 | printf("\n"); // Add a spacer if no FAILURE banner is displayed. |
| 4657 | } |
| 4658 | ColoredPrintf(COLOR_YELLOW, |
| 4659 | " YOU HAVE %d DISABLED %s\n\n", |
| 4660 | num_disabled, |
| 4661 | num_disabled == 1 ? "TEST" : "TESTS"); |
| 4662 | } |
| 4663 | // Ensure that Google Test output is printed before, e.g., heapchecker output. |
| 4664 | fflush(stdout); |
| 4665 | } |
| 4666 | |
| 4667 | // End PrettyUnitTestResultPrinter |
| 4668 |
no test coverage detected