transformedUnit.pm

filter: Statementstmt 100% 29 / 29 Branchbran n/a Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 9 / 9 Podpod n/a totaltotal 90.7% 39 / 43 CC 2 SCAR 1.9
CC
2
Cov
94%
new
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« unit.pm ↑ Summary blib/lib/Cosmoloj/unitSimple.pm »
1 package TransformedUnit;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use unitConverter;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use unit;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 # heritage
10 1 ▶use base qw( Unit );
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 12 ▶sub new {
Subroutine new: called CC=2 SCAR=7.1
13 12 my ( $class, $toReference, $reference ) = @_;
14 12 ▶ $class = ref($class) || $class;
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
0120
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
15 12 my $this = $class->SUPER::new();
16 12 bless($this, $class);
17 12 $this->{TO_REFERENCE} = $toReference;
18 12 $this->{REFERENCE} = $reference;
19 12 return $this;
20 }
21  
22 14 ▶sub toReference {
Subroutine toReference: called CC=1 SCAR=0.0
23 14 my $this = shift;
24 14 return $this->{TO_REFERENCE};
25 }
26  
27 14 ▶sub reference {
Subroutine reference: called CC=1 SCAR=0.0
28 14 my $this = shift;
29 14 return $this->{REFERENCE};
30 }
31  
32 14 ▶sub toBase {
Subroutine toBase: called CC=1 SCAR=0.0
33 14 my $this = shift;
34 14 return $this->reference->toBase->concatenate($this->toReference);
35 }
36  
37 =head1 NAME
38  
39 TransformedUnit - representation of an unit based on a referenced unit and an unit conversion
40  
41 =head1 DESCRIPTION
42  
43 This module maps a conceptual class that represents an unit based on a referenced unit and an unit conversion.
44  
45 =head1 AUTHOR
46  
47 Samuel Andres
48  
49 =head1 LICENSE
50  
51 UnLicense
52  
53 =cut
54  
55 1 1;
« unit.pm ↑ Summary blib/lib/Cosmoloj/unitSimple.pm »