Branch Coverage

blib/lib/JSONSchema/Validator/Constraints/Draft4.pm
Criterion Covered Total %
branch 140 192 72.9


line true false branch
59 0 321 unless my $validator = $params{'validator'}
85 62 773 CORE::ref $types ? :
87 700 135 if grep {$self->check_type($instance, $_);} @types
99 1 24 unless $self->check_type($instance, "number")
100 17 7 if $instance >= $minimum
111 0 13 unless $self->check_type($instance, "number")
112 10 3 if $instance <= $maximum
123 0 0 unless $self->check_type($instance, "number")
124 0 0 unless exists $schema->{'maximum'}
129 0 0 unless $res
131 0 0 unless $exclusiveMaximum
132 0 0 if $instance != $maximum
144 0 0 unless $self->check_type($instance, "number")
145 0 0 unless exists $schema->{'minimum'}
150 0 0 unless $res
152 0 0 unless $exclusiveMinimum
153 0 0 if $instance != $minimum
165 0 16 unless $self->check_type($instance, "array")
166 15 1 if scalar @$instance >= $min
177 1 3 unless $self->check_type($instance, "array")
178 2 1 if scalar @$instance <= $max
189 0 3 unless $self->check_type($instance, "string")
190 2 1 if length $instance >= $min
201 1 3 unless $self->check_type($instance, "string")
202 2 1 if length $instance <= $max
215 3 34 unless $self->check_type($instance, "object")
220 62 2 unless exists $instance->{$prop}
225 2 0 if ($self->check_type($dep, 'array', 1)) { }
228 1 1 if exists $instance->{$p}
240 0 0 unless $r
249 0 10 unless $self->check_type($instance, "array")
251 0 10 if $self->check_type($schema->{'items'} // {}, "object", 1)
256 8 2 if ($self->check_type($additionalItems, "boolean", 1))
257 0 8 if $additionalItems
258 2 6 if (scalar @$instance > $len_items)
280 1 5 unless $r
293 6 137 unless $self->check_type($instance, "object")
299 136 28 if $schema->{'properties'} and exists $schema->{'properties'}{$p}
300 12 87 if $patterns and $p =~ /$patterns/u
307 80 57 unless @extra_props
310 39 18 if ($self->check_type($addProps, "object", 1))
318 1 68 unless $r
325 0 18 if $addProps
343 22 138 unless $r
360 3 67 unless ($result)
368 67 3 if $result
371 67 1 if $result
393 64 72 if ($r) { }
403 64 72 if $r
406 62 2 if $num == 1
408 1 1 if ($num > 1) { }
432 4 597 if ($self->check_type($e, 'boolean', 1)) { }
0 597 elsif ($self->check_type($e, 'object', 1) or $self->check_type($e, 'array', 1)) { }
4 593 elsif ($self->check_type($e, 'number', 1)) { }
593 0 elsif (defined $e and defined $instance) { }
0 0 elsif (CORE::not defined $e || defined $instance) { }
433 4 0 $self->check_type($instance, 'boolean') ? :
437 0 0 $self->check_type($instance, 'object') || $self->check_type($instance, 'array') ? :
442 4 0 $self->check_type($instance, 'number') ? :
452 162 439 if $result
455 162 19 if $result
467 2 47 unless $self->check_type($instance, "array")
470 10 37 if ($self->check_type($items, 'array', 1)) { }
471 2 8 $#{$items;} > $#{$instance;} ? :
478 0 17 unless $r
486 9 62 unless $r
494 0 53 unless exists {"byte" => ["string",sub { ;}],"date" => ["string",sub { ;}],"date-time" => ["string",sub { ;}],"double" => ["number",sub { ;}],"email" => ["string",sub { ;}],"float" => ["number",sub { ;}],"hostname" => ["string",sub { ;}],"idn-email" => ["string",sub { ;}],"int32" => ["integer",sub { ;}],"int64" => ["integer",sub { ;}],"ipv4" => ["string",sub { ;}],"ipv6" => ["string",sub { ;}],"iri" => ["string",sub { ;}],"iri-reference" => ["string",sub { ;}],"json-pointer" => ["string",sub { ;}],"regex" => ["string",sub { ;}],"relative-json-pointer" => ["string",sub { ;}],"time" => ["string",sub { ;}],"uri" => ["string",sub { ;}],"uri-reference" => ["string",sub { ;}],"uri-template" => ["string",sub { ;}],"uuid" => ["string",sub { ;}]}->{$format}
497 5 48 unless $self->check_type($instance, $type)
500 48 0 if $result
512 0 2 unless $self->check_type($instance, "object")
513 1 1 if scalar keys %$instance <= $maxProperties
525 0 7 unless $self->check_type($instance, "object")
526 6 1 if scalar keys %$instance >= $minProperties
538 0 5 unless $self->check_type($instance, "number")
543 2 3 if $div == "Inf" or int $div != $div
545 3 2 if $result
564 61 1 unless $result
576 0 15 unless $self->check_type($instance, "string")
577 11 4 if $instance =~ /$pattern/u
589 0 135 unless $self->check_type($instance, "object")
597 35 225 if ($k =~ /$pattern/u)
600 3 32 unless $r
609 1 412 unless $self->check_type($instance, "object")
613 4630 693 unless exists $instance->{$prop}
619 73 620 unless $r
626 0 181 unless $self->check_type($instance, "object")
631 109 131 if exists $instance->{$prop}
645 0 24 unless $self->check_type($instance, "array")
647 0 24 unless $uniqueItems
653 1 44 if ($type eq 'null') { }
4 40 elsif ($type eq 'object' or $type eq 'array') { }
10 30 elsif ($type eq 'boolean') { }
667 22 2 if scalar keys %hash == scalar @$instance
681 339 49 if $scope
685 0 388 unless $schema
693 0 388 if ($@)