ODS/Table/Column/Array.pm

filter: Statementstmt 63.3% 19 / 30 Branchbran 40.0% 4 / 10 Conditioncond 36.3% 4 / 11 MC/DCmcdc 0.0% 0 / 7 Subroutinesub 80.0% 4 / 5 Podpod 0.0% 0 / 3 totaltotal 46.9% 31 / 66 CC 10 SCAR 22.8
CC
10
Cov
53%
validation
15.8
inflation
6.0
deflation
3.8
CRAP 9.7
↑ Summary ODS/Storage/Base.pm »
1 package ODS::Table::Column::Array;
2  
3 1 ▶use YAOO;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 extends 'ODS::Table::Column::Base';
6  
7 1 ▶use ODS::Utils qw/clone error/;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 has reference => isa(boolean);
10  
11 1 has min_length => isa(integer);
12  
13 1 has max_length => isa(integer);
14  
15 1 has serialize_class => isa(object);
16  
17 sub validation {
18 6 ▶ if (ref($_[1] || "") ne 'ARRAY') {
Subroutine validation: called CC=7 SCAR=27.6
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
if (ref($_[1] || "") ne "ARRAY") 0 6 6
Condition50%1/2
$_[1] || ''
l!l
60
MC/DC0%0/1
$_[1] || ''
$_[1]
Truth table50%1/2
A
A= $_[1]
Aresult
11
00
19 0 croak sprintf "The value passed to the %s column does not match the array constraint.",
20 $_[0]->name;
21 }
22 6 ▶ if ($_[0]->min_length && $_[0]->min_length > scalar @{$_[1]}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]->min_length and $_[0]->min_length > scalar @{$_[1];}) 0 6 6
Condition33%1/3
$_[0]->min_length and $_[0]->min_length > scalar @{$_[1];}
!ll&&!rl&&r
600
MC/DC0%0/2
$_[0]->min_length and $_[0]->min_length > scalar @{$_[1];}
$_[0]->min_length $_[0]->min_length > scalar @{$_[1];}
Truth table33%1/3
A and B
A= $_[0]->min_lengthB= $_[0]->min_length > scalar @{$_[1];}
ABresult
0X0
100
111
23 0 croak sprintf "The % column array length is less than the minimum allowed length for the attribute.",
24 $_[0]->name;
25 }
26 6 ▶ if ($_[0]->max_length && $_[0]->max_length < scalar @{$_[1]}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]->max_length and $_[0]->max_length < scalar @{$_[1];}) 0 6 6
Condition33%1/3
$_[0]->max_length and $_[0]->max_length < scalar @{$_[1];}
!ll&&!rl&&r
600
MC/DC0%0/2
$_[0]->max_length and $_[0]->max_length < scalar @{$_[1];}
$_[0]->max_length $_[0]->max_length < scalar @{$_[1];}
Truth table33%1/3
A and B
A= $_[0]->max_lengthB= $_[0]->max_length < scalar @{$_[1];}
ABresult
0X0
100
111
27 0 croak sprintf "The % column array length is greater than the maximum allowed length for the attribute.",
28 $_[0]->name;
29 }
30 6 return $_[1];
31 }
32  
33 sub inflation {
34 0 ▶ my ($self, $value) = @_;
Subroutine inflation: not called CC=2 SCAR=17.9
Pod undocumented
35 0 ▶ if (! ref $value) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $value) 0 0 0
36 0 $value = $self->serialize_class->parse($value);
37 0 $self->reference(1);
38 }
39 0 return $value;
40 }
41  
42 sub deflation {
43 4 ▶ my ($self, $value) = @_;
Subroutine deflation: called CC=3 SCAR=13.3
Pod undocumented
44 4 ▶ if ($self->reference && ref $value) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->reference and ref $value) 0 4 4
Condition33%1/3
$self->reference and ref $value
!ll&&!rl&&r
400
MC/DC0%0/2
$self->reference and ref $value
$self->reference ref $value
Truth table33%1/3
A and B
A= $self->referenceB= ref $value
ABresult
0X0
100
111
45 0 $value = $self->serialize_class->stringify($value);
46 }
47 4 return $value;
48 }
49  
50 1 1;
51  
52 __END__
↑ Summary ODS/Storage/Base.pm »