forked from ThrowTheSwitch/CMock
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- beefed up 64-bit testing git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@200 bf332499-1b4d-0410-844d-d2d48d5cc64c
- Loading branch information
mvandervoord
committed
Dec 29, 2010
1 parent
53d2c85
commit cee9277
Showing
14 changed files
with
174 additions
and
37 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
--- | ||
compiler: | ||
path: gcc | ||
source_path: &systest_generated_path 'test/system/generated/' | ||
unit_tests_path: &unit_tests_path 'examples/test/' | ||
mocks_path: &systest_mocks_path 'test/system/generated/' | ||
build_path: &systest_build_path 'test/system/build/' | ||
options: | ||
- '-c' | ||
- '-Wall' | ||
- '-Wno-address' | ||
- '-std=c99' | ||
- '-pedantic' | ||
includes: | ||
prefix: '-I' | ||
items: | ||
- *systest_generated_path | ||
- *unit_tests_path | ||
- *systest_mocks_path | ||
- 'src/' | ||
- 'vendor/unity/src/' | ||
- 'vendor/c_exception/lib/' | ||
- 'test/system/test_compilation/' | ||
- 'test/' | ||
defines: | ||
prefix: '-D' | ||
items: | ||
- UNITY_SUPPORT_64 | ||
- UNITY_LONG_WIDTH=32 | ||
- 'CMOCK_MEM_PTR_AS_INT=long' | ||
object_files: | ||
prefix: '-o' | ||
extension: '.o' | ||
destination: *systest_build_path | ||
|
||
linker: | ||
path: gcc | ||
options: | ||
- -lm | ||
includes: | ||
prefix: '-I' | ||
object_files: | ||
path: *systest_build_path | ||
extension: '.o' | ||
bin_files: | ||
prefix: '-o' | ||
extension: '.exe' | ||
destination: *systest_build_path | ||
|
||
unsupported: [] | ||
|
||
colour: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -102,5 +102,6 @@ simulator: | |
unsupported: | ||
- nonstandard_parsed_stuff_1 | ||
- const | ||
- unity_64bit_support | ||
|
||
colour: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,5 +87,6 @@ simulator: | |
unsupported: | ||
- nonstandard_parsed_stuff_1 | ||
- const | ||
- unity_64bit_support | ||
|
||
colour: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
--- | ||
#The purpose of this test is to play with things 64-bit integers, which aren't supported by all compilers | ||
:cmock: | ||
:plugins: | ||
- :array | ||
- :ignore | ||
|
||
:systest: | ||
:types: | | ||
#if (UNITY_LONG_WIDTH == 32) | ||
typedef unsigned long long TEST64; | ||
#elif (UNITY_LONG_WIDTH == 64) | ||
typedef unsigned long TEST64; | ||
#else | ||
#error This Test Should Not Be Run Unless You Have 64 Bit Support Enabled | ||
#endif | ||
:mockable: | | ||
TEST64 foo(TEST64 a); | ||
TEST64* bar(TEST64* b); | ||
:source: | ||
:header: | | ||
TEST64 function_a(void); | ||
:code: | | ||
TEST64 function_a(void) { | ||
TEST64 a = 0x1234567890123456; | ||
TEST64 b; | ||
TEST64* c; | ||
b = foo(a); | ||
c = bar(&b); | ||
return *c; | ||
} | ||
:tests: | ||
:common: | | ||
void setUp(void) {} | ||
void tearDown(void) {} | ||
:units: | ||
- :pass: TRUE | ||
:should: 'handle a straightforward 64-bit series of calls' | ||
:code: | | ||
test() | ||
{ | ||
TEST64 a = 0x0987654321543210; | ||
TEST64 b = 0x5a5a5a5a5a5a5a5a; | ||
foo_ExpectAndReturn(0x1234567890123456, 0x0987654321543210); | ||
bar_ExpectAndReturn(&a, &b); | ||
TEST_ASSERT_EQUAL_HEX64(b, function_a()); | ||
} | ||
- :pass: FALSE | ||
:should: 'handle a straightforward 64-bit series of calls with a failure' | ||
:code: | | ||
test() | ||
{ | ||
TEST64 a = 0x0987654321543210; | ||
TEST64 b = 0x5a5a5a5a5a5a5a5a; | ||
foo_ExpectAndReturn(0x1234567890123456, 0x0987654321543211); | ||
bar_ExpectAndReturn(&a, &b); | ||
TEST_ASSERT_EQUAL_HEX64(b, function_a()); | ||
} | ||
- :pass: FALSE | ||
:should: 'handle a straightforward 64-bit series of calls returning a failure' | ||
:code: | | ||
test() | ||
{ | ||
TEST64 a = 0x0987654321543210; | ||
TEST64 b = 0x5a5a5a5a5a5a5a5a; | ||
foo_ExpectAndReturn(0x1234567890123456, 0x0987654321543210); | ||
bar_ExpectAndReturn(&a, &b); | ||
TEST_ASSERT_EQUAL_HEX64(b+1, function_a()); | ||
} | ||
... |