ODS/Table/Column/Hash.pm

filter: Statementstmt 60.0% 18 / 30 Branchbran 37.5% 3 / 8 Conditioncond 37.5% 3 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 80.0% 4 / 5 Podpod 0.0% 0 / 3 totaltotal 47.4% 28 / 59 CC 8 SCAR 18.3
CC
8
Cov
52%
validation
9.9
inflation
6.0
deflation
3.8
CRAP 6.2
« ODS/Storage/Base.pm ↑ Summary ODS/Table/Column/Float.pm »
1 package ODS::Table::Column::Hash;
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 required_keys => isa(array);
12  
13 1 has serialize_class => isa(object);
14  
15 sub validation {
16 6 ▶ if (ref($_[1] || "") ne 'HASH') {
Subroutine validation: called CC=5 SCAR=22.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
if (ref($_[1] || "") ne "HASH") 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
17 0 croak sprintf "The value passed to the %s column does not match the hash constraint.",
18 $_[0]->name;
19 }
20 6 my @missing;
21 6 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]->required_keys and do { @missing = grep({not defined $_[1]{$_};} @{$_[0]->required_keys;}); @missing }) 0 6 6
Condition33%1/3
$_[0]->required_keys and do { @missing = grep({not defined $_[1]{$_};} @{$_[0]->required_keys;}); @missing }
!ll&&!rl&&r
600
MC/DC0%0/2
$_[0]->required_keys and do { @missing = grep({not defined $_[1]{$_};} @{$_[0]->required_keys;}); @missing }
$_[0]->required_keys do { @missing = grep({not defined $_[1]{$_};} @{$_[0]->required_keys;}); @missing }
Truth table33%1/3
A and B
A= $_[0]->required_keysB= do { @missing = grep({not defined $_[1]{$_};} @{$_[0]->required_keys;}); @missing }
ABresult
0X0
100
111
22 $_[0]->required_keys && do {
23 0 @missing = grep { ! defined $_[1]->{$_} } @{$_[0]->required_keys};
24 0 @missing;
25 }
26 ) {
27 0 croak sprintf "The % column array length is missing the following required keys %s.",
28 $_[0]->name, join ", ", @missing;
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__
« ODS/Storage/Base.pm ↑ Summary ODS/Table/Column/Float.pm »