blib/lib/Graphics/Primitive/Insets.pm

filter: Statementstmt 88.8% 32 / 36 Branchbran n/a Conditioncond 44.4% 4 / 9 MC/DCmcdc 25.0% 1 / 4 Subroutinesub 70.0% 7 / 10 Podpod 75.0% 3 / 4 totaltotal 74.6% 47 / 63 CC 4 SCAR 9.6
CC
4
Cov
80%
equal_to
5.5
__ANON__
2.0
__ANON__
2.0
CRAP 2.6
« blib/lib/Graphics/Primitive/Container.pm ↑ Summary blib/lib/Graphics/Primitive/Driver/TextLayout.pm »
1 package Graphics::Primitive::Insets;
2 9 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 9 ▶use MooseX::Storage;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 9 with 'Geometry::Primitive::Equal';
6  
7 9 with 'MooseX::Clone';
8 9 with Storage (format => 'JSON', io => 'File');
9  
10 9 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 coerce 'Graphics::Primitive::Insets'
13 => from 'ArrayRef'
14 0 ▶ => via {
Subroutine __ANON__: not called CC=1 SCAR=6.9
15 0 Graphics::Primitive::Insets->new(
16 top => $_->[0], right => $_->[1],
17 bottom => $_->[2], left => $_->[3]
18 )
19 9 };
20  
21 coerce 'Graphics::Primitive::Insets'
22 => from 'Num'
23 0 ▶ => via {
Subroutine __ANON__: not called CC=1 SCAR=6.9
24 0 Graphics::Primitive::Insets->new(
25 top => $_, right => $_,
26 bottom => $_, left => $_
27 )
28 9 };
29  
30 9 has 'top' => ( is => 'rw', isa => 'Num', default => 0 );
31 9 has 'bottom' => ( is => 'rw', isa => 'Num', default => 0 );
32 9 has 'left' => ( is => 'rw', isa => 'Num', default => 0 );
33 9 has 'right' => ( is => 'rw', isa => 'Num', default => 0 );
34  
35 0 ▶sub as_array {
Subroutine as_array: not called CC=1 SCAR=6.9
Pod documented
36 0 my ($self) = @_;
37  
38 0 return ($self->top, $self->right, $self->bottom, $self->left);
39 }
40  
41 5 ▶sub equal_to {
Subroutine equal_to: called CC=4 SCAR=17.1
Pod documented
42 5 my ($self, $other) = @_;
43  
44 5 ▶ return ($self->top == $other->top) && ($self->bottom == $other->bottom)
Condition44%4/9
$self->top == $other->top && $self->bottom == $other->bottom && $self->left == $other->left && $self->right == $other->right
!ll&&!rl&&r
014
$self->top == $other->top and $self->bottom == $other->bottom and $self->left == $other->left
!ll&&!rl&&r
005
$self->top == $other->top and $self->bottom == $other->bottom
!ll&&!rl&&r
005
MC/DC25%1/4
$self->top == $other->top && $self->bottom == $other->bottom && $self->left == $other->left && $self->right == $other->right
$self->top == $other->top $self->bottom == $other->bottom $self->left == $other->left $self->right == $other->right
Truth table40%2/5
A and B and C && D
A= $self->top == $other->topB= $self->bottom == $other->bottomC= $self->left == $other->leftD= $self->right == $other->right
ABCDresult
0XXX0
10XX0
110X0
11100
11111
45 && ($self->left == $other->left) && ($self->right == $other->right);
46 }
47  
48 2 ▶sub width {
Subroutine width: called CC=1 SCAR=0.0
Pod undocumented
49 2 my ($self, $width) = @_;
50  
51 2 $self->top($width); $self->bottom($width);
52 2 $self->left($width); $self->right($width);
53 }
54  
55 1 ▶sub zero {
Subroutine zero: called CC=1 SCAR=0.0
Pod documented
56 1 my ($self) = @_;
57  
58 1 $self->width(0);
59 }
60  
61 9 __PACKAGE__->meta->make_immutable;
62  
63 9 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
64 9 1;
65 __END__
« blib/lib/Graphics/Primitive/Container.pm ↑ Summary blib/lib/Graphics/Primitive/Driver/TextLayout.pm »