lib/Traveller/System/Classic/MPTS.pm

filter: Statementstmt 18.1% 4 / 22 Branchbran 0.0% 0 / 30 Conditioncond 0.0% 0 / 63 MC/DCmcdc 0.0% 0 / 31 Subroutinesub 50.0% 1 / 2 Podpod 0.0% 0 / 1 totaltotal 3.3% 5 / 149 CC 37 SCAR 72.2
CC
37
Cov
3%
compute_tradecodes
1406.0
BEGIN
1.0
CRAP 1369.0
↑ Summary lib/Traveller/Mapper/Classic.pm »
1 #!/usr/bin/perl
2 # Copyright (C) 2009-2021 Alex Schroeder <alex@gnu.org>
3 # Copyright (C) 2020 Christian Carey
4 #
5 # This program is free software: you can redistribute it and/or modify it under
6 # the terms of the GNU General Public License as published by the Free Software
7 # Foundation, either version 3 of the License, or (at your option) any later
8 # version.
9 #
10 # This program is distributed in the hope that it will be useful, but WITHOUT
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License along with
15 # this program. If not, see <http://www.gnu.org/licenses/>.
16  
17 package Traveller::System::Classic::MPTS;
18 2 ▶use Mojo::Base 'Traveller::System::Classic';
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 0 ▶sub compute_tradecodes {
Subroutine compute_tradecodes: not called CC=37 SCAR=72.5
Pod undocumented
21 0 my $self = shift;
22 0 my $tradecodes = '';
23 0 ▶ $tradecodes .= ' Ag' if $self->atmosphere >= 4 and $self->atmosphere <= 9
Branch: 1 branch
BranchTrueFalseTotal
if $self->atmosphere >= 4 and $self->atmosphere <= 9 and $self->hydro >= 4 and $self->hydro <= 8 and $self->population >= 5 and $self->population <= 7 0 0 0
Condition0%0/15
$self->atmosphere >= 4 and $self->atmosphere <= 9 and $self->hydro >= 4 and $self->hydro <= 8 and $self->population >= 5 and $self->population <= 7
!ll&&!rl&&r
000
$self->atmosphere >= 4 and $self->atmosphere <= 9 and $self->hydro >= 4 and $self->hydro <= 8 and $self->population >= 5
!ll&&!rl&&r
000
$self->atmosphere >= 4 and $self->atmosphere <= 9 and $self->hydro >= 4 and $self->hydro <= 8
!ll&&!rl&&r
000
$self->atmosphere >= 4 and $self->atmosphere <= 9 and $self->hydro >= 4
!ll&&!rl&&r
000
$self->atmosphere >= 4 and $self->atmosphere <= 9
!ll&&!rl&&r
000
MC/DC0%0/6
$self->atmosphere >= 4 and $self->atmosphere <= 9 and $self->hydro >= 4 and $self->hydro <= 8 and $self->population >= 5 and $self->population <= 7
$self->atmosphere >= 4 $self->atmosphere <= 9 $self->hydro >= 4 $self->hydro <= 8 $self->population >= 5 $self->population <= 7
Truth table0%0/7
A and B and C and D and E and F
A= $self->atmosphere >= 4B= $self->atmosphere <= 9C= $self->hydro >= 4D= $self->hydro <= 8E= $self->population >= 5F= $self->population <= 7
ABCDEFresult
0XXXXX0
10XXXX0
110XXX0
1110XX0
11110X0
1111100
1111111
24 and $self->hydro >= 4 and $self->hydro <= 8
25 and $self->population >= 5 and $self->population <= 7;
26 0 ▶ $tradecodes .= ' As' if $self->size == 0
Branch: 1 branch
BranchTrueFalseTotal
if $self->size == 0 and $self->atmosphere == 0 and $self->hydro == 0 0 0 0
Condition0%0/6
$self->size == 0 and $self->atmosphere == 0 and $self->hydro == 0
!ll&&!rl&&r
000
$self->size == 0 and $self->atmosphere == 0
!ll&&!rl&&r
000
MC/DC0%0/3
$self->size == 0 and $self->atmosphere == 0 and $self->hydro == 0
$self->size == 0 $self->atmosphere == 0 $self->hydro == 0
Truth table0%0/4
A and B and C
A= $self->size == 0B= $self->atmosphere == 0C= $self->hydro == 0
ABCresult
0XX0
10X0
1100
1111
27 and $self->atmosphere == 0
28 and $self->hydro == 0;
29 0 ▶ $tradecodes .= ' Ba' if $self->population == 0
Branch: 1 branch
BranchTrueFalseTotal
if $self->population == 0 and $self->government == 0 and $self->law == 0 0 0 0
Condition0%0/6
$self->population == 0 and $self->government == 0 and $self->law == 0
!ll&&!rl&&r
000
$self->population == 0 and $self->government == 0
!ll&&!rl&&r
000
MC/DC0%0/3
$self->population == 0 and $self->government == 0 and $self->law == 0
$self->population == 0 $self->government == 0 $self->law == 0
Truth table0%0/4
A and B and C
A= $self->population == 0B= $self->government == 0C= $self->law == 0
ABCresult
0XX0
10X0
1100
1111
30 and $self->government == 0
31 and $self->law == 0;
32 0 ▶ $tradecodes .= ' De' if $self->atmosphere >= 2 and $self->hydro == 0;
Branch: 1 branch
BranchTrueFalseTotal
if $self->atmosphere >= 2 and $self->hydro == 0 0 0 0
Condition0%0/3
$self->atmosphere >= 2 and $self->hydro == 0
!ll&&!rl&&r
000
MC/DC0%0/2
$self->atmosphere >= 2 and $self->hydro == 0
$self->atmosphere >= 2 $self->hydro == 0
Truth table0%0/3
A and B
A= $self->atmosphere >= 2B= $self->hydro == 0
ABresult
0X0
100
111
33 0 ▶ $tradecodes .= ' Fl' if $self->atmosphere =~ /^[ABC]$/ # erratum
Branch: 1 branch
BranchTrueFalseTotal
if $self->atmosphere =~ /^[ABC]$/u and $self->hydro >= 1 0 0 0
Condition0%0/3
$self->atmosphere =~ /^[ABC]$/u and $self->hydro >= 1
!ll&&!rl&&r
000
MC/DC0%0/2
$self->atmosphere =~ /^[ABC]$/u and $self->hydro >= 1
$self->atmosphere =~ /^[ABC]$/u $self->hydro >= 1
Truth table0%0/3
A and B
A= $self->atmosphere =~ /^[ABC]$/uB= $self->hydro >= 1
ABresult
0X0
100
111
34 and $self->hydro >= 1;
35 0 ▶ $tradecodes .= ' Hi' if $self->population >= 9;
Branch: 1 branch
BranchTrueFalseTotal
if $self->population >= 9 0 0 0
36 0 ▶ $tradecodes .= ' Ic' if $self->atmosphere <= 1 and $self->hydro >= 1;
Branch: 1 branch
BranchTrueFalseTotal
if $self->atmosphere <= 1 and $self->hydro >= 1 0 0 0
Condition0%0/3
$self->atmosphere <= 1 and $self->hydro >= 1
!ll&&!rl&&r
000
MC/DC0%0/2
$self->atmosphere <= 1 and $self->hydro >= 1
$self->atmosphere <= 1 $self->hydro >= 1
Truth table0%0/3
A and B
A= $self->atmosphere <= 1B= $self->hydro >= 1
ABresult
0X0
100
111
37 0 ▶ $tradecodes .= ' In' if $self->atmosphere =~ /^[012479]$/ and $self->population >= 9;
Branch: 1 branch
BranchTrueFalseTotal
if $self->atmosphere =~ /^[012479]$/u and $self->population >= 9 0 0 0
Condition0%0/3
$self->atmosphere =~ /^[012479]$/u and $self->population >= 9
!ll&&!rl&&r
000
MC/DC0%0/2
$self->atmosphere =~ /^[012479]$/u and $self->population >= 9
$self->atmosphere =~ /^[012479]$/u $self->population >= 9
Truth table0%0/3
A and B
A= $self->atmosphere =~ /^[012479]$/uB= $self->population >= 9
ABresult
0X0
100
111
38 0 ▶ $tradecodes .= ' Lo' if $self->population <= 3;
Branch: 1 branch
BranchTrueFalseTotal
if $self->population <= 3 0 0 0
39 0 ▶ $tradecodes .= ' Na' if $self->atmosphere <= 3 and $self->hydro <= 3
Branch: 1 branch
BranchTrueFalseTotal
if $self->atmosphere <= 3 and $self->hydro <= 3 and $self->population >= 6 0 0 0
Condition0%0/6
$self->atmosphere <= 3 and $self->hydro <= 3 and $self->population >= 6
!ll&&!rl&&r
000
$self->atmosphere <= 3 and $self->hydro <= 3
!ll&&!rl&&r
000
MC/DC0%0/3
$self->atmosphere <= 3 and $self->hydro <= 3 and $self->population >= 6
$self->atmosphere <= 3 $self->hydro <= 3 $self->population >= 6
Truth table0%0/4
A and B and C
A= $self->atmosphere <= 3B= $self->hydro <= 3C= $self->population >= 6
ABCresult
0XX0
10X0
1100
1111
40 and $self->population >= 6;
41 0 ▶ $tradecodes .= ' Ni' if $self->population <= 6;
Branch: 1 branch
BranchTrueFalseTotal
if $self->population <= 6 0 0 0
42 0 ▶ $tradecodes .= ' Po' if $self->atmosphere >= 2 and $self->atmosphere <= 5
Branch: 1 branch
BranchTrueFalseTotal
if $self->atmosphere >= 2 and $self->atmosphere <= 5 and $self->hydro <= 3 0 0 0
Condition0%0/6
$self->atmosphere >= 2 and $self->atmosphere <= 5 and $self->hydro <= 3
!ll&&!rl&&r
000
$self->atmosphere >= 2 and $self->atmosphere <= 5
!ll&&!rl&&r
000
MC/DC0%0/3
$self->atmosphere >= 2 and $self->atmosphere <= 5 and $self->hydro <= 3
$self->atmosphere >= 2 $self->atmosphere <= 5 $self->hydro <= 3
Truth table0%0/4
A and B and C
A= $self->atmosphere >= 2B= $self->atmosphere <= 5C= $self->hydro <= 3
ABCresult
0XX0
10X0
1100
1111
43 and $self->hydro <= 3;
44 0 ▶ $tradecodes .= ' Ri' if $self->atmosphere =~ /^[68]$/
Branch: 1 branch
BranchTrueFalseTotal
if $self->atmosphere =~ /^[68]$/u and $self->population >= 6 and $self->population <= 8 and $self->government >= 4 and $self->government <= 9 0 0 0
Condition0%0/12
$self->atmosphere =~ /^[68]$/u and $self->population >= 6 and $self->population <= 8 and $self->government >= 4 and $self->government <= 9
!ll&&!rl&&r
000
$self->atmosphere =~ /^[68]$/u and $self->population >= 6 and $self->population <= 8 and $self->government >= 4
!ll&&!rl&&r
000
$self->atmosphere =~ /^[68]$/u and $self->population >= 6 and $self->population <= 8
!ll&&!rl&&r
000
$self->atmosphere =~ /^[68]$/u and $self->population >= 6
!ll&&!rl&&r
000
MC/DC0%0/5
$self->atmosphere =~ /^[68]$/u and $self->population >= 6 and $self->population <= 8 and $self->government >= 4 and $self->government <= 9
$self->atmosphere =~ /^[68]$/u $self->population >= 6 $self->population <= 8 $self->government >= 4 $self->government <= 9
Truth table0%0/6
A and B and C and D and E
A= $self->atmosphere =~ /^[68]$/uB= $self->population >= 6C= $self->population <= 8D= $self->government >= 4E= $self->government <= 9
ABCDEresult
0XXXX0
10XXX0
110XX0
1110X0
111100
111111
45 and $self->population >= 6 and $self->population <= 8
46 and $self->government >= 4 and $self->government <= 9;
47 0 ▶ $tradecodes .= ' Va' if $self->atmosphere == 0;
Branch: 1 branch
BranchTrueFalseTotal
if $self->atmosphere == 0 0 0 0
48 0 ▶ $tradecodes .= ' Wa' if $self->hydro == 10;
Branch: 1 branch
BranchTrueFalseTotal
if $self->hydro == 10 0 0 0
49 0 return $tradecodes;
50 }
51  
52 2 1;
↑ Summary lib/Traveller/Mapper/Classic.pm »