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 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) { }
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] ? :
359 268 24873 $canonical ? :
361 3 25138 if ($self->{'sort_by'})
364 1 1 $self->{'sort_by'} =~ /\D+/ ? :
1 2 ref $self->{'sort_by'} eq 'CODE' ? :
367 0 78 unless ref $obj or $props->[7]
372 7 25116 if $indent
382 346 25145 if ($type eq 'HASH') { }
25010 135 elsif ($type eq 'ARRAY') { }
54 81 elsif ($type) { }
389 34 20 if (&blessed($obj)) { }
391 20 14 if $obj->isa("JSON::PP::Boolean")
393 1 13 if ($allow_tags and $obj->can("FREEZE"))
397 0 1 if (@results and ref $results[0])
398 0 0 if (&refaddr($obj) eq &refaddr($results[0]))
408 5 8 if ($convert_blessed and $obj->can("TO_JSON"))
410 2 3 if (defined $result and ref $result)
411 1 1 if (&refaddr($obj) eq &refaddr($result))
422 3 5 if $bignum and _is_bignum($obj)
424 3 2 if ($allow_blessed)
425 0 3 if $as_nonblessed
445 1 345 if ++$depth > $max_depth
448 7 338 $indent ? :
449 5 340 $space_before ? :
5 340 $space_after ? :
454 36 708 ref $obj->{$k} ? :
458 7 336 if $indent
460 10 333 unless @res
469 1 25009 if ++$depth > $max_depth
472 2 25007 $indent ? :
475 310 25485 ref $v ? :
479 2 24993 if $indent
481 10 24985 unless @res
495 12487 13743 if utf8::is_utf8($value)
500 12926 817 unless length((my $dummy = "") & $value)
501 1 816 unless 0 + $value eq $value
502 816 0 if $value * 0 == 0
510 44 26270 unless defined $value
514 26230 40 if (not $type) { }
20 20 elsif (&blessed($value) and $value->isa('JSON::PP::Boolean')) { }
516 816 25414 if (do { _looks_like_number($value) })
525 10 10 $$value == 1 ? :
528 0 20 if ((overload::StrVal($value) =~ /=(\w+)/)[0])
532 7 13 if ($type eq "SCALAR" and defined $$value)
535 1 4 $self->{'PROPS'}[18] ? :
1 5 $$value eq '0' ? :
1 6 $$value eq '1' ? :
539 4 9 if ($self->{'PROPS'}[18]) { }
543 6 3 if ($type eq 'SCALAR' or $type eq 'REF') { }
571 1 26157 if $escape_slash
576 12297 13861 if ($ascii)
580 2 26156 if ($latin1)
584 12551 13607 if ($utf8)
594 0 0 if ($reftype eq 'HASH') { }
0 0 elsif ($reftype eq 'ARRAY') { }
613 222 123 defined $keysort ? :
649 2312958 1127975 $_ <= 65535 ? :
2818604 3440933 chr($_) =~ /[[:ascii:]]/ ? :
661 1 0 $_ <= 65535 ? :
21 1 $_ <= 255 ? :
677 1 2 unless $_[0]->isa("Math::BigInt")
693 64 1024 if ($int =~ /[eE]/)
744 20 12390 unless defined $octets[3]
745 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] ? :
760 4 25265 if (not defined $text or ref $text)
771 12410 12855 if ($utf8) { }
773 3 12407 if ($encoding ne 'UTF-8' and $encoding ne 'unknown') { }
777 1 12406 unless utf8::downgrade($text, 1)
789 2 25262 if ($max_size > 1)
792 1 1 if $bytes > $max_size
800 2 25261 unless defined $ch
804 5 198 unless ($props->[7] or ref $result)
810 0 25179 if $len < $at
812 273 24906 defined $ch ? :
816 304 24875 if $want_offset
818 12 24863 if defined $ch
825 25070 36694985 if $at >= $len
832 0 53833 unless defined $ch
833 1390 52443 if $ch eq "{"
834 26115 26328 if $ch eq "["
835 1 26327 if $ch eq "("
836 25422 905 if $ch eq "\"" or $singlequote and $ch eq "'"
837 812 93 if $ch =~ /[0-9]/ or $ch eq "-"
849 27147 5 if ($ch eq "\"" or $singlequote and $ch eq "'")
854 27131 10688362 if ($ch eq $boundChar) { }
5300299 5388063 elsif ($ch eq '\\') { }
857 1 27130 if ($utf16)
861 24800 2330 if $is_utf8
867 152492 5147807 if (exists $escapes{$ch}) { }
5147803 4 elsif ($ch eq 'u') { }
875 0 20591212 unless $ch =~ /[0-9a-fA-F]/
880 1127978 4019825 if ($u =~ /^[dD][89abAB][0-9a-fA-F]{2}/) { }
1127977 2891848 elsif ($u =~ /^[dD][c-fC-F][0-9a-fA-F]{2}/) { }
885 1 1127976 unless (defined $utf16)
893 1 2891847 if (defined $utf16)
898 2891847 0 if (chr $u =~ /[[:^ascii:]]/) { }
909 4 0 unless ($loose)
918 3441000 1947063 if ($ch =~ /[[:^ascii:]]/)
919 3440995 5 if ($ch = is_valid_utf8($ch)) { }
930 5388058 0 unless ($loose)
931 4 5388054 if ($ch =~ /$invalid_char_re/)
932 4 0 if (not $relaxed or $ch ne "\t")
952 27669 137053 if ($ch eq '' or $ch =~ /\A[ \t\r\n]\z/) { }
0 137053 elsif ($relaxed and $ch eq '/') { }
957 0 0 if (defined $ch and $ch eq '/') { }
0 0 elsif (defined $ch and $ch eq '*') { }
963 0 0 if (defined $ch) { }
964 0 0 if ($ch eq '*') { }
965 0 0 if (defined next_chr() and $ch eq "/")
986 9 137044 if ($relaxed and $ch eq "#")
1003 3 26112 if ++$depth > $max_depth
1009 23 26089 if (defined $ch and $ch eq ']') { }
1020 3 26276 unless (defined $ch)
1024 25514 762 if ($ch eq "]")
1030 3 759 if ($ch ne ",")
1037 2 757 if ($relaxed and $ch eq "]")
1046 3 3 if defined $ch and $ch ne ""
1051 0 1 unless $allow_tags
1057 0 1 unless defined $tag
1058 0 1 if ref $tag
1062 0 1 if (not defined $ch or $ch ne ")")
1070 0 1 unless defined $val
1071 0 1 unless ref $val eq "ARRAY"
1073 0 1 unless (eval { do { $tag->can("THAW") } })
1074 0 0 if $@
1084 0 1390 if ++$depth > $max_depth
1089 9 1381 if (defined $ch and $ch eq '}') { }
1092 1 8 if ($F_HOOK)
1099 2 1730 $allow_barekey && $ch ne '"' && $ch ne q['] ? :
1102 3 1724 if (not defined $ch or $ch ne ":")
1111 2 1205 unless defined $ch
1113 847 358 if ($ch eq "}")
1116 8 839 if ($F_HOOK)
1122 5 353 if ($ch ne ",")
1129 1 352 if ($relaxed and $ch eq "}")
1132 0 1 if ($F_HOOK)
1142 5 3 if defined $ch and $ch ne ""
1160 14 79 if ($word eq 'true') { }
44 35 elsif ($word eq 'null') { }
11 24 elsif ($word eq 'fals') { }
1163 3 11 defined $alt_true ? :
1172 11 0 if (substr($text, $at, 1) eq "e")
1175 3 8 defined $alt_false ? :
1181 1 23 if $word =~ /^n/
1182 1 22 if $word =~ /^t/
1183 0 22 if $word =~ /^f/
1194 41 771 if ($ch eq "-")
1197 1 40 unless (defined $ch and $ch =~ /\d/)
1203 46 765 if ($ch eq 0)
1205 5 41 if ($peek =~ /^[0-9a-dfA-DF]/)
1217 49 757 if (defined $ch and $ch eq ".")
1222 1 48 if (not defined $ch && $ch =~ /\d/) { }
1234 58 737 if (defined $ch and $ch eq 'e' || $ch eq 'E')
1239 38 20 if (defined $ch and $ch eq '+' || $ch eq '-') { }
18 2 elsif (defined $ch and $ch =~ /\d/) { }
1242 2 36 if (not defined $ch or $ch =~ /\D/)
1262 70 731 if ($is_dec or $is_exp) { }
1263 1 69 if ($allow_bignum)
1268 1 730 if (length $v > $max_intsize)
1269 1 0 if ($allow_bignum) { }
1279 47 752 $is_dec ? :
1302 9 3440991 if $limit > length $start_point
1312 3440995 1240130 if (utf8::decode($copy))
1337 100 1 defined $text ? :
1343 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' ? :
436 16 $chr_c =~ /[[:print:]]/ ? :
7 452 $chr_c eq '\\' ? :
1352 10 449 if (length $mess >= 20)
1358 30 71 unless (length $mess)
1363 6 95 $no_rep ? :
1373 4 1 if ($cb_sk_object and @ks == 1 and exists $$cb_sk_object{$ks[0]} and ref $$cb_sk_object{$ks[0]})
1375 1 3 if (@val == 0) { }
3 0 elsif (@val == 1) { }
1386 4 1 if $cb_object
1387 3 2 if (@val == 0) { }
2 0 elsif (@val == 1) { }
1446 0 304 if ($_[0]{'_incr_parser'}{'incr_pos'})
1463 2 3 if (&blessed($_[0])) { }
1513 57 687 unless defined $self->{'incr_text'}
1515 402 342 if (defined $text)
1519 383 361 if (defined wantarray)
1525 393 1 unless ($self->{'incr_nest'} <= 0 and $self->{'incr_mode'} == 3)
1528 1 391 if ($max_size and $self->{'incr_pos'} > $max_size)
1531 83 308 unless ($self->{'incr_nest'} <= 0 and $self->{'incr_mode'} == 3)
1533 7 39 if ($self->{'incr_mode'} == 0 and $self->{'incr_pos'})
1541 301 8 unless ($coder->get_utf8)
1552 287 11 unless wantarray
1556 7 363 if (wantarray) { }
1560 287 76 defined $ret[0] ? :
1575 0 3084 unless defined $s
1578 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) { }
1581 0 594 unless defined $s
1582 328 266 if (ord $s > 32)
1583 6 322 if ($s eq '#') { }
1600 0 45 unless defined $s
1601 9 36 if ($s eq "\n")
1602 6 3 $self->{'incr_mode'} == 4 ? :
1609 1 0 if $p >= $len and $self->{'incr_nest'}
1612 105 35 if defined $s and $s =~ /[rueals]/
1618 0 35 unless $self->{'incr_nest'}
1621 3 2 if $p >= $len and $self->{'incr_nest'}
1624 93 389 if defined $s and $s =~ /[0-9eE.+\-]/
1630 18 378 unless $self->{'incr_nest'}
1635 0 84413 unless defined $s
1636 780 83633 if ($s eq '"') { }
508 83125 elsif ($s eq '\\') { }
1640 20 760 unless $self->{'incr_nest'}
1645 0 508 unless (defined substr($text, $p, 1))
1655 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 '#') { }
1659 0 724 unless ($self->{'incr_nest'})
1674 1 382 if (++$self->{'incr_nest'} > $coder->get_max_depth)
1679 270 99 if (--$self->{'incr_nest'} <= 0)
1691 351 41 $p ? :
1696 0 0 if ($_[0]{'incr_pos'})