Branch Coverage

blib/lib/Data/FeatureFactory.pm
Criterion Covered Total %
branch 321 416 77.1


line true false branch
29 0 30 if ref $class
30 0 30 if @_ > 2
33 3 27 if (defined $args)
34 0 3 if ref $args ne 'HASH'
37 0 3 unless (exists $accepted_option{$k})
40 3 0 if ($k eq 'N/A')
47 0 30 unless (defined @{$class . '::features';})
53 0 30 unless (@features)
69 1 109 unless (exists $$feature{'name'})
73 1 108 if (exists $feat_named{$name})
82 2 297 unless (exists $supported_option{$_})
83 1 1 if (exists $accepted_option{$_}) { }
94 4 103 if (exists $$feature{'postproc'} and ref $$feature{'postproc'} ne 'CODE')
100 3 1 if ($@ =~ /Undefined subroutine/) { }
0 1 elsif ($@ =~ /^Undefined subroutine/) { }
103 2 1 if (defined $package_name and length $package_name > 0) { }
108 0 2 if ($@)
119 0 3 if ($@ =~ /^Undefined subroutine/)
130 29 78 if (exists $$feature{'values'})
131 1 28 if (exists $$feature{'values_file'})
135 4 24 if (ref $values eq 'HASH') { }
24 0 elsif (ref $values eq 'ARRAY') { }
144 0 0 if (ref $values) { }
154 4 102 if (exists $$feature{'values_file'})
157 4 0 unless ($opened)
158 0 4 unless open $values_fh, '<' . $OPEN_OPTIONS, $$self{'caller_path'} . '/' . $values_fn
173 13 93 if (exists $$feature{'range'})
174 2 11 if (exists $$feature{'values'})
177 1 10 unless $$feature{'range'} =~ /^ (.+?) \s* \.{2,} \s* (.+) $/x
181 1 9 unless ($l < $r)
185 7 2 if ($$feature{'type'} =~ /^int/i) { }
2 0 elsif ($$feature{'type'} =~ /^num/i) { }
195 14 88 if (exists $$feature{'default'})
196 0 1 unless (exists $$feature{'values'} or exists $$feature{'range_l'})
201 41 61 if (exists $$feature{'type'})
204 0 41 unless ($type_OK)
210 15 26 if ($type eq 'boo') { }
14 12 elsif ($type eq 'int') { }
9 3 elsif ($type eq 'num') { }
211 5 10 if (exists $$feature{'values'}) { }
212 5 0 exists $$feature{'values_ordered'} ? :
213 1 4 if (@values > 2)
220 4 3 if ($_) { }
221 1 3 if (defined $true)
227 1 2 if (defined $false)
232 3 2 $_ ? :
234 2 0 if (exists $$feature{'values_ordered'})
243 2 10 if (exists $$feature{'default'})
246 1 1 if (@vals > 1)
249 1 0 unless ($def xor $vals[0])
250 1 0 $def ? :
253 0 0 $def ? :
257 7 7 if (exists $$feature{'values'})
258 7 0 exists $$feature{'values_ordered'} ? :
263 7 0 if (exists $$feature{'values_ordered'})
268 1 13 if (exists $$feature{'default'})
274 0 9 if (exists $$feature{'values'})
275 0 0 exists $$feature{'values_ordered'} ? :
279 0 0 if (exists $$feature{'values_ordered'})
284 1 8 if (exists $$feature{'default'})
290 9 88 if (exists $$feature{'format'})
292 1 8 unless ($format =~ /^ (?: normal | numeric | binary ) $/x)
295 1 7 if (not exists $$feature{'values'} and $format eq 'binary')
303 46 49 if (exists $$feature{'code'}) { }
1 48 elsif (%{$class . '::features';} and exists ${$class . '::features';}{$name}) { }
305 0 46 if (ref $code ne 'CODE')
311 0 1 if (ref $code ne 'CODE')
317 0 48 if (ref $code ne 'CODE')
323 23 72 if (exists $$feature{'label'})
325 13 10 if (ref $label eq 'ARRAY') { }
0 10 elsif (ref $label) { }
342 105 89 if (not ref $featnames and exists $$self{'expand_names_cache'}{$featnames})
349 4 85 if ($featnames eq 'ALL') { }
50 35 elsif (ref $featnames eq 'ARRAY') { }
10 25 elsif (not $featnames =~ /[[:lower:]]/ and $featnames =~ /[[:upper:]]/) { }
361 3 7 if (@plus_labels == 0 and @minus_labels > 0)
364 1 9 if (grep {$_ eq 'ALL';} @minus_labels)
370 160 31 unless $_ eq 'ALL'
372 62 65 if $included and not $excluded
379 38 50 unless (ref $orig_featnames)
389 112 52 if (exists $$self{'evaluate_featnames_cache'}{"@$featnames"}) { }
395 0 145 unless (exists $feat_named{$featname})
403 1 163 unless (exists $KNOWN_FORMATS{$format})
410 0 161 if (@args == 0)
422 115 555 exists $$feature{'format'} ? :
424 145 525 if (not defined $normrv and exists $$self{'N/A'}) { }
426 41 104 if (exists $$feature{'type'} and $$feature{'type'} eq 'boo') { }
45 59 elsif ($format eq 'binary') { }
432 0 45 unless (@dummy)
446 5 520 if ($@)
447 4 1 if (ref $@ and $@->isa('Data::FeatureFactory::SoftError')) { }
469 374 712 if (exists $$feature{'type'})
471 185 189 if ($type eq 'num' or $type eq 'int')
474 158 216 if ($type eq 'int')
477 136 238 if ($type eq 'boo')
478 30 106 $normrv ? :
483 834 252 if (exists $$feature{'values'}) { }
20 232 elsif (exists $$feature{'range_l'}) { }
484 523 311 if (exists $$feature{'values'}{$normrv}) { }
307 4 elsif (exists $$feature{'default'}) { }
495 0 20 unless (exists $$feature{'range_r'})
498 0 20 if ($normrv < $$feature{'range_l'})
499 0 0 if (exists $$feature{'default'}) { }
508 1 19 if ($normrv > $$feature{'range_r'})
509 1 0 if (exists $$feature{'default'}) { }
520 425 657 if ($format eq 'normal') { }
414 243 elsif ($format eq 'numeric') { }
243 0 elsif ($format eq 'binary') { }
521 101 324 if (exists $$feature{'postproc'})
527 143 271 if (exists $$feature{'type'} and $$feature{'type'} =~ /^( num | int | boo )$/x) { }
219 52 elsif (exists $$feature{'cat2num'}) { }
531 0 219 unless (exists $$feature{'cat2num'}{$normrv})
538 52 0 if (exists $$feature{'cat2num_dyna'}{$normrv}) { }
546 0 0 if (exists $$feature{'postproc'})
551 0 0 unless print {$$feature{'num_values_fh'};} join("\t", @toprint) . "\n"
559 39 204 if (exists $$feature{'type'} and $$feature{'type'} eq 'boo') { }
0 204 elsif (not exists $$feature{'cat2bin'}{$normrv}) { }
578 242 2 if (exists $$feature{'values_ordered'}) { }
2 0 elsif (exists $$feature{'values'}) { }
587 41 203 if (exists $$feature{'default'} and not exists $$feature{'values'}{$$feature{'default'}})
595 1049 0 if ref $class
596 211 838 if (exists $$feature{'format'} and $format ne 'postprocd')
600 486 563 if (lc $format eq 'normal') { }
279 284 elsif (lc $format eq 'numeric') { }
273 11 elsif (lc $format eq 'binary') { }
11 0 elsif ($format eq 'postprocd') { }
603 17 262 if exists $$feature{'type'} and $$feature{'type'} eq 'num'
604 69 193 if exists $$feature{'type'} and $$feature{'type'} eq 'int'
605 53 140 if exists $$feature{'type'} and $$feature{'type'} eq 'boo'
606 102 38 if exists $$feature{'cat2num'}
608 28 10 if (not exists $$feature{'values'}) { }
609 25 3 if exists $$feature{'num_values_fh'}
624 3 0 if ($opened)
629 22 0 if $num > $num_value_max
632 10 12 if defined $ppd
640 0 3 unless ($opened)
642 0 0 if ($opened)
648 0 3 unless ($opened)
667 42 231 if exists $$feature{'type'} and $$feature{'type'} eq 'boo'
668 213 18 if exists $$feature{'cat2bin'}
670 2 1 unless (exists $$feature{'values_ordered'} or exists $$feature{'values'})
688 9 2 if exists $$feature{'pp2cat'}
690 0 2 unless (exists $$feature{'postproc'})
714 52 216 if (exists $$feature{'type'} and $$feature{'type'} eq 'boo')
722 0 40 if ($format ne 'binary')
726 0 40 if (@$values < $n)
735 0 32 if (ref $names ne 'ARRAY')
738 0 32 if (ref $options ne 'HASH')
746 0 118 unless (exists $accepted_options{$_})
754 0 64 unless (/^(?: normal | numeric | binary )$/x)
759 2 30 if (exists $$options{'from_NA'} and exists $$options{'to_NA'}) { }
3 27 elsif (exists $$options{'from_NA'} and exists $$self{'N/A'}) { }
3 24 elsif (exists $$options{'to_NA'} and exists $$self{'N/A'}) { }
0 24 elsif (exists $$options{'to_NA'}) { }
0 24 elsif (exists $$options{'from_NA'}) { }
15 9 elsif (exists $$self{'N/A'}) { }
777 0 32 if (exists $$options{'header'} and not $$options{'header'})
781 4 28 if (exists $$options{'ignore'})
785 2 2 unless (ref $ignore)
789 4 0 if (ref $ignore eq 'ARRAY') { }
791 0 4 if ($has_non_nums)
795 0 9 if ($idx < 0)
806 2 2 if (exists $$options{'header'})
816 0 181 unless (exists $names{$name})
822 15 166 if ($from_format eq 'normal' and exists $$feature{'postproc'})
823 11 4 if (exists $$feature{'values'}) { }
1 3 elsif (exists $$feature{'format'} or $to_format eq 'normal') { }
3 0 elsif (join(' ', sort($from_format, $to_format)) eq 'normal numeric') { }
838 24 157 if (exists $$feature{'format'} and $$feature{'format'} eq 'binary') { }
24 133 elsif (exists $$feature{'format'}) { }
36 97 elsif ($from_format eq 'binary') { }
845 60 121 $bin ? :
859 0 203 if (ref $values ne 'ARRAY')
862 0 203 if (@$values < @$descrs)
873 160 1137 if (defined $ignore)
878 318 979 exists $$feature{'format'} ? :
879 318 979 exists $$feature{'format'} ? :
881 0 1297 if (@value == 0)
887 950 347 if (@value == 1) { }
889 235 715 if (defined $from_NA and $value eq $from_NA) { }
0 1400 elsif (defined $to_NA and not defined $value and not defined $from_NA) { }
897 0 347 if (defined $to_NA and not grep({defined $_;} @value) and not defined $from_NA) { }
133 229 elsif (defined $from_NA and not grep({$_ ne $from_NA;} @value)) { }
906 368 929 if ($is_NA)
907 164 204 $to_format eq 'binary' ? :
912 368 561 if ($from_format eq $to_format) { }
919 102 459 if ($from_format eq 'normal' and exists $$feature{'postproc'})
922 171 390 if ($from_format eq 'normal') { }
49 341 elsif ($from_format eq 'numeric' and exists $$feature{'type'} and $$feature{'type'} =~ /^(int|num|boo)$/) { }
27 314 elsif ($from_format eq 'binary' and exists $$feature{'type'} and $$feature{'type'} eq 'boo') { }
933 0 314 unless (defined $transfer)
936 40 274 unless (exists $$feature{$transfer})
937 40 0 if (exists $$feature{$transfer . '_dyna'}) { }
945 0 314 unless (exists $$feature{$transfer}{$valval})
947 0 0 if ($valval eq $$feature{'name'})
976 0 19 unless (defined &Scalar::Util::openhandle($source))
979 0 19 unless (defined &Scalar::Util::openhandle($sink))
982 0 19 if (ref $options ne 'HASH')
986 2 17 exists $$options{'OFS'} ? :
989 16 3 if (exists $$options{'names'}) { }
3 0 elsif (exists $$options{'header'} and $$options{'header'}) { }
1005 3 16 if (@orig_header_fields)
1010 4 15 if (not exists $$self{'feat_named'}{$field}) { }
1016 4 11 $bin ? :
1029 0 190 if $@
1037 0 0 if (exists $$feature{'label'}) { }
1038 0 0 if (ref $$feature{'label'} eq 'ARRAY') { }
1054 0 4 unless defined $message