Branch Coverage

blib/lib/BSON/PP.pm
Criterion Covered Total %
branch 242 284 85.2


line true false branch
77 5 0 if ($] ge 5.01) { }
93 46 21 $started ? :
94 20 47 unless defined $k
105 0 29886 if $ENV{'BSON_TEST_SORT_HASH'}
108 29677 144818 unless defined $k
117 1 9 if ($neg) { }
0 9 elsif ($bigint > $max_int64) { }
118 0 1 if ($bigint < $min_int64)
130 9 1 if $len < 16
132 1 9 if $neg
138 0 0 if $bytes eq "\000\000\000\000\000\000\000\000"
139 0 0 if (unpack('c', $bytes) < 0) { }
140 0 0 if ($bytes eq "\200\000\000\000\000\000\000\000") { }
158 17666 10 unless ($type)
164 10 0 if ($type eq 'Math::BigInt') { }
0 0 elsif ($type eq 'Math::Int64') { }
179 1 0 unless $reftype eq 'HASH'
187 4 30033 if $opt->{'_circular'}{$refaddr}++
189 2482 27551 unless defined $opt->{'_depth'}
191 2 30031 if ($opt->{'_depth'} > 100)
197 103 29928 if ($doc_type eq 'BSON::Raw' or $doc_type eq 'MongoDB::BSON::_EncodedDoc')
203 3 29925 if ($doc_type eq 'MongoDB::BSON::Raw')
215 0 1 $doc_type eq 'MongoDB::DBRef' ? :
15 1 $doc_type eq 'BSON::DBRef' ? :
6 16 $doc_type eq 'Tie::IxHash' ? :
17 22 $doc_type eq 'BSON::Doc' ? :
29886 39 $doc_type eq 'HASH' ? :
219 2 29922 defined $opt->{'op_char'} ? :
221 2 29922 length $opt->{'invalid_chars'} ? :
230 1 144889 if defined $first_key and $key eq $first_key
232 2 144887 if ($first_key_pending)
238 0 144889 unless defined $key
240 1 144888 unless -1 == index($key, "\000")
243 1 144887 if length $op_char and substr($key, 0, 1) eq $op_char
246 2 144886 if ($invalid and $key =~ /$invalid/)
260 90486 54400 if (&blessed($value))
261 39 90447 unless ($type =~ /\ABSON::\w+\z/)
263 0 39 if defined $parent
268 8890 135996 if (not defined $value) { }
109254 26742 elsif (length $type) { }
276 8924 100330 if ($type eq 'ARRAY' or $type eq 'BSON::Array') { }
4 100326 elsif ($type eq 'BSON::DBPointer') { }
9968 90358 elsif ($type eq 'HASH' or $type eq 'BSON::Doc' or $type eq 'BSON::Raw' or $type eq 'MongoDB::BSON::_EncodedDoc' or $type eq 'Tie::IxHash' or $type eq 'MongoDB::BSON::Raw' or $type eq 'BSON::DBRef' or $type eq 'MongoDB::DBRef') { }
4 90354 elsif ($type eq 'Regexp') { }
8881 81473 elsif ($type eq 'BSON::Regex' or $type eq 'MongoDB::BSON::Regexp') { }
8912 72561 elsif ($type eq 'BSON::OID' or $type eq 'BSON::ObjectId') { }
0 72561 elsif ($type eq 'MongoDB::OID') { }
8841 63720 elsif ($type eq 'BSON::Time') { }
0 63720 elsif ($type eq 'Time::Moment') { }
0 63720 elsif ($type eq 'DateTime') { }
0 63720 elsif ($type eq 'DateTime::Tiny') { }
0 63720 elsif ($type eq 'Mango::BSON::Time') { }
8872 54848 elsif ($type eq 'BSON::Timestamp') { }
0 54848 elsif ($type eq 'MongoDB::Timestamp') { }
8789 46059 elsif ($type eq 'BSON::MinKey' or $type eq 'MongoDB::MinKey') { }
8715 37344 elsif ($type eq 'BSON::MaxKey' or $type eq 'MongoDB::MaxKey') { }
8960 28384 elsif ($type eq 'SCALAR' or $type eq 'BSON::Bytes' or $type eq 'BSON::Binary' or $type eq 'MongoDB::BSON::Binary') { }
8985 19399 elsif ($type eq 'BSON::Code' or $type eq 'MongoDB::Code') { }
8976 10423 elsif ($type eq 'boolean' or $type =~ /$bools_re/) { }
8817 1606 elsif ($type eq 'BSON::String' or $type eq 'BSON::Symbol') { }
2 1604 elsif ($type eq 'MongoDB::BSON::String') { }
24 1580 elsif ($type eq 'BSON::Int64' or $type eq 'Math::BigInt' or $type eq 'Math::Int64') { }
35 1545 elsif ($type eq 'BSON::Int32') { }
32 1513 elsif ($type eq 'BSON::Double') { }
1512 1 elsif ($type eq 'BSON::Decimal128') { }
332 0 0 if ($value->time_zone->name eq 'floating')
377 0 4 $type eq 'MongoDB::BSON::Binary' ? :
8954 4 $type eq 'BSON::Bytes' ? :
2 8958 $type eq 'SCALAR' ? :
378 2 8958 $type eq 'SCALAR' ? :
380 2 8958 if ($subtype == 2) { }
396 8659 326 if (ref $value->scope eq 'HASH') { }
408 4547 4429 $value ? :
426 0 24 if ($value > $max_int64 or $value < $min_int64)
431 16 8 if ($type eq 'BSON::Int64')
467 8943 17799 if ($flags & 512) { }
17675 124 elsif ($flags & 256) { }
3 121 elsif ($opt->{'prefer_numeric'} and &looks_like_number($value)) { }
473 0 17675 if ($value > $max_int64 or $value < $min_int64) { }
8811 8864 elsif ($value > $max_int32 or $value < $min_int32) { }
485 2 1 if ($value =~ /$int_re/) { }
1 0 elsif ($value =~ /$doub_re/) { }
486 0 2 if ($value > $max_int64 or $value < $min_int64) { }
0 2 elsif ($value > $max_int32 or $value < $min_int32) { }
563 0 28903 unless (defined $bson)
566 2147 26756 unless defined $opt->{'_depth'}
568 1 28902 if ($opt->{'_depth'} > 100)
573 13 28889 if (length $bson != $len)
576 5 28884 if (chop $bson ne "\000")
582 1485 27399 if $opt->{'ordered'}
590 8 143734 unless (defined $min_size)
593 12 143722 if (length $bson < $min_size)
598 8989 134733 if ($type == 1) { }
8949 125784 elsif ($type == 2 or $type == 14) { }
18096 107688 elsif ($type == 3 or $type == 4) { }
8962 98726 elsif ($type == 5) { }
2 98724 elsif ($type == 6) { }
8905 89819 elsif ($type == 7) { }
8978 80841 elsif ($type == 8) { }
8844 71997 elsif ($type == 9) { }
8882 63115 elsif ($type == 10) { }
8885 54230 elsif ($type == 11) { }
11 54219 elsif ($type == 12) { }
326 53893 elsif ($type == 13) { }
8670 45223 elsif ($type == 15) { }
8802 36421 elsif ($type == 16) { }
8871 27550 elsif ($type == 17) { }
8840 18710 elsif ($type == 18) { }
1206 17504 elsif ($type == 19) { }
8789 8715 elsif ($type == 255) { }
8715 0 elsif ($type == 127) { }
600 51 8938 if $opt->{'wrap_numbers'}
606 11 8938 if (length $bson < $len or substr($bson, $len - 1, 1) ne "\000")
611 3 8935 unless (utf8::decode($value))
614 6 8929 if $opt->{'wrap_strings'}
621 11 0 if ($opt->{'wrap_dbrefs'} and $type == 3 and exists $value->{'$id'} and exists $value->{'$ref'})
632 1 8961 if ($len < 0)
635 1 8960 if ($len > length $bson)
641 5 8955 if ($btype == 2)
642 0 5 if ($len < 4)
647 3 2 if ($sublen != length($binary) - 4)
671 2 8976 unless $bool == 0 or $bool == 1
687 1 8843 if (defined $dt_type and $dt_type ne 'BSON::Time')
688 0 1 $dt_type eq 'Mango::BSON::Time' ? :
0 1 $dt_type eq 'DateTime::Tiny' ? :
0 1 $dt_type eq 'DateTime' ? :
0 1 $dt_type eq 'Time::Moment' ? :
711 3 8 if (length $bson < $len or substr($bson, $len - 1, 1) ne "\000")
716 1 7 unless (utf8::decode($ref))
727 0 326 if (length $bson < $len or substr($bson, $len - 1, 1) ne "\000")
732 0 326 unless (utf8::decode($value))
743 1 8669 if ($len < 0)
746 2 8667 if ($len > length $bson)
749 1 8666 if ($len < 5)
761 1 8665 if (length $codewscope < $strlen or substr($codewscope, -1, 1) ne "\000")
767 0 8665 unless (utf8::decode($code))
771 2 8663 if (length $codewscope < 5)
777 3 8660 if (length $codewscope < $scopelen or substr($codewscope, $scopelen - 1, 1) ne "\000")
789 38 8764 if $opt->{'wrap_numbers'}
807 21 8819 if $opt->{'wrap_numbers'}
833 28546 115031 if ($opt->{'_decode_array'}) { }
841 8921 19798 $opt->{'_decode_array'} ? :