acpc_dealer 2.0.6 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (145) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +4 -2
  3. data/lib/acpc_dealer.rb +6 -2
  4. data/lib/acpc_dealer/version.rb +1 -1
  5. data/vendor/project_acpc_server/Makefile +12 -2
  6. data/vendor/project_acpc_server/README +1 -0
  7. data/vendor/project_acpc_server/example_player.limit.2p.sh +2 -1
  8. data/vendor/project_acpc_server/example_player.limit.3p.sh +2 -1
  9. data/vendor/project_acpc_server/example_player.nolimit.2p.sh +2 -1
  10. data/vendor/project_acpc_server/example_player.nolimit.3p.sh +2 -1
  11. data/vendor/project_acpc_server/kuhn.limit.3p.game +14 -0
  12. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player.sf1.sh +3 -0
  13. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player.sf2.sh +3 -0
  14. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player.sf3.sh +3 -0
  15. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/LICENCE +23 -0
  16. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/Makefile +128 -0
  17. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/README.md +35 -0
  18. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/CExceptionConfig.h +12 -0
  19. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/dealer_connection.c +49 -0
  20. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/dealer_connection.h +22 -0
  21. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/kuhn_3p_equilibrium_player.c +483 -0
  22. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/kuhn_3p_equilibrium_player.h +107 -0
  23. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/main.c +84 -0
  24. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/player_config.c +252 -0
  25. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/src/player_config.h +21 -0
  26. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/support/test_helper.c +45 -0
  27. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/support/test_helper.h +27 -0
  28. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player.c +698 -0
  29. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player_sub_family_1.c +324 -0
  30. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player_sub_family_2.c +262 -0
  31. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/test/test_kuhn_3p_equilibrium_player_sub_family_3.c +177 -0
  32. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/docs/CExceptionSummary.odt +0 -0
  33. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/docs/CExceptionSummary.pdf +0 -0
  34. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/docs/license.txt +30 -0
  35. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/docs/readme.txt +242 -0
  36. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/lib/CException.c +43 -0
  37. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/lib/CException.h +86 -0
  38. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/release/build.info +2 -0
  39. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cexception/release/version.info +2 -0
  40. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/config/production_environment.rb +14 -0
  41. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/config/test_environment.rb +16 -0
  42. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/docs/CMock Summary.odt +0 -0
  43. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/docs/CMock Summary.pdf +0 -0
  44. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/docs/CMock_Summary.md +356 -0
  45. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/docs/license.txt +31 -0
  46. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/SAM7_FLASH.mac +71 -0
  47. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/SAM7_RAM.mac +94 -0
  48. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/SAM7_SIM.mac +67 -0
  49. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_FLASH.xcl +185 -0
  50. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_RAM.xcl +185 -0
  51. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/Resource/ioat91sam7x256.ddf +2259 -0
  52. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/cmock_demo.dep +3691 -0
  53. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/cmock_demo.ewd +1696 -0
  54. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/cmock_demo.ewp +2581 -0
  55. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/cmock_demo.eww +10 -0
  56. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X-EK.h +61 -0
  57. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.inc +2314 -0
  58. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.rdf +4704 -0
  59. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.tcl +3407 -0
  60. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256_inc.h +2268 -0
  61. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/ioat91sam7x256.h +4380 -0
  62. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/incIAR/lib_AT91SAM7X256.h +4211 -0
  63. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/settings/cmock_demo.cspy.bat +32 -0
  64. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/settings/cmock_demo.dbgdt +86 -0
  65. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/settings/cmock_demo.dni +42 -0
  66. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/settings/cmock_demo.wsdt +76 -0
  67. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/srcIAR/Cstartup.s79 +266 -0
  68. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v4/srcIAR/Cstartup_SAM7.c +98 -0
  69. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/Resource/SAM7_FLASH.mac +71 -0
  70. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/Resource/SAM7_RAM.mac +94 -0
  71. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/Resource/SAM7_SIM.mac +67 -0
  72. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_FLASH.icf +43 -0
  73. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_RAM.icf +42 -0
  74. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/cmock_demo.dep +4204 -0
  75. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/cmock_demo.ewd +1906 -0
  76. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/cmock_demo.ewp +2426 -0
  77. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/cmock_demo.eww +26 -0
  78. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X-EK.h +61 -0
  79. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X256_inc.h +2268 -0
  80. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/incIAR/lib_AT91SAM7X256.h +4211 -0
  81. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/incIAR/project.h +30 -0
  82. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.cspy.bat +33 -0
  83. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dbgdt +5 -0
  84. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dni +18 -0
  85. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.wsdt +74 -0
  86. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X_FLASH_Debug.jlink +12 -0
  87. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo.cspy.bat +33 -0
  88. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo.dbgdt +85 -0
  89. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo.dni +44 -0
  90. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo.wsdt +73 -0
  91. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo_Binary.jlink +12 -0
  92. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo_FLASH_Debug.jlink +12 -0
  93. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/settings/cmock_demo_RAM_Debug.jlink +12 -0
  94. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/srcIAR/Cstartup.s +299 -0
  95. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/iar/iar_v5/srcIAR/Cstartup_SAM7.c +98 -0
  96. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock.rb +65 -0
  97. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_config.rb +129 -0
  98. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_file_writer.rb +33 -0
  99. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator.rb +195 -0
  100. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_array.rb +57 -0
  101. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_callback.rb +78 -0
  102. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_cexception.rb +51 -0
  103. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_expect.rb +86 -0
  104. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_ignore.rb +95 -0
  105. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb +44 -0
  106. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_plugin_return_thru_ptr.rb +74 -0
  107. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_generator_utils.rb +202 -0
  108. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_header_parser.rb +277 -0
  109. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_plugin_manager.rb +40 -0
  110. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/lib/cmock_unityhelper_parser.rb +75 -0
  111. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/release/build.info +2 -0
  112. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/release/version.info +2 -0
  113. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/src/cmock.c +176 -0
  114. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/src/cmock.h +31 -0
  115. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/src/cmock_internals.h +43 -0
  116. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/targets/gcc.yml +53 -0
  117. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/targets/iar_arm_v4.yml +108 -0
  118. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/cmock/targets/iar_arm_v5.yml +93 -0
  119. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/History.md +27 -0
  120. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/Makefile +8 -0
  121. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/Readme.md +103 -0
  122. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/package.json +9 -0
  123. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/src/commander.c +250 -0
  124. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/src/commander.h +88 -0
  125. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/commander.c/test.c +34 -0
  126. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/colour_prompt.rb +94 -0
  127. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/colour_reporter.rb +39 -0
  128. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/generate_config.yml +36 -0
  129. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/generate_module.rb +202 -0
  130. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/generate_test_runner.rb +316 -0
  131. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/test_file_filter.rb +23 -0
  132. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/auto/unity_test_summary.rb +139 -0
  133. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/docs/Unity Summary.odt +0 -0
  134. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/docs/Unity Summary.pdf +0 -0
  135. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/docs/Unity Summary.txt +216 -0
  136. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/docs/license.txt +31 -0
  137. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/release/build.info +2 -0
  138. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/release/version.info +2 -0
  139. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/src/unity.c +1146 -0
  140. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/src/unity.h +245 -0
  141. data/vendor/project_acpc_server/kuhn_3p_equilibrium_player/vendor/unity/src/unity_internals.h +546 -0
  142. data/vendor/project_acpc_server/net.c +0 -0
  143. data/vendor/project_acpc_server/net.h +1 -0
  144. data/vendor/project_acpc_server/tags +298 -0
  145. metadata +158 -26
@@ -0,0 +1,51 @@
1
+ # ==========================================
2
+ # CMock Project - Automatic Mock Generation for C
3
+ # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4
+ # [Released under MIT License. Please refer to license.txt for details]
5
+ # ==========================================
6
+
7
+ class CMockGeneratorPluginCexception
8
+
9
+ attr_reader :priority
10
+ attr_reader :config, :utils
11
+
12
+ def initialize(config, utils)
13
+ @config = config
14
+ @utils = utils
15
+ @priority = 7
16
+ end
17
+
18
+ def include_files
19
+ return "#include \"CException.h\"\n"
20
+ end
21
+
22
+ def instance_typedefs(function)
23
+ " CEXCEPTION_T ExceptionToThrow;\n"
24
+ end
25
+
26
+ def mock_function_declarations(function)
27
+ if (function[:args_string] == "void")
28
+ return "#define #{function[:name]}_ExpectAndThrow(cmock_to_throw) #{function[:name]}_CMockExpectAndThrow(__LINE__, cmock_to_throw)\n" +
29
+ "void #{function[:name]}_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, CEXCEPTION_T cmock_to_throw);\n"
30
+ else
31
+ return "#define #{function[:name]}_ExpectAndThrow(#{function[:args_call]}, cmock_to_throw) #{function[:name]}_CMockExpectAndThrow(__LINE__, #{function[:args_call]}, cmock_to_throw)\n" +
32
+ "void #{function[:name]}_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, #{function[:args_string]}, CEXCEPTION_T cmock_to_throw);\n"
33
+ end
34
+ end
35
+
36
+ def mock_implementation(function)
37
+ " if (cmock_call_instance->ExceptionToThrow != CEXCEPTION_NONE)\n {\n" +
38
+ " Throw(cmock_call_instance->ExceptionToThrow);\n }\n"
39
+ end
40
+
41
+ def mock_interfaces(function)
42
+ arg_insert = (function[:args_string] == "void") ? "" : "#{function[:args_string]}, "
43
+ call_string = function[:args].map{|m| m[:name]}.join(', ')
44
+ [ "void #{function[:name]}_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, #{arg_insert}CEXCEPTION_T cmock_to_throw)\n{\n",
45
+ @utils.code_add_base_expectation(function[:name]),
46
+ @utils.code_call_argument_loader(function),
47
+ " cmock_call_instance->ExceptionToThrow = cmock_to_throw;\n",
48
+ "}\n\n" ].join
49
+ end
50
+
51
+ end
@@ -0,0 +1,86 @@
1
+ # ==========================================
2
+ # CMock Project - Automatic Mock Generation for C
3
+ # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4
+ # [Released under MIT License. Please refer to license.txt for details]
5
+ # ==========================================
6
+
7
+ class CMockGeneratorPluginExpect
8
+
9
+ attr_reader :priority
10
+ attr_accessor :config, :utils, :unity_helper, :ordered
11
+
12
+ def initialize(config, utils)
13
+ @config = config
14
+ @ptr_handling = @config.when_ptr
15
+ @ordered = @config.enforce_strict_ordering
16
+ @utils = utils
17
+ @unity_helper = @utils.helpers[:unity_helper]
18
+ @priority = 5
19
+ end
20
+
21
+ def instance_typedefs(function)
22
+ lines = ""
23
+ lines << " #{function[:return][:type]} ReturnVal;\n" unless (function[:return][:void?])
24
+ lines << " int CallOrder;\n" if (@ordered)
25
+ function[:args].each do |arg|
26
+ lines << " #{arg[:type]} Expected_#{arg[:name]};\n"
27
+ end
28
+ lines
29
+ end
30
+
31
+ def mock_function_declarations(function)
32
+ if (function[:args].empty?)
33
+ if (function[:return][:void?])
34
+ return "#define #{function[:name]}_Expect() #{function[:name]}_CMockExpect(__LINE__)\n" +
35
+ "void #{function[:name]}_CMockExpect(UNITY_LINE_TYPE cmock_line);\n"
36
+ else
37
+ return "#define #{function[:name]}_ExpectAndReturn(cmock_retval) #{function[:name]}_CMockExpectAndReturn(__LINE__, cmock_retval)\n" +
38
+ "void #{function[:name]}_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]});\n"
39
+ end
40
+ else
41
+ if (function[:return][:void?])
42
+ return "#define #{function[:name]}_Expect(#{function[:args_call]}) #{function[:name]}_CMockExpect(__LINE__, #{function[:args_call]})\n" +
43
+ "void #{function[:name]}_CMockExpect(UNITY_LINE_TYPE cmock_line, #{function[:args_string]});\n"
44
+ else
45
+ return "#define #{function[:name]}_ExpectAndReturn(#{function[:args_call]}, cmock_retval) #{function[:name]}_CMockExpectAndReturn(__LINE__, #{function[:args_call]}, cmock_retval)\n" +
46
+ "void #{function[:name]}_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:args_string]}, #{function[:return][:str]});\n"
47
+ end
48
+ end
49
+ end
50
+
51
+ def mock_implementation(function)
52
+ lines = ""
53
+ function[:args].each do |arg|
54
+ lines << @utils.code_verify_an_arg_expectation(function, arg)
55
+ end
56
+ lines
57
+ end
58
+
59
+ def mock_interfaces(function)
60
+ lines = ""
61
+ func_name = function[:name]
62
+ if (function[:return][:void?])
63
+ if (function[:args_string] == "void")
64
+ lines << "void #{func_name}_CMockExpect(UNITY_LINE_TYPE cmock_line)\n{\n"
65
+ else
66
+ lines << "void #{func_name}_CMockExpect(UNITY_LINE_TYPE cmock_line, #{function[:args_string]})\n{\n"
67
+ end
68
+ else
69
+ if (function[:args_string] == "void")
70
+ lines << "void #{func_name}_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]})\n{\n"
71
+ else
72
+ lines << "void #{func_name}_CMockExpectAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:args_string]}, #{function[:return][:str]})\n{\n"
73
+ end
74
+ end
75
+ lines << @utils.code_add_base_expectation(func_name)
76
+ lines << @utils.code_call_argument_loader(function)
77
+ lines << @utils.code_assign_argument_quickly("cmock_call_instance->ReturnVal", function[:return]) unless (function[:return][:void?])
78
+ lines << "}\n\n"
79
+ end
80
+
81
+ def mock_verify(function)
82
+ func_name = function[:name]
83
+ " UNITY_TEST_ASSERT(CMOCK_GUTS_NONE == Mock.#{func_name}_CallInstance, cmock_line, \"Function '#{func_name}' called less times than expected.\");\n"
84
+ end
85
+
86
+ end
@@ -0,0 +1,95 @@
1
+ # ==========================================
2
+ # CMock Project - Automatic Mock Generation for C
3
+ # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4
+ # [Released under MIT License. Please refer to license.txt for details]
5
+ # ==========================================
6
+
7
+ class CMockGeneratorPluginIgnore
8
+
9
+ attr_reader :priority
10
+ attr_reader :config, :utils
11
+
12
+ def initialize(config, utils)
13
+ @config = config
14
+ if (@config.ignore == :args_and_calls)
15
+ alias :mock_implementation_precheck :mock_implementation_for_ignores
16
+ alias :mock_implementation :nothing
17
+ alias :mock_verify :mock_conditionally_verify_counts
18
+ else
19
+ alias :mock_implementation :mock_implementation_for_ignores
20
+ alias :mock_implementation_precheck :nothing
21
+ alias :mock_verify :nothing
22
+ end
23
+ @utils = utils
24
+ @priority = 2
25
+ end
26
+
27
+ def instance_structure(function)
28
+ if (function[:return][:void?])
29
+ " int #{function[:name]}_IgnoreBool;\n"
30
+ else
31
+ " int #{function[:name]}_IgnoreBool;\n #{function[:return][:type]} #{function[:name]}_FinalReturn;\n"
32
+ end
33
+ end
34
+
35
+ def mock_function_declarations(function)
36
+ if (function[:return][:void?])
37
+ if (@config.ignore == :args_only)
38
+ return "#define #{function[:name]}_Ignore() #{function[:name]}_CMockIgnore(__LINE__)\n" +
39
+ "void #{function[:name]}_CMockIgnore(UNITY_LINE_TYPE cmock_line);\n"
40
+ else
41
+ return "#define #{function[:name]}_Ignore() #{function[:name]}_CMockIgnore()\n" +
42
+ "void #{function[:name]}_CMockIgnore(void);\n"
43
+ end
44
+ else
45
+ return "#define #{function[:name]}_IgnoreAndReturn(cmock_retval) #{function[:name]}_CMockIgnoreAndReturn(__LINE__, cmock_retval)\n" +
46
+ "void #{function[:name]}_CMockIgnoreAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]});\n"
47
+ end
48
+ end
49
+
50
+ def mock_implementation_for_ignores(function)
51
+ lines = " if (Mock.#{function[:name]}_IgnoreBool)\n {\n"
52
+ if (function[:return][:void?])
53
+ lines << " return;\n }\n"
54
+ else
55
+ retval = function[:return].merge( { :name => "cmock_call_instance->ReturnVal"} )
56
+ lines << " if (cmock_call_instance == NULL)\n return Mock.#{function[:name]}_FinalReturn;\n"
57
+ lines << " " + @utils.code_assign_argument_quickly("Mock.#{function[:name]}_FinalReturn", retval) unless (retval[:void?])
58
+ lines << " return cmock_call_instance->ReturnVal;\n }\n"
59
+ end
60
+ lines
61
+ end
62
+
63
+ def mock_interfaces(function)
64
+ lines = ""
65
+ args_only = (@config.ignore == :args_only)
66
+ if (function[:return][:void?])
67
+ if (args_only)
68
+ lines << "void #{function[:name]}_CMockIgnore(UNITY_LINE_TYPE cmock_line)\n{\n"
69
+ else
70
+ lines << "void #{function[:name]}_CMockIgnore(void)\n{\n"
71
+ end
72
+ else
73
+ lines << "void #{function[:name]}_CMockIgnoreAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]})\n{\n"
74
+ end
75
+ if (args_only)
76
+ lines << @utils.code_add_base_expectation(function[:name], true)
77
+ elsif (!function[:return][:void?])
78
+ lines << @utils.code_add_base_expectation(function[:name], false)
79
+ end
80
+ unless (function[:return][:void?])
81
+ lines << " cmock_call_instance->ReturnVal = cmock_to_return;\n"
82
+ end
83
+ lines << " Mock.#{function[:name]}_IgnoreBool = (int)1;\n"
84
+ lines << "}\n\n"
85
+ end
86
+
87
+ def mock_conditionally_verify_counts(function)
88
+ func_name = function[:name]
89
+ " if (Mock.#{func_name}_IgnoreBool)\n Mock.#{func_name}_CallInstance = CMOCK_GUTS_NONE;\n"
90
+ end
91
+
92
+ def nothing(function)
93
+ return ""
94
+ end
95
+ end
@@ -0,0 +1,44 @@
1
+ class CMockGeneratorPluginIgnoreArg
2
+ attr_reader :priority
3
+ attr_accessor :utils
4
+
5
+ def initialize(config, utils)
6
+ @utils = utils
7
+ @priority = 10
8
+ end
9
+
10
+ def instance_typedefs(function)
11
+ lines = ""
12
+ function[:args].each do |arg|
13
+ lines << " int IgnoreArg_#{arg[:name]};\n"
14
+ end
15
+ lines
16
+ end
17
+
18
+ def mock_function_declarations(function)
19
+ lines = ""
20
+ function[:args].each do |arg|
21
+ lines << "#define #{function[:name]}_IgnoreArg_#{arg[:name]}()"
22
+ lines << " #{function[:name]}_CMockIgnoreArg_#{arg[:name]}(__LINE__)\n"
23
+ lines << "void #{function[:name]}_CMockIgnoreArg_#{arg[:name]}(UNITY_LINE_TYPE cmock_line);\n"
24
+ end
25
+ lines
26
+ end
27
+
28
+ def mock_interfaces(function)
29
+ lines = []
30
+ func_name = function[:name]
31
+ function[:args].each do |arg|
32
+ arg_name = arg[:name]
33
+ arg_type = arg[:type]
34
+ lines << "void #{function[:name]}_CMockIgnoreArg_#{arg[:name]}(UNITY_LINE_TYPE cmock_line)\n"
35
+ lines << "{\n"
36
+ lines << " CMOCK_#{func_name}_CALL_INSTANCE* cmock_call_instance = " +
37
+ "cmock_call_instance = (CMOCK_#{func_name}_CALL_INSTANCE*)CMock_Guts_GetAddressFor(CMock_Guts_MemEndOfChain(Mock.#{func_name}_CallInstance));\n"
38
+ lines << " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"#{arg_name} IgnoreArg called before Expect on '#{func_name}'.\");\n"
39
+ lines << " cmock_call_instance->IgnoreArg_#{arg_name} = 1;\n"
40
+ lines << "}\n\n"
41
+ end
42
+ lines
43
+ end
44
+ end
@@ -0,0 +1,74 @@
1
+ class CMockGeneratorPluginReturnThruPtr
2
+ attr_reader :priority
3
+ attr_accessor :utils
4
+
5
+ def initialize(config, utils)
6
+ @utils = utils
7
+ @priority = 9
8
+ end
9
+
10
+ def instance_typedefs(function)
11
+ lines = ""
12
+ function[:args].each do |arg|
13
+ if (@utils.ptr_or_str?(arg[:type]) and not arg[:const?])
14
+ lines << " int ReturnThruPtr_#{arg[:name]}_Used;\n"
15
+ lines << " #{arg[:type]} ReturnThruPtr_#{arg[:name]}_Val;\n"
16
+ lines << " int ReturnThruPtr_#{arg[:name]}_Size;\n"
17
+ end
18
+ end
19
+ lines
20
+ end
21
+
22
+ def mock_function_declarations(function)
23
+ lines = ""
24
+ function[:args].each do |arg|
25
+ if (@utils.ptr_or_str?(arg[:type]) and not arg[:const?])
26
+ lines << "#define #{function[:name]}_ReturnThruPtr_#{arg[:name]}(#{arg[:name]})"
27
+ lines << " #{function[:name]}_CMockReturnMemThruPtr_#{arg[:name]}(__LINE__, #{arg[:name]}, sizeof(*#{arg[:name]}))\n"
28
+ lines << "#define #{function[:name]}_ReturnArrayThruPtr_#{arg[:name]}(#{arg[:name]}, cmock_len)"
29
+ lines << " #{function[:name]}_CMockReturnMemThruPtr_#{arg[:name]}(__LINE__, #{arg[:name]}, cmock_len * sizeof(*#{arg[:name]}))\n"
30
+ lines << "#define #{function[:name]}_ReturnMemThruPtr_#{arg[:name]}(#{arg[:name]}, cmock_size)"
31
+ lines << " #{function[:name]}_CMockReturnMemThruPtr_#{arg[:name]}(__LINE__, #{arg[:name]}, cmock_size)\n"
32
+ lines << "void #{function[:name]}_CMockReturnMemThruPtr_#{arg[:name]}(UNITY_LINE_TYPE cmock_line, #{arg[:type]} #{arg[:name]}, int cmock_size);\n"
33
+ end
34
+ end
35
+ lines
36
+ end
37
+
38
+ def mock_interfaces(function)
39
+ lines = []
40
+ func_name = function[:name]
41
+ function[:args].each do |arg|
42
+ arg_name = arg[:name]
43
+ arg_type = arg[:type]
44
+ if (@utils.ptr_or_str?(arg[:type]) and not arg[:const?])
45
+ lines << "void #{func_name}_CMockReturnMemThruPtr_#{arg_name}(UNITY_LINE_TYPE cmock_line, #{arg[:type]} #{arg_name}, int cmock_size)\n"
46
+ lines << "{\n"
47
+ lines << " CMOCK_#{func_name}_CALL_INSTANCE* cmock_call_instance = " +
48
+ "cmock_call_instance = (CMOCK_#{func_name}_CALL_INSTANCE*)CMock_Guts_GetAddressFor(CMock_Guts_MemEndOfChain(Mock.#{func_name}_CallInstance));\n"
49
+ lines << " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"#{arg_name} ReturnThruPtr called before Expect on '#{func_name}'.\");\n"
50
+ lines << " cmock_call_instance->ReturnThruPtr_#{arg_name}_Used = 1;\n"
51
+ lines << " cmock_call_instance->ReturnThruPtr_#{arg_name}_Val = #{arg_name};\n"
52
+ lines << " cmock_call_instance->ReturnThruPtr_#{arg_name}_Size = cmock_size;\n"
53
+ lines << "}\n\n"
54
+ end
55
+ end
56
+ lines
57
+ end
58
+
59
+ def mock_implementation(function)
60
+ lines = []
61
+ function[:args].each do |arg|
62
+ arg_name = arg[:name]
63
+ arg_type = arg[:type]
64
+ if (@utils.ptr_or_str?(arg[:type]) and not arg[:const?])
65
+ lines << " if (cmock_call_instance->ReturnThruPtr_#{arg_name}_Used)\n"
66
+ lines << " {\n"
67
+ lines << " memcpy(#{arg_name}, cmock_call_instance->ReturnThruPtr_#{arg_name}_Val,\n"
68
+ lines << " cmock_call_instance->ReturnThruPtr_#{arg_name}_Size);\n"
69
+ lines << " }\n"
70
+ end
71
+ end
72
+ lines
73
+ end
74
+ end
@@ -0,0 +1,202 @@
1
+ # ==========================================
2
+ # CMock Project - Automatic Mock Generation for C
3
+ # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4
+ # [Released under MIT License. Please refer to license.txt for details]
5
+ # ==========================================
6
+
7
+ class CMockGeneratorUtils
8
+
9
+ attr_accessor :config, :helpers, :ordered, :ptr_handling, :arrays, :cexception
10
+
11
+ def initialize(config, helpers={})
12
+ @config = config
13
+ @ptr_handling = @config.when_ptr
14
+ @ordered = @config.enforce_strict_ordering
15
+ @arrays = @config.plugins.include? :array
16
+ @cexception = @config.plugins.include? :cexception
17
+ @return_thru_ptr = @config.plugins.include? :return_thru_ptr
18
+ @ignore_arg = @config.plugins.include? :ignore_arg
19
+ @treat_as = @config.treat_as
20
+ @helpers = helpers
21
+
22
+ if (@arrays)
23
+ case(@ptr_handling)
24
+ when :smart then alias :code_verify_an_arg_expectation :code_verify_an_arg_expectation_with_smart_arrays
25
+ when :compare_data then alias :code_verify_an_arg_expectation :code_verify_an_arg_expectation_with_normal_arrays
26
+ when :compare_ptr then raise "ERROR: the array plugin doesn't enjoy working with :compare_ptr only. Disable one option."
27
+ end
28
+ else
29
+ alias :code_verify_an_arg_expectation :code_verify_an_arg_expectation_with_no_arrays
30
+ end
31
+ end
32
+
33
+ def code_add_base_expectation(func_name, global_ordering_supported=true)
34
+ lines = " CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_#{func_name}_CALL_INSTANCE));\n"
35
+ lines << " CMOCK_#{func_name}_CALL_INSTANCE* cmock_call_instance = (CMOCK_#{func_name}_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);\n"
36
+ lines << " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"CMock has run out of memory. Please allocate more.\");\n"
37
+ lines << " Mock.#{func_name}_CallInstance = CMock_Guts_MemChain(Mock.#{func_name}_CallInstance, cmock_guts_index);\n"
38
+ lines << " cmock_call_instance->LineNumber = cmock_line;\n"
39
+ lines << " cmock_call_instance->CallOrder = ++GlobalExpectCount;\n" if (@ordered and global_ordering_supported)
40
+ lines << " cmock_call_instance->ExceptionToThrow = CEXCEPTION_NONE;\n" if (@cexception)
41
+ lines
42
+ end
43
+
44
+ def code_add_an_arg_expectation(arg, depth=1)
45
+ lines = code_assign_argument_quickly("cmock_call_instance->Expected_#{arg[:name]}", arg)
46
+ lines << " cmock_call_instance->Expected_#{arg[:name]}_Depth = #{arg[:name]}_Depth;\n" if (@arrays and (depth.class == String))
47
+ lines << " cmock_call_instance->IgnoreArg_#{arg[:name]} = 0;\n" if (@ignore_arg)
48
+ lines << " cmock_call_instance->ReturnThruPtr_#{arg[:name]}_Used = 0;\n" if (@return_thru_ptr and ptr_or_str?(arg[:type]) and not arg[:const?])
49
+ lines
50
+ end
51
+
52
+ def code_assign_argument_quickly(dest, arg)
53
+ if (arg[:ptr?] or @treat_as.include?(arg[:type]))
54
+ " #{dest} = #{arg[:const?] ? "(#{arg[:type]})" : ''}#{arg[:name]};\n"
55
+ else
56
+ " memcpy(&#{dest}, &#{arg[:name]}, sizeof(#{arg[:type]}));\n"
57
+ end
58
+ end
59
+
60
+ def code_add_argument_loader(function)
61
+ if (function[:args_string] != "void")
62
+ if (@arrays)
63
+ args_string = function[:args].map do |m|
64
+ const_str = m[ :const? ] ? 'const ' : ''
65
+ m[:ptr?] ? "#{const_str}#{m[:type]} #{m[:name]}, int #{m[:name]}_Depth" : "#{const_str}#{m[:type]} #{m[:name]}"
66
+ end.join(', ')
67
+ "void CMockExpectParameters_#{function[:name]}(CMOCK_#{function[:name]}_CALL_INSTANCE* cmock_call_instance, #{args_string})\n{\n" +
68
+ function[:args].inject("") { |all, arg| all + code_add_an_arg_expectation(arg, (arg[:ptr?] ? "#{arg[:name]}_Depth" : 1) ) } +
69
+ "}\n\n"
70
+ else
71
+ "void CMockExpectParameters_#{function[:name]}(CMOCK_#{function[:name]}_CALL_INSTANCE* cmock_call_instance, #{function[:args_string]})\n{\n" +
72
+ function[:args].inject("") { |all, arg| all + code_add_an_arg_expectation(arg) } +
73
+ "}\n\n"
74
+ end
75
+ else
76
+ ""
77
+ end
78
+ end
79
+
80
+ def code_call_argument_loader(function)
81
+ if (function[:args_string] != "void")
82
+ args = function[:args].map do |m|
83
+ (@arrays and m[:ptr?]) ? "#{m[:name]}, 1" : m[:name]
84
+ end
85
+ " CMockExpectParameters_#{function[:name]}(cmock_call_instance, #{args.join(', ')});\n"
86
+ else
87
+ ""
88
+ end
89
+ end
90
+
91
+ def ptr_or_str?(arg_type)
92
+ return (arg_type.include? '*' or
93
+ @treat_as.fetch(arg_type, "").include? '*')
94
+ end
95
+
96
+ #private ######################
97
+
98
+ def lookup_expect_type(function, arg)
99
+ c_type = arg[:type]
100
+ arg_name = arg[:name]
101
+ expected = "cmock_call_instance->Expected_#{arg_name}"
102
+ ignore = "cmock_call_instance->IgnoreArg_#{arg_name}"
103
+ unity_func = if ((arg[:ptr?]) and ((c_type =~ /\*\*/) or (@ptr_handling == :compare_ptr)))
104
+ ['UNITY_TEST_ASSERT_EQUAL_PTR', '']
105
+ else
106
+ (@helpers.nil? or @helpers[:unity_helper].nil?) ? ["UNITY_TEST_ASSERT_EQUAL",''] : @helpers[:unity_helper].get_helper(c_type)
107
+ end
108
+ unity_msg = "Function '#{function[:name]}' called with unexpected value for argument '#{arg_name}'."
109
+ return c_type, arg_name, expected, ignore, unity_func[0], unity_func[1], unity_msg
110
+ end
111
+
112
+ def code_verify_an_arg_expectation_with_no_arrays(function, arg)
113
+ c_type, arg_name, expected, ignore, unity_func, pre, unity_msg = lookup_expect_type(function, arg)
114
+ lines = ""
115
+ lines << " if (!#{ignore})\n" if @ignore_arg
116
+ lines << " {\n"
117
+ case(unity_func)
118
+ when "UNITY_TEST_ASSERT_EQUAL_MEMORY"
119
+ c_type_local = c_type.gsub(/\*$/,'')
120
+ lines << " UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type_local}), cmock_line, \"#{unity_msg}\");\n"
121
+ when "UNITY_TEST_ASSERT_EQUAL_MEMORY"
122
+ lines << " if (#{pre}#{expected} == NULL)\n"
123
+ lines << " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }\n"
124
+ lines << " else\n"
125
+ lines << " { UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type.sub('*','')}), cmock_line, \"#{unity_msg}\"); }\n"
126
+ when /_ARRAY/
127
+ lines << " if (#{pre}#{expected} == NULL)\n"
128
+ lines << " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }\n"
129
+ lines << " else\n"
130
+ lines << " { #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, 1, cmock_line, \"#{unity_msg}\"); }\n"
131
+ else
132
+ lines << " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\");\n"
133
+ end
134
+ lines << " }\n"
135
+ lines
136
+ end
137
+
138
+ def code_verify_an_arg_expectation_with_normal_arrays(function, arg)
139
+ c_type, arg_name, expected, ignore, unity_func, pre, unity_msg = lookup_expect_type(function, arg)
140
+ depth_name = (arg[:ptr?]) ? "cmock_call_instance->Expected_#{arg_name}_Depth" : 1
141
+ lines = ""
142
+ lines << " if (!#{ignore})\n" if @ignore_arg
143
+ lines << " {\n"
144
+ case(unity_func)
145
+ when "UNITY_TEST_ASSERT_EQUAL_MEMORY"
146
+ c_type_local = c_type.gsub(/\*$/,'')
147
+ lines << " UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type_local}), cmock_line, \"#{unity_msg}\");\n"
148
+ when "UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY"
149
+ lines << " if (#{pre}#{expected} == NULL)\n"
150
+ lines << " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }\n"
151
+ lines << " else\n"
152
+ 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"
153
+ when /_ARRAY/
154
+ if (pre == '&')
155
+ lines << " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, #{depth_name}, cmock_line, \"#{unity_msg}\");\n"
156
+ else
157
+ lines << " if (#{pre}#{expected} == NULL)\n"
158
+ lines << " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }\n"
159
+ lines << " else\n"
160
+ lines << " { #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, #{depth_name}, cmock_line, \"#{unity_msg}\"); }\n"
161
+ end
162
+ else
163
+ lines << " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\");\n"
164
+ end
165
+ lines << " }\n"
166
+ lines
167
+ end
168
+
169
+ def code_verify_an_arg_expectation_with_smart_arrays(function, arg)
170
+ c_type, arg_name, expected, ignore, unity_func, pre, unity_msg = lookup_expect_type(function, arg)
171
+ depth_name = (arg[:ptr?]) ? "cmock_call_instance->Expected_#{arg_name}_Depth" : 1
172
+ lines = ""
173
+ lines << " if (!#{ignore})\n" if @ignore_arg
174
+ lines << " {\n"
175
+ case(unity_func)
176
+ when "UNITY_TEST_ASSERT_EQUAL_MEMORY"
177
+ c_type_local = c_type.gsub(/\*$/,'')
178
+ lines << " UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type_local}), cmock_line, \"#{unity_msg}\");\n"
179
+ when "UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY"
180
+ lines << " if (#{pre}#{expected} == NULL)\n"
181
+ lines << " { UNITY_TEST_ASSERT_NULL(#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }\n"
182
+ 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" : "")
183
+ lines << " else\n"
184
+ 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"
185
+ when /_ARRAY/
186
+ if (pre == '&')
187
+ lines << " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, #{depth_name}, cmock_line, \"#{unity_msg}\");\n"
188
+ else
189
+ lines << " if (#{pre}#{expected} == NULL)\n"
190
+ lines << " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }\n"
191
+ 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" : "")
192
+ lines << " else\n"
193
+ lines << " { #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, #{depth_name}, cmock_line, \"#{unity_msg}\"); }\n"
194
+ end
195
+ else
196
+ lines << " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\");\n"
197
+ end
198
+ lines << " }\n"
199
+ lines
200
+ end
201
+
202
+ end