Utils/Equal.pm

filter: Statementstmt 96.7% 30 / 31 Branchbran 33.3% 2 / 6 Conditioncond 44.4% 4 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 1 totaltotal 72.8% 43 / 59 CC 8 SCAR 19.9
CC
8
Cov
78%
process
12.1
BEGIN
1.0
BEGIN
1.0
CRAP 7.3
↑ Summary Utils/Substr.pm »
1 package Petal::Utils::Equal;
2  
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use warnings::register;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 4 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 4 ▶use base qw( Petal::Utils::Base );
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 4 ▶use constant name => 'equal';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 ▶use constant aliases => qw( eq );
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 4 our $VERSION = ((require Petal::Utils), $Petal::Utils::VERSION)[1];
14 4 our $REVISION = (split(/ /, ' $Revision: 1.3 $ '))[2];
15  
16 1 ▶sub process {
Subroutine process: called CC=8 SCAR=24.9
Pod undocumented
17 1 my $class = shift;
18 1 my $hash = shift;
19 1 ▶ my $args = shift || confess( "'equal' expects 2 variables (got nothing)!" );
Condition50%1/2
shift() || confess(q['equal' expects 2 variables (got nothing)!])
l!l
10
MC/DC0%0/1
shift() || confess(q['equal' expects 2 variables (got nothing)!])
shift()
Truth table50%1/2
A
A= shift()
Aresult
11
00
20  
21 1 my @args = $class->split_first_arg( $args );
22 1 ▶ my $arg1 = $args[0] || confess( "1st arg to 'equal' should be a variable (got nothing)!" );
Condition50%1/2
$args[0] || confess(q[1st arg to 'equal' should be a variable (got nothing)!])
l!l
10
MC/DC0%0/1
$args[0] || confess(q[1st arg to 'equal' should be a variable (got nothing)!])
$args[0]
Truth table50%1/2
A
A= $args[0]
Aresult
11
00
23 1 ▶ my $arg2 = $args[1] || confess( "2nd arg to 'equal' should be a variable (got nothing)!" );
Condition50%1/2
$args[1] || confess(q[2nd arg to 'equal' should be a variable (got nothing)!])
l!l
10
MC/DC0%0/1
$args[1] || confess(q[2nd arg to 'equal' should be a variable (got nothing)!])
$args[1]
Truth table50%1/2
A
A= $args[1]
Aresult
11
00
24  
25 1 my $h1 = $hash->fetch($arg1);
26 1 my $h2 = $hash->fetch($arg2);
27  
28 1 ▶ return $h1 == $h2 ? 1 : 0 if ($h1 =~ /\A\d+\z/ and $h2 =~ /\A\d+\z/);
Branch: 2 branches
BranchTrueFalseTotal
if $h1 =~ /\A\d+\z/ and $h2 =~ /\A\d+\z/ 1 0 1
$h1 == $h2 ? : 0 1 1
Condition33%1/3
$h1 =~ /\A\d+\z/ and $h2 =~ /\A\d+\z/
!ll&&!rl&&r
001
MC/DC0%0/2
$h1 =~ /\A\d+\z/ and $h2 =~ /\A\d+\z/
$h1 =~ /\A\d+\z/ $h2 =~ /\A\d+\z/
Truth table33%1/3
A and B
A= $h1 =~ /\A\d+\z/B= $h2 =~ /\A\d+\z/
ABresult
0X0
100
111
29 0 ▶ return $h1 eq $h2 ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$h1 eq $h2 ? : 0 0 0
30 }
31  
32 4 1;
↑ Summary Utils/Substr.pm »