181 printf(
"DEBUG: Testing negative threshold state transitions\n");
182 printf(
"DEBUG: Threshold=-40W (need 40W+ surplus), Hysteresis=20W\n");
185 bool prev_state =
false;
186 int32_t test_values[] = { -20, 0, 20, 35, 45, 30, 25, 15 };
187 const char* descriptions[] = {
188 "Import 20W",
"Zero",
"Surplus 20W",
"Surplus 35W",
189 "Surplus 45W (ON)",
"Surplus 30W",
"Surplus 25W",
"Surplus 15W (OFF)"
192 for (
int i = 0;
i < 8;
i++)
195 printf(
"DEBUG: Power=%dW, State=%s, Description=%s\n",
196 (
int)test_values[
i], new_state ?
"ON" :
"OFF", descriptions[
i]);
198 if (
i == 4) TEST_ASSERT_TRUE(new_state);
199 if (
i == 7) TEST_ASSERT_FALSE(new_state);
201 prev_state = new_state;
void test_negative_threshold_battery_scenario()
void test_normal_positive_threshold()
void test_zero_threshold_special_case()
void test_negative_threshold_edge_cases()
void test_large_negative_threshold()
void test_state_transitions_with_debug()
void test_negative_threshold_import_scenarios()