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 28363 if $ENV{'BSON_TEST_SORT_HASH'}
108 28154 137599 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 16815 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 28510 if $opt->{'_circular'}{$refaddr}++
189 2482 26028 unless defined $opt->{'_depth'}
191 2 28508 if ($opt->{'_depth'} > 100)
197 103 28405 if ($doc_type eq 'BSON::Raw' or $doc_type eq 'MongoDB::BSON::_EncodedDoc')
203 3 28402 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' ? :
28363 39 $doc_type eq 'HASH' ? :
219 2 28399 defined $opt->{'op_char'} ? :
221 2 28399 length $opt->{'invalid_chars'} ? :
230 1 137670 if defined $first_key and $key eq $first_key
232 2 137668 if ($first_key_pending)
238 0 137670 unless defined $key
240 1 137669 unless -1 == index($key, "\000")
243 1 137668 if length $op_char and substr($key, 0, 1) eq $op_char
246 2 137667 if ($invalid and $key =~ /$invalid/)
260 86247 51420 if (&blessed($value))
261 39 86208 unless ($type =~ /\ABSON::\w+\z/)
263 0 39 if defined $parent
268 8367 129300 if (not defined $value) { }
103889 25411 elsif (length $type) { }
276 8425 95464 if ($type eq 'ARRAY' or $type eq 'BSON::Array') { }
4 95460 elsif ($type eq 'BSON::DBPointer') { }
9341 86119 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 86115 elsif ($type eq 'Regexp') { }
8389 77726 elsif ($type eq 'BSON::Regex' or $type eq 'MongoDB::BSON::Regexp') { }
8553 69173 elsif ($type eq 'BSON::OID' or $type eq 'BSON::ObjectId') { }
0 69173 elsif ($type eq 'MongoDB::OID') { }
8434 60739 elsif ($type eq 'BSON::Time') { }
0 60739 elsif ($type eq 'Time::Moment') { }
0 60739 elsif ($type eq 'DateTime') { }
0 60739 elsif ($type eq 'DateTime::Tiny') { }
0 60739 elsif ($type eq 'Mango::BSON::Time') { }
8376 52363 elsif ($type eq 'BSON::Timestamp') { }
0 52363 elsif ($type eq 'MongoDB::Timestamp') { }
8288 44075 elsif ($type eq 'BSON::MinKey' or $type eq 'MongoDB::MinKey') { }
8445 35630 elsif ($type eq 'BSON::MaxKey' or $type eq 'MongoDB::MaxKey') { }
8425 27205 elsif ($type eq 'SCALAR' or $type eq 'BSON::Bytes' or $type eq 'BSON::Binary' or $type eq 'MongoDB::BSON::Binary') { }
8530 18675 elsif ($type eq 'BSON::Code' or $type eq 'MongoDB::Code') { }
8425 10250 elsif ($type eq 'boolean' or $type =~ /$bools_re/) { }
8644 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' ? :
8419 4 $type eq 'BSON::Bytes' ? :
2 8423 $type eq 'SCALAR' ? :
378 2 8423 $type eq 'SCALAR' ? :
380 2 8423 if ($subtype == 2) { }
396 8262 268 if (ref $value->scope eq 'HASH') { }
408 4195 4230 $value ? :
426 0 24 if ($value > $max_int64 or $value < $min_int64)
431 16 8 if ($type eq 'BSON::Int64')
467 8419 16992 if ($flags & 512) { }
16868 124 elsif ($flags & 256) { }
3 121 elsif ($opt->{'prefer_numeric'} and &looks_like_number($value)) { }
473 0 16868 if ($value > $max_int64 or $value < $min_int64) { }
8367 8501 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 27381 unless (defined $bson)
566 2147 25234 unless defined $opt->{'_depth'}
568 1 27380 if ($opt->{'_depth'} > 100)
573 13 27367 if (length $bson != $len)
576 5 27362 if (chop $bson ne "\000")
582 1485 25877 if $opt->{'ordered'}
590 8 136517 unless (defined $min_size)
593 12 136505 if (length $bson < $min_size)
598 8465 128040 if ($type == 1) { }
8776 119264 elsif ($type == 2 or $type == 14) { }
16971 102293 elsif ($type == 3 or $type == 4) { }
8427 93866 elsif ($type == 5) { }
2 93864 elsif ($type == 6) { }
8546 85318 elsif ($type == 7) { }
8427 76891 elsif ($type == 8) { }
8437 68454 elsif ($type == 9) { }
8359 60095 elsif ($type == 10) { }
8393 51702 elsif ($type == 11) { }
11 51691 elsif ($type == 12) { }
268 51423 elsif ($type == 13) { }
8273 43150 elsif ($type == 15) { }
8440 34710 elsif ($type == 16) { }
8375 26335 elsif ($type == 17) { }
8396 17939 elsif ($type == 18) { }
1206 16733 elsif ($type == 19) { }
8288 8445 elsif ($type == 255) { }
8445 0 elsif ($type == 127) { }
600 51 8414 if $opt->{'wrap_numbers'}
606 11 8765 if (length $bson < $len or substr($bson, $len - 1, 1) ne "\000")
611 3 8762 unless (utf8::decode($value))
614 6 8756 if $opt->{'wrap_strings'}
621 11 0 if ($opt->{'wrap_dbrefs'} and $type == 3 and exists $value->{'$id'} and exists $value->{'$ref'})
632 1 8426 if ($len < 0)
635 1 8425 if ($len > length $bson)
641 5 8420 if ($btype == 2)
642 0 5 if ($len < 4)
647 3 2 if ($sublen != length($binary) - 4)
671 2 8425 unless $bool == 0 or $bool == 1
687 1 8436 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 268 if (length $bson < $len or substr($bson, $len - 1, 1) ne "\000")
732 0 268 unless (utf8::decode($value))
743 1 8272 if ($len < 0)
746 2 8270 if ($len > length $bson)
749 1 8269 if ($len < 5)
761 1 8268 if (length $codewscope < $strlen or substr($codewscope, -1, 1) ne "\000")
767 0 8268 unless (utf8::decode($code))
771 2 8266 if (length $codewscope < 5)
777 3 8263 if (length $codewscope < $scopelen or substr($codewscope, $scopelen - 1, 1) ne "\000")
789 38 8402 if $opt->{'wrap_numbers'}
807 21 8375 if $opt->{'wrap_numbers'}
833 25069 111291 if ($opt->{'_decode_array'}) { }
841 8422 18775 $opt->{'_decode_array'} ? :