Branch Coverage

blib/lib/JSON/Schema/ToJSON.pm
Criterion Covered Total %
branch 74 100 74.0


line true false branch
33 9 9 unless ($schema)
38 0 9 unless (eval { do { $schema = &decode_json($schema) } })
41 0 18 if $args{'example_key'}
50 0 18 if $self->_depth
61 2 107 if $self->example_key and $$schema{$self->example_key}
69 0 1 if scalar $self->_example_from_spec($schema)
72 1 0 rand > 0.5 ? :
80 0 79 if scalar $self->_example_from_spec($schema)
87 4 75 if defined $min and $schema->{'exclusiveMinimum'}
88 4 75 if defined $max and $schema->{'exclusiveMaximum'}
90 3 76 if (my $mof = $schema->{'multipleOf'}) { }
97 2 10 if $int % $mof == 0
110 0 7 if scalar $self->_example_from_spec($schema)
114 0 7 if $schema->{'multipleOf'}
122 1 20 if scalar $self->_example_from_spec($schema)
125 0 20 if (my(@enum) = @{$schema->{'enum'} // [];})
130 2 18 if $schema->{'pattern'}
132 7 11 if (my $format = $schema->{'format'})
173 0 12 if ($self->max_depth and $self->_depth >= $self->max_depth) { }
183 8 4 if (my $items = $schema->{'items'}) { }
187 4 4 if (ref $items eq 'ARRAY') { }
190 0 23 if $self->max_depth and $self->_depth >= $self->max_depth
191 9 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 5 17 unless $self->_add_next_array_item(\@return_items, $items, $unique)
209 5 7 if $self->_depth
216 0 45 if ($self->max_depth and $self->_depth >= $self->max_depth)
226 19 26 if $self->_depth
228 20 25 unless ($unique)
237 11 14 unless ($existing{$value})
252 2 5 if ($required = $schema->{'required'})
264 5 1 unless ($min or $max)
269 1 6 if ($min and scalar keys %properties < $min)
271 1 0 if ($max) { }
275 1 0 if scalar keys %properties == $min
283 1 6 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 7 if ($self->max_depth and $self->_depth >= $self->max_depth) { }
312 0 34 if $self->max_depth and $self->_depth >= $self->max_depth
317 34 0 $self->can($method) ? :
322 3 4 if $self->_depth
337 1 96 if ($schema->{'type'} and ref $schema->{'type'} eq "ARRAY")
345 0 97 if (my $any_of = $schema->{'anyOf'}) { }
0 97 elsif (my $all_of = $schema->{'allOf'}) { }
0 97 elsif (my $one_of = $schema->{'oneOf'}) { }
0 97 elsif (my $not = $schema->{'not'}) { }
375 0 0 if (my $not_type = $not->{'type'})
400 24 73 $schema->{'enum'} ? :
405 97 0 if $self->_depth