Branch Coverage

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


line true false branch
33 9 18 unless ($schema)
38 0 9 unless (eval { do { $schema = &decode_json($schema) } })
41 0 27 if $args{'example_key'}
50 0 26 if $self->_depth
61 2 341 if $self->example_key and $$schema{$self->example_key}
69 0 3 if scalar $self->_example_from_spec($schema)
72 1 2 rand > 0.5 ? :
80 0 174 if scalar $self->_example_from_spec($schema)
87 4 170 if defined $min and $schema->{'exclusiveMinimum'}
88 4 170 if defined $max and $schema->{'exclusiveMaximum'}
90 5 169 if (my $mof = $schema->{'multipleOf'}) { }
97 4 18 if $int % $mof == 0
110 0 17 if scalar $self->_example_from_spec($schema)
114 2 15 if $schema->{'multipleOf'}
122 1 147 if scalar $self->_example_from_spec($schema)
125 0 147 if (my(@enum) = @{$schema->{'enum'} // [];})
130 2 145 if $schema->{'pattern'}
132 25 120 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 15 if $self->max_depth and $self->_depth >= $self->max_depth
191 1 14 unless $self->_add_next_array_item(\@return_items, $item, $unique)
198 0 26 if $self->max_depth and $self->_depth >= $self->max_depth
199 1 25 unless $self->_add_next_array_item(\@return_items, $items, $unique)
209 8 8 if $self->_depth
216 0 41 if ($self->max_depth and $self->_depth >= $self->max_depth)
226 25 16 if $self->_depth
228 29 12 unless ($unique)
237 10 2 unless ($existing{$value})
252 4 31 if ($required = $schema->{'required'})
264 33 1 unless ($min or $max)
269 1 34 if ($min and scalar keys %properties < $min)
271 1 0 if ($max) { }
275 1 1 if scalar keys %properties == $min
283 1 34 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 35 if ($self->max_depth and $self->_depth >= $self->max_depth) { }
312 0 241 if $self->max_depth and $self->_depth >= $self->max_depth
317 193 48 $self->can($method) ? :
322 30 5 if $self->_depth
337 40 273 if ($schema->{'type'} and ref $schema->{'type'} eq 'ARRAY')
345 1 312 if (my $any_of = $schema->{'anyOf'}) { }
1 311 elsif (my $all_of = $schema->{'allOf'}) { }
2 309 elsif (my $one_of = $schema->{'oneOf'}) { }
1 308 elsif (my $not = $schema->{'not'}) { }
375 1 0 if (my $not_type = $not->{'type'})
400 15 293 $schema->{'enum'} ? :
405 308 0 if $self->_depth