| 4787 | } |
| 4788 | |
| 4789 | void PrettyUnitTestResultPrinter::OnTestIterationEnd(const UnitTest& unit_test, |
| 4790 | int /*iteration*/) { |
| 4791 | ColoredPrintf(COLOR_GREEN, "[==========] "); |
| 4792 | printf("%s from %s ran.", |
| 4793 | FormatTestCount(unit_test.test_to_run_count()).c_str(), |
| 4794 | FormatTestSuiteCount(unit_test.test_suite_to_run_count()).c_str()); |
| 4795 | if (GTEST_FLAG(print_time)) { |
| 4796 | printf(" (%s ms total)", |
| 4797 | internal::StreamableToString(unit_test.elapsed_time()).c_str()); |
| 4798 | } |
| 4799 | printf("\n"); |
| 4800 | ColoredPrintf(COLOR_GREEN, "[ PASSED ] "); |
| 4801 | printf("%s.\n", FormatTestCount(unit_test.successful_test_count()).c_str()); |
| 4802 | |
| 4803 | const int skipped_test_count = unit_test.skipped_test_count(); |
| 4804 | if (skipped_test_count > 0) { |
| 4805 | ColoredPrintf(COLOR_GREEN, "[ SKIPPED ] "); |
| 4806 | printf("%s, listed below:\n", FormatTestCount(skipped_test_count).c_str()); |
| 4807 | PrintSkippedTests(unit_test); |
| 4808 | } |
| 4809 | |
| 4810 | int num_failures = unit_test.failed_test_count(); |
| 4811 | if (!unit_test.Passed()) { |
| 4812 | const int failed_test_count = unit_test.failed_test_count(); |
| 4813 | ColoredPrintf(COLOR_RED, "[ FAILED ] "); |
| 4814 | printf("%s, listed below:\n", FormatTestCount(failed_test_count).c_str()); |
| 4815 | PrintFailedTests(unit_test); |
| 4816 | printf("\n%2d FAILED %s\n", num_failures, |
| 4817 | num_failures == 1 ? "TEST" : "TESTS"); |
| 4818 | } |
| 4819 | |
| 4820 | int num_disabled = unit_test.reportable_disabled_test_count(); |
| 4821 | if (num_disabled && !GTEST_FLAG(also_run_disabled_tests)) { |
| 4822 | if (!num_failures) { |
| 4823 | printf("\n"); // Add a spacer if no FAILURE banner is displayed. |
| 4824 | } |
| 4825 | ColoredPrintf(COLOR_YELLOW, |
| 4826 | " YOU HAVE %d DISABLED %s\n\n", |
| 4827 | num_disabled, |
| 4828 | num_disabled == 1 ? "TEST" : "TESTS"); |
| 4829 | } |
| 4830 | // Ensure that Google Test output is printed before, e.g., heapchecker output. |
| 4831 | fflush(stdout); |
| 4832 | } |
| 4833 | |
| 4834 | // End PrettyUnitTestResultPrinter |
| 4835 |
no test coverage detected