Branch Coverage

blib/lib/Sport/Analytics/NHL/Test.pm
Criterion Covered Total %
branch 199 278 71.5


line true false branch
331 68 0 if ($DO_NOT_DIE)
334 0 68 if ($EVENT) { }
0 68 elsif ($PLAYER) { }
356 0 0 unless $message =~ /\n$/
374 150883 75164 if (@_ == 2) { }
378 74 75090 if (ref $_[1] and ref $_[1] eq 'ARRAY') { }
386 225979 68 if (&$test(@_)) { }
394 0 226047 if $Sport::Analytics::NHL::Test::IS_AUTHOR and $0 =~ /\.t$/
409 0 1539 if $@
438 11219 6483 $is_nhl ? :
450 0 12433 if &test_team_code($_[0], $_[1])
459 6054 480 unless $THIS_SEASON < ($Sport::Analytics::NHL::Test::DATA_BY_SEASON{$data} || $Sport::Analytics::NHL::Test::STAT_RECORD_FROM{$data} || $data)
472 9 1 unless &is_unapplicable('location')
475 0 10 if @{$bs->{'periods'};} > 3
477 0 10 if @{$bs->{'periods'};} > 4 and $bs->{'stage'} == $Sport::Analytics::NHL::Test::REGULAR
478 0 10 if ($bs->{'so'} and ref $bs->{'shootout'})
512 10 15 if not $period and $p > 2
526 255 1235 if scalar keys %{$coords;} < 2
541 12 2 unless $opts->{'es'} or $opts->{'gs'} or $opts->{'ro'}
543 14 2 unless $opts->{'es'} or $opts->{'gs'}
544 2 16 if $opts->{'bs'}
546 2 16 if $opts->{'bs'}
549 5 20 $opts->{'ro'} ? :
560 0 304 if $player->{'missing'}
561 4 300 if ($opts->{'gs'}) { }
40 260 elsif ($opts->{'ro'}) { }
40 220 elsif ($opts->{'es'}) { }
563 0 4 $player->{'old'} ? :
573 12 208 $player->{'position'} eq 'G' ? :
576 106 114 if $opts->{'merged'}
590 436 180 if &is_unapplicable($Sport::Analytics::NHL::Test::STAT_RECORD_FROM{$stat}) or $player->{'position'} eq 'G' and $opts->{'es'}
591 0 3992 unless (defined $player->{$stat})
596 16 760 $opts->{'es'} || $opts->{'gs'} ? :
776 3216 $stat =~ /timeonice/i ? :
600 220 40 unless $opts->{'es'} or $opts->{'gs'} or $opts->{'ro'}
614 0 324 if $player->{'_id'} and $player->{'_id'} =~ /^80/
616 20 304 if ($player->{'broken'})
621 197 107 if (not $decision) { }
0 107 elsif ($player->{'decision'}) { }
633 6 2 unless $broken or $Sport::Analytics::NHL::Test::BOXSCORE->{'_gs_no_g'} or $opts->{'es'} or $opts->{'ro'}
634 6 12 if $opts->{'merged'}
653 555 112 if $event->{'type'} eq 'GOAL' or $opts->{'merged'} and (not $Sport::Analytics::NHL::Test::BROKEN_TIMES{$Sport::Analytics::NHL::Test::BOXSCORE->{'_id'}} and $event->{'type'} ne 'CHL' and not $event->{'type'} eq 'PENL' && !$event->{'sources'}{'PL'} and $event->{'type'} eq 'GOAL' || $Sport::Analytics::NHL::Test::BOXSCORE->{'sources'}{'PL'} && !&is_noplay_event($event) and not $event->{'type'} eq 'MISS' && !$event->{'sources'}{'PL'})
663 1490 462 if not &is_unapplicable('coordinates') || &is_noplay_event($event) || $event->{'penalty'} || $Sport::Analytics::NHL::Test::BROKEN_COORDS{$Sport::Analytics::NHL::Test::BOXSCORE->{'_id'}}
672 659 1293 if $Sport::Analytics::NHL::Test::BOXSCORE->{'sources'}{'BS'} and not $Sport::Analytics::NHL::Test::BROKEN_FILES{$Sport::Analytics::NHL::Test::BOXSCORE->{'_id'}}{'BS'} or $Sport::Analytics::NHL::Test::BOXSCORE->{'sources'}{'PL'}
679 7 1945 if ($event->{'servedby'})
682 1 6 $opts->{'pl'} ? :
684 33 1919 if ($event->{'assists'} and @{$event->{'assists'};})
687 10 56 $opts->{'pl'} ? :
697 268 1351 if ($opts->{'gs'} and not $event->{'old'} or $opts->{'pl'}) { }
707 1325 26 unless $opts->{'gs'} or $event->{'type'} eq 'PENL' and $event->{'time'} eq '20:00' || $Sport::Analytics::NHL::Test::PENALTY_POSSIBLE_NO_OFFENDER{$event->{'penalty'}}
720 666 0 unless $event->{'type'} eq 'GOAL' and $event->{'en'} or ($event->{'type'} eq 'GOAL' and $opts->{'bh'} or $opts->{'gs'} or $opts->{'pl'}) or $opts->{'merged'} and not $event->{'sources'}{'BS'} and $event->{'type'} eq 'GOAL' or $event->{'time'} eq '0:00' and $event->{'type'} ne 'FAC'
727 34 0 unless ($opts->{'pb'} or $opts->{'pl'} or $event->{'so'} or $Sport::Analytics::NHL::Test::BROKEN_FILES{'BS'}{$Sport::Analytics::NHL::Test::BOXSCORE->{'_id'}} and $Sport::Analytics::NHL::Test::BROKEN_FILES{'BS'}{$Sport::Analytics::NHL::Test::BOXSCORE->{'_id'}} == $Sport::Analytics::NHL::Test::NO_EVENTS)
731 16 18 if $event->{'sources'}{'BS'} or $event->{'sources'}{'GS'}
733 5 29 if $opts->{'bs'}
740 128 0 unless ($opts->{'pb'})
749 80 0 unless not defined $event->{'severity'} or &is_unapplicable('severity') or $opts->{'bh'} or $opts->{'gs'} or $opts->{'pl'} or not $event->{'length'} or $Sport::Analytics::NHL::Test::BROKEN_FILES{'BS'}{$Sport::Analytics::NHL::Test::BOXSCORE->{'_id'}} and $Sport::Analytics::NHL::Test::BROKEN_FILES{'BS'}{$Sport::Analytics::NHL::Test::BOXSCORE->{'_id'}} == $Sport::Analytics::NHL::Test::NO_EVENTS
761 1952 0 if exists $event->{'strength'}
798 192 0 unless $event->{'penaltyshot'}
840 1 6 $Sport::Analytics::NHL::Test::BOXSCORE->{'season'} < 2010 ? :
7 1 unless $Sport::Analytics::NHL::Test::ZERO_EVENT_GAMES{$Sport::Analytics::NHL::Test::BOXSCORE->{'_id'}} or $Sport::Analytics::NHL::Test::BROKEN_FILES{$Sport::Analytics::NHL::Test::BOXSCORE->{'_id'}}{'BS'} and $Sport::Analytics::NHL::Test::BROKEN_FILES{$Sport::Analytics::NHL::Test::BOXSCORE->{'_id'}}{'BS'} == $Sport::Analytics::NHL::Test::NO_EVENTS and not $Sport::Analytics::NHL::Test::BOXSCORE->{'sources'}{'GS'} || $Sport::Analytics::NHL::Test::BOXSCORE->{'sources'}{'PL'} or $opts->{'bh'} or $opts->{'gs'}
854 1 5 if $opts->{'bs'}
856 3 3 if not $opts->{'es'} || $opts->{'pl'} and $boxscore->{'season'} >= $Sport::Analytics::NHL::Test::DATA_BY_SEASON{'officials'}
857 5 1 unless $opts->{'pl'}
859 4 1 unless $Sport::Analytics::NHL::Test::BROKEN_FILES{'BS'}{$Sport::Analytics::NHL::Test::BOXSCORE->{'_id'}} and $Sport::Analytics::NHL::Test::BROKEN_FILES{'BS'}{$Sport::Analytics::NHL::Test::BOXSCORE->{'_id'}} == $Sport::Analytics::NHL::Test::NO_EVENTS or $opts->{'es'} or $opts->{'ro'}
870 2 1 if $BOXSCORE->has_html or not &is_unapplicable('attendance')
872 0 3 if $bs->has_html
919 38 0 if defined $roster_player->{'penaltyMinutes'} and $roster_player->{'penaltyMinutes'} != -1
920 37 1 if ($roster_player->{'penaltyMinutes'} == $event_player->{'penaltyMinutes'} - $event_player->{'servedbyMinutes'})
935 2 0 unless $Sport::Analytics::NHL::Test::BROKEN_FILES{$boxscore_id}{'BS'} or &is_unapplicable('saves')
946 36 72 if $stat eq 'penaltyMinutes'
947 36 36 if ($stat eq 'goals' or $stat eq 'assists')
955 0 36 unless defined $roster_player->{$stat}
964 36 0 unless $Sport::Analytics::NHL::Test::BROKEN_FILES{'BS'}{$boxscore_id} or &is_unapplicable($stat)
977 2 41 if ($player->{'position'} eq 'G') { }
1006 2 0 unless $Sport::Analytics::NHL::Test::BROKEN_FILES{$boxscore->{'_id'}}{'BS'}
1008 5 38 if $player->{'broken'} or $player->{'position'} eq 'N/A'
1013 2 36 $player->{'position'} eq 'G' ? :
1018 1 0 unless $Sport::Analytics::NHL::Test::BROKEN_FILES{$boxscore->{'_id'}}{'BS'}
1025 0 3 if ($boxscore->{'teams'}[0]{'score'} > $boxscore->{'teams'}[1]{'score'}) { }
3 0 elsif ($boxscore->{'teams'}[0]{'score'} < $boxscore->{'teams'}[1]{'score'}) { }
1027 0 0 $boxscore->{'season'} > 1998 && $boxscore->{'ot'} ? :
1031 0 3 $boxscore->{'season'} > 1998 && $boxscore->{'ot'} ? :
1038 2 1 unless &is_unapplicable('location')
1042 11 4 if $source eq 'BS' or -f "$path/$source.html" and not $Sport::Analytics::NHL::Test::BROKEN_FILES{$boxscore->{'_id'}}{$source}
1069 6 0 if ($player->{'position'} eq 'G') { }
1083 2474 0 if defined $player->{$field}
1110 0 3 if $Sport::Analytics::NHL::Test::BROKEN_FILES{$boxscore->{'_id'}}{'BS'} and $Sport::Analytics::NHL::Test::BROKEN_FILES{$boxscore->{'_id'}}{'BS'} == $Sport::Analytics::NHL::Test::UNSYNCHED
1113 547 119 unless &is_noplay_event($event)
1115 547 119 unless &is_noplay_event($event)
1119 3323 7 if defined $event->{$field}
1122 0 666 if $event->{'coords'}
1123 547 119 unless &is_noplay_event($event)
1126 11 655 if exists $event->{'en'}
1130 547 119 if defined $event->{'t'} and $event->{'t'} != -1
1133 990 1674 if exists $event->{$field}
1135 624 42 if ($event->{'on_ice'})
1146 11 0 unless $event->{'en'}
1150 10 1 if ($event->{'assist1'})
1153 10 0 if ($event->{'assist2'})
1160 0 0 if $event->{'length'} == 0
1163 0 0 if $event->{'servedby'}
1168 0 11 if ($event->{'type'} ne 'GOAL')
1180 46 279 if $field eq 'file' or ref $event->{$field}
1181 88 191 if ($event->{$field} =~ /\D/) { }
1198 0 3 if $gp == 4
1218 657 6 if $boxscore->{'events'}[$e]{'period'} == $boxscore->{'events'}[$e + 1]{'period'}
1232 219 444 if $boxscore->{'events'}[$e]{'period'} == $boxscore->{'events'}[$e + 1]{'period'} and $boxscore->{'events'}[$e]{'ts'} == $boxscore->{'events'}[$e + 1]{'ts'}
1235 9 654 if ($event->{'type'} eq 'PSTR') { }
9 645 elsif ($event->{'type'} eq 'PEND') { }
0 645 elsif ($event->{'type'} eq 'GEND') { }
1266 3 0 if defined $report->{'number'}
1267 3 0 if defined $report->{'height'}
1268 3 0 if defined $report->{'weight'}
1276 1 2 if $report->{'active'}
1278 1 2 if ($report->{'pick'} == $Sport::Analytics::NHL::Test::UNDRAFTED_PICK) { }
1295 160 0 if ($season->{'season'} ne 'total' and $season->{'league'} ne 'bogus') { }
1296 59 101 unless $season->{'league'} eq 'NHL'
1299 0 101 unless length $season->{'gp'}
1300 101 0 if length $season->{'gp'}
1301 0 101 if ($report->{'position'} eq 'G') { }
1303 0 0 if length $season->{'w'}
1305 0 0 if length $season->{'l'}
1307 0 0 if length $season->{'t'}
1309 0 0 if $season->{'ot'} and length $season->{'ot'}
1311 0 0 if length $season->{'so'}
1313 0 0 if length $season->{'ga'}
1317 101 0 if length $season->{'g'}
1319 101 0 if length $season->{'a'}
1321 101 0 if length $season->{'pim'}
1323 68 33 if ($season->{'league'} eq 'NHL' and $season->{'start'} >= 1988)
1324 0 68 if ($report->{'position'} eq 'G') { }
1325 0 0 if (length $season->{'gp'} and $season->{'gp'})
1337 68 0 if length $season->{'s'}
1341 68 0 if $season->{'s'}
1343 68 0 if length $season->{'+/-'}
1348 0 0 if $season->{'league'} eq 'bogus'
1369 1 48 if ($BOXSCORE)
1372 0 49 if ($EVENT)
1376 0 49 if ($PLAYER)