Branch Coverage

blib/lib/JSON/backportPP.pm
Criterion Covered Total %
branch 487 630 77.3


line true false branch
83 0 2 defined $_[1] ? :
2 0 if ($enable) { }
1 0 defined $_[1] ? :
1 0 if ($enable) { }
3 7 defined $_[1] ? :
7 3 if ($enable) { }
24623 24 defined $_[1] ? :
9279 15368 if ($enable) { }
0 1 defined $_[1] ? :
1 0 if ($enable) { }
0 0 defined $_[1] ? :
0 0 if ($enable) { }
2 1 defined $_[1] ? :
2 1 if ($enable) { }
0 0 defined $_[1] ? :
0 0 if ($enable) { }
4 12294 defined $_[1] ? :
12296 2 if ($enable) { }
5 10 defined $_[1] ? :
13 2 if ($enable) { }
4 8 defined $_[1] ? :
9 3 if ($enable) { }
0 1 defined $_[1] ? :
1 0 if ($enable) { }
0 0 $_[0]{'PROPS'}[14] ? :
0 0 $_[0]{'PROPS'}[13] ? :
4 3 $_[0]{'PROPS'}[9] ? :
5 2 $_[0]{'PROPS'}[7] ? :
0 0 $_[0]{'PROPS'}[15] ? :
0 0 $_[0]{'PROPS'}[19] ? :
0 0 $_[0]{'PROPS'}[18] ? :
0 0 $_[0]{'PROPS'}[17] ? :
4 3 $_[0]{'PROPS'}[0] ? :
4 3 $_[0]{'PROPS'}[4] ? :
4 3 $_[0]{'PROPS'}[10] ? :
0 0 $_[0]{'PROPS'}[16] ? :
4 3 $_[0]{'PROPS'}[3] ? :
4 3 $_[0]{'PROPS'}[1] ? :
0 0 $_[0]{'PROPS'}[12] ? :
4 3 $_[0]{'PROPS'}[11] ? :
4 3 $_[0]{'PROPS'}[8] ? :
4 3 $_[0]{'PROPS'}[6] ? :
4 3 $_[0]{'PROPS'}[5] ? :
4 276 $_[0]{'PROPS'}[2] ? :
8 4 defined $_[1] ? :
8 4 if ($enable) { }
2 6 defined $_[1] ? :
6 2 if ($enable) { }
0 0 defined $_[1] ? :
0 0 if ($enable) { }
2 18 defined $_[1] ? :
18 2 if ($enable) { }
2 21508 defined $_[1] ? :
21508 2 if ($enable) { }
9 4 defined $_[1] ? :
8 5 if ($enable) { }
8 4 defined $_[1] ? :
8 4 if ($enable) { }
6 18497 defined $_[1] ? :
18501 2 if ($enable) { }
170 5 0 defined $v ? :
172 3 2 if ($enable) { }
185 6 1 defined $_[1] ? :
195 4 1 defined $_[1] ? :
205 0 0 if (@_) { }
211 0 0 if (builtin::is_bool($true) and builtin::is_bool($false) and $true and not $false) { }
228 0 0 defined $_[0] ? :
229 0 0 if ($core_bools) { }
259 0 0 if (exists $self->{'true'} and exists $self->{'false'})
266 2 1 if (defined $_[1] and ref $_[1] eq 'CODE') { }
271 3 0 $_[0]{'cb_object'} || $_[0]{'cb_sk_object'} ? :
276 0 4 if (@_ == 1 or @_ > 3)
279 3 1 if (defined $_[2] and ref $_[2] eq 'CODE') { }
283 0 1 unless $_[0]{'cb_sk_object'}
0 1 unless %{{} unless $_[0]{'cb_sk_object'};}
285 4 0 $_[0]{'cb_object'} || $_[0]{'cb_sk_object'} ? :
290 0 0 if (not defined $_[1] or $_[1] > 15 or $_[1] < 0) { }
304 3 0 defined $_[1] ? :
331 246 24879 $self->{'PROPS'}[4] ? :
333 3 25122 if ($self->{'sort_by'})
336 1 1 $self->{'sort_by'} =~ /\D+/ ? :
1 2 ref $self->{'sort_by'} eq 'CODE' ? :
339 0 60 unless ref $obj or $props->[7]
344 7 25100 if $self->{'PROPS'}[3]
354 343 25137 if ($type eq 'HASH') { }
25019 118 elsif ($type eq 'ARRAY') { }
54 64 elsif ($type) { }
361 34 20 if (builtin::blessed($obj)) { }
363 18 16 if $obj->isa("JSON::PP::Boolean")
365 0 16 if ($self->{'PROPS'}[19] and $obj->can("FREEZE"))
369 0 0 if (@results and ref $results[0])
370 0 0 if (builtin::refaddr($obj) eq builtin::refaddr($results[0]))
380 8 8 if ($self->{'PROPS'}[10] and $obj->can("TO_JSON"))
382 4 4 if (defined $result and ref $result)
383 1 3 if (builtin::refaddr($obj) eq builtin::refaddr($result))
394 2 6 if $self->{'PROPS'}[13] and _is_bignum($obj)
396 4 2 if ($self->{'PROPS'}[9])
397 0 4 if $self->{'PROPS'}[17]
418 1 342 if ++$self->{'depth'} > $self->{'max_depth'}
420 7 335 $self->{'PROPS'}[3] ? :
421 5 337 $self->{'PROPS'}[5] ? :
5 337 $self->{'PROPS'}[6] ? :
426 33 630 ref $obj->{$k} ? :
430 7 333 if $self->{'PROPS'}[3]
432 10 330 unless @res
442 1 25018 if ++$self->{'depth'} > $self->{'max_depth'}
444 2 25016 $self->{'PROPS'}[3] ? :
447 315 25492 ref $v ? :
451 2 25002 if $self->{'PROPS'}[3]
453 10 24994 unless @res
454 0 24994 $pre eq '' && $self->{'PROPS'}[6] ? :
468 12487 13648 if utf8::is_utf8($value)
473 12851 797 unless length((my $dummy = "") & $value)
474 0 797 unless 0 + $value eq $value
475 797 0 if $value * 0 == 0
483 45 26179 unless defined $value
487 26141 38 if (not $type) { }
18 20 elsif (builtin::blessed($value) and $value->isa('JSON::PP::Boolean')) { }
489 6 26135 if (builtin::is_bool($value)) { }
797 25338 elsif (_looks_like_number($value)) { }
490 3 3 $value ? :
498 9 9 $$value == 1 ? :
501 0 20 if ((overload::StrVal($value) =~ /=(\w+)/)[0])
505 7 13 if ($type eq "SCALAR" and defined $$value)
508 1 4 $self->{'PROPS'}[18] ? :
1 5 $$value eq '0' ? :
1 6 $$value eq '1' ? :
512 4 9 if ($self->{'PROPS'}[18]) { }
516 6 3 if ($type eq 'SCALAR' or $type eq 'REF') { }
544 1 26000 if $self->{'PROPS'}[16]
549 12297 13704 if ($self->{'PROPS'}[0])
553 2 25999 if ($self->{'PROPS'}[1])
557 12545 13456 if ($self->{'PROPS'}[2])
567 0 0 if ($reftype eq 'HASH') { }
0 0 elsif ($reftype eq 'ARRAY') { }
588 222 120 defined $keysort ? :
616 2312298 1127735 $_ <= 65535 ? :
2824908 3440033 if (chr($_) =~ /[[:ascii:]]/) { }
628 1 0 $_ <= 65535 ? :
21 1 if ($_ <= 255) { }
644 1 1 unless $_[0]->isa("Math::BigInt")
660 57 912 if ($int =~ /[eE]/)
683 15 12438 unless defined $octets[3]
684 0 0 !$octets[2] ? :
2 0 $octets[2] ? :
0 2 !($octets[0] || $octets[1]) ? :
1 2 !$octets[0] && $octets[1] ? :
12435 3 $octets[0] && $octets[1] ? :
697 4 25261 if (not defined $text or ref $text)
703 12453 12808 if ($self->{'PROPS'}[2]) { }
705 3 12450 if ($encoding ne 'UTF-8' and $encoding ne 'unknown') { }
709 0 12450 unless utf8::downgrade($text, 1)
719 2 25259 if ($self->{'max_size'} > 1)
725 1 1 if $bytes > $self->{'max_size'}
730 2 25258 unless defined $self->{'ch'}
734 4 198 unless ($props->[7] or ref $result)
740 0 25184 if $self->{'len'} < $self->{'at'}
742 293 24891 defined $self->{'ch'} ? :
746 275 24909 if $want_offset
748 7 24902 if defined $self->{'ch'}
756 25085 36689249 if $self->{'at'} >= $self->{'len'}
765 0 55786 unless defined $ch
766 2170 53616 if $ch eq "{"
767 26287 27329 if $ch eq "["
768 0 27329 if $ch eq "("
769 26352 977 if $ch eq "\"" or $self->{'PROPS'}[15] and $ch eq "'"
770 891 86 if $ch =~ /[0-9]/ or $ch eq "-"
784 29806 5 if ($ch eq "\"" or $self->{'PROPS'}[15] and $ch eq "'")
789 29791 10642758 if ($ch eq $boundChar) { }
5302021 5340737 elsif ($ch eq '\\') { }
792 1 29790 if ($utf16)
796 24802 4988 if $is_utf8
802 153373 5148648 if (exists $escapes{$ch}) { }
5148644 4 elsif ($ch eq 'u') { }
810 0 20594576 unless $ch =~ /[0-9a-fA-F]/
815 1127737 4020907 if ($u =~ /^[dD][89abAB][0-9a-fA-F]{2}/) { }
1127736 2893171 elsif ($u =~ /^[dD][c-fC-F][0-9a-fA-F]{2}/) { }
820 1 1127735 unless (defined $utf16)
828 1 2893170 if (defined $utf16)
833 2893170 0 if (chr $u =~ /[[:^ascii:]]/) { }
844 4 0 unless ($self->{'PROPS'}[12])
853 3440092 1900645 if ($ch =~ /[[:^ascii:]]/)
854 3440088 4 if ($ch = $self->_is_valid_utf8($ch, \$utf8_len)) { }
865 5340733 0 unless ($self->{'PROPS'}[12])
866 4 5340729 if ($ch =~ /$invalid_char_re/)
867 4 0 if (not $self->{'PROPS'}[11] or $ch ne "\t")
889 52590 144632 if ($ch eq '' or $ch =~ /\A[ \t\r\n]\z/) { }
0 144632 elsif ($self->{'PROPS'}[11] and $ch eq '/') { }
894 0 0 if (defined $ch and $ch eq '/') { }
0 0 elsif (defined $ch and $ch eq '*') { }
900 0 0 if (defined $ch) { }
901 0 0 if ($ch eq '*') { }
902 0 0 if (defined($ch = $self->_next_chr) and $ch eq "/")
923 9 144623 if ($self->{'PROPS'}[11] and $ch eq "#")
942 3 26284 if ++$self->{'depth'} > $self->{'max_depth'}
948 22 26262 if (defined $ch and $ch eq ']') { }
960 3 26505 unless (defined $ch)
964 25688 817 if ($ch eq "]")
970 2 815 if ($ch ne ",")
978 2 813 if ($self->{'PROPS'}[11] and $ch eq "]")
987 2 3 if defined $ch and $ch ne ""
993 0 0 unless $self->{'PROPS'}[19]
999 0 0 unless defined $tag
1000 0 0 if ref $tag
1005 0 0 if (not defined $ch or $ch ne ")")
1013 0 0 unless defined $val
1014 0 0 unless ref $val eq "ARRAY"
1016 0 0 unless (eval { do { $tag->can("THAW") } })
1017 0 0 if $@
1029 0 2170 if ++$self->{'depth'} > $self->{'max_depth'}
1034 8 2162 if (defined $ch and $ch eq '}') { }
1037 1 7 if ($self->{'F_HOOK'})
1044 2 3459 $self->{'PROPS'}[14] && $ch ne '"' && $ch ne q['] ? :
1048 3 3453 if (not defined $ch or $ch ne ":")
1058 1 2935 unless defined $ch
1060 1630 1305 if ($ch eq "}")
1063 8 1622 if ($self->{'F_HOOK'})
1069 4 1301 if ($ch ne ",")
1077 1 1300 if ($self->{'PROPS'}[11] and $ch eq "}")
1080 0 1 if ($self->{'F_HOOK'})
1090 4 2 if defined $ch and $ch ne ""
1111 11 75 if ($word eq 'true') { }
46 29 elsif ($word eq 'null') { }
8 21 elsif ($word eq 'fals') { }
1114 0 11 defined $self->{'true'} ? :
1123 8 0 if (substr($self->{'text'}, $self->{'at'}, 1) eq "e")
1126 0 8 defined $self->{'false'} ? :
1132 1 20 if $word =~ /^n/
1133 1 19 if $word =~ /^t/
1134 0 19 if $word =~ /^f/
1147 41 850 if ($ch eq "-")
1150 1 40 unless (defined $ch and $ch =~ /\d/)
1156 81 809 if ($ch eq 0)
1158 5 76 if ($peek =~ /^[0-9a-dfA-DF]/)
1170 27 858 if (defined $ch and $ch eq ".")
1175 1 26 if (not defined $ch && $ch =~ /\d/) { }
1187 36 841 if (defined $ch and $ch eq 'e' || $ch eq 'E')
1192 16 20 if (defined $ch and $ch eq '+' || $ch eq '-') { }
18 2 elsif (defined $ch and $ch =~ /\d/) { }
1195 2 14 if (not defined $ch or $ch =~ /\D/)
1215 48 832 if ($is_dec or $is_exp) { }
1216 1 47 if ($self->{'PROPS'}[13])
1221 1 831 if (length $v > $max_intsize)
1222 1 0 if ($self->{'PROPS'}[13]) { }
1232 25 853 $is_dec ? :
1256 7 3440085 if $limit > length $start_point
1266 3440088 1239100 if (utf8::decode($copy))
1292 84 4 defined $self->{'text'} ? :
1298 0 15 $chr_c eq '\\f' ? :
0 15 $chr_c eq '\\r' ? :
0 15 $chr_c eq '\\n' ? :
0 15 $chr_c eq '\\t' ? :
0 15 $chr_c eq '\\a' ? :
382 15 $chr_c =~ /[[:print:]]/ ? :
6 397 $chr_c eq '\\' ? :
1307 10 393 if (length $mess >= 20)
1313 26 62 unless (length $mess)
1318 5 83 $no_rep ? :
1329 4 1 if ($self->{'cb_sk_object'} and @ks == 1 and exists $self->{'cb_sk_object'}{$ks[0]} and ref $self->{'cb_sk_object'}{$ks[0]})
1331 1 3 if (@val == 0) { }
3 0 elsif (@val == 1) { }
1342 4 1 if $self->{'cb_object'}
1343 3 2 if (@val == 0) { }
2 0 elsif (@val == 1) { }
1389 0 293 if ($_[0]{'_incr_parser'}{'incr_pos'})
1406 2 3 if (builtin::blessed($_[0])) { }
1457 26 611 unless defined $self->{'incr_text'}
1459 329 308 if (defined $text)
1463 319 318 if (defined wantarray)
1469 320 1 unless ($self->{'incr_nest'} <= 0 and $self->{'incr_mode'} == 3)
1472 1 318 if ($max_size and $self->{'incr_pos'} > $max_size)
1475 46 272 unless ($self->{'incr_nest'} <= 0 and $self->{'incr_mode'} == 3)
1477 4 38 if ($self->{'incr_mode'} == 0 and $self->{'incr_pos'})
1485 273 0 unless ($coder->get_utf8)
1496 267 2 unless wantarray
1500 4 309 if (wantarray) { }
1504 267 42 defined $ret[0] ? :
1519 0 2550 unless defined $s
1522 284 2266 if ($mode == 0) { }
0 2266 elsif ($mode == 2) { }
9 2257 elsif ($mode == 4 or $mode == 5) { }
35 2222 elsif ($mode == 6) { }
380 1842 elsif ($mode == 7) { }
585 1257 elsif ($mode == 1) { }
1257 0 elsif ($mode == 3) { }
1525 0 516 unless defined $s
1526 280 236 if (ord $s > 32)
1527 6 274 if ($s eq '#') { }
1544 0 45 unless defined $s
1545 9 36 if ($s eq "\n")
1546 6 3 $self->{'incr_mode'} == 4 ? :
1553 0 0 if $p >= $len and $self->{'incr_nest'}
1556 105 35 if defined $s and $s =~ /[rueals]/
1562 0 35 unless $self->{'incr_nest'}
1565 0 0 if $p >= $len and $self->{'incr_nest'}
1568 16 375 if defined $s and $s =~ /[0-9eE.+\-]/
1574 5 375 unless $self->{'incr_nest'}
1579 0 2063 unless defined $s
1580 583 1480 if ($s eq '"') { }
498 982 elsif ($s eq '\\') { }
1584 15 568 unless $self->{'incr_nest'}
1589 0 498 unless (defined substr($text, $p, 1))
1599 0 3126 if ($s eq "\000") { }
682 2444 elsif ($s =~ /^[\t\n\r ]$/) { }
35 2409 elsif ($s eq 't' or $s eq 'f' or $s eq 'n') { }
380 2029 elsif ($s =~ /^[0-9\-]$/) { }
583 1446 elsif ($s eq '"') { }
355 1091 elsif ($s eq '[' or $s eq '{') { }
352 739 elsif ($s eq ']' or $s eq '}') { }
3 736 elsif ($s eq '#') { }
1603 0 682 unless ($self->{'incr_nest'})
1618 1 354 if (++$self->{'incr_nest'} > $coder->get_max_depth)
1623 253 99 if (--$self->{'incr_nest'} <= 0)
1635 281 38 $p ? :
1640 0 0 if ($_[0]{'incr_pos'})