"""Equivalence class test cases for HVAC temperature controller."""
import pytest
# Input: setpoint_C and cabin_temp_C
# ECT partitions:
# Setpoint: [invalid_low: < 16], [valid: 16-28], [invalid_high: > 28]
# Cabin temp: [cold: < 10], [normal: 10-40], [hot: > 40]
ECT_CLASSES = [
# (test_name, setpoint, cabin_temp, expected_mode, desc)
# Valid setpoint + normal cabin temp classes
("ect_normal_cooling", 22.0, 28.0, "COOLING", "Valid: hot cabin, needs cooling"),
("ect_normal_heating", 22.0, 16.0, "HEATING", "Valid: cold cabin, needs heating"),
("ect_normal_balanced", 22.0, 22.0, "MAINTAIN", "Valid: cabin at setpoint"),
# Invalid setpoint classes
("ect_invalid_low_sp", 10.0, 22.0, "FAULT", "Invalid: setpoint below minimum"),
("ect_invalid_high_sp", 35.0, 22.0, "FAULT", "Invalid: setpoint above maximum"),
# Extreme cabin temperature classes
("ect_cold_cabin", 22.0, 5.0, "MAX_HEAT", "Cold cabin: full heat output"),
("ect_hot_cabin", 22.0, 45.0, "MAX_COOL", "Hot cabin: full cooling output"),
]
@pytest.mark.parametrize("name,setpoint,cabin,expected_mode,desc",
ECT_CLASSES,
ids=[c[0] for c in ECT_CLASSES])
def test_hvac_ect(name, setpoint, cabin, expected_mode, desc):
"""Run HVAC ECT class representative value."""
# (Replace with actual SiL call)
result = run_hvac_sil(setpoint_c=setpoint, cabin_temp_c=cabin)
assert result["mode"] == expected_mode, \
f"ECT class [{name}] failed: {desc}"