doc(pico-sensor): updated readme with remote tests informations

This commit is contained in:
SylvanArnold
2025-06-04 10:51:17 +02:00
parent 2a5b481d66
commit 0bb52a3a07
6 changed files with 88 additions and 25 deletions

View File

@@ -0,0 +1,27 @@
/*
* 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