Enbld/Target/Attribute/VersionCondition.pm

filter: Statementstmt 100% 34 / 34 Branchbran 100% 10 / 10 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 2 totaltotal 96.4% 55 / 57 SCAR 19.5
CC
7
Cov
100%
validate
5.0
initialize
3.0
BEGIN
1.0
CRAP 7.0
« Enbld/Target/Attribute.pm ↑ Summary Enbld/Target/Attribute/SortedVersionList.pm »
1 package Enbld::Target::Attribute::VersionCondition;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 3 ▶use parent qw/Enbld::Target::AttributeExtension::Word/;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 sub initialize {
11 45 ▶ my ( $self, $param ) = @_;
Subroutine initialize: called CC=3 SCAR=11.0
Pod undocumented
12  
13 45 ▶ if ( ! defined $param ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $param) 3 42 45
14 3 $self->{value} = 'latest';
15 3 $self->{is_evaluated}++;
16  
17 3 return $self;
18 }
19  
20 42 ▶ if ( $param ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($param) 41 1 42
21 41 $self->SUPER::initialize( $param );
22 41 return $self;
23 }
24  
25 1 require Enbld::Exception;
26 1 my $err = "Attribute 'VersionCondition' isn't defined";
27 1 croak( Enbld::Exception->new( $err ));
28 }
29  
30 sub validate {
31 84 ▶ my ( $self, $string ) = @_;
Subroutine validate: called CC=5 SCAR=16.1
Pod undocumented
32  
33 84 $self->SUPER::validate( $string );
34  
35 82 ▶ return $string if ( $string eq 'latest' );
Branch: 1 branch
BranchTrueFalseTotal
if $string eq "latest" 22 60 82
36  
37 60 my $allowed = $self->{attributes}->AllowedCondition;
38 60 ▶ return $string if ( $allowed and ( $string eq $allowed ) );
Branch: 1 branch
BranchTrueFalseTotal
if $allowed and $string eq $allowed 1 59 60
Condition100%3/3
$allowed and $string eq $allowed
!ll&&!rl&&r
5811
MC/DC100%2/2
$allowed and $string eq $allowed
$allowed $string eq $allowed
Truth table100%3/3
A and B
A= $allowedB= $string eq $allowed
ABresult
0X0
100
111
39  
40 59 my $form = $self->{attributes}->VersionForm;
41 59 ▶ return $string if ( $string =~ /^$form$/ );
Branch: 1 branch
BranchTrueFalseTotal
if $string =~ /^$form$/ 57 2 59
42  
43 2 my $err = "Invalid Version Condition:$string," .
44 " please check install condition";
45 2 require Enbld::Error;
46 2 die( Enbld::Error->new( $err ));
47 }
48  
49 3 1;
« Enbld/Target/Attribute.pm ↑ Summary Enbld/Target/Attribute/SortedVersionList.pm »