Statistics/R/REXP/List.pm

filter: Statementstmt 97.6% 42 / 43 Branchbran 90.0% 9 / 10 Conditioncond 66.6% 4 / 6 MC/DCmcdc 50.0% 2 / 4 Subroutinesub 100% 10 / 10 Podpod 100% 1 / 1 totaltotal 91.8% 68 / 74 CC 8 SCAR 11.5
CC
8
Cov
93%
to_pl
6.1
__ANON__
3.0
BEGIN
1.0
CRAP 3.2
« Statistics/R/REXP/Integer.pm ↑ Summary Statistics/R/IO/Parser.pm »
1 package Statistics::R::REXP::List;
2 # ABSTRACT: an R generic vector (list)
3 24 $Statistics::R::REXP::List::VERSION = '1.0002';
4 24 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 24 ▶use Scalar::Util qw(blessed weaken);
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 24 ▶use Class::Tiny::Antlers;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 24 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 24 extends 'Statistics::R::REXP::Vector';
12 24 ▶use overload;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14  
15 24 ▶use constant sexptype => 'VECSXP';
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 151 ▶sub _to_s {
Subroutine _to_s: called CC=1 SCAR=0.0
18 151 my $self = shift;
19
20 151 my ($u, $unfold);
21 166 ▶ $u = $unfold = sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
22 166 join(', ', map { ref $_ eq ref [] ?
23 392 ▶ '[' . &$unfold(@{$_}) . ']' :
Branch: 2 branches
BranchTrueFalseTotal
ref $_ eq ref [] ? : 15 377 392
defined $_ ? : 368 9 377
24 (defined $_? $_ : 'undef') } @_);
25 151 };
26 151 weaken $unfold;
27 151 $self->_type . '(' . &$unfold(@{$self->elements}) . ')';
28 }
29  
30  
31 6 ▶sub to_pl {
Subroutine to_pl: called CC=6 SCAR=18.2
Pod documented
32 6 my $self = shift;
33 [ map {
34 16 ▶ if (blessed $_ && $_->can('to_pl')) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($_) and $_->can('to_pl')) { } 6 10 16
Condition66%2/3
builtin::blessed($_) and $_->can("to_pl")
!ll&&!rl&&r
1006
MC/DC50%1/2
builtin::blessed($_) and $_->can("to_pl")
builtin::blessed($_) $_->can("to_pl")
Truth table66%2/3
A and B
A= builtin::blessed($_)B= $_->can("to_pl")
ABresult
0X0
100
111
35 6 my $x = $_->to_pl;
36 6 ▶ if (ref $x eq ref []) {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $x eq ref []) { } 6 0 6
37 6 ▶ unless (scalar @{$x} > 1 ||
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @{$x;} > 1 or $_->isa('Statistics::R::REXP::List')) { } 2 4 6
Condition66%2/3
scalar @{$x;} > 1 or $_->isa("Statistics::R::REXP::List")
l!l&&r!l&&!r
204
MC/DC50%1/2
scalar @{$x;} > 1 or $_->isa("Statistics::R::REXP::List")
scalar @{$x;} > 1 $_->isa("Statistics::R::REXP::List")
Truth table66%2/3
A or B
A= scalar @{$x;} > 1B= $_->isa("Statistics::R::REXP::List")
ABresult
1X1
011
000
38 $_->isa('Statistics::R::REXP::List')) {
39 4 @{$x}
40 } else {
41 2 $x
42 }
43 } else {
44 0 $x
45 }
46 } else {
47 10 $_
48 }
49 6 } @{$self->elements} ]
50 }
51  
52  
53 122 ▶sub _type { 'list'; }
Subroutine _type: called CC=1 SCAR=0.0
54  
55  
56 24 1; # End of Statistics::R::REXP::List
57  
58 __END__
« Statistics/R/REXP/Integer.pm ↑ Summary Statistics/R/IO/Parser.pm »