PDL/Role/Stringifiable.pm

filter: Statementstmt 93.7% 30 / 32 Branchbran 75.0% 6 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod 0.0% 0 / 4 totaltotal 82.3% 42 / 51 CC 6 SCAR 9.6
CC
6
Cov
90%
string
4.0
string1d
3.0
string2d
2.0
CRAP 2.6
« PDL/SV.pm ↑ Summary PDL/Logical.pm »
1 package PDL::Role::Stringifiable;
2 19 $PDL::Role::Stringifiable::VERSION = '0.006005';
3 19 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 19 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 19 ▶use Role::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 19 requires 'element_stringify';
8 19 requires 'element_stringify_max_width';
9  
10 170 ▶sub element_stringify {
Subroutine element_stringify: called CC=1 SCAR=0.0
Pod undocumented
11 170 my($self, $element) = @_;
12 170 "$element";
13 }
14  
15 207 ▶sub string {
Subroutine string: called CC=4 SCAR=14.0
Pod undocumented
16 # TODO
17 207 my ($self) = @_;
18  
19 207 ▶ if ($self->nelem > $PDL::toolongtoprint) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->nelem > $PDL::toolongtoprint) 1 206 207
20 1 return "TOO LONG TO PRINT";
21 }
22  
23 206 my $ndims = $self->ndims;
24 206 ▶ if( $ndims == 0 ) {
Branch: 2 branches
BranchTrueFalseTotal
if ($ndims == 0) { } 200 6 206
elsif ($ndims == 1) { } 6 0 6
25 200 return $self->element_stringify( $self->at() );
26 }
27 elsif( $ndims == 1 ) {
28 6 return $self->string1d;
29 }
30 # TODO string2d, stringNd
31 ...
32 0 }
33  
34 6 ▶sub string1d {
Subroutine string1d: called CC=3 SCAR=11.0
Pod undocumented
35 6 my ($self) = @_;
36 6 my $str = "[";
37  
38 6 for my $w (0..$self->nelem-1) {
39 18 $str .= " ";
40 18 $str .= $self->element_stringify( $self->at($w) );
41 }
42 6 ▶ $str .= " " if ($self->nelem > 0);
Branch: 1 branch
BranchTrueFalseTotal
if $self->nelem > 0 6 0 6
43 6 $str .= "]";
44 6 $str;
45 }
46  
47 0 ▶sub string2d {
Subroutine string2d: not called CC=1 SCAR=6.9
Pod undocumented
48 ...
49 0 }
50  
51  
52 19 1;
53  
54 __END__
« PDL/SV.pm ↑ Summary PDL/Logical.pm »