Farly/Transport/Object.pm

filter: Statementstmt 68.7% 22 / 32 Branchbran 35.7% 5 / 14 Conditioncond 74.0% 20 / 27 MC/DCmcdc 50.0% 7 / 14 Subroutinesub 63.6% 7 / 11 Podpod 87.5% 7 / 8 totaltotal 64.1% 68 / 106 CC 17 SCAR 16.9
CC
17
Cov
64%
adjacent
12.0
intersects
7.8
gt
6.0
CRAP 5.4
« Farly/Remove/Address.pm ↑ Summary Farly/Object/List.pm »
1 package Farly::Transport::Object;
2
3 17 ▶use 5.008008;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 17 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 17 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6
7 17 our $VERSION = '0.26';
8
9 0 ▶sub size {
Subroutine size: not called CC=1 SCAR=6.9
Pod documented
10 0 return $_[0]->last - $_[0]->first;
11 }
12
13 163 ▶sub equals {
Subroutine equals: called CC=3 SCAR=11.0
Pod documented
14 163 my ( $self, $other ) = @_;
15
16 163 ▶ if ( $other->isa('Farly::Transport::Object') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($other->isa("Farly::Transport::Object")) 63 100 163
17
18 63 ▶ return $self->first == $other->first
Condition100%3/3
$self->first == $other->first && $self->last == $other->last
!ll&&!rl&&r
45315
MC/DC100%2/2
$self->first == $other->first && $self->last == $other->last
$self->first == $other->first $self->last == $other->last
Truth table100%3/3
A && B
A= $self->first == $other->firstB= $self->last == $other->last
ABresult
0X0
100
111
19 && $self->last == $other->last;
20 }
21 }
22
23 45 ▶sub contains {
Subroutine contains: called CC=3 SCAR=11.0
Pod documented
24 45 my ( $self, $other ) = @_;
25
26 45 ▶ if ( $other->isa('Farly::Transport::Object') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($other->isa("Farly::Transport::Object")) 45 0 45
27
28 45 ▶ return $self->first <= $other->first
Condition100%3/3
$self->first <= $other->first && $self->last >= $other->last
!ll&&!rl&&r
211113
MC/DC100%2/2
$self->first <= $other->first && $self->last >= $other->last
$self->first <= $other->first $self->last >= $other->last
Truth table100%3/3
A && B
A= $self->first <= $other->firstB= $self->last >= $other->last
ABresult
0X0
100
111
29 && $self->last >= $other->last;
30 }
31 }
32
33 7 ▶sub intersects {
Subroutine intersects: called CC=7 SCAR=20.5
Pod documented
34 7 my ( $self, $other ) = @_;
35
36 7 ▶ if ( $other->isa('Farly::Transport::Object') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($other->isa("Farly::Transport::Object")) 7 0 7
37
38 7 ▶ return ( $self->first <= $other->first && $other->first <= $self->last )
Condition73%11/15
$self->first <= $other->first && $other->first <= $self->last || $self->first <= $other->last && $other->last <= $self->last || $other->first <= $self->first && $self->first <= $other->last
l!l&&r!l&&!r
421
$self->first <= $other->first and $other->first <= $self->last or $self->first <= $other->last and $other->last <= $self->last
l!l&&r!l&&!r
403
$self->first <= $other->first and $other->first <= $self->last
!ll&&!rl&&r
214
$self->first <= $other->last and $other->last <= $self->last
!ll&&!rl&&r
030
$other->first <= $self->first and $self->first <= $other->last
!ll&&!rl&&r
102
MC/DC16%1/6
$self->first <= $other->first && $other->first <= $self->last || $self->first <= $other->last && $other->last <= $self->last || $other->first <= $self->first && $self->first <= $other->last
$self->first <= $other->first $other->first <= $self->last $self->first <= $other->last $other->last <= $self->last $other->first <= $self->first $self->first <= $other->last
Truth table20%3/15
A and B or C and D || E and F
A= $self->first <= $other->firstB= $other->first <= $self->lastC= $self->first <= $other->lastD= $other->last <= $self->lastE= $other->first <= $self->firstF= $self->first <= $other->last
ABCDEFresult
11XXXX1
0X11XX1
1011XX1
0X0X111
0X10111
100X111
1010111
0X0X0X0
0X0X100
0X100X0
0X10100
100X0X0
100X100
10100X0
1010100
39 || ( $self->first <= $other->last && $other->last <= $self->last )
40 || ( $other->first <= $self->first && $self->first <= $other->last );
41 }
42 }
43
44 0 ▶sub gt {
Subroutine gt: not called CC=2 SCAR=17.9
Pod documented
45 0 my ( $self, $other ) = @_;
46
47 0 ▶ if ( $other->isa('Farly::Transport::Object') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($other->isa("Farly::Transport::Object")) 0 0 0
48
49 0 return $self->first > $other->last;
50 }
51 }
52
53 0 ▶sub lt {
Subroutine lt: not called CC=2 SCAR=17.9
Pod documented
54 0 my ( $self, $other ) = @_;
55
56 0 ▶ if ( $other->isa('Farly::Transport::Object') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($other->isa("Farly::Transport::Object")) 0 0 0
57
58 0 return $self->last < $other->first;
59 }
60 }
61
62 0 ▶sub adjacent {
Subroutine adjacent: not called CC=3 SCAR=24.8
Pod documented
63 0 my ( $self, $other ) = @_;
64
65 0 ▶ if ( $other->isa('Farly::Transport::Object') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($other->isa("Farly::Transport::Object")) 0 0 0
66
67 0 ▶ return $self->size() == $other->size()
Condition0%0/3
$self->size == $other->size && $self->last + 1 == $other->first
!ll&&!rl&&r
000
MC/DC0%0/2
$self->size == $other->size && $self->last + 1 == $other->first
$self->size == $other->size $self->last + 1 == $other->first
Truth table0%0/3
A && B
A= $self->size == $other->sizeB= $self->last + 1 == $other->first
ABresult
0X0
100
111
68 && ( $self->last + 1 ) == $other->first;
69 }
70 }
71
72 25 ▶sub compare {
Subroutine compare: called CC=3 SCAR=11.0
Pod undocumented
73 25 my ( $self, $other ) = @_;
74
75 25 ▶ if ( $other->isa('Farly::Transport::Object') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($other->isa("Farly::Transport::Object")) 25 0 25
76
77 25 ▶ return ( $self->first() <=> $other->first()
Condition100%3/3
$self->first <=> $other->first || $other->last <=> $self->last
l!l&&r!l&&!r
12112
MC/DC100%2/2
$self->first <=> $other->first || $other->last <=> $self->last
$self->first <=> $other->first $other->last <=> $self->last
Truth table100%3/3
A || B
A= $self->first <=> $other->firstB= $other->last <=> $self->last
ABresult
1X1
011
000
78 || $other->last() <=> $self->last() );
79 }
80 }
81
82 17 1;
83 __END__
« Farly/Remove/Address.pm ↑ Summary Farly/Object/List.pm »