test reset values

This commit is contained in:
Janosch
2022-10-11 13:38:50 +01:00
parent 8e61ddd188
commit b45c29f89e
7 changed files with 26 additions and 11 deletions
+1
View File
@@ -11,4 +11,5 @@ void DisableAll();
void EvseRead();
bool CheckStartCondition();
bool CheckVoltage();
void ResetValuesInOffMode();
#endif
Binary file not shown.
+11
View File
@@ -166,3 +166,14 @@ void EvseRead()
}
}
void ResetValuesInOffMode()
{
if (Param::GetInt(Param::state) == OFF)
{
for (int i = Param::c1stt; i <= Param::c3idc; i++)
{
Param::SetInt((Param::PARAM_NUM)i, 0);
}
}
}
-11
View File
@@ -241,17 +241,6 @@ static void CalcEnable()
Param::SetInt(Param::enable, enable);
}
static void ResetValuesInOffMode()
{
if (Param::GetInt(Param::state) == OFF)
{
for (int i = Param::c1stt; i <= Param::c3idc; i++)
{
Param::SetInt((Param::PARAM_NUM)i, 0);
}
}
}
//sample 100ms task
static void Ms100Task(void)
{
+1
View File
@@ -25,6 +25,7 @@ int main() {
(TestCase){"test_evse_read", test_evse_read},
(TestCase){"test_check_start_condition", test_check_start_condition},
(TestCase){"test_check_voltage", test_check_voltage},
(TestCase){"test_reset_values_in_off_mode", test_reset_values_in_off_mode},
// Example:
//(TestCase){"Your tests name", function_name_without_brackets}
//...
BIN
View File
Binary file not shown.
+13
View File
@@ -168,3 +168,16 @@ void test_check_voltage(){
}
assert(res);
}
void test_reset_values_in_off_mode(){
Param::SetInt(Param::c1flag, 1);
Param::SetInt(Param::c2tmp2, 15);
Param::SetInt(Param::c3stt, 15);
Param::SetInt(Param::c3uac, 239);
assert(1 == Param::GetInt(Param::c1flag));
ResetValuesInOffMode();
assert(0 == Param::GetInt(Param::c1flag));
assert(0 == Param::GetInt(Param::c2tmp2));
assert(0 == Param::GetInt(Param::c3stt));
assert(0 == Param::GetInt(Param::c3uac));
}