Branch Coverage

blib/lib/Kwalify.pm
Criterion Covered Total %
branch 124 130 95.3


line true false branch
29 33 40 if (@{$self->{'errors'};}) { }
55 1 444 unless (UNIVERSAL::isa($schema, "HASH"))
60 3 441 unless (defined $type)
64 1 443 unless ($self->can($type_check_method))
75 559 0 if (defined $schema->{$schema_key})
76 30 529 if ($schema_key eq 'pattern') { }
20 509 elsif ($schema_key eq 'length') { }
37 472 elsif ($schema_key eq 'enum') { }
32 440 elsif ($schema_key eq 'range') { }
0 440 elsif ($schema_key eq 'assert') { }
1 439 elsif (not $schema_key =~ /^(type|required|unique|name|classname|class|desc)$/) { }
78 7 23 unless ($data =~ qr/$pattern/)
82 1 19 unless (UNIVERSAL::isa($schema->{'length'}, "HASH"))
87 12 25 if ($sub_schema_key eq 'min') { }
6 19 elsif ($sub_schema_key eq 'min-ex') { }
14 5 elsif ($sub_schema_key eq 'max') { }
4 1 elsif ($sub_schema_key eq 'max-ex') { }
89 5 7 if ($length < $min)
94 1 5 if ($length <= $min)
99 1 13 if ($length > $max)
104 1 3 if ($length >= $max)
112 1 36 unless (UNIVERSAL::isa($schema->{'enum'}, "ARRAY"))
116 5 31 unless (exists $valid{$data})
120 1 31 unless (UNIVERSAL::isa($schema->{'range'}, "HASH"))
143 24 37 if ($sub_schema_key eq 'min') { }
6 31 elsif ($sub_schema_key eq 'min-ex') { }
26 5 elsif ($sub_schema_key eq 'max') { }
4 1 elsif ($sub_schema_key eq 'max-ex') { }
145 10 14 if (&$lt($data, $min))
150 1 5 if (&$le($data, $min))
155 1 25 if (&$gt($data, $max))
160 1 3 if (&$ge($data, $max))
178 3 25 if (not defined $data or ref $data)
179 2 1 defined $data ? :
186 3 189 if (not defined $data or ref $data or $data =~ /^\d+(\.\d+)?$/)
187 3 1 defined $data ? :
194 9 29 unless ($data =~ /^[+-]?\d+$/)
202 1 1 unless ($data =~ /^[+-]?\d+\.\d+$/)
210 1 1 unless ($data =~ /^[+-]?\d+(\.\d+)?$/)
218 1 6 unless ($data =~ /^(yes|true|1|no|false|0)$/)
231 6 20 unless ($data =~ /^\d{4}-\d{2}-\d{2}$/)
239 0 1 unless ($data =~ /^\d{2}:\d{2}:\d{2}$/)
257 1 47 unless (exists $schema->{'sequence'})
261 1 46 unless (UNIVERSAL::isa($sequence, "ARRAY"))
264 1 45 if (@$sequence != 1)
267 1 44 unless (UNIVERSAL::isa($data, "ARRAY"))
272 0 44 if $self->{'done'}{overload::StrVal($data)}{overload::StrVal($schema)}
283 39 65 if ($unique)
284 3 36 if (exists $unique_val{$elem}) { }
297 56 0 if ($args and $args->{'unique_mapping_val'})
300 1 91 unless (exists $schema->{'mapping'})
304 1 90 unless (UNIVERSAL::isa($mapping, "HASH"))
307 1 89 unless (defined $data)
311 2 87 unless (UNIVERSAL::isa($data, "HASH"))
316 1 86 if $self->{'done'}{overload::StrVal($data)}{overload::StrVal($schema)}
328 4 316 if ($key eq "=")
334 0 316 unless (UNIVERSAL::isa($subschema, "HASH"))
338 70 246 unless (defined $data->{$key})
339 6 64 if ($required) { }
349 22 224 if ($unique)
350 4 18 if (defined $$unique_mapping_val{$data->{$key}}{'val'} and $$unique_mapping_val{$data->{$key}}{'val'} eq $data->{$key}) { }
369 22 246 unless ($seen_key{$key})
370 9 13 if ($default_key_schema) { }
395 555 133 !($root =~ m[/$]) ? :
406 128 478 if defined $val