mirror of
https://github.com/ThrowTheSwitch/CMock
synced 2025-02-02 10:08:41 -05:00
41 lines
1.1 KiB
C
41 lines
1.1 KiB
C
/* =========================================================================
|
|
CMock - Automatic Mock Generation for C
|
|
ThrowTheSwitch.org
|
|
Copyright (c) 2007-25 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
|
SPDX-License-Identifier: MIT
|
|
========================================================================= */
|
|
|
|
#include "unity.h"
|
|
#include "Types.h"
|
|
#include "AdcModel.h"
|
|
#include "MockTaskScheduler.h"
|
|
#include "MockTemperatureCalculator.h"
|
|
#include "MockTemperatureFilter.h"
|
|
|
|
void setUp(void)
|
|
{
|
|
}
|
|
|
|
void tearDown(void)
|
|
{
|
|
}
|
|
|
|
void testDoGetSampleShouldReturn_FALSE_WhenTaskSchedulerReturns_FALSE(void)
|
|
{
|
|
TaskScheduler_DoAdc_ExpectAndReturn(FALSE);
|
|
TEST_ASSERT_EQUAL(FALSE, AdcModel_DoGetSample());
|
|
}
|
|
|
|
void testDoGetSampleShouldReturn_TRUE_WhenTaskSchedulerReturns_TRUE(void)
|
|
{
|
|
TaskScheduler_DoAdc_ExpectAndReturn(TRUE);
|
|
TEST_ASSERT_EQUAL(TRUE, AdcModel_DoGetSample());
|
|
}
|
|
|
|
void testProcessInputShouldDelegateToTemperatureCalculatorAndPassResultToFilter(void)
|
|
{
|
|
TemperatureCalculator_Calculate_ExpectAndReturn(21473, 23.5f);
|
|
TemperatureFilter_ProcessInput_Expect(23.5f);
|
|
AdcModel_ProcessInput(21473);
|
|
}
|