Branch Coverage

blib/lib/FU/Validate.pm
Criterion Covered Total %
branch 196 212 92.4


line true false branch
37 2 42 ref $v eq 'ARRAY' ? :
3 44 ref $v eq 'HASH' ? :
38 39 8 (!defined($min) || $got >= $min) && (!defined($max) || $got <= $max) ? :
44 34 33 $_[0] =~ /$reg/u ? :
116 493 102 if ref $schema ne "ARRAY"
120 161 764 if ($name eq "type")
121 1 160 if $name eq "type" and not $type_vals{$val}
122 2 158 if $top->{'type'} and $top->{'type'} ne $val
128 74 690 if ($type)
129 0 74 if $top->{'type'} and $top->{'type'} ne $type
133 10 754 if ($name eq "elems" or $name eq "values")
139 31 723 if ($name eq "keys")
148 226 497 if ($name eq "func")
153 31 466 if ($name eq "default")
155 1 30 if ref $val eq "SCALAR" and $$val eq "required"
159 53 413 if ($name eq "_scalartype")
160 48 5 if ($top->{'_scalartype'} || 0) < $val
164 69 344 if ($builtin{$name})
165 0 69 if $name eq "missing" and not $missing_vals{$val}
166 0 69 if $name eq "unknown" and not $unknown_vals{$val}
167 0 6 if $name eq "accept_array" and $val and $val ne "first" and $val ne "last"
168 4 65 if $name eq "sort" and ref $val ne "CODE"
173 2 342 if ($iscompiled and $name eq "validations")
179 2 340 unless $t
180 2 338 if $rec < 1
181 90 248 ref $t eq 'CODE' ? :
185 190 20 if @{$v->{'validations'}}
191 0 192 if $schema isa __PACKAGE__
201 20 6 if ($c->{'keys'})
204 15 22 unless (exists $_[1]{$k})
205 8 7 if $s->{'missing'} and $s->{'missing'} eq "ignore"
206 2 5 if $s->{'missing'} and $s->{'missing'} eq "reject"
207 0 5 ref $s->{'default'} eq 'CODE' ? :
208 2 3 if exists $s->{'default'}
212 5 20 if ($r)
217 5 13 if @err
220 2 17 if ($c->{'values'})
224 1 2 if ($r)
229 1 1 if @err
237 3 10 if ($r)
242 2 5 if @err
249 191 180 if (ref $v eq 'CODE') { }
251 56 135 if ref $r eq "HASH"
252 2 133 unless $r
260 56 10 $r->{'validation'} eq 'func' && (!exists $r->{'result'} || keys %$r > 2) ? :
66 114 if $r
269 5 18 if $c->{'sort'}
272 4 19 if ($c->{'unique'} and !$c->{'sort'} || ref $c->{'unique'} eq 'CODE') { }
2 17 elsif ($c->{'unique'}) { }
275 6 6 ref $c->{'unique'} eq 'CODE' ? :
276 2 10 if exists $h{$k}
284 1 3 if $c->{'sort'}->($_[1][$i], $_[1][$i + 1]) == 0
297 3 1 $c->{'accept_array'} eq 'first' ? :
2 4 @{$_[1]} == 0 ? :
6 218 if $c->{'accept_array'} and ref $_[1] eq "ARRAY"
300 137 70 if (defined $_[1] and not ref $_[1] and $type eq "scalar")
302 133 4 if not exists $c->{'trim'} or $c->{'trim'}
304 1 136 if not $c->{'allow_control'} and &has_control($_[1])
308 26 197 if (not defined $_[1] or not ref $_[1] and $_[1] eq "")
309 12 14 if (exists $c->{'default'})
310 3 9 ref $c->{'default'} eq 'CODE' ? :
316 129 68 if ($type eq 'scalar') { }
30 38 elsif ($type eq 'hash') { }
27 11 elsif ($type eq 'array') { }
11 0 elsif ($type eq 'any') { }
317 1 128 if ref $_[1]
320 3 27 if ref $_[1] ne "HASH"
325 13 14 if (not $c->{'keys'} or $c->{'unknown'} and $c->{'unknown'} eq 'pass') { }
12 2 elsif (not $c->{'unknown'} or $c->{'unknown'} eq 'remove') { }
331 1 1 if @err
336 1 26 if $c->{'accept_scalar'} and not ref $_[1]
337 0 1 $c->{'accept_scalar'} ? :
1 26 if ref $_[1] ne "ARRAY"
345 123 60 unless $type eq "hash" and &_validate_hash or $c->{'elems'} and &_validate_elems or &_validate_rec
355 1 3 ref $c->{'onerror'} eq 'CODE' ? :
4 88 if $r and exists $c->{'onerror'}
362 104 79 unless $r
365 1 78 @e > 1 ? :
373 2 12 if (not defined $_[1]) { }
6 6 elsif ($c->{'_scalartype'}) { }
1 5 elsif (not $c->{'type'} or $c->{'type'} eq 'scalar') { }
1 4 elsif ($c->{'type'} eq 'array' and $c->{'elems'} and ref $_[1] eq 'ARRAY') { }
2 2 elsif ($c->{'type'} eq 'hash' and $c->{'keys'} and ref $_[1] eq 'HASH') { }
376 4 1 $c->{'_scalartype'} == 2 ? :
1 5 $c->{'_scalartype'} == 3 ? :
384 1 1 if $opt{'unknown'} and $opt{'unknown'} ne "pass"
386 6 6 exists $_[1]{$_} ? :
393 0 4 ref $c->{'default'} eq 'CODE' ? :
4 9 if exists $c->{'default'}
394 2 7 if $c->{'type'} and $c->{'type'} eq "array"
395 1 0 $c->{'keys'} ? :
1 6 if $c->{'type'} and $c->{'type'} eq "hash"
396 2 4 if $c->{'type'} and $c->{'type'} eq "any"
398 0 4 $c->{'_scalartype'} == 3 ? :
0 4 !$c->{'_scalartype'} ? :
403 18 0 $k =~ /^[a-zA-Z0-9_-]+$/u ? :
431 0 0 unless $_[0]{'longmess'}
436 28 165 $prefix ? :
444 0 72 $e->{'message'} ? :
8 72 $e->{'error'} ? :
6 80 $val eq 'unique' ? :
5 86 $val eq 'elems' ? :
4 91 $val eq 'missing' ? :
2 95 $val eq 'values' ? :
10 97 $val eq 'keys' ? :
86 107 if ($FU::Validate::error_format{$val}) { }