lib/VANAMBURG/FaceValue.pm

filter: Statementstmt 91.6% 11 / 12 Branchbran 50.0% 2 / 4 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 2 / 2 Podpod 100% 1 / 1 totaltotal 70.8% 17 / 24 CC 4 SCAR 14.6
CC
4
Cov
74%
equals
5.2
BEGIN
1.0
CRAP 4.3
« lib/VANAMBURG/OrderedSuit.pm ↑ Summary lib/VANAMBURG/Suit.pm »
1 package VANAMBURG::FaceValue;
2 6 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 =head2 VANAMBURG::FaceValue
5  
6 Represents the face value of a card. See also VANAMBURG::Suit.
7  
8 =cut
9  
10 =head2 name
11  
12 The name of the face value is an full name suchas "Jack", "Ace", etc.
13  
14 =cut
15  
16 6 has 'name' => ( isa => 'Str', is => 'ro', required => 1 );
17  
18 =head2 value
19  
20 The value of the card is a number 1 through 13, where Ace is 1,
21 Two is 2, King is 13, etc.
22  
23 =cut
24  
25 6 has 'value' => ( isa => 'Int', is => 'ro', required => 1 );
26  
27 =head2 abbreviation
28  
29 A single character text abbreviation for the face value. Ace is "A", two is "2",
30 Jack is "J", etc.
31  
32 =cut
33  
34 6 has 'abbreviation' => ( isa => 'Str', is => 'ro', required => 1 );
35  
36 =head2 equals
37  
38 Returns true (1) when the name and value of this object is the same as that
39 passed to the method, otherwise returns false (0).
40  
41 =cut
42  
43 13 ▶sub equals {
Subroutine equals: called CC=4 SCAR=16.4
Pod documented
44 13 my ( $self, $other ) = @_;
45 13 ▶ return 0 if ( !defined $other );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $other 0 13 13
46 13 ▶ if ( $self->name eq $other->name && $self->value == $other->value ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->name eq $other->name and $self->value == $other->value) { } 13 0 13
Condition33%1/3
$self->name eq $other->name and $self->value == $other->value
!ll&&!rl&&r
0013
MC/DC0%0/2
$self->name eq $other->name and $self->value == $other->value
$self->name eq $other->name $self->value == $other->value
Truth table33%1/3
A and B
A= $self->name eq $other->nameB= $self->value == $other->value
ABresult
0X0
100
111
47 13 return 1;
48 }
49 else {
50 0 return 0;
51 }
52 }
53 6 1;
« lib/VANAMBURG/OrderedSuit.pm ↑ Summary lib/VANAMBURG/Suit.pm »