Branch Coverage

blib/lib/JSON/PP.pm
Criterion Covered Total %
branch 473 646 73.2


line true false branch
47 0 64 $] < 5.008 ? :
90 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 4 defined $_[1] ? :
4 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 18461 defined $_[1] ? :
18466 0 if ($enable) { }
177 5 0 defined $v ? :
179 3 2 if ($enable) { }
192 5 0 defined $_[1] ? :
202 3 0 defined $_[1] ? :
212 4 2 if (@_) { }
235 0 1 defined $_[0] ? :
236 1 0 if ($core_bools) { }
266 3 0 if (exists $self->{'true'} and exists $self->{'false'})
273 2 1 if (defined $_[1] and ref $_[1] eq 'CODE') { }
278 3 0 $_[0]{'cb_object'} || $_[0]{'cb_sk_object'} ? :
283 0 4 if (@_ == 1 or @_ > 3)
286 3 1 if (defined $_[2] and ref $_[2] eq 'CODE') { }
290 0 1 unless $_[0]{'cb_sk_object'}
0 1 unless %{{} unless $_[0]{'cb_sk_object'};}
292 4 0 $_[0]{'cb_object'} || $_[0]{'cb_sk_object'} ? :
297 0 0 if (not defined $_[1] or $_[1] > 15 or $_[1] < 0) { }
311 3 0 defined $_[1] ? :
367 268 24873 $canonical ? :
369 3 25138 if ($self->{'sort_by'})
372 1 1 $self->{'sort_by'} =~ /\D+/ ? :
1 2 ref $self->{'sort_by'} eq 'CODE' ? :
375 0 78 unless ref $obj or $props->[7]
380 7 25116 if $indent
390 346 25145 if ($type eq 'HASH') { }
25010 135 elsif ($type eq 'ARRAY') { }
54 81 elsif ($type) { }
397 34 20 if (&blessed($obj)) { }
399 20 14 if $obj->isa("JSON::PP::Boolean")
401 1 13 if ($allow_tags and $obj->can("FREEZE"))
405 0 1 if (@results and ref $results[0])
406 0 0 if (&refaddr($obj) eq &refaddr($results[0]))
416 5 8 if ($convert_blessed and $obj->can("TO_JSON"))
418 2 3 if (defined $result and ref $result)
419 1 1 if (&refaddr($obj) eq &refaddr($result))
430 3 5 if $bignum and _is_bignum($obj)
432 3 2 if ($allow_blessed)
433 0 3 if $as_nonblessed
453 1 345 if ++$depth > $max_depth
456 7 338 $indent ? :
457 5 340 $space_before ? :
5 340 $space_after ? :
463 36 708 ref $obj->{$k} ? :
467 7 336 if $indent
469 10 333 unless @res
478 1 25009 if ++$depth > $max_depth
481 2 25007 $indent ? :
484 310 25485 ref $v ? :
488 2 24993 if $indent
490 10 24985 unless @res
504 12487 13743 if utf8::is_utf8($value)
509 12926 817 unless length((my $dummy = "") & $value)
510 1 816 unless 0 + $value eq $value
511 816 0 if $value * 0 == 0
519 44 26270 unless defined $value
523 26230 40 if (not $type) { }
20 20 elsif (&blessed($value) and $value->isa('JSON::PP::Boolean')) { }
525 816 25414 if (do { _looks_like_number($value) })
534 10 10 $$value == 1 ? :
537 0 20 if ((overload::StrVal($value) =~ /=(\w+)/)[0])
541 7 13 if ($type eq "SCALAR" and defined $$value)
544 1 4 $self->{'PROPS'}[18] ? :
1 5 $$value eq '0' ? :
1 6 $$value eq '1' ? :
548 4 9 if ($self->{'PROPS'}[18]) { }
552 6 3 if ($type eq 'SCALAR' or $type eq 'REF') { }
580 1 26157 if $escape_slash
585 12297 13861 if ($ascii)
589 2 26156 if ($latin1)
593 12551 13607 if ($utf8)
603 0 0 if ($reftype eq 'HASH') { }
0 0 elsif ($reftype eq 'ARRAY') { }
622 222 123 defined $keysort ? :
658 2312958 1127975 $_ <= 65535 ? :
2818604 3440933 chr($_) =~ /[[:ascii:]]/ ? :
670 1 0 $_ <= 65535 ? :
21 1 $_ <= 255 ? :
686 1 2 unless $_[0]->isa("Math::BigInt")
702 64 1024 if ($int =~ /[eE]/)
753 20 12390 unless defined $octets[3]
754 0 0 !$octets[2] ? :
2 0 $octets[2] ? :
0 2 !($octets[0] || $octets[1]) ? :
1 2 !$octets[0] && $octets[1] ? :
12387 3 $octets[0] && $octets[1] ? :
769 4 25265 if (not defined $text or ref $text)
780 12410 12855 if ($utf8) { }
782 3 12407 if ($encoding ne 'UTF-8' and $encoding ne 'unknown') { }
786 1 12406 unless utf8::downgrade($text, 1)
798 2 25262 if ($max_size > 1)
801 1 1 if $bytes > $max_size
809 2 25261 unless defined $ch
813 5 198 unless ($props->[7] or ref $result)
819 0 25179 if $len < $at
821 273 24906 defined $ch ? :
825 304 24875 if $want_offset
827 12 24863 if defined $ch
834 25070 36694985 if $at >= $len
841 0 53833 unless defined $ch
842 1390 52443 if $ch eq "{"
843 26115 26328 if $ch eq "["
844 1 26327 if $ch eq "("
845 25422 905 if $ch eq "\"" or $singlequote and $ch eq "'"
846 812 93 if $ch =~ /[0-9]/ or $ch eq "-"
858 27147 5 if ($ch eq "\"" or $singlequote and $ch eq "'")
863 27131 10688362 if ($ch eq $boundChar) { }
5300299 5388063 elsif ($ch eq '\\') { }
866 1 27130 if ($utf16)
870 24800 2330 if $is_utf8
876 152492 5147807 if (exists $escapes{$ch}) { }
5147803 4 elsif ($ch eq 'u') { }
884 0 20591212 unless $ch =~ /[0-9a-fA-F]/
889 1127978 4019825 if ($u =~ /^[dD][89abAB][0-9a-fA-F]{2}/) { }
1127977 2891848 elsif ($u =~ /^[dD][c-fC-F][0-9a-fA-F]{2}/) { }
894 1 1127976 unless (defined $utf16)
902 1 2891847 if (defined $utf16)
907 2891847 0 if (chr $u =~ /[[:^ascii:]]/) { }
918 4 0 unless ($loose)
927 3441000 1947063 if ($ch =~ /[[:^ascii:]]/)
928 3440995 5 if ($ch = is_valid_utf8($ch)) { }
939 5388058 0 unless ($loose)
940 4 5388054 if ($ch =~ /$invalid_char_re/)
941 4 0 if (not $relaxed or $ch ne "\t")
961 27669 137053 if ($ch eq '' or $ch =~ /\A[ \t\r\n]\z/) { }
0 137053 elsif ($relaxed and $ch eq '/') { }
966 0 0 if (defined $ch and $ch eq '/') { }
0 0 elsif (defined $ch and $ch eq '*') { }
972 0 0 if (defined $ch) { }
973 0 0 if ($ch eq '*') { }
974 0 0 if (defined next_chr() and $ch eq "/")
995 9 137044 if ($relaxed and $ch eq "#")
1012 3 26112 if ++$depth > $max_depth
1018 23 26089 if (defined $ch and $ch eq ']') { }
1029 3 26276 unless (defined $ch)
1033 25514 762 if ($ch eq "]")
1039 3 759 if ($ch ne ",")
1046 2 757 if ($relaxed and $ch eq "]")
1055 3 3 if defined $ch and $ch ne ""
1060 0 1 unless $allow_tags
1066 0 1 unless defined $tag
1067 0 1 if ref $tag
1071 0 1 if (not defined $ch or $ch ne ")")
1079 0 1 unless defined $val
1080 0 1 unless ref $val eq "ARRAY"
1082 0 1 unless (eval { do { $tag->can("THAW") } })
1083 0 0 if $@
1093 0 1390 if ++$depth > $max_depth
1098 9 1381 if (defined $ch and $ch eq '}') { }
1101 1 8 if ($F_HOOK)
1108 2 1730 $allow_barekey && $ch ne '"' && $ch ne q['] ? :
1111 3 1724 if (not defined $ch or $ch ne ":")
1120 2 1205 unless defined $ch
1122 847 358 if ($ch eq "}")
1125 8 839 if ($F_HOOK)
1131 5 353 if ($ch ne ",")
1138 1 352 if ($relaxed and $ch eq "}")
1141 0 1 if ($F_HOOK)
1151 5 3 if defined $ch and $ch ne ""
1169 14 79 if ($word eq 'true') { }
44 35 elsif ($word eq 'null') { }
11 24 elsif ($word eq 'fals') { }
1172 3 11 defined $alt_true ? :
1181 11 0 if (substr($text, $at, 1) eq "e")
1184 3 8 defined $alt_false ? :
1190 1 23 if $word =~ /^n/
1191 1 22 if $word =~ /^t/
1192 0 22 if $word =~ /^f/
1203 41 771 if ($ch eq "-")
1206 1 40 unless (defined $ch and $ch =~ /\d/)
1212 46 765 if ($ch eq 0)
1214 5 41 if ($peek =~ /^[0-9a-dfA-DF]/)
1226 49 757 if (defined $ch and $ch eq ".")
1231 1 48 if (not defined $ch && $ch =~ /\d/) { }
1243 58 737 if (defined $ch and $ch eq 'e' || $ch eq 'E')
1248 38 20 if (defined $ch and $ch eq '+' || $ch eq '-') { }
18 2 elsif (defined $ch and $ch =~ /\d/) { }
1251 2 36 if (not defined $ch or $ch =~ /\D/)
1271 70 731 if ($is_dec or $is_exp) { }
1272 1 69 if ($allow_bignum)
1277 1 730 if (length $v > $max_intsize)
1278 1 0 if ($allow_bignum) { }
1288 47 752 $is_dec ? :
1294 64 0 if $] >= "5.006" and require warnings
1311 9 3440991 if $limit > length $start_point
1321 3440995 1240130 if (utf8::decode($copy))
1346 100 1 defined $text ? :
1359 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' ? :
435 16 $chr_c =~ /[[:print:]]/ ? :
7 451 $chr_c eq '\\' ? :
1368 10 448 if (length $mess >= 20)
1374 30 71 unless (length $mess)
1379 6 95 $no_rep ? :
1389 4 1 if ($cb_sk_object and @ks == 1 and exists $$cb_sk_object{$ks[0]} and ref $$cb_sk_object{$ks[0]})
1391 1 3 if (@val == 0) { }
3 0 elsif (@val == 1) { }
1402 4 1 if $cb_object
1403 3 2 if (@val == 0) { }
2 0 elsif (@val == 1) { }
1450 0 64 unless (defined &utf8::is_utf8)
1461 0 64 if ($] < "5.008003")
1493 64 0 if $] >= "5.006"
0 304 if ($_[0]{'_incr_parser'}{'incr_pos'})
1513 0 64 if ($@) { }
1523 0 0 ref $_[0] ? :
1538 0 0 unless length ref $r
1543 0 0 length ref $$r ? :
0 0 exists $tmap{$t} ? :
1548 0 0 unless length ref $_[0]
1551 0 0 if (defined(my $pkg = &blessed($_[0]))) { }
1574 2 3 if (&blessed($_[0])) { }
1624 57 687 unless defined $self->{'incr_text'}
1626 402 342 if (defined $text)
1630 383 361 if (defined wantarray)
1636 393 1 unless ($self->{'incr_nest'} <= 0 and $self->{'incr_mode'} == 3)
1639 1 391 if ($max_size and $self->{'incr_pos'} > $max_size)
1642 83 308 unless ($self->{'incr_nest'} <= 0 and $self->{'incr_mode'} == 3)
1644 7 39 if ($self->{'incr_mode'} == 0 and $self->{'incr_pos'})
1652 301 8 unless ($coder->get_utf8)
1663 287 11 unless wantarray
1667 7 363 if (wantarray) { }
1671 287 76 defined $ret[0] ? :
1686 0 3084 unless defined $s
1689 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) { }
1692 0 594 unless defined $s
1693 328 266 if (ord $s > 32)
1694 6 322 if ($s eq '#') { }
1711 0 45 unless defined $s
1712 9 36 if ($s eq "\n")
1713 6 3 $self->{'incr_mode'} == 4 ? :
1720 1 0 if $p >= $len and $self->{'incr_nest'}
1723 105 35 if defined $s and $s =~ /[rueals]/
1729 0 35 unless $self->{'incr_nest'}
1732 3 2 if $p >= $len and $self->{'incr_nest'}
1735 93 389 if defined $s and $s =~ /[0-9eE.+\-]/
1741 18 378 unless $self->{'incr_nest'}
1746 0 84413 unless defined $s
1747 780 83633 if ($s eq '"') { }
508 83125 elsif ($s eq '\\') { }
1751 20 760 unless $self->{'incr_nest'}
1756 0 508 unless (defined substr($text, $p, 1))
1766 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 '#') { }
1770 0 724 unless ($self->{'incr_nest'})
1785 1 382 if (++$self->{'incr_nest'} > $coder->get_max_depth)
1790 270 99 if (--$self->{'incr_nest'} <= 0)
1802 351 41 $p ? :
1807 0 0 if ($_[0]{'incr_pos'})