Sha256: c0b4fa6e672acf99d863c9a9dd2c02c3b38d63c4d4628c2eff463fc847b4d51d

Contents?: true

Size: 815 Bytes

Versions: 6

Compression:

Stored size: 815 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

6 entries across 6 versions & 1 rubygems

Version Path
ceedling-0.25.0 examples/temp_sensor/test/TestTemperatureCalculator.c
ceedling-0.24.0 examples/temp_sensor/test/TestTemperatureCalculator.c
ceedling-0.22.0 examples/temp_sensor/test/TestTemperatureCalculator.c
ceedling-0.21.0 examples/temp_sensor/test/TestTemperatureCalculator.c
ceedling-0.20.3 examples/temp_sensor/test/TestTemperatureCalculator.c
ceedling-0.20.2 examples/temp_sensor/test/TestTemperatureCalculator.c