mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-10-12 03:47:26 +00:00
resolved conflicts
This commit is contained in:
@@ -14,6 +14,7 @@ class CMockGeneratorUtils
|
|||||||
@ordered = @config.enforce_strict_ordering
|
@ordered = @config.enforce_strict_ordering
|
||||||
@arrays = @config.plugins.include? :array
|
@arrays = @config.plugins.include? :array
|
||||||
@cexception = @config.plugins.include? :cexception
|
@cexception = @config.plugins.include? :cexception
|
||||||
|
@expect_any = @config.plugins.include? :expect_any_args
|
||||||
@return_thru_ptr = @config.plugins.include? :return_thru_ptr
|
@return_thru_ptr = @config.plugins.include? :return_thru_ptr
|
||||||
@ignore_arg = @config.plugins.include? :ignore_arg
|
@ignore_arg = @config.plugins.include? :ignore_arg
|
||||||
@treat_as = @config.treat_as
|
@treat_as = @config.treat_as
|
||||||
@@ -40,6 +41,7 @@ class CMockGeneratorUtils
|
|||||||
lines << " cmock_call_instance->LineNumber = cmock_line;\n"
|
lines << " cmock_call_instance->LineNumber = cmock_line;\n"
|
||||||
lines << " cmock_call_instance->CallOrder = ++GlobalExpectCount;\n" if (@ordered and global_ordering_supported)
|
lines << " cmock_call_instance->CallOrder = ++GlobalExpectCount;\n" if (@ordered and global_ordering_supported)
|
||||||
lines << " cmock_call_instance->ExceptionToThrow = CEXCEPTION_NONE;\n" if (@cexception)
|
lines << " cmock_call_instance->ExceptionToThrow = CEXCEPTION_NONE;\n" if (@cexception)
|
||||||
|
lines << " cmock_call_instance->IgnoreMode = CMOCK_ARG_ALL;\n" if (@expect_any)
|
||||||
lines
|
lines
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -183,15 +185,11 @@ class CMockGeneratorUtils
|
|||||||
c_type_local = c_type.gsub(/\*$/,'')
|
c_type_local = c_type.gsub(/\*$/,'')
|
||||||
lines << " UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type_local}), cmock_line, \"#{unity_msg}\");\n"
|
lines << " UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type_local}), cmock_line, \"#{unity_msg}\");\n"
|
||||||
when "UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY"
|
when "UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY"
|
||||||
if (pre == '&')
|
lines << " if (#{pre}#{expected} == NULL)\n"
|
||||||
lines << " UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type.sub('*','')}), #{depth_name}, cmock_line, \"#{unity_msg}\");\n"
|
lines << " { UNITY_TEST_ASSERT_NULL(#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }\n"
|
||||||
else
|
lines << ((depth_name != 1) ? " else if (#{depth_name} == 0)\n { UNITY_TEST_ASSERT_EQUAL_PTR(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\"); }\n" : "")
|
||||||
lines << " if (#{pre}#{expected} == NULL)\n"
|
lines << " else\n"
|
||||||
lines << " { UNITY_TEST_ASSERT_NULL(#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }\n"
|
lines << " { UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type.sub('*','')}), #{depth_name}, cmock_line, \"#{unity_msg}\"); }\n"
|
||||||
lines << ((depth_name != 1) ? " else if (#{depth_name} == 0)\n { UNITY_TEST_ASSERT_EQUAL_PTR(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\"); }\n" : "")
|
|
||||||
lines << " else\n"
|
|
||||||
lines << " { UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type.sub('*','')}), #{depth_name}, cmock_line, \"#{unity_msg}\"); }\n"
|
|
||||||
end
|
|
||||||
when /_ARRAY/
|
when /_ARRAY/
|
||||||
if (pre == '&')
|
if (pre == '&')
|
||||||
lines << " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, #{depth_name}, cmock_line, \"#{unity_msg}\");\n"
|
lines << " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, #{depth_name}, cmock_line, \"#{unity_msg}\");\n"
|
||||||
|
|||||||
@@ -279,7 +279,7 @@ class CMockGeneratorUtilsTest < Test::Unit::TestCase
|
|||||||
should 'handle custom types as memory compares when we have no better way to do it with array plugin enabled' do
|
should 'handle custom types as memory compares when we have no better way to do it with array plugin enabled' do
|
||||||
function = { :name => 'Pear' }
|
function = { :name => 'Pear' }
|
||||||
arg = test_arg[:mytype]
|
arg = test_arg[:mytype]
|
||||||
expected = " if (!cmock_call_instance->IgnoreArg_MyMyType)\n {\n UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY((void*)(&cmock_call_instance->Expected_MyMyType), (void*)(&MyMyType), sizeof(MY_TYPE), 1, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyType'.\");\n }\n"
|
expected = " if (!cmock_call_instance->IgnoreArg_MyMyType)\n {\n if (&cmock_call_instance->Expected_MyMyType == NULL)\n { UNITY_TEST_ASSERT_NULL(MyMyType, cmock_line, \"Expected NULL. Function 'Pear' called with unexpected value for argument 'MyMyType'.\"); }\n else\n { UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY((void*)(&cmock_call_instance->Expected_MyMyType), (void*)(&MyMyType), sizeof(MY_TYPE), 1, cmock_line, \"Function 'Pear' called with unexpected value for argument 'MyMyType'.\"); }\n }\n"
|
||||||
@unity_helper.expect.get_helper('MY_TYPE').returns(['UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY','&'])
|
@unity_helper.expect.get_helper('MY_TYPE').returns(['UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY','&'])
|
||||||
assert_equal(expected, @cmock_generator_utils_complex.code_verify_an_arg_expectation(function, arg))
|
assert_equal(expected, @cmock_generator_utils_complex.code_verify_an_arg_expectation(function, arg))
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user