Branch Coverage

blib/lib/Data/Smile/PP.pm
Criterion Covered Total %
branch 207 394 52.5


line true false branch
92 54 0 if (ref $i) { }
95 27 27 if ($module eq 'builtin') { }
96 0 27 unless $] >= "5.038"
99 27 0 if (defined &{"builtin::$external_function_name";})
105 0 27 unless eval "require $module; 1"
106 0 27 unless my $f = $module->can($external_function_name)
112 0 0 if eval "sub $name { $i }; 1"
120 33 13 unless defined $opts
121 0 13 unless Ref::Util::XS::is_plain_hashref($opts)
123 3 11 unless $allowed->{$k}
131 0 0 if $$pos + 4 > length $$buf
139 0 0 utf8::is_utf8($s) ? :
141 0 0 if $flag
147 0 0 if $$pos >= length $$buf
150 0 0 if $$pos + $len > length $$buf
153 0 0 if $flag
159 30 19 unless ref $v
160 18 1 unless builtin::blessed($v)
161 0 1 unless $v->can("TO_JSON")
169 0 0 unless (defined $v)
173 0 0 if (Ref::Util::XS::is_plain_arrayref($v))
179 0 0 if (Ref::Util::XS::is_plain_hashref($v))
189 0 0 if ref $v
191 0 0 if (builtin::is_bool($v))
192 0 0 $v ? :
195 0 0 if (&_created_as_string($v))
199 0 0 if (&_created_as_number($v) or &looks_like_number($v))
200 0 0 if ($v =~ /\A-?[0-9]+\z/ and $v >= '-9223372036854775808' and $v <= '9223372036854775807')
214 0 0 if $$pos >= length $$buf
217 0 0 if $tag eq "U"
218 0 0 if ($tag eq "b")
219 0 0 if $$pos >= length $$buf
220 0 0 if ($json_bool)
221 0 0 unless (defined $jppT)
226 0 0 ord substr($$buf, $$pos++, 1) ? :
228 0 0 ord substr($$buf, $$pos++, 1) ? :
230 0 0 if ($tag eq "S")
233 0 0 if ($tag eq "I")
234 0 0 if $$pos + 8 > length $$buf
239 0 0 if ($tag eq "N")
242 0 0 if ($use_bigint and $s =~ /\A-?[0-9]{19,}\z/)
249 0 0 if ($tag eq "A")
255 0 0 if ($tag eq "H")
275 198 1279 if ($num == 0 + $integer_text and abs $num >= '9007199254740992' and $num >= '-9223372036854775808' and $num <= '18446744073709551615')
292 0 21929 if $$pos >= length $$buf
294 8596 13333 if ($byte & 128)
306 5671 6194 $v & 1 ? :
315 0 51330 if $$pos >= length $$buf
320 5133 0 if (defined $bits_needed and length $bits > $bits_needed)
337 0 60 if $$pos >= length $$buf
368 0 178546 if $$pos >= length $$buf
370 472 178074 if $byte == 252
374 18 454 if $utf8
380 0 4046 unless defined $v
382 1 4045 if (@$ary >= 1024)
391 0 53161 if $$pos >= length $$buf
394 11414 41747 if ($t <= 31)
395 0 11414 if $t == 0 or not defined $ctx->{'shared_values'}[$t - 1]
398 3 41744 if ($t == 32)
399 3 0 if $ctx->{'enable_shared_values'}
402 6 41738 if ($t == 33)
405 5 41733 if ($t == 34 or $t == 35)
407 5 0 if ($json_bool)
408 1 4 unless (defined $jppT)
413 3 2 $is_true ? :
415 0 0 $is_true ? :
417 8592 33141 if ($t == 36 or $t == 37)
421 4 33137 if ($t == 38)
426 2 2 if ($use_bigint)
433 0 33137 if ($t == 42)
442 0 0 if ($scale > 0) { }
0 0 elsif ($scale < 0) { }
448 0 0 $use_bigint ? :
450 0 33137 if ($t == 40)
455 5133 28004 if ($t == 41)
460 3316 24688 if ($t >= 64 and $t <= 127)
461 3046 270 $t <= 95 ? :
462 0 3316 if $$pos + $len > length $$buf
465 3314 2 if $ctx->{'enable_shared_values'}
468 16 24672 if ($t >= 128 and $t <= 191)
469 14 2 $t <= 159 ? :
470 0 16 if $$pos + $len > length $$buf
474 13 3 if $ctx->{'enable_shared_values'}
477 3273 21399 if ($t >= 192 and $t <= 223)
480 454 20945 if ($t >= 224 and $t <= 227)
483 18 20927 if ($t >= 228 and $t <= 231)
486 0 20927 if ($t == 232)
490 9606 11321 if ($t >= 236 and $t <= 239)
491 0 9606 if $$pos >= length $$buf
494 0 9606 if $idx < 31 or not defined $ctx->{'shared_values'}[$idx]
497 734 10587 if ($t == 248)
500 0 20260 if $$pos >= length $$buf
501 734 19526 if ord substr($$buf, $$pos, 1) == 249
507 10587 0 if ($t == 250)
511 10587 33605 unless defined $k
522 0 44192 if $$pos >= length $$buf
525 10587 33605 if $t == 251
527 0 33605 if ($t == 32)
528 0 0 if $ctx->{'enable_shared_names'}
531 9884 23721 if ($t >= 48 and $t <= 51)
532 0 9884 if $$pos >= length $$buf
535 0 9884 if $idx < 64 or not defined $ctx->{'shared_names'}[$idx]
538 23005 716 if ($t >= 64 and $t <= 127)
540 0 23005 unless defined $ctx->{'shared_names'}[$idx]
543 715 1 if ($t >= 128 and $t <= 191)
545 0 715 if $$pos + $len > length $$buf
548 715 0 if $ctx->{'enable_shared_names'}
551 1 0 if ($t >= 192 and $t <= 247)
553 0 1 if $$pos + $len > length $$buf
557 1 0 if $ctx->{'enable_shared_names'}
560 0 0 if ($t == 52)
562 0 0 if $ctx->{'enable_shared_names'}
571 0 0 unless Ref::Util::XS::is_plain_arrayref($v)
574 0 0 unless Ref::Util::XS::is_plain_hashref($e)
576 0 0 if ++$seen{$k} > 1
584 0 0 unless Ref::Util::XS::is_plain_arrayref($v)
587 0 0 if ref $e
588 0 0 if not defined $e or utf8::is_utf8($e) or length $e > 64
589 0 0 if ++$seen{$e} > 1
609 0 15 $v < 0 ? :
630 8 1 if (not $is_utf8 and $len >= 1 and $len <= 32)
633 0 1 if (not $is_utf8 and $len >= 33 and $len <= 64)
636 0 0 if ($is_utf8 and $len >= 2 and $len <= 33)
639 0 0 if ($is_utf8 and $len >= 34 and $len <= 65)
643 0 1 $is_utf8 ? :
650 1 22 if (defined $ctx->{'name_to_idx'}{$key})
652 1 0 if ($idx <= 63)
655 0 0 if ($idx <= 1023)
662 19 3 if ($ctx->{'enable_shared_names'} and @{$ctx->{'shared_names'};} < 1024)
663 0 19 if (@{$ctx->{'shared_names'};} >= 1024)
673 0 22 if $key eq ""
677 0 22 if $is_utf8
680 22 0 if (not $is_utf8 and $len >= 1 and $len <= 64)
683 0 0 if ($is_utf8 and $len >= 2 and $len <= 65)
694 1 48 unless (defined $v)
698 6 42 if (Ref::Util::XS::is_plain_arrayref($v))
705 13 29 if (Ref::Util::XS::is_plain_hashref($v))
707 1 12 if $ctx->{'canonical'}
718 0 29 if ref $v
720 0 29 if (builtin::is_bool($v))
721 0 0 $v ? :
724 15 14 if (&_created_as_number($v) or &looks_like_number($v))
725 15 0 if ($v =~ /\A-?[0-9]+\z/)
727 15 0 if ($n >= -16 and $n <= 15)
738 0 14 utf8::is_utf8($text) ? :
740 5 9 if ($ctx->{'enable_shared_values'} and defined $ctx->{'value_to_idx'}{$cache_key})
742 5 0 if ($idx <= 30)
745 0 0 if ($idx <= 1023)
752 7 2 if ($ctx->{'enable_shared_values'})
753 0 7 if (@{$ctx->{'shared_values'};} >= 1024)
765 0 9 if $is_utf8
771 0 14 if @_ > 2
774 3 9 exists $opts->{'write_header'} ? :
775 2 10 exists $opts->{'shared_values'} ? :
776 1 11 exists $opts->{'shared_names'} ? :
777 1 11 exists $opts->{'canonical'} ? :
790 9 3 $write_header ? :
799 0 32 if @_ > 2
801 2 29 exists $opts->{'use_bigint'} ? :
802 2 29 exists $opts->{'require_header'} ? :
803 0 31 exists $opts->{'json_bool'} ? :
807 27 4 if (substr($bytes, 0, 3) eq ":)\n") { }
1 3 elsif ($require_header) { }
815 0 30 if ($pos < length $bytes and substr($bytes, $pos, 1) eq "z")
817 0 0 if $pos >= length $bytes
819 0 0 if $flags & 1
820 0 0 if $flags & 2
823 0 0 if $pos + $len > length $bytes
832 27 3 $has_header ? :
833 27 3 $has_header ? :
27 3 $has_header ? :
843 0 2 if $rest == 255
844 0 0 if ($rest == 10 or $rest == 13 or $rest == 9 or $rest == 32)
855 5 19 unless ref $x
856 18 1 if eval { do { $x->isa("Path::Tiny") } } or eval { do { $x->isa("Path::Class::File") } }
863 17 2 if (_is_pathish_filename($file))
867 19 0 unless (ref $file)
868 0 19 unless open my $fh, "<:raw", $file
872 0 0 if (eval { do { $file->can("read") } } or eval { do { $file->can("getline") } } or ref $file eq "GLOB")
883 1 4 if (_is_pathish_filename($file))
887 4 1 unless (ref $file)
888 0 4 unless open my $fh, ">:raw", $file
892 0 0 if (eval { do { $file->can("print") } } or eval { do { $file->can("write") } } or ref $file eq "GLOB")
902 0 5 if @_ > 3
904 2 3 if (@_ >= 3 and defined $opts)
905 0 2 unless Ref::Util::XS::is_plain_hashref($opts)
911 4 0 eval { do { die "write: $!" unless print {$fh;} $bytes; 1 } } ? :
912 0 4 unless print {$fh;} $bytes
916 3 1 if ($close)
917 0 3 unless close $fh
920 4 0 $ok ? :
925 0 19 if @_ > 2
927 1 18 if (@_ >= 2 and defined $opts)
928 0 1 unless Ref::Util::XS::is_plain_hashref($opts)
934 0 19 unless defined $buf
936 19 0 if ($close)
937 0 19 unless close $fh