Branch Coverage

Declare.xs
Criterion Covered Total %
branch 286 356 80.3


line true false branch
25 0 2870 if (c == -1) break;
26 2870 0 if (!isALNUM(c) && c != '_') break;
476 2394 if (!isALNUM(c) && c != '_') break;
476 0 if (!isALNUM(c) && c != '_') break;
30 0 476 if (SvCUR(buf) == 0) {
43 0 243 if (c == -1) break;
44 243 0 if (isALNUM(c) || c == '_') {
41 202 if (isALNUM(c) || c == '_') {
0 41 if (isALNUM(c) || c == '_') {
47 1 40 } else if (c == ':' && PL_parser->bufptr[0] == ':'
1 0 } else if (c == ':' && PL_parser->bufptr[0] == ':'
48 1 0 && PL_parser->bufptr[1] == ':') {
54 1 39 if (SvCUR(buf) == 0) {
66 109 4 if (c == '-' || c == '+') {
1 108 if (c == '-' || c == '+') {
72 159 96 if (c >= '0' && c <= '9') { seen_digit = 1; }
137 22 if (c >= '0' && c <= '9') { seen_digit = 1; }
73 5 113 else if (c == '.' && !seen_dot) {
5 0 else if (c == '.' && !seen_dot) {
76 5 0 char next = (PL_parser->bufptr[0] == '.') ? PL_parser->bufptr[1] : '\0';
77 4 1 if (next < '0' || next > '9') break;
4 0 if (next < '0' || next > '9') break;
80 112 1 else if ((c == 'e' || c == 'E') && seen_digit) {
0 112 else if ((c == 'e' || c == 'E') && seen_digit) {
1 0 else if ((c == 'e' || c == 'E') && seen_digit) {
84 1 0 if (c == '-' || c == '+') {
0 1 if (c == '-' || c == '+') {
94 0 113 if (!seen_digit) {
108 1 237 if (c == -1) croak("switch: unterminated string in case pattern");
109 2 235 if (c == '\\') {
111 0 2 if (next == -1) croak("switch: unterminated string in case pattern");
112 1 1 if (quote == '"') {
122 1 0 if (next != '\\' && next != '\'')
1 0 if (next != '\\' && next != '\'')
126 92 143 } else if (c == quote) {
161 171 192 if (t->kind == SDT_CONST)
181 203 0 SETs(boolSV(sv && SvOK(sv) && looks_like_number(sv)));
197 6 SETs(boolSV(sv && SvOK(sv) && looks_like_number(sv)));
196 1 SETs(boolSV(sv && SvOK(sv) && looks_like_number(sv)));
204 84 28 if (t->lln_mode == LLN_CONST)
205 73 11 return newSVOP(OP_CONST, 0, boolSV(t->lln_const));
224 7 4 SETs(SvROK(sv) ? sv_2mortal(newSVpv(sv_reftype(SvRV(sv), 0), 0))
265 5 3 if (sentinel)
277 114 90 if (c == '"' || c == '\'') {
1 113 if (c == '"' || c == '\'') {
281 108 5 if ((c >= '0' && c <= '9') || c == '-' || c == '+' || c == '.') {
0 108 if ((c >= '0' && c <= '9') || c == '-' || c == '+' || c == '.') {
1 4 if ((c >= '0' && c <= '9') || c == '-' || c == '+' || c == '.') {
0 1 if ((c >= '0' && c <= '9') || c == '-' || c == '+' || c == '.') {
0 0 if ((c >= '0' && c <= '9') || c == '-' || c == '+' || c == '.') {
294 112 90 OP *cmp = newBINOP(is_num ? numop : strop, 0, sd_topic(aTHX_ t), konst);
295 112 90 if (is_num)
328 8 32 if (lex_peek_unichar(0) != '(') return NULL;
332 30 2 if (c == '"' || c == '\'')
0 30 if (c == '"' || c == '\'')
336 0 32 if (!name) croak("switch: expected a name inside (...)");
338 0 32 if (lex_peek_unichar(0) != ')') {
358 16 238 if (c == '/') {
367 1 91 if (c == -1) croak("switch: unterminated regex in case pattern");
368 5 86 if (c == '\\') {
370 0 5 if (n == -1) croak("switch: unterminated regex in case pattern");
375 15 71 if (c == '/') break;
378 8 14 while (isALPHA((c = lex_peek_unichar(0)))) {
402 11 227 if (c == '\\') {
407 1 10 if (lex_peek_unichar(0) != '&')
411 1 9 if (!name) croak("switch: expected sub name after '\\&'");
419 26 201 if (c == '[') {
426 14 12 if (lex_peek_unichar(0) == '.') {
431 1 13 if (lex_peek_unichar(0) != '.')
437 0 13 if (lex_peek_unichar(0) != ']')
451 23 11 if (lex_peek_unichar(0) == ',') lex_read_unichar(0);
453 12 22 if (lex_peek_unichar(0) == ']') { lex_read_unichar(0); break; }
467 143 58 if (isALPHA(c) || c == '_') {
0 143 if (isALPHA(c) || c == '_') {
469 58 0 int is_sub = word && strEQ(SvPV_nolen(word), "sub");
12 46 int is_sub = word && strEQ(SvPV_nolen(word), "sub");
470 58 0 int is_undef = word && strEQ(SvPV_nolen(word), "undef");
6 52 int is_undef = word && strEQ(SvPV_nolen(word), "undef");
471 58 0 int is_ref = word && strEQ(SvPV_nolen(word), "ref");
17 41 int is_ref = word && strEQ(SvPV_nolen(word), "ref");
472 58 0 int is_reftype = word && strEQ(SvPV_nolen(word), "reftype");
11 47 int is_reftype = word && strEQ(SvPV_nolen(word), "reftype");
473 58 0 int is_isa = word && strEQ(SvPV_nolen(word), "isa");
12 46 int is_isa = word && strEQ(SvPV_nolen(word), "isa");
474 58 0 if (word) SvREFCNT_dec(word);
475 6 52 if (is_undef) {
481 17 35 if (is_ref) {
485 5 12 if (!type)
491 11 24 if (is_reftype) {
495 3 8 if (!type)
500 12 12 if (is_isa) {
502 0 12 if (!klass)
507 12 0 if (is_sub) {
511 1 11 if (lex_peek_unichar(0) != '{')
526 80 62 if (!is_num) {
543 0 456 if (!o) return 0;
544 0 456 if (o->op_private & OPpLVAL_INTRO) return 1;
545 27 429 if (o->op_flags & OPf_KIDS) {
546 29 27 for (kid = cUNOPx(o)->op_first; kid; kid = OpSIBLING(kid))
56 27 for (kid = cUNOPx(o)->op_first; kid; kid = OpSIBLING(kid))
547 0 56 if (sd_has_intro(aTHX_ kid)) return 1;
558 407 0 if (block->op_type == OP_LINESEQ) {
560 407 0 if (first
561 0 407 && (first->op_type == OP_NEXTSTATE || first->op_type == OP_DBSTATE)
0 0 && (first->op_type == OP_NEXTSTATE || first->op_type == OP_DBSTATE)
562 407 0 && OpSIBLING(first) && !OpSIBLING(OpSIBLING(first))
407 0 && OpSIBLING(first) && !OpSIBLING(OpSIBLING(first))
407 0 && OpSIBLING(first) && !OpSIBLING(OpSIBLING(first))
7 400 && OpSIBLING(first) && !OpSIBLING(OpSIBLING(first))
7 0 && OpSIBLING(first) && !OpSIBLING(OpSIBLING(first))
0 7 && OpSIBLING(first) && !OpSIBLING(OpSIBLING(first))
563 400 0 && !sd_has_intro(aTHX_ OpSIBLING(first))) {
400 0 && !sd_has_intro(aTHX_ OpSIBLING(first))) {
564 400 0 OP *expr = OpSIBLING(first);
606 1 175 if (lex_peek_unichar(0) != '(')
611 0 175 if (lex_peek_unichar(0) != ')')
621 38 137 if (scrutinee->op_type == OP_PADSV
622 38 0 && !(scrutinee->op_private & OPpLVAL_INTRO)) {
628 114 23 else if (scrutinee->op_type == OP_CONST) {
648 114 61 topic_maybe_undef = !(topic.kind == SDT_CONST && SvOK(topic.sv));
0 114 topic_maybe_undef = !(topic.kind == SDT_CONST && SvOK(topic.sv));
654 114 61 if (topic.kind == SDT_CONST && SvOK(topic.sv)) {
114 0 if (topic.kind == SDT_CONST && SvOK(topic.sv)) {
668 0 175 if (lex_peek_unichar(0) != '{')
676 164 418 if (c == '}') { lex_read_unichar(0); break; }
677 0 418 if (c == -1) croak("switch: unexpected end of input in switch body");
680 0 418 if (!kw) croak("switch: expected 'case' or 'default'");
682 255 163 if (strEQ(SvPV_nolen(kw), "case")) {
686 1 254 if (default_block)
688 0 254 if (narms >= MAX_ARMS)
698 109 138 if (topic_maybe_undef && !pat.undef_safe)
51 58 if (topic_maybe_undef && !pat.undef_safe)
703 1 246 if (lex_peek_unichar(0) != '{')
711 226 20 ? ((SVOP *)blk)->op_sv : NULL;
713 80 166 if (!pat.key || !vals[narms]) dispatchable = 0;
13 67 if (!pat.key || !vals[narms]) dispatchable = 0;
716 162 1 else if (strEQ(SvPV_nolen(kw), "default")) {
717 1 161 if (default_block)
720 0 161 if (lex_peek_unichar(0) != '{')
735 3 161 if (narms == 0 && !default_block)
1 2 if (narms == 0 && !default_block)
743 24 139 if (dispatchable && narms >= SD_DISPATCH_MIN) {
9 15 if (dispatchable && narms >= SD_DISPATCH_MIN) {
749 9 0 HV *hv = GvHVn(gv);
756 5 4 ? newSVpvn("\1\0Switch::Declare::undef-key\0\1", 28) : NULL;
757 36 8 for (i = 0; i < narms; i++) {
760 1 35 if (hv_exists(hv, kpv, klen)) { dup = 1; break; }
761 0 35 if (!SvOK(vals[i])) any_undef = 1;
764 8 1 if (!dup && sentinel) {
5 3 if (!dup && sentinel) {
767 0 5 if (hv_exists(hv, sp, sl)) dup = 1;
769 1 8 if (dup) {
773 1 7 : newOP(OP_UNDEF, 0);
774 0 8 if (any_undef) {
784 33 8 for (i = 0; i < narms; i++) { op_free(conds[i]); op_free(blocks[i]); }
786 5 4 if (sentinel) SvREFCNT_dec(sentinel);
790 155 8 if (!chain) {
792 3 152 : newOP(OP_UNDEF, 0);
793 212 155 for (i = narms - 1; i >= 0; i--)
797 245 163 for (i = 0; i < narms; i++)
798 80 165 if (keys[i]) SvREFCNT_dec(keys[i]);
802 61 102 if (topic.lln_mode == LLN_PAD && topic.lln_used) {
17 44 if (topic.lln_mode == LLN_PAD && topic.lln_used) {
810 140 23 if (topic.kind != SDT_TEMP) {
811 102 38 if (topic.kind == SDT_CONST) SvREFCNT_dec(topic.sv);
812 128 12 if (!lln_prelude && all_simple)
123 5 if (!lln_prelude && all_simple)
818 12 5 if (lln_prelude) {
844 5 18 if (lln_prelude)
860 0 179 if (!hints) return 0;
862 176 3 return ent && SvTRUE(*ent);
176 0 return ent && SvTRUE(*ent);
866 18146 94656 if (kwlen == 6 && memEQ(kw, "switch", 6) && sd_in_scope(aTHX)) {
179 17967 if (kwlen == 6 && memEQ(kw, "switch", 6) && sd_in_scope(aTHX)) {
176 3 if (kwlen == 6 && memEQ(kw, "switch", 6) && sd_in_scope(aTHX)) {
895 6 6 RETVAL = (sv_isobject(obj)
896 8 4 && sv_derived_from(obj, SvPV_nolen(klass))) ? 1 : 0;
6 2 && sv_derived_from(obj, SvPV_nolen(klass))) ? 1 : 0;