Sha256: fd499dbb47402f8fe2cfd6a11f470bf1c93dc49ba4c6ace0f24b77101e2d3051

Contents?: true

Size: 1.18 KB

Versions: 4

Compression:

Stored size: 1.18 KB

Contents

#include "unity.h"
#include "Types.h"
#include "UsartModel.h"
#include "ModelConfig.h"
#include "MockTemperatureFilter.h"
#include "MockUsartBaudRateRegisterCalculator.h"
#include <math.h>

void setUp(void)
{
}

void tearDown(void)
{
}

void testGetBaudRateRegisterSettingShouldReturnAppropriateBaudRateRegisterSetting(void)
{
  uint8 dummyRegisterSetting = 17;
  UsartModel_CalculateBaudRateRegisterSetting_ExpectAndReturn(MASTER_CLOCK, USART0_BAUDRATE, dummyRegisterSetting);

  TEST_ASSERT_EQUAL(dummyRegisterSetting, UsartModel_GetBaudRateRegisterSetting());
}

void testGetFormattedTemperatureFormatsTemperatureFromCalculatorAppropriately(void)
{
  TemperatureFilter_GetTemperatureInCelcius_ExpectAndReturn(25.0f);
  TEST_ASSERT_EQUAL_STRING("25.0 C\n", UsartModel_GetFormattedTemperature());
}

void testShouldReturnErrorMessageUponInvalidTemperatureValue(void)
{
  TemperatureFilter_GetTemperatureInCelcius_ExpectAndReturn(-INFINITY);
  TEST_ASSERT_EQUAL_STRING("Temperature sensor failure!\n", UsartModel_GetFormattedTemperature());
}

void testShouldReturnWakeupMessage(void)
{
  TEST_ASSERT_EQUAL_STRING("It's Awesome Time!\n", UsartModel_GetWakeupMessage());
}

Version data entries

4 entries across 2 versions & 1 rubygems

Version Path
ceedling-0.29.1 examples/temp_sensor/test/TestUsartModel.c
ceedling-0.29.1 vendor/cmock/examples/temp_sensor/test/TestUsartModel.c
ceedling-0.29.0 examples/temp_sensor/test/TestUsartModel.c
ceedling-0.29.0 vendor/cmock/examples/temp_sensor/test/TestUsartModel.c