MCPcopy Create free account
hub / github.com/ChaiScript/ChaiScript / printTotals

Method printTotals

unittests/catch.hpp:12104–12132  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12102};
12103
12104void 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}
12133void 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];

Callers

nothing calls this directly

Calls 6

ColourClass · 0.85
pluraliseClass · 0.85
SummaryColumnClass · 0.85
totalMethod · 0.80
allPassedMethod · 0.80
addRowMethod · 0.80

Tested by

no test coverage detected