Branch Coverage

blib/lib/JSON/Schema/Draft201909/Vocabulary/Validation.pm
Criterion Covered Total %
branch 129 148 87.1


line true false branch
36 82 1788 if (XXX) { }
37 0 82 unless @{$schema->{'type'};}
40 2 168 unless &any(sub {
42 0 80 if not is_elements_unique($schema->{'type'})
45 2 1786 unless assert_keyword_type($state, $schema, 'string')
47 2 1784 if not &any(sub {
54 431 1732 if (XXX) { }
56 402 74 if is_type($type, $data)
61 1192 540 if is_type($schema->{'type'}, $data)
68 0 143 unless assert_keyword_type($state, $schema, 'array')
69 0 143 if not is_elements_unique($schema->{'enum'})
76 71 57 if &any(sub {
80 54 3 !grep($_->{'path'}, @s) ? :
86 205 131 if is_equal($data, $schema->{'const'}, my $s = {})
88 19 112 $s->{'path'} ? :
93 0 302 unless assert_keyword_type($state, $schema, 'number')
94 0 302 if $schema->{'multipleOf'} <= 0
100 67 215 unless is_type('number', $data)
103 112 103 if int $quotient == $quotient and not $quotient =~ /^-?Inf$/iu
112 69 130 unless is_type('number', $data)
113 67 63 if $data <= $schema->{'maximum'}
122 67 101 unless is_type('number', $data)
123 48 53 if $data < $schema->{'exclusiveMaximum'}
132 69 162 unless is_type('number', $data)
133 72 90 if $data >= $schema->{'minimum'}
142 67 80 unless is_type('number', $data)
143 38 42 if $data > $schema->{'exclusiveMinimum'}
152 74 112 unless is_type('string', $data)
153 58 54 if length $data <= $schema->{'maxLength'}
162 73 100 unless is_type('string', $data)
163 53 47 if length $data >= $schema->{'minLength'}
169 0 313 unless assert_keyword_type($state, $schema, 'string')
176 80 244 unless is_type('string', $data)
178 129 114 if $data =~ /$schema->{'pattern'}/u
187 60 86 unless is_type('array', $data)
188 45 41 if @$data <= $schema->{'maxItems'}
189 6 35 $schema->{'maxItems'} > 1 ? :
197 73 85 unless is_type('array', $data)
198 44 41 if @$data >= $schema->{'minItems'}
199 39 2 $schema->{'minItems'} > 1 ? :
204 0 279 if not assert_keyword_type($state, $schema, 'boolean')
210 71 197 unless is_type('array', $data)
211 55 142 unless $schema->{'uniqueItems'}
212 80 62 if is_elements_unique($data, my $equal_indices = [])
222 4 28 unless exists $state->{'_num_contains'}
223 0 28 unless is_type('array', $data)
226 12 16 if $state->{'_num_contains'} > $schema->{'maxContains'}
236 4 38 unless exists $state->{'_num_contains'}
237 0 38 unless is_type('array', $data)
240 15 23 if $state->{'_num_contains'} < $schema->{'minContains'}
250 47 64 unless is_type('object', $data)
251 33 31 if keys %$data <= $schema->{'maxProperties'}
253 2 29 $schema->{'maxProperties'} > 1 ? :
261 47 64 unless is_type('object', $data)
262 33 31 if keys %$data >= $schema->{'minProperties'}
264 2 29 $schema->{'minProperties'} > 1 ? :
270 0 357 unless assert_keyword_type($state, $schema, 'array')
272 0 357 if &any(sub {
273 0 357 if not is_elements_unique($schema->{'required'})
279 47 305 unless is_type('object', $data)
282 217 88 unless @missing
283 4 84 @missing > 1 ? :
289 0 152 unless assert_keyword_type($state, $schema, 'object')
293 0 160 unless is_type('array', $schema->{'dependentRequired'}{$property})
297 0 166 unless is_type('string', $schema->{'dependentRequired'}{$property}[$index])
301 0 160 unless is_elements_unique($schema->{'dependentRequired'}{$property})
308 49 86 unless is_type('object', $data)
312 18 76 unless exists $data->{$property}
314 39 37 if (my(@missing) = grep((!exists $data->{$_}), @{$$schema{'dependentRequired'}{$property};}))
315 2 37 @missing > 1 ? :
320 47 39 if $valid
326 4 825 if not assert_keyword_type($state, $schema, 'number')
331 0 1110 unless assert_keyword_type($state, $schema, 'integer')
333 0 1110 if $$schema{$state->{'keyword'}} < 0