mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-06-05 21:15:20 +00:00
* major changes to Expects to support structs, etc... not recommended for general consumption yet.
git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@56 bf332499-1b4d-0410-844d-d2d48d5cc64c
This commit is contained in:
@@ -16,3 +16,12 @@ void AdcConductor_Run(void)
|
||||
AdcHardware_StartConversion();
|
||||
}
|
||||
}
|
||||
|
||||
bool AdcConductor_JustHereToTest(void)
|
||||
{
|
||||
EXAMPLE_STRUCT_T ExampleStruct;
|
||||
ExampleStruct.x = 5;
|
||||
ExampleStruct.y = 7;
|
||||
|
||||
return AdcModel_DoNothingExceptTestASpecialType(ExampleStruct);
|
||||
}
|
||||
|
||||
@@ -4,4 +4,6 @@
|
||||
void AdcConductor_Init(void);
|
||||
void AdcConductor_Run(void);
|
||||
|
||||
bool AdcConductor_JustHereToTest(void);
|
||||
|
||||
#endif // _ADCCONDUCTOR_H
|
||||
|
||||
@@ -16,4 +16,3 @@ void Adc_EnableTemperatureChannel(void)
|
||||
{
|
||||
AT91C_BASE_ADC->ADC_CHER = 0x10;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,3 +14,7 @@ void AdcModel_ProcessInput(uint16 millivolts)
|
||||
TemperatureFilter_ProcessInput(TemperatureCalculator_Calculate(millivolts));
|
||||
}
|
||||
|
||||
bool AdcModel_DoNothingExceptTestASpecialType(EXAMPLE_STRUCT_T ExampleStruct)
|
||||
{
|
||||
//This doesn't really do anything. it's only here to make sure I can compare a struct.
|
||||
}
|
||||
|
||||
@@ -4,4 +4,6 @@
|
||||
bool AdcModel_DoGetSample(void);
|
||||
void AdcModel_ProcessInput(uint16 millivolts);
|
||||
|
||||
bool AdcModel_DoNothingExceptTestASpecialType(EXAMPLE_STRUCT_T ExampleStruct);
|
||||
|
||||
#endif // _ADCMODEL_H
|
||||
|
||||
@@ -21,7 +21,7 @@ typedef int int32;
|
||||
typedef unsigned short uint16;
|
||||
typedef short int16;
|
||||
typedef unsigned char uint8;
|
||||
typedef char int8;
|
||||
typedef char int8;
|
||||
typedef char bool;
|
||||
|
||||
// Application Special Value Definitions
|
||||
@@ -85,4 +85,10 @@ typedef char bool;
|
||||
#define UINT32_MIN 0x00000000U
|
||||
#endif
|
||||
|
||||
typedef struct _EXAMPLE_STRUCT_T
|
||||
{
|
||||
int x;
|
||||
int y;
|
||||
} EXAMPLE_STRUCT_T;
|
||||
|
||||
#endif // _MYTYPES_H_
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "unity.h"
|
||||
#include "UnityHelper.h"
|
||||
#include "Types.h"
|
||||
#include "Types.h"
|
||||
#include "AdcConductor.h"
|
||||
@@ -44,3 +45,37 @@ void testRunShouldGetLatestSampleFromAdcAndPassItToModelAndStartNewConversionWhe
|
||||
|
||||
AdcConductor_Run();
|
||||
}
|
||||
|
||||
void testJustHereToTest_Should_ProperlyPassAStructAndVerifyIt(void)
|
||||
{
|
||||
EXAMPLE_STRUCT_T TestStruct;
|
||||
TestStruct.x = 5;
|
||||
TestStruct.y = 7;
|
||||
|
||||
AdcModel_DoNothingExceptTestASpecialType_ExpectAndReturn(TestStruct, TRUE);
|
||||
|
||||
TEST_ASSERT_TRUE(AdcConductor_JustHereToTest());
|
||||
}
|
||||
|
||||
//void testJustHereToTest_Should_FailThisTestIfYouUncommentXIsBecauseItsWrong(void)
|
||||
//{
|
||||
// EXAMPLE_STRUCT_T TestStruct;
|
||||
// TestStruct.x = 6;
|
||||
// TestStruct.y = 7;
|
||||
//
|
||||
// AdcModel_DoNothingExceptTestASpecialType_ExpectAndReturn(TestStruct, TRUE);
|
||||
//
|
||||
// TEST_ASSERT_TRUE(AdcConductor_JustHereToTest());
|
||||
//}
|
||||
//
|
||||
//void testJustHereToTest_Should_FailThisTestIfYouUncommentYIsBecauseItsWrong(void)
|
||||
//{
|
||||
// EXAMPLE_STRUCT_T TestStruct;
|
||||
// TestStruct.x = 5;
|
||||
// TestStruct.y = 8;
|
||||
//
|
||||
// AdcModel_DoNothingExceptTestASpecialType_ExpectAndReturn(TestStruct, TRUE);
|
||||
//
|
||||
// TEST_ASSERT_TRUE(AdcConductor_JustHereToTest());
|
||||
//}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user