2009-04-14 18:08:23 -04:00
|
|
|
---
|
|
|
|
:cmock:
|
|
|
|
:plugins:
|
|
|
|
- # no plugins
|
|
|
|
|
|
|
|
:systest:
|
|
|
|
:types: |
|
|
|
|
typedef unsigned short U16;
|
2009-04-15 16:17:44 -04:00
|
|
|
typedef struct _POINT_T
|
|
|
|
{
|
|
|
|
int x;
|
|
|
|
int y;
|
|
|
|
} POINT_T;
|
2009-04-14 18:08:23 -04:00
|
|
|
|
|
|
|
:mockable: |
|
2009-04-23 11:00:35 -04:00
|
|
|
// typedef edge case; must be in mockable.h (simulating preprocessed header)
|
|
|
|
typedef void VOID_TYPE_CRAZINESS;
|
2009-04-17 19:40:30 -04:00
|
|
|
|
2009-04-14 18:08:23 -04:00
|
|
|
U16 *ptr_return1(int a);
|
|
|
|
U16* ptr_return2(int a);
|
|
|
|
U16 * ptr_return3(int a);
|
|
|
|
|
|
|
|
void var_args1(int a, ...);
|
|
|
|
void var_args2(int a, int b, ...);
|
|
|
|
|
2009-04-23 11:00:35 -04:00
|
|
|
VOID_TYPE_CRAZINESS arg_list(int * a, int *b, int* c);
|
2009-04-15 16:17:44 -04:00
|
|
|
|
2009-04-17 19:40:30 -04:00
|
|
|
char
|
|
|
|
crazy_multiline(
|
|
|
|
int a,
|
|
|
|
unsigned int b);
|
|
|
|
|
2009-04-15 16:17:44 -04:00
|
|
|
unsigned int** ptr_ptr_return1(unsigned int** a);
|
|
|
|
unsigned int* *ptr_ptr_return2(unsigned int* *a);
|
|
|
|
unsigned int **ptr_ptr_return3(unsigned int **a);
|
|
|
|
unsigned int ** ptr_ptr_return4(unsigned int ** a);
|
2009-04-14 18:08:23 -04:00
|
|
|
|
2009-04-15 21:29:47 -04:00
|
|
|
unsigned long int incredible_descriptors(const unsigned short a);
|
2009-04-15 16:17:44 -04:00
|
|
|
|
2009-04-14 18:08:23 -04:00
|
|
|
:source:
|
|
|
|
:header: |
|
2009-04-17 19:40:30 -04:00
|
|
|
U16* exercise_return_pointers(int a);
|
|
|
|
void exercise_var_args(int a, int b);
|
|
|
|
void exercise_arglist_pointers(void);
|
|
|
|
char exercise_multiline_declarations(int a, unsigned int b);
|
|
|
|
void exercise_double_pointers(unsigned int a);
|
2009-05-15 02:00:47 -04:00
|
|
|
int exercise_many_descriptors(int a);
|
2009-04-15 16:17:44 -04:00
|
|
|
|
2009-04-14 18:08:23 -04:00
|
|
|
:code: |
|
|
|
|
int A, B, C;
|
2009-05-15 02:00:47 -04:00
|
|
|
|
2009-04-17 19:40:30 -04:00
|
|
|
U16* exercise_return_pointers(int a)
|
2009-04-14 18:08:23 -04:00
|
|
|
{
|
|
|
|
ptr_return1(a);
|
|
|
|
ptr_return2(a);
|
|
|
|
return ptr_return3(a);
|
|
|
|
}
|
|
|
|
|
2009-04-17 19:40:30 -04:00
|
|
|
void exercise_var_args(int a, int b)
|
2009-04-14 18:08:23 -04:00
|
|
|
{
|
|
|
|
var_args1(a, 3);
|
|
|
|
var_args2(a, b, 'c');
|
|
|
|
}
|
|
|
|
|
2009-04-17 19:40:30 -04:00
|
|
|
void exercise_arglist_pointers(void)
|
2009-04-14 18:08:23 -04:00
|
|
|
{
|
|
|
|
arg_list(&A, &B, &C);
|
|
|
|
}
|
|
|
|
|
2009-04-17 19:40:30 -04:00
|
|
|
char exercise_multiline_declarations(int a, unsigned int b)
|
|
|
|
{
|
|
|
|
return crazy_multiline(a, b);
|
|
|
|
}
|
|
|
|
|
|
|
|
void exercise_double_pointers(unsigned int a)
|
2009-04-15 16:17:44 -04:00
|
|
|
{
|
|
|
|
ptr_ptr_return1((unsigned int**)a);
|
|
|
|
ptr_ptr_return2((unsigned int**)a);
|
|
|
|
ptr_ptr_return3((unsigned int**)a);
|
|
|
|
ptr_ptr_return4((unsigned int**)a);
|
|
|
|
}
|
|
|
|
|
2009-04-17 19:40:30 -04:00
|
|
|
int exercise_many_descriptors(int a)
|
2009-04-15 16:17:44 -04:00
|
|
|
{
|
2009-04-15 21:29:47 -04:00
|
|
|
return (int)incredible_descriptors((unsigned short)a);
|
2009-04-15 16:17:44 -04:00
|
|
|
}
|
|
|
|
|
2009-04-14 18:08:23 -04:00
|
|
|
:tests:
|
|
|
|
:common: |
|
|
|
|
void setUp(void) {}
|
|
|
|
void tearDown(void) {}
|
|
|
|
|
|
|
|
extern int A, B, C;
|
|
|
|
:units:
|
|
|
|
- :pass: TRUE
|
|
|
|
:should: 'just do cursory return value check - compilation was the important part'
|
|
|
|
:code: |
|
|
|
|
test()
|
|
|
|
{
|
|
|
|
U16 retval;
|
|
|
|
ptr_return1_ExpectAndReturn(2, NULL);
|
|
|
|
ptr_return2_ExpectAndReturn(2, NULL);
|
|
|
|
ptr_return3_ExpectAndReturn(2, &retval);
|
2009-04-17 19:40:30 -04:00
|
|
|
TEST_ASSERT_EQUAL(&retval, exercise_return_pointers(2));
|
2009-04-14 18:08:23 -04:00
|
|
|
}
|
2009-04-15 16:17:44 -04:00
|
|
|
|
2009-04-14 18:08:23 -04:00
|
|
|
- :pass: TRUE
|
|
|
|
:should: 'just do cursory var arg check - compilation was the important part'
|
|
|
|
:code: |
|
|
|
|
test()
|
|
|
|
{
|
|
|
|
var_args1_Expect(2);
|
|
|
|
var_args2_Expect(2, 3);
|
2009-04-17 19:40:30 -04:00
|
|
|
exercise_var_args(2, 3);
|
2009-04-14 18:08:23 -04:00
|
|
|
}
|
2009-04-15 16:17:44 -04:00
|
|
|
|
2009-04-14 18:08:23 -04:00
|
|
|
- :pass: TRUE
|
|
|
|
:should: 'just do cursory argument list check - compilation was the important part'
|
|
|
|
:code: |
|
|
|
|
test()
|
|
|
|
{
|
|
|
|
arg_list_Expect(&A, &B, &C);
|
2009-04-17 19:40:30 -04:00
|
|
|
exercise_arglist_pointers();
|
|
|
|
}
|
|
|
|
|
|
|
|
- :pass: TRUE
|
|
|
|
:should: 'just do cursory return value check - compilation was the important part'
|
|
|
|
:code: |
|
|
|
|
test()
|
|
|
|
{
|
|
|
|
crazy_multiline_ExpectAndReturn(-10, 11, 'z');
|
|
|
|
TEST_ASSERT_EQUAL('z', exercise_multiline_declarations(-10, 11));
|
2009-04-14 18:08:23 -04:00
|
|
|
}
|
|
|
|
|
2009-04-15 16:17:44 -04:00
|
|
|
- :pass: TRUE
|
|
|
|
:should: 'just do cursory value check - compilation was the important part'
|
|
|
|
:code: |
|
|
|
|
test()
|
|
|
|
{
|
|
|
|
ptr_ptr_return1_ExpectAndReturn((unsigned int**)A, (unsigned int**)B);
|
|
|
|
ptr_ptr_return2_ExpectAndReturn((unsigned int**)A, (unsigned int**)B);
|
|
|
|
ptr_ptr_return3_ExpectAndReturn((unsigned int**)A, (unsigned int**)B);
|
|
|
|
ptr_ptr_return4_ExpectAndReturn((unsigned int**)A, (unsigned int**)B);
|
2009-04-17 19:40:30 -04:00
|
|
|
exercise_double_pointers((unsigned int)A);
|
2009-04-15 16:17:44 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
- :pass: TRUE
|
|
|
|
:should: 'just do cursory return value check - compilation was the important part'
|
|
|
|
:code: |
|
|
|
|
test()
|
|
|
|
{
|
|
|
|
incredible_descriptors_ExpectAndReturn(888, 777);
|
2009-04-17 19:40:30 -04:00
|
|
|
TEST_ASSERT_EQUAL(777, exercise_many_descriptors(888));
|
2009-04-15 16:17:44 -04:00
|
|
|
}
|
2009-05-15 02:00:47 -04:00
|
|
|
|
|
|
|
|
2009-04-14 18:08:23 -04:00
|
|
|
...
|