Oil/ed/Array.pm

filter: Statementstmt 90.0% 45 / 50 Branchbran 68.7% 11 / 16 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 83.3% 10 / 12 Podpod n/a totaltotal 80.7% 67 / 83 CC 10 SCAR 11.0
CC
10
Cov
83%
STORE
5.0
FETCH
4.2
CLEAR
3.3
CRAP 3.0
« Oil/ed.pm ↑ Summary Oil/ed/Scalar.pm »
1 ##############################################################################
2 package Acme::Oil::ed::Array;
3  
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use base qw(Tie::Array Acme::Oil::ed);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9  
10 3 ▶sub TIEARRAY {
Subroutine TIEARRAY: called CC=1 SCAR=0.0
11 3 my $class = shift;
12 3 my @array = @_;
13 3 my $self = {
14 value => [@array],
15 level => 80,
16 };
17 3 bless $self, $class;
18 }
19  
20  
21 25 ▶sub FETCH {
Subroutine FETCH: called CC=4 SCAR=14.3
22 25 my ($self,$index) = @_;
23  
24 25 ▶ if( $self->is_slipped(1, 1) ){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->is_slipped(1, 1)) 13 12 25
25 13 my $rand = rand($self->FETCHSIZE + 1);
26 13 ▶ carp "Can't be taken out well by your hand's slipping."
Branch: 1 branch
BranchTrueFalseTotal
if $rand ne $index and warnings::enabled("Acme::Oil") 13 0 13
Condition33%1/3
$rand ne $index and warnings::enabled("Acme::Oil")
!ll&&!rl&&r
0013
MC/DC0%0/2
$rand ne $index and warnings::enabled("Acme::Oil")
$rand ne $index warnings::enabled("Acme::Oil")
Truth table33%1/3
A and B
A= $rand ne $indexB= warnings::enabled("Acme::Oil")
ABresult
0X0
100
111
27 if($rand ne $index and warnings::enabled('Acme::Oil'));
28 13 return $self->{value}[$rand];
29 }
30  
31 12 $self->{value}[$index];
32 }
33  
34  
35 35 ▶sub STORE {
Subroutine STORE: called CC=5 SCAR=16.2
36 35 my ($self, $index, $value) = @_;
37  
38 35 ▶ if(Acme::Oil::_is_burning($value)){
Branch: 1 branch
BranchTrueFalseTotal
if (Acme::Oil::_is_burning($value)) 1 34 35
39 1 $self->ignition();
40 1 return;
41 }
42  
43 34 ▶ if( $self->is_slipped(0.3, 0.5) ){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->is_slipped("0.3", "0.5")) 2 32 34
44 2 ▶ carp "Can't be put well by your hand's slipping."
Branch: 1 branch
BranchTrueFalseTotal
if warnings::enabled("Acme::Oil") 2 0 2
45 if(warnings::enabled('Acme::Oil'));
46  
47 2 my $rand = rand($self->FETCHSIZE + 1);
48  
49 2 ▶ if( $rand < $self->FETCHSIZE ){
Branch: 1 branch
BranchTrueFalseTotal
if ($rand < $self->FETCHSIZE) 2 0 2
50 2 $self->{value}[$rand] = $value;
51 }
52  
53 2 return;
54 }
55  
56 32 $self->{value}[$index] = $value;
57 }
58  
59  
60 23 ▶sub FETCHSIZE {
Subroutine FETCHSIZE: called CC=1 SCAR=0.0
61 23 my $self = shift;
62 23 scalar @{ $self->{value} };
63 }
64  
65  
66 3 ▶sub STORESIZE {
Subroutine STORESIZE: called CC=1 SCAR=0.0
67 3 my $self = shift;
68 3 my $num = shift;
69 3 $#{ $self->{value} } = $num - 1;
70 }
71  
72 0 ▶sub EXISTS {
Subroutine EXISTS: not called CC=1 SCAR=6.9
73 0 my ($self, $index) = @_;
74 0 exsits $self->{value}[$index];
75 }
76  
77 0 ▶sub DELETE {
Subroutine DELETE: not called CC=1 SCAR=6.9
78 0 my ($self, $index) = @_;
79 0 delete $self->{value}[$index];
80 }
81  
82  
83 1 ▶sub CLEAR {
Subroutine CLEAR: called CC=3 SCAR=12.0
84 1 my $self = shift;
85  
86 1 ▶ if( $self->is_slipped(1, 1) ){
Branch: 1 branch
BranchTrueFalseTotal
if ($self->is_slipped(1, 1)) 1 0 1
87 1 ▶ carp "Can't be clear by your hand's slipping."
Branch: 1 branch
BranchTrueFalseTotal
if warnings::enabled("Acme::Oil") 1 0 1
88 if(warnings::enabled('Acme::Oil'));
89 1 return;
90 }
91  
92 0 $self->STORESIZE(0);
93 }
94  
95  
96  
97  
98  
99 1 1;
100 __END__
« Oil/ed.pm ↑ Summary Oil/ed/Scalar.pm »