test-lib/Car/AbstractFactory.pm

filter: Statementstmt 88.0% 22 / 25 Branchbran 50.0% 2 / 4 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 1 totaltotal 79.4% 31 / 39 CC 3 SCAR 6.4
CC
3
Cov
81%
__ANON__
3.3
BEGIN
1.1
BEGIN
1.0
CRAP 1.9
« test-lib/Car/Fiat.pm ↑ Summary test-lib/Car/Mercedes.pm »
1 package Car::AbstractFactory;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 3 ▶use Class::Interface;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 3 abstract;
7  
8 0 ▶eval qq|
Subroutine BEGIN: called CC=1 SCAR=1.2
9 use Class::AccessorMaker {
10 createdCars => [],
11 };
12 |;
13  
14 3 ▶if ( $@ ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 3 0 3
15 3 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
16 3 ▶ *{ __PACKAGE__ . "::createdCars" } = sub {
Subroutine __ANON__: called CC=3 SCAR=12.0
17 1 my ( $self, $what ) = @_;
18  
19 1 ▶ if ( defined $what ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $what) 0 1 1
20 0 $self->{$what} = $what;
21 }
22  
23 1 ▶ return $self->{$what} || [];
Condition50%1/2
$self->{$what} || []
l!l
01
MC/DC0%0/1
$self->{$what} || []
$self->{$what}
Truth table50%1/2
A
A= $self->{$what}
Aresult
11
00
24 3 };
25 }
26  
27 sub createCar; # this is the abstract method
28  
29 1 ▶sub rememberCreatedCar {
Subroutine rememberCreatedCar: called CC=1 SCAR=0.0
Pod undocumented
30 1 my ( $self, $car ) = @_;
31  
32 1 push @{$self->createdCars}, $car;
33 }
34  
35 3 1;
« test-lib/Car/Fiat.pm ↑ Summary test-lib/Car/Mercedes.pm »