Sha256: 8fedcc9570165858714d952791a29349dffbbb2f2e6ff2f3533426033ee43f63

Contents?: true

Size: 848 Bytes

Versions: 11

Compression:

Stored size: 848 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_IS_NEG_INF(TemperatureCalculator_Calculate(0));
}

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ceedling-0.19.0 examples/temp_sensor/test/TestTemperatureCalculator.c
ceedling-0.18.0 examples/temp_sensor/test/TestTemperatureCalculator.c
ceedling-0.17.0 examples/temp_sensor/test/TestTemperatureCalculator.c
ceedling-0.16.0 examples/temp_sensor/test/TestTemperatureCalculator.c
ceedling-0.15.6 examples/temp_sensor/test/TestTemperatureCalculator.c
ceedling-0.15.5 examples/temp_sensor/test/TestTemperatureCalculator.c
ceedling-0.15.4 examples/temp_sensor/test/TestTemperatureCalculator.c
ceedling-0.15.3 examples/temp_sensor/test/TestTemperatureCalculator.c
ceedling-0.15.2 examples/temp_sensor/test/TestTemperatureCalculator.c
ceedling-0.15.1 examples/temp_sensor/test/TestTemperatureCalculator.c
ceedling-0.15.0 examples/temp_sensor/test/TestTemperatureCalculator.c