Branch Coverage

blib/lib/Validate/Simple.pm
Criterion Covered Total %
branch 113 122 92.6


line true false branch
23 1 1941 if (defined $specs and ref $specs ne 'HASH')
34 1937 4 if (defined $specs and keys %$specs)
36 1 1936 unless $self->validate_specs($specs, \$self->{'required'})
49 2762 0 if ($error)
60 7331 0 wantarray ? :
268 1912 1693 if (not defined $specs) { }
6 1687 elsif (not $self->validate_specs($specs, \$req, '', $all_errors)) { }
272 2 1910 unless (defined $specs)
284 129 3468 unless ($self->hash($params))
309 4 5535 unless ($self->hash($specs))
314 0 5535 unless ($req)
319 0 5535 if (ref $req ne 'SCALAR')
326 3 16388 unless ($self->hash($spec))
332 16382 6 exists $spec->{'type'} ? :
335 3 16385 unless (exists $specs_of_specs{$type}{'specs'})
343 5 16380 unless ($self->_validate($spec, $spec_of_spec, \$specs_of_specs{$type}{'required'}))
349 126 16254 if ($type eq 'enum')
355 263 16117 if ($type eq 'spec') { }
0 30338 elsif (exists $spec->{'of'} and not $self->validate_specs({'of', $spec->{'of'}}, \(my $r = 0), $p2v, $all_errors)) { }
359 1 262 unless (my $vs = eval { do { &blessed($self)->new($spec->{'of'}, $all_errors) } })
362 1 262 if ($create_error)
367 0 262 if (@errors)
381 34 1 if exists $spec->{'required'} and $spec->{'required'}
394 20 33217 unless (exists $specs->{$name})
399 6 14 if ($all_errors) { }
410 18694 0 if exists $spec->{'required'} and $spec->{'required'}
413 1667 815 unless $valid or $all_errors
418 9 19844 if ($req)
422 2552 17301 @{$self->{'_errors'};} ? :
432 11 0 if (exists $spec->{'required'} and $spec->{'required'})
433 7 4 unless (exists $params->{$par})
452 347 37231 if ($undef and not defined $value)
458 16439 20792 if ($type eq 'enum')
463 168 37063 if ($type eq 'spec')
468 2103 35128 unless ($specs_of_specs{$type}{'validate'}->($value, @other))
469 144 1959 if ($type eq 'spec') { }
471 111 45 m[^/] ? :
474 36 1923 $type eq 'enum' ? :
482 186 34942 if (exists $spec->{'gt'})
483 106 80 if ($spec->{'gt'} >= $value)
490 162 34860 if (exists $spec->{'ge'})
491 30 132 if ($spec->{'ge'} > $value)
498 204 34788 if (exists $spec->{'lt'})
499 132 72 if ($spec->{'lt'} <= $value)
506 186 34674 if (exists $spec->{'le'})
507 72 114 if ($spec->{'le'} < $value)
514 48 34740 if (exists $spec->{'min_length'})
515 24 24 if ($spec->{'min_length'} > length($value // ''))
522 48 34716 if (exists $spec->{'max_length'})
523 24 24 if ($spec->{'max_length'} < length($value // ''))
530 18 34722 if (exists $spec->{'re'})
531 12 6 unless ($value =~ /$spec->{'re'}/)
539 2843 31885 if (exists $spec->{'of'} and $type ne 'spec')
540 398 2445 if ($type eq 'array') { }
2445 0 elsif ($type eq 'hash') { }
549 86 68 unless ($is_valid or $all_errors)
562 48 28 unless ($is_valid or $all_errors)
572 83 2626 if ($type eq 'array' and not @$value or $type eq 'hash' and not %$value)
574 63 20 unless (exists $spec->{'empty'} and $spec->{'empty'})
582 399 34132 if (exists $spec->{'callback'})
583 12 387 unless ($spec->{'callback'}->($value, @other))