Statistics/R/REXP/Raw.pm

filter: Statementstmt 96.8% 31 / 32 Branchbran 100% 6 / 6 Conditioncond 66.6% 4 / 6 MC/DCmcdc 50.0% 2 / 4 Subroutinesub 88.8% 8 / 9 Podpod 0.0% 0 / 2 totaltotal 86.4% 51 / 59 CC 6 SCAR 9.8
CC
6
Cov
93%
BUILD
5.1
_type
2.0
BUILDARGS
2.0
CRAP 2.7
« Statistics/R/REXP/Symbol.pm ↑ Summary Statistics/R/REXP/BaseEnvironment.pm »
1 package Statistics::R::REXP::Raw;
2 # ABSTRACT: an R raw vector
3 14 $Statistics::R::REXP::Raw::VERSION = '1.0002';
4 14 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 14 ▶use Scalar::Util qw(looks_like_number);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 14 ▶use Class::Tiny::Antlers;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 14 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 14 extends 'Statistics::R::REXP::Vector';
12 14 ▶use overload;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14  
15 14 ▶use constant sexptype => 'RAWSXP';
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 0 ▶sub _type { 'raw'; }
Subroutine _type: not called CC=1 SCAR=6.9
18  
19  
20 90 ▶sub BUILDARGS {
Subroutine BUILDARGS: called CC=2 SCAR=6.9
Pod undocumented
21 90 my $class = shift;
22 90 my $attributes = $class->SUPER::BUILDARGS(@_);
23  
24 89 ▶ if (ref($attributes->{elements}) eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $attributes->{"elements"} eq "ARRAY") 75 14 89
25 $attributes->{elements} = [
26 map int,
27 75 Statistics::R::REXP::Vector::_flatten(@{$attributes->{elements}})
28 ]
29 }
30 $attributes
31 89 }
32  
33  
34 87 ▶sub BUILD {
Subroutine BUILD: called CC=5 SCAR=16.2
Pod undocumented
35 87 my ($self, $args) = @_;
36  
37 # Required attribute type
38 87 ▶ die 'Raw vectors cannot have attributes' if defined $self->attributes;
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->attributes 1 86 87
39 die 'Elements of raw vectors must be 0-255' if defined $self->elements &&
40 86 ▶ grep { !($_ >= 0 && $_ <= 255) } @{$self->elements}
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->elements and grep {not $_ >= 0 && $_ <= 255;} @{$self->elements;} 1 85 86
Condition66%4/6
defined $self->elements and grep {not $_ >= 0 && $_ <= 255;} @{$self->elements;}
!ll&&!rl&&r
0851
$_ >= 0 && $_ <= 255
!ll&&!rl&&r
10264
MC/DC50%1/2
defined $self->elements and grep {not $_ >= 0 && $_ <= 255;} @{$self->elements;}
defined $self->elements grep {not $_ >= 0 && $_ <= 255;} @{$self->elements;}
MC/DC50%1/2
$_ >= 0 && $_ <= 255
$_ >= 0 $_ <= 255
Truth table66%2/3
A and B
A= defined $self->elementsB= grep {not $_ >= 0 && $_ <= 255;} @{$self->elements;}
ABresult
0X0
100
111
Truth table66%2/3
A && B
A= $_ >= 0B= $_ <= 255
ABresult
0X0
100
111
41 }
42  
43  
44 14 1; # End of Statistics::R::REXP::Raw
45  
46 __END__
« Statistics/R/REXP/Symbol.pm ↑ Summary Statistics/R/REXP/BaseEnvironment.pm »