mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-07-31 16:27:49 +00:00
* updated CMock internal variable and function names to avoid naming conflicts.
git-svn-id: http://cmock.svn.sourceforge.net/svnroot/cmock/trunk@152 bf332499-1b4d-0410-844d-d2d48d5cc64c
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
|
||||
class CMockGeneratorPluginArray
|
||||
|
||||
|
||||
attr_reader :priority
|
||||
attr_accessor :config, :utils, :unity_helper, :ordered
|
||||
|
||||
def initialize(config, utils)
|
||||
@config = config
|
||||
@ptr_handling = @config.when_ptr
|
||||
@@ -12,7 +10,7 @@ class CMockGeneratorPluginArray
|
||||
@unity_helper = @utils.helpers[:unity_helper]
|
||||
@priority = 8
|
||||
end
|
||||
|
||||
|
||||
def instance_structure(function)
|
||||
lines = ""
|
||||
function[:args].each do |arg|
|
||||
@@ -20,7 +18,7 @@ class CMockGeneratorPluginArray
|
||||
end
|
||||
lines
|
||||
end
|
||||
|
||||
|
||||
def mock_function_declarations(function)
|
||||
return nil unless function[:contains_ptr?]
|
||||
if (function[:args_string] == "void")
|
||||
@@ -29,7 +27,7 @@ class CMockGeneratorPluginArray
|
||||
else
|
||||
return "void #{function[:name]}_ExpectWithArrayAndReturn(#{function[:return_string]});\n"
|
||||
end
|
||||
else
|
||||
else
|
||||
args_string = function[:args].map{|m| m[:ptr?] ? "#{m[:type]} #{m[:name]}, int #{m[:name]}_Depth" : "#{m[:type]} #{m[:name]}"}.join(', ')
|
||||
if (function[:return_type] == 'void')
|
||||
return "void #{function[:name]}_ExpectWithArray(#{args_string});\n"
|
||||
@@ -38,7 +36,7 @@ class CMockGeneratorPluginArray
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def mock_interfaces(function)
|
||||
return nil unless function[:contains_ptr?]
|
||||
|
||||
@@ -46,7 +44,7 @@ class CMockGeneratorPluginArray
|
||||
func_name = function[:name]
|
||||
args_string = function[:args].map{|m| m[:ptr?] ? "#{m[:type]} #{m[:name]}, int #{m[:name]}_Depth" : "#{m[:type]} #{m[:name]}"}.join(', ')
|
||||
call_string = function[:args].map{|m| m[:ptr?] ? "#{m[:name]}, #{m[:name]}_Depth" : m[:name]}.join(', ')
|
||||
|
||||
|
||||
# Parameter Helper Function
|
||||
if (function[:args_string] != "void")
|
||||
lines << "void ExpectParametersWithArray_#{func_name}(#{args_string})\n{\n"
|
||||
@@ -55,7 +53,7 @@ class CMockGeneratorPluginArray
|
||||
end
|
||||
lines << "}\n\n"
|
||||
end
|
||||
|
||||
|
||||
#Main Mock Interface
|
||||
if (function[:return_type] == "void")
|
||||
lines << "void #{func_name}_ExpectWithArray(#{args_string})\n"
|
||||
@@ -65,15 +63,15 @@ class CMockGeneratorPluginArray
|
||||
lines << "{\n"
|
||||
lines << @utils.code_add_base_expectation(func_name)
|
||||
lines << " ExpectParametersWithArray_#{func_name}(#{call_string});\n"
|
||||
|
||||
|
||||
if (function[:return_type] != "void")
|
||||
lines << @utils.code_insert_item_into_expect_array(function[:return_type], "Mock.#{func_name}_Return", 'toReturn')
|
||||
lines << @utils.code_insert_item_into_expect_array(function[:return_type], "Mock.#{func_name}_Return", 'cmock_to_return')
|
||||
lines << " Mock.#{func_name}_Return = Mock.#{func_name}_Return_Head;\n"
|
||||
lines << " Mock.#{func_name}_Return += Mock.#{func_name}_CallCount;\n"
|
||||
end
|
||||
lines << "}\n\n"
|
||||
end
|
||||
|
||||
|
||||
def mock_destroy(function)
|
||||
lines = []
|
||||
function[:args].each do |arg|
|
||||
@@ -81,9 +79,9 @@ class CMockGeneratorPluginArray
|
||||
end
|
||||
lines.flatten
|
||||
end
|
||||
|
||||
|
||||
private #####################
|
||||
|
||||
|
||||
INSTANCE_STRUCTURE_DEPTH_SNIPPET = %q[
|
||||
int* %1$s_Depth;
|
||||
int* %1$s_Depth_Head;
|
||||
|
||||
@@ -41,7 +41,7 @@ class CMockGeneratorPluginCexception
|
||||
@utils.code_insert_item_into_expect_array('int', "Mock.#{function[:name]}_ThrowOnCallCount", "Mock.#{function[:name]}_CallsExpected"),
|
||||
@utils.code_insert_item_into_expect_array('CEXCEPTION_T', "Mock.#{function[:name]}_ThrowValue", "toThrow"),
|
||||
(MOCK_INTERFACE_THROW_HANDLING_SNIPPET % function[:name]),
|
||||
(function[:args_string] != "void") ? " ExpectParameters_#{function[:name]}(#{call_string});\n" : nil,
|
||||
(function[:args_string] != "void") ? " CMockExpectParameters_#{function[:name]}(#{call_string});\n" : nil,
|
||||
"}\n\n" ].join
|
||||
end
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ class CMockGeneratorPluginExpect
|
||||
|
||||
# Parameter Helper Function
|
||||
if (function[:args_string] != "void")
|
||||
lines << "void ExpectParameters_#{func_name}(#{function[:args_string]})\n{\n"
|
||||
lines << "void CMockExpectParameters_#{func_name}(#{function[:args_string]})\n{\n"
|
||||
function[:args].each do |arg|
|
||||
lines << @utils.code_add_an_arg_expectation(function, arg)
|
||||
end
|
||||
@@ -85,11 +85,11 @@ class CMockGeneratorPluginExpect
|
||||
lines << @utils.code_add_base_expectation(func_name)
|
||||
|
||||
if (function[:args_string] != "void")
|
||||
lines << " ExpectParameters_#{func_name}(#{function[:args].map{|m| m[:name]}.join(', ')});\n"
|
||||
lines << " CMockExpectParameters_#{func_name}(#{function[:args].map{|m| m[:name]}.join(', ')});\n"
|
||||
end
|
||||
|
||||
if (function[:return_type] != "void")
|
||||
lines << @utils.code_insert_item_into_expect_array(function[:return_type], "Mock.#{func_name}_Return", 'toReturn')
|
||||
lines << @utils.code_insert_item_into_expect_array(function[:return_type], "Mock.#{func_name}_Return", 'cmock_to_return')
|
||||
lines << " Mock.#{func_name}_Return = Mock.#{func_name}_Return_Head;\n"
|
||||
lines << " Mock.#{func_name}_Return += Mock.#{func_name}_CallCount;\n"
|
||||
end
|
||||
@@ -140,16 +140,16 @@ class CMockGeneratorPluginExpect
|
||||
]
|
||||
|
||||
MOCK_IMPLEMENT_ORDERED_SNIPPET = %q[ {
|
||||
int* p_expected = Mock.%1$s_CallOrder;
|
||||
int* cmock_val_expected = Mock.%1$s_CallOrder;
|
||||
++GlobalVerifyOrder;
|
||||
if (Mock.%1$s_CallOrder != Mock.%1$s_CallOrder_Tail)
|
||||
Mock.%1$s_CallOrder++;
|
||||
if ((*p_expected != GlobalVerifyOrder) && (GlobalOrderError == NULL))
|
||||
if ((*cmock_val_expected != GlobalVerifyOrder) && (GlobalOrderError == NULL))
|
||||
{
|
||||
const char* ErrStr = "%2$s";
|
||||
const char* cmock_err_str = "%2$s";
|
||||
GlobalOrderError = malloc(%3$s);
|
||||
if (GlobalOrderError)
|
||||
strcpy(GlobalOrderError, ErrStr);
|
||||
strcpy(GlobalOrderError, cmock_err_str);
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
@@ -36,7 +36,7 @@ class CMockGeneratorPluginIgnore
|
||||
if (function[:return_type] == "void")
|
||||
MOCK_INTERFACE_VOID_SNIPPET % function[:name]
|
||||
else
|
||||
item_insert = @utils.code_insert_item_into_expect_array(function[:return_type], "Mock.#{function[:name]}_Return", 'toReturn')
|
||||
item_insert = @utils.code_insert_item_into_expect_array(function[:return_type], "Mock.#{function[:name]}_Return", 'cmock_to_return')
|
||||
MOCK_INTERFACE_FULL_SNIPPET % [function[:name], function[:return_string], item_insert]
|
||||
end
|
||||
end
|
||||
@@ -46,11 +46,11 @@ class CMockGeneratorPluginIgnore
|
||||
MOCK_IMPLEMENT_PREFIX_SNIPPET = %q[
|
||||
if (Mock.%1$s_Return != Mock.%1$s_Return_Tail)
|
||||
{
|
||||
%2$s toReturn = *Mock.%1$s_Return;
|
||||
%2$s cmock_to_return = *Mock.%1$s_Return;
|
||||
Mock.%1$s_Return++;
|
||||
Mock.%1$s_CallCount++;
|
||||
Mock.%1$s_CallsExpected++;
|
||||
return toReturn;
|
||||
return cmock_to_return;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ class CMockGeneratorUtils
|
||||
|
||||
def code_verify_an_arg_expectation(function, arg)
|
||||
(INSERT_ARG_VERIFY_START_SNIPPET % ["#{function[:name]}_Expected_#{arg[:name]}", arg[:type]]) +
|
||||
expect_helper(arg, '*p_expected', "\"Function '#{function[:name]}' called with unexpected value for argument '#{arg[:name]}'.\"", "#{function[:name]}_Expected_#{arg[:name]}_Depth") +
|
||||
expect_helper(arg, '*cmock_val_expected', "\"Function '#{function[:name]}' called with unexpected value for argument '#{arg[:name]}'.\"", "#{function[:name]}_Expected_#{arg[:name]}_Depth") +
|
||||
"\n }\n"
|
||||
end
|
||||
|
||||
@@ -60,13 +60,13 @@ class CMockGeneratorUtils
|
||||
when "TEST_ASSERT_EQUAL_MEMORY_MESSAGE_ARRAY"
|
||||
if (@arrays)
|
||||
[ (INSERT_ARG_DEPTH_START_SNIPPET % [depth_name]),
|
||||
" if (*p_expected == NULL)",
|
||||
" if (*cmock_val_expected == NULL)",
|
||||
" { TEST_ASSERT_NULL(#{name}); }",
|
||||
((@ptr_handling == :smart) ? " else if (Depth == 0)\n { TEST_ASSERT_EQUAL_HEX32(*p_expected, #{name}); }" : nil),
|
||||
((@ptr_handling == :smart) ? " else if (cmock_depth == 0)\n { TEST_ASSERT_EQUAL_HEX32(*cmock_val_expected, #{name}); }" : nil),
|
||||
" else",
|
||||
" { TEST_ASSERT_EQUAL_MEMORY_ARRAY_MESSAGE((void*)(#{expected}), (void*)#{name}, sizeof(#{c_type.sub('*','')}), Depth#{unity_msg}); }"].compact.join("\n")
|
||||
" { TEST_ASSERT_EQUAL_MEMORY_ARRAY_MESSAGE((void*)(#{expected}), (void*)#{name}, sizeof(#{c_type.sub('*','')}), cmock_depth#{unity_msg}); }"].compact.join("\n")
|
||||
else
|
||||
[ " if (*p_expected == NULL)",
|
||||
[ " if (*cmock_val_expected == NULL)",
|
||||
" { TEST_ASSERT_NULL(#{name}); }",
|
||||
" else",
|
||||
" { TEST_ASSERT_EQUAL_MEMORY_MESSAGE((void*)(#{expected}), (void*)#{name}, sizeof(#{c_type.sub('*','')})#{unity_msg}); }"].join("\n")
|
||||
@@ -75,13 +75,13 @@ class CMockGeneratorUtils
|
||||
when /_ARRAY/
|
||||
if (@arrays)
|
||||
[ (INSERT_ARG_DEPTH_START_SNIPPET % [depth_name]),
|
||||
" if (*p_expected == NULL)",
|
||||
" if (*cmock_val_expected == NULL)",
|
||||
" { TEST_ASSERT_NULL(#{name}); }",
|
||||
((@ptr_handling == :smart) ? " else if (Depth == 0)\n { TEST_ASSERT_EQUAL_HEX32(*p_expected, #{name}); }" : nil),
|
||||
((@ptr_handling == :smart) ? " else if (cmock_depth == 0)\n { TEST_ASSERT_EQUAL_HEX32(*cmock_val_expected, #{name}); }" : nil),
|
||||
" else",
|
||||
" { #{unity_func}(#{expected}, #{name}, Depth); }"].compact.join("\n")
|
||||
" { #{unity_func}(#{expected}, #{name}, cmock_depth); }"].compact.join("\n")
|
||||
else
|
||||
[ " if (*p_expected == NULL)",
|
||||
[ " if (*cmock_val_expected == NULL)",
|
||||
" { TEST_ASSERT_NULL(#{name}); }",
|
||||
" else",
|
||||
" { #{unity_func}(#{expected}, #{name}, 1); }"].join("\n")
|
||||
@@ -100,8 +100,8 @@ class CMockGeneratorUtils
|
||||
INSERT_EXPECT_CODE_SNIPPET = %q[
|
||||
{
|
||||
int sz = 0;
|
||||
%1$s *pointer = %2$s_Head;
|
||||
while (pointer && pointer != %2$s_Tail) { sz++; pointer++; }
|
||||
%1$s *cmock_pointer = %2$s_Head;
|
||||
while (cmock_pointer && cmock_pointer != %2$s_Tail) { sz++; cmock_pointer++; }
|
||||
if (sz == 0)
|
||||
{
|
||||
%2$s_Head = (%1$s*)malloc(2*sizeof(%1$s));
|
||||
@@ -124,8 +124,8 @@ class CMockGeneratorUtils
|
||||
INSERT_EXPECT_SHORT_CODE_SNIPPET = %q[
|
||||
{
|
||||
int sz = 0;
|
||||
%1$s *pointer = %2$s_Head;
|
||||
while (pointer && pointer != %2$s_Tail) { sz++; pointer++; }
|
||||
%1$s *cmock_pointer = %2$s_Head;
|
||||
while (cmock_pointer && cmock_pointer != %2$s_Tail) { sz++; cmock_pointer++; }
|
||||
if (sz == 0)
|
||||
{
|
||||
%2$s_Head = (%1$s*)malloc(2*sizeof(%1$s));
|
||||
@@ -151,9 +151,9 @@ class CMockGeneratorUtils
|
||||
INSERT_RETURN_TYPE_SNIPPET = %q[
|
||||
if (Mock.%1$s_Return != Mock.%1$s_Return_Tail)
|
||||
{
|
||||
%2$s toReturn = *Mock.%1$s_Return;
|
||||
%2$s cmock_to_return = *Mock.%1$s_Return;
|
||||
Mock.%1$s_Return++;
|
||||
return toReturn;
|
||||
return cmock_to_return;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -164,12 +164,12 @@ class CMockGeneratorUtils
|
||||
INSERT_ARG_VERIFY_START_SNIPPET = %q[
|
||||
if (Mock.%1$s != Mock.%1$s_Tail)
|
||||
{
|
||||
%2$s* p_expected = Mock.%1$s;
|
||||
%2$s* cmock_val_expected = Mock.%1$s;
|
||||
Mock.%1$s++;
|
||||
]
|
||||
|
||||
INSERT_ARG_DEPTH_START_SNIPPET = %q[
|
||||
int Depth = *Mock.%1$s;
|
||||
int cmock_depth = *Mock.%1$s;
|
||||
Mock.%1$s++;
|
||||
]
|
||||
|
||||
|
||||
@@ -189,7 +189,7 @@ class CMockHeaderParser
|
||||
decl[:modifier] = decl[:modifier].join(' ')
|
||||
decl[:return_type] = decl[:return_type].join(' ')
|
||||
decl[:return_type] = 'void' if (@local_as_void.include?(decl[:return_type].strip))
|
||||
decl[:return_string] = decl[:return_type] + " toReturn"
|
||||
decl[:return_string] = decl[:return_type] + " cmock_to_return"
|
||||
|
||||
#remove default argument statements from mock definitions
|
||||
args.gsub!(/=\s*[a-zA-Z0-9_\.]+\s*\,/, ',')
|
||||
|
||||
@@ -72,10 +72,10 @@ class CMockGeneratorPluginArrayTest < Test::Unit::TestCase
|
||||
:ptr? => true,
|
||||
}],
|
||||
:return_type => "const char*",
|
||||
:return_string => "const char* toReturn",
|
||||
:return_string => "const char* cmock_to_return",
|
||||
:contains_ptr? => true }
|
||||
|
||||
expected = "void #{function[:name]}_ExpectWithArrayAndReturn(int* tofu, int tofu_Depth, const char* toReturn);\n"
|
||||
expected = "void #{function[:name]}_ExpectWithArrayAndReturn(int* tofu, int tofu_Depth, const char* cmock_to_return);\n"
|
||||
returned = @cmock_generator_plugin_array.mock_function_declarations(function)
|
||||
assert_equal(expected, returned)
|
||||
end
|
||||
@@ -95,19 +95,19 @@ class CMockGeneratorPluginArrayTest < Test::Unit::TestCase
|
||||
:args => [{ :type => "int*", :name => "pescado", :ptr? => true}, { :type => "int", :name => "pes", :ptr? => false}],
|
||||
:args_string => "int* pescado, int pes",
|
||||
:return_type => "int",
|
||||
:return_string => "int toReturn",
|
||||
:return_string => "int cmock_to_return",
|
||||
:contains_ptr? => true }
|
||||
@utils.expect.code_add_an_arg_expectation(function, function[:args][0], "pescado_Depth").returns("mock_retval_2")
|
||||
@utils.expect.code_add_an_arg_expectation(function, function[:args][1], "1").returns("mock_retval_3")
|
||||
@utils.expect.code_add_base_expectation("Lemon").returns("mock_retval_0")
|
||||
@utils.expect.code_insert_item_into_expect_array(function[:return_type], "Mock.Lemon_Return", 'toReturn').returns("mock_retval_1")
|
||||
@utils.expect.code_insert_item_into_expect_array(function[:return_type], "Mock.Lemon_Return", 'cmock_to_return').returns("mock_retval_1")
|
||||
|
||||
expected = ["void ExpectParametersWithArray_Lemon(int* pescado, int pescado_Depth, int pes)\n",
|
||||
"{\n",
|
||||
"mock_retval_2",
|
||||
"mock_retval_3",
|
||||
"}\n\n",
|
||||
"void Lemon_ExpectWithArrayAndReturn(int* pescado, int pescado_Depth, int pes, int toReturn)\n",
|
||||
"void Lemon_ExpectWithArrayAndReturn(int* pescado, int pescado_Depth, int pes, int cmock_to_return)\n",
|
||||
"{\n",
|
||||
"mock_retval_0",
|
||||
" ExpectParametersWithArray_Lemon(pescado, pescado_Depth, pes);\n",
|
||||
|
||||
@@ -122,7 +122,7 @@ class CMockGeneratorPluginCallbackTest < Test::Unit::TestCase
|
||||
:args => [{ :type => "char*", :name => "pescado"}],
|
||||
:args_string => "char* pescado",
|
||||
:return_type => "int",
|
||||
:return_string => "int toReturn" }
|
||||
:return_string => "int cmock_to_return" }
|
||||
|
||||
expected = ["\n",
|
||||
"void Lemon_StubWithCallback(CMOCK_Lemon_CALLBACK Callback)\n",
|
||||
|
||||
@@ -123,7 +123,7 @@ class CMockGeneratorPluginCexceptionTest < Test::Unit::TestCase
|
||||
" Mock.Pear_ThrowValue++;\n",
|
||||
" Mock.Pear_ThrowOnCallCount++;\n",
|
||||
" }\n",
|
||||
" ExpectParameters_Pear(blah);\n",
|
||||
" CMockExpectParameters_Pear(blah);\n",
|
||||
"}\n\n"
|
||||
].join
|
||||
returned = @cmock_generator_plugin_cexception.mock_interfaces(function)
|
||||
|
||||
@@ -116,7 +116,7 @@ class CMockGeneratorPluginExpectTest < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
should "add mock function declaration for functions of style 'int func(void)'" do
|
||||
function = {:name => "Spruce", :args_string => "void", :return_string => "int toReturn"}
|
||||
function = {:name => "Spruce", :args_string => "void", :return_string => "int cmock_to_return"}
|
||||
|
||||
expected = "void #{function[:name]}_ExpectAndReturn(#{function[:return_string]});\n"
|
||||
returned = @cmock_generator_plugin_expect.mock_function_declarations(function)
|
||||
@@ -124,7 +124,7 @@ class CMockGeneratorPluginExpectTest < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
should "add mock function declaration for functions of style 'const char* func(int tofu)'" do
|
||||
function = {:name => "Pine", :args_string => "int tofu", :return_string => "const char* toReturn"}
|
||||
function = {:name => "Pine", :args_string => "int tofu", :return_string => "const char* cmock_to_return"}
|
||||
|
||||
expected = "void #{function[:name]}_ExpectAndReturn(#{function[:args_string]}, #{function[:return_string]});\n"
|
||||
returned = @cmock_generator_plugin_expect.mock_function_declarations(function)
|
||||
@@ -172,16 +172,16 @@ class CMockGeneratorPluginExpectTest < Test::Unit::TestCase
|
||||
" TEST_FAIL(\"Function 'Apple' called more times than expected\");\n",
|
||||
" }\n",
|
||||
" {\n",
|
||||
" int* p_expected = Mock.Apple_CallOrder;\n",
|
||||
" int* cmock_val_expected = Mock.Apple_CallOrder;\n",
|
||||
" ++GlobalVerifyOrder;\n",
|
||||
" if (Mock.Apple_CallOrder != Mock.Apple_CallOrder_Tail)\n",
|
||||
" Mock.Apple_CallOrder++;\n",
|
||||
" if ((*p_expected != GlobalVerifyOrder) && (GlobalOrderError == NULL))\n",
|
||||
" if ((*cmock_val_expected != GlobalVerifyOrder) && (GlobalOrderError == NULL))\n",
|
||||
" {\n",
|
||||
" const char* ErrStr = \"Out of order function calls. Function 'Apple'\";\n",
|
||||
" const char* cmock_err_str = \"Out of order function calls. Function 'Apple'\";\n",
|
||||
" GlobalOrderError = malloc(46);\n",
|
||||
" if (GlobalOrderError)\n",
|
||||
" strcpy(GlobalOrderError, ErrStr);\n",
|
||||
" strcpy(GlobalOrderError, cmock_err_str);\n",
|
||||
" }\n",
|
||||
" }\n"
|
||||
].join
|
||||
@@ -199,16 +199,16 @@ class CMockGeneratorPluginExpectTest < Test::Unit::TestCase
|
||||
" TEST_FAIL(\"Function 'Apple' called more times than expected\");\n",
|
||||
" }\n",
|
||||
" {\n",
|
||||
" int* p_expected = Mock.Apple_CallOrder;\n",
|
||||
" int* cmock_val_expected = Mock.Apple_CallOrder;\n",
|
||||
" ++GlobalVerifyOrder;\n",
|
||||
" if (Mock.Apple_CallOrder != Mock.Apple_CallOrder_Tail)\n",
|
||||
" Mock.Apple_CallOrder++;\n",
|
||||
" if ((*p_expected != GlobalVerifyOrder) && (GlobalOrderError == NULL))\n",
|
||||
" if ((*cmock_val_expected != GlobalVerifyOrder) && (GlobalOrderError == NULL))\n",
|
||||
" {\n",
|
||||
" const char* ErrStr = \"Out of order function calls. Function 'Apple'\";\n",
|
||||
" const char* cmock_err_str = \"Out of order function calls. Function 'Apple'\";\n",
|
||||
" GlobalOrderError = malloc(46);\n",
|
||||
" if (GlobalOrderError)\n",
|
||||
" strcpy(GlobalOrderError, ErrStr);\n",
|
||||
" strcpy(GlobalOrderError, cmock_err_str);\n",
|
||||
" }\n",
|
||||
" }\n"
|
||||
].join
|
||||
@@ -229,11 +229,11 @@ class CMockGeneratorPluginExpectTest < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
should "add mock interfaces for functions of style 'unsigned short func(void)'" do
|
||||
function = {:name => "Orange", :args => [], :args_string => "void", :return_type => "unsigned short", :return_string => "unsigned short toReturn"}
|
||||
function = {:name => "Orange", :args => [], :args_string => "void", :return_type => "unsigned short", :return_string => "unsigned short cmock_to_return"}
|
||||
@utils.expect.code_add_base_expectation("Orange").returns("mock_retval_0")
|
||||
@utils.expect.code_insert_item_into_expect_array(function[:return_type], "Mock.Orange_Return","toReturn").returns("mock_retval_1")
|
||||
@utils.expect.code_insert_item_into_expect_array(function[:return_type], "Mock.Orange_Return","cmock_to_return").returns("mock_retval_1")
|
||||
|
||||
expected = ["void Orange_ExpectAndReturn(unsigned short toReturn)\n",
|
||||
expected = ["void Orange_ExpectAndReturn(unsigned short cmock_to_return)\n",
|
||||
"{\n",
|
||||
"mock_retval_0",
|
||||
"mock_retval_1",
|
||||
@@ -246,19 +246,19 @@ class CMockGeneratorPluginExpectTest < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
should "add mock interfaces for functions of style 'int func(char* pescado)'" do
|
||||
function = {:name => "Lemon", :args => [{ :type => "char*", :name => "pescado"}], :args_string => "char* pescado", :return_type => "int", :return_string => "int toReturn"}
|
||||
function = {:name => "Lemon", :args => [{ :type => "char*", :name => "pescado"}], :args_string => "char* pescado", :return_type => "int", :return_string => "int cmock_to_return"}
|
||||
@utils.expect.code_add_an_arg_expectation(function, {:type => "char*", :name => "pescado"}).returns("mock_retval_2")
|
||||
@utils.expect.code_add_base_expectation("Lemon").returns("mock_retval_0")
|
||||
@utils.expect.code_insert_item_into_expect_array(function[:return_type], "Mock.Lemon_Return", 'toReturn').returns("mock_retval_1")
|
||||
@utils.expect.code_insert_item_into_expect_array(function[:return_type], "Mock.Lemon_Return", 'cmock_to_return').returns("mock_retval_1")
|
||||
|
||||
expected = ["void ExpectParameters_Lemon(char* pescado)\n",
|
||||
expected = ["void CMockExpectParameters_Lemon(char* pescado)\n",
|
||||
"{\n",
|
||||
"mock_retval_2",
|
||||
"}\n\n",
|
||||
"void Lemon_ExpectAndReturn(char* pescado, int toReturn)\n",
|
||||
"void Lemon_ExpectAndReturn(char* pescado, int cmock_to_return)\n",
|
||||
"{\n",
|
||||
"mock_retval_0",
|
||||
" ExpectParameters_Lemon(pescado);\n",
|
||||
" CMockExpectParameters_Lemon(pescado);\n",
|
||||
"mock_retval_1",
|
||||
" Mock.Lemon_Return = Mock.Lemon_Return_Head;\n",
|
||||
" Mock.Lemon_Return += Mock.Lemon_CallCount;\n",
|
||||
|
||||
@@ -36,8 +36,8 @@ class CMockGeneratorPluginIgnoreTest < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
should "handle function declarations for functions that returns something" do
|
||||
function = {:name => "Fungus", :args_string => "void", :return_type => "const char*", :return_string => "const char* toReturn"}
|
||||
expected = "void Fungus_IgnoreAndReturn(const char* toReturn);\n"
|
||||
function = {:name => "Fungus", :args_string => "void", :return_type => "const char*", :return_string => "const char* cmock_to_return"}
|
||||
expected = "void Fungus_IgnoreAndReturn(const char* cmock_to_return);\n"
|
||||
returned = @cmock_generator_plugin_ignore.mock_function_declarations(function)
|
||||
assert_equal(expected, returned)
|
||||
end
|
||||
@@ -59,11 +59,11 @@ class CMockGeneratorPluginIgnoreTest < Test::Unit::TestCase
|
||||
" {\n",
|
||||
" if (Mock.Fungus_Return != Mock.Fungus_Return_Tail)\n",
|
||||
" {\n",
|
||||
" int toReturn = *Mock.Fungus_Return;\n",
|
||||
" int cmock_to_return = *Mock.Fungus_Return;\n",
|
||||
" Mock.Fungus_Return++;\n",
|
||||
" Mock.Fungus_CallCount++;\n",
|
||||
" Mock.Fungus_CallsExpected++;\n",
|
||||
" return toReturn;\n",
|
||||
" return cmock_to_return;\n",
|
||||
" }\n",
|
||||
" else\n",
|
||||
" {\n",
|
||||
@@ -88,11 +88,11 @@ class CMockGeneratorPluginIgnoreTest < Test::Unit::TestCase
|
||||
end
|
||||
|
||||
should "add a new mock interface for ignoring when function has return value" do
|
||||
function = {:name => "Slime", :args => [], :args_string => "void", :return_type => "uint32", :return_string => "uint32 toReturn"}
|
||||
@utils.expect.code_insert_item_into_expect_array("uint32", "Mock.Slime_Return", "toReturn").returns("mock_return_1")
|
||||
function = {:name => "Slime", :args => [], :args_string => "void", :return_type => "uint32", :return_string => "uint32 cmock_to_return"}
|
||||
@utils.expect.code_insert_item_into_expect_array("uint32", "Mock.Slime_Return", "cmock_to_return").returns("mock_return_1")
|
||||
|
||||
expected = ["\n",
|
||||
"void Slime_IgnoreAndReturn(uint32 toReturn)\n",
|
||||
"void Slime_IgnoreAndReturn(uint32 cmock_to_return)\n",
|
||||
"{\n",
|
||||
" Mock.Slime_IgnoreBool = (int)1;\n",
|
||||
"mock_return_1\n",
|
||||
|
||||
@@ -38,8 +38,8 @@ class CMockGeneratorUtilsTest < Test::Unit::TestCase
|
||||
expected = ["\n",
|
||||
" {\n",
|
||||
" int sz = 0;\n",
|
||||
" int *pointer = array_Head;\n",
|
||||
" while (pointer && pointer != array_Tail) { sz++; pointer++; }\n",
|
||||
" int *cmock_pointer = array_Head;\n",
|
||||
" while (cmock_pointer && cmock_pointer != array_Tail) { sz++; cmock_pointer++; }\n",
|
||||
" if (sz == 0)\n",
|
||||
" {\n",
|
||||
" array_Head = (int*)malloc(2*sizeof(int));\n",
|
||||
@@ -66,9 +66,9 @@ class CMockGeneratorUtilsTest < Test::Unit::TestCase
|
||||
expected = ["\n",
|
||||
" if (Mock.Spatula_Return != Mock.Spatula_Return_Tail)\n",
|
||||
" {\n",
|
||||
" uint64 toReturn = *Mock.Spatula_Return;\n",
|
||||
" uint64 cmock_to_return = *Mock.Spatula_Return;\n",
|
||||
" Mock.Spatula_Return++;\n",
|
||||
" return toReturn;\n",
|
||||
" return cmock_to_return;\n",
|
||||
" }\n",
|
||||
" else\n",
|
||||
" {\n",
|
||||
@@ -87,8 +87,8 @@ class CMockGeneratorUtilsTest < Test::Unit::TestCase
|
||||
expected = ["\n",
|
||||
" {\n",
|
||||
" int sz = 0;\n",
|
||||
" uint16 *pointer = Mock.PizzaCutter_Expected_Spork_Head;\n",
|
||||
" while (pointer && pointer != Mock.PizzaCutter_Expected_Spork_Tail) { sz++; pointer++; }\n",
|
||||
" uint16 *cmock_pointer = Mock.PizzaCutter_Expected_Spork_Head;\n",
|
||||
" while (cmock_pointer && cmock_pointer != Mock.PizzaCutter_Expected_Spork_Tail) { sz++; cmock_pointer++; }\n",
|
||||
" if (sz == 0)\n",
|
||||
" {\n",
|
||||
" Mock.PizzaCutter_Expected_Spork_Head = (uint16*)malloc(2*sizeof(uint16));\n",
|
||||
@@ -126,8 +126,8 @@ class CMockGeneratorUtilsTest < Test::Unit::TestCase
|
||||
"\n",
|
||||
" {\n",
|
||||
" int sz = 0;\n",
|
||||
" int *pointer = Mock.Nectarine_CallOrder_Head;\n",
|
||||
" while (pointer && pointer != Mock.Nectarine_CallOrder_Tail) { sz++; pointer++; }\n",
|
||||
" int *cmock_pointer = Mock.Nectarine_CallOrder_Head;\n",
|
||||
" while (cmock_pointer && cmock_pointer != Mock.Nectarine_CallOrder_Tail) { sz++; cmock_pointer++; }\n",
|
||||
" if (sz == 0)\n",
|
||||
" {\n",
|
||||
" Mock.Nectarine_CallOrder_Head = (int*)malloc(2*sizeof(int));\n",
|
||||
@@ -160,9 +160,9 @@ class CMockGeneratorUtilsTest < Test::Unit::TestCase
|
||||
expected = ["\n",
|
||||
" if (Mock.CanOpener_Expected_CorkScrew != Mock.CanOpener_Expected_CorkScrew_Tail)\n",
|
||||
" {\n",
|
||||
" uint16* p_expected = Mock.CanOpener_Expected_CorkScrew;\n",
|
||||
" uint16* cmock_val_expected = Mock.CanOpener_Expected_CorkScrew;\n",
|
||||
" Mock.CanOpener_Expected_CorkScrew++;\n",
|
||||
" TEST_ASSERT_EQUAL_MESSAGE(*p_expected, CorkScrew, \"Function 'CanOpener' called with unexpected value for argument 'CorkScrew'.\");\n\n",
|
||||
" TEST_ASSERT_EQUAL_MESSAGE(*cmock_val_expected, CorkScrew, \"Function 'CanOpener' called with unexpected value for argument 'CorkScrew'.\");\n\n",
|
||||
" }\n"
|
||||
].join
|
||||
returned = @cmock_generator_utils.code_verify_an_arg_expectation(function, {:type => var_type, :name => var_name})
|
||||
@@ -180,9 +180,9 @@ class CMockGeneratorUtilsTest < Test::Unit::TestCase
|
||||
expected = ["\n",
|
||||
" if (Mock.MeasureCup_Expected_TeaSpoon != Mock.MeasureCup_Expected_TeaSpoon_Tail)\n",
|
||||
" {\n",
|
||||
" const char** p_expected = Mock.MeasureCup_Expected_TeaSpoon;\n",
|
||||
" const char** cmock_val_expected = Mock.MeasureCup_Expected_TeaSpoon;\n",
|
||||
" Mock.MeasureCup_Expected_TeaSpoon++;\n",
|
||||
" TEST_ASSERT_EQUAL_STRING_MESSAGE(*p_expected, TeaSpoon, \"Function 'MeasureCup' called with unexpected value for argument 'TeaSpoon'.\");\n\n",
|
||||
" TEST_ASSERT_EQUAL_STRING_MESSAGE(*cmock_val_expected, TeaSpoon, \"Function 'MeasureCup' called with unexpected value for argument 'TeaSpoon'.\");\n\n",
|
||||
" }\n"
|
||||
].join
|
||||
returned = @cmock_generator_utils.code_verify_an_arg_expectation(function, {:type => var_type, :name => var_name})
|
||||
@@ -200,9 +200,9 @@ class CMockGeneratorUtilsTest < Test::Unit::TestCase
|
||||
expected = ["\n",
|
||||
" if (Mock.TeaPot_Expected_TeaSpoon != Mock.TeaPot_Expected_TeaSpoon_Tail)\n",
|
||||
" {\n",
|
||||
" MANDELBROT_SET_T* p_expected = Mock.TeaPot_Expected_TeaSpoon;\n",
|
||||
" MANDELBROT_SET_T* cmock_val_expected = Mock.TeaPot_Expected_TeaSpoon;\n",
|
||||
" Mock.TeaPot_Expected_TeaSpoon++;\n",
|
||||
" TEST_ASSERT_EQUAL_MANDELBROT_SET_T_MESSAGE(*p_expected, TeaSpoon, \"Function 'TeaPot' called with unexpected value for argument 'TeaSpoon'.\");\n\n",
|
||||
" TEST_ASSERT_EQUAL_MANDELBROT_SET_T_MESSAGE(*cmock_val_expected, TeaSpoon, \"Function 'TeaPot' called with unexpected value for argument 'TeaSpoon'.\");\n\n",
|
||||
" }\n"
|
||||
].join
|
||||
returned = @cmock_generator_utils.code_verify_an_arg_expectation(function, {:type => var_type, :name => var_name})
|
||||
@@ -220,9 +220,9 @@ class CMockGeneratorUtilsTest < Test::Unit::TestCase
|
||||
expected = ["\n",
|
||||
" if (Mock.Toaster_Expected_Bread != Mock.Toaster_Expected_Bread_Tail)\n",
|
||||
" {\n",
|
||||
" SOME_STRUCT* p_expected = Mock.Toaster_Expected_Bread;\n",
|
||||
" SOME_STRUCT* cmock_val_expected = Mock.Toaster_Expected_Bread;\n",
|
||||
" Mock.Toaster_Expected_Bread++;\n",
|
||||
" TEST_ASSERT_EQUAL_MEMORY_MESSAGE((void*)p_expected, (void*)&(Bread), sizeof(SOME_STRUCT), \"Function 'Toaster' called with unexpected value for argument 'Bread'.\");\n\n",
|
||||
" TEST_ASSERT_EQUAL_MEMORY_MESSAGE((void*)cmock_val_expected, (void*)&(Bread), sizeof(SOME_STRUCT), \"Function 'Toaster' called with unexpected value for argument 'Bread'.\");\n\n",
|
||||
" }\n"
|
||||
].join
|
||||
returned = @cmock_generator_utils.code_verify_an_arg_expectation(function, {:type => var_type, :name => var_name})
|
||||
@@ -240,12 +240,12 @@ class CMockGeneratorUtilsTest < Test::Unit::TestCase
|
||||
expected = ["\n",
|
||||
" if (Mock.Toaster_Expected_Bread != Mock.Toaster_Expected_Bread_Tail)\n",
|
||||
" {\n",
|
||||
" SOME_STRUCT** p_expected = Mock.Toaster_Expected_Bread;\n",
|
||||
" SOME_STRUCT** cmock_val_expected = Mock.Toaster_Expected_Bread;\n",
|
||||
" Mock.Toaster_Expected_Bread++;\n",
|
||||
" if (*p_expected == NULL)\n",
|
||||
" if (*cmock_val_expected == NULL)\n",
|
||||
" { TEST_ASSERT_NULL(Bread); }\n",
|
||||
" else\n",
|
||||
" { TEST_ASSERT_EQUAL_MEMORY_MESSAGE((void*)(*p_expected), (void*)Bread, sizeof(SOME_STRUCT), \"Function 'Toaster' called with unexpected value for argument 'Bread'.\"); }\n",
|
||||
" { TEST_ASSERT_EQUAL_MEMORY_MESSAGE((void*)(*cmock_val_expected), (void*)Bread, sizeof(SOME_STRUCT), \"Function 'Toaster' called with unexpected value for argument 'Bread'.\"); }\n",
|
||||
" }\n"
|
||||
].join
|
||||
returned = @cmock_generator_utils.code_verify_an_arg_expectation(function, {:type => var_type, :name => var_name})
|
||||
@@ -263,12 +263,12 @@ class CMockGeneratorUtilsTest < Test::Unit::TestCase
|
||||
expected = ["\n",
|
||||
" if (Mock.Blender_Expected_Strawberry != Mock.Blender_Expected_Strawberry_Tail)\n",
|
||||
" {\n",
|
||||
" FRUIT** p_expected = Mock.Blender_Expected_Strawberry;\n",
|
||||
" FRUIT** cmock_val_expected = Mock.Blender_Expected_Strawberry;\n",
|
||||
" Mock.Blender_Expected_Strawberry++;\n",
|
||||
" if (*p_expected == NULL)\n",
|
||||
" if (*cmock_val_expected == NULL)\n",
|
||||
" { TEST_ASSERT_NULL(Strawberry); }\n",
|
||||
" else\n",
|
||||
" { TEST_ASSERT_EQUAL_FRUIT_ARRAY(*p_expected, Strawberry, 1); }\n",
|
||||
" { TEST_ASSERT_EQUAL_FRUIT_ARRAY(*cmock_val_expected, Strawberry, 1); }\n",
|
||||
" }\n"
|
||||
].join
|
||||
returned = @cmock_generator_utils.code_verify_an_arg_expectation(function, {:type => var_type, :name => var_name})
|
||||
@@ -287,19 +287,19 @@ class CMockGeneratorUtilsTest < Test::Unit::TestCase
|
||||
expected = ["\n",
|
||||
" if (Mock.Blender_Expected_Strawberry != Mock.Blender_Expected_Strawberry_Tail)\n",
|
||||
" {\n",
|
||||
" FRUIT** p_expected = Mock.Blender_Expected_Strawberry;\n",
|
||||
" FRUIT** cmock_val_expected = Mock.Blender_Expected_Strawberry;\n",
|
||||
" Mock.Blender_Expected_Strawberry++;\n",
|
||||
" if (*p_expected == NULL)\n",
|
||||
" if (*cmock_val_expected == NULL)\n",
|
||||
" { TEST_ASSERT_NULL(Strawberry); }\n",
|
||||
" else\n",
|
||||
" { TEST_ASSERT_EQUAL_FRUIT_ARRAY(*p_expected, Strawberry, 1); }\n",
|
||||
" { TEST_ASSERT_EQUAL_FRUIT_ARRAY(*cmock_val_expected, Strawberry, 1); }\n",
|
||||
" }\n"
|
||||
].join
|
||||
returned = @cmock_generator_utils.code_verify_an_arg_expectation(function, {:type => var_type, :name => var_name})
|
||||
assert_equal(expected, returned)
|
||||
end
|
||||
|
||||
should "make handle default types when working in pointer only mode" do
|
||||
should "make handle default types when working in cmock_pointer only mode" do
|
||||
function = { :name => "Blender", :return_type => "uint16*"}
|
||||
var_type = "FRUIT*"
|
||||
var_name = "Strawberry"
|
||||
@@ -311,9 +311,9 @@ class CMockGeneratorUtilsTest < Test::Unit::TestCase
|
||||
expected = ["\n",
|
||||
" if (Mock.Blender_Expected_Strawberry != Mock.Blender_Expected_Strawberry_Tail)\n",
|
||||
" {\n",
|
||||
" FRUIT** p_expected = Mock.Blender_Expected_Strawberry;\n",
|
||||
" FRUIT** cmock_val_expected = Mock.Blender_Expected_Strawberry;\n",
|
||||
" Mock.Blender_Expected_Strawberry++;\n",
|
||||
" TEST_ASSERT_EQUAL_HEX32_MESSAGE(*p_expected, Strawberry, \"Function 'Blender' called with unexpected value for argument 'Strawberry'.\");\n\n",
|
||||
" TEST_ASSERT_EQUAL_HEX32_MESSAGE(*cmock_val_expected, Strawberry, \"Function 'Blender' called with unexpected value for argument 'Strawberry'.\");\n\n",
|
||||
" }\n"
|
||||
].join
|
||||
returned = @cmock_generator_utils.code_verify_an_arg_expectation(function, {:type => var_type, :name => var_name, :ptr? => true})
|
||||
@@ -333,14 +333,14 @@ class CMockGeneratorUtilsTest < Test::Unit::TestCase
|
||||
expected = ["\n",
|
||||
" if (Mock.Blender_Expected_Strawberry != Mock.Blender_Expected_Strawberry_Tail)\n",
|
||||
" {\n",
|
||||
" FRUIT** p_expected = Mock.Blender_Expected_Strawberry;\n",
|
||||
" FRUIT** cmock_val_expected = Mock.Blender_Expected_Strawberry;\n",
|
||||
" Mock.Blender_Expected_Strawberry++;\n\n",
|
||||
" int Depth = *Mock.Blender_Expected_Strawberry_Depth;\n",
|
||||
" int cmock_depth = *Mock.Blender_Expected_Strawberry_Depth;\n",
|
||||
" Mock.Blender_Expected_Strawberry_Depth++;\n\n",
|
||||
" if (*p_expected == NULL)\n",
|
||||
" if (*cmock_val_expected == NULL)\n",
|
||||
" { TEST_ASSERT_NULL(Strawberry); }\n",
|
||||
" else\n",
|
||||
" { TEST_ASSERT_EQUAL_FRUIT_ARRAY(*p_expected, Strawberry, Depth); }\n",
|
||||
" { TEST_ASSERT_EQUAL_FRUIT_ARRAY(*cmock_val_expected, Strawberry, cmock_depth); }\n",
|
||||
" }\n"
|
||||
].join
|
||||
returned = @cmock_generator_utils.code_verify_an_arg_expectation(function, {:type => var_type, :name => var_name, :ptr? => true})
|
||||
@@ -360,16 +360,16 @@ class CMockGeneratorUtilsTest < Test::Unit::TestCase
|
||||
expected = ["\n",
|
||||
" if (Mock.Blender_Expected_Strawberry != Mock.Blender_Expected_Strawberry_Tail)\n",
|
||||
" {\n",
|
||||
" FRUIT** p_expected = Mock.Blender_Expected_Strawberry;\n",
|
||||
" FRUIT** cmock_val_expected = Mock.Blender_Expected_Strawberry;\n",
|
||||
" Mock.Blender_Expected_Strawberry++;\n\n",
|
||||
" int Depth = *Mock.Blender_Expected_Strawberry_Depth;\n",
|
||||
" int cmock_depth = *Mock.Blender_Expected_Strawberry_Depth;\n",
|
||||
" Mock.Blender_Expected_Strawberry_Depth++;\n\n",
|
||||
" if (*p_expected == NULL)\n",
|
||||
" if (*cmock_val_expected == NULL)\n",
|
||||
" { TEST_ASSERT_NULL(Strawberry); }\n",
|
||||
" else if (Depth == 0)\n",
|
||||
" { TEST_ASSERT_EQUAL_HEX32(*p_expected, Strawberry); }\n",
|
||||
" else if (cmock_depth == 0)\n",
|
||||
" { TEST_ASSERT_EQUAL_HEX32(*cmock_val_expected, Strawberry); }\n",
|
||||
" else\n",
|
||||
" { TEST_ASSERT_EQUAL_FRUIT_ARRAY(*p_expected, Strawberry, Depth); }\n",
|
||||
" { TEST_ASSERT_EQUAL_FRUIT_ARRAY(*cmock_val_expected, Strawberry, cmock_depth); }\n",
|
||||
" }\n"
|
||||
].join
|
||||
returned = @cmock_generator_utils.code_verify_an_arg_expectation(function, {:type => var_type, :name => var_name, :ptr? => true})
|
||||
|
||||
@@ -263,7 +263,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
||||
should "handle odd case of typedef'd void returned" do
|
||||
source = "MY_FUNKY_VOID FunkyVoidReturned(int a)"
|
||||
expected = { :var_arg=>nil,
|
||||
:return_string=>"void toReturn",
|
||||
:return_string=>"void cmock_to_return",
|
||||
:name=>"FunkyVoidReturned",
|
||||
:return_type=>"void",
|
||||
:modifier=>"",
|
||||
@@ -276,7 +276,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
||||
should "handle odd case of typedef'd void as arg" do
|
||||
source = "int FunkyVoidAsArg(MY_FUNKY_VOID)"
|
||||
expected = { :var_arg=>nil,
|
||||
:return_string=>"int toReturn",
|
||||
:return_string=>"int cmock_to_return",
|
||||
:name=>"FunkyVoidAsArg",
|
||||
:return_type=>"int",
|
||||
:modifier=>"",
|
||||
@@ -289,7 +289,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
||||
should "handle odd case of typedef'd void as arg pointer" do
|
||||
source = "char FunkyVoidPointer(MY_FUNKY_VOID* bluh)"
|
||||
expected = { :var_arg=>nil,
|
||||
:return_string=>"char toReturn",
|
||||
:return_string=>"char cmock_to_return",
|
||||
:name=>"FunkyVoidPointer",
|
||||
:return_type=>"char",
|
||||
:modifier=>"",
|
||||
@@ -375,7 +375,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
||||
|
||||
source = "int Foo(int a, unsigned int b)"
|
||||
expected = { :var_arg=>nil,
|
||||
:return_string=>"int toReturn",
|
||||
:return_string=>"int cmock_to_return",
|
||||
:name=>"Foo",
|
||||
:return_type=>"int",
|
||||
:modifier=>"",
|
||||
@@ -391,7 +391,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
||||
|
||||
source = "void FunkyChicken( uint la, int de, bool da)"
|
||||
expected = { :var_arg=>nil,
|
||||
:return_string=>"void toReturn",
|
||||
:return_string=>"void cmock_to_return",
|
||||
:name=>"FunkyChicken",
|
||||
:return_type=>"void",
|
||||
:modifier=>"",
|
||||
@@ -408,7 +408,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
||||
|
||||
source = "void tat()"
|
||||
expected = { :var_arg=>nil,
|
||||
:return_string=>"void toReturn",
|
||||
:return_string=>"void cmock_to_return",
|
||||
:name=>"tat",
|
||||
:return_type=>"void",
|
||||
:modifier=>"",
|
||||
@@ -422,7 +422,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
||||
|
||||
source = "const int TheMatrix(int Trinity, unsigned int * Neo)"
|
||||
expected = { :var_arg=>nil,
|
||||
:return_string=>"int toReturn",
|
||||
:return_string=>"int cmock_to_return",
|
||||
:name=>"TheMatrix",
|
||||
:return_type=>"int",
|
||||
:modifier=>"const",
|
||||
@@ -440,7 +440,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
||||
"int Morpheus(int, unsigned int*);\n"
|
||||
|
||||
expected = [{ :var_arg=>nil,
|
||||
:return_string=>"int toReturn",
|
||||
:return_string=>"int cmock_to_return",
|
||||
:name=>"TheMatrix",
|
||||
:return_type=>"int",
|
||||
:modifier=>"const",
|
||||
@@ -450,7 +450,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
||||
],
|
||||
:args_string=>"int Trinity, unsigned int* Neo" },
|
||||
{ :var_arg=>nil,
|
||||
:return_string=>"int toReturn",
|
||||
:return_string=>"int cmock_to_return",
|
||||
:name=>"Morpheus",
|
||||
:return_type=>"int",
|
||||
:modifier=>"",
|
||||
@@ -469,7 +469,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
||||
"const int TheMatrix(int, unsigned int*);\n"
|
||||
|
||||
expected = [{ :var_arg=>nil,
|
||||
:return_string=>"int toReturn",
|
||||
:return_string=>"int cmock_to_return",
|
||||
:name=>"TheMatrix",
|
||||
:return_type=>"int",
|
||||
:modifier=>"const",
|
||||
@@ -490,7 +490,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
||||
"int CaptainHammer(CHUNKY_VOID_T);\n"
|
||||
|
||||
expected = [{ :var_arg=>nil,
|
||||
:return_string=>"void toReturn",
|
||||
:return_string=>"void cmock_to_return",
|
||||
:name=>"DrHorrible",
|
||||
:return_type=>"void",
|
||||
:modifier=>"",
|
||||
@@ -499,7 +499,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
||||
:args_string=>"int SingAlong"
|
||||
},
|
||||
{ :var_arg=>nil,
|
||||
:return_string=>"int toReturn",
|
||||
:return_string=>"int cmock_to_return",
|
||||
:name=>"CaptainHammer",
|
||||
:return_type=>"int",
|
||||
:modifier=>"",
|
||||
@@ -517,7 +517,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
||||
"struct TheseArentTheHammer CaptainHammer(void);\n"
|
||||
|
||||
expected = [{ :var_arg=>nil,
|
||||
:return_string=>"int toReturn",
|
||||
:return_string=>"int cmock_to_return",
|
||||
:name=>"DrHorrible",
|
||||
:return_type=>"int",
|
||||
:modifier=>"",
|
||||
@@ -526,7 +526,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
||||
:args_string=>"struct SingAlong Blog"
|
||||
},
|
||||
{ :var_arg=>nil,
|
||||
:return_string=>"void toReturn",
|
||||
:return_string=>"void cmock_to_return",
|
||||
:name=>"Penny",
|
||||
:return_type=>"void",
|
||||
:modifier=>"",
|
||||
@@ -535,7 +535,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
||||
:args_string=>"struct const _KeepYourHeadUp_* const BillyBuddy"
|
||||
},
|
||||
{ :var_arg=>nil,
|
||||
:return_string=>"struct TheseArentTheHammer toReturn",
|
||||
:return_string=>"struct TheseArentTheHammer cmock_to_return",
|
||||
:name=>"CaptainHammer",
|
||||
:return_type=>"struct TheseArentTheHammer",
|
||||
:modifier=>"",
|
||||
@@ -550,7 +550,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
||||
|
||||
source = "int XFiles(int Scully, int Mulder, ...);\n"
|
||||
expected = [{ :var_arg=>"...",
|
||||
:return_string=>"int toReturn",
|
||||
:return_string=>"int cmock_to_return",
|
||||
:name=>"XFiles",
|
||||
:return_type=>"int",
|
||||
:modifier=>"",
|
||||
|
||||
Reference in New Issue
Block a user