Branch Coverage

blib/lib/JSON/Schema/ToJSON.pm
Criterion Covered Total %
branch 83 100 83.0


line true false branch
33 9 20 unless ($schema)
38 0 9 unless (eval { do { $schema = &decode_json($schema) } })
41 0 29 if $args{'example_key'}
50 0 26 if $self->_depth
61 2 325 if $self->example_key and $$schema{$self->example_key}
69 0 3 if scalar $self->_example_from_spec($schema)
72 2 1 rand > 0.5 ? :
80 0 169 if scalar $self->_example_from_spec($schema)
87 4 165 if defined $min and $schema->{'exclusiveMinimum'}
88 4 165 if defined $max and $schema->{'exclusiveMaximum'}
90 5 164 if (my $mof = $schema->{'multipleOf'}) { }
97 4 18 if $int % $mof == 0
110 0 19 if scalar $self->_example_from_spec($schema)
114 2 17 if $schema->{'multipleOf'}
122 1 134 if scalar $self->_example_from_spec($schema)
125 0 134 if (my(@enum) = @{$schema->{'enum'} // [];})
130 2 132 if $schema->{'pattern'}
132 23 109 if (my $format = $schema->{'format'})
173 0 16 if ($self->max_depth and $self->_depth >= $self->max_depth) { }
183 12 4 if (my $items = $schema->{'items'}) { }
187 4 8 if (ref $items eq 'ARRAY') { }
190 0 18 if $self->max_depth and $self->_depth >= $self->max_depth
191 4 14 unless $self->_add_next_array_item(\@return_items, $item, $unique)
198 0 22 if $self->max_depth and $self->_depth >= $self->max_depth
199 2 20 unless $self->_add_next_array_item(\@return_items, $items, $unique)
209 8 8 if $self->_depth
216 0 40 if ($self->max_depth and $self->_depth >= $self->max_depth)
226 25 15 if $self->_depth
228 24 16 unless ($unique)
237 10 6 unless ($existing{$value})
252 4 30 if ($required = $schema->{'required'})
264 32 1 unless ($min or $max)
269 1 33 if ($min and scalar keys %properties < $min)
271 1 0 if ($max) { }
275 1 1 if scalar keys %properties == $min
283 1 33 if ($max and scalar keys %properties > $max)
293 2 0 unless $required and grep {$_ eq $property;} @{$required;}
296 1 1 if scalar keys %properties <= $max
300 0 34 if ($self->max_depth and $self->_depth >= $self->max_depth) { }
312 0 236 if $self->max_depth and $self->_depth >= $self->max_depth
317 184 52 $self->can($method) ? :
322 29 5 if $self->_depth
337 40 267 if ($schema->{'type'} and ref $schema->{'type'} eq 'ARRAY')
345 1 306 if (my $any_of = $schema->{'anyOf'}) { }
1 305 elsif (my $all_of = $schema->{'allOf'}) { }
2 303 elsif (my $one_of = $schema->{'oneOf'}) { }
1 302 elsif (my $not = $schema->{'not'}) { }
375 1 0 if (my $not_type = $not->{'type'})
400 18 284 $schema->{'enum'} ? :
405 302 0 if $self->_depth