diff --git a/docs/CMock Summary.odt b/docs/CMock Summary.odt index 510b8ba..2b0d349 100644 Binary files a/docs/CMock Summary.odt and b/docs/CMock Summary.odt differ diff --git a/docs/CMock Summary.pdf b/docs/CMock Summary.pdf index 2b95753..c7d154c 100644 Binary files a/docs/CMock Summary.pdf and b/docs/CMock Summary.pdf differ diff --git a/lib/cmock_config.rb b/lib/cmock_config.rb index df7ceb4..9332e05 100644 --- a/lib/cmock_config.rb +++ b/lib/cmock_config.rb @@ -19,7 +19,6 @@ class CMockConfig :treat_as => {}, :treat_as_void => [], :memcmp_if_unknown => true, - :ptr_size => 32, :when_no_prototypes => :warn, #the options being :ignore, :warn, or :error :when_ptr => :compare_data, #the options being :compare_ptr, :compare_data, or :smart :verbosity => 2, #the options being 0 errors only, 1 warnings and errors, 2 normal info, 3 verbose diff --git a/lib/cmock_generator_utils.rb b/lib/cmock_generator_utils.rb index d16d581..a3e323c 100644 --- a/lib/cmock_generator_utils.rb +++ b/lib/cmock_generator_utils.rb @@ -15,7 +15,6 @@ class CMockGeneratorUtils @arrays = @config.plugins.include? :array @cexception = @config.plugins.include? :cexception @treat_as = @config.treat_as - @ptr_compare_assert = "UNITY_TEST_ASSERT_EQUAL_HEX#{@config.ptr_size.to_s}" @helpers = helpers if (@arrays) @@ -91,7 +90,7 @@ class CMockGeneratorUtils arg_name = arg[:name] expected = "cmock_call_instance->Expected_#{arg_name}" unity_func = if ((arg[:ptr?]) and ((c_type =~ /\*\*/) or (@ptr_handling == :compare_ptr))) - [@ptr_compare_assert, ''] + ['UNITY_TEST_ASSERT_EQUAL_PTR', ''] else (@helpers.nil? or @helpers[:unity_helper].nil?) ? ["UNITY_TEST_ASSERT_EQUAL",''] : @helpers[:unity_helper].get_helper(c_type) end @@ -156,7 +155,7 @@ class CMockGeneratorUtils when "UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY" [ " if (#{pre}#{expected} == NULL)", " { UNITY_TEST_ASSERT_NULL(#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }", - ((depth_name != 1) ? " else if (#{depth_name} == 0)\n { #{@ptr_compare_assert}(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\"); }" : nil), + ((depth_name != 1) ? " else if (#{depth_name} == 0)\n { UNITY_TEST_ASSERT_EQUAL_PTR(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\"); }" : nil), " else", " { UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type.sub('*','')}), #{depth_name}, cmock_line, \"#{unity_msg}\"); }\n"].compact.join("\n") when /_ARRAY/ @@ -165,7 +164,7 @@ class CMockGeneratorUtils else [ " if (#{pre}#{expected} == NULL)", " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }", - ((depth_name != 1) ? " else if (#{depth_name} == 0)\n { #{@ptr_compare_assert}(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\"); }" : nil), + ((depth_name != 1) ? " else if (#{depth_name} == 0)\n { UNITY_TEST_ASSERT_EQUAL_PTR(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\"); }" : nil), " else", " { #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, #{depth_name}, cmock_line, \"#{unity_msg}\"); }\n"].compact.join("\n") end diff --git a/test/unit/cmock_generator_utils_test.rb b/test/unit/cmock_generator_utils_test.rb index 0b0c0e0..77c5feb 100644 --- a/test/unit/cmock_generator_utils_test.rb +++ b/test/unit/cmock_generator_utils_test.rb @@ -16,7 +16,6 @@ class CMockGeneratorUtilsTest < Test::Unit::TestCase @config.expect.plugins.returns([]) @config.expect.plugins.returns([]) @config.expect.treat_as.returns(['int','short','long','char','char*']) - @config.expect.ptr_size.returns(32) @cmock_generator_utils_simple = CMockGeneratorUtils.new(@config, {:unity_helper => @unity_helper}) @config.expect.when_ptr.returns(:smart) @@ -24,7 +23,6 @@ class CMockGeneratorUtilsTest < Test::Unit::TestCase @config.expect.plugins.returns([:array, :cexception]) @config.expect.plugins.returns([:array, :cexception]) @config.expect.treat_as.returns(['int','short','long','char','uint32_t','char*']) - @config.expect.ptr_size.returns(32) @cmock_generator_utils_complex = CMockGeneratorUtils.new(@config, {:unity_helper => @unity_helper, :A=>1, :B=>2}) end @@ -186,7 +184,7 @@ class CMockGeneratorUtilsTest < Test::Unit::TestCase should 'handle a pointer comparison when configured to do so' do function = { :name => 'Pear' } arg = test_arg[:int_ptr] - expected = " UNITY_TEST_ASSERT_EQUAL_HEX32(cmock_call_instance->Expected_MyIntPtr, MyIntPtr, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyIntPtr'.\");\n" + expected = " UNITY_TEST_ASSERT_EQUAL_PTR(cmock_call_instance->Expected_MyIntPtr, MyIntPtr, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyIntPtr'.\");\n" assert_equal(expected, @cmock_generator_utils_simple.code_verify_an_arg_expectation(function, arg)) end @@ -236,7 +234,7 @@ class CMockGeneratorUtilsTest < Test::Unit::TestCase expected = " if (cmock_call_instance->Expected_MyIntPtr == NULL)\n" + " { UNITY_TEST_ASSERT_NULL(MyIntPtr, cmock_line, \"Expected NULL. Function 'Pear' called with unexpected value for argument 'MyIntPtr'.\"); }\n" + " else if (cmock_call_instance->Expected_MyIntPtr_Depth == 0)\n" + - " { UNITY_TEST_ASSERT_EQUAL_HEX32(cmock_call_instance->Expected_MyIntPtr, MyIntPtr, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyIntPtr'.\"); }\n" + + " { UNITY_TEST_ASSERT_EQUAL_PTR(cmock_call_instance->Expected_MyIntPtr, MyIntPtr, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyIntPtr'.\"); }\n" + " else\n" + " { UNITY_TEST_ASSERT_EQUAL_INT_ARRAY(cmock_call_instance->Expected_MyIntPtr, MyIntPtr, cmock_call_instance->Expected_MyIntPtr_Depth, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyIntPtr'.\"); }\n" @unity_helper.expect.get_helper('int*').returns(['UNITY_TEST_ASSERT_EQUAL_INT_ARRAY','']) @@ -273,7 +271,7 @@ class CMockGeneratorUtilsTest < Test::Unit::TestCase expected = " if (cmock_call_instance->Expected_MyMyTypePtr == NULL)\n" + " { UNITY_TEST_ASSERT_NULL(MyMyTypePtr, cmock_line, \"Expected NULL. Function 'Pear' called with unexpected value for argument 'MyMyTypePtr'.\"); }\n" + " else if (cmock_call_instance->Expected_MyMyTypePtr_Depth == 0)\n" + - " { UNITY_TEST_ASSERT_EQUAL_HEX32(cmock_call_instance->Expected_MyMyTypePtr, MyMyTypePtr, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyTypePtr'.\"); }\n" + + " { UNITY_TEST_ASSERT_EQUAL_PTR(cmock_call_instance->Expected_MyMyTypePtr, MyMyTypePtr, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyTypePtr'.\"); }\n" + " else\n" + " { UNITY_TEST_ASSERT_EQUAL_MY_TYPE_ARRAY(cmock_call_instance->Expected_MyMyTypePtr, MyMyTypePtr, cmock_call_instance->Expected_MyMyTypePtr_Depth, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyTypePtr'.\"); }\n" @unity_helper.expect.get_helper('MY_TYPE*').returns(['UNITY_TEST_ASSERT_EQUAL_MY_TYPE_ARRAY',''])