-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add sunset/sunrise windows self test
- Loading branch information
1 parent
b4a331e
commit bc580f0
Showing
6 changed files
with
62 additions
and
6 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
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
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,44 @@ | ||
#ifdef WINDOWS | ||
|
||
#include "selftest_local.h" | ||
|
||
void Test_NTP_SunsetSunrise() { | ||
byte hour, minute; | ||
|
||
// reset whole device | ||
SIM_ClearOBK(0); | ||
|
||
// setup test case - Serbia | ||
CMD_ExecuteCommand("startDriver NTP", 0); | ||
CMD_ExecuteCommand("ntp_timeZoneOfs 1", 0); | ||
CMD_ExecuteCommand("ntp_setLatlong 44.272563 19.900690", 0); | ||
// set Tue, 19 Dec 2023 20:14:52 | ||
NTP_SetSimulatedTime(1703016892); | ||
NTP_CalculateSunrise(&hour, &minute); | ||
// Expect sunrise at 7:11 | ||
SELFTEST_ASSERT(hour == 7); | ||
SELFTEST_ASSERT(minute == 11); | ||
NTP_CalculateSunset(&hour, &minute); | ||
// Expect sunset at 16:02 | ||
SELFTEST_ASSERT(hour == 16); | ||
SELFTEST_ASSERT(minute == 2); | ||
|
||
|
||
// setup test case - Los Angeles | ||
CMD_ExecuteCommand("ntp_timeZoneOfs -8", 0); | ||
CMD_ExecuteCommand("ntp_setLatlong 34.052235 -118.243683", 0); | ||
|
||
// set Tue, 19 Dec 2023 20:14:52 | ||
NTP_SetSimulatedTime(1703016892); | ||
NTP_CalculateSunrise(&hour, &minute); | ||
// Expect sunrise at 6:52 | ||
SELFTEST_ASSERT(hour == 6); | ||
SELFTEST_ASSERT(minute == 52); | ||
NTP_CalculateSunset(&hour, &minute); | ||
// Expect sunset at 16:462 | ||
SELFTEST_ASSERT(hour == 16); | ||
SELFTEST_ASSERT(minute == 45); | ||
} | ||
|
||
|
||
#endif |