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

Function printTotals

extern/Catch2/catch.hpp:15865–15895  ·  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

15863// - red: Failed N tests cases, failed M assertions.
15864// - green: Passed [both/all] N tests cases with M assertions.
15865void printTotals(std::ostream& out, const Totals& totals) {
15866 if (totals.testCases.total() == 0) {
15867 out << "No tests ran.";
15868 } else if (totals.testCases.failed == totals.testCases.total()) {
15869 Colour colour(Colour::ResultError);
15870 const std::string qualify_assertions_failed =
15871 totals.assertions.failed == totals.assertions.total() ?
15872 bothOrAll(totals.assertions.failed) : std::string();
15873 out <<
15874 "Failed " << bothOrAll(totals.testCases.failed)
15875 << pluralise(totals.testCases.failed, "test case") << ", "
15876 "failed " << qualify_assertions_failed <<
15877 pluralise(totals.assertions.failed, "assertion") << '.';
15878 } else if (totals.assertions.total() == 0) {
15879 out <<
15880 "Passed " << bothOrAll(totals.testCases.total())
15881 << pluralise(totals.testCases.total(), "test case")
15882 << " (no assertions).";
15883 } else if (totals.assertions.failed) {
15884 Colour colour(Colour::ResultError);
15885 out <<
15886 "Failed " << pluralise(totals.testCases.failed, "test case") << ", "
15887 "failed " << pluralise(totals.assertions.failed, "assertion") << '.';
15888 } else {
15889 Colour colour(Colour::ResultSuccess);
15890 out <<
15891 "Passed " << bothOrAll(totals.testCases.passed)
15892 << pluralise(totals.testCases.passed, "test case") <<
15893 " with " << pluralise(totals.assertions.passed, "assertion") << '.';
15894 }
15895}
15896
15897// Implementation of CompactReporter formatting
15898class AssertionPrinter {

Callers 2

testRunEndedMethod · 0.85
testGroupEndedMethod · 0.85

Calls 4

bothOrAllFunction · 0.85
stringFunction · 0.85
pluraliseClass · 0.85
totalMethod · 0.45

Tested by

no test coverage detected