Sha256: f0b725debcc365c16a055371f3f48534d3f30bac75804cc9c5838850a8bb91c9
Contents?: true
Size: 834 Bytes
Versions: 14
Compression:
Stored size: 834 Bytes
Contents
#include "unity.h" #include "Types.h" #include "TemperatureCalculator.h" #include <math.h> 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_WITHIN(0.0000001f, -INFINITY, TemperatureCalculator_Calculate(0)); }
Version data entries
14 entries across 14 versions & 1 rubygems