-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
30aa47f
commit a362dc0
Showing
5 changed files
with
55 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#ifdef WINDOWS | ||
|
||
#include "selftest_local.h" | ||
|
||
void Test_ChargeLimitDriver() { | ||
int i; | ||
// reset whole device | ||
SIM_ClearOBK(0); | ||
|
||
int start10 = 1000; | ||
CHANNEL_Set(10, start10, 0); | ||
CHANNEL_Set(12, 0, 0); | ||
CMD_ExecuteCommand("startDriver ChargingLimit", 0); | ||
// chSetupLimit 5 5000 3600 "POWER OFF" | ||
CMD_ExecuteCommand("alias MyEvent SetChannel 12 1", 0); | ||
CMD_ExecuteCommand("chSetupLimit 10 5 3600 MyEvent", 0); | ||
|
||
// simulate time passing | ||
for (int i = 0; i < 10; i++) { | ||
CMD_ExecuteCommand("addChannel 10 2", 0); | ||
Main_OnEverySecond(); | ||
int val10 = CHANNEL_Get(10); | ||
int nowDelta = val10 - start10; | ||
if (nowDelta >= 5) { | ||
SELFTEST_ASSERT_CHANNEL(12,1); | ||
} | ||
else { | ||
SELFTEST_ASSERT_CHANNEL(12, 0); | ||
} | ||
} | ||
|
||
// simulate time passing - time limit 5 seconds | ||
CHANNEL_Set(12, 0, 0); | ||
CMD_ExecuteCommand("chSetupLimit 10 5 5 MyEvent", 0); | ||
for (int i = 0; i < 15; i++) { | ||
Main_OnEverySecond(); | ||
// has 5 seconds passed? | ||
if (i >= 4) { | ||
SELFTEST_ASSERT_CHANNEL(12, 1); | ||
} | ||
else { | ||
SELFTEST_ASSERT_CHANNEL(12, 0); | ||
} | ||
} | ||
|
||
} | ||
|
||
|
||
#endif |
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