| 1 |
--- |
| 2 |
|
| 3 |
:cmock: |
| 4 |
:enforce_strict_ordering: 1 |
| 5 |
:plugins: |
| 6 |
- :array |
| 7 |
- :cexception |
| 8 |
- :ignore |
| 9 |
|
| 10 |
:systest: |
| 11 |
:types: | |
| 12 |
typedef struct _POINT_T { |
| 13 |
int x; |
| 14 |
int y; |
| 15 |
} POINT_T; |
| 16 |
|
| 17 |
:mockable: | |
| 18 |
#include "CException.h" |
| 19 |
void foos(const char const * a); |
| 20 |
const char const * bars(void); |
| 21 |
|
| 22 |
:source: |
| 23 |
:header: | |
| 24 |
#include "CException.h" |
| 25 |
void function_a(void); |
| 26 |
void function_b(void); |
| 27 |
void function_c(void); |
| 28 |
int function_d(void); |
| 29 |
|
| 30 |
:code: | |
| 31 |
void function_c(void) { |
| 32 |
CEXCEPTION_T e; |
| 33 |
Try { |
| 34 |
foos(bars()); |
| 35 |
} Catch(e) { foos("err"); } |
| 36 |
} |
| 37 |
|
| 38 |
:tests: |
| 39 |
:common: | |
| 40 |
#include "CException.h" |
| 41 |
void setUp(void) {} |
| 42 |
void tearDown(void) {} |
| 43 |
|
| 44 |
:units: |
| 45 |
- :pass: TRUE |
| 46 |
:should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, passing' |
| 47 |
:code: | |
| 48 |
test() |
| 49 |
{ |
| 50 |
bars_ExpectAndReturn("This is a\0 silly string"); |
| 51 |
foos_Expect("This is a\0 wacky string"); |
| 52 |
|
| 53 |
function_c(); |
| 54 |
} |
| 55 |
|
| 56 |
- :pass: FALSE |
| 57 |
:should: 'handle standard c string as null terminated on not do crappy memory compares of a byte, finding failures' |
| 58 |
:code: | |
| 59 |
test() |
| 60 |
{ |
| 61 |
bars_ExpectAndReturn("This is a silly string"); |
| 62 |
foos_Expect("This is a wacky string"); |
| 63 |
|
| 64 |
function_c(); |
| 65 |
} |
| 66 |
|
| 67 |
- :pass: TRUE |
| 68 |
:should: 'handle an exception being caught' |
| 69 |
:code: | |
| 70 |
test() |
| 71 |
{ |
| 72 |
bars_ExpectAndReturn("This is a\0 silly string"); |
| 73 |
foos_ExpectAndThrow("This is a\0 wacky string", 55); |
| 74 |
foos_Expect("err"); |
| 75 |
|
| 76 |
function_c(); |
| 77 |
} |
| 78 |
|
| 79 |
- :pass: FALSE |
| 80 |
:should: 'handle an exception being caught but still catch following errors' |
| 81 |
:code: | |
| 82 |
test() |
| 83 |
{ |
| 84 |
bars_ExpectAndReturn("This is a\0 silly string"); |
| 85 |
foos_ExpectAndThrow("This is a\0 wacky string", 55); |
| 86 |
foos_Expect("wrong error"); |
| 87 |
|
| 88 |
function_c(); |
| 89 |
} |
| 90 |
|
| 91 |
... |