mirror of
https://github.com/ThrowTheSwitch/CMock.git
synced 2026-09-10 04:10:00 +00:00
convert Boolean values from int to char to reduce memory
This commit is contained in:
@@ -32,7 +32,7 @@ describe CMockGeneratorPluginCallback, "Verify CMockGeneratorPluginCallback Modu
|
||||
|
||||
it "add to instance structure" do
|
||||
function = {:name => "Oak", :args => [:type => "int*", :name => "blah", :ptr? => true], :return => test_return[:int_ptr]}
|
||||
expected = " int Oak_CallbackBool;\n" +
|
||||
expected = " char Oak_CallbackBool;\n" +
|
||||
" CMOCK_Oak_CALLBACK Oak_CallbackFunctionPointer;\n" +
|
||||
" int Oak_CallbackCalls;\n"
|
||||
returned = @cmock_generator_plugin_callback.instance_structure(function)
|
||||
@@ -264,14 +264,14 @@ describe CMockGeneratorPluginCallback, "Verify CMockGeneratorPluginCallback Modu
|
||||
|
||||
expected = ["void Lemon_AddCallback(CMOCK_Lemon_CALLBACK Callback)\n",
|
||||
"{\n",
|
||||
" Mock.Lemon_IgnoreBool = (int)0;\n",
|
||||
" Mock.Lemon_CallbackBool = (int)1;\n",
|
||||
" Mock.Lemon_IgnoreBool = (char)0;\n",
|
||||
" Mock.Lemon_CallbackBool = (char)1;\n",
|
||||
" Mock.Lemon_CallbackFunctionPointer = Callback;\n",
|
||||
"}\n\n",
|
||||
"void Lemon_Stub(CMOCK_Lemon_CALLBACK Callback)\n",
|
||||
"{\n",
|
||||
" Mock.Lemon_IgnoreBool = (int)0;\n",
|
||||
" Mock.Lemon_CallbackBool = (int)0;\n",
|
||||
" Mock.Lemon_IgnoreBool = (char)0;\n",
|
||||
" Mock.Lemon_CallbackBool = (char)0;\n",
|
||||
" Mock.Lemon_CallbackFunctionPointer = Callback;\n",
|
||||
"}\n\n"
|
||||
].join
|
||||
|
||||
@@ -57,7 +57,7 @@ describe CMockGeneratorPluginExpectAnyArgs, "Verify CMockGeneratorPluginExpectAn
|
||||
expected = ["void Slime_CMockExpectAnyArgs(UNITY_LINE_TYPE cmock_line)\n",
|
||||
"{\n",
|
||||
"mock_return_1",
|
||||
" cmock_call_instance->ExpectAnyArgsBool = (int)1;\n",
|
||||
" cmock_call_instance->ExpectAnyArgsBool = (char)1;\n",
|
||||
"}\n\n"
|
||||
].join
|
||||
@utils.expect :code_add_base_expectation, "mock_return_1", ["Slime", true]
|
||||
|
||||
@@ -54,9 +54,9 @@ describe CMockGeneratorPluginIgnoreArg, "Verify CMockGeneratorPluginIgnoreArg Mo
|
||||
end
|
||||
|
||||
it "add to tyepdef structure mock needs of functions of style 'void func(int chicken, int* pork)'" do
|
||||
expected = " int IgnoreArg_chicken;\n" +
|
||||
" int IgnoreArg_beef;\n" +
|
||||
" int IgnoreArg_tofu;\n"
|
||||
expected = " char IgnoreArg_chicken;\n" +
|
||||
" char IgnoreArg_beef;\n" +
|
||||
" char IgnoreArg_tofu;\n"
|
||||
returned = @cmock_generator_plugin_ignore_arg.instance_typedefs(@complex_func)
|
||||
assert_equal(expected, returned)
|
||||
end
|
||||
|
||||
@@ -28,7 +28,7 @@ describe CMockGeneratorPluginIgnore, "Verify CMockGeneratorPluginIgnore Module"
|
||||
|
||||
it "add a required variable to the instance structure" do
|
||||
function = {:name => "Grass", :args => [], :return => test_return[:void]}
|
||||
expected = " int Grass_IgnoreBool;\n"
|
||||
expected = " char Grass_IgnoreBool;\n"
|
||||
returned = @cmock_generator_plugin_ignore.instance_structure(function)
|
||||
assert_equal(expected, returned)
|
||||
end
|
||||
@@ -81,7 +81,7 @@ describe CMockGeneratorPluginIgnore, "Verify CMockGeneratorPluginIgnore Module"
|
||||
function = {:name => "Slime", :args => [], :args_string => "void", :return => test_return[:void]}
|
||||
expected = ["void Slime_CMockIgnore(void)\n",
|
||||
"{\n",
|
||||
" Mock.Slime_IgnoreBool = (int)1;\n",
|
||||
" Mock.Slime_IgnoreBool = (char)1;\n",
|
||||
"}\n\n"
|
||||
].join
|
||||
returned = @cmock_generator_plugin_ignore.mock_interfaces(function)
|
||||
@@ -95,7 +95,7 @@ describe CMockGeneratorPluginIgnore, "Verify CMockGeneratorPluginIgnore Module"
|
||||
"{\n",
|
||||
"mock_return_1",
|
||||
" cmock_call_instance->ReturnVal = cmock_to_return;\n",
|
||||
" Mock.Slime_IgnoreBool = (int)1;\n",
|
||||
" Mock.Slime_IgnoreBool = (char)1;\n",
|
||||
"}\n\n"
|
||||
].join
|
||||
returned = @cmock_generator_plugin_ignore.mock_interfaces(function)
|
||||
|
||||
@@ -71,7 +71,7 @@ describe CMockGeneratorPluginReturnThruPtr, "Verify CMockGeneratorPluginReturnTh
|
||||
|
||||
it "add to tyepdef structure mock needs of functions of style 'void func(int chicken, int* pork)'" do
|
||||
complex_func_expect()
|
||||
expected = " int ReturnThruPtr_tofu_Used;\n" +
|
||||
expected = " char ReturnThruPtr_tofu_Used;\n" +
|
||||
" int* ReturnThruPtr_tofu_Val;\n" +
|
||||
" int ReturnThruPtr_tofu_Size;\n"
|
||||
returned = @cmock_generator_plugin_return_thru_ptr.instance_typedefs(@complex_func)
|
||||
|
||||
@@ -73,7 +73,7 @@ describe CMockGeneratorUtils, "Verify CMockGeneratorUtils Module" do
|
||||
" UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringOutOfMemory);\n" +
|
||||
" memset(cmock_call_instance, 0, sizeof(*cmock_call_instance));\n" +
|
||||
" Mock.Apple_CallInstance = CMock_Guts_MemChain(Mock.Apple_CallInstance, cmock_guts_index);\n" +
|
||||
" Mock.Apple_IgnoreBool = (int)0;\n" +
|
||||
" Mock.Apple_IgnoreBool = (char)0;\n" +
|
||||
" cmock_call_instance->LineNumber = cmock_line;\n" +
|
||||
" cmock_call_instance->CallOrder = ++GlobalExpectCount;\n" +
|
||||
" cmock_call_instance->ExceptionToThrow = CEXCEPTION_NONE;\n"
|
||||
@@ -88,7 +88,7 @@ describe CMockGeneratorUtils, "Verify CMockGeneratorUtils Module" do
|
||||
" UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringOutOfMemory);\n" +
|
||||
" memset(cmock_call_instance, 0, sizeof(*cmock_call_instance));\n" +
|
||||
" Mock.Apple_CallInstance = CMock_Guts_MemChain(Mock.Apple_CallInstance, cmock_guts_index);\n" +
|
||||
" Mock.Apple_IgnoreBool = (int)0;\n" +
|
||||
" Mock.Apple_IgnoreBool = (char)0;\n" +
|
||||
" cmock_call_instance->LineNumber = cmock_line;\n" +
|
||||
" cmock_call_instance->ExceptionToThrow = CEXCEPTION_NONE;\n"
|
||||
output = @cmock_generator_utils_complex.code_add_base_expectation("Apple", false)
|
||||
|
||||
Reference in New Issue
Block a user