Sha256: edf633a70cf95d94d7d294b61d94d19c14913163763f47b038f69aff1fb1f490
Contents?: true
Size: 915 Bytes
Versions: 2
Compression:
Stored size: 915 Bytes
Contents
#include "unity.h" #include "Types.h" #include <math.h> TEST_FILE("TemperatureCalculator.c") extern float TemperatureCalculator_Calculate(uint16_t val); void setUp(void) { } void tearDown(void) { } void testTemperatureCalculatorShouldCalculateTemperatureFromMillivolts(void) { float result; // Series resistor is 5k Ohms; Reference voltage is 3.0V // R(t) = A * e^(B*t); R is resistance of thermisor; t is temperature in C result = TemperatureCalculator_Calculate(1000); TEST_ASSERT_FLOAT_WITHIN(0.01f, 25.0f, result); result = TemperatureCalculator_Calculate(2985); TEST_ASSERT_FLOAT_WITHIN(0.01f, 68.317f, result); result = TemperatureCalculator_Calculate(3); TEST_ASSERT_FLOAT_WITHIN(0.01f, -19.96f, result); } void testShouldReturnNegativeInfinityWhen_0_millivoltsInput(void) { TEST_ASSERT_FLOAT_IS_NEG_INF(TemperatureCalculator_Calculate(0)); }
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ceedling-0.29.1 | examples/temp_sensor/test/TestTemperatureCalculator.c |
ceedling-0.29.0 | examples/temp_sensor/test/TestTemperatureCalculator.c |