ODS/Table/Column/Boolean.pm

filter: Statementstmt 90.4% 19 / 21 Branchbran 66.6% 4 / 6 Conditioncond 37.5% 3 / 8 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 3 totaltotal 65.9% 31 / 47 CC 7 SCAR 12.8
CC
7
Cov
74%
validation
5.5
deflation
3.8
inflation
2.0
CRAP 3.6
« ODS/Table.pm ↑ Summary ODS/Table/Column/Object.pm »
1 package ODS::Table::Column::Boolean;
2  
3 71 ▶use YAOO;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 71 extends 'ODS::Table::Column::Base';
6  
7 71 ▶use ODS::Utils qw/clone error/;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 71 has reference => isa(boolean);
10  
11 sub validation {
12 6844 ▶ if (ref($_[1] || "") ne 'SCALAR' || ${$_[1]} !~ m/1|0/) {
Subroutine validation: called CC=4 SCAR=17.1
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
if (ref($_[1] || "") ne "SCALAR" or not ${$_[1];} =~ /1|0/) 0 6844 6844
Condition40%2/5
ref($_[1] || "") ne "SCALAR" or not ${$_[1];} =~ /1|0/
l!l&&r!l&&!r
006844
$_[1] || ''
l!l
68440
MC/DC0%0/2
ref($_[1] || "") ne "SCALAR" or not ${$_[1];} =~ /1|0/
$_[1] not ${$_[1];} =~ /1|0/
Truth table0%0/3
A or not(B)
A= $_[1]B= not ${$_[1];} =~ /1|0/
ABresult
1X1
011
000
13 0 croak sprintf "The value passed to the %s column does not match the boolean constraint.",
14 $_[0]->name;
15 }
16 6844 return $_[1];
17 }
18  
19 sub inflation {
20 1818 ▶ my ($self, $value) = @_;
Subroutine inflation: called CC=2 SCAR=6.9
Pod undocumented
21 1818 ▶ if (! ref $value) {
Branch: 1 branch
BranchTrueFalseTotal
if (not ref $value) 19 1799 1818
22 19 $self->reference(\1);
23 19 $value = \!!$value;
24 }
25 }
26  
27 sub deflation {
28 3422 ▶ my ($self, $value) = @_;
Subroutine deflation: called CC=3 SCAR=13.3
Pod undocumented
29 3422 ▶ if ($self->reference && ref $value) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->reference and ref $value) 0 3422 3422
Condition33%1/3
$self->reference and ref $value
!ll&&!rl&&r
342200
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
30 0 $value = $$value;
31 }
32 3422 return $value;
33 }
34  
35 71 1;
36  
37 __END__
« ODS/Table.pm ↑ Summary ODS/Table/Column/Object.pm »