From c4b30f25edd51af83e97638d1bfa98d79510714a Mon Sep 17 00:00:00 2001 From: mvandervoord Date: Wed, 9 Jun 2010 02:00:21 +0000 Subject: [PATCH] - default treat_as updated to take advantage of unity's new array size options git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@165 bf332499-1b4d-0410-844d-d2d48d5cc64c --- lib/cmock_config.rb | 16 +++++----- .../array_and_pointer_handling.yml | 31 ++++++++++++++++++- 2 files changed, 38 insertions(+), 9 deletions(-) diff --git a/lib/cmock_config.rb b/lib/cmock_config.rb index bf8e64c..1f1bbb3 100644 --- a/lib/cmock_config.rb +++ b/lib/cmock_config.rb @@ -68,17 +68,17 @@ class CMockConfig def standard_treat_as_map { 'int' => 'INT', - 'char' => 'INT', - 'short' => 'INT', + 'char' => 'INT8', + 'short' => 'INT16', 'long' => 'INT', - 'int8' => 'INT', - 'int16' => 'INT', + 'int8' => 'INT8', + 'int16' => 'INT16', 'int32' => 'INT', - 'int8_t' => 'INT', - 'int16_t' => 'INT', + 'int8_t' => 'INT8', + 'int16_t' => 'INT16', 'int32_t' => 'INT', - 'INT8_T' => 'INT', - 'INT16_T' => 'INT', + 'INT8_T' => 'INT8', + 'INT16_T' => 'INT16', 'INT32_T' => 'INT', 'bool' => 'INT', 'bool_t' => 'INT', diff --git a/test/system/test_interactions/array_and_pointer_handling.yml b/test/system/test_interactions/array_and_pointer_handling.yml index 4faac9b..773b46d 100644 --- a/test/system/test_interactions/array_and_pointer_handling.yml +++ b/test/system/test_interactions/array_and_pointer_handling.yml @@ -19,13 +19,15 @@ const char * bars(void); void no_pointers(int a, char* b); int mixed(int a, int* b, int c); + void potential_packing_problem(short *a); :source: :header: | void function_a(void); void function_b(void); void function_c(void); - int function_d(void); + int function_d(void); + void function_e(void); :code: | void function_a(void) @@ -47,6 +49,11 @@ return mixed(6, test_list, 7); } + void function_e(void) { + short test_list[] = {-1, -2, -3, -4}; + potential_packing_problem(&test_list[1]); + } + :tests: :common: | void setUp(void) {} @@ -348,5 +355,27 @@ TEST_ASSERT_EQUAL(13, function_d()); } + - :pass: TRUE + :should: 'handle a passing version of a potential packing problem (particularly try with ARM simulators)' + :code: | + test() + { + short expect_list[] = { -2, -3, -4 }; + potential_packing_problem_ExpectWithArray(expect_list, 3); + + function_e(); + } + + - :pass: FALSE + :should: 'handle a failing version of a potential packing problem (particularly try with ARM simulators)' + :code: | + test() + { + short expect_list[] = { -2, -3, 4 }; + potential_packing_problem_ExpectWithArray(expect_list, 3); + + function_e(); + } + ...