/*
 * Copyright (c) 2025, Sylvan Arnold
 *
 */
#include "platform.h"
#if PL_CONFIG_USE_UNIT_TESTS
#include "test_sensors.h"
#include "unity.h"
#include "sensor.h"

void TestSensors_Test(void) {
    float temp, hum;

    /* Test that initial sensor values are within a reasonable range */
    temp = Sensor_GetTemperature();
    hum = Sensor_GetHumidity();

    /* Check temperature is within plausible sensor range (-40°C to 125°C) */
    TEST_ASSERT_TRUE_MESSAGE(temp > -50.0f && temp < 130.0f, "Temperature out of range");

    /* Check humidity is within plausible sensor range (0% to 100%) */
    TEST_ASSERT_TRUE_MESSAGE(hum >= 0.0f && hum <= 100.0f, "Humidity out of range");

    /* Optionally, check that values are not both zero (unless sensor is uninitialized) */
    TEST_ASSERT_FALSE_MESSAGE(temp == 0.0f && hum == 0.0f, "Sensor values are both zero, possible init error");
}
# endif