MCPcopy Create free account
hub / github.com/InteractiveComputerGraphics/TriangleMeshDistance / printTotals

Function printTotals

tests/catch.hpp:12834–12864  ·  view source on GitHub ↗

Colour, message variants: - white: No tests ran. - red: Failed [both/all] N test cases, failed [both/all] M assertions. - white: Passed [both/all] N test cases (no assertions). - red: Failed N tests cases, failed M assertions. - green: Passed [both/all] N tests cases with M assertions.

Source from the content-addressed store, hash-verified

12832// - red: Failed N tests cases, failed M assertions.
12833// - green: Passed [both/all] N tests cases with M assertions.
12834void printTotals(std::ostream& out, const Totals& totals) {
12835 if (totals.testCases.total() == 0) {
12836 out << "No tests ran.";
12837 } else if (totals.testCases.failed == totals.testCases.total()) {
12838 Colour colour(Colour::ResultError);
12839 const std::string qualify_assertions_failed =
12840 totals.assertions.failed == totals.assertions.total() ?
12841 bothOrAll(totals.assertions.failed) : std::string();
12842 out <<
12843 "Failed " << bothOrAll(totals.testCases.failed)
12844 << pluralise(totals.testCases.failed, "test case") << ", "
12845 "failed " << qualify_assertions_failed <<
12846 pluralise(totals.assertions.failed, "assertion") << '.';
12847 } else if (totals.assertions.total() == 0) {
12848 out <<
12849 "Passed " << bothOrAll(totals.testCases.total())
12850 << pluralise(totals.testCases.total(), "test case")
12851 << " (no assertions).";
12852 } else if (totals.assertions.failed) {
12853 Colour colour(Colour::ResultError);
12854 out <<
12855 "Failed " << pluralise(totals.testCases.failed, "test case") << ", "
12856 "failed " << pluralise(totals.assertions.failed, "assertion") << '.';
12857 } else {
12858 Colour colour(Colour::ResultSuccess);
12859 out <<
12860 "Passed " << bothOrAll(totals.testCases.passed)
12861 << pluralise(totals.testCases.passed, "test case") <<
12862 " with " << pluralise(totals.assertions.passed, "assertion") << '.';
12863 }
12864}
12865
12866// Implementation of CompactReporter formatting
12867class AssertionPrinter {

Callers 2

testRunEndedMethod · 0.85
testGroupEndedMethod · 0.85

Calls 3

bothOrAllFunction · 0.85
pluraliseClass · 0.85
totalMethod · 0.80

Tested by

no test coverage detected