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

Version Path
ceedling-0.31.1 vendor/cmock/examples/temp_sensor/test/TestTemperatureCalculator.c
ceedling-0.31.0 vendor/cmock/examples/temp_sensor/test/TestTemperatureCalculator.c
ceedling-0.30.0 vendor/cmock/examples/temp_sensor/test/TestTemperatureCalculator.c
ceedling-0.28.3 vendor/cmock/examples/temp_sensor/test/TestTemperatureCalculator.c
ceedling-0.28.2 vendor/cmock/examples/temp_sensor/test/TestTemperatureCalculator.c
ceedling-0.28.1 vendor/cmock/examples/temp_sensor/test/TestTemperatureCalculator.c
ceedling-0.27.0 vendor/cmock/examples/temp_sensor/test/TestTemperatureCalculator.c
ceedling-0.25.0 vendor/cmock/examples/temp_sensor/test/TestTemperatureCalculator.c
ceedling-0.24.0 vendor/cmock/examples/temp_sensor/test/TestTemperatureCalculator.c
ceedling-0.22.0 vendor/cmock/examples/temp_sensor/test/TestTemperatureCalculator.c
ceedling-0.21.0 vendor/cmock/examples/temp_sensor/test/TestTemperatureCalculator.c
ceedling-0.20.3 vendor/cmock/examples/temp_sensor/test/TestTemperatureCalculator.c
ceedling-0.20.2 vendor/cmock/examples/temp_sensor/test/TestTemperatureCalculator.c
ceedling-0.19.0 vendor/cmock/examples/temp_sensor/test/TestTemperatureCalculator.c