Branch Coverage

blib/lib/Net/BitTorrent/Protocol.pm
Criterion Covered Total %
branch 88 106 83.0


line true false branch
82 4 94 if (grep {not defined $_;} @_[0..2] or length $reserved != 8 or length $infohash != 20 or length $peerid != 20)
103 3 40 unless (defined $index and $index =~ /^\d+$/)
113 2 3 unless ($bitfield and unpack('b*', $bitfield) =~ /^[01]+$/)
123 4 15 unless (defined $index and $index =~ /^\d+$/)
128 3 12 unless (defined $offset and $offset =~ /^\d+$/)
133 3 9 unless (defined $length and $length =~ /^\d+$/)
144 3 14 unless (defined $index and $index =~ /^\d+$/)
149 3 11 unless (defined $offset and $offset =~ /^\d+$/)
154 1 10 unless ($data and $$data)
165 4 9 unless (defined $index and $index =~ /^\d+$/)
170 3 6 unless (defined $offset and $offset =~ /^\d+$/)
175 3 3 unless (defined $length and $length =~ /^\d+$/)
186 4 3 unless (defined $port and $port =~ /^\d+$/)
196 4 5 unless (defined $index and $index =~ /^\d+$/)
208 3 10 unless (defined $index and $index =~ /^\d+$/)
213 3 7 unless (defined $offset and $offset =~ /^\d+$/)
218 3 4 unless (defined $length and $length =~ /^\d+$/)
229 4 5 unless (defined $index and $index =~ /^\d+$/)
239 4 72 unless (defined $msgID and $msgID =~ /^\d+$/)
244 4 68 if (not $data or ref $data ne 'HASH')
273 4 269 if (not $data or ref $data ne 'SCALAR' or not $$data)
279 66 203 if (unpack('c', $$data) == 19) { }
203 0 elsif (defined unpack('N', $$data) and unpack('N', $$data) =~ /\d/) { }
281 66 0 if @payload
288 202 1 if (unpack('N', $$data) <= length $$data)
291 200 2 if (defined $parse_packet_dispatch{$type}) { }
0 2 elsif (eval 'require Data::Dump') { }
293 99 101 defined $payload ? :
316 3 68 if (not $packet or length $packet < 68)
323 1 67 if ($protocol_name ne 'BitTorrent protocol')
339 2 32 if (not $packet or length $packet < 1)
349 2 5 if (not $packet or length $packet < 1)
359 2 11 if (not $packet or length $packet < 9)
372 3 9 if (not $packet or length $packet < 9)
385 2 5 if (not $packet or length $packet < 9)
398 2 8 if (not $packet or length $packet < 1)
408 2 9 if (not $packet or length $packet < 1)
420 2 6 if (not $packet or length $packet < 9)
433 2 9 if (not $packet or length $packet < 1)
443 2 52 unless ($packet and length $packet)
450 0 0 unless (defined $tid)
455 0 0 unless (defined $id)
472 0 18 unless (defined $tid)
477 0 18 unless (defined $id)
482 0 18 unless (defined $token)
487 0 18 if (not defined $infohash or length $infohash != 20)
492 0 18 unless (defined $tid and $port =~ /^\d+$/)
513 0 47 unless (defined $tid)
518 0 47 unless (defined $id)
523 0 47 if (not defined $target or length $target != 20)
542 0 34 unless (defined $tid)
547 0 34 unless (defined $id)
552 0 34 if (not defined $info_hash or length $info_hash != 20)