The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Sport::Analytics::NHL::Test - Utilities to test NHL reports data.

SYNOPSYS

Utilities to test NHL report data

 These are utilities that test and validate the data contained in the NHL reports to detect errors. They are also used to test and validate the permutations that are performed by this software on the data.
 Ideally, that method should extend Test::More, but first, I was too lazy to figure out how to do it, and second, I notice that in the huge number of tests that are run, Test::More begins to drag things down.

    use Sport::Analytics::NHL::Test;
    test_team_id('SJS') # pass
    test_team_id('S.J') # fail and die (usually)

 The failures are usually bad enough to force the death of the program and an update to Sport::Analytics::NHL::Errors (q.v.), but see the next section

GLOBAL VARIABLES

 The behaviour of the tests is controlled by several global variables:
 * $TEST_COUNTER - contains the number of the current test in Curr_Test field and the number of passes/fails in Test_Results.
 * $DO_NOT_DIE - when set to 1, failed test will not die.
 * $MESSAGE - the latest failure message
 * $TEST_ERRORS - accumulation of errors by type (event, player, boxscore, team)

FUNCTIONS

my_die

Either dies with a stack trace dump, or aggregates the error messages, based on $DO_NOT_DIE Arguments: the death message Returns: void

my_test

Executes a test subroutine and sets the failure message in case of failure. Updates test counters. Arguments: the test subroutine and its arguments Returns: void

my_like

Approximately the same as Test::More::like()

my_is

Approximately the same as Test::More::is()

my_ok

Approximately the same as Test::More::ok()

my_is_one_of

Approximately the same as grep {$_[0] == $_} $_[1]

test_season

For the test_* functions below the second argument is always the notification message. Sometimes third parameter may be passed. This one tests if the season is one between $FIRST_SEASON (from Sports::Analytics::NHL::Config) and $CURRENT_SEASON (from Sports::Analytics::NHL::LocalConfig)

test_stage

Tests if the stage is either Regular (2) or Playoff (3)

test_season_id

Tests the season Id to be between 1 and 1500 (supposedly maximum number of games per reg. season)

test_game_id

Tests the game Id to be of the SSSSTIIII form. In case optional parameter is_nhl, tests for the NHL id SSSSTTIIII

test_team_code

Tests if the string is a three-letter team code, not necessarily the normalized one.

test_team_id

Tests if the string is a three-letter franchise code, as specified in keys of Sports::Analytics::NHL::Config::TEAMS

test_ts

Tests the timestamp to be an integer (negative for pre-1970 games) number.

test_game_date

Tests the game date to be in YYYYMMDD format.

is_noplay_event

Check if the event is not a played one (PEND, GEND, PSTR, STOP)

is_unapplicable

Check if the particular stat is measured in season being processed, stored in $THIS_SEASON

set_tested_stats

Set the stats tested for a player

test_assists_and_servedby

Tests the correct values in assists and servedby fields

test_boxscore

Overall sequence to test the entire boxscore

test_coords

Tests the event coordinates

test_decision

Tests the decision for the goaltender being one of W,L,O,T

test_event

Overall sequence to test the event

test_event_by_type

Route the particular event testing according to its type

test_event_coords

Checks the applicability of coordinates for the event and tests them

test_event_description

Tests the event's description (for existence, actually)

test_event_strength

Checks the applicability of strength setting for the event and tests it

test_events

Test the boxscore's events (loops over test_event (q.v.))

test_goal

Tests the goal event

test_header

Tests the header information of the boxscore

test_name

Tests the player's name (to have a space between two words, more or less)

test_officials

Tests the officials definition in the boxscore

test_penalty

Tests the penalty event

test_periods

Tests the periods' reports from the boxscore

test_player

Tests a player entry in the team's roster

test_player1

Tests valid population of the player1 event field

test_player2

Tests valid population of the player2 event field

test_player_id

Tests the player id to be the valid 7-digit one one starting with 8

test_position

Tests the position of the player to be one of C L R F D G

test_strength

Tests the event's strength to be one of EV, SH, PP, PS or XX (unknown)

test_team_header

Tests "header" information for a team: shots, score, coach etc.

test_teams

Tests teams that played in the game

test_time

Tests the time to be of format M{1,3}:SS

AUTHOR

More Hockey Stats, <contact at morehockeystats.com>

BUGS

Please report any bugs or feature requests to contact at morehockeystats.com, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Sport::Analytics::NHL::Test. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Sport::Analytics::NHL::Test

You can also look for information at: