PerlActor/Command.pm

filter: Statementstmt 75.5% 37 / 49 Branchbran 50.0% 2 / 4 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 84.6% 11 / 13 Podpod 0.0% 0 / 6 totaltotal 66.2% 51 / 77 CC 4 SCAR 6.7
CC
4
Cov
71%
executeScript
6.0
execute
2.1
getParams
2.0
CRAP 2.0
« run_tests.pl ↑ Summary PerlActor/Object.pm »
1 package PerlActor::Command;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use base 'PerlActor::Object';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use fields qw( params );
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Error;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use PerlActor::Exception::AssertionFailure;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use PerlActor::Exception::NotImplemented;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 #===============================================================================================
11 # Public Methods
12 #===============================================================================================
13  
14 sub new
15 20 ▶{
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
16 20 my $proto = shift;
17 20 my @params = @_;
18 20 my $self = $proto->SUPER::new(@_);
19 20 $self->{params} = \@params;
20 20 return $self;
21 }
22  
23 sub getParam
24 11 ▶{
Subroutine getParam: called CC=1 SCAR=0.0
Pod undocumented
25 11 my $self = shift;
26 11 my $paramNumber = shift;
27 11 return $self->{params}->[$paramNumber];
28 }
29  
30 sub getParams
31 0 ▶{
Subroutine getParams: not called CC=1 SCAR=6.9
Pod undocumented
32 0 my $self = shift;
33 0 return @{$self->{params}};
34 }
35  
36 sub execute
37 3 ▶{
Subroutine execute: called CC=2 SCAR=7.6
Pod undocumented
38 3 my $self = shift;
39 3 ▶ my $class = ref $self || $self;
Condition33%1/3
ref $self || $self
l!l&&r!l&&!r
300
MC/DC0%0/2
ref $self || $self
ref $self $self
Truth table33%1/3
A || B
A= ref $selfB= $self
ABresult
1X1
011
000
40 3 throw PerlActor::Exception::NotImplemented("command class '$class' does not implement execute()");
41 }
42  
43 sub executeScript
44 0 ▶{
Subroutine executeScript: not called CC=2 SCAR=17.9
Pod undocumented
45 0 my $self = shift;
46 0 my $file = shift;
47
48 0 ▶ open SCRIPT, "$file"
Branch: 1 branch
BranchTrueFalseTotal
open SCRIPT, "$file" or "PerlActor::Exception"->throw("cannot open test script file '${file}': $!\n") 0 0 0
49 or throw PerlActor::Exception("cannot open test script file '$file': $!\n");
50
51 0 my @lines = <SCRIPT>;
52 0 my $script = new PerlActor::Script("$file");
53 0 $script->setListener($self->getListener());
54 0 $script->setLines(@lines);
55 0 $script->execute();
56 0 close SCRIPT;
57 }
58  
59 sub assert
60 3 ▶{
Subroutine assert: called CC=2 SCAR=6.9
Pod undocumented
61 3 my $self = shift;
62 3 my $condition = shift;
63 3 my $message = shift;
64 3 ▶ throw PerlActor::Exception::AssertionFailure($message)
Branch: 1 branch
BranchTrueFalseTotal
unless $condition 2 1 3
65 unless $condition;
66 }
67  
68 #===============================================================================================
69 # Protected Methods - Don't even think about calling these from outside the class.
70 #===============================================================================================
71  
72 # Keep Perl happy.
73 1 1;
« run_tests.pl ↑ Summary PerlActor/Object.pm »