Branch Coverage

blib/lib/Avro/Schema.pm
Criterion Covered Total %
branch 150 202 74.2


line true false branch
60 87 140 if (ref $struct eq 'HASH') { }
16 124 elsif (ref $struct eq 'ARRAY') { }
62 0 87 unless my $type = $struct->{'type'}
63 11 76 if ("Avro::Schema::Primitive"->is_type_valid($type))
68 23 53 if ($type eq 'record' or $type eq 'error') { }
6 47 elsif ($type eq 'enum') { }
19 28 elsif ($type eq 'array') { }
17 11 elsif ($type eq 'map') { }
11 0 elsif ($type eq 'fixed') { }
121 124 0 unless ($type =~ /\./)
123 1 123 if (exists $names->{$fulltype})
129 11 112 if (exists $names->{$type})
143 0 1908 unless my $reader = $param{'reader'}
145 0 1908 unless my $writer = $param{'writer'}
147 1908 0 ref $writer ? :
148 1908 0 ref $reader ? :
150 3 1905 if $wtype eq "union" or $rtype eq "union"
153 1313 592 if $wtype eq $rtype and "Avro::Schema::Primitive"->is_type_valid($wtype)
158 2 0 if ($wtype eq "int" and $rtype eq 'float' || $rtype eq 'long' || $rtype eq 'double')
164 1 2 if ($wtype eq "long" and $rtype eq 'float' || $rtype eq 'double')
170 1 587 if ($wtype eq "float" and $rtype eq "double")
173 12 575 unless $rtype eq $wtype
176 427 148 if ($rtype eq 'array') { }
11 137 elsif ($rtype eq 'record') { }
115 22 elsif ($rtype eq 'map') { }
14 8 elsif ($rtype eq 'fixed') { }
8 0 elsif ($rtype eq 'enum') { }
177 425 2 if $class->match("reader", $reader->items, "writer", $writer->items)
183 10 1 if $reader->fullname eq $writer->fullname
186 113 2 if $class->match("reader", $reader->values, "writer", $writer->values)
192 13 1 if $reader->size eq $writer->size and $reader->fullname eq $writer->fullname
196 7 1 if $reader->fullname eq $writer->fullname
211 204 22 unless ($type)
257 0 126 unless my $type = $param{'type'}
259 1 125 unless $class->is_type_valid($type)
262 22 103 unless (exists $Singleton{$type})
279 13 20 if ($type eq "int")
283 5 8 $unpacked_int eq $data ? :
285 11 9 if ($type eq "long")
286 11 0 if ($Avro::Schema::Primitive::Config{'use64bitint'}) { }
287 1 10 unless defined $data
290 6 4 $unpacked_int eq $data ? :
296 0 0 if ($@)
300 0 0 if $int->is_nan
302 0 0 $int->bcmp($max) <= 0 ? :
305 1 8 if ($type eq "float" or $type eq "double")
306 1 0 $data =~ /^$Avro::Schema::Primitive::RE{'num'}{'real'}$/ ? :
308 5 3 if ($type eq "bytes" or $type eq "string")
309 3 2 unless not defined $data or ref $data
311 3 2 if ($type eq "null")
312 1 2 defined $data ? :
314 0 2 if ($type eq "boolean")
315 0 0 if ref $data
316 0 0 if $data =~ /yes|no|y|n|t|f|true|false/i
346 0 152 unless (defined $name and length $name)
350 111 41 unless (defined $namespace and length $namespace)
369 13 139 if (@parts > 1)
372 5 8 if (grep {not length $_;} @parts)
383 31 116 unless (length $name and $name =~ /^[A-Za-z_][A-Za-z0-9_]*$/)
388 52 64 if (defined $namespace and length $namespace)
390 36 32 unless ($_ and /^[A-Za-z_][A-Za-z0-9_]*$/)
406 0 80 if (exists $names->{$name})
417 329 39 if defined $_
441 0 63 unless my $fields = $param{'struct'}{'fields'}
443 0 63 unless ref $fields eq "ARRAY"
462 3 3 if ($known_names->{$fullname}++)
481 4 6 unless (exists $schema->{'_fields_as_hash'})
494 1 1 unless $field->is_data_valid($data->{$key})
513 0 84 unless defined $name and length $name
517 0 84 unless defined $type and length $type
525 28 54 if (exists $struct->{'default'})
528 12 16 unless $is_valid
533 0 16 if ($type eq 'boolean') { }
534 0 0 $struct->{'default'} ? :
540 7 63 if (my $order = $struct->{'order'})
543 4 3 unless $ValidOrder{$order}
552 1 1 if $field->{'type'}->is_data_valid($data)
564 0 6 unless my $struct = $param{'struct'}
567 0 6 unless (@$symbols)
573 0 15 if (ref $_)
579 0 15 if exists $symbols{$_}
590 3 2 if defined $data and exists $schema->{'hash_symbols'}{$data}
596 3 7 unless (exists $schema->{'symbols'})
613 0 3 if ($known_names->{$fullname}++)
632 0 19 unless my $struct = $param{'struct'}
635 0 19 unless my $items = $struct->{'items'}
645 2 0 if $default and ref $default eq "ARRAY"
673 0 17 unless my $struct = $param{'struct'}
676 0 17 unless (defined $values and length $values)
688 1 0 if $default and ref $default eq "HASH"
715 0 16 unless my $union = $param{'struct'}
729 9 27 if ("Avro::Schema::Named"->is_type_valid($type))
733 3 33 if ($seen_types{$type}++)
739 1 32 if ($type eq "union")
760 0 0 if ($type->is_data_valid($data))
782 0 11 unless my $struct = $param{'struct'}
785 0 11 unless (defined $size and length $size)
788 0 11 if (ref $size)
793 4 7 unless ($size =~ /^\d+$/ and $size > 0)
808 0 0 if $default and $default->bytes::length == $size
822 0 1 if ($known_names->{$fullname}++)