Path.pm

filter: Statementstmt 85.7% 36 / 42 Branchbran 77.7% 14 / 18 Conditioncond 58.3% 7 / 12 MC/DCmcdc 37.5% 3 / 8 Subroutinesub 100% 3 / 3 Podpod 0.0% 0 / 1 totaltotal 75.0% 63 / 84 CC 15 SCAR 27.7
CC
15
Cov
79%
path2list
17.9
BEGIN
1.0
BEGIN
1.0
CRAP 15.9
« Graph.pm ↑ Summary Parser.pm »
1 # Path.pm
2 # author 'Rolf Veen'
3 # license zlib
4 # date 20030609
5  
6 package OGDL::Path;
7  
8 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 2 our $VERSION = '0.01';
12  
13 # takes a string and returns a list
14 # with the path elements
15 sub path2list
16 19 ▶{
Subroutine path2list: called CC=15 SCAR=28.8
Pod undocumented
17 19 my @l;
18 19 my $s = $_[0];
19 19 my $len = length($s);
20 19 my $state = 0;
21 19 my $ix = 0;
22 19 my $i=0;
23 19 my $j=0;
24 19 my $n=0;
25
26 19 foreach my $c (split //, $s) {
27
28 205 ▶ if ($state == 0) {
Branch: 4 branches
BranchTrueFalseTotal
if ($state == 0) { } 193 12 205
elsif ($state == 1 and $c eq '"') { } 0 12 12
elsif ($state == 2 and $c eq q[']) { } 0 12 12
elsif ($state == 3 and $c eq ']') { } 7 5 12
29 193 ▶ if ( $c eq "." ) {
Branch: 4 branches
BranchTrueFalseTotal
if ($c eq '.') { } 35 158 193
elsif ($c eq '"') { } 0 158 158
elsif ($c eq q[']) { } 0 158 158
elsif ($c eq '[' and $n > 0) { } 7 151 158
30 35 ▶ if ($n != 0) { $l[$ix++] = substr($s,$j,$i-$j); }
Branch: 1 branch
BranchTrueFalseTotal
if ($n != 0) 28 7 35
31 35 $l[$ix++] = ".";
32 35 $j = $i+1;
33 35 $n = 0;
34 }
35 elsif ( $c eq "\"") {
36 0 $state = 1;
37 }
38 elsif ( $c eq "'") {
39 0 $state = 2;
40 }
41 ▶ elsif ( ($c eq "[") && ($n > 0)) {
Condition100%3/3
$c eq "[" and $n > 0
!ll&&!rl&&r
132197
MC/DC100%2/2
$c eq "[" and $n > 0
$c eq "[" $n > 0
Truth table100%3/3
A and B
A= $c eq "["B= $n > 0
ABresult
0X0
100
111
42 7 $l[$ix++] = substr($s,$j,$i-$j);
43 7 $j = $i;
44 7 $state = 3;
45 7 $n = 0;
46 }
47 151 else { $n++; }
48 }
49 ▶ elsif ( ($state == 1) && ($c eq '"')) {
Condition33%1/3
$state == 1 and $c eq "\""
!ll&&!rl&&r
1200
MC/DC0%0/2
$state == 1 and $c eq "\""
$state == 1 $c eq "\""
Truth table33%1/3
A and B
A= $state == 1B= $c eq "\""
ABresult
0X0
100
111
50 0 $state = 0;
51 0 $n++;
52 }
53 ▶ elsif ( ($state == 2) && ($c eq '\'')) {
Condition33%1/3
$state == 2 and $c eq "'"
!ll&&!rl&&r
1200
MC/DC0%0/2
$state == 2 and $c eq "'"
$state == 2 $c eq "'"
Truth table33%1/3
A and B
A= $state == 2B= $c eq "'"
ABresult
0X0
100
111
54 0 $state = 0;
55 0 $n++;
56 }
57 ▶ elsif ( ($state == 3) && ($c eq ']') ) {
Condition66%2/3
$state == 3 and $c eq "]"
!ll&&!rl&&r
057
MC/DC50%1/2
$state == 3 and $c eq "]"
$state == 3 $c eq "]"
Truth table66%2/3
A and B
A= $state == 3B= $c eq "]"
ABresult
0X0
100
111
58 7 $l[$ix++] = substr($s,$j,$i-$j+1);
59 7 $j = $i+1;
60 7 $state = 0;
61 7 $n = 0;
62 }
63 205 $i++;
64 }
65 19 $l[$ix++] = substr($s,$j,$i-$j);
66  
67 19 return @l;
68 }
69 2 1;
70 __END__
« Graph.pm ↑ Summary Parser.pm »