Go/Role/Types.pm

filter: Statementstmt 100% 40 / 40 Branchbran 100% 12 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod n/a totaltotal 100% 60 / 60 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Go.pm ↑ Summary
1 package Data::Pokemon::Go::Role::Types;
2 8 ▶use 5.008001;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 8 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 8 ▶use Encode;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 8 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 8 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 8 our @All = qw(
10 ノーマル かくとう どく じめん ひこう むし いわ
11 ゴースト はがね ほのお みず でんき くさ こおり
12 エスパー ドラゴン あく フェアリー
13 );
14  
15 8 enum 'Type' => \@All;
16 8 has types => ( is => 'rw', default => 'ノーマル', isa => 'Type' );
17  
18 8 ▶no Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 # initialize ==============================================================
21 8 ▶use YAML::XS;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 8 ▶use File::Share 'dist_dir';
Subroutine BEGIN: called CC=1 SCAR=0.0
23 8 my $dir = dist_dir('Data-Pokemon-Go');
24  
25 8 our $Ref_Advantage = YAML::XS::LoadFile("$dir/Relations.yaml");
26 8 our $Relations = {};
27  
28 8 ▶while( my( $type, $ref ) = each %$Ref_Advantage ){
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$Data::Pokemon::Go::Role::Types::Ref_Advantage) 144 8 152
29 144 ▶ while( my( $relation, $values ) = each %$ref ){
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %$ref) 432 144 576
30 432 ▶ next unless ref $values;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $values 88 344 432
31 344 foreach my $value (@$values){
32 960 ▶ push @{$Relations->{$value}{invalid}}, $type if $relation eq 'invalid';
Branch: 1 branch
BranchTrueFalseTotal
if $relation eq "invalid" 488 472 960
33 960 ▶ unshift @{$Relations->{$value}{invalid}}, $type if $relation eq 'void';
Branch: 1 branch
BranchTrueFalseTotal
if $relation eq "void" 64 896 960
34 960 ▶ push @{$Relations->{$value}{effective}}, $type if $relation eq 'effective';
Branch: 1 branch
BranchTrueFalseTotal
if $relation eq "effective" 408 552 960
35 }
36 }
37 }
38  
39 8 1;
40 __END__
« Go.pm ↑ Summary