Branch Coverage

blib/lib/Color/RGB/Util.pm
Criterion Covered Total %
branch 108 166 65.0


line true false branch
46 0 0 $_[0] < $_[1] ? :
51 7 5 if abs $h > 360
52 10 2 $h >= 0 ? :
70 2 1 rgb_is_dark($rgb) ? :
77 1 2 rgb_is_light($rgb) ? :
95 1 8 unless my($r1, $g1, $b1) = $rgb1 =~ /$re_rgb/
97 0 8 unless my($r2, $g2, $b2) = $rgb2 =~ /$re_rgb/
114 1 9 unless my($r, $g, $b) = $rgb =~ /$re_rgb/
125 2 3 unless $tot_weight > 0
138 0 88 unless my($r1, $g1, $b1) = $rgb1 =~ /$re_rgb/
141 0 88 unless my($r2, $g2, $b2) = $rgb2 =~ /$re_rgb/
153 0 31 ref $_[0] eq 'HASH' ? :
155 0 31 exists $opts->{'light_color'} ? :
171 58 0 if ($light_color) { }
0 0 elsif (defined $light_color) { }
172 23 35 if (rgb_is_dark($rgb))
174 0 0 if (rgb_is_light($rgb))
176 0 35 if ($avoid_colors and ref $avoid_colors eq 'ARRAY')
177 0 0 if (grep {$rgb eq $_;} @$avoid_colors)
179 0 35 if ($avoid_colors and ref $avoid_colors eq 'HASH')
180 0 0 if ($avoid_colors->{$rgb})
184 35 10 if @res - $_ < 0
186 0 10 if (rgb_diff($rgb, $prev_rgb, 'approx2') < $min_distance)
190 35 23 unless $reject
191 0 23 if ++$num_attempts >= $max_attempts
193 0 35 $hash_prefix ? :
201 0 1 unless my($r, $g, $b) = $rgb =~ /$re_rgb/
211 0 1 unless my($r, $g, $b) = $rgb =~ /$re_rgb/
224 0 65 unless $rgb =~ /$re_rgb/
232 0 1 unless my($r, $g, $b) = $rgb =~ /$re_rgb/
240 0 3 if $_ > 255
249 0 44 unless my($r1, $g1, $b1) = $rgb1 =~ /$re_rgb/
251 0 44 unless my($r2, $g2, $b2) = $rgb2 =~ /$re_rgb/
259 44 0 if ($algo eq 'approx1' or $algo eq 'approx2') { }
0 0 elsif ($algo eq 'hsv_euclidean' or $algo eq 'hsv_hue1') { }
261 3 41 if ($algo eq 'approx1') { }
264 40 1 if ($rm < 128) { }
280 0 0 if ($algo eq 'hsv_hue1') { }
293 0 147 unless my($r1, $g1, $b1) = $rgb1 =~ /$re_rgb/
295 0 147 unless my($r2, $g2, $b2) = $rgb2 =~ /$re_rgb/
304 27 38 rgb_distance($rgb, '000000') < rgb_distance($rgb, 'ffffff') ? :
309 3 4 rgb_distance($rgb, '000000') > rgb_distance($rgb, 'ffffff') ? :
320 0 3 unless my($r, $g, $b) = $rgb =~ /$re_rgb/
332 0 5 unless my($r1, $g1, $b1) = $rgb1 =~ /$re_rgb/
334 0 5 unless my($r2, $g2, $b2) = $rgb2 =~ /$re_rgb/
350 0 3 unless my($r, $g, $b) = $rgb =~ /$re_rgb/
358 1 2 if ($g > $max)
362 1 2 if ($b > $max)
367 1 2 if ($g < $min)
370 0 3 if ($b < $min)
375 0 3 if ($max == $min) { }
1 2 elsif ($maxc eq 'r') { }
1 1 elsif ($maxc eq 'g') { }
1 0 elsif ($maxc eq 'b') { }
387 0 3 if ($max == $min) { }
2 1 elsif ($l <= 0.5) { }
401 0 3 unless my($r, $g, $b) = $rgb =~ /$re_rgb/
409 1 2 if ($g > $max)
413 1 2 if ($b > $max)
418 1 2 if ($g < $min)
421 0 3 if ($b < $min)
427 0 3 if ($max == $min) { }
1 2 elsif ($maxc eq 'r') { }
1 1 elsif ($maxc eq 'g') { }
1 0 elsif ($maxc eq 'b') { }
438 0 3 if ($max == 0) { }
451 2 7 unless $h >= 0 and $h <= 360
0 9 unless $s >= 0 and $s <= 1
0 9 unless $l >= 0 and $l <= 1
457 7 2 $l <= 1 ? :
468 1 4 unless $h >= 0 and $h <= 360
0 5 unless $s >= 0 and $s <= 1
0 5 unless $v >= 0 and $v <= 1
473 0 4 $_l == 0 ? :
4 1 $_l <= 1 ? :
487 1 7 unless $h >= 0 and $h <= 360
0 8 unless $s >= 0 and $s <= 1
0 8 unless $v >= 0 and $v <= 1
496 4 4 if ($i == 0) { }
0 4 elsif ($i == 1) { }
2 2 elsif ($i == 2) { }
0 2 elsif ($i == 3) { }
2 0 elsif ($i == 4) { }