ODS/Table/Column/Boolean.pm

filter: Statementstmt 61.9% 13 / 21 Branchbran 33.3% 2 / 6 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 60.0% 3 / 5 Podpod 0.0% 0 / 3 totaltotal 38.3% 18 / 47 CC 7 SCAR 24.1
CC
7
Cov
43%
validation
20.0
deflation
12.0
inflation
2.0
CRAP 11.1
↑ Summary ODS/Storage/Base.pm »
1 package ODS::Table::Column::Boolean;
2  
3 2 ▶use YAOO;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 2 extends 'ODS::Table::Column::Base';
6  
7 2 ▶use ODS::Utils qw/clone error/;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 2 has reference => isa(boolean);
10  
11 sub validation {
12 0 ▶ if (ref($_[1] || "") ne 'SCALAR' && ${$_[1]} !~ m/1|0/) {
Subroutine validation: not called CC=4 SCAR=30.0
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
if (ref($_[1] || "") ne "SCALAR" and not ${$_[1];} =~ /1|0/) 0 0 0
Condition0%0/5
ref($_[1] || "") ne "SCALAR" and not ${$_[1];} =~ /1|0/
!ll&&!rl&&r
000
$_[1] || ''
l!l
00
MC/DC0%0/2
ref($_[1] || "") ne "SCALAR" and not ${$_[1];} =~ /1|0/
$_[1] not ${$_[1];} =~ /1|0/
Truth table0%0/3
A and not(B)
A= $_[1]B= not ${$_[1];} =~ /1|0/
ABresult
0X0
100
111
13 0 croak sprintf "The value passed to the %s column does not match the boolean constraint.",
14 $_[0]->name;
15 }
16 0 return $_[1];
17 }
18  
19 sub inflation {
20 2 ▶ my ($self, $value) = @_;
Subroutine inflation: called CC=2 SCAR=6.9
Pod undocumented
21 2 ▶ if (! ref $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (not ref $value) 1 1 2
22 1 $self->reference(\1);
23 1 $value = \!!$value;
24 }
25 }
26  
27 sub deflation {
28 0 ▶ my ($self, $value) = @_;
Subroutine deflation: not called CC=3 SCAR=24.8
Pod undocumented
29 0 ▶ if ($self->reference && ref $value) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->reference and ref $value) 0 0 0
Condition0%0/3
$self->reference and ref $value
!ll&&!rl&&r
000
MC/DC0%0/2
$self->reference and ref $value
$self->reference ref $value
Truth table0%0/3
A and B
A= $self->referenceB= ref $value
ABresult
0X0
100
111
30 0 $value = $$value;
31 }
32 0 return $value;
33 }
34  
35 2 1;
36  
37 __END__
↑ Summary ODS/Storage/Base.pm »