Branch Coverage

blib/lib/Kwalify.pm
Criterion Covered Total %
branch 108 130 83.0


line true false branch
29 22 25 if (@{$self->{'errors'};}) { }
55 1 145 unless (UNIVERSAL::isa($schema, 'HASH'))
60 0 145 unless (defined $type)
64 1 144 unless ($self->can($type_check_method))
75 167 0 if (defined $schema->{$schema_key})
76 4 163 if ($schema_key eq 'pattern') { }
8 155 elsif ($schema_key eq 'length') { }
3 152 elsif ($schema_key eq 'enum') { }
8 144 elsif ($schema_key eq 'range') { }
0 144 elsif ($schema_key eq 'assert') { }
1 143 elsif (not $schema_key =~ /^(type|required|unique|name|classname|class|desc)$/) { }
78 1 3 unless ($data =~ qr/$pattern/)
82 1 7 unless (UNIVERSAL::isa($schema->{'length'}, 'HASH'))
87 0 13 if ($sub_schema_key eq 'min') { }
6 7 elsif ($sub_schema_key eq 'min-ex') { }
2 5 elsif ($sub_schema_key eq 'max') { }
4 1 elsif ($sub_schema_key eq 'max-ex') { }
89 0 0 if ($length < $min)
94 1 5 if ($length <= $min)
99 1 1 if ($length > $max)
104 1 3 if ($length >= $max)
112 1 2 unless (UNIVERSAL::isa($schema->{'enum'}, 'ARRAY'))
116 0 2 unless (exists $valid{$data})
120 1 7 unless (UNIVERSAL::isa($schema->{'range'}, 'HASH'))
143 0 13 if ($sub_schema_key eq 'min') { }
6 7 elsif ($sub_schema_key eq 'min-ex') { }
2 5 elsif ($sub_schema_key eq 'max') { }
4 1 elsif ($sub_schema_key eq 'max-ex') { }
145 0 0 if (&$lt($data, $min))
150 1 5 if (&$le($data, $min))
155 1 1 if (&$gt($data, $max))
160 1 3 if (&$ge($data, $max))
178 3 13 if (not defined $data or ref $data)
179 2 1 defined $data ? :
186 2 50 if (not defined $data or ref $data or $data =~ /^\d+(\.\d+)?$/)
187 2 1 defined $data ? :
194 2 6 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 0 0 unless ($data =~ /^\d{4}-\d{2}-\d{2}$/)
239 0 1 unless ($data =~ /^\d{2}:\d{2}:\d{2}$/)
257 1 19 unless (exists $schema->{'sequence'})
261 1 18 unless (UNIVERSAL::isa($sequence, 'ARRAY'))
264 1 17 if (@$sequence != 1)
267 1 16 unless (UNIVERSAL::isa($data, 'ARRAY'))
272 0 16 if $self->{'done'}{overload::StrVal($data)}{overload::StrVal($schema)}
283 26 12 if ($unique)
284 2 24 if (exists $unique_val{$elem}) { }
297 12 0 if ($args and $args->{'unique_mapping_val'})
300 1 28 unless (exists $schema->{'mapping'})
304 1 27 unless (UNIVERSAL::isa($mapping, 'HASH'))
307 1 26 unless (defined $data)
311 2 24 unless (UNIVERSAL::isa($data, 'HASH'))
316 0 24 if $self->{'done'}{overload::StrVal($data)}{overload::StrVal($schema)}
328 0 60 if ($key eq '=')
334 0 60 unless (UNIVERSAL::isa($subschema, 'HASH'))
338 12 48 unless (defined $data->{$key})
339 0 12 if ($required) { }
349 12 36 if ($unique)
350 2 10 if (defined $$unique_mapping_val{$data->{$key}}{'val'} and $$unique_mapping_val{$data->{$key}}{'val'} eq $data->{$key}) { }
369 0 48 unless ($seen_key{$key})
370 0 0 if ($default_key_schema) { }
395 98 48 !($root =~ m[/$]) ? :
406 36 88 if defined $val