Branch Coverage

lib/Changes/Version.pm
Criterion Covered Total %
branch 153 330 46.3


line true false branch
143 42 97 if (@_ == 1 and ref $_[0] ne "HASH" or @_ > 1 and ref $_[0] ne "HASH" and @_ % 2 || ref $_[1] eq 'HASH')
147 0 42 unless defined $vstr and length "$vstr"
150 2 40 if exists $opts->{'debug'} and defined $opts->{'debug'} and length "$opts->{'debug'}"
153 0 42 unless defined $v
159 0 139 unless defined $rv
168 0 117 unless (exists $self->{'_reset'} and defined $self->{'_reset'} and length $self->{'_reset'})
172 68 124 if (exists $self->{'_cache_value'} and defined $self->{'_cache_value'} and length $self->{'_cache_value'}) { }
124 0 elsif (defined $self->{'original'} and length "$self->{'original'}") { }
185 59 58 if (defined $type and $type eq 'dotted' or not defined $type and $Changes::Version::DEFAULT_TYPE eq 'dotted') { }
195 1 57 if (defined $fmt and length $fmt) { }
201 57 0 if (defined $minor and index($minor, '_') != -1 || length $minor == 3 && substr($minor, 0, 1) eq '0' || length(($patch // '') || $self->padded)) { }
210 2 55 if (not $self->padded and index($str, "_") == -1)
215 3 1 if ($self->pretty and index($str, "_") == -1 and not length([split(/\./, $str, 0)]->[1]) % 3)
225 0 0 defined $minor ? :
0 0 defined $alpha ? :
273 1 0 if (defined $minor and length $minor) { }
0 0 elsif (defined $patch and length $patch) { }
275 1 0 if (defined $patch and length $patch) { }
295 0 0 unless ($self->extra->is_empty)
303 0 0 $comp->is_empty ? :
315 1 0 length $a ? :
321 0 0 length $dots ? :
327 0 0 length $dots ? :
335 0 0 length $minor ? :
343 1 0 length $num ? :
355 0 0 length $num ? :
359 0 1 if ($self->_is_array($fmt)) { }
1 0 elsif (not ref $fmt or ref $fmt and overload::Method($fmt, '""')) { }
363 0 0 if substr($this, 0, 1) eq "%"
364 0 0 unless (exists $map->{$this})
366 0 0 if $self->_is_warnings_enabled
380 3 0 if (exists $map->{$this}) { }
409 0 0 (shift())->alpha->length > 0 ? :
411 0 0 (shift())->qv ? :
428 1 59 unless ($self->qv)
432 59 1 if ($opts->{'raw'}) { }
444 0 60 if ($@)
461 57 1 if ($opts->{'raw'}) { }
470 22 35 if defined $alpha and length "$alpha"
479 1 0 if (length($alpha // '')) { }
491 0 58 if ($@)
506 0 96 unless defined $str and length "$str"
507 0 96 if ($] >= "5.008001" and ref \$str eq "VSTRING")
521 96 0 if ($str =~ /^$Changes::Version::VERSION_LAX_REGEX$/) { }
526 13 83 if (defined $re->{'dotted'} and length $re->{'dotted'}) { }
83 0 elsif (defined $re->{'decimal'} and length $re->{'decimal'}) { }
539 6 90 if defined $re->{'has_v'} and length $re->{'has_v'}
541 80 16 if defined $re->{'minor'} and length $re->{'minor'}
542 2 94 if defined $re->{'alpha'} and length $re->{'alpha'}
543 13 83 if ($def->{'type'} eq 'dotted') { }
83 0 elsif ($def->{'type'} eq 'decimal') { }
546 1 12 if (defined $re->{'dotted_numified'}) { }
551 0 1 if (defined $re->{'dotted_numified_under'}) { }
558 1 0 if defined $re->{'alpha'}
561 1 0 if ($vstr =~ /^$Changes::Version::VERSION_LAX_REGEX$/)
564 1 0 if (defined $re2->{'dotted'} and length $re2->{'dotted'})
566 1 0 if (defined $re2->{'minor_patch'})
584 1 11 if defined $def->{'alpha'} and length $def->{'alpha'}
585 12 0 if (defined $re->{'minor_patch'})
606 79 4 if defined $def->{'minor'} and length $def->{'minor'}
608 0 83 if (defined $def->{'alpha'} and length $def->{'alpha'} < 3 and not $self->compat) { }
650 96 0 if defined $v
651 0 96 unless defined $new
674 170 80 if (not exists $self->{'_reset'} && defined $self->{'_reset'} && length $self->{'_reset'} and scalar @_)
681 73 97 if (defined $self->{'major'})
691 0 73 if ($@)
693 0 0 if $self->_warnings_is_enabled
704 0 7 __PACKAGE__->_is_object($this) && $this->isa('Changes::Version') ? :
721 3 6 if (/^(\d+([._]\d+)*)$/)
723 1 2 if $vers == "version"->parse($1)
726 4 2 if (/^([=!<>]=|[<>])(\d+([._]\d+)*)$/)
728 4 0 if $cmp->{$1}->($vers, "version"->parse($2))
731 2 0 if (/^(\d+([._]\d+)*)\.\.(\d+([._]\d+)*)$/)
733 2 0 if ("version"->parse($1) <= $vers and $vers <= "version"->parse($3))
754 88 13 if ($self->{'type'} eq 'decimal') { }
13 0 elsif ($self->{'type'} eq 'dotted') { }
781 0 0 if (not defined $frag && length $frag) { }
0 0 elsif (not $frag =~ /^(major|minor|patch|alpha|\d+)$/) { }
0 0 elsif ($val >= 0) { }
797 0 0 $frag =~ /^\d+$/ ? :
811 0 0 if ($frag eq "alpha")
816 0 0 if $frag_is_int and $frag == 0
817 0 0 $frag_is_int ? :
820 0 0 if ($type eq "decimal" and $level > 2)
830 0 0 if ($val < 0) { }
833 0 0 unless ($i == 1)
837 0 0 if (exists $num2frag->{$j}) { }
849 0 0 $up_val > 0 ? :
852 0 0 if (exists $num2frag->{$i}) { }
866 0 0 if (exists $num2frag->{$i}) { }
888 0 84 if (not defined $frag && length $frag) { }
0 84 elsif (not $frag =~ /^(major|minor|patch|alpha|\d+)$/) { }
898 0 84 $frag =~ /^\d+$/ ? :
899 21 63 if ($frag eq 'major' or $frag_is_int and $frag == 1) { }
21 42 elsif ($frag eq 'minor' or $frag_is_int and $frag == 2) { }
21 21 elsif ($frag eq 'patch' or $frag_is_int and $frag == 3) { }
21 0 elsif ($frag eq 'alpha') { }
0 0 elsif ($type eq 'dotted' and $frag_is_int) { }
926 0 0 $offset < $len ? :
928 0 0 if ($i < $offset and not defined $extra->[$i] && length $extra->[$i] or $i > $offset)
944 0 40 if ${^GLOBAL_PHASE} eq "DESTRUCT"
945 40 0 unless ($left->_is_a($right, $class))
950 0 40 if ($swap)
955 0 40 unless (_verify($left))
957 0 0 $swap ? :
960 0 40 unless (_verify($right))
962 0 0 $swap ? :
985 0 96 unless $frag =~ /^(major|minor|patch|alpha|\d+)$/
986 0 96 if (not defined $opts or ref $opts ne "HASH" or not exists $opts->{'op'} or not defined $opts->{'op'} or not length $opts->{'op'})
997 0 96 $frag =~ /^\d+$/ ? :
1005 96 0 if ($frag_is_int and exists $map->{$frag} or not $frag_is_int)
1010 96 0 defined $coderef ? :
1012 0 96 if (not defined $val) { }
0 96 elsif (not $self->_is_a($val, 'Module::Generic::Number')) { }
1019 0 0 unless (defined $val)
1026 16 80 if ($op eq '++' or $op eq '--') { }
1032 16 0 defined $other ? :
64 0 defined $other ? :
16 64 $swap ? :
1035 0 96 if $@
1036 0 96 if (defined $err)
1038 0 0 if $self->_warnings_is_enabled
1044 16 80 if ($swap) { }
1046 0 16 ref $rv ? :
1052 16 64 if ($op eq '++' or $op eq '--') { }
1062 0 80 if ($new_val < 0) { }
1068 80 0 if (defined $coderef) { }
1087 0 4 unless $op =~ /^(inc|dec)$/
1090 0 4 if (not defined $frag && length "$frag") { }
0 4 elsif (not $frag =~ /^(major|minor|patch|alpha|\d+)$/) { }
1092 0 0 $op eq 'inc' ? :
1096 0 0 $op eq 'inc' ? :
1098 0 4 if (defined $unit and not $unit =~ /^\d+$/)
1100 0 0 $op eq 'inc' ? :
1103 0 4 $frag =~ /^\d+$/ ? :
1111 4 0 if ($frag_is_int and exists $map->{$frag} or not $frag_is_int)
1116 4 0 defined $coderef ? :
1118 0 4 if ($frag_is_int and $frag - 4 > $extra->size) { }
0 4 elsif (defined $unit and $unit == 1) { }
1120 0 0 defined $unit ? :
0 0 $op eq 'inc' ? :
1128 0 0 $op eq 'inc' ? :
1132 4 0 $op eq 'inc' ? :
1135 4 0 if (defined $coderef) { }
1151 0 0 if $self->_warnings_is_enabled
1164 0 189 unless defined $def->{'major'} and length $def->{'major'}
1165 94 95 if ($self->qv or ($type // '') eq 'dotted') { }
95 0 elsif (($type // '') eq 'decimal') { }
1167 0 94 unless defined $def->{'minor'} and length "$def->{'minor'}"
1168 0 94 unless defined $def->{'patch'} and length "$def->{'patch'}"
1174 0 0 if not defined $def->{'minor'} && length "$def->{'minor'}" and defined $def->{'alpha'} and length "$def->{'alpha'}"
1177 0 189 unless ($self->extra->is_empty)
1184 3 0 unless length $def->{$_} or $ok
1189 94 95 $self->qv ? :
1190 94 95 if defined $def->{'alpha'} and length $def->{'alpha'}
1197 0 80 if ${^GLOBAL_PHASE} eq "DESTRUCT"
1198 0 80 unless (defined $self and ref $self eq "Changes::Version")
1202 80 0 if (eval {
1216 0 87 if (@_) { }
0 87 elsif (not exists $self->{'_version'} && defined $self->{'_version'}) { }
1219 0 0 unless $self->_is_a($v, "version")
1230 0 0 if ($@)
1232 0 0 if $self->_warnings_is_enabled
1243 0 456 unless defined $self
1245 0 456 if ${^GLOBAL_PHASE} eq "DESTRUCT"