Branch Coverage

blib/lib/BSON/PP.pm
Criterion Covered Total %
branch 246 284 86.6


line true false branch
77 5 0 if ($] ge 5.01) { }
93 48 22 $started ? :
94 21 49 unless defined $k
105 0 30576 if $ENV{'BSON_TEST_SORT_HASH'}
108 30367 148773 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 18243 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 30724 if $opt->{'_circular'}{$refaddr}++
189 2491 28233 unless defined $opt->{'_depth'}
191 2 30722 if ($opt->{'_depth'} > 100)
197 103 30619 if ($doc_type eq 'BSON::Raw' or $doc_type eq 'MongoDB::BSON::_EncodedDoc')
203 3 30616 if ($doc_type eq 'MongoDB::BSON::Raw')
215 1 1 $doc_type eq 'MongoDB::DBRef' ? :
15 2 $doc_type eq 'BSON::DBRef' ? :
6 17 $doc_type eq 'Tie::IxHash' ? :
17 23 $doc_type eq 'BSON::Doc' ? :
30576 40 $doc_type eq 'HASH' ? :
219 2 30613 defined $opt->{'op_char'} ? :
221 2 30613 length $opt->{'invalid_chars'} ? :
230 1 148846 if defined $first_key and $key eq $first_key
232 2 148844 if ($first_key_pending)
238 0 148846 unless defined $key
240 1 148845 unless -1 == index($key, "\000")
243 1 148844 if length $op_char and substr($key, 0, 1) eq $op_char
246 2 148843 if ($invalid and $key =~ /$invalid/)
260 92955 55888 if (&blessed($value))
261 47 92908 unless ($type =~ /\ABSON::\w+\z/)
263 7 40 if defined $parent
268 9098 139745 if (not defined $value) { }
112176 27569 elsif (length $type) { }
276 9056 103120 if ($type eq 'ARRAY' or $type eq 'BSON::Array') { }
4 103116 elsif ($type eq 'BSON::DBPointer') { }
10290 92826 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 92822 elsif ($type eq 'Regexp') { }
9223 83599 elsif ($type eq 'BSON::Regex' or $type eq 'MongoDB::BSON::Regexp') { }
9142 74457 elsif ($type eq 'BSON::OID' or $type eq 'BSON::ObjectId') { }
0 74457 elsif ($type eq 'MongoDB::OID') { }
9092 65365 elsif ($type eq 'BSON::Time') { }
1 65364 elsif ($type eq 'Time::Moment') { }
0 65364 elsif ($type eq 'DateTime') { }
0 65364 elsif ($type eq 'DateTime::Tiny') { }
0 65364 elsif ($type eq 'Mango::BSON::Time') { }
9086 56278 elsif ($type eq 'BSON::Timestamp') { }
0 56278 elsif ($type eq 'MongoDB::Timestamp') { }
9085 47193 elsif ($type eq 'BSON::MinKey' or $type eq 'MongoDB::MinKey') { }
9144 38049 elsif ($type eq 'BSON::MaxKey' or $type eq 'MongoDB::MaxKey') { }
9077 28972 elsif ($type eq 'SCALAR' or $type eq 'BSON::Bytes' or $type eq 'BSON::Binary' or $type eq 'MongoDB::BSON::Binary') { }
9172 19800 elsif ($type eq 'BSON::Code' or $type eq 'MongoDB::Code') { }
9090 10710 elsif ($type eq 'boolean' or $type =~ /$bools_re/) { }
9104 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' ? :
9071 4 $type eq 'BSON::Bytes' ? :
2 9075 $type eq 'SCALAR' ? :
378 2 9075 $type eq 'SCALAR' ? :
380 2 9075 if ($subtype == 2) { }
396 8887 285 if (ref $value->scope eq 'HASH') { }
408 4511 4579 $value ? :
426 0 24 if ($value > $max_int64 or $value < $min_int64)
431 16 8 if ($type eq 'BSON::Int64')
467 9188 18381 if ($flags & 512) { }
18255 126 elsif ($flags & 256) { }
3 123 elsif ($opt->{'prefer_numeric'} and &looks_like_number($value)) { }
473 0 18255 if ($value > $max_int64 or $value < $min_int64) { }
9136 9119 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 29596 unless (defined $bson)
566 2158 27438 unless defined $opt->{'_depth'}
568 1 29595 if ($opt->{'_depth'} > 100)
573 15 29580 if (length $bson != $len)
576 5 29575 if (chop $bson ne "\000")
582 1485 28090 if $opt->{'ordered'}
590 8 147691 unless (defined $min_size)
593 12 147679 if (length $bson < $min_size)
598 9234 138445 if ($type == 1) { }
9238 129207 elsif ($type == 2 or $type == 14) { }
18550 110657 elsif ($type == 3 or $type == 4) { }
9079 101578 elsif ($type == 5) { }
2 101576 elsif ($type == 6) { }
9135 92441 elsif ($type == 7) { }
9092 83349 elsif ($type == 8) { }
9096 74253 elsif ($type == 9) { }
9090 65163 elsif ($type == 10) { }
9227 55936 elsif ($type == 11) { }
11 55925 elsif ($type == 12) { }
285 55640 elsif ($type == 13) { }
8898 46742 elsif ($type == 15) { }
9057 37685 elsif ($type == 16) { }
9085 28600 elsif ($type == 17) { }
9165 19435 elsif ($type == 18) { }
1206 18229 elsif ($type == 19) { }
9085 9144 elsif ($type == 255) { }
9144 0 elsif ($type == 127) { }
600 51 9183 if $opt->{'wrap_numbers'}
606 11 9227 if (length $bson < $len or substr($bson, $len - 1, 1) ne "\000")
611 3 9224 unless (utf8::decode($value))
614 6 9218 if $opt->{'wrap_strings'}
621 12 0 if ($opt->{'wrap_dbrefs'} and $type == 3 and exists $value->{'$id'} and exists $value->{'$ref'})
632 1 9078 if ($len < 0)
635 1 9077 if ($len > length $bson)
641 5 9072 if ($btype == 2)
642 0 5 if ($len < 4)
647 3 2 if ($sublen != length($binary) - 4)
671 2 9090 unless $bool == 0 or $bool == 1
687 2 9094 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' ? :
1 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 285 if (length $bson < $len or substr($bson, $len - 1, 1) ne "\000")
732 0 285 unless (utf8::decode($value))
743 1 8897 if ($len < 0)
746 2 8895 if ($len > length $bson)
749 1 8894 if ($len < 5)
761 1 8893 if (length $codewscope < $strlen or substr($codewscope, -1, 1) ne "\000")
767 0 8893 unless (utf8::decode($code))
771 2 8891 if (length $codewscope < 5)
777 3 8888 if (length $codewscope < $scopelen or substr($codewscope, $scopelen - 1, 1) ne "\000")
789 38 9019 if $opt->{'wrap_numbers'}
807 21 9144 if $opt->{'wrap_numbers'}
833 28031 119503 if ($opt->{'_decode_array'}) { }
841 9053 20357 $opt->{'_decode_array'} ? :