blib/lib/Games/TF2/Demo/StringTable.pm

filter: Statementstmt 55.1% 27 / 49 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 54.5% 6 / 11 Podpod 100% 4 / 4 totaltotal 46.8% 37 / 79 CC 5 SCAR 23.8
CC
5
Cov
45%
_checked_index
30.0
text
2.0
user_data
2.0
CRAP 10.9
« blib/lib/Games/TF2/Demo.pm ↑ Summary blib/lib/Games/TF2/Demo/StateReader.pm »
1 package Games::TF2::Demo::StringTable;
2  
3 11 ▶use v5.26;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 11 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 11 ▶use feature 'signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 11 ▶no warnings 'experimental::signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 11 our $VERSION = '0.01';
9  
10 11 ▶use Object::Pad 0.800;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 class Games::TF2::Demo::StringTable :strict(params) {
13 11 ▶ use Games::TF2::Demo::Error;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 0 ▶ field $name :param :reader;
Subroutine name: not called CC=1 SCAR=2.6
Pod documented
16 11 field $texts :param;
17 11 field $user_data :param;
18  
19 0 ▶ method size () { return scalar $texts->@* }
Subroutine size: not called CC=1 SCAR=4.1
Pod documented
20  
21 0 ▶ method text ($index) {
Subroutine text: not called CC=1 SCAR=6.9
Pod documented
22 0 return $texts->[ $self->_checked_index($index) ];
23 11 }
24  
25 0 ▶ method user_data ($index) {
Subroutine user_data: not called CC=1 SCAR=6.9
Pod documented
26 0 return $user_data->[ $self->_checked_index($index) ];
27 11 }
28  
29 0 ▶ method _checked_index ($index) {
Subroutine _checked_index: not called CC=5 SCAR=34.0
30 0 ▶ return $index if defined $index && !ref $index && $index =~ /\A[0-9]+\z/ && $index < $texts->@*;
Branch: 1 branch
BranchTrueFalseTotal
if defined $index and not ref $index and $index =~ /\A[0-9]+\z/u and $index < @$texts 0 0 0
Condition0%0/9
defined $index and not ref $index and $index =~ /\A[0-9]+\z/u and $index < @$texts
!ll&&!rl&&r
000
defined $index and not ref $index and $index =~ /\A[0-9]+\z/u
!ll&&!rl&&r
000
defined $index and not ref $index
!ll&&!rl&&r
000
MC/DC0%0/4
defined $index and not ref $index and $index =~ /\A[0-9]+\z/u and $index < @$texts
defined $index not ref $index $index =~ /\A[0-9]+\z/u $index < @$texts
Truth table0%0/5
A and not(B) and C and D
A= defined $indexB= not ref $indexC= $index =~ /\A[0-9]+\z/uD= $index < @$texts
ABCDresult
0XXX0
10XX0
110X0
11100
11111
31 0 Games::TF2::Demo::Error::Argument->throw( message => "Games::TF2::Demo::StringTable: no entry $index in $name, it has " . scalar( $texts->@* ) );
32 11 }
33 }
34  
35 11 1;
36  
37 __END__
« blib/lib/Games/TF2/Demo.pm ↑ Summary blib/lib/Games/TF2/Demo/StateReader.pm »