Condition Coverage

lib/JSON/Schema/Validate.pm
Criterion Covered Total %
condition 225 609 36.9


and 3 conditions

line !l l&&!r l&&r condition
37 0 121 0 defined $schema and !ref($schema) || ref $schema ne 'HASH'
133 118 0 3 $opts->{'format'} and ref $opts->{'format'} eq "HASH"
154 0 0 1 $self->{'compile_on'} and not $self->{'compiled'}
172 0 0 0 exists $opts->{'name'} && defined $opts->{'name'} && length $opts->{'name'}
384 0 0 2 defined $s and not ref $s
436 0 0 2 defined $s and not ref $s
459 0 0 2 defined $s and not ref $s
481 0 0 2 defined $s and not ref $s
488 1 0 1 $s =~ /\A
508 0 0 13 defined $s and not ref $s
516 0 0 1 defined $s and not ref $s
524 0 0 0 defined $ascii and length $ascii
545 0 0 2 defined $s and not ref $s
549 0 0 3 length $label >= 1 and length $label <= 63
558 0 0 1 defined $s and not ref $s
563 0 0 0 defined $ascii and length $ascii
571 0 0 2 length $label >= 1 and length $label <= 63
581 0 0 2 defined $s and not ref $s
593 0 0 2 defined $s and not ref $s
618 0 0 2 defined $s and not ref $s
625 0 0 1 defined $s and not ref $s
632 0 0 1 defined $s and not ref $s
643 0 0 3 defined $s and not ref $s
651 0 0 3 defined $s and not ref $s
659 0 0 3 defined $s and not ref $s
668 0 0 2 defined $s and not ref $s
698 0 0 0 defined $name and length $name
723 1 2 1 defined $code and ref $code ne "CODE"
738 0 2 0 defined $code and ref $code ne "CODE"
808 0 0 0 ref $root eq "HASH" and ref $root->{'$vocabulary'} eq "HASH"
875 215 0 3 defined $opts->{'max_errors'} && $opts->{'max_errors'} =~ /^\d+$/u
218 0 0 defined $opts->{'trace_limit'} && $opts->{'trace_limit'} =~ /^\d+$/u
983 0 0 5 $ext and ref $ext
985 0 0 5 ref $ext eq 'HASH' && $ext->{'$id'}
995 0 0 5 defined $frag and length $frag
1046 0 118 2 ref $root eq "HASH" and ref $root->{'$vocabulary'} eq "HASH"
1076 0 0 0 defined $ecma && $ecma =~ /^\d+$/u && $ecma >= 2018
1089 0 0 0 defined $S and not ref $S
0 0 0 defined $S and not ref $S and $S =~ m[^#/]u
1103 0 0 0 defined $target_schema and not ref $target_schema
1106 0 0 0 defined $target_schema and not ref $target_schema
0 0 0 defined $target_schema and not ref $target_schema and $target_schema =~ m[^#/]u
1150 0 0 0 ref $S eq "HASH" and exists $S->{'$ref'}
1156 0 0 0 defined $ref and $ref =~ /^#/u
1174 0 0 0 defined $target_schema and not ref $target_schema
1177 0 0 0 defined $target_schema and not ref $target_schema
0 0 0 defined $target_schema and not ref $target_schema and $target_schema =~ m[^#/]u
1270 0 0 0 exists $S->{'allOf'} and ref $S->{'allOf'} eq "ARRAY"
0 0 0 exists $S->{'allOf'} and ref $S->{'allOf'} eq "ARRAY" and @{$S->{'allOf'};}
1291 0 0 0 exists $S->{'anyOf'} and ref $S->{'anyOf'} eq "ARRAY"
0 0 0 exists $S->{'anyOf'} and ref $S->{'anyOf'} eq "ARRAY" and @{$S->{'anyOf'};}
1335 0 0 0 exists $S->{'oneOf'} and ref $S->{'oneOf'} eq "ARRAY"
0 0 0 exists $S->{'oneOf'} and ref $S->{'oneOf'} eq "ARRAY" and @{$S->{'oneOf'};}
1385 0 0 0 exists $N->{'required'} and ref $N->{'required'} eq "ARRAY"
0 0 0 exists $N->{'anyOf'} and ref $N->{'anyOf'} eq "ARRAY"
1397 0 0 0 ref $elt eq "HASH" and exists $elt->{'required'}
0 0 0 ref $elt eq "HASH" and exists $elt->{'required'} and ref $elt->{'required'} eq "ARRAY"
1489 0 0 0 $self->{'unique_keys'} and exists $S->{'uniqueKeys'}
0 0 0 $self->{'unique_keys'} and exists $S->{'uniqueKeys'} and ref $S->{'uniqueKeys'} eq "ARRAY"
1495 0 0 0 ref $keyset_ref eq "ARRAY" and @$keyset_ref
1526 0 0 0 ref $S eq 'HASH' && exists $S->{'type'}
1569 0 0 0 exists $S->{'enum'} and ref $S->{'enum'} eq "ARRAY"
0 0 0 exists $S->{'enum'} and ref $S->{'enum'} eq "ARRAY" and @{$S->{'enum'};}
1631 0 0 0 exists $S->{'required'} and ref $S->{'required'} eq "ARRAY"
0 0 0 exists $S->{'required'} and ref $S->{'required'} eq "ARRAY" and @{$S->{'required'};}
1700 0 0 0 exists $S->{'pattern'} and defined $S->{'pattern'}
0 0 0 exists $S->{'pattern'} and defined $S->{'pattern'} and length $S->{'pattern'}
1887 0 0 0 exists $S->{'items'} and ref $S->{'items'} eq "HASH"
1954 0 0 0 exists $S->{'properties'} and ref $S->{'properties'} eq "HASH"
1987 0 0 0 exists $S->{'definitions'} and ref $S->{'definitions'} eq "HASH"
2113 38 0 0 exists $S->{'uniqueKeys'} && ref $S->{'uniqueKeys'} eq 'ARRAY'
2131 38 0 0 exists $S->{'contains'} and ref $S->{'contains'}
2135 38 0 0 exists $S->{'unevaluatedItems'} and ref $S->{'unevaluatedItems'} eq "HASH"
2157 28 10 0 exists $S->{'additionalProperties'} and ref $S->{'additionalProperties'} eq "HASH"
2161 38 0 0 exists $S->{'propertyNames'} and ref $S->{'propertyNames'} eq "HASH"
2165 38 0 0 exists $S->{'dependentSchemas'} and ref $S->{'dependentSchemas'} eq "HASH"
2173 38 0 0 exists $S->{'unevaluatedProperties'} and ref $S->{'unevaluatedProperties'} eq "HASH"
2198 38 0 0 exists $S->{'if'} and ref $S->{'if'} eq "HASH"
2201 0 0 0 exists $S->{'then'} and ref $S->{'then'}
2202 0 0 0 exists $S->{'else'} and ref $S->{'else'}
2219 35 0 0 $ctx->{'unique_keys'} and $has_unique_keys
35 0 0 $ctx->{'unique_keys'} and $has_unique_keys and ref $inst eq "ARRAY"
2236 17 0 17 not ref $inst and defined $inst
2276 0 0 0 defined $maybe_decoded and not ref $maybe_decoded
2280 0 0 0 $mt =~ m[\Atext/]u and ($params->{'charset'} || '') =~ /\Autf-?8\z/iu
2289 0 0 0 not $ok and $assert
2347 25 0 0 exists $S->{'allOf'} and ref $S->{'allOf'} eq "ARRAY"
2363 25 0 0 exists $S->{'anyOf'} and ref $S->{'anyOf'} eq "ARRAY"
2408 25 0 0 exists $S->{'oneOf'} and ref $S->{'oneOf'} eq "ARRAY"
2429 25 0 0 exists $S->{'not'} and ref $S->{'not'}
2446 25 0 0 exists $S->{'if'} and ref $S->{'if'}
2482 0 105 9 ref $schema eq 'HASH' && $schema->{'$id'}
2528 0 0 176 $ctx->{'ptr_stack'} && @{$ctx->{'ptr_stack'};}
2566 0 0 1 exists $schema->{'items'} and ref $schema->{'items'} eq "HASH"
2617 0 0 7 builtin::blessed($ap) and $ap->isa("JSON::PP::Boolean")
2622 0 1 0 defined $out->{'allow_ap'} and not $out->{'allow_ap'}
2671 19 0 2 scalar @_ == 1 and defined $_[0]
19 0 2 scalar @_ == 1 and defined $_[0] and (ref $_[0] || '') eq "HASH"
2698 775 0 15 exists $node->{'$id'} and defined $node->{'$id'}
775 0 15 exists $node->{'$id'} and defined $node->{'$id'} and $node->{'$id'} ne ""
2704 789 0 1 exists $node->{'$anchor'} and defined $node->{'$anchor'}
789 0 1 exists $node->{'$anchor'} and defined $node->{'$anchor'} and $node->{'$anchor'} ne ""
2710 788 0 2 exists $node->{'$dynamicAnchor'} and defined $node->{'$dynamicAnchor'}
788 0 2 exists $node->{'$dynamicAnchor'} and defined $node->{'$dynamicAnchor'} and $node->{'$dynamicAnchor'} ne ""
2773 0 0 2917 defined $base and length $base
2827 0 0 9 @tokens and $tokens[0] eq ""
2841 8 0 9 $tok eq "definitions" and not exists $node->{'definitions'}
8 1 8 $tok eq "definitions" and not exists $node->{'definitions'} and exists $node->{'$defs'}
2859 0 0 0 $tok =~ /^\d+$/u and $tok < @$node
2883 27 5 0 exists $S->{'minItems'} and @$A < $S->{'minItems'}
2887 32 0 0 exists $S->{'maxItems'} and @$A > $S->{'maxItems'}
2914 1 0 5 exists $S->{'items'} and ref $S->{'items'} eq "HASH"
3233 0 134 2 $ctx->{'max_errors'} && $ctx->{'error_count'} >= $ctx->{'max_errors'}
3236 287 0 0 exists $S->{'minProperties'} and scalar keys %$H < $S->{'minProperties'}
3242 287 0 0 exists $S->{'maxProperties'} and scalar keys %$H > $S->{'maxProperties'}
3254 122 3 162 exists $S->{'required'} and ref $S->{'required'} eq "ARRAY"
3302 280 0 6 exists $S->{'propertyNames'} and ref $S->{'propertyNames'} eq "HASH"
3367 132 0 21 $addl_set and not _is_true($addl)
132 5 16 $addl_set and not _is_true($addl) and not _is_hash($addl)
3459 18 25 7 exists $S->{'minLength'} and $len < $S->{'minLength'}
3464 18 25 0 exists $S->{'minLength'} and $ctx->{'trace_on'}
3466 38 4 1 exists $S->{'maxLength'} and $len > $S->{'maxLength'}
3471 38 4 0 exists $S->{'maxLength'} and $ctx->{'trace_on'}
3517 0 0 17 ref $uk_def eq "ARRAY" and @$uk_def
3524 0 0 19 ref $key_set eq "ARRAY" and @$key_set
3577 594 0 1 $t eq "null" and not defined $v
3582 6 0 8 builtin::blessed($v) and ref($v) =~ /Boolean/u
3604 3 5 132 !ref($v) && defined $v && !_is_number($v)
3607 250 5 37 $t eq "array" and ref $v eq "ARRAY"
3608 5 14 236 $t eq "object" and ref $v eq "HASH"
3616 0 0 119 defined $u and length $u
3669 0 1 2 $item_schema and ref $item
3733 0 0 0 $shape->{'ap_schema'} and ref $val
3800 0 0 0 defined $re and length $re
3968 0 44 0 $ctx->{'trace_limit'} and @{$ctx->{'trace'};} >= $ctx->{'trace_limit'}
4003 0 704 11 ref $schema eq "HASH" and exists $schema->{'$dynamicAnchor'}
704 0 11 ref $schema eq "HASH" and exists $schema->{'$dynamicAnchor'} and defined $schema->{'$dynamicAnchor'}
704 0 11 ref $schema eq "HASH" and exists $schema->{'$dynamicAnchor'} and defined $schema->{'$dynamicAnchor'} and $schema->{'$dynamicAnchor'} ne ""
4029 0 693 22 ref $schema eq "HASH" and exists $schema->{'$ref'}
4034 0 688 5 ref $schema eq "HASH" and exists $schema->{'$dynamicRef'}
4039 0 679 9 ref $schema eq "HASH" and exists $schema->{'$comment'}
679 0 9 ref $schema eq "HASH" and exists $schema->{'$comment'} and defined $schema->{'$comment'}
4086 537 59 17 $ctx->{'unique_keys'} and exists $schema->{'uniqueKeys'}
59 0 17 $ctx->{'unique_keys'} and exists $schema->{'uniqueKeys'} and ref $schema->{'uniqueKeys'} eq "ARRAY"
59 0 17 $ctx->{'unique_keys'} and exists $schema->{'uniqueKeys'} and ref $schema->{'uniqueKeys'} eq "ARRAY" and ref $inst eq "ARRAY"
4106 316 2 265 not ref $inst and defined $inst
4150 1 2 1 defined $maybe_decoded and not ref $maybe_decoded
4154 2 0 0 $mt =~ m[\Atext/]u and ($params->{'charset'} || '') =~ /\Autf-?8\z/iu
4163 0 0 0 not $ok and $assert
4207 521 23 0 ref $inst eq "ARRAY" and $ctx->{'trace_on'}
4216 274 157 0 ref $inst eq "HASH" and $ctx->{'trace_on'}
4271 176 0 4 @_ == 2 and not $_[0] =~ /^(?:path|message|keyword|schema_pointer)$/u
4339 0 2 4 defined $other and builtin::blessed($other)
2 0 4 defined $other and builtin::blessed($other) and $other->isa("JSON::Schema::Validate::Error")
4343 1 1 2 ($self->message // "") eq ($other->message // "") and ($self->path // "") eq ($other->path // "")

or 2 conditions

line l !l condition
304 0 0 $_[0]{'trace_limit'} // 0
336 0 2 $opts->{'max_errors'} //= 1
773 0 0 $n || 0
780 0 0 $pct || 0
812 0 0 $self->{'vocab_support'} || {}
875 2 216 $self->{'trace_sample'} || 0
7 211 $self->{'trace_limit'} || 0
1017 0 0 _ptr_of_node({'anchors', $anchors}, $node) || '#'
1049 2 0 $self->{'vocab_support'} || {}
1074 0 0 $opts ||= {}
1135 0 0 ref $target_schema || 'scalar'
1208 0 0 ref $target_schema || 'scalar'
2280 0 0 $params->{'charset'} || ''
2501 9 0 $enc // ""
2528 176 0 $ctx->{'ptr_stack'}[-1] // "#"
2671 2 0 ref $_[0] || ''
2760 582 0 eval {
2761 582 0 eval {
3315 250 36 $S->{'properties'} || {}
3316 6 280 $S->{'patternProperties'} || {}
3624 7 0 $type ||= ""
3798 0 0 $opt{'style'} || 'string'
3903 0 0 $@ || 'callback failed'
3981 36 0 $ctx->{'ptr_stack'}[-1] // "#"
4154 0 0 $params->{'charset'} || ''
4298 8 1 $self->schema_pointer // ""
4299 9 0 $self->path // ""
4300 9 0 $self->message // ""
4343 4 0 $self->message // ""
4 0 $other->message // ""
3 0 $self->path // ""
3 0 $other->path // ""
4356 2 0 $self->message // ""

or 3 conditions

line l !l&&r !l&&!r condition
37 0 0 121 !ref($schema) || ref $schema ne 'HASH'
1667 0 0 0 exists $S->{'minLength'} || exists $S->{'maxLength'} || exists $S->{'pattern'}
1785 0 0 0 exists $S->{'minimum'} || exists $S->{'maximum'} || exists $S->{'exclusiveMinimum'} || exists $S->{'exclusiveMaximum'}
1879 0 0 0 exists $S->{'minItems'} || exists $S->{'maxItems'}
1881 0 0 0 exists $S->{'items'} or $has_array_len
2059 0 0 0 $have_min or $have_max
2107 0 0 36 exists $S->{'minLength'} || exists $S->{'maxLength'} || exists $S->{'pattern'}
2242 0 0 15 exists $S->{'contentEncoding'} or exists $S->{'contentMediaType'}
0 0 15 exists $S->{'contentEncoding'} or exists $S->{'contentMediaType'} or exists $S->{'contentSchema'}
2271 0 0 0 $msg || "contentMediaType '${mt}' validation failed"
2479 0 2 0 $schema->{'$defs'} ||= delete $schema->{'definitions'}
2617 0 7 0 not ref $ap or builtin::blessed($ap) and $ap->isa("JSON::PP::Boolean")
2821 0 0 9 not defined $ptr or $ptr eq ""
0 0 9 not defined $ptr or $ptr eq "" or $ptr eq "#"
2974 0 0 3 _is_true($UE) || _is_hash($UE)
3191 0 1 12 not defined $arg or $arg <= 0
3426 0 0 4 _is_true($UE) || _is_hash($UE)
3585 1 7 0 $s eq '0' || $s eq '1'
3886 0 0 37 not defined $base or $base eq ""
0 19 18 not defined $base or $base eq "" or $ref =~ /^[A-Za-z][A-Za-z0-9+\-.]*:/u
4108 30 0 235 exists $schema->{'minLength'} or exists $schema->{'maxLength'}
0 18 217 exists $schema->{'minLength'} or exists $schema->{'maxLength'} or exists $schema->{'pattern'}
4118 9 0 230 exists $schema->{'contentEncoding'} or exists $schema->{'contentMediaType'}
0 0 230 exists $schema->{'contentEncoding'} or exists $schema->{'contentMediaType'} or exists $schema->{'contentSchema'}
4147 1 0 0 $msg || "contentMediaType '${mt}' validation failed"
4283 0 180 0 ref $that || $that