| 1 |
--- |
| 2 |
|
| 3 |
:cmock: |
| 4 |
:plugins: |
| 5 |
- :array |
| 6 |
- :ignore |
| 7 |
|
| 8 |
:systest: |
| 9 |
:types: | |
| 10 |
#include "unity_internals.h" |
| 11 |
typedef UNITY_UINT64 TEST64; |
| 12 |
|
| 13 |
:mockable: | |
| 14 |
TEST64 foo(TEST64 a); |
| 15 |
TEST64* bar(TEST64* b); |
| 16 |
|
| 17 |
:source: |
| 18 |
:header: | |
| 19 |
TEST64 function_a(void); |
| 20 |
|
| 21 |
:code: | |
| 22 |
TEST64 function_a(void) { |
| 23 |
TEST64 a = 0x1234567890123456; |
| 24 |
TEST64 b; |
| 25 |
TEST64* c; |
| 26 |
|
| 27 |
b = foo(a); |
| 28 |
c = bar(&b); |
| 29 |
return *c; |
| 30 |
} |
| 31 |
|
| 32 |
:tests: |
| 33 |
:common: | |
| 34 |
void setUp(void) {} |
| 35 |
void tearDown(void) {} |
| 36 |
|
| 37 |
:units: |
| 38 |
- :pass: TRUE |
| 39 |
:should: 'handle a straightforward 64-bit series of calls' |
| 40 |
:code: | |
| 41 |
test() |
| 42 |
{ |
| 43 |
TEST64 a = 0x0987654321543210; |
| 44 |
TEST64 b = 0x5a5a5a5a5a5a5a5a; |
| 45 |
foo_ExpectAndReturn(0x1234567890123456, 0x0987654321543210); |
| 46 |
bar_ExpectAndReturn(&a, &b); |
| 47 |
|
| 48 |
TEST_ASSERT_EQUAL_HEX64(b, function_a()); |
| 49 |
} |
| 50 |
|
| 51 |
- :pass: FALSE |
| 52 |
:should: 'handle a straightforward 64-bit series of calls with a failure' |
| 53 |
:code: | |
| 54 |
test() |
| 55 |
{ |
| 56 |
TEST64 a = 0x0987654321543210; |
| 57 |
TEST64 b = 0x5a5a5a5a5a5a5a5a; |
| 58 |
foo_ExpectAndReturn(0x1234567890123456, 0x0987654321543211); |
| 59 |
bar_ExpectAndReturn(&a, &b); |
| 60 |
|
| 61 |
TEST_ASSERT_EQUAL_HEX64(b, function_a()); |
| 62 |
} |
| 63 |
|
| 64 |
- :pass: FALSE |
| 65 |
:should: 'handle a straightforward 64-bit series of calls returning a failure' |
| 66 |
:code: | |
| 67 |
test() |
| 68 |
{ |
| 69 |
TEST64 a = 0x0987654321543210; |
| 70 |
TEST64 b = 0x5a5a5a5a5a5a5a5a; |
| 71 |
foo_ExpectAndReturn(0x1234567890123456, 0x0987654321543210); |
| 72 |
bar_ExpectAndReturn(&a, &b); |
| 73 |
|
| 74 |
TEST_ASSERT_EQUAL_HEX64(b+1, function_a()); |
| 75 |
} |
| 76 |
|
| 77 |
... |