Tangerine/hook/if.pm

filter: Statementstmt 100% 36 / 36 Branchbran 85.7% 12 / 14 Conditioncond 62.0% 18 / 29 MC/DCmcdc 35.7% 5 / 14 Subroutinesub 100% 8 / 8 Podpod 100% 1 / 1 totaltotal 78.4% 80 / 102 CC 18 SCAR 27.5
CC
18
Cov
84%
run
21.3
BEGIN
1.0
BEGIN
1.0
CRAP 15.6
« Tangerine.pm ↑ Summary Tangerine/hook/list.pm »
1 package Tangerine::hook::if;
2 16 $Tangerine::hook::if::VERSION = '0.23';
3 16 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 16 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 16 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 16 ▶use parent 'Tangerine::Hook';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 16 ▶use Tangerine::HookData;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 16 ▶use Tangerine::Utils qw(any stripquotelike $vre);
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10  
11 142 ▶sub run {
Subroutine run: called CC=18 SCAR=30.6
Pod documented
12 142 my ($self, $s) = @_;
13 142 ▶ if ((any { $s->[0] eq $_ } qw(use no)) &&
Subroutine __ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
if (&any(sub { $s->[0] eq $_; } , "use", "no") and scalar @$s > 3 and $s->[1] eq "if") 5 137 142
Condition100%6/6
&any(sub { $s->[0] eq $_; } , "use", "no") and scalar @$s > 3 and $s->[1] eq "if"
!ll&&!rl&&r
85525
&any(sub { $s->[0] eq $_; } , "use", "no") and scalar @$s > 3
!ll&&!rl&&r
572857
MC/DC100%3/3
&any(sub { $s->[0] eq $_; } , "use", "no") and scalar @$s > 3 and $s->[1] eq "if"
&any(sub { $s->[0] eq $_; } , "use", "no") scalar @$s > 3 $s->[1] eq "if"
Truth table100%4/4
A and B and C
A= &any(sub { $s->[0] eq $_; } , "use", "no")B= scalar @$s > 3C= $s->[1] eq "if"
ABCresult
0XX0
10X0
1100
1111
14 scalar(@$s) > 3 && $s->[1] eq 'if') {
15 5 my ($version) = $s->[2] =~ $vre;
16 5 ▶ $version //= '';
Condition100%2/2
$version //= ""
l!l
14
MC/DC100%1/1
$version //= ""
$version
Truth table100%2/2
A
A= $version
Aresult
11
00
17 5 ▶ my $voffset = $version ? 3 : 2;
Branch: 1 branch
BranchTrueFalseTotal
$version ? : 1 4 5
18 5 my ($depth, $index) = (0, 0);
19 5 ▶ for ($index = $voffset; $index < $#$s; $index++) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index < $s->$#*) 11 1 12
20 11 my $token = $s->[$index];
21 11 ▶ $depth++ if ($token eq '[' || $token eq '{' || $token eq '(');
Branch: 1 branch
BranchTrueFalseTotal
if $token eq "[" or $token eq "{" or $token eq "(" 0 11 11
Condition33%2/6
$token eq "[" or $token eq "{" or $token eq "("
l!l&&r!l&&!r
0011
$token eq "[" or $token eq "{"
l!l&&r!l&&!r
0011
MC/DC0%0/3
$token eq "[" or $token eq "{" or $token eq "("
$token eq "[" $token eq "{" $token eq "("
Truth table25%1/4
A or B or C
A= $token eq "["B= $token eq "{"C= $token eq "("
ABCresult
1XX1
01X1
0011
0000
22 11 ▶ $depth-- if ($token eq ']' || $token eq '}' || $token eq ')');
Branch: 1 branch
BranchTrueFalseTotal
if $token eq "]" or $token eq "}" or $token eq ")" 0 11 11
Condition33%2/6
$token eq "]" or $token eq "}" or $token eq ")"
l!l&&r!l&&!r
0011
$token eq "]" or $token eq "}"
l!l&&r!l&&!r
0011
MC/DC0%0/3
$token eq "]" or $token eq "}" or $token eq ")"
$token eq "]" $token eq "}" $token eq ")"
Truth table25%1/4
A or B or C
A= $token eq "]"B= $token eq "}"C= $token eq ")"
ABCresult
1XX1
01X1
0011
0000
23 11 ▶ last if ($token eq ';' || !$depth &&
Branch: 1 branch
BranchTrueFalseTotal
if $token eq ";" or not $depth and $token eq "," || $token eq "=>" 4 7 11
Condition66%6/9
$token eq ";" or not $depth and $token eq "," || $token eq "=>"
l!l&&r!l&&!r
047
not $depth and $token eq "," || $token eq "=>"
!ll&&!rl&&r
074
$token eq "," or $token eq "=>"
l!l&&r!l&&!r
407
MC/DC25%1/4
$token eq ";" or not $depth and $token eq "," || $token eq "=>"
$token eq ";" not $depth $token eq "," $token eq "=>"
Truth table40%2/5
A or not(B) and C or D
A= $token eq ";"B= not $depthC= $token eq ","D= $token eq "=>"
ABCDresult
1XXX1
011X1
01011
00XX0
01000
24 ($token eq ',' || $token eq '=>'));
25 }
26 5 $index++;
27 5 ▶ if ($s->[$index]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($s->[$index]) 4 1 5
28 4 $s->[$index] = stripquotelike($s->[$index]);
29 4 return Tangerine::HookData->new(
30 children => [ $s->[0], @$s[$index..$#$s] ],
31 );
32 }
33 }
34 138 return;
35 }
36  
37 16 1;
38  
39 __END__
« Tangerine.pm ↑ Summary Tangerine/hook/list.pm »