Branch Coverage

blib/lib/Sport/Analytics/NHL/Merger.pm
Criterion Covered Total %
branch 92 166 55.4


line true false branch
229 1 2 if (not $bs_player) { }
1 1 elsif (not $bs_player->{'number'} or $bs_player->{'number'} != $player->{'number'}) { }
238 0 2 if ($bs_player->{'broken'})
255 0 14 if ($player->{'name'} =~ /\.\s*(\S+.*)$/ and not $name =~ /^st\./i)
264 301 1 unless $_->{'name'} =~ /^$fname.*$name$/i
265 13 1 unless @found_players
267 0 1 if @found_players > 1
269 0 1 if (@found_players > 1)
272 0 0 $CURRENT eq 'GS' ? :
274 1 0 if @found_players == 1
275 0 0 if (@found_players > 1)
278 0 0 unless $_->{'number'} == $o_i
280 0 0 if $found
292 0 361 unless (ref $player)
293 0 0 $player =~ /^\d/ ? :
297 3 358 if ($player->{'_id'} and $player->{'_id'} =~ /^8\d{6}/) { }
356 2 elsif ($player->{'number'}) { }
299 3 0 if $player->{'_id'} and $player->{'_id'} =~ /^8\d{6}/
304 343 13 if $$PLAYER_RESOLVE_CACHE{$team->{'name'}}{$player->{'number'}}
305 1 12 unless $bs_player or $player->{'name'}
308 13 347 unless $bs_player
309 347 0 if defined $bs_player->{'number'} and not $bs_player->{'broken'}
320 0 36 if ($event->{'type'} eq 'PENL') { }
36 0 elsif ($event->{'type'} eq 'STOP') { }
326 0 0 if $event->{'length'} == $_->{'length'} || $event->{'length'} == 10 && $_->{'length'} == 2 and $event->{'penalty'} eq $_->{'penalty'}
330 2 34 if ($event->{'stopreason'} =~ /$stopreason/i or $event->{'stopreason'} =~ /CHLG/i and $stopreason =~ /challenge/i)
343 0 0 unless ($event->{'player1'} || 0) == ($_->{'player1'} || 0)
354 1 1270 if $event->{'special'}
355 1 1269 if not $event->{'player1'} and $type ne 'PL'
362 12010 139538 if $_->{'t'} == $event->{'t'} and $_->{'period'} == $event->{'period'} and $_->{'type'} eq $event->{'type'}
364 0 0 if (not @candidates and $event->{'type'} eq 'MISS' || $event->{'type'} eq 'SHOT' and $event->{'so'})
368 0 0 if $_->{'t'} == $event->{'t'}
370 1249 20 if @candidates == 1
371 2 18 unless @candidates
373 1 17 if @candidates
374 17 0 unless @candidates
382 0 15 if $event->{'sources'}{'GS'} and $event->{'period'} == 5 and $event->{'stage'} == $Sport::Analytics::NHL::Merger::REGULAR
385 0 21996 unless $on_ice =~ /^\d{1,2}$/
393 0 21996 unless (ref $new_on_ice)
394 0 0 if ($CURRENT eq 'GS')
411 0 372 if $player->{'error'}
412 354 12 if ($player->{'timeOnIce'} || defined $player->{'start'} && $player->{'start'} != 2 and not $player->{'_id'} && $player->{'_id'} eq $Sport::Analytics::NHL::Merger::EMPTY_NET_ID)
414 0 354 if (not $bs_player and $CURRENT eq 'GS')
419 0 12 unless $bs_player or ($player->{'position'} eq 'G' and $player->{'start'} != 1 or not $player->{'timeOnIce'})
429 1593 318 if ($event->{'team1'})
430 0 1593 if ($event->{'team1'} eq 'OTH')
432 0 0 $event->{'team2'} eq $report->{'teams'}[0]{'name'} ? :
436 858 1053 if ($event->{'team2'})
437 0 858 if ($event->{'team2'} eq 'OTH')
439 0 0 $event->{'team1'} eq $report->{'teams'}[0]{'name'} ? :
454 0 0 if $Sport::Analytics::NHL::Merger::REVERSE_NAME_TYPOS{$last_name}
455 0 0 if ($description =~ /\b$last_name\b/i)
469 7014 2541 if not $event->{$field} or $event->{$field} =~ /^8\d{6}/
470 858 1683 $field eq 'player2' ? :
471 858 1683 $field eq 'player2' ? :
472 0 2541 if ($event->{$field} and $event->{$field} =~ /\D/) { }
474 0 0 if ($player) { }
0 0 elsif (not $CURRENT eq 'GS' && $event->{'type'} eq 'GOAL') { }
480 0 0 if ($event->{'player1'} and $event->{'servedby'} and $event->{'player1'} == $event->{'servedby'})
506 8 8 if ($rp->{'events'})
511 1590 5 if $event->{'on_ice'}
527 180 1367 if $rp_event->{'stopreason'}
534 14 0 if not $bs_event->{$_} or $bs_event->{$_} eq 'N/A'
538 1244 0 if not $bs_event->{'on_ice'} && $bs_event->{'on_ice'}[0] && @{$bs_event->{'on_ice'}[0];}
542 1032 0 if not $bs_event->{$_} =~ /\S/ or $bs_event->{$_} eq 'XX'
548 286 1261 if (defined $bs_event->{'position'})
550 0 14 if (not defined $bs_event->{$field} and defined $rp_event->{$field} and $rp_event->{$field} eq '' || $rp_event->{$field} eq 0)
566 0 292 if $rp_player->{'error'}
567 6 286 unless $rp_player->{'timeOnIce'} or defined $rp_player->{'start'}
568 0 286 if $rp_player->{'_id'} and $rp_player->{'_id'} == $Sport::Analytics::NHL::Merger::EMPTY_NET_ID
572 286 0 if $rp_player->{'number'}
584 0 20 unless ($bs_team->{'name'} eq $rp_team->{'name'})
601 0 0 if ($event->{'assist1'})
630 16 0 unless $boxscore->{'no_events'} or $type eq 'PL' and $event->{'season'} < 2010 and $event->{'type'} ne 'PENL' and $event->{'type'} ne 'GOAL' or ref $Sport::Analytics::NHL::Merger::FORCED_PUSH{$type}{$game_id} and $Sport::Analytics::NHL::Merger::FORCED_PUSH{$type}{$game_id}{$event->{'id'}} or $event->{'type'} eq 'PENL' and $event->{'length'} == 0 or $event->{'type'} eq 'PEND' or $event->{'type'} eq 'GEND' or $event->{'type'} eq 'STOP' and $event->{'description'} =~ /CHL/i
641 0 0 if $event->{'type'} eq 'MISS'
653 15 0 if $type eq 'GS' and $boxscore->{'sources'}{'PL'} and $boxscore->{'season'} >= 2007
655 16 1248 if (not ref $e) { }
0 2496 elsif ($type eq 'GS' and $rp_event->{'type'} eq 'MISS') { }
656 0 16 if (&expected_miss($type, $rp_event, $boxscore))
664 0 0 unless (ref $e)
669 0 1264 unless defined $e
670 16 1248 if $e == -1
699 6 0 @{$boxscore->{'events'};} ? :