Sha256: 3fb29ef2641d85565fda4fc07051113add4be854fa32768674fbb4afe44c7253

Contents?: true

Size: 1.22 KB

Versions: 2

Compression:

Stored size: 1.22 KB

Contents

/* =========================================================================
    Ceedling - Test-Centered Build System for C
    ThrowTheSwitch.org
    Copyright (c) 2010-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
    SPDX-License-Identifier: MIT
========================================================================= */

#include "unity.h"
#include "Types.h"
#include "UsartConductor.h"
#include "MockUsartModel.h"
#include "MockUsartHardware.h"
#include "MockTaskScheduler.h"

void setUp(void)
{
}

void tearDown(void)
{
}

void testShouldInitializeHardwareWhenInitCalled(void)
{
  UsartModel_GetBaudRateRegisterSetting_ExpectAndReturn(4);
  UsartHardware_Init_Expect(4);
  UsartModel_GetWakeupMessage_ExpectAndReturn("Hey there!");
  UsartHardware_TransmitString_Expect("Hey there!");

  UsartConductor_Init();
}

void testRunShouldNotDoAnythingIfSchedulerSaysItIsNotTimeYet(void)
{
  TaskScheduler_DoUsart_ExpectAndReturn(FALSE);

  UsartConductor_Run();
}

void testRunShouldGetCurrentTemperatureAndTransmitIfSchedulerSaysItIsTime(void)
{
  TaskScheduler_DoUsart_ExpectAndReturn(TRUE);
  UsartModel_GetFormattedTemperature_ExpectAndReturn("hey there");
  UsartHardware_TransmitString_Expect("hey there");

  UsartConductor_Run();
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ceedling-1.0.1 examples/temp_sensor/test/TestUsartConductor.c
ceedling-1.0.0 examples/temp_sensor/test/TestUsartConductor.c