Branch Coverage

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


line true false branch
58 0 321 unless my $validator = $params{'validator'}
84 62 773 CORE::ref $types ? :
86 700 135 if grep {$self->check_type($instance, $_);} @types
98 1 24 unless $self->check_type($instance, "number")
99 17 7 if $instance >= $minimum
110 0 13 unless $self->check_type($instance, "number")
111 10 3 if $instance <= $maximum
122 0 0 unless $self->check_type($instance, "number")
123 0 0 unless exists $schema->{'maximum'}
128 0 0 unless $res
130 0 0 unless $exclusiveMaximum
131 0 0 if $instance != $maximum
143 0 0 unless $self->check_type($instance, "number")
144 0 0 unless exists $schema->{'minimum'}
149 0 0 unless $res
151 0 0 unless $exclusiveMinimum
152 0 0 if $instance != $minimum
164 0 16 unless $self->check_type($instance, "array")
165 15 1 if scalar @$instance >= $min
176 1 3 unless $self->check_type($instance, "array")
177 2 1 if scalar @$instance <= $max
188 0 3 unless $self->check_type($instance, "string")
189 2 1 if length $instance >= $min
200 1 3 unless $self->check_type($instance, "string")
201 2 1 if length $instance <= $max
214 3 34 unless $self->check_type($instance, "object")
219 62 2 unless exists $instance->{$prop}
224 2 0 if ($self->check_type($dep, 'array', 1)) { }
227 1 1 if exists $instance->{$p}
239 0 0 unless $r
248 0 10 unless $self->check_type($instance, "array")
250 0 10 if $self->check_type($schema->{'items'} // {}, "object", 1)
255 8 2 if ($self->check_type($additionalItems, "boolean", 1))
256 0 8 if $additionalItems
257 2 6 if (scalar @$instance > $len_items)
279 1 5 unless $r
287 6 137 unless $self->check_type($instance, "object")
293 136 28 if $schema->{'properties'} and exists $schema->{'properties'}{$p}
294 12 87 if $patterns and $p =~ /$patterns/u
298 80 57 unless @extra_props
301 39 18 if ($self->check_type($addProps, "object", 1))
306 1 68 unless $r
313 0 18 if $addProps
331 22 138 unless $r
348 3 67 unless ($result)
356 67 3 if $result
359 67 1 if $result
381 64 72 if ($r) { }
391 64 72 if $r
394 62 2 if $num == 1
396 1 1 if ($num > 1) { }
420 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) { }
421 4 0 $self->check_type($instance, 'boolean') ? :
425 0 0 $self->check_type($instance, 'object') || $self->check_type($instance, 'array') ? :
430 4 0 $self->check_type($instance, 'number') ? :
440 162 439 if $result
443 162 19 if $result
455 2 47 unless $self->check_type($instance, "array")
458 10 37 if ($self->check_type($items, 'array', 1)) { }
459 2 8 $#{$items;} > $#{$instance;} ? :
466 0 17 unless $r
474 9 62 unless $r
482 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}
485 5 48 unless $self->check_type($instance, $type)
488 48 0 if $result
500 0 2 unless $self->check_type($instance, "object")
501 1 1 if scalar keys %$instance <= $maxProperties
513 0 7 unless $self->check_type($instance, "object")
514 6 1 if scalar keys %$instance >= $minProperties
526 0 5 unless $self->check_type($instance, "number")
531 2 3 if $div == "Inf" or int $div != $div
533 3 2 if $result
552 61 1 unless $result
564 0 15 unless $self->check_type($instance, "string")
565 11 4 if $instance =~ /$pattern/u
577 0 135 unless $self->check_type($instance, "object")
585 35 225 if ($k =~ /$pattern/u)
588 3 32 unless $r
597 1 412 unless $self->check_type($instance, "object")
601 4630 693 unless exists $instance->{$prop}
607 73 620 unless $r
614 0 181 unless $self->check_type($instance, "object")
619 109 131 if exists $instance->{$prop}
633 0 24 unless $self->check_type($instance, "array")
635 0 24 unless $uniqueItems
641 1 44 if ($type eq 'null') { }
4 40 elsif ($type eq 'object' or $type eq 'array') { }
10 30 elsif ($type eq 'boolean') { }
655 22 2 if scalar keys %hash == scalar @$instance
669 339 49 if $scope
673 0 388 unless $schema
681 0 388 if ($@)