* 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:
mvandervoord
2009-02-19 03:28:53 +00:00
parent c7ec4f5b9a
commit 492e319e11
25 changed files with 259 additions and 101 deletions
+9
View File
@@ -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);
}
+2
View File
@@ -4,4 +4,6 @@
void AdcConductor_Init(void);
void AdcConductor_Run(void);
bool AdcConductor_JustHereToTest(void);
#endif // _ADCCONDUCTOR_H
-1
View File
@@ -16,4 +16,3 @@ void Adc_EnableTemperatureChannel(void)
{
AT91C_BASE_ADC->ADC_CHER = 0x10;
}
+4
View File
@@ -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.
}
+2
View File
@@ -4,4 +4,6 @@
bool AdcModel_DoGetSample(void);
void AdcModel_ProcessInput(uint16 millivolts);
bool AdcModel_DoNothingExceptTestASpecialType(EXAMPLE_STRUCT_T ExampleStruct);
#endif // _ADCMODEL_H
+7 -1
View File
@@ -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_
+35
View File
@@ -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());
//}