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.

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: