ceedling 0.15.1 → 0.15.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (295) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +1 -1
  3. data/Gemfile.lock +9 -13
  4. data/README.md +21 -3
  5. data/{rakefile.rb → Rakefile} +0 -0
  6. data/lib/ceedling/version.rb +4 -4
  7. data/lib/ceedling/version.rb.erb +1 -1
  8. data/release/version.info +1 -1
  9. data/vendor/c_exception/Gemfile +1 -1
  10. data/vendor/c_exception/Gemfile.lock +12 -0
  11. data/vendor/c_exception/{docs/license.txt → LICENSE.txt} +9 -9
  12. data/vendor/c_exception/README.md +146 -0
  13. data/vendor/c_exception/{rakefile.rb → Rakefile} +6 -5
  14. data/vendor/c_exception/lib/CException.c +9 -6
  15. data/vendor/c_exception/release/build.info +1 -1
  16. data/vendor/c_exception/release/version.info +1 -1
  17. data/vendor/c_exception/test/CExceptionConfig.h +2 -0
  18. data/vendor/c_exception/test/TestException.c +4 -1
  19. data/vendor/cmock/README.md +24 -0
  20. data/vendor/cmock/{rakefile.rb → Rakefile} +12 -12
  21. data/vendor/cmock/docs/CMock Summary.odt +0 -0
  22. data/vendor/cmock/docs/CMock Summary.pdf +0 -0
  23. data/vendor/cmock/docs/CMock_Summary.md +130 -111
  24. data/vendor/cmock/docs/license.txt +1 -1
  25. data/vendor/cmock/lib/cmock.rb +36 -12
  26. data/vendor/cmock/lib/cmock_config.rb +39 -36
  27. data/vendor/cmock/lib/cmock_generator.rb +33 -25
  28. data/vendor/cmock/lib/cmock_generator_plugin_expect_any_args.rb +68 -0
  29. data/vendor/cmock/lib/cmock_generator_plugin_ignore.rb +18 -42
  30. data/vendor/cmock/lib/cmock_generator_plugin_return_thru_ptr.rb +2 -2
  31. data/vendor/cmock/lib/cmock_generator_utils.rb +39 -29
  32. data/vendor/cmock/lib/cmock_header_parser.rb +46 -39
  33. data/vendor/cmock/rakefile_helper.rb +38 -38
  34. data/vendor/cmock/src/cmock.c +20 -4
  35. data/vendor/cmock/src/cmock.h +6 -1
  36. data/vendor/cmock/src/cmock_internals.h +26 -3
  37. data/vendor/cmock/targets/clang_strict.yml +85 -0
  38. data/vendor/cmock/targets/gcc.yml +4 -2
  39. data/vendor/cmock/targets/gcc_64.yml +55 -0
  40. data/vendor/cmock/test/c/TestCMockC.c +3 -3
  41. data/vendor/cmock/test/c/TestCMockCDynamic.c +11 -11
  42. data/vendor/cmock/test/c/TestCMockCDynamic_Runner.c +4 -2
  43. data/vendor/cmock/test/c/TestCMockC_Runner.c +1 -1
  44. data/vendor/cmock/test/system/systest_generator.rb +38 -26
  45. data/vendor/cmock/test/system/test_compilation/const.h +8 -3
  46. data/vendor/cmock/test/system/test_interactions/all_plugins_but_other_limits.yml +92 -58
  47. data/vendor/cmock/test/system/test_interactions/all_plugins_coexist.yml +53 -48
  48. data/vendor/cmock/test/system/test_interactions/array_and_pointer_handling.yml +58 -56
  49. data/vendor/cmock/test/system/test_interactions/basic_expect_and_return.yml +19 -18
  50. data/vendor/cmock/test/system/test_interactions/expect_and_return_custom_types.yml +13 -13
  51. data/vendor/cmock/test/system/test_interactions/expect_and_return_treat_as.yml +20 -20
  52. data/vendor/cmock/test/system/test_interactions/expect_any_args.yml +238 -0
  53. data/vendor/cmock/test/system/test_interactions/fancy_pointer_handling.yml +36 -34
  54. data/vendor/cmock/test/system/test_interactions/ignore_and_return.yml +24 -15
  55. data/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_2.yml +11 -11
  56. data/vendor/cmock/test/system/test_interactions/return_thru_ptr_and_expect_any_args.yml +235 -0
  57. data/vendor/cmock/test/system/test_interactions/return_thru_ptr_ignore_arg.yml +22 -26
  58. data/vendor/cmock/test/system/test_interactions/stubs_with_callbacks.yml +31 -31
  59. data/vendor/cmock/test/unit/cmock_generator_main_test.rb +141 -109
  60. data/vendor/cmock/test/unit/cmock_generator_plugin_expect_any_args_test.rb +82 -0
  61. data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_test.rb +17 -81
  62. data/vendor/cmock/test/unit/cmock_generator_plugin_return_thru_ptr_test.rb +10 -10
  63. data/vendor/cmock/test/unit/cmock_generator_utils_test.rb +47 -41
  64. data/vendor/cmock/test/unit/cmock_header_parser_test.rb +290 -227
  65. data/vendor/unity/{rakefile.rb → Rakefile} +13 -6
  66. data/vendor/unity/auto/colour_prompt.rb +33 -12
  67. data/vendor/unity/auto/generate_test_runner.rb +67 -63
  68. data/vendor/unity/auto/parseOutput.rb +189 -0
  69. data/vendor/{cmock/vendor/unity/examples → unity/examples/example_1}/makefile +41 -40
  70. data/vendor/unity/examples/example_1/readme.txt +5 -0
  71. data/vendor/{cmock/vendor/unity/examples → unity/examples/example_1}/src/ProductionCode.c +24 -24
  72. data/vendor/{c_exception/vendor/unity/examples → unity/examples/example_1}/src/ProductionCode.h +3 -3
  73. data/vendor/{cmock/vendor/unity/examples → unity/examples/example_1}/src/ProductionCode2.c +9 -9
  74. data/vendor/{c_exception/vendor/unity/examples → unity/examples/example_1}/src/ProductionCode2.h +2 -2
  75. data/vendor/{cmock/vendor/unity/examples → unity/examples/example_1}/test/TestProductionCode.c +62 -62
  76. data/vendor/unity/examples/{test → example_1/test}/TestProductionCode2.c +31 -31
  77. data/vendor/unity/examples/{test/no_ruby → example_1/test/test_runners}/TestProductionCode2_Runner.c +46 -46
  78. data/vendor/unity/examples/{test/no_ruby → example_1/test/test_runners}/TestProductionCode_Runner.c +50 -50
  79. data/vendor/unity/examples/example_2/makefile +45 -0
  80. data/vendor/unity/examples/example_2/readme.txt +5 -0
  81. data/vendor/unity/examples/{src → example_2/src}/ProductionCode.c +24 -24
  82. data/vendor/unity/examples/{src → example_2/src}/ProductionCode.h +3 -3
  83. data/vendor/unity/examples/{src → example_2/src}/ProductionCode2.c +9 -9
  84. data/vendor/unity/examples/{src → example_2/src}/ProductionCode2.h +2 -2
  85. data/vendor/unity/examples/{test → example_2/test}/TestProductionCode.c +64 -62
  86. data/vendor/{cmock/vendor/unity/examples → unity/examples/example_2}/test/TestProductionCode2.c +33 -31
  87. data/vendor/unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c +9 -0
  88. data/vendor/unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c +11 -0
  89. data/vendor/unity/examples/example_2/test/test_runners/all_tests.c +12 -0
  90. data/vendor/unity/examples/{helper → example_3/helper}/UnityHelper.c +10 -10
  91. data/vendor/{cmock/vendor/unity/examples → unity/examples/example_3}/helper/UnityHelper.h +12 -12
  92. data/vendor/unity/examples/{makefile → example_3/makefile} +41 -40
  93. data/vendor/unity/examples/{rakefile.rb → example_3/rakefile.rb} +44 -43
  94. data/vendor/{cmock/vendor/unity/examples → unity/examples/example_3}/rakefile_helper.rb +256 -256
  95. data/vendor/{c_exception/vendor/unity/examples → unity/examples/example_3}/readme.txt +18 -17
  96. data/vendor/{c_exception/vendor/unity/examples → unity/examples/example_3}/src/ProductionCode.c +24 -24
  97. data/vendor/{cmock/vendor/unity/examples → unity/examples/example_3}/src/ProductionCode.h +3 -3
  98. data/vendor/{c_exception/vendor/unity/examples → unity/examples/example_3}/src/ProductionCode2.c +9 -9
  99. data/vendor/{cmock/vendor/unity/examples → unity/examples/example_3}/src/ProductionCode2.h +2 -2
  100. data/vendor/{c_exception/vendor/unity/targets/gcc_64.yml → unity/examples/example_3/target_gcc_32.yml} +46 -44
  101. data/vendor/{c_exception/vendor/unity/examples → unity/examples/example_3}/test/TestProductionCode.c +62 -62
  102. data/vendor/{c_exception/vendor/unity/examples → unity/examples/example_3}/test/TestProductionCode2.c +31 -31
  103. data/vendor/{c_exception/vendor/unity/examples → unity/examples/example_3}/test/no_ruby/TestProductionCode2_Runner.c +46 -46
  104. data/vendor/{cmock/vendor/unity/examples → unity/examples/example_3}/test/no_ruby/TestProductionCode_Runner.c +50 -50
  105. data/vendor/unity/extras/eclipse/error_parsers.txt +26 -0
  106. data/vendor/unity/extras/fixture/src/unity_fixture.c +4 -1
  107. data/vendor/unity/extras/fixture/src/unity_fixture.h +17 -16
  108. data/vendor/unity/extras/fixture/src/unity_fixture_internals.h +7 -7
  109. data/vendor/unity/extras/fixture/test/unity_fixture_Test.c +17 -0
  110. data/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +1 -0
  111. data/vendor/unity/makefile +6 -4
  112. data/vendor/unity/rakefile_helper.rb +36 -27
  113. data/vendor/unity/src/unity.c +180 -181
  114. data/vendor/unity/src/unity.h +64 -2
  115. data/vendor/unity/src/unity_internals.h +188 -102
  116. data/vendor/unity/targets/clang_strict.yml +83 -0
  117. data/vendor/unity/targets/gcc_32.yml +5 -0
  118. data/vendor/unity/targets/gcc_64.yml +5 -0
  119. data/vendor/{c_exception/vendor/unity/targets/gcc.yml → unity/targets/gcc_auto_limits.yml} +5 -2
  120. data/vendor/{cmock/vendor/unity/targets/gcc_64.yml → unity/targets/gcc_auto_sizeof.yml} +6 -3
  121. data/vendor/{cmock/vendor/unity/targets/gcc.yml → unity/targets/gcc_auto_stdint.yml} +4 -2
  122. data/vendor/unity/test/expectdata/testsample_cmd.c +57 -54
  123. data/vendor/unity/test/expectdata/testsample_def.c +53 -50
  124. data/vendor/unity/test/expectdata/testsample_mock_cmd.c +79 -76
  125. data/vendor/unity/test/expectdata/testsample_mock_def.c +75 -72
  126. data/vendor/unity/test/expectdata/testsample_mock_new1.c +88 -85
  127. data/vendor/unity/test/expectdata/testsample_mock_new2.c +88 -85
  128. data/vendor/unity/test/expectdata/testsample_mock_param.c +76 -73
  129. data/vendor/unity/test/expectdata/testsample_mock_run1.c +88 -85
  130. data/vendor/unity/test/expectdata/testsample_mock_run2.c +88 -85
  131. data/vendor/unity/test/expectdata/testsample_mock_yaml.c +89 -86
  132. data/vendor/unity/test/expectdata/testsample_new1.c +63 -60
  133. data/vendor/unity/test/expectdata/testsample_new2.c +66 -63
  134. data/vendor/unity/test/expectdata/testsample_param.c +54 -51
  135. data/vendor/unity/test/expectdata/testsample_run1.c +63 -60
  136. data/vendor/unity/test/expectdata/testsample_run2.c +66 -63
  137. data/vendor/unity/test/expectdata/testsample_yaml.c +67 -64
  138. data/vendor/unity/test/test_generate_test_runner.rb +66 -72
  139. data/vendor/unity/test/testunity.c +591 -111
  140. metadata +58 -195
  141. data/vendor/c_exception/vendor/unity/auto/colour_prompt.rb +0 -94
  142. data/vendor/c_exception/vendor/unity/auto/colour_reporter.rb +0 -39
  143. data/vendor/c_exception/vendor/unity/auto/generate_config.yml +0 -36
  144. data/vendor/c_exception/vendor/unity/auto/generate_module.rb +0 -202
  145. data/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +0 -313
  146. data/vendor/c_exception/vendor/unity/auto/test_file_filter.rb +0 -23
  147. data/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb +0 -139
  148. data/vendor/c_exception/vendor/unity/docs/Unity Summary.odt +0 -0
  149. data/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf +0 -0
  150. data/vendor/c_exception/vendor/unity/docs/Unity Summary.txt +0 -217
  151. data/vendor/c_exception/vendor/unity/docs/license.txt +0 -31
  152. data/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.c +0 -10
  153. data/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.h +0 -12
  154. data/vendor/c_exception/vendor/unity/examples/makefile +0 -40
  155. data/vendor/c_exception/vendor/unity/examples/rakefile.rb +0 -32
  156. data/vendor/c_exception/vendor/unity/examples/rakefile_helper.rb +0 -256
  157. data/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c +0 -50
  158. data/vendor/c_exception/vendor/unity/extras/fixture/build/MakefileWorker.mk +0 -331
  159. data/vendor/c_exception/vendor/unity/extras/fixture/build/filterGcov.sh +0 -61
  160. data/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb +0 -37
  161. data/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb +0 -178
  162. data/vendor/c_exception/vendor/unity/extras/fixture/readme.txt +0 -9
  163. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +0 -381
  164. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h +0 -81
  165. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +0 -44
  166. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +0 -16
  167. data/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c +0 -21
  168. data/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c +0 -39
  169. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +0 -321
  170. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +0 -40
  171. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c +0 -56
  172. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h +0 -17
  173. data/vendor/c_exception/vendor/unity/makefile +0 -35
  174. data/vendor/c_exception/vendor/unity/rakefile.rb +0 -59
  175. data/vendor/c_exception/vendor/unity/rakefile_helper.rb +0 -240
  176. data/vendor/c_exception/vendor/unity/release/build.info +0 -2
  177. data/vendor/c_exception/vendor/unity/release/version.info +0 -2
  178. data/vendor/c_exception/vendor/unity/src/unity.c +0 -979
  179. data/vendor/c_exception/vendor/unity/src/unity.h +0 -232
  180. data/vendor/c_exception/vendor/unity/src/unity_internals.h +0 -424
  181. data/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml +0 -101
  182. data/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml +0 -89
  183. data/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml +0 -79
  184. data/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml +0 -79
  185. data/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml +0 -93
  186. data/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml +0 -83
  187. data/vendor/c_exception/vendor/unity/targets/iar_msp430.yml +0 -94
  188. data/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml +0 -85
  189. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c +0 -54
  190. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c +0 -50
  191. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c +0 -76
  192. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c +0 -72
  193. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c +0 -85
  194. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c +0 -85
  195. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c +0 -73
  196. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c +0 -85
  197. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c +0 -85
  198. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c +0 -86
  199. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c +0 -60
  200. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c +0 -63
  201. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c +0 -51
  202. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c +0 -60
  203. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c +0 -63
  204. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c +0 -64
  205. data/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb +0 -94
  206. data/vendor/c_exception/vendor/unity/test/testdata/mocksample.c +0 -51
  207. data/vendor/c_exception/vendor/unity/test/testdata/sample.yml +0 -9
  208. data/vendor/c_exception/vendor/unity/test/testdata/testsample.c +0 -51
  209. data/vendor/c_exception/vendor/unity/test/testparameterized.c +0 -101
  210. data/vendor/c_exception/vendor/unity/test/testunity.c +0 -2024
  211. data/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.odt +0 -0
  212. data/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.pdf +0 -0
  213. data/vendor/cmock/vendor/c_exception/docs/license.txt +0 -30
  214. data/vendor/cmock/vendor/c_exception/docs/readme.txt +0 -236
  215. data/vendor/cmock/vendor/c_exception/lib/CException.c +0 -39
  216. data/vendor/cmock/vendor/c_exception/lib/CException.h +0 -70
  217. data/vendor/cmock/vendor/c_exception/makefile +0 -24
  218. data/vendor/cmock/vendor/c_exception/rakefile.rb +0 -41
  219. data/vendor/cmock/vendor/c_exception/release/build.info +0 -2
  220. data/vendor/cmock/vendor/c_exception/release/version.info +0 -2
  221. data/vendor/cmock/vendor/c_exception/test/CExceptionConfig.h +0 -27
  222. data/vendor/cmock/vendor/c_exception/test/TestException.c +0 -291
  223. data/vendor/cmock/vendor/c_exception/test/TestException_Runner.c +0 -62
  224. data/vendor/cmock/vendor/unity/auto/colour_prompt.rb +0 -94
  225. data/vendor/cmock/vendor/unity/auto/colour_reporter.rb +0 -39
  226. data/vendor/cmock/vendor/unity/auto/generate_config.yml +0 -36
  227. data/vendor/cmock/vendor/unity/auto/generate_module.rb +0 -202
  228. data/vendor/cmock/vendor/unity/auto/generate_test_runner.rb +0 -313
  229. data/vendor/cmock/vendor/unity/auto/test_file_filter.rb +0 -23
  230. data/vendor/cmock/vendor/unity/auto/unity_test_summary.rb +0 -139
  231. data/vendor/cmock/vendor/unity/docs/Unity Summary.odt +0 -0
  232. data/vendor/cmock/vendor/unity/docs/Unity Summary.pdf +0 -0
  233. data/vendor/cmock/vendor/unity/docs/Unity Summary.txt +0 -217
  234. data/vendor/cmock/vendor/unity/docs/license.txt +0 -31
  235. data/vendor/cmock/vendor/unity/examples/helper/UnityHelper.c +0 -10
  236. data/vendor/cmock/vendor/unity/examples/rakefile.rb +0 -32
  237. data/vendor/cmock/vendor/unity/examples/readme.txt +0 -18
  238. data/vendor/cmock/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c +0 -46
  239. data/vendor/cmock/vendor/unity/extras/fixture/build/MakefileWorker.mk +0 -331
  240. data/vendor/cmock/vendor/unity/extras/fixture/build/filterGcov.sh +0 -61
  241. data/vendor/cmock/vendor/unity/extras/fixture/rakefile.rb +0 -37
  242. data/vendor/cmock/vendor/unity/extras/fixture/rakefile_helper.rb +0 -178
  243. data/vendor/cmock/vendor/unity/extras/fixture/readme.txt +0 -9
  244. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c +0 -381
  245. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h +0 -81
  246. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h +0 -44
  247. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +0 -16
  248. data/vendor/cmock/vendor/unity/extras/fixture/test/main/AllTests.c +0 -21
  249. data/vendor/cmock/vendor/unity/extras/fixture/test/testunity_fixture.c +0 -39
  250. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c +0 -321
  251. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +0 -40
  252. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.c +0 -56
  253. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.h +0 -17
  254. data/vendor/cmock/vendor/unity/makefile +0 -35
  255. data/vendor/cmock/vendor/unity/rakefile.rb +0 -48
  256. data/vendor/cmock/vendor/unity/rakefile_helper.rb +0 -240
  257. data/vendor/cmock/vendor/unity/release/build.info +0 -2
  258. data/vendor/cmock/vendor/unity/release/version.info +0 -2
  259. data/vendor/cmock/vendor/unity/src/unity.c +0 -979
  260. data/vendor/cmock/vendor/unity/src/unity.h +0 -232
  261. data/vendor/cmock/vendor/unity/src/unity_internals.h +0 -424
  262. data/vendor/cmock/vendor/unity/targets/hitech_picc18.yml +0 -101
  263. data/vendor/cmock/vendor/unity/targets/iar_arm_v4.yml +0 -89
  264. data/vendor/cmock/vendor/unity/targets/iar_arm_v5.yml +0 -79
  265. data/vendor/cmock/vendor/unity/targets/iar_arm_v5_3.yml +0 -79
  266. data/vendor/cmock/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml +0 -93
  267. data/vendor/cmock/vendor/unity/targets/iar_cortexm3_v5.yml +0 -83
  268. data/vendor/cmock/vendor/unity/targets/iar_msp430.yml +0 -94
  269. data/vendor/cmock/vendor/unity/targets/iar_sh2a_v6.yml +0 -85
  270. data/vendor/cmock/vendor/unity/test/expectdata/testsample_cmd.c +0 -54
  271. data/vendor/cmock/vendor/unity/test/expectdata/testsample_def.c +0 -50
  272. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_cmd.c +0 -76
  273. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_def.c +0 -72
  274. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new1.c +0 -85
  275. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new2.c +0 -85
  276. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_param.c +0 -73
  277. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run1.c +0 -85
  278. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run2.c +0 -85
  279. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_yaml.c +0 -86
  280. data/vendor/cmock/vendor/unity/test/expectdata/testsample_new1.c +0 -60
  281. data/vendor/cmock/vendor/unity/test/expectdata/testsample_new2.c +0 -63
  282. data/vendor/cmock/vendor/unity/test/expectdata/testsample_param.c +0 -51
  283. data/vendor/cmock/vendor/unity/test/expectdata/testsample_run1.c +0 -60
  284. data/vendor/cmock/vendor/unity/test/expectdata/testsample_run2.c +0 -63
  285. data/vendor/cmock/vendor/unity/test/expectdata/testsample_yaml.c +0 -64
  286. data/vendor/cmock/vendor/unity/test/test_generate_test_runner.rb +0 -94
  287. data/vendor/cmock/vendor/unity/test/testdata/mocksample.c +0 -51
  288. data/vendor/cmock/vendor/unity/test/testdata/sample.yml +0 -9
  289. data/vendor/cmock/vendor/unity/test/testdata/testsample.c +0 -51
  290. data/vendor/cmock/vendor/unity/test/testparameterized.c +0 -101
  291. data/vendor/cmock/vendor/unity/test/testunity.c +0 -2024
  292. data/vendor/unity/Gemfile +0 -4
  293. data/vendor/unity/examples/helper/UnityHelper.h +0 -12
  294. data/vendor/unity/examples/rakefile_helper.rb +0 -256
  295. data/vendor/unity/examples/readme.txt +0 -18
@@ -4,7 +4,7 @@ class CMockGeneratorPluginReturnThruPtr
4
4
 
5
5
  def initialize(config, utils)
6
6
  @utils = utils
7
- @priority = 9
7
+ @priority = 1
8
8
  end
9
9
 
10
10
  def instance_typedefs(function)
@@ -26,7 +26,7 @@ class CMockGeneratorPluginReturnThruPtr
26
26
  lines << "#define #{function[:name]}_ReturnThruPtr_#{arg[:name]}(#{arg[:name]})"
27
27
  lines << " #{function[:name]}_CMockReturnMemThruPtr_#{arg[:name]}(__LINE__, #{arg[:name]}, sizeof(*#{arg[:name]}))\n"
28
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"
29
+ lines << " #{function[:name]}_CMockReturnMemThruPtr_#{arg[:name]}(__LINE__, #{arg[:name]}, (int)(cmock_len * (int)sizeof(*#{arg[:name]})))\n"
30
30
  lines << "#define #{function[:name]}_ReturnMemThruPtr_#{arg[:name]}(#{arg[:name]}, cmock_size)"
31
31
  lines << " #{function[:name]}_CMockReturnMemThruPtr_#{arg[:name]}(__LINE__, #{arg[:name]}, cmock_size)\n"
32
32
  lines << "void #{function[:name]}_CMockReturnMemThruPtr_#{arg[:name]}(UNITY_LINE_TYPE cmock_line, #{arg[:type]} #{arg[:name]}, int cmock_size);\n"
@@ -2,7 +2,7 @@
2
2
  # CMock Project - Automatic Mock Generation for C
3
3
  # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4
4
  # [Released under MIT License. Please refer to license.txt for details]
5
- # ==========================================
5
+ # ==========================================
6
6
 
7
7
  class CMockGeneratorUtils
8
8
 
@@ -14,61 +14,67 @@ class CMockGeneratorUtils
14
14
  @ordered = @config.enforce_strict_ordering
15
15
  @arrays = @config.plugins.include? :array
16
16
  @cexception = @config.plugins.include? :cexception
17
+ @expect_any = @config.plugins.include? :expect_any_args
17
18
  @return_thru_ptr = @config.plugins.include? :return_thru_ptr
18
19
  @ignore_arg = @config.plugins.include? :ignore_arg
20
+ @ignore = @config.plugins.include? :ignore
19
21
  @treat_as = @config.treat_as
20
22
  @helpers = helpers
21
-
23
+ end
24
+
25
+ def code_verify_an_arg_expectation(function, arg)
22
26
  if (@arrays)
23
27
  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
28
+ when :smart then code_verify_an_arg_expectation_with_smart_arrays(function, arg)
29
+ when :compare_data then code_verify_an_arg_expectation_with_normal_arrays(function, arg)
26
30
  when :compare_ptr then raise "ERROR: the array plugin doesn't enjoy working with :compare_ptr only. Disable one option."
27
31
  end
28
32
  else
29
- alias :code_verify_an_arg_expectation :code_verify_an_arg_expectation_with_no_arrays
33
+ code_verify_an_arg_expectation_with_no_arrays(function, arg)
30
34
  end
31
35
  end
32
-
36
+
33
37
  def code_add_base_expectation(func_name, global_ordering_supported=true)
34
38
  lines = " CMOCK_MEM_INDEX_TYPE cmock_guts_index = CMock_Guts_MemNew(sizeof(CMOCK_#{func_name}_CALL_INSTANCE));\n"
35
39
  lines << " CMOCK_#{func_name}_CALL_INSTANCE* cmock_call_instance = (CMOCK_#{func_name}_CALL_INSTANCE*)CMock_Guts_GetAddressFor(cmock_guts_index);\n"
36
40
  lines << " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, \"CMock has run out of memory. Please allocate more.\");\n"
37
41
  lines << " Mock.#{func_name}_CallInstance = CMock_Guts_MemChain(Mock.#{func_name}_CallInstance, cmock_guts_index);\n"
42
+ lines << " Mock.#{func_name}_IgnoreBool = (int)0;\n" if (@ignore)
38
43
  lines << " cmock_call_instance->LineNumber = cmock_line;\n"
39
44
  lines << " cmock_call_instance->CallOrder = ++GlobalExpectCount;\n" if (@ordered and global_ordering_supported)
40
45
  lines << " cmock_call_instance->ExceptionToThrow = CEXCEPTION_NONE;\n" if (@cexception)
46
+ lines << " cmock_call_instance->IgnoreMode = CMOCK_ARG_ALL;\n" if (@expect_any)
41
47
  lines
42
48
  end
43
-
44
- def code_add_an_arg_expectation(arg, depth=1)
49
+
50
+ def code_add_an_arg_expectation(arg, depth=1)
45
51
  lines = code_assign_argument_quickly("cmock_call_instance->Expected_#{arg[:name]}", arg)
46
52
  lines << " cmock_call_instance->Expected_#{arg[:name]}_Depth = #{arg[:name]}_Depth;\n" if (@arrays and (depth.class == String))
47
53
  lines << " cmock_call_instance->IgnoreArg_#{arg[:name]} = 0;\n" if (@ignore_arg)
48
54
  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
55
  lines
50
56
  end
51
-
52
- def code_assign_argument_quickly(dest, arg)
57
+
58
+ def code_assign_argument_quickly(dest, arg)
53
59
  if (arg[:ptr?] or @treat_as.include?(arg[:type]))
54
60
  " #{dest} = #{arg[:const?] ? "(#{arg[:type]})" : ''}#{arg[:name]};\n"
55
61
  else
56
62
  " memcpy(&#{dest}, &#{arg[:name]}, sizeof(#{arg[:type]}));\n"
57
63
  end
58
64
  end
59
-
65
+
60
66
  def code_add_argument_loader(function)
61
67
  if (function[:args_string] != "void")
62
68
  if (@arrays)
63
- args_string = function[:args].map do |m|
69
+ args_string = function[:args].map do |m|
64
70
  const_str = m[ :const? ] ? 'const ' : ''
65
71
  m[:ptr?] ? "#{const_str}#{m[:type]} #{m[:name]}, int #{m[:name]}_Depth" : "#{const_str}#{m[:type]} #{m[:name]}"
66
72
  end.join(', ')
67
- "void CMockExpectParameters_#{function[:name]}(CMOCK_#{function[:name]}_CALL_INSTANCE* cmock_call_instance, #{args_string})\n{\n" +
73
+ "void CMockExpectParameters_#{function[:name]}(CMOCK_#{function[:name]}_CALL_INSTANCE* cmock_call_instance, #{args_string})\n{\n" +
68
74
  function[:args].inject("") { |all, arg| all + code_add_an_arg_expectation(arg, (arg[:ptr?] ? "#{arg[:name]}_Depth" : 1) ) } +
69
75
  "}\n\n"
70
76
  else
71
- "void CMockExpectParameters_#{function[:name]}(CMOCK_#{function[:name]}_CALL_INSTANCE* cmock_call_instance, #{function[:args_string]})\n{\n" +
77
+ "void CMockExpectParameters_#{function[:name]}(CMOCK_#{function[:name]}_CALL_INSTANCE* cmock_call_instance, #{function[:args_string]})\n{\n" +
72
78
  function[:args].inject("") { |all, arg| all + code_add_an_arg_expectation(arg) } +
73
79
  "}\n\n"
74
80
  end
@@ -76,25 +82,25 @@ class CMockGeneratorUtils
76
82
  ""
77
83
  end
78
84
  end
79
-
85
+
80
86
  def code_call_argument_loader(function)
81
87
  if (function[:args_string] != "void")
82
88
  args = function[:args].map do |m|
83
89
  (@arrays and m[:ptr?]) ? "#{m[:name]}, 1" : m[:name]
84
90
  end
85
- " CMockExpectParameters_#{function[:name]}(cmock_call_instance, #{args.join(', ')});\n"
91
+ " CMockExpectParameters_#{function[:name]}(cmock_call_instance, #{args.join(', ')});\n"
86
92
  else
87
93
  ""
88
94
  end
89
95
  end
90
-
96
+
91
97
  def ptr_or_str?(arg_type)
92
98
  return (arg_type.include? '*' or
93
99
  @treat_as.fetch(arg_type, "").include? '*')
94
100
  end
95
101
 
96
102
  #private ######################
97
-
103
+
98
104
  def lookup_expect_type(function, arg)
99
105
  c_type = arg[:type]
100
106
  arg_name = arg[:name]
@@ -108,7 +114,7 @@ class CMockGeneratorUtils
108
114
  unity_msg = "Function '#{function[:name]}' called with unexpected value for argument '#{arg_name}'."
109
115
  return c_type, arg_name, expected, ignore, unity_func[0], unity_func[1], unity_msg
110
116
  end
111
-
117
+
112
118
  def code_verify_an_arg_expectation_with_no_arrays(function, arg)
113
119
  c_type, arg_name, expected, ignore, unity_func, pre, unity_msg = lookup_expect_type(function, arg)
114
120
  lines = ""
@@ -124,17 +130,21 @@ class CMockGeneratorUtils
124
130
  lines << " else\n"
125
131
  lines << " { UNITY_TEST_ASSERT_EQUAL_MEMORY((void*)(#{pre}#{expected}), (void*)(#{pre}#{arg_name}), sizeof(#{c_type.sub('*','')}), cmock_line, \"#{unity_msg}\"); }\n"
126
132
  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"
133
+ if (pre == '&')
134
+ lines << " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, 1, cmock_line, \"#{unity_msg}\");\n"
135
+ else
136
+ lines << " if (#{pre}#{expected} == NULL)\n"
137
+ lines << " { UNITY_TEST_ASSERT_NULL(#{pre}#{arg_name}, cmock_line, \"Expected NULL. #{unity_msg}\"); }\n"
138
+ lines << " else\n"
139
+ lines << " { #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, 1, cmock_line, \"#{unity_msg}\"); }\n"
140
+ end
131
141
  else
132
- lines << " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\");\n"
142
+ lines << " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\");\n"
133
143
  end
134
144
  lines << " }\n"
135
145
  lines
136
146
  end
137
-
147
+
138
148
  def code_verify_an_arg_expectation_with_normal_arrays(function, arg)
139
149
  c_type, arg_name, expected, ignore, unity_func, pre, unity_msg = lookup_expect_type(function, arg)
140
150
  depth_name = (arg[:ptr?]) ? "cmock_call_instance->Expected_#{arg_name}_Depth" : 1
@@ -160,12 +170,12 @@ class CMockGeneratorUtils
160
170
  lines << " { #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, #{depth_name}, cmock_line, \"#{unity_msg}\"); }\n"
161
171
  end
162
172
  else
163
- lines << " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\");\n"
173
+ lines << " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\");\n"
164
174
  end
165
175
  lines << " }\n"
166
176
  lines
167
177
  end
168
-
178
+
169
179
  def code_verify_an_arg_expectation_with_smart_arrays(function, arg)
170
180
  c_type, arg_name, expected, ignore, unity_func, pre, unity_msg = lookup_expect_type(function, arg)
171
181
  depth_name = (arg[:ptr?]) ? "cmock_call_instance->Expected_#{arg_name}_Depth" : 1
@@ -193,10 +203,10 @@ class CMockGeneratorUtils
193
203
  lines << " { #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, #{depth_name}, cmock_line, \"#{unity_msg}\"); }\n"
194
204
  end
195
205
  else
196
- lines << " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\");\n"
206
+ lines << " #{unity_func}(#{pre}#{expected}, #{pre}#{arg_name}, cmock_line, \"#{unity_msg}\");\n"
197
207
  end
198
208
  lines << " }\n"
199
209
  lines
200
210
  end
201
-
211
+
202
212
  end
@@ -2,12 +2,12 @@
2
2
  # CMock Project - Automatic Mock Generation for C
3
3
  # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4
4
  # [Released under MIT License. Please refer to license.txt for details]
5
- # ==========================================
5
+ # ==========================================
6
6
 
7
7
  class CMockHeaderParser
8
8
 
9
9
  attr_accessor :funcs, :c_attributes, :treat_as_void, :treat_externs
10
-
10
+
11
11
  def initialize(cfg)
12
12
  @funcs = []
13
13
  @c_strippables = cfg.strippables
@@ -22,31 +22,34 @@ class CMockHeaderParser
22
22
  @treat_externs = cfg.treat_externs
23
23
  @c_strippables += ['extern'] if (@treat_externs == :include) #we'll need to remove the attribute if we're allowing externs
24
24
  end
25
-
25
+
26
26
  def parse(name, source)
27
27
  @module_name = name.gsub(/\W/,'')
28
28
  @typedefs = []
29
29
  @funcs = []
30
30
  function_names = []
31
-
32
- parse_functions( import_source(source) ).map do |decl|
31
+
32
+ parse_functions( import_source(source) ).map do |decl|
33
33
  func = parse_declaration(decl)
34
34
  unless (function_names.include? func[:name])
35
35
  @funcs << func
36
36
  function_names << func[:name]
37
37
  end
38
38
  end
39
-
39
+
40
40
  { :includes => nil,
41
41
  :functions => @funcs,
42
42
  :typedefs => @typedefs
43
43
  }
44
44
  end
45
-
45
+
46
46
  private if $ThisIsOnlyATest.nil? ################
47
-
47
+
48
48
  def import_source(source)
49
49
 
50
+ # let's clean up the encoding in case they've done anything weird with the characters we might find
51
+ source = source.force_encoding("ISO-8859-1").encode("utf-8", :replace => nil) if ($QUICK_RUBY_VERSION > 10900)
52
+
50
53
  # void must be void for cmock _ExpectAndReturn calls to process properly, not some weird typedef which equates to void
51
54
  # to a certain extent, this action assumes we're chewing on pre-processed header files, otherwise we'll most likely just get stuff from @treat_as_void
52
55
  @local_as_void = @treat_as_void
@@ -54,48 +57,49 @@ class CMockHeaderParser
54
57
  if void_types
55
58
  @local_as_void += void_types.flatten.uniq.compact
56
59
  end
57
-
60
+
58
61
  # smush multiline macros into single line (checking for continuation character at end of line '\')
59
62
  source.gsub!(/\s*\\\s*/m, ' ')
60
-
63
+
61
64
  #remove comments (block and line, in three steps to ensure correct precedence)
62
65
  source.gsub!(/\/\/(?:.+\/\*|\*(?:$|[^\/])).*$/, '') # remove line comments that comment out the start of blocks
63
- source.gsub!(/\/\*.*?\*\//m, '') # remove block comments
66
+ source.gsub!(/\/\*.*?\*\//m, '') # remove block comments
64
67
  source.gsub!(/\/\/.*$/, '') # remove line comments (all that remain)
65
68
 
66
69
  # remove assembler pragma sections
67
70
  source.gsub!(/^\s*#\s*pragma\s+asm\s+.*?#\s*pragma\s+endasm/m, '')
68
-
71
+
69
72
  # remove gcc's __attribute__ tags
70
- source.gsub(/__attrbute__\s*\(\(\.*\)\)/, '')
71
-
72
- # remove preprocessor statements and extern "C"
73
+ source.gsub!(/__attribute(?:__)?\s*\(\(+.*\)\)+/, '')
74
+
75
+ # remove preprocessor statements and extern "C"
73
76
  source.gsub!(/^\s*#.*/, '')
74
77
  source.gsub!(/extern\s+\"C\"\s+\{/, '')
75
-
78
+
76
79
  # enums, unions, structs, and typedefs can all contain things (e.g. function pointers) that parse like function prototypes, so yank them
77
80
  # forward declared structs are removed before struct definitions so they don't mess up real thing later. we leave structs keywords in function prototypes
78
81
  source.gsub!(/^[\w\s]*struct[^;\{\}\(\)]+;/m, '') # remove forward declared structs
79
82
  source.gsub!(/^[\w\s]*(enum|union|struct|typepdef)[\w\s]*\{[^\}]+\}[\w\s\*\,]*;/m, '') # remove struct, union, and enum definitions and typedefs with braces
80
83
  source.gsub!(/(\W)(?:register|auto|static|restrict)(\W)/, '\1\2') # remove problem keywords
81
84
  source.gsub!(/\s*=\s*['"a-zA-Z0-9_\.]+\s*/, '') # remove default value statements from argument lists
82
- source.gsub!(/^(?:[\w\s]*\W)?typedef\W.*/, '') # remove typedef statements
85
+ source.gsub!(/^(?:[\w\s]*\W)?typedef\W[^;]*/m, '') # remove typedef statements
86
+ source.gsub!(/\)(\w)/, ') \1') # add space between parenthese and alphanumeric
83
87
  source.gsub!(/(^|\W+)(?:#{@c_strippables.join('|')})(?=$|\W+)/,'\1') unless @c_strippables.empty? # remove known attributes slated to be stripped
84
-
88
+
85
89
  #scan for functions which return function pointers, because they are a pain
86
90
  source.gsub!(/([\w\s\*]+)\(*\(\s*\*([\w\s\*]+)\s*\(([\w\s\*,]*)\)\)\s*\(([\w\s\*,]*)\)\)*/) do |m|
87
91
  functype = "cmock_#{@module_name}_func_ptr#{@typedefs.size + 1}"
88
92
  @typedefs << "typedef #{$1.strip}(*#{functype})(#{$4});"
89
93
  "#{functype} #{$2.strip}(#{$3});"
90
94
  end
91
-
95
+
92
96
  #drop extra white space to make the rest go faster
93
97
  source.gsub!(/^\s+/, '') # remove extra white space from beginning of line
94
98
  source.gsub!(/\s+$/, '') # remove extra white space from end of line
95
99
  source.gsub!(/\s*\(\s*/, '(') # remove extra white space from before left parens
96
100
  source.gsub!(/\s*\)\s*/, ')') # remove extra white space from before right parens
97
101
  source.gsub!(/\s+/, ' ') # remove remaining extra white space
98
-
102
+
99
103
  #split lines on semicolons and remove things that are obviously not what we are looking for
100
104
  src_lines = source.split(/\s*;\s*/)
101
105
  src_lines.delete_if {|line| line.strip.length == 0} # remove blank lines
@@ -105,6 +109,9 @@ class CMockHeaderParser
105
109
  else
106
110
  src_lines.delete_if {|line| !(line =~ /(?:^|\s+)(?:extern|inline)\s+/).nil?} # remove inline and extern functions
107
111
  end
112
+ src_lines.delete_if {|line| !(line =~ /\{/).nil? } # remove lines with opening braces { because this isn't a declaration, it's a definition!
113
+ src_lines.map!{|line| line.gsub(/.*\}/,'')} #remove braces left at the beginning of lines
114
+ src_lines.delete_if {|line| line.empty? } #drop empty lines
108
115
  end
109
116
 
110
117
  def parse_functions(source)
@@ -113,23 +120,23 @@ class CMockHeaderParser
113
120
  if funcs.empty?
114
121
  case @when_no_prototypes
115
122
  when :error
116
- raise "ERROR: No function prototypes found!"
123
+ raise "ERROR: No function prototypes found!"
117
124
  when :warn
118
125
  puts "WARNING: No function prototypes found!" unless (@verbosity < 1)
119
126
  end
120
127
  end
121
128
  return funcs
122
129
  end
123
-
130
+
124
131
  def parse_args(arg_list)
125
132
  args = []
126
133
  arg_list.split(',').each do |arg|
127
- arg.strip!
134
+ arg.strip!
128
135
  return args if (arg =~ /^\s*((\.\.\.)|(void))\s*$/) # we're done if we reach void by itself or ...
129
136
  arg_array = arg.split
130
137
  arg_elements = arg_array - @c_attributes # split up words and remove known attributes
131
- args << { :type => (arg_type =arg_elements[0..-2].join(' ')),
132
- :name => arg_elements[-1],
138
+ args << { :type => (arg_type =arg_elements[0..-2].join(' ')),
139
+ :name => arg_elements[-1],
133
140
  :ptr? => divine_ptr(arg_type),
134
141
  :const? => arg_array.include?('const')
135
142
  }
@@ -151,7 +158,7 @@ class CMockHeaderParser
151
158
  arg_list.gsub!(/(\w+)(?:\s*\[[\s\d\w+-]*\])+/,'*\1') # magically turn brackets into asterisks
152
159
  arg_list.gsub!(/\s+\*/,'*') # remove space to place asterisks with type (where they belong)
153
160
  arg_list.gsub!(/\*(\w)/,'* \1') # pull asterisks away from arg to place asterisks with type (where they belong)
154
-
161
+
155
162
  #scan argument list for function pointers and replace them with custom types
156
163
  arg_list.gsub!(/([\w\s\*]+)\(+\s*\*[\*\s]*([\w\s]*)\s*\)+\s*\(((?:[\w\s\*]*,?)*)\s*\)*/) do |m|
157
164
 
@@ -168,25 +175,25 @@ class CMockHeaderParser
168
175
  funcname = "cmock_arg#{c+=1}" if (funcname.empty?)
169
176
  "#{functype} #{funconst}#{funcname}"
170
177
  end
171
-
178
+
172
179
  #automatically name unnamed arguments (those that only had a type)
173
- arg_list.split(/\s*,\s*/).map { |arg|
180
+ arg_list.split(/\s*,\s*/).map { |arg|
174
181
  parts = (arg.split - ['struct', 'union', 'enum', 'const', 'const*'])
175
182
  if ((parts.size < 2) or (parts[-1][-1].chr == '*') or (@standards.include?(parts[-1])))
176
- "#{arg} cmock_arg#{c+=1}"
183
+ "#{arg} cmock_arg#{c+=1}"
177
184
  else
178
185
  arg
179
186
  end
180
187
  }.join(', ')
181
188
  end
182
189
  end
183
-
190
+
184
191
  def parse_declaration(declaration)
185
192
  decl = {}
186
-
193
+
187
194
  regex_match = @declaration_parse_matcher.match(declaration)
188
- raise "Failed parsing function declaration: '#{declaration}'" if regex_match.nil?
189
-
195
+ raise "Failed parsing function declaration: '#{declaration}'" if regex_match.nil?
196
+
190
197
  #grab argument list
191
198
  args = regex_match[2].strip
192
199
 
@@ -214,17 +221,17 @@ class CMockHeaderParser
214
221
  decl[:modifier] = decl[:modifier].join(' ')
215
222
  rettype = rettype.join(' ')
216
223
  rettype = 'void' if (@local_as_void.include?(rettype.strip))
217
- decl[:return] = { :type => rettype,
218
- :name => 'cmock_to_return',
224
+ decl[:return] = { :type => rettype,
225
+ :name => 'cmock_to_return',
219
226
  :ptr? => divine_ptr(rettype),
220
- :const? => rettype.split(/\s/).include?('const'),
227
+ :const? => decl[:modifier].split(/\s/).include?('const'),
221
228
  :str => "#{rettype} cmock_to_return",
222
229
  :void? => (rettype == 'void')
223
230
  }
224
-
231
+
225
232
  #remove default argument statements from mock definitions
226
233
  args.gsub!(/=\s*[a-zA-Z0-9_\.]+\s*/, ' ')
227
-
234
+
228
235
  #check for var args
229
236
  if (args =~ /\.\.\./)
230
237
  decl[:var_arg] = args.match( /[\w\s]*\.\.\./ ).to_s.strip
@@ -241,7 +248,7 @@ class CMockHeaderParser
241
248
  decl[:args] = parse_args(args)
242
249
  decl[:args_call] = decl[:args].map{|a| a[:name]}.join(', ')
243
250
  decl[:contains_ptr?] = decl[:args].inject(false) {|ptr, arg| arg[:ptr?] ? true : ptr }
244
-
251
+
245
252
  if (decl[:return][:type].nil? or decl[:name].nil? or decl[:args].nil? or
246
253
  decl[:return][:type].empty? or decl[:name].empty?)
247
254
  raise "Failed Parsing Declaration Prototype!\n" +
@@ -2,7 +2,7 @@
2
2
  # CMock Project - Automatic Mock Generation for C
3
3
  # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4
4
  # [Released under MIT License. Please refer to license.txt for details]
5
- # ==========================================
5
+ # ==========================================
6
6
 
7
7
  require 'yaml'
8
8
  require 'fileutils'
@@ -18,23 +18,23 @@ module RakefileHelpers
18
18
  SYSTEST_COMPILE_MOCKABLES_PATH = 'test/system/test_compilation/'
19
19
  C_EXTENSION = '.c'
20
20
  RESULT_EXTENSION = '.result'
21
-
21
+
22
22
  def load_configuration(config_file)
23
23
  $cfg_file = config_file
24
24
  $cfg = YAML.load(File.read('./targets/' + $cfg_file))
25
25
  $colour_output = false unless $cfg['colour']
26
26
  end
27
-
27
+
28
28
  def configure_clean
29
29
  CLEAN.include(SYSTEST_GENERATED_FILES_PATH + '*.*')
30
30
  CLEAN.include(SYSTEST_BUILD_FILES_PATH + '*.*')
31
31
  end
32
-
32
+
33
33
  def configure_toolchain(config_file)
34
34
  load_configuration(config_file)
35
35
  configure_clean
36
36
  end
37
-
37
+
38
38
  def get_local_include_dirs
39
39
  include_dirs = $cfg['compiler']['includes']['items'].dup
40
40
  include_dirs.delete_if {|dir| dir.is_a?(Array)}
@@ -90,7 +90,7 @@ module RakefileHelpers
90
90
  execute(cmd_str + obj_file)
91
91
  return obj_file
92
92
  end
93
-
93
+
94
94
  def build_linker_fields
95
95
  command = tackit($cfg['linker']['path'])
96
96
  if $cfg['linker']['options'].nil?
@@ -106,7 +106,7 @@ module RakefileHelpers
106
106
  includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR)
107
107
  return {:command => command, :options => options, :includes => includes}
108
108
  end
109
-
109
+
110
110
  def link_it(exe_name, obj_list)
111
111
  linker = build_linker_fields
112
112
  cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " +
@@ -116,7 +116,7 @@ module RakefileHelpers
116
116
  exe_name + $cfg['linker']['bin_files']['extension']
117
117
  execute(cmd_str)
118
118
  end
119
-
119
+
120
120
  def build_simulator_fields
121
121
  return nil if $cfg['simulator'].nil?
122
122
  if $cfg['simulator']['path'].nil?
@@ -136,7 +136,7 @@ module RakefileHelpers
136
136
  end
137
137
  return {:command => command, :pre_support => pre_support, :post_support => post_support}
138
138
  end
139
-
139
+
140
140
  def execute(command_string, verbose=true, raise_on_failure=true)
141
141
  #report command_string
142
142
  output = `#{command_string}`.chomp
@@ -146,7 +146,7 @@ module RakefileHelpers
146
146
  end
147
147
  return output
148
148
  end
149
-
149
+
150
150
  def tackit(strings)
151
151
  case(strings)
152
152
  when Array
@@ -159,7 +159,7 @@ module RakefileHelpers
159
159
  strings
160
160
  end
161
161
  end
162
-
162
+
163
163
  def report_summary
164
164
  summary = UnityTestSummary.new
165
165
  summary.set_root_path(File.expand_path(File.dirname(__FILE__)) + '/')
@@ -170,28 +170,28 @@ module RakefileHelpers
170
170
  summary.run
171
171
  fail_out "FAIL: There were failures" if (summary.failures > 0)
172
172
  end
173
-
173
+
174
174
  def run_system_test_interactions(test_case_files)
175
175
  load './lib/cmock.rb'
176
-
176
+
177
177
  SystemTestGenerator.new.generate_files(test_case_files)
178
178
  test_files = FileList.new(SYSTEST_GENERATED_FILES_PATH + 'test*.c')
179
-
179
+
180
180
  load_configuration($cfg_file)
181
181
  $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil?
182
-
182
+
183
183
  include_dirs = get_local_include_dirs
184
184
 
185
185
  # Build and execute each unit test
186
186
  test_files.each do |test|
187
187
 
188
188
  obj_list = []
189
-
189
+
190
190
  test_base = File.basename(test, C_EXTENSION)
191
191
  cmock_config = test_base.gsub(/test_/, '') + '_cmock.yml'
192
-
192
+
193
193
  report "Executing system tests in #{File.basename(test)}..."
194
-
194
+
195
195
  # Detect dependencies and build required required modules
196
196
  extract_headers(test).each do |header|
197
197
 
@@ -213,13 +213,13 @@ module RakefileHelpers
213
213
  runner_path = $cfg['compiler']['source_path'] + runner_name
214
214
  UnityTestRunnerGenerator.new(SYSTEST_GENERATED_FILES_PATH + cmock_config).run(test, runner_path)
215
215
  obj_list << compile(runner_path)
216
-
216
+
217
217
  # Build the test module
218
218
  obj_list << compile(test)
219
-
219
+
220
220
  # Link the test executable
221
221
  link_it(test_base, obj_list)
222
-
222
+
223
223
  # Execute unit test and generate results file
224
224
  simulator = build_simulator_fields
225
225
  executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension']
@@ -232,19 +232,19 @@ module RakefileHelpers
232
232
  test_results = $cfg['compiler']['build_path'] + test_base + RESULT_EXTENSION
233
233
  File.open(test_results, 'w') { |f| f.print output }
234
234
  end
235
-
235
+
236
236
  # Parse and report test results
237
237
  total_tests = 0
238
238
  total_failures = 0
239
239
  failure_messages = []
240
240
 
241
- test_case_files.each do |test_case|
241
+ test_case_files.each do |test_case|
242
242
  tests = (YAML.load_file(test_case))[:systest][:tests][:units]
243
243
  total_tests += tests.size
244
244
 
245
245
  test_file = 'test_' + File.basename(test_case).ext(C_EXTENSION)
246
246
  result_file = test_file.ext(RESULT_EXTENSION)
247
- test_results = File.readlines(SYSTEST_BUILD_FILES_PATH + result_file)
247
+ test_results = File.readlines(SYSTEST_BUILD_FILES_PATH + result_file).reject {|line| line.size < 10 } # we're rejecting lines that are too short to be realistic, which handles line ending problems
248
248
  tests.each_with_index do |test, index|
249
249
  # compare test's intended pass/fail state with pass/fail state in actual results;
250
250
  # if they don't match, the system test has failed
@@ -268,26 +268,26 @@ module RakefileHelpers
268
268
  end
269
269
  end
270
270
  end
271
-
271
+
272
272
  report "\n"
273
273
  report "------------------------------------\n"
274
274
  report "SYSTEM TEST MOCK INTERACTION SUMMARY\n"
275
275
  report "------------------------------------\n"
276
276
  report "#{total_tests} Tests #{total_failures} Failures 0 Ignored\n"
277
277
  report "\n"
278
-
278
+
279
279
  if (failure_messages.size > 0)
280
280
  report 'System test failures:'
281
281
  failure_messages.each do |failure|
282
282
  report failure
283
283
  end
284
284
  end
285
-
285
+
286
286
  report ''
287
287
 
288
288
  return total_failures
289
289
  end
290
-
290
+
291
291
  def profile_this(filename)
292
292
  profile = true
293
293
  begin
@@ -296,9 +296,9 @@ module RakefileHelpers
296
296
  rescue
297
297
  profile = false
298
298
  end
299
-
299
+
300
300
  yield
301
-
301
+
302
302
  if (profile)
303
303
  profile_result = RubyProf.stop
304
304
  File.open("Profile_#{filename}.html", 'w') do |f|
@@ -306,10 +306,10 @@ module RakefileHelpers
306
306
  end
307
307
  end
308
308
  end
309
-
309
+
310
310
  def run_system_test_compilations(mockables)
311
311
  load './lib/cmock.rb'
312
-
312
+
313
313
  load_configuration($cfg_file)
314
314
  $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil?
315
315
 
@@ -324,10 +324,10 @@ module RakefileHelpers
324
324
  compile(SYSTEST_GENERATED_FILES_PATH + mock_filename)
325
325
  end
326
326
  end
327
-
327
+
328
328
  def run_system_test_profiles(mockables)
329
329
  load './lib/cmock.rb'
330
-
330
+
331
331
  load_configuration($cfg_file)
332
332
  $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil?
333
333
 
@@ -337,8 +337,8 @@ module RakefileHelpers
337
337
  report "--------------------------\n"
338
338
  mockables.each do |header|
339
339
  mock_filename = 'mock_' + File.basename(header).ext('.c')
340
- profile_this(mock_filename.gsub('.c','')) do
341
- 10.times do
340
+ profile_this(mock_filename.gsub('.c','')) do
341
+ 10.times do
342
342
  CMock.new(SYSTEST_COMPILE_MOCKABLES_PATH + 'config.yml').setup_mocks(header)
343
343
  end
344
344
  end
@@ -346,7 +346,7 @@ module RakefileHelpers
346
346
  compile(SYSTEST_GENERATED_FILES_PATH + mock_filename)
347
347
  end
348
348
  end
349
-
349
+
350
350
  def build_and_test_c_files
351
351
  report "\n"
352
352
  report "----------------\n"
@@ -372,7 +372,7 @@ module RakefileHelpers
372
372
  end
373
373
  end
374
374
  end
375
-
375
+
376
376
  def fail_out(msg)
377
377
  puts msg
378
378
  exit(-1)