Branch Coverage

blib/lib/Image/PBMlib.pm
Criterion Covered Total %
branch 395 550 71.8


line true false branch
144 0 13 if (not defined $rc or $rc != 3)
150 2 11 if ($in =~ /\nP[123456]/)
154 2 0 if ($rc and $peek eq "\n")
160 13 0 if ($in =~ /^P([123456])\s/) { }
162 8 5 if ($$ir{'type'} > 3) { }
170 5 8 if ($$ir{'type'} == 1 or $$ir{'type'} == 4) { }
4 4 elsif ($$ir{'type'} == 2 or $$ir{'type'} == 5) { }
181 0 88 if (not defined $rc or $rc != 1)
195 20 68 if ($$ir{'bgp'} eq 'b') { }
196 5 15 if ($no_comments =~ /^P\d\s+(\d+)\s+(\d+)\s/)
204 8 60 if ($no_comments =~ /^P\d\s+(\d+)\s+(\d+)\s+(\d+)\s/)
232 4 12 if ($v >= $m) { }
0 12 elsif ($v == 0) { }
256 2 42 if ($r > $m)
257 0 44 if ($g > $m)
258 2 42 if ($b > $m)
281 17 76 if ($v >= 0.999999) { }
65 11 elsif ($v <= 1e-06) { }
323 1 7 if ($v >= 0.999999) { }
0 7 elsif ($v <= 1e-06) { }
367 12 27 if ($type == 6)
370 9 18 if ($type == 5)
373 3 15 if ($type == 4)
376 5 10 if ($type == 3)
379 7 3 if ($type == 2)
382 3 0 if ($type == 1)
406 16 4 $1 ? :
409 1 19 if ($used >= $$ir{'pixels'})
411 4 15 if ($w >= $$ir{'width'})
418 0 1 if ($used < $$ir{'pixels'}) { }
438 1 2 if ($deep eq '1d') { }
450 0 60 if ($enc eq 'float') { }
451 0 0 if ($cur > 0.5) { }
458 12 48 if ($cur) { }
466 0 60 if ($wide > 70)
473 20 40 if ($deep eq '1d') { }
474 19 1 if (exists $$pr[$w] and defined $$pr[$w]) { }
480 11 29 unless (exists $$pr[$h][$w])
484 37 3 if (exists $$pr[$h][$w] and defined $$pr[$h][$w]) { }
492 3 0 if ($wide)
516 0 40 if ($enc eq 'dec') { }
0 40 elsif ($enc eq 'hex') { }
521 32 8 if ($val >= $$ir{'max'}) { }
8 0 elsif ($val == 0) { }
532 2 38 if ($used >= $$ir{'pixels'})
534 8 30 if ($w >= $$ir{'width'})
541 0 2 if ($used < $$ir{'pixels'}) { }
563 3 4 if ($deep eq '1d') { }
575 20 109 if ($enc eq 'float') { }
29 80 elsif ($enc eq 'hex') { }
586 2 127 if ($val > $max)
590 0 129 if (70 < $wide + 1 + length($val))
599 49 80 if ($deep eq '1d') { }
600 46 3 if (exists $$pr[$w] and defined $$pr[$w]) { }
606 23 57 unless (exists $$pr[$h][$w])
610 73 7 if (exists $$pr[$h][$w] and defined $$pr[$h][$w]) { }
618 7 0 if ($wide)
646 0 120 if ($enc eq 'dec') { }
0 120 elsif ($enc eq 'hex') { }
651 96 24 if ($val >= $$ir{'max'}) { }
24 0 elsif ($val == 0) { }
660 40 80 if ($state eq 'r') { }
40 40 elsif ($state eq 'g') { }
671 2 38 if ($used >= $$ir{'pixels'})
673 8 30 if ($w >= $$ir{'width'})
683 0 2 if ($used < $$ir{'pixels'}) { }
706 0 5 if ($deep eq '1d') { }
719 60 240 if ($enc eq 'float') { }
60 180 elsif ($enc eq 'hex') { }
730 0 300 if ($val > $max)
734 6 294 if (70 < $wide + 1 + length($val))
744 0 100 if ($deep eq '1d') { }
745 0 0 if (exists $$pr[$w] and defined $$pr[$w]) { }
751 25 75 unless (exists $$pr[$h][$w])
755 95 5 if (exists $$pr[$h][$w] and defined $$pr[$h][$w]) { }
763 5 0 if ($wide)
791 4 76 if ($used >= $$ir{'pixels'})
793 16 60 if ($w >= $$ir{'width'})
802 0 4 if ($used < $$ir{'pixels'}) { }
823 0 3 if ($deep eq '1d') { }
835 0 57 if ($enc eq 'float') { }
836 0 0 if ($cur > 0.5) { }
843 32 25 if ($cur) { }
851 3 54 if ($used == 8)
859 0 57 if ($deep eq '1d') { }
860 0 0 if (exists $$pr[$w] and defined $$pr[$w]) { }
866 11 46 unless (exists $$pr[$h][$w])
871 8 3 if ($used)
877 52 5 if (exists $$pr[$h][$w] and defined $$pr[$h][$w]) { }
885 0 3 if ($used)
907 1 1 if ($$ir{'max'} > 255)
912 40 0 if ($rc == $expect)
913 20 20 if ($expect == 1) { }
921 0 40 if ($enc eq 'dec') { }
0 40 elsif ($enc eq 'hex') { }
926 32 8 if ($val >= $$ir{'max'}) { }
8 0 elsif ($val == 0) { }
937 2 38 if ($used >= $$ir{'pixels'})
939 8 30 if ($w >= $$ir{'width'})
946 0 2 if ($used < $$ir{'pixels'}) { }
969 2 7 if ($max > 255) { }
974 2 7 if ($deep eq '1d') { }
986 3 69 if ($enc eq 'float') { }
69 0 elsif ($enc eq 'hex') { }
997 0 72 if ($val > $max)
1005 18 54 if ($deep eq '1d') { }
1006 16 2 if (exists $$pr[$w] and defined $$pr[$w]) { }
1012 11 43 unless (exists $$pr[$h][$w])
1016 47 7 if (exists $$pr[$h][$w] and defined $$pr[$h][$w]) { }
1048 1 1 if ($$ir{'max'} > 255)
1053 40 0 if ($rc == $expect)
1054 20 20 if ($expect == 3) { }
1063 0 40 if ($enc eq 'dec') { }
0 40 elsif ($enc eq 'hex') { }
1073 2 38 if ($used >= $$ir{'pixels'})
1075 8 30 if ($w >= $$ir{'width'})
1083 0 2 if ($used < $$ir{'pixels'}) { }
1106 1 11 if ($max > 255) { }
1112 0 12 if ($deep eq '1d') { }
1125 0 75 if ($enc eq 'float') { }
0 75 elsif ($enc eq 'hex') { }
1136 0 75 if ($val > $max)
1145 0 25 if ($deep eq '1d') { }
1146 0 0 if (exists $$pr[$w] and defined $$pr[$w]) { }
1152 14 11 unless (exists $$pr[$h][$w])
1156 13 12 if (exists $$pr[$h][$w] and defined $$pr[$h][$w]) { }
1177 2 11 if ($$ir{'type'} == 6)
1178 2 9 if ($$ir{'type'} == 5)
1179 4 5 if ($$ir{'type'} == 4)
1180 2 3 if ($$ir{'type'} == 3)
1181 2 1 if ($$ir{'type'} == 2)
1182 1 0 if ($$ir{'type'} == 1)
1196 18 18 if ($fmt =~ /^raw$/i) { }
17 1 elsif ($fmt =~ /^ascii$/i) { }
1205 0 35 if (not $max =~ /^\d+$/ or $max < 1 or $max > 65535)
1209 11 24 if ($max > 255) { }
1215 0 35 if (ref $p_r ne 'ARRAY')
1220 8 27 if (ref $$p_r[0] eq '') { }
21 6 elsif (ref $$p_r[0] eq 'ARRAY' and ref $$p_r[0][0] eq '') { }
6 0 elsif (ref $$p_r[0][0] eq 'ARRAY' and ref $$p_r[0][0][0] eq '') { }
1245 1 34 unless (defined $inspect{'first'})
1249 4 30 if ($inspect{'first'} =~ /^[.0-9]+,/) { }
14 16 elsif ($inspect{'first'} =~ /^[0-9]+:/) { }
8 8 elsif ($inspect{'first'} =~ m[^[0-9a-fA-F]+/]) { }
8 0 elsif ($inspect{'first'} =~ /^[01]+$/) { }
1267 6 28 if ($max == 1) { }
6 22 elsif ($inspect{'deep'} eq '3d') { }
1275 7 15 if ($inspect{'first'} =~ m[^[.0-9a-fA-F]+[,:/][.0-9a-fA-F]+[,:/][.0-9a-fA-F]+]) { }
1394 0 13 if ('HASH' ne ref $i_r)
1399 0 13 if ('GLOB' ne ref $f_r)
1404 0 13 if ('ARRAY' ne ref $p_r)
1409 13 0 if ($enc =~ /^(float|dec|raw)/i) { }
1418 0 13 if (length $$i_r{'error'})
1424 0 13 if (exists $$i_r{'error'} and length $$i_r{'error'})
1430 0 13 if (length $$i_r{'error'})
1453 0 13 if (not exists $$i_r{'type'} && $$i_r{'type'} =~ /^\d/ && (exists $$i_r{'pixels'} && $$i_r{'pixels'} =~ /^\d/) && (exists $$i_r{'max'} && $$i_r{'max'} =~ /^\d/) && (exists $$i_r{'width'} && $$i_r{'width'} =~ /^\d/) && (exists $$i_r{'height'} && $$i_r{'height'} =~ /^\d/))
1483 0 0 if ('HASH' ne ref $i_r)
1488 0 0 if ('GLOB' ne ref $f_r)
1495 0 0 if (length $$i_r{'error'})
1501 0 0 if (exists $$i_r{'error'} and length $$i_r{'error'})
1531 0 0 if ('HASH' ne ref $i_r)
1536 0 0 if ('GLOB' ne ref $g_r)
1541 0 0 if ('ARRAY' ne ref $p_r)
1546 0 0 if ($enc =~ /^(float|dec|raw)/i) { }
1554 0 0 if (exists $$i_r{'error'} and length $$i_r{'error'})
1560 0 0 if (exists $$i_r{'error'} and length $$i_r{'error'})
1598 2 2 if (wantarray)
1601 1 1 if (ref $trip eq 'ARRAY') { }
1 0 elsif ($trip =~ m[^([0-9a-fA-F]+)/([0-9a-fA-F]+)/([0-9a-fA-F]+)/?$]) { }
1615 1 1 if (ref $trip eq 'ARRAY') { }
1 0 elsif ($trip =~ m[^([0-9a-fA-F]+)/([0-9a-fA-F]+)/([0-9a-fA-F]+)/?$]) { }
1656 2 2 if (wantarray)
1659 1 1 if (ref $trip eq 'ARRAY') { }
1 0 elsif ($trip =~ /^(\d+):(\d+):(\d+):?$/) { }
1672 1 1 if (ref $trip eq 'ARRAY') { }
1 0 elsif ($trip =~ /^(\d+):(\d+):(\d+):?$/) { }
1705 2 0 if ($val =~ m[^([a-fA-F0-9]+)/?$])
1735 2 0 if ($val =~ /^(\d+):?$/)
1769 0 0 if (wantarray)
1772 0 0 if (ref $trip eq 'ARRAY') { }
0 0 elsif ($trip =~ /^([.\d+]),([.\d+]),([.\d+]),?$/) { }
1785 0 0 if (ref $trip eq 'ARRAY') { }
0 0 elsif ($trip =~ /^([.\d+]),([.\d+]),([.\d+]),?$/) { }
1823 0 0 if (wantarray)
1826 0 0 if (ref $trip eq 'ARRAY') { }
0 0 elsif ($trip =~ /^([.\d+]),([.\d+]),([.\d+]),?$/) { }
1839 0 0 if (ref $trip eq 'ARRAY') { }
0 0 elsif ($trip =~ /^([.\d+]),([.\d+]),([.\d+]),?$/) { }
1932 0 4 unless (defined $a_r and defined $b_r)
1935 0 4 if ($v)
1938 1 3 if ($v)
1970 2 13 if ($low_a > $b)
1971 2 11 if ($hi_a < $b)
2000 2 2 if ($a =~ s[/$][]) { }
2005 2 2 if ($b =~ s[/$][]) { }
2011 2 2 if ($a_m == $b_m)
2057 0 4 unless (defined $a_r and defined $b_r)
2060 2 2 if ($a_r =~ s[/$][]) { }
2061 2 2 if ($a_g =~ s[/$][]) { }
2062 2 2 if ($a_b =~ s[/$][]) { }
2063 2 2 if ($b_r =~ s[/$][]) { }
2064 2 2 if ($b_g =~ s[/$][]) { }
2065 2 2 if ($b_b =~ s[/$][]) { }
2067 2 2 if ($a_m == $b_m)
2076 0 2 if ($v)
2082 0 2 if ($v)
2114 49 109 if (ref $a eq 'ARRAY') { }
2119 58 51 if ($a =~ /^(\d+):(\d+):(\d+):?$/) { }
27 24 elsif ($a =~ m[^([0-9a-fA-F]+)/([0-9a-fA-F]+)/([0-9a-fA-F]+)/?$]) { }
24 0 elsif ($a =~ /^([.0-9]+),([.0-9]+),([.0-9]+),?$/) { }
2169 0 6 unless (defined $p_r)
2171 3 3 if ($p_r =~ /:/) { }
2 1 elsif ($p_r =~ m[/]) { }
2178 5 1 if (defined $enc)
2184 2 4 if (wantarray) { }
2216 6 13 if ($o_m == $n_m)
2221 7 6 if ($v =~ /:$/) { }
5 1 elsif ($v =~ m[/$]) { }
1 0 elsif ($v =~ /,$/) { }
2279 2 14 if (ref $hr ne 'HASH') { }
2285 0 2 unless (defined $type and defined $w and defined $h)
2289 0 2 unless ($type =~ /^[123456]$/)
2292 0 2 unless ($w =~ /^\d+$/)
2295 0 2 unless ($h =~ /^\d+$/)
2301 14 0 if (defined $$hr{'width'} and $$hr{'width'} =~ /^\d+$/) { }
2307 14 0 if (defined $$hr{'height'} and $$hr{'height'} =~ /^\d+$/) { }
2313 12 2 if (defined $$hr{'max'} and $$hr{'max'} =~ /^\d+$/) { }
2320 12 2 if (defined $$hr{'type'} and $$hr{'type'} =~ /^[123456]$/) { }
2 0 elsif (defined $$hr{'bgp'} and defined $$hr{'format'} and $$hr{'bgp'} =~ /^([bgp])$/i) { }
2327 0 2 if ($bgp eq 'b') { }
2 0 elsif ($bgp eq 'g') { }
2335 1 1 if ($$hr{'format'} =~ /raw/i) { }
0 1 elsif (not $$hr{'format'} =~ /ascii/i) { }
2346 11 3 if (defined $$hr{'comments'} and length $$hr{'comments'})
2349 11 0 if (substr($com, -1, 1) ne "\n")
2356 0 16 if ($w < 1 or $h < 1)
2363 14 2 if ($type != 1 and $type != 4)
2364 0 14 if (not defined $max or $max < 1 or $max > 65535)
2368 1 13 if ($setmax)
2421 0 21 if (exists $$i{'error'} and length $$i{'error'})
2467 0 5 if (ref $f_r ne 'GLOB' or ref $i_r ne 'HASH' or ref $p_r ne 'ARRAY')
2472 0 5 unless (defined $header)
2479 5 0 unless (defined $fmt)
2480 4 1 if ($$i_r{'type'} > 3) { }
2488 0 5 if (exists $$inspect{'error'} and length $$inspect{'error'})
2498 0 5 if ($rc != length $header)
2503 3 2 if ($deep eq '1d')
2508 0 3 if ($rc != length $pixels)
2518 0 15 if ($rc != length $pixels)
2624 2 8 if (exists $$i_r{'error'} and length $$i_r{'error'})
2635 2 6 if ($$i_r{'deep'} eq '1d') { }
2641 11 21 if ($$i_r{'deep'} eq '3d') { }
0 21 elsif (ref $cur ne '') { }
8 13 elsif ($$i_r{'type'} == 6 or $$i_r{'type'} == 3) { }
13 0 elsif ($$i_r{'type'} == 5 or $$i_r{'type'} == 2) { }
2642 1 10 if (ref $cur ne 'ARRAY') { }
0 10 elsif ($#{$cur;} != 2) { }
1 9 elsif (not checkval($$cur[0], $$i_r{'encode'}) && checkval($$cur[1], $$i_r{'encode'}) && checkval($$cur[2], $$i_r{'encode'})) { }
2663 0 8 if ($#rgb != 2) { }
1 7 elsif (not checkval($rgb[0], $$i_r{'encode'}) && checkval($rgb[1], $$i_r{'encode'}) && checkval($rgb[2], $$i_r{'encode'})) { }
2674 1 12 unless (checkval($cur, $$i_r{'encode'}))
2679 4 28 if (length $$i_r{'error'})
2688 3 25 if ($checked == $$i_r{'pixels'})
2692 8 17 if ($$i_r{'deep'} eq '1d') { }
2697 5 12 if ($w > $$i_r{'width'} - 1)
2698 0 5 if (exists $$p_r[$h][$w]) { }
2706 0 17 unless (exists $$p_r[$h][$w])
2716 1 3 if ($checked != $$i_r{'pixels'})
2741 0 65 unless (defined $v and defined $enc)
2745 7 58 if ($enc eq 'float') { }
34 24 elsif ($enc eq 'dec') { }
24 0 elsif ($enc eq 'hex') { }
2746 7 0 if ($v =~ /^[.\d]+,$/)
2750 31 3 if ($v =~ /^[\d]+:$/)
2754 24 0 if ($v =~ m[^[\da-fA-F]+/$])