Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merged PR 450: Merge 92_time_support to master
Related work items: #93, #92
- Loading branch information
Allen B. Cummings
committed
Feb 26, 2019
1 parent
02917a4
commit ccb8ec3
Showing
2 changed files
with
293 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
//***************************************************************************** | ||
// Copyright (c) 2019 - Allen Cummings, RealmsMUD, All rights reserved. See | ||
// the accompanying LICENSE file for details. | ||
//***************************************************************************** | ||
inherit "/lib/tests/framework/testFixture.c"; | ||
|
||
object Dictionary; | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
void Setup() | ||
{ | ||
Dictionary = load_object("/lib/dictionaries/environmentDictionary.c"); | ||
} | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
void CleanUp() | ||
{ | ||
destruct(Dictionary); | ||
} | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
void CurrentTimeDayANdYearCorrectlyDisplayed() | ||
{ | ||
ExpectEq(661, Dictionary->currentTime()); | ||
ExpectEq(92, Dictionary->currentDay()); | ||
ExpectEq(1, Dictionary->currentYear()); | ||
|
||
Dictionary->advanceTime(345); | ||
ExpectEq(1006, Dictionary->currentTime()); | ||
ExpectEq(92, Dictionary->currentDay()); | ||
ExpectEq(1, Dictionary->currentYear()); | ||
} | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
void SettingTimeOfDayAltersCurrentTime() | ||
{ | ||
ExpectEq(661, Dictionary->currentTime()); | ||
ExpectEq("noon", Dictionary->timeOfDay()); | ||
|
||
Dictionary->timeOfDay("afternoon"); | ||
ExpectEq(990, Dictionary->currentTime()); | ||
ExpectEq("afternoon", Dictionary->timeOfDay()); | ||
} | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
void AdvancingTimePastEndOfDayIncrementsDayAndRollsTime() | ||
{ | ||
Dictionary->timeOfDay("night"); | ||
ExpectEq(92, Dictionary->currentDay()); | ||
|
||
Dictionary->advanceTime(60); | ||
ExpectEq(0, Dictionary->currentTime()); | ||
ExpectEq("midnight", Dictionary->timeOfDay()); | ||
ExpectEq(93, Dictionary->currentDay()); | ||
} | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
void AdvancingTimePastSeasonIncrementsSeason() | ||
{ | ||
Dictionary->setDay(91); | ||
ExpectEq(91, Dictionary->currentDay()); | ||
ExpectEq("spring", Dictionary->season()); | ||
|
||
Dictionary->advanceTime(1440); | ||
ExpectEq(92, Dictionary->currentDay()); | ||
ExpectEq("summer", Dictionary->season()); | ||
} | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
void AdvancingTimePastYearIncrementsYearAndResetsSeason() | ||
{ | ||
Dictionary->setDay(364); | ||
ExpectEq(364, Dictionary->currentDay()); | ||
ExpectEq("winter", Dictionary->season()); | ||
ExpectEq(1, Dictionary->currentYear()); | ||
|
||
Dictionary->advanceTime(1440); | ||
ExpectEq(0, Dictionary->currentDay()); | ||
ExpectEq("spring", Dictionary->season()); | ||
ExpectEq(2, Dictionary->currentYear()); | ||
} |