Branch Coverage

blib/lib/JSON/PP.pm
Criterion Covered Total %
branch 474 630 75.2


line true false branch
82 0 2 defined $_[1] ? :
2 0 if ($enable) { }
1 0 defined $_[1] ? :
1 0 if ($enable) { }
0 2 defined $_[1] ? :
2 0 if ($enable) { }
24633 20 defined $_[1] ? :
9286 15367 if ($enable) { }
0 1 defined $_[1] ? :
1 0 if ($enable) { }
0 1 defined $_[1] ? :
1 0 if ($enable) { }
2 1 defined $_[1] ? :
2 1 if ($enable) { }
0 0 defined $_[1] ? :
0 0 if ($enable) { }
2 12290 defined $_[1] ? :
12292 0 if ($enable) { }
3 7 defined $_[1] ? :
10 0 if ($enable) { }
0 5 defined $_[1] ? :
5 0 if ($enable) { }
0 1 defined $_[1] ? :
1 0 if ($enable) { }
0 0 $_[0]{'PROPS'}[14] ? :
0 0 $_[0]{'PROPS'}[13] ? :
0 0 $_[0]{'PROPS'}[9] ? :
0 0 $_[0]{'PROPS'}[7] ? :
0 0 $_[0]{'PROPS'}[15] ? :
0 0 $_[0]{'PROPS'}[19] ? :
0 0 $_[0]{'PROPS'}[18] ? :
0 0 $_[0]{'PROPS'}[17] ? :
0 0 $_[0]{'PROPS'}[0] ? :
0 0 $_[0]{'PROPS'}[4] ? :
0 0 $_[0]{'PROPS'}[10] ? :
0 0 $_[0]{'PROPS'}[16] ? :
0 0 $_[0]{'PROPS'}[3] ? :
0 0 $_[0]{'PROPS'}[1] ? :
0 0 $_[0]{'PROPS'}[12] ? :
0 0 $_[0]{'PROPS'}[11] ? :
0 0 $_[0]{'PROPS'}[8] ? :
0 0 $_[0]{'PROPS'}[6] ? :
0 0 $_[0]{'PROPS'}[5] ? :
8 301 $_[0]{'PROPS'}[2] ? :
6 0 defined $_[1] ? :
4 2 if ($enable) { }
0 2 defined $_[1] ? :
2 0 if ($enable) { }
0 0 defined $_[1] ? :
0 0 if ($enable) { }
0 14 defined $_[1] ? :
14 0 if ($enable) { }
0 21504 defined $_[1] ? :
21504 0 if ($enable) { }
7 0 defined $_[1] ? :
4 3 if ($enable) { }
6 0 defined $_[1] ? :
4 2 if ($enable) { }
5 18506 defined $_[1] ? :
18511 0 if ($enable) { }
169 5 0 defined $v ? :
171 3 2 if ($enable) { }
184 5 0 defined $_[1] ? :
194 3 0 defined $_[1] ? :
204 4 2 if (@_) { }
210 1 3 if (builtin::is_bool($true) and builtin::is_bool($false) and $true and not $false) { }
227 0 1 defined $_[0] ? :
228 1 0 if ($core_bools) { }
258 3 0 if (exists $self->{'true'} and exists $self->{'false'})
265 2 1 if (defined $_[1] and ref $_[1] eq 'CODE') { }
270 3 0 $_[0]{'cb_object'} || $_[0]{'cb_sk_object'} ? :
275 0 4 if (@_ == 1 or @_ > 3)
278 3 1 if (defined $_[2] and ref $_[2] eq 'CODE') { }
282 0 1 unless $_[0]{'cb_sk_object'}
0 1 unless %{{} unless $_[0]{'cb_sk_object'};}
284 4 0 $_[0]{'cb_object'} || $_[0]{'cb_sk_object'} ? :
289 0 0 if (not defined $_[1] or $_[1] > 15 or $_[1] < 0) { }
303 3 0 defined $_[1] ? :
330 268 24880 $self->{'PROPS'}[4] ? :
332 3 25145 if ($self->{'sort_by'})
335 1 1 $self->{'sort_by'} =~ /\D+/ ? :
1 2 ref $self->{'sort_by'} eq 'CODE' ? :
338 0 78 unless ref $obj or $props->[7]
343 7 25123 if $self->{'PROPS'}[3]
353 346 25158 if ($type eq 'HASH') { }
25017 141 elsif ($type eq 'ARRAY') { }
57 84 elsif ($type) { }
360 37 20 if (builtin::blessed($obj)) { }
362 20 17 if $obj->isa("JSON::PP::Boolean")
364 1 16 if ($self->{'PROPS'}[19] and $obj->can("FREEZE"))
368 0 1 if (@results and ref $results[0])
369 0 0 if (builtin::refaddr($obj) eq builtin::refaddr($results[0]))
379 8 8 if ($self->{'PROPS'}[10] and $obj->can("TO_JSON"))
381 2 6 if (defined $result and ref $result)
382 1 1 if (builtin::refaddr($obj) eq builtin::refaddr($result))
393 3 5 if $self->{'PROPS'}[13] and _is_bignum($obj)
395 3 2 if ($self->{'PROPS'}[9])
396 0 3 if $self->{'PROPS'}[17]
417 1 345 if ++$self->{'depth'} > $self->{'max_depth'}
419 7 338 $self->{'PROPS'}[3] ? :
420 5 340 $self->{'PROPS'}[5] ? :
5 340 $self->{'PROPS'}[6] ? :
425 36 708 ref $obj->{$k} ? :
429 7 336 if $self->{'PROPS'}[3]
431 10 333 unless @res
441 1 25016 if ++$self->{'depth'} > $self->{'max_depth'}
443 2 25014 $self->{'PROPS'}[3] ? :
446 313 25487 ref $v ? :
450 2 25000 if $self->{'PROPS'}[3]
452 13 24989 unless @res
453 0 24989 $pre eq '' && $self->{'PROPS'}[6] ? :
467 12487 13746 if utf8::is_utf8($value)
472 12929 817 unless length((my $dummy = "") & $value)
473 1 816 unless 0 + $value eq $value
474 816 0 if $value * 0 == 0
482 44 26275 unless defined $value
486 26235 40 if (not $type) { }
20 20 elsif (builtin::blessed($value) and $value->isa('JSON::PP::Boolean')) { }
488 2 26233 if (builtin::is_bool($value)) { }
816 25417 elsif (_looks_like_number($value)) { }
489 1 1 $value ? :
497 10 10 $$value == 1 ? :
500 0 20 if ((overload::StrVal($value) =~ /=(\w+)/)[0])
504 7 13 if ($type eq "SCALAR" and defined $$value)
507 1 4 $self->{'PROPS'}[18] ? :
1 5 $$value eq '0' ? :
1 6 $$value eq '1' ? :
511 4 9 if ($self->{'PROPS'}[18]) { }
515 6 3 if ($type eq 'SCALAR' or $type eq 'REF') { }
543 1 26160 if $self->{'PROPS'}[16]
548 12297 13864 if ($self->{'PROPS'}[0])
552 2 26159 if ($self->{'PROPS'}[1])
556 12551 13610 if ($self->{'PROPS'}[2])
566 0 0 if ($reftype eq 'HASH') { }
0 0 elsif ($reftype eq 'ARRAY') { }
587 222 123 defined $keysort ? :
615 2312958 1127975 $_ <= 65535 ? :
2818604 3440933 if (chr($_) =~ /[[:ascii:]]/) { }
627 1 0 $_ <= 65535 ? :
21 1 if ($_ <= 255) { }
643 1 2 unless $_[0]->isa("Math::BigInt")
659 67 1072 if ($int =~ /[eE]/)
682 20 12457 unless defined $octets[3]
683 0 0 !$octets[2] ? :
2 0 $octets[2] ? :
0 2 !($octets[0] || $octets[1]) ? :
1 2 !$octets[0] && $octets[1] ? :
12454 3 $octets[0] && $octets[1] ? :
696 4 25332 if (not defined $text or ref $text)
702 12477 12855 if ($self->{'PROPS'}[2]) { }
704 3 12474 if ($encoding ne 'UTF-8' and $encoding ne 'unknown') { }
708 1 12473 unless utf8::downgrade($text, 1)
718 2 25329 if ($self->{'max_size'} > 1)
724 1 1 if $bytes > $self->{'max_size'}
729 2 25328 unless defined $self->{'ch'}
733 5 198 unless ($props->[7] or ref $result)
739 0 25246 if $self->{'len'} < $self->{'at'}
741 340 24906 defined $self->{'ch'} ? :
745 304 24942 if $want_offset
747 12 24930 if defined $self->{'ch'}
755 25137 36775519 if $self->{'at'} >= $self->{'len'}
764 0 56178 unless defined $ch
765 2261 53917 if $ch eq "{"
766 26316 27601 if $ch eq "["
767 1 27600 if $ch eq "("
768 26561 1039 if $ch eq "\"" or $self->{'PROPS'}[15] and $ch eq "'"
769 946 93 if $ch =~ /[0-9]/ or $ch eq "-"
783 30296 5 if ($ch eq "\"" or $self->{'PROPS'}[15] and $ch eq "'")
788 30280 10730170 if ($ch eq $boundChar) { }
5300299 5429871 elsif ($ch eq '\\') { }
791 1 30279 if ($utf16)
795 24800 5479 if $is_utf8
801 152492 5147807 if (exists $escapes{$ch}) { }
5147803 4 elsif ($ch eq 'u') { }
809 0 20591212 unless $ch =~ /[0-9a-fA-F]/
814 1127978 4019825 if ($u =~ /^[dD][89abAB][0-9a-fA-F]{2}/) { }
1127977 2891848 elsif ($u =~ /^[dD][c-fC-F][0-9a-fA-F]{2}/) { }
819 1 1127976 unless (defined $utf16)
827 1 2891847 if (defined $utf16)
832 2891847 0 if (chr $u =~ /[[:^ascii:]]/) { }
843 4 0 unless ($self->{'PROPS'}[12])
852 3441000 1988871 if ($ch =~ /[[:^ascii:]]/)
853 3440995 5 if ($ch = $self->_is_valid_utf8($ch, \$utf8_len)) { }
864 5429866 0 unless ($self->{'PROPS'}[12])
865 4 5429862 if ($ch =~ /$invalid_char_re/)
866 4 0 if (not $self->{'PROPS'}[11] or $ch ne "\t")
888 54670 146031 if ($ch eq '' or $ch =~ /\A[ \t\r\n]\z/) { }
0 146031 elsif ($self->{'PROPS'}[11] and $ch eq '/') { }
893 0 0 if (defined $ch and $ch eq '/') { }
0 0 elsif (defined $ch and $ch eq '*') { }
899 0 0 if (defined $ch) { }
900 0 0 if ($ch eq '*') { }
901 0 0 if (defined($ch = $self->_next_chr) and $ch eq "/")
922 9 146022 if ($self->{'PROPS'}[11] and $ch eq "#")
941 3 26313 if ++$self->{'depth'} > $self->{'max_depth'}
947 23 26290 if (defined $ch and $ch eq ']') { }
959 3 26544 unless (defined $ch)
963 25715 829 if ($ch eq "]")
969 3 826 if ($ch ne ",")
977 2 824 if ($self->{'PROPS'}[11] and $ch eq "]")
986 3 3 if defined $ch and $ch ne ""
992 0 1 unless $self->{'PROPS'}[19]
998 0 1 unless defined $tag
999 0 1 if ref $tag
1004 0 1 if (not defined $ch or $ch ne ")")
1012 0 1 unless defined $val
1013 0 1 unless ref $val eq "ARRAY"
1015 0 1 unless (eval { do { $tag->can("THAW") } })
1016 0 0 if $@
1028 0 2261 if ++$self->{'depth'} > $self->{'max_depth'}
1033 9 2252 if (defined $ch and $ch eq '}') { }
1036 1 8 if ($self->{'F_HOOK'})
1043 2 3740 $self->{'PROPS'}[14] && $ch ne '"' && $ch ne q['] ? :
1047 3 3734 if (not defined $ch or $ch ne ":")
1057 2 3215 unless defined $ch
1059 1718 1497 if ($ch eq "}")
1062 8 1710 if ($self->{'F_HOOK'})
1068 5 1492 if ($ch ne ",")
1076 1 1491 if ($self->{'PROPS'}[11] and $ch eq "}")
1079 0 1 if ($self->{'F_HOOK'})
1089 5 3 if defined $ch and $ch ne ""
1110 14 79 if ($word eq 'true') { }
44 35 elsif ($word eq 'null') { }
11 24 elsif ($word eq 'fals') { }
1113 3 11 defined $self->{'true'} ? :
1122 11 0 if (substr($self->{'text'}, $self->{'at'}, 1) eq "e")
1125 3 8 defined $self->{'false'} ? :
1131 1 23 if $word =~ /^n/
1132 1 22 if $word =~ /^t/
1133 0 22 if $word =~ /^f/
1146 41 905 if ($ch eq "-")
1149 1 40 unless (defined $ch and $ch =~ /\d/)
1155 113 832 if ($ch eq 0)
1157 5 108 if ($peek =~ /^[0-9a-dfA-DF]/)
1169 49 891 if (defined $ch and $ch eq ".")
1174 1 48 if (not defined $ch && $ch =~ /\d/) { }
1186 58 871 if (defined $ch and $ch eq 'e' || $ch eq 'E')
1191 38 20 if (defined $ch and $ch eq '+' || $ch eq '-') { }
18 2 elsif (defined $ch and $ch =~ /\d/) { }
1194 2 36 if (not defined $ch or $ch =~ /\D/)
1214 70 865 if ($is_dec or $is_exp) { }
1215 1 69 if ($self->{'PROPS'}[13])
1220 1 864 if (length $v > $max_intsize)
1221 1 0 if ($self->{'PROPS'}[13]) { }
1231 47 886 $is_dec ? :
1255 9 3440991 if $limit > length $start_point
1265 3440995 1240130 if (utf8::decode($copy))
1291 97 4 defined $self->{'text'} ? :
1297 0 16 $chr_c eq '\\f' ? :
0 16 $chr_c eq '\\r' ? :
0 16 $chr_c eq '\\n' ? :
0 16 $chr_c eq '\\t' ? :
0 16 $chr_c eq '\\a' ? :
388 16 $chr_c =~ /[[:print:]]/ ? :
7 404 $chr_c eq '\\' ? :
1306 10 401 if (length $mess >= 20)
1312 33 68 unless (length $mess)
1317 6 95 $no_rep ? :
1328 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]})
1330 1 3 if (@val == 0) { }
3 0 elsif (@val == 1) { }
1341 4 1 if $self->{'cb_object'}
1342 3 2 if (@val == 0) { }
2 0 elsif (@val == 1) { }
1388 0 304 if ($_[0]{'_incr_parser'}{'incr_pos'})
1405 2 9 if (builtin::blessed($_[0])) { }
1455 57 687 unless defined $self->{'incr_text'}
1457 402 342 if (defined $text)
1461 383 361 if (defined wantarray)
1467 393 1 unless ($self->{'incr_nest'} <= 0 and $self->{'incr_mode'} == 3)
1470 1 391 if ($max_size and $self->{'incr_pos'} > $max_size)
1473 83 308 unless ($self->{'incr_nest'} <= 0 and $self->{'incr_mode'} == 3)
1475 7 39 if ($self->{'incr_mode'} == 0 and $self->{'incr_pos'})
1483 301 8 unless ($coder->get_utf8)
1494 287 11 unless wantarray
1498 7 363 if (wantarray) { }
1502 287 76 defined $ret[0] ? :
1517 0 3084 unless defined $s
1520 335 2749 if ($mode == 0) { }
0 2749 elsif ($mode == 2) { }
9 2740 elsif ($mode == 4 or $mode == 5) { }
36 2704 elsif ($mode == 6) { }
399 2305 elsif ($mode == 7) { }
805 1500 elsif ($mode == 1) { }
1500 0 elsif ($mode == 3) { }
1523 0 594 unless defined $s
1524 328 266 if (ord $s > 32)
1525 6 322 if ($s eq '#') { }
1542 0 45 unless defined $s
1543 9 36 if ($s eq "\n")
1544 6 3 $self->{'incr_mode'} == 4 ? :
1551 1 0 if $p >= $len and $self->{'incr_nest'}
1554 105 35 if defined $s and $s =~ /[rueals]/
1560 0 35 unless $self->{'incr_nest'}
1563 3 2 if $p >= $len and $self->{'incr_nest'}
1566 93 389 if defined $s and $s =~ /[0-9eE.+\-]/
1572 18 378 unless $self->{'incr_nest'}
1577 0 84413 unless defined $s
1578 780 83633 if ($s eq '"') { }
508 83125 elsif ($s eq '\\') { }
1582 20 760 unless $self->{'incr_nest'}
1587 0 508 unless (defined substr($text, $p, 1))
1597 0 3614 if ($s eq "\000") { }
724 2890 elsif ($s =~ /^[\t\n\r ]$/) { }
36 2854 elsif ($s eq 't' or $s eq 'f' or $s eq 'n') { }
398 2456 elsif ($s =~ /^[0-9\-]$/) { }
783 1673 elsif ($s eq '"') { }
383 1290 elsif ($s eq '[' or $s eq '{') { }
369 921 elsif ($s eq ']' or $s eq '}') { }
3 918 elsif ($s eq '#') { }
1601 0 724 unless ($self->{'incr_nest'})
1616 1 382 if (++$self->{'incr_nest'} > $coder->get_max_depth)
1621 270 99 if (--$self->{'incr_nest'} <= 0)
1633 351 41 $p ? :
1638 0 0 if ($_[0]{'incr_pos'})