Branch Coverage

Catch.xs
Criterion Covered Total %
branch 124 318 38.9


line true false branch
30 0 0 if (result.isOk()) printIssue(" # TODO");
0 0 if (result.isOk()) printIssue(" # TODO");
0 0 if (result.isOk()) printIssue(" # TODO");
34 0 0 printIssue("unexpected exception ");
0 0 printIssue("unexpected exception ");
39 0 0 printIssue("fatal error condition with message:");
0 0 printIssue("fatal error condition with message:");
45 0 0 printIssue("expected exception, got none");
0 0 printIssue("expected exception, got none");
60 0 0 printIssue("explicitly");
0 0 printIssue("explicitly");
75 3 132 while (pos < expr.length()) {
86 0 0 if (!result.hasExpression()) return;
92 50 0 if (result.hasExpression()) stream << " " << result.getExpression();
50 0 if (result.hasExpression()) stream << " " << result.getExpression();
50 0 if (result.hasExpression()) stream << " " << result.getExpression();
96 50 0 if (!result.hasExpandedExpression()) return;
17 33 if (!result.hasExpandedExpression()) return;
97 33 0 stream << " for: ";
98 33 0 string expr = result.getExpandedExpression();
100 33 0 expr_replace(expr, "\"\r\n==\r\n\"", "\" == \"");
33 0 expr_replace(expr, "\"\r\n==\r\n\"", "\" == \"");
33 0 expr_replace(expr, "\"\r\n==\r\n\"", "\" == \"");
101 33 0 expr_replace(expr, "\"\n==\n\"", "\" == \"");
33 0 expr_replace(expr, "\"\n==\n\"", "\" == \"");
33 0 expr_replace(expr, "\"\n==\n\"", "\" == \"");
103 33 0 expr_replace(expr, "\r", "\\r");
33 0 expr_replace(expr, "\r", "\\r");
33 0 expr_replace(expr, "\r", "\\r");
104 33 0 expr_replace(expr, "\n", "\\n");
33 0 expr_replace(expr, "\n", "\\n");
33 0 expr_replace(expr, "\n", "\\n");
105 33 0 stream << expr;
109 0 0 if (itMessage != messages.end()) {
116 50 0 if (itMessage == messages.cend()) return;
120 0 0 const size_t N = static_cast(std::distance(itMessage, itEnd));
122 0 0 stream << " with " << pluralise( N, "message" ) << ":";
0 0 stream << " with " << pluralise( N, "message" ) << ":";
0 0 stream << " with " << pluralise( N, "message" ) << ":";
0 0 stream << " with " << pluralise( N, "message" ) << ":";
0 0 stream << " with " << pluralise( N, "message" ) << ":";
124 0 0 for (; itMessage != itEnd; ++itMessage) {
126 0 0 if (itMessage->type != ResultWas::Info) {
127 0 0 stream << "\n# " << itMessage->message;
0 0 stream << "\n# " << itMessage->message;
139 0 5 struct PerlReporter : IStreamingReporter {
140 5 0 struct Scope {
149 0 0 static string getDescription () { return "Reports test results in perl test-harness compatible format"; }
152 5 0 : scope(), sliding_scope(), fatal(), config(_config.fullConfig()), stream(_config.stream())
5 0 : scope(), sliding_scope(), fatal(), config(_config.fullConfig()), stream(_config.stream())
184 0 13 if (fatal) {
192 21 22 if (sliding_scope && sliding_scope->name == info.name) {
12 9 if (sliding_scope && sliding_scope->name == info.name) {
12 31 if (sliding_scope && sliding_scope->name == info.name) {
201 31 0 startLine();
202 18 13 auto fullname = scope->fullname.length() ? (scope->fullname + " / " + info.name) : info.name;
18 0 auto fullname = scope->fullname.length() ? (scope->fullname + " / " + info.name) : info.name;
18 0 auto fullname = scope->fullname.length() ? (scope->fullname + " / " + info.name) : info.name;
13 0 auto fullname = scope->fullname.length() ? (scope->fullname + " / " + info.name) : info.name;
18 13 auto fullname = scope->fullname.length() ? (scope->fullname + " / " + info.name) : info.name;
0 0 auto fullname = scope->fullname.length() ? (scope->fullname + " / " + info.name) : info.name;
203 31 0 stream << "# Subtest: " << fullname << endl;
31 0 stream << "# Subtest: " << fullname << endl;
31 0 stream << "# Subtest: " << fullname << endl;
204 31 0 scopes.push_back({0, 0, scope->depth + 1, info.name, fullname});
31 0 scopes.push_back({0, 0, scope->depth + 1, info.name, fullname});
31 0 scopes.push_back({0, 0, scope->depth + 1, info.name, fullname});
209 0 43 if (fatal) return;
210 22 21 if (!sliding_scope) sliding_scope = scope + 1;
212 22 21 if (sliding_scope == &scopes[1]) commitAssertions();
216 22 22 if (!sliding_scope) return;
218 31 22 while (cnt--) closeCurrentScope();
223 31 0 auto name = scope->fullname;
225 31 0 startLine() << "1.." << scope->count << endl;
31 0 startLine() << "1.." << scope->count << endl;
31 0 startLine() << "1.." << scope->count << endl;
31 0 startLine() << "1.." << scope->count << endl;
226 0 31 if (scope->failed) {
227 0 0 startErrorLine() << "# Looks like you failed " << scope->failed << " test of " << scope->count << " at [" << name << "]." << endl;
0 0 startErrorLine() << "# Looks like you failed " << scope->failed << " test of " << scope->count << " at [" << name << "]." << endl;
0 0 startErrorLine() << "# Looks like you failed " << scope->failed << " test of " << scope->count << " at [" << name << "]." << endl;
0 0 startErrorLine() << "# Looks like you failed " << scope->failed << " test of " << scope->count << " at [" << name << "]." << endl;
0 0 startErrorLine() << "# Looks like you failed " << scope->failed << " test of " << scope->count << " at [" << name << "]." << endl;
0 0 startErrorLine() << "# Looks like you failed " << scope->failed << " test of " << scope->count << " at [" << name << "]." << endl;
0 0 startErrorLine() << "# Looks like you failed " << scope->failed << " test of " << scope->count << " at [" << name << "]." << endl;
0 0 startErrorLine() << "# Looks like you failed " << scope->failed << " test of " << scope->count << " at [" << name << "]." << endl;
0 0 startErrorLine() << "# Looks like you failed " << scope->failed << " test of " << scope->count << " at [" << name << "]." << endl;
231 0 31 if (scopes.empty()) throw "WTF?";
235 31 0 startLine();
236 0 31 if (failed) {
238 0 0 stream << "not ok";
240 31 0 else stream << "ok";
241 31 0 stream << " " << scope->count << " - [" << name << "]" << endl;
31 0 stream << " " << scope->count << " - [" << name << "]" << endl;
31 0 stream << " " << scope->count << " - [" << name << "]" << endl;
31 0 stream << " " << scope->count << " - [" << name << "]" << endl;
31 0 stream << " " << scope->count << " - [" << name << "]" << endl;
31 0 stream << " " << scope->count << " - [" << name << "]" << endl;
245 353 143 for (size_t i = 0; i < scope->depth; ++i) stream << " ";
250 0 0 for (size_t i = 0; i < scope->depth; ++i) std::cerr << " ";
257 50 0 ostringstream s;
258 50 0 Printer(s, stats).print();
50 0 Printer(s, stats).print();
259 50 0 assertions.push_back({stats, s.str()});
50 0 assertions.push_back({stats, s.str()});
50 0 assertions.push_back({stats, s.str()});
264 50 22 for (auto& row : assertions) {
266 50 0 auto result = stats.assertionResult;
268 50 0 bool is_test = result.getResultType() != ResultWas::Info && result.getResultType() != ResultWas::Warning;
50 0 bool is_test = result.getResultType() != ResultWas::Info && result.getResultType() != ResultWas::Warning;
50 0 bool is_test = result.getResultType() != ResultWas::Info && result.getResultType() != ResultWas::Warning;
50 0 bool is_test = result.getResultType() != ResultWas::Info && result.getResultType() != ResultWas::Warning;
271 50 0 ostream& ss = result.succeeded() ? startLine() : startErrorLine();
50 0 ostream& ss = result.succeeded() ? startLine() : startErrorLine();
50 0 ostream& ss = result.succeeded() ? startLine() : startErrorLine();
0 0 ostream& ss = result.succeeded() ? startLine() : startErrorLine();
273 50 0 if (is_test) {
275 50 0 if (result.succeeded()) {
50 0 if (result.succeeded()) {
276 50 0 ss << "ok";
279 0 0 ss << "not ok";
282 50 0 ss << " " << scope->count << " -";
50 0 ss << " " << scope->count << " -";
50 0 ss << " " << scope->count << " -";
286 50 0 Colour cg(color); (void)cg;
287 50 0 ss << row.expr;
288 50 0 ss << " # at " << result.getSourceInfo();
50 0 ss << " # at " << result.getSourceInfo();
50 0 ss << " # at " << result.getSourceInfo();
291 50 0 ss << endl;
293 50 0 if (is_test && !result.succeeded()) {
50 0 if (is_test && !result.succeeded()) {
0 50 if (is_test && !result.succeeded()) {
0 50 if (is_test && !result.succeeded()) {
294 0 0 startErrorLine() << "#\e[1;31m Failed test in section [" << scope->fullname << "] at " << result.getSourceInfo() << "\e[0m" << endl;
0 0 startErrorLine() << "#\e[1;31m Failed test in section [" << scope->fullname << "] at " << result.getSourceInfo() << "\e[0m" << endl;
0 0 startErrorLine() << "#\e[1;31m Failed test in section [" << scope->fullname << "] at " << result.getSourceInfo() << "\e[0m" << endl;
0 0 startErrorLine() << "#\e[1;31m Failed test in section [" << scope->fullname << "] at " << result.getSourceInfo() << "\e[0m" << endl;
0 0 startErrorLine() << "#\e[1;31m Failed test in section [" << scope->fullname << "] at " << result.getSourceInfo() << "\e[0m" << endl;
0 0 startErrorLine() << "#\e[1;31m Failed test in section [" << scope->fullname << "] at " << result.getSourceInfo() << "\e[0m" << endl;
0 0 startErrorLine() << "#\e[1;31m Failed test in section [" << scope->fullname << "] at " << result.getSourceInfo() << "\e[0m" << endl;
0 0 startErrorLine() << "#\e[1;31m Failed test in section [" << scope->fullname << "] at " << result.getSourceInfo() << "\e[0m" << endl;
310 12 0 struct AData {
327 1 0 CATCH_REGISTER_REPORTER("perl", PerlReporter);
1 0 CATCH_REGISTER_REPORTER("perl", PerlReporter);
335 5 0 std::vector argv = {"test"};
337 4 5 for (int i = 3; i < items; ++i) {
339 0 4 if (!SvOK(arg)) continue;
0 0 if (!SvOK(arg)) continue;
0 0 if (!SvOK(arg)) continue;
340 4 0 argv.push_back(SvPV_nolen(arg));
0 0 argv.push_back(SvPV_nolen(arg));
4 0 argv.push_back(SvPV_nolen(arg));
343 5 0 argv.push_back("-i");
345 5 0 session.useConfigData({});
346 5 0 err = session.applyCommandLine(argv.size(), argv.data());
348 0 5 if (err) croak("session.applyCommandLine: error %d", err);
350 0 5 PerlReporter::context.count = SvUV(count);
351 0 5 PerlReporter::context.failed = SvUV(failed);