| 13620 | }; |
| 13621 | |
| 13622 | void ConsoleReporter::printTotals( Totals const& totals ) { |
| 13623 | if (totals.testCases.total() == 0) { |
| 13624 | stream << Colour(Colour::Warning) << "No tests ran\n"; |
| 13625 | } else if (totals.assertions.total() > 0 && totals.testCases.allPassed()) { |
| 13626 | stream << Colour(Colour::ResultSuccess) << "All tests passed"; |
| 13627 | stream << " (" |
| 13628 | << pluralise(totals.assertions.passed, "assertion") << " in " |
| 13629 | << pluralise(totals.testCases.passed, "test case") << ')' |
| 13630 | << '\n'; |
| 13631 | } else { |
| 13632 | |
| 13633 | std::vector<SummaryColumn> columns; |
| 13634 | columns.push_back(SummaryColumn("", Colour::None) |
| 13635 | .addRow(totals.testCases.total()) |
| 13636 | .addRow(totals.assertions.total())); |
| 13637 | columns.push_back(SummaryColumn("passed", Colour::Success) |
| 13638 | .addRow(totals.testCases.passed) |
| 13639 | .addRow(totals.assertions.passed)); |
| 13640 | columns.push_back(SummaryColumn("failed", Colour::ResultError) |
| 13641 | .addRow(totals.testCases.failed) |
| 13642 | .addRow(totals.assertions.failed)); |
| 13643 | columns.push_back(SummaryColumn("failed as expected", Colour::ResultExpectedFailure) |
| 13644 | .addRow(totals.testCases.failedButOk) |
| 13645 | .addRow(totals.assertions.failedButOk)); |
| 13646 | |
| 13647 | printSummaryRow("test cases", columns, 0); |
| 13648 | printSummaryRow("assertions", columns, 1); |
| 13649 | } |
| 13650 | } |
| 13651 | void ConsoleReporter::printSummaryRow(std::string const& label, std::vector<SummaryColumn> const& cols, std::size_t row) { |
| 13652 | for (auto col : cols) { |
| 13653 | std::string value = col.rows[row]; |