mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-07-11 14:50:22 +00:00
71651c1575
* Added :config target to allow passing toolchain configuration file into Rake * Added checking of Unity unit test results in order to allow Rake to report a failure if any unit tests fail * Fixed bug where base path setting was incompatible with with Unity unit test summary git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@48 bf332499-1b4d-0410-844d-d2d48d5cc64c
34 lines
867 B
C
34 lines
867 B
C
#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));
|
|
}
|