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
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
288 6 137 unless $self->check_type($instance, "object")
294 136 28 if $schema->{'properties'} and exists $schema->{'properties'}{$p}
295 12 87 if $patterns and $p =~ /$patterns/u
299 80 57 unless @extra_props
302 39 18 if ($self->check_type($addProps, "object", 1))
307 1 68 unless $r
314 0 18 if $addProps
332 22 138 unless $r
349 3 67 unless ($result)
357 67 3 if $result
360 67 1 if $result
382 64 72 if ($r) { }
392 64 72 if $r
395 62 2 if $num == 1
397 1 1 if ($num > 1) { }
421 4 602 if ($self->check_type($e, 'boolean', 1)) { }
0 602 elsif ($self->check_type($e, 'object', 1) or $self->check_type($e, 'array', 1)) { }
4 598 elsif ($self->check_type($e, 'number', 1)) { }
598 0 elsif (defined $e and defined $instance) { }
0 0 elsif (CORE::not defined $e || defined $instance) { }
422 4 0 $self->check_type($instance, 'boolean') ? :
426 0 0 $self->check_type($instance, 'object') || $self->check_type($instance, 'array') ? :
431 4 0 $self->check_type($instance, 'number') ? :
441 165 441 if $result
444 165 19 if $result
456 2 47 unless $self->check_type($instance, "array")
459 10 37 if ($self->check_type($items, 'array', 1)) { }
460 2 8 $#{$items;} > $#{$instance;} ? :
467 0 17 unless $r
475 9 62 unless $r
483 0 54 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}
486 5 49 unless $self->check_type($instance, $type)
489 49 0 if $result
501 0 2 unless $self->check_type($instance, "object")
502 1 1 if scalar keys %$instance <= $maxProperties
514 0 7 unless $self->check_type($instance, "object")
515 6 1 if scalar keys %$instance >= $minProperties
527 0 5 unless $self->check_type($instance, "number")
532 2 3 if $div == "Inf" or int $div != $div
534 3 2 if $result
553 61 1 unless $result
565 0 15 unless $self->check_type($instance, "string")
566 11 4 if $instance =~ /$pattern/u
578 0 135 unless $self->check_type($instance, "object")
586 35 225 if ($k =~ /$pattern/u)
589 3 32 unless $r
598 1 414 unless $self->check_type($instance, "object")
602 4632 695 unless exists $instance->{$prop}
608 73 622 unless $r
615 0 181 unless $self->check_type($instance, "object")
620 109 131 if exists $instance->{$prop}
634 0 24 unless $self->check_type($instance, "array")
636 0 24 unless $uniqueItems
642 1 44 if ($type eq 'null') { }
4 40 elsif ($type eq 'object' or $type eq 'array') { }
10 30 elsif ($type eq 'boolean') { }
656 22 2 if scalar keys %hash == scalar @$instance
670 339 49 if $scope
674 0 388 unless $schema
682 0 388 if ($@)