lib/BalanceOfPower/Relations/TradeRoute.pm

filter: Statementstmt 37.1% 13 / 35 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 42.8% 3 / 7 Podpod 0.0% 0 / 4 totaltotal 28.0% 16 / 57 CC 6 SCAR 20.0
CC
6
Cov
29%
factor_for_node
12.0
print
12.0
dump
6.0
CRAP 7.4
« blib/lib/BalanceOfPower/Role/Diplomat.pm ↑ Summary lib/BalanceOfPower/Commands/RecallMilitarySupport.pm »
1 package BalanceOfPower::Relations::TradeRoute;
2 11 $BalanceOfPower::Relations::TradeRoute::VERSION = '0.300010';
3 11 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 11 ▶use v5.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 11 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 11 has factor1 => (
9 is => 'ro'
10 );
11 11 has factor2 => (
12 is => 'ro'
13 );
14  
15 11 with 'BalanceOfPower::Relations::Role::Relation';
16  
17 sub factor_for_node
18 {
19 0 ▶ my $self = shift;
Subroutine factor_for_node: not called CC=3 SCAR=24.8
Pod undocumented
20 0 my $node = shift;
21 0 ▶ if ($self->node1 eq $node)
Branch: 2 branches
BranchTrueFalseTotal
if ($self->node1 eq $node) { } 0 0 0
elsif ($self->node2 eq $node) { } 0 0 0
22 {
23 0 return $self->factor1;
24 }
25 elsif ($self->node2 eq $node)
26 {
27 0 return $self->factor2;
28 }
29 else
30 {
31 0 return undef;
32 }
33 }
34 sub print
35 {
36 0 ▶ my $self = shift;
Subroutine print: not called CC=3 SCAR=24.8
Pod undocumented
37 0 my $from = shift;
38 0 ▶ if($from eq $self->node1)
Branch: 2 branches
BranchTrueFalseTotal
if ($from eq $self->node1) { } 0 0 0
elsif ($from eq $self->node2) { } 0 0 0
39 {
40 0 return $from . " -[x" . $self->factor1 . "]-> " . $self->node2;
41 }
42 elsif($from eq $self->node2)
43 {
44 0 return $from . " -[x" . $self->factor2 . "]-> " . $self->node1;
45 }
46 }
47 sub dump
48 {
49 0 ▶ my $self = shift;
Subroutine dump: not called CC=2 SCAR=17.9
Pod undocumented
50 0 my $io = shift;
51 0 ▶ my $indent = shift || "";
Condition0%0/2
shift() || ''
l!l
00
MC/DC0%0/1
shift() || ''
shift()
Truth table0%0/2
A
A= shift()
Aresult
11
00
52 0 print {$io} $indent . join(";", $self->node1, $self->node2, $self->factor1, $self->factor2) . "\n";
53 }
54 sub load
55 {
56 0 ▶ my $self = shift;
Subroutine load: not called CC=1 SCAR=6.9
Pod undocumented
57 0 my $data = shift;
58 0 $data =~ s/^\s+//;
59 0 chomp $data;
60 0 my ($node1, $node2, $factor1, $factor2) = split ";", $data;
61 0 return $self->new(node1 => $node1, node2 => $node2, factor1 => $factor1, factor2 => $factor2);
62 }
63  
64  
65  
66  
67  
68  
69 11 1;
70  
71  
« blib/lib/BalanceOfPower/Role/Diplomat.pm ↑ Summary lib/BalanceOfPower/Commands/RecallMilitarySupport.pm »