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_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

test_merged_boxscore

Tests the boxscore after it was merged with other files (e.g. via Sport::Analytics::NHL::Merger). Test options are set according to the types of reports that have been merged ($boxscore->{sources})

test_merged_events

Tests the events of the merged boxscore

test_merged_header

Tests the header of the merged boxscore

test_merged_teams

Tests the teams of the merged boxscore

my_cmp_ok

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

test_arranged_events

Tests that the normalized events have been arranged correctly

test_consistency

Tests the consistency between the event summary and the boxscore

test_consistency_goalie

Tests the consistency between the goaltender data and the event summary

test_consistency_penalty_minutes

Tests the consistency between the penalty minutes of the players in the boxscore and in the event summary

test_consistency_playergoals

Tests the consistency between the goals scored in the events and the goals in the boxscore teams/players

test_consistency_skater

Tests the consistency between the skater data and the event summary

test_normalized_boxscore

Full test of the normalized boxscore

test_normalized_events

Tests the normalized boxscore events

test_normalized_header

Tests the normalized boxscore's header

test_normalized_roster

Tests the normalized roster of a team

test_normalized_teams

Tests the normalized boxscore's teams

test_bio

Tests the player's bio and draft data retrieved from the NHL website

test_career

Tests the player's career data retrieved from the NHL website and amended with the preserved errata.

test_player_report

Calls test_bio() and test_career() to test the player report from the NHL website. Executes presence, syntactic and sanity value checks.

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: