factor.pm

filter: Statementstmt 82.6% 19 / 23 Branchbran n/a Conditioncond 60.0% 6 / 10 MC/DCmcdc 16.6% 1 / 6 Subroutinesub 71.4% 5 / 7 Podpod n/a totaltotal 67.3% 31 / 46 CC 5 SCAR 11.4
CC
5
Cov
76%
new
5.3
numerator
2.0
denominator
2.0
CRAP 3.1
↑ Summary unitConverter.pm »
1 package Factor;
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 38 ▶sub new {
Subroutine new: called CC=5 SCAR=16.6
7 38 my ( $class, $unit, $numerator, $denominator ) = @_;
8 38 ▶ $class = ref($class) || $class;
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
0380
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
9 38 my $this = {};
10 38 bless($this, $class);
11 38 ▶ $this->{DIM} = $unit ||= $this;
Condition66%2/3
$unit ||= $this
l!l&&r!l&&!r
9290
MC/DC0%0/2
$unit ||= $this
$unit $this
Truth table66%2/3
A ||= B
A= $unitB= $this
ABresult
1X1
011
000
12 38 ▶ $this->{NUMERATOR} = $numerator ||= 1.;
Condition100%2/2
$numerator ||= 1
l!l
929
MC/DC100%1/1
$numerator ||= 1
$numerator
Truth table100%2/2
A
A= $numerator
Aresult
11
00
13 38 ▶ $this->{DENOMINATOR} = $denominator ||= 1;
Condition50%1/2
$denominator ||= 1
l!l
038
MC/DC0%0/1
$denominator ||= 1
$denominator
Truth table50%1/2
A
A= $denominator
Aresult
11
00
14 38 return $this;
15 }
16  
17 18 ▶sub dim {
Subroutine dim: called CC=1 SCAR=0.0
18 18 my $this = shift;
19 18 return $this->{DIM};
20 }
21  
22 0 ▶sub numerator {
Subroutine numerator: not called CC=1 SCAR=6.9
23 0 my $this = shift;
24 0 return $this->{NUMERATOR};
25 }
26  
27 0 ▶sub denominator {
Subroutine denominator: not called CC=1 SCAR=6.9
28 0 my $this = shift;
29 0 return $this->{DENOMINATOR};
30 }
31  
32 18 ▶sub power {
Subroutine power: called CC=1 SCAR=0.0
33 18 my $this = shift;
34 18 return $this->{NUMERATOR} / $this->{DENOMINATOR};
35 }
36  
37 =head1 NAME
38  
39 Factor - representation of a power of units
40  
41 =head1 DESCRIPTION
42  
43 This module maps a conceptual class that represents a power of unit of measurement.
44  
45 =head1 AUTHOR
46  
47 Samuel Andres
48  
49 =head1 LICENSE
50  
51 UnLicense
52  
53 =cut
54  
55 1 1;
↑ Summary unitConverter.pm »