| 12102 | }; |
| 12103 | |
| 12104 | void ConsoleReporter::printTotals( Totals const& totals ) { |
| 12105 | if (totals.testCases.total() == 0) { |
| 12106 | stream << Colour(Colour::Warning) << "No tests ran\n"; |
| 12107 | } else if (totals.assertions.total() > 0 && totals.testCases.allPassed()) { |
| 12108 | stream << Colour(Colour::ResultSuccess) << "All tests passed"; |
| 12109 | stream << " (" |
| 12110 | << pluralise(totals.assertions.passed, "assertion") << " in " |
| 12111 | << pluralise(totals.testCases.passed, "test case") << ')' |
| 12112 | << '\n'; |
| 12113 | } else { |
| 12114 | |
| 12115 | std::vector<SummaryColumn> columns; |
| 12116 | columns.push_back(SummaryColumn("", Colour::None) |
| 12117 | .addRow(totals.testCases.total()) |
| 12118 | .addRow(totals.assertions.total())); |
| 12119 | columns.push_back(SummaryColumn("passed", Colour::Success) |
| 12120 | .addRow(totals.testCases.passed) |
| 12121 | .addRow(totals.assertions.passed)); |
| 12122 | columns.push_back(SummaryColumn("failed", Colour::ResultError) |
| 12123 | .addRow(totals.testCases.failed) |
| 12124 | .addRow(totals.assertions.failed)); |
| 12125 | columns.push_back(SummaryColumn("failed as expected", Colour::ResultExpectedFailure) |
| 12126 | .addRow(totals.testCases.failedButOk) |
| 12127 | .addRow(totals.assertions.failedButOk)); |
| 12128 | |
| 12129 | printSummaryRow("test cases", columns, 0); |
| 12130 | printSummaryRow("assertions", columns, 1); |
| 12131 | } |
| 12132 | } |
| 12133 | void ConsoleReporter::printSummaryRow(std::string const& label, std::vector<SummaryColumn> const& cols, std::size_t row) { |
| 12134 | for (auto col : cols) { |
| 12135 | std::string value = col.rows[row]; |