Branch Coverage

blib/lib/Sport/Analytics/NHL/Report/PL.pm
Criterion Covered Total %
branch 96 286 33.5


line true false branch
244 0 0 if ($event->{'description'} =~ /^(\d+).*\,\s*(\S.*\S)\s*\,\s*(\d+)/) { }
0 0 elsif ($event->{'description'} =~ /^Team Penalty\,\s*(\S.*\S)\s*\,\s*(\d+) min\, Served By\s+(\d+)/) { }
0 0 elsif ($event->{'description'} =~ /^Abuse of officials - bench\,\s*(\d+) min\, Served By\s+(\d+)/) { }
0 0 elsif ($event->{'description'} =~ /^Team Penalty\,\s*(\S.*\S)\s*\,\s*(\d+) min/) { }
253 0 0 $event->{'description'} =~ /\bcoach\b/ ? :
270 0 0 if $event->{'description'} =~ /(misconduct|unsportsmanlike)/i
281 0 32 if (not $event->{'team1'}) { }
283 0 0 unless $event->{'description'} =~ /team/i
288 0 32 if ($desc =~ /^\#(\s+)/)
296 0 32 unless defined $desc
297 30 2 if ($desc =~ /Drawn.By: (\S\S\S) #(\d+)/i) { }
303 2 30 if $desc =~ /Served.By: #(\d+)/
304 0 32 if $use_servedby
305 30 2 if $desc =~ /(\w\w\w). Zone/
306 0 32 if $event->{'description'} =~ /(misconduct|unsportsmanlike)/i
308 0 32 if (not $event->{'player1'} and $event->{'servedby'}) { }
2 30 elsif ($event->{'player1'} =~ /team/i) { }
0 30 elsif ($event->{'player1'} eq ' ') { }
315 0 0 $event->{'description'} =~ /(Team Staff|\bcoach\b)/i ? :
319 0 32 if $event->{'servedby'} and $event->{'servedby'} =~ /^80/
329 0 0 if $event->{'description'} =~ /(offensive|neutral|defensive) zone/
330 0 0 if $event->{'description'} =~ /(\d+)\s+ft/
331 0 0 if ($event->{'description'} =~ /^\-?(\d+)/)
335 0 0 if $event->{'strength'} eq 'SO'
344 0 0 if ($event->{'winning_team'} eq $1) { }
0 0 elsif ($event->{'winning_team'} eq $3) { }
374 0 0 if ($event->{'description'} =~ /($VALID_MISSES|Penalty)/) { }
375 0 0 if ($1 eq 'Penalty') { }
394 0 0 if ($event->{'shot_type'} eq 'Unsuccessful Penalty Shot')
406 0 0 $event->{'distance'} > 72 ? :
0 0 $event->{'distance'} > 120 ? :
407 0 0 if ($event->{'description'} =~ /A\:\s+(\d+)\s+(\S+)\,\s+(\d+)\s+(\S+)/) { }
0 0 elsif ($event->{'description'} =~ /A\:\s+(\d+)\s+(\S+)/) { }
428 0 0 if defined $$evx{$event->{'id'}} and $$evx{$event->{'id'}}{'description'}
430 32 600 if $event->{'type'} eq 'PENL'
437 0 600 if ($event->{'type'} eq 'CHL')
443 470 130 if ($event->{'type'} ne 'FAC') { }
444 200 270 if ($items[-1] =~ /^(\d+) ft./)
448 364 106 if ($items[-1] =~ /^($VALID_ZONES)\. Zone/)
452 64 406 if ($items[-1] =~ /$VALID_MISSES/)
456 262 208 if ($items[-1] =~ /^$VALID_SHOTS$/)
464 130 0 if $event->{'description'} =~ /($VALID_ZONES)\. Zone/
472 0 600 if $event->{'description'} =~ /Penalty Shot/
473 262 338 if $event->{'type'} =~ /^(GOAL|MISS|SHOT|BLOCK)$/
474 64 536 if $event->{'type'} eq 'MISS'
476 0 106 $event->{'type'} =~ /(GOAL|SHOT|MISS|BLOCK)/ ? :
106 494 unless $event->{'location'}
479 10 0 if ($event->{'description'} =~ /Assists: #(\d+) .* #(\d+)/) { }
0 0 elsif ($event->{'description'} =~ /Assist: #(\d+)/) { }
497 0 130 unless $1
499 64 66 if ($event->{'winning_team'} ne $event->{'team1'})
526 0 1260 if (ref $on_ice eq 'ARRAY') { }
532 0 1260 unless ref $on_ice_table->{'_content'}
541 0 7272 unless defined $on_ice_cell
542 0 7272 unless $on_ice_cell =~ /^\d+$/
559 0 0 $adjust ? :
0 0 ref $row->{'_content'}[$r] ? :
561 0 0 $block =~ /\r/ ? :
579 0 0 if ($team eq $self->{'teams'}[0]{'name'}) { }
0 0 elsif ($team eq $self->{'teams'}[1]{'name'}) { }
590 0 0 if $Sport::Analytics::NHL::Report::PL::BROKEN_EVENTS{'PL'}{$self->{'_id'}}{$self->{'events'}[-1]{'id'}}{'on_ice2'}
598 0 0 $self->{'events'}[-1] ? :
613 0 0 if ($line =~ /Shootout/)
619 0 0 if not $line =~ /\w/ or $line =~ /^\<\!\-\-/ or $line =~ /^\s*(\-+|\#)/ or not $self->{'goal_mode'} || $line =~ /^\s*(\d+|SO\s|F\s)/
622 0 0 if ($self->{'goal_mode'})
626 0 0 if ($line =~ /^\s+\d+\s+\d+:\d+/)
631 0 0 $self->{'so'} ? :
637 0 0 if defined $Sport::Analytics::NHL::Report::PL::BROKEN_EVENTS{'PL'}{$self->{'_id'}}{$event->{'id'}} and !$Sport::Analytics::NHL::Report::PL::BROKEN_EVENTS{'PL'}{$self->{'_id'}}{$event->{'id'}} || $Sport::Analytics::NHL::Report::PL::BROKEN_EVENTS{'PL'}{$self->{'_id'}}{$event->{'id'}}{'special'}
638 0 0 if ($self->{'so'})
641 0 0 $self->{'so'} ? :
643 0 0 if $event->{'period'} > 5 and $self->{'stage'} == $Sport::Analytics::NHL::Report::PL::REGULAR
646 0 0 if $event->{'type'} =~ /GOALIE/i
648 0 0 $self->{'so'} ? :
649 0 0 if $event->{'period'} =~ /\d/ and $event->{'period'} == 5 and $self->{'stage'} == $Sport::Analytics::NHL::Report::PL::REGULAR
650 0 0 $self->{'so'} ? :
651 0 0 $self->{'so'} ? :
666 0 0 if ($event->{'type'} =~ /(.*)\s+\(\s*\S+\s*\)/)
676 0 0 if ($event->{'type'} eq 'Penalty Shot')
681 0 0 if ($event->{'type'} eq 'GOAL')
682 0 0 $self->{'shootout'} ? :
696 0 0 if $event->{'special'}
697 0 0 if ($event->{'type'} eq 'GOAL')
698 0 0 if ($Sport::Analytics::NHL::Report::PL::BROKEN_EVENTS{'PL'}{$self->{'_id'}}{$event->{'id'}}{'on_ice'}) { }
0 0 elsif ($Sport::Analytics::NHL::Report::PL::BROKEN_EVENTS{'PL'}{$self->{'_id'}}{$event->{'id'}}{'on_ice1'}) { }
0 0 elsif ($Sport::Analytics::NHL::Report::PL::BROKEN_EVENTS{'PL'}{$self->{'_id'}}{$event->{'id'}}{'on_ice'}) { }
715 0 0 @{$self->{'head'};} == 2 ? :
724 0 0 if ($r == 1 and not @{$self->{'events'};})
731 0 0 unless $event
732 0 0 if $$event_cache{$event->{'id'}}
736 0 0 if ($evx and $evx->{'special'})
741 0 0 unless $OLD_EVENT_TYPES{$event->{'type'}}
744 0 0 if defined $evx->{'description'}
745 0 0 $event->{'type'} eq 'PENL' ? :
747 0 0 if ($event->{'strength'} eq '-')
748 0 0 @{$self->{'events'};} ? :
752 0 0 if $event->{'period'} > 11
756 0 0 if @{$self->{'events'};} and $self->{'events'}[-1]{'special'} or $adjust
758 0 0 unless $self->{'events'}[-1]{'special'}
759 0 0 if ($Sport::Analytics::NHL::Report::PL::BROKEN_EVENTS{'PL'}{$self->{'_id'}}{'-1'})
775 16 632 if $event_cell eq '#' or $event_cell and ref $event_cell
777 0 632 if defined $Sport::Analytics::NHL::Report::PL::BROKEN_EVENTS{'PL'}{$self->{'_id'}}{$event_cell} and not $Sport::Analytics::NHL::Report::PL::BROKEN_EVENTS{'PL'}{$self->{'_id'}}{$event_cell}
780 0 632 unless $event_cell
781 0 632 if grep {$event_cell eq $_;} @IGNORED_EVENT_TYPES
783 0 632 if not grep({$event_cell eq $_;} @KNOWN_EVENT_TYPES)
787 10 5046 if ($pp == $DESCRIPTION_INDEX and $event->{'type'} eq 'GOAL')
789 10 0 if $extra_description
790 0 10 if ($event->{'id'} == 1)
802 0 632 if $event->{'type'} eq 'PEND' and not $event->{'time'} =~ /^\d+/
812 0 0 if ($self->{'events'}[-$e]{'type'} eq 'PEND')
820 0 0 if ($self->{'events'}[-$e]{'period'} == 5 and $self->{'stage'} == $Sport::Analytics::NHL::Report::PL::REGULAR)
834 0 2 unless defined $evx
835 0 2 if ($evx->{'-1'})
839 632 0 unless $$evx{$event->{'id'}}
840 0 0 if $event->{'special'}
841 0 0 if ($$evx{$event->{'id'}}{'on_ice'}) { }
0 0 elsif ($$evx{$event->{'id'}}{'on_ice1'}) { }
0 0 elsif ($$evx{$event->{'id'}}{'on_ice'}) { }
858 0 632 if $event and $event->{'period'} > 11
861 0 6 if $event->{'type'} eq 'PEND' || $event->{'type'} eq 'PSTR' and @{$self->{'events'};} and $self->{'events'}[-1]{'type'} eq $event->{'type'}
873 0 632 if ($event->{'period'} == 5 and $self->{'stage'} == $Sport::Analytics::NHL::Report::PL::REGULAR)
888 0 6 unless $main_table
890 56 648 unless ref $play_row and scalar @{$play_row->{'_content'};} >= @event_fields
892 16 632 if not $event or $self->skip_event($event)
894 0 632 if $event->{'type'} eq 'CHL' and $event->{'team1'} eq 'html'
895 630 2 unless $event->{'type'} eq 'GEND'
898 632 0 $Sport::Analytics::NHL::Report::PL::BROKEN_EVENTS{'PL'}{$self->{'_id'}} ? :
900 0 2 if $event->{'on_ice1'} and ref $event->{'on_ice1'} and ref $event->{'on_ice1'} ne 'ARRAY'
901 0 2 if $event->{'on_ice2'} and ref $event->{'on_ice2'} and ref $event->{'on_ice2'} ne 'ARRAY'
904 2 630 if $self->{'events'}[-1]{'type'} eq 'GEND'
909 0 2 unless $self->{'events'}[-1]{'type'} eq 'GEND'
910 0 2 unless $self->{'events'}[-1]{'type'} eq 'GEND'
919 32 600 if ($event->{'penalty'})
920 2 30 if ($event->{'penalty'} =~ /\bbench\b/i and not $event->{'penalty'} =~ /leav/i) { }
0 30 elsif ($event->{'penalty'} =~ /(.*\w)\W*\bcoach\b/i) { }
929 0 32 if ($event->{'penalty'} =~ /(.*)\s+\(MAJ\)/i) { }
0 32 elsif ($event->{'penalty'} =~ /(.*)\s+\(10 MIN\)/i) { }
940 2072 1088 unless exists $event->{$v}
941 98 990 if ($v eq 'stopreason') { }
32 958 elsif ($v eq 'penalty') { }
954 10 622 if ($event->{'assist1'})
956 10 0 if $event->{'assist2'}
958 0 632 if ($event->{'period'} == 5 and $self->{'stage'} == $Sport::Analytics::NHL::Report::PL::REGULAR)
970 0 2 $self->{'old'} ? :