Farly/IPv4/Object.pm

filter: Statementstmt 100% 36 / 36 Branchbran 64.2% 9 / 14 Conditioncond 73.3% 22 / 30 MC/DCmcdc 53.3% 8 / 15 Subroutinesub 100% 12 / 12 Podpod 87.5% 7 / 8 totaltotal 81.7% 94 / 115 CC 18 SCAR 14.8
CC
18
Cov
84%
intersects
10.1
equals
4.0
adjacent
3.0
CRAP 4.4
« Farly/Object/List.pm ↑ Summary Farly/Object/Aggregate.pm »
1 package Farly::IPv4::Object;
2
3 19 ▶use 5.008008;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 19 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 19 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 19 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7
8 19 our $VERSION = '0.26';
9
10 45 ▶sub size {
Subroutine size: called CC=1 SCAR=0.0
Pod documented
11 45 my ($self) = @_;
12 45 return $self->last - $self->first + 1;
13 }
14
15 205 ▶sub equals {
Subroutine equals: called CC=4 SCAR=13.9
Pod documented
16 205 my ( $self, $other ) = @_;
17
18 205 ▶ if ( $other->isa('Farly::IPv4::Object') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($other->isa("Farly::IPv4::Object")) 33 172 205
19
20 33 ▶ return $self->first == $other->first
Condition83%5/6
$self->first == $other->first && $self->last == $other->last && $self->size == $other->size
!ll&&!rl&&r
11022
$self->first == $other->first and $self->last == $other->last
!ll&&!rl&&r
10122
MC/DC66%2/3
$self->first == $other->first && $self->last == $other->last && $self->size == $other->size
$self->first == $other->first $self->last == $other->last $self->size == $other->size
Truth table75%3/4
A and B && C
A= $self->first == $other->firstB= $self->last == $other->lastC= $self->size == $other->size
ABCresult
0XX0
10X0
1100
1111
21 && $self->last == $other->last
22 && $self->size == $other->size;
23 }
24 }
25
26 185 ▶sub contains {
Subroutine contains: called CC=3 SCAR=11.0
Pod documented
27 185 my ( $self, $other ) = @_;
28
29 185 ▶ if ( $other->isa('Farly::IPv4::Object') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($other->isa("Farly::IPv4::Object")) 117 68 185
30
31 117 ▶ return $self->first <= $other->first
Condition100%3/3
$self->first <= $other->first && $self->last >= $other->last
!ll&&!rl&&r
374337
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
32 && $self->last >= $other->last;
33 }
34 }
35
36 3 ▶sub intersects {
Subroutine intersects: called CC=7 SCAR=23.2
Pod documented
37 3 my ( $self, $other ) = @_;
38
39 3 ▶ if ( $other->isa('Farly::IPv4::Object') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($other->isa("Farly::IPv4::Object")) 3 0 3
40
41 3 ▶ return ( $self->first <= $other->first && $other->first <= $self->last )
Condition53%8/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
210
$self->first <= $other->first and $other->first <= $self->last or $self->first <= $other->last and $other->last <= $self->last
l!l&&r!l&&!r
201
$self->first <= $other->first and $other->first <= $self->last
!ll&&!rl&&r
102
$self->first <= $other->last and $other->last <= $self->last
!ll&&!rl&&r
010
$other->first <= $self->first and $self->first <= $other->last
!ll&&!rl&&r
001
MC/DC0%0/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 table13%2/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
42 || ( $self->first <= $other->last && $other->last <= $self->last )
43 || ( $other->first <= $self->first && $self->first <= $other->last );
44 }
45 }
46
47 59 ▶sub gt {
Subroutine gt: called CC=2 SCAR=7.1
Pod documented
48 59 my ( $self, $other ) = @_;
49
50 59 ▶ if ( $other->isa('Farly::IPv4::Object') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($other->isa("Farly::IPv4::Object")) 59 0 59
51
52 59 return $self->first > $other->last;
53 }
54 }
55
56 5 ▶sub lt {
Subroutine lt: called CC=2 SCAR=7.1
Pod documented
57 5 my ( $self, $other ) = @_;
58
59 5 ▶ if ( $other->isa('Farly::IPv4::Object') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($other->isa("Farly::IPv4::Object")) 5 0 5
60
61 5 return $self->last < $other->first;
62 }
63 }
64
65 7 ▶sub adjacent {
Subroutine adjacent: called CC=3 SCAR=11.0
Pod documented
66 7 my ( $self, $other ) = @_;
67
68 7 ▶ if ( $other->isa('Farly::IPv4::Object') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($other->isa("Farly::IPv4::Object")) 7 0 7
69
70 7 ▶ return ( ( $self->last + 1 ) == $other->first )
Condition100%3/3
$self->last + 1 == $other->first || $other->last + 1 == $self->first
l!l&&r!l&&!r
322
MC/DC100%2/2
$self->last + 1 == $other->first || $other->last + 1 == $self->first
$self->last + 1 == $other->first $other->last + 1 == $self->first
Truth table100%3/3
A || B
A= $self->last + 1 == $other->firstB= $other->last + 1 == $self->first
ABresult
1X1
011
000
71 || ( ( $other->last + 1 ) == $self->first );
72 }
73 }
74
75 115 ▶sub compare {
Subroutine compare: called CC=3 SCAR=11.0
Pod undocumented
76 115 my ( $self, $other ) = @_;
77
78 115 ▶ if ( $other->isa('Farly::IPv4::Object') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($other->isa("Farly::IPv4::Object")) 115 0 115
79
80 115 ▶ return ( $self->first() <=> $other->first()
Condition100%3/3
$self->first <=> $other->first || $other->last <=> $self->last
l!l&&r!l&&!r
68542
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
81 || $other->last() <=> $self->last() );
82 }
83 }
84
85 19 1;
86 __END__
« Farly/Object/List.pm ↑ Summary Farly/Object/Aggregate.pm »