Branch Coverage

blib/lib/JSON/PP.pm
Criterion Covered Total %
branch 467 622 75.0


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 18462 defined $_[1] ? :
18467 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 (@_) { }
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 24878 $self->{'PROPS'}[4] ? :
332 3 25143 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 25121 if $self->{'PROPS'}[3]
353 346 25156 if ($type eq 'HASH') { }
25015 141 elsif ($type eq 'ARRAY') { }
57 84 elsif ($type) { }
360 37 20 if (&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 (&refaddr($obj) eq &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 (&refaddr($obj) eq &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 25014 if ++$self->{'depth'} > $self->{'max_depth'}
443 2 25012 $self->{'PROPS'}[3] ? :
446 313 25485 ref $v ? :
450 2 24998 if $self->{'PROPS'}[3]
452 13 24987 unless @res
466 12487 13746 if utf8::is_utf8($value)
471 12929 817 unless length((my $dummy = "") & $value)
472 1 816 unless 0 + $value eq $value
473 816 0 if $value * 0 == 0
481 44 26273 unless defined $value
485 26233 40 if (not $type) { }
20 20 elsif (&blessed($value) and $value->isa('JSON::PP::Boolean')) { }
487 816 25417 if (do { _looks_like_number($value) })
496 10 10 $$value == 1 ? :
499 0 20 if ((overload::StrVal($value) =~ /=(\w+)/)[0])
503 7 13 if ($type eq "SCALAR" and defined $$value)
506 1 4 $self->{'PROPS'}[18] ? :
1 5 $$value eq '0' ? :
1 6 $$value eq '1' ? :
510 4 9 if ($self->{'PROPS'}[18]) { }
514 6 3 if ($type eq 'SCALAR' or $type eq 'REF') { }
542 1 26160 if $self->{'PROPS'}[16]
547 12297 13864 if ($self->{'PROPS'}[0])
551 2 26159 if ($self->{'PROPS'}[1])
555 12551 13610 if ($self->{'PROPS'}[2])
565 0 0 if ($reftype eq 'HASH') { }
0 0 elsif ($reftype eq 'ARRAY') { }
586 222 123 defined $keysort ? :
614 2312958 1127975 $_ <= 65535 ? :
2818604 3440933 chr($_) =~ /[[:ascii:]]/ ? :
626 1 0 $_ <= 65535 ? :
21 1 $_ <= 255 ? :
642 1 2 unless $_[0]->isa("Math::BigInt")
658 65 1040 if ($int =~ /[eE]/)
681 20 12390 unless defined $octets[3]
682 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] ? :
695 4 25265 if (not defined $text or ref $text)
701 12410 12855 if ($self->{'PROPS'}[2]) { }
703 3 12407 if ($encoding ne 'UTF-8' and $encoding ne 'unknown') { }
707 1 12406 unless utf8::downgrade($text, 1)
717 2 25262 if ($self->{'max_size'} > 1)
723 1 1 if $bytes > $self->{'max_size'}
728 2 25261 unless defined $self->{'ch'}
732 5 198 unless ($props->[7] or ref $result)
738 0 25179 if $self->{'len'} < $self->{'at'}
740 273 24906 defined $self->{'ch'} ? :
744 304 24875 if $want_offset
746 12 24863 if defined $self->{'ch'}
754 25070 36694985 if $self->{'at'} >= $self->{'len'}
763 0 53833 unless defined $ch
764 1390 52443 if $ch eq "{"
765 26115 26328 if $ch eq "["
766 1 26327 if $ch eq "("
767 25422 905 if $ch eq "\"" or $self->{'PROPS'}[15] and $ch eq "'"
768 812 93 if $ch =~ /[0-9]/ or $ch eq "-"
782 27147 5 if ($ch eq "\"" or $self->{'PROPS'}[15] and $ch eq "'")
787 27131 10688362 if ($ch eq $boundChar) { }
5300299 5388063 elsif ($ch eq '\\') { }
790 1 27130 if ($utf16)
794 24800 2330 if $is_utf8
800 152492 5147807 if (exists $escapes{$ch}) { }
5147803 4 elsif ($ch eq 'u') { }
808 0 20591212 unless $ch =~ /[0-9a-fA-F]/
813 1127978 4019825 if ($u =~ /^[dD][89abAB][0-9a-fA-F]{2}/) { }
1127977 2891848 elsif ($u =~ /^[dD][c-fC-F][0-9a-fA-F]{2}/) { }
818 1 1127976 unless (defined $utf16)
826 1 2891847 if (defined $utf16)
831 2891847 0 if (chr $u =~ /[[:^ascii:]]/) { }
842 4 0 unless ($self->{'PROPS'}[12])
851 3441000 1947063 if ($ch =~ /[[:^ascii:]]/)
852 3440995 5 if ($ch = $self->_is_valid_utf8($ch, \$utf8_len)) { }
863 5388058 0 unless ($self->{'PROPS'}[12])
864 4 5388054 if ($ch =~ /$invalid_char_re/)
865 4 0 if (not $self->{'PROPS'}[11] or $ch ne "\t")
887 27669 137053 if ($ch eq '' or $ch =~ /\A[ \t\r\n]\z/) { }
0 137053 elsif ($self->{'PROPS'}[11] and $ch eq '/') { }
892 0 0 if (defined $ch and $ch eq '/') { }
0 0 elsif (defined $ch and $ch eq '*') { }
898 0 0 if (defined $ch) { }
899 0 0 if ($ch eq '*') { }
900 0 0 if (defined($ch = $self->_next_chr) and $ch eq "/")
921 9 137044 if ($self->{'PROPS'}[11] and $ch eq "#")
940 3 26112 if ++$self->{'depth'} > $self->{'max_depth'}
946 23 26089 if (defined $ch and $ch eq ']') { }
958 3 26276 unless (defined $ch)
962 25514 762 if ($ch eq "]")
968 3 759 if ($ch ne ",")
976 2 757 if ($self->{'PROPS'}[11] and $ch eq "]")
985 3 3 if defined $ch and $ch ne ""
991 0 1 unless $self->{'PROPS'}[19]
997 0 1 unless defined $tag
998 0 1 if ref $tag
1003 0 1 if (not defined $ch or $ch ne ")")
1011 0 1 unless defined $val
1012 0 1 unless ref $val eq "ARRAY"
1014 0 1 unless (eval { do { $tag->can("THAW") } })
1015 0 0 if $@
1027 0 1390 if ++$self->{'depth'} > $self->{'max_depth'}
1032 9 1381 if (defined $ch and $ch eq '}') { }
1035 1 8 if ($self->{'F_HOOK'})
1042 2 1730 $self->{'PROPS'}[14] && $ch ne '"' && $ch ne q['] ? :
1046 3 1724 if (not defined $ch or $ch ne ":")
1056 2 1205 unless defined $ch
1058 847 358 if ($ch eq "}")
1061 8 839 if ($self->{'F_HOOK'})
1067 5 353 if ($ch ne ",")
1075 1 352 if ($self->{'PROPS'}[11] and $ch eq "}")
1078 0 1 if ($self->{'F_HOOK'})
1088 5 3 if defined $ch and $ch ne ""
1109 14 79 if ($word eq 'true') { }
44 35 elsif ($word eq 'null') { }
11 24 elsif ($word eq 'fals') { }
1112 3 11 defined $self->{'true'} ? :
1121 11 0 if (substr($self->{'text'}, $self->{'at'}, 1) eq "e")
1124 3 8 defined $self->{'false'} ? :
1130 1 23 if $word =~ /^n/
1131 1 22 if $word =~ /^t/
1132 0 22 if $word =~ /^f/
1145 41 771 if ($ch eq "-")
1148 1 40 unless (defined $ch and $ch =~ /\d/)
1154 46 765 if ($ch eq 0)
1156 5 41 if ($peek =~ /^[0-9a-dfA-DF]/)
1168 49 757 if (defined $ch and $ch eq ".")
1173 1 48 if (not defined $ch && $ch =~ /\d/) { }
1185 58 737 if (defined $ch and $ch eq 'e' || $ch eq 'E')
1190 38 20 if (defined $ch and $ch eq '+' || $ch eq '-') { }
18 2 elsif (defined $ch and $ch =~ /\d/) { }
1193 2 36 if (not defined $ch or $ch =~ /\D/)
1213 70 731 if ($is_dec or $is_exp) { }
1214 1 69 if ($self->{'PROPS'}[13])
1219 1 730 if (length $v > $max_intsize)
1220 1 0 if ($self->{'PROPS'}[13]) { }
1230 47 752 $is_dec ? :
1254 9 3440991 if $limit > length $start_point
1264 3440995 1240130 if (utf8::decode($copy))
1290 97 4 defined $self->{'text'} ? :
1296 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 '\\' ? :
1305 10 401 if (length $mess >= 20)
1311 33 68 unless (length $mess)
1316 6 95 $no_rep ? :
1327 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]})
1329 1 3 if (@val == 0) { }
3 0 elsif (@val == 1) { }
1340 4 1 if $self->{'cb_object'}
1341 3 2 if (@val == 0) { }
2 0 elsif (@val == 1) { }
1387 0 304 if ($_[0]{'_incr_parser'}{'incr_pos'})
1404 2 3 if (&blessed($_[0])) { }
1454 57 687 unless defined $self->{'incr_text'}
1456 402 342 if (defined $text)
1460 383 361 if (defined wantarray)
1466 393 1 unless ($self->{'incr_nest'} <= 0 and $self->{'incr_mode'} == 3)
1469 1 391 if ($max_size and $self->{'incr_pos'} > $max_size)
1472 83 308 unless ($self->{'incr_nest'} <= 0 and $self->{'incr_mode'} == 3)
1474 7 39 if ($self->{'incr_mode'} == 0 and $self->{'incr_pos'})
1482 301 8 unless ($coder->get_utf8)
1493 287 11 unless wantarray
1497 7 363 if (wantarray) { }
1501 287 76 defined $ret[0] ? :
1516 0 3084 unless defined $s
1519 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) { }
1522 0 594 unless defined $s
1523 328 266 if (ord $s > 32)
1524 6 322 if ($s eq '#') { }
1541 0 45 unless defined $s
1542 9 36 if ($s eq "\n")
1543 6 3 $self->{'incr_mode'} == 4 ? :
1550 1 0 if $p >= $len and $self->{'incr_nest'}
1553 105 35 if defined $s and $s =~ /[rueals]/
1559 0 35 unless $self->{'incr_nest'}
1562 3 2 if $p >= $len and $self->{'incr_nest'}
1565 93 389 if defined $s and $s =~ /[0-9eE.+\-]/
1571 18 378 unless $self->{'incr_nest'}
1576 0 84413 unless defined $s
1577 780 83633 if ($s eq '"') { }
508 83125 elsif ($s eq '\\') { }
1581 20 760 unless $self->{'incr_nest'}
1586 0 508 unless (defined substr($text, $p, 1))
1596 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 '#') { }
1600 0 724 unless ($self->{'incr_nest'})
1615 1 382 if (++$self->{'incr_nest'} > $coder->get_max_depth)
1620 270 99 if (--$self->{'incr_nest'} <= 0)
1632 351 41 $p ? :
1637 0 0 if ($_[0]{'incr_pos'})