ceedling 0.13.0.rc1 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (426) hide show
  1. data/Gemfile.lock +32 -0
  2. data/README.md +8 -8
  3. data/assets/example_file.c +5 -0
  4. data/assets/example_file.h +6 -0
  5. data/assets/project_as_gem.yml +71 -0
  6. data/assets/{project.yml → project_with_guts.yml} +2 -0
  7. data/assets/rakefile_as_gem.rb +1 -0
  8. data/assets/{rakefile.rb → rakefile_with_guts.rb} +0 -0
  9. data/assets/test_example_file.c +13 -0
  10. data/bin/ceedling +55 -31
  11. data/ceedling-0.13.0.rc4.gem +0 -0
  12. data/ceedling.gemspec +13 -12
  13. data/ceedling.sublime-project +8 -0
  14. data/ceedling.sublime-workspace +365 -0
  15. data/examples/temp_sensor/project.yml +3 -4
  16. data/lib/ceedling.rb +13 -4
  17. data/lib/ceedling/version.rb +3 -3
  18. data/lib/project_file_loader.rb +1 -1
  19. data/lib/rakefile.rb +14 -1
  20. data/lib/target_loader.rb +38 -0
  21. data/plugins/bullseye/{template.erb → assets/template.erb} +0 -0
  22. data/plugins/bullseye/{defaults.yml → config/defaults.yml} +0 -0
  23. data/plugins/bullseye/{bullseye.rb → lib/bullseye.rb} +9 -10
  24. data/spec/spec_system_helper.rb +192 -0
  25. data/spec/system/deployment_spec.rb +116 -0
  26. data/tags +977 -0
  27. data/vendor/c_exception/docs/CExceptionSummary.odt +0 -0
  28. data/vendor/c_exception/docs/CExceptionSummary.pdf +0 -0
  29. data/vendor/c_exception/docs/license.txt +30 -0
  30. data/vendor/c_exception/docs/readme.txt +242 -0
  31. data/vendor/c_exception/makefile +24 -0
  32. data/vendor/c_exception/rakefile.rb +41 -0
  33. data/vendor/c_exception/test/CExceptionConfig.h +44 -0
  34. data/vendor/c_exception/test/TestException.c +328 -0
  35. data/vendor/c_exception/test/TestException_Runner.c +57 -0
  36. data/vendor/c_exception/vendor/unity/auto/colour_prompt.rb +94 -0
  37. data/vendor/c_exception/vendor/unity/auto/colour_reporter.rb +39 -0
  38. data/vendor/c_exception/vendor/unity/auto/generate_config.yml +36 -0
  39. data/vendor/c_exception/vendor/unity/auto/generate_module.rb +202 -0
  40. data/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +313 -0
  41. data/vendor/c_exception/vendor/unity/auto/test_file_filter.rb +23 -0
  42. data/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb +139 -0
  43. data/vendor/c_exception/vendor/unity/docs/Unity Summary.odt +0 -0
  44. data/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf +0 -0
  45. data/vendor/c_exception/vendor/unity/docs/Unity Summary.txt +217 -0
  46. data/vendor/c_exception/vendor/unity/docs/license.txt +31 -0
  47. data/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.c +10 -0
  48. data/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.h +12 -0
  49. data/vendor/c_exception/vendor/unity/examples/makefile +40 -0
  50. data/vendor/c_exception/vendor/unity/examples/rakefile.rb +32 -0
  51. data/vendor/c_exception/vendor/unity/examples/rakefile_helper.rb +256 -0
  52. data/vendor/c_exception/vendor/unity/examples/readme.txt +18 -0
  53. data/vendor/c_exception/vendor/unity/examples/src/ProductionCode.c +24 -0
  54. data/vendor/c_exception/vendor/unity/examples/src/ProductionCode.h +3 -0
  55. data/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.c +9 -0
  56. data/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.h +2 -0
  57. data/vendor/c_exception/vendor/unity/examples/test/TestProductionCode.c +62 -0
  58. data/vendor/c_exception/vendor/unity/examples/test/TestProductionCode2.c +31 -0
  59. data/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c +46 -0
  60. data/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c +50 -0
  61. data/vendor/c_exception/vendor/unity/extras/fixture/build/MakefileWorker.mk +331 -0
  62. data/vendor/c_exception/vendor/unity/extras/fixture/build/filterGcov.sh +61 -0
  63. data/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb +37 -0
  64. data/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb +178 -0
  65. data/vendor/c_exception/vendor/unity/extras/fixture/readme.txt +9 -0
  66. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +381 -0
  67. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h +81 -0
  68. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +44 -0
  69. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +16 -0
  70. data/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c +21 -0
  71. data/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c +39 -0
  72. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +321 -0
  73. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +40 -0
  74. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c +56 -0
  75. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h +17 -0
  76. data/vendor/c_exception/vendor/unity/makefile +35 -0
  77. data/vendor/c_exception/vendor/unity/rakefile.rb +59 -0
  78. data/vendor/c_exception/vendor/unity/rakefile_helper.rb +240 -0
  79. data/vendor/c_exception/vendor/unity/release/build.info +2 -0
  80. data/vendor/c_exception/vendor/unity/release/version.info +2 -0
  81. data/vendor/c_exception/vendor/unity/src/unity.c +979 -0
  82. data/vendor/c_exception/vendor/unity/src/unity.h +232 -0
  83. data/vendor/c_exception/vendor/unity/src/unity_internals.h +424 -0
  84. data/vendor/c_exception/vendor/unity/targets/gcc.yml +43 -0
  85. data/vendor/c_exception/vendor/unity/targets/gcc_64.yml +44 -0
  86. data/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml +101 -0
  87. data/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml +89 -0
  88. data/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml +79 -0
  89. data/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml +79 -0
  90. data/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml +93 -0
  91. data/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml +83 -0
  92. data/vendor/c_exception/vendor/unity/targets/iar_msp430.yml +94 -0
  93. data/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml +85 -0
  94. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c +54 -0
  95. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c +50 -0
  96. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c +76 -0
  97. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c +72 -0
  98. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c +85 -0
  99. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c +85 -0
  100. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c +73 -0
  101. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c +85 -0
  102. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c +85 -0
  103. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c +86 -0
  104. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c +60 -0
  105. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c +63 -0
  106. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c +51 -0
  107. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c +60 -0
  108. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c +63 -0
  109. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c +64 -0
  110. data/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb +94 -0
  111. data/vendor/c_exception/vendor/unity/test/testdata/mocksample.c +51 -0
  112. data/vendor/c_exception/vendor/unity/test/testdata/sample.yml +9 -0
  113. data/vendor/c_exception/vendor/unity/test/testdata/testsample.c +51 -0
  114. data/vendor/c_exception/vendor/unity/test/testparameterized.c +101 -0
  115. data/vendor/c_exception/vendor/unity/test/testunity.c +2024 -0
  116. data/vendor/cmock/docs/CMock Summary.odt +0 -0
  117. data/vendor/cmock/docs/CMock Summary.pdf +0 -0
  118. data/vendor/cmock/docs/CMock_Summary.md +356 -0
  119. data/vendor/cmock/docs/license.txt +31 -0
  120. data/vendor/cmock/examples/gcc.yml +43 -0
  121. data/vendor/cmock/examples/iar_v4.yml +91 -0
  122. data/vendor/cmock/examples/iar_v5.yml +80 -0
  123. data/vendor/cmock/examples/rakefile.rb +32 -0
  124. data/vendor/cmock/examples/rakefile_helper.rb +270 -0
  125. data/vendor/cmock/examples/src/AT91SAM7X256.h +2556 -0
  126. data/vendor/cmock/examples/src/AdcConductor.c +42 -0
  127. data/vendor/cmock/examples/src/AdcConductor.h +11 -0
  128. data/vendor/cmock/examples/src/AdcHardware.c +27 -0
  129. data/vendor/cmock/examples/src/AdcHardware.h +9 -0
  130. data/vendor/cmock/examples/src/AdcHardwareConfigurator.c +18 -0
  131. data/vendor/cmock/examples/src/AdcHardwareConfigurator.h +10 -0
  132. data/vendor/cmock/examples/src/AdcModel.c +33 -0
  133. data/vendor/cmock/examples/src/AdcModel.h +13 -0
  134. data/vendor/cmock/examples/src/AdcTemperatureSensor.c +51 -0
  135. data/vendor/cmock/examples/src/AdcTemperatureSensor.h +10 -0
  136. data/vendor/cmock/examples/src/Executor.c +25 -0
  137. data/vendor/cmock/examples/src/Executor.h +9 -0
  138. data/vendor/cmock/examples/src/IntrinsicsWrapper.c +18 -0
  139. data/vendor/cmock/examples/src/IntrinsicsWrapper.h +7 -0
  140. data/vendor/cmock/examples/src/Main.c +46 -0
  141. data/vendor/cmock/examples/src/Main.h +7 -0
  142. data/vendor/cmock/examples/src/Model.c +10 -0
  143. data/vendor/cmock/examples/src/Model.h +8 -0
  144. data/vendor/cmock/examples/src/ModelConfig.h +7 -0
  145. data/vendor/cmock/examples/src/TaskScheduler.c +72 -0
  146. data/vendor/cmock/examples/src/TaskScheduler.h +11 -0
  147. data/vendor/cmock/examples/src/TemperatureCalculator.c +27 -0
  148. data/vendor/cmock/examples/src/TemperatureCalculator.h +6 -0
  149. data/vendor/cmock/examples/src/TemperatureFilter.c +39 -0
  150. data/vendor/cmock/examples/src/TemperatureFilter.h +10 -0
  151. data/vendor/cmock/examples/src/TimerConductor.c +15 -0
  152. data/vendor/cmock/examples/src/TimerConductor.h +9 -0
  153. data/vendor/cmock/examples/src/TimerConfigurator.c +51 -0
  154. data/vendor/cmock/examples/src/TimerConfigurator.h +15 -0
  155. data/vendor/cmock/examples/src/TimerHardware.c +15 -0
  156. data/vendor/cmock/examples/src/TimerHardware.h +8 -0
  157. data/vendor/cmock/examples/src/TimerInterruptConfigurator.c +55 -0
  158. data/vendor/cmock/examples/src/TimerInterruptConfigurator.h +13 -0
  159. data/vendor/cmock/examples/src/TimerInterruptHandler.c +25 -0
  160. data/vendor/cmock/examples/src/TimerInterruptHandler.h +10 -0
  161. data/vendor/cmock/examples/src/TimerModel.c +9 -0
  162. data/vendor/cmock/examples/src/TimerModel.h +8 -0
  163. data/vendor/cmock/examples/src/Types.h +103 -0
  164. data/vendor/cmock/examples/src/UsartBaudRateRegisterCalculator.c +18 -0
  165. data/vendor/cmock/examples/src/UsartBaudRateRegisterCalculator.h +6 -0
  166. data/vendor/cmock/examples/src/UsartConductor.c +21 -0
  167. data/vendor/cmock/examples/src/UsartConductor.h +7 -0
  168. data/vendor/cmock/examples/src/UsartConfigurator.c +39 -0
  169. data/vendor/cmock/examples/src/UsartConfigurator.h +13 -0
  170. data/vendor/cmock/examples/src/UsartHardware.c +22 -0
  171. data/vendor/cmock/examples/src/UsartHardware.h +9 -0
  172. data/vendor/cmock/examples/src/UsartModel.c +34 -0
  173. data/vendor/cmock/examples/src/UsartModel.h +10 -0
  174. data/vendor/cmock/examples/src/UsartPutChar.c +16 -0
  175. data/vendor/cmock/examples/src/UsartPutChar.h +8 -0
  176. data/vendor/cmock/examples/src/UsartTransmitBufferStatus.c +7 -0
  177. data/vendor/cmock/examples/src/UsartTransmitBufferStatus.h +8 -0
  178. data/vendor/cmock/examples/test/TestAdcConductor.c +121 -0
  179. data/vendor/cmock/examples/test/TestAdcHardware.c +44 -0
  180. data/vendor/cmock/examples/test/TestAdcHardwareConfigurator.c +43 -0
  181. data/vendor/cmock/examples/test/TestAdcModel.c +33 -0
  182. data/vendor/cmock/examples/test/TestAdcTemperatureSensor.c +47 -0
  183. data/vendor/cmock/examples/test/TestExecutor.c +36 -0
  184. data/vendor/cmock/examples/test/TestMain.c +24 -0
  185. data/vendor/cmock/examples/test/TestModel.c +20 -0
  186. data/vendor/cmock/examples/test/TestTaskScheduler.c +104 -0
  187. data/vendor/cmock/examples/test/TestTemperatureCalculator.c +33 -0
  188. data/vendor/cmock/examples/test/TestTemperatureFilter.c +69 -0
  189. data/vendor/cmock/examples/test/TestTimerConductor.c +32 -0
  190. data/vendor/cmock/examples/test/TestTimerConfigurator.c +112 -0
  191. data/vendor/cmock/examples/test/TestTimerHardware.c +26 -0
  192. data/vendor/cmock/examples/test/TestTimerInterruptConfigurator.c +78 -0
  193. data/vendor/cmock/examples/test/TestTimerInterruptHandler.c +66 -0
  194. data/vendor/cmock/examples/test/TestTimerModel.c +18 -0
  195. data/vendor/cmock/examples/test/TestUsartBaudRateRegisterCalculator.c +21 -0
  196. data/vendor/cmock/examples/test/TestUsartConductor.c +40 -0
  197. data/vendor/cmock/examples/test/TestUsartConfigurator.c +77 -0
  198. data/vendor/cmock/examples/test/TestUsartHardware.c +37 -0
  199. data/vendor/cmock/examples/test/TestUsartModel.c +40 -0
  200. data/vendor/cmock/examples/test/TestUsartPutChar.c +43 -0
  201. data/vendor/cmock/examples/test/TestUsartTransmitBufferStatus.c +22 -0
  202. data/vendor/cmock/iar/iar_v4/Resource/SAM7_FLASH.mac +71 -0
  203. data/vendor/cmock/iar/iar_v4/Resource/SAM7_RAM.mac +94 -0
  204. data/vendor/cmock/iar/iar_v4/Resource/SAM7_SIM.mac +67 -0
  205. data/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_FLASH.xcl +185 -0
  206. data/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_RAM.xcl +185 -0
  207. data/vendor/cmock/iar/iar_v4/Resource/ioat91sam7x256.ddf +2259 -0
  208. data/vendor/cmock/iar/iar_v4/cmock_demo.dep +3691 -0
  209. data/vendor/cmock/iar/iar_v4/cmock_demo.ewd +1696 -0
  210. data/vendor/cmock/iar/iar_v4/cmock_demo.ewp +2581 -0
  211. data/vendor/cmock/iar/iar_v4/cmock_demo.eww +10 -0
  212. data/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X-EK.h +61 -0
  213. data/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.inc +2314 -0
  214. data/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.rdf +4704 -0
  215. data/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.tcl +3407 -0
  216. data/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256_inc.h +2268 -0
  217. data/vendor/cmock/iar/iar_v4/incIAR/ioat91sam7x256.h +4380 -0
  218. data/vendor/cmock/iar/iar_v4/incIAR/lib_AT91SAM7X256.h +4211 -0
  219. data/vendor/cmock/iar/iar_v4/settings/cmock_demo.cspy.bat +32 -0
  220. data/vendor/cmock/iar/iar_v4/settings/cmock_demo.dbgdt +86 -0
  221. data/vendor/cmock/iar/iar_v4/settings/cmock_demo.dni +42 -0
  222. data/vendor/cmock/iar/iar_v4/settings/cmock_demo.wsdt +76 -0
  223. data/vendor/cmock/iar/iar_v4/srcIAR/Cstartup.s79 +266 -0
  224. data/vendor/cmock/iar/iar_v4/srcIAR/Cstartup_SAM7.c +98 -0
  225. data/vendor/cmock/iar/iar_v5/Resource/SAM7_FLASH.mac +71 -0
  226. data/vendor/cmock/iar/iar_v5/Resource/SAM7_RAM.mac +94 -0
  227. data/vendor/cmock/iar/iar_v5/Resource/SAM7_SIM.mac +67 -0
  228. data/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_FLASH.icf +43 -0
  229. data/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_RAM.icf +42 -0
  230. data/vendor/cmock/iar/iar_v5/cmock_demo.dep +4204 -0
  231. data/vendor/cmock/iar/iar_v5/cmock_demo.ewd +1906 -0
  232. data/vendor/cmock/iar/iar_v5/cmock_demo.ewp +2426 -0
  233. data/vendor/cmock/iar/iar_v5/cmock_demo.eww +26 -0
  234. data/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X-EK.h +61 -0
  235. data/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X256_inc.h +2268 -0
  236. data/vendor/cmock/iar/iar_v5/incIAR/lib_AT91SAM7X256.h +4211 -0
  237. data/vendor/cmock/iar/iar_v5/incIAR/project.h +30 -0
  238. data/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.cspy.bat +33 -0
  239. data/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dbgdt +5 -0
  240. data/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dni +18 -0
  241. data/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.wsdt +74 -0
  242. data/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X_FLASH_Debug.jlink +12 -0
  243. data/vendor/cmock/iar/iar_v5/settings/cmock_demo.cspy.bat +33 -0
  244. data/vendor/cmock/iar/iar_v5/settings/cmock_demo.dbgdt +85 -0
  245. data/vendor/cmock/iar/iar_v5/settings/cmock_demo.dni +44 -0
  246. data/vendor/cmock/iar/iar_v5/settings/cmock_demo.wsdt +73 -0
  247. data/vendor/cmock/iar/iar_v5/settings/cmock_demo_Binary.jlink +12 -0
  248. data/vendor/cmock/iar/iar_v5/settings/cmock_demo_FLASH_Debug.jlink +12 -0
  249. data/vendor/cmock/iar/iar_v5/settings/cmock_demo_RAM_Debug.jlink +12 -0
  250. data/vendor/cmock/iar/iar_v5/srcIAR/Cstartup.s +299 -0
  251. data/vendor/cmock/iar/iar_v5/srcIAR/Cstartup_SAM7.c +98 -0
  252. data/vendor/cmock/rakefile.rb +111 -0
  253. data/vendor/cmock/rakefile_helper.rb +381 -0
  254. data/vendor/cmock/targets/gcc.yml +53 -0
  255. data/vendor/cmock/targets/iar_arm_v4.yml +108 -0
  256. data/vendor/cmock/targets/iar_arm_v5.yml +93 -0
  257. data/vendor/cmock/test/c/TestCMockC.c +280 -0
  258. data/vendor/cmock/test/c/TestCMockC.yml +12 -0
  259. data/vendor/cmock/test/c/TestCMockCDynamic.c +186 -0
  260. data/vendor/cmock/test/c/TestCMockCDynamic.yml +12 -0
  261. data/vendor/cmock/test/c/TestCMockCDynamic_Runner.c +35 -0
  262. data/vendor/cmock/test/c/TestCMockC_Runner.c +37 -0
  263. data/vendor/cmock/test/spec/cmock_file_writer_spec.rb +25 -0
  264. data/vendor/cmock/test/spec/spec_helper.rb +12 -0
  265. data/vendor/cmock/test/system/systest_generator.rb +178 -0
  266. data/vendor/cmock/test/system/test_compilation/callingconv.h +11 -0
  267. data/vendor/cmock/test/system/test_compilation/config.yml +9 -0
  268. data/vendor/cmock/test/system/test_compilation/const.h +15 -0
  269. data/vendor/cmock/test/system/test_compilation/osek.h +275 -0
  270. data/vendor/cmock/test/system/test_compilation/parsing.h +47 -0
  271. data/vendor/cmock/test/system/test_interactions/all_plugins_but_other_limits.yml +341 -0
  272. data/vendor/cmock/test/system/test_interactions/all_plugins_coexist.yml +382 -0
  273. data/vendor/cmock/test/system/test_interactions/array_and_pointer_handling.yml +382 -0
  274. data/vendor/cmock/test/system/test_interactions/basic_expect_and_return.yml +123 -0
  275. data/vendor/cmock/test/system/test_interactions/const_primitives_handling.yml +87 -0
  276. data/vendor/cmock/test/system/test_interactions/enforce_strict_ordering.yml +247 -0
  277. data/vendor/cmock/test/system/test_interactions/expect_and_return_custom_types.yml +108 -0
  278. data/vendor/cmock/test/system/test_interactions/expect_and_return_treat_as.yml +173 -0
  279. data/vendor/cmock/test/system/test_interactions/expect_and_throw.yml +170 -0
  280. data/vendor/cmock/test/system/test_interactions/fancy_pointer_handling.yml +208 -0
  281. data/vendor/cmock/test/system/test_interactions/function_pointer_handling.yml +82 -0
  282. data/vendor/cmock/test/system/test_interactions/ignore_and_return.yml +153 -0
  283. data/vendor/cmock/test/system/test_interactions/newer_standards_stuff1.yml +52 -0
  284. data/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_1.yml +91 -0
  285. data/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_2.yml +59 -0
  286. data/vendor/cmock/test/system/test_interactions/parsing_challenges.yml +222 -0
  287. data/vendor/cmock/test/system/test_interactions/struct_union_enum_expect_and_return.yml +277 -0
  288. data/vendor/cmock/test/system/test_interactions/stubs_with_callbacks.yml +221 -0
  289. data/vendor/cmock/test/system/test_interactions/unity_64bit_support.yml +77 -0
  290. data/vendor/cmock/test/system/test_interactions/unity_ignores.yml +139 -0
  291. data/vendor/cmock/test/test_helper.rb +44 -0
  292. data/vendor/cmock/test/unit/cmock_config_test.rb +121 -0
  293. data/vendor/cmock/test/unit/cmock_config_test.yml +5 -0
  294. data/vendor/cmock/test/unit/cmock_file_writer_test.rb +30 -0
  295. data/vendor/cmock/test/unit/cmock_generator_main_test.rb +413 -0
  296. data/vendor/cmock/test/unit/cmock_generator_plugin_array_test.rb +114 -0
  297. data/vendor/cmock/test/unit/cmock_generator_plugin_callback_test.rb +190 -0
  298. data/vendor/cmock/test/unit/cmock_generator_plugin_cexception_test.rb +94 -0
  299. data/vendor/cmock/test/unit/cmock_generator_plugin_expect_test.rb +206 -0
  300. data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_test.rb +168 -0
  301. data/vendor/cmock/test/unit/cmock_generator_utils_test.rb +291 -0
  302. data/vendor/cmock/test/unit/cmock_header_parser_test.rb +1247 -0
  303. data/vendor/cmock/test/unit/cmock_plugin_manager_test.rb +85 -0
  304. data/vendor/cmock/test/unit/cmock_unityhelper_parser_test.rb +223 -0
  305. data/vendor/cmock/vendor/behaviors/Manifest.txt +9 -0
  306. data/vendor/cmock/vendor/behaviors/Rakefile +19 -0
  307. data/vendor/cmock/vendor/behaviors/lib/behaviors.rb +76 -0
  308. data/vendor/cmock/vendor/behaviors/lib/behaviors/reporttask.rb +158 -0
  309. data/vendor/cmock/vendor/behaviors/test/behaviors_tasks_test.rb +73 -0
  310. data/vendor/cmock/vendor/behaviors/test/behaviors_test.rb +50 -0
  311. data/vendor/cmock/vendor/behaviors/test/tasks_test/Rakefile +19 -0
  312. data/vendor/cmock/vendor/behaviors/test/tasks_test/lib/user.rb +2 -0
  313. data/vendor/cmock/vendor/behaviors/test/tasks_test/test/user_test.rb +17 -0
  314. data/vendor/cmock/vendor/hardmock/CHANGES +78 -0
  315. data/vendor/cmock/vendor/hardmock/LICENSE +7 -0
  316. data/vendor/cmock/vendor/hardmock/README +70 -0
  317. data/vendor/cmock/vendor/hardmock/Rakefile +8 -0
  318. data/vendor/cmock/vendor/hardmock/config/environment.rb +12 -0
  319. data/vendor/cmock/vendor/hardmock/lib/assert_error.rb +23 -0
  320. data/vendor/cmock/vendor/hardmock/lib/extend_test_unit.rb +14 -0
  321. data/vendor/cmock/vendor/hardmock/lib/hardmock.rb +86 -0
  322. data/vendor/cmock/vendor/hardmock/lib/hardmock/errors.rb +22 -0
  323. data/vendor/cmock/vendor/hardmock/lib/hardmock/expectation.rb +229 -0
  324. data/vendor/cmock/vendor/hardmock/lib/hardmock/expectation_builder.rb +9 -0
  325. data/vendor/cmock/vendor/hardmock/lib/hardmock/expector.rb +26 -0
  326. data/vendor/cmock/vendor/hardmock/lib/hardmock/method_cleanout.rb +33 -0
  327. data/vendor/cmock/vendor/hardmock/lib/hardmock/mock.rb +180 -0
  328. data/vendor/cmock/vendor/hardmock/lib/hardmock/mock_control.rb +53 -0
  329. data/vendor/cmock/vendor/hardmock/lib/hardmock/stubbing.rb +210 -0
  330. data/vendor/cmock/vendor/hardmock/lib/hardmock/trapper.rb +31 -0
  331. data/vendor/cmock/vendor/hardmock/lib/hardmock/utils.rb +9 -0
  332. data/vendor/cmock/vendor/hardmock/lib/test_unit_before_after.rb +169 -0
  333. data/vendor/cmock/vendor/hardmock/rake_tasks/rdoc.rake +19 -0
  334. data/vendor/cmock/vendor/hardmock/rake_tasks/rdoc_options.rb +4 -0
  335. data/vendor/cmock/vendor/hardmock/rake_tasks/test.rake +22 -0
  336. data/vendor/cmock/vendor/hardmock/test/functional/assert_error_test.rb +52 -0
  337. data/vendor/cmock/vendor/hardmock/test/functional/auto_verify_test.rb +178 -0
  338. data/vendor/cmock/vendor/hardmock/test/functional/direct_mock_usage_test.rb +396 -0
  339. data/vendor/cmock/vendor/hardmock/test/functional/hardmock_test.rb +434 -0
  340. data/vendor/cmock/vendor/hardmock/test/functional/stubbing_test.rb +479 -0
  341. data/vendor/cmock/vendor/hardmock/test/test_helper.rb +43 -0
  342. data/vendor/cmock/vendor/hardmock/test/unit/expectation_builder_test.rb +19 -0
  343. data/vendor/cmock/vendor/hardmock/test/unit/expectation_test.rb +372 -0
  344. data/vendor/cmock/vendor/hardmock/test/unit/expector_test.rb +57 -0
  345. data/vendor/cmock/vendor/hardmock/test/unit/method_cleanout_test.rb +36 -0
  346. data/vendor/cmock/vendor/hardmock/test/unit/mock_control_test.rb +175 -0
  347. data/vendor/cmock/vendor/hardmock/test/unit/mock_test.rb +279 -0
  348. data/vendor/cmock/vendor/hardmock/test/unit/test_unit_before_after_test.rb +452 -0
  349. data/vendor/cmock/vendor/hardmock/test/unit/trapper_test.rb +62 -0
  350. data/vendor/cmock/vendor/hardmock/test/unit/verify_error_test.rb +40 -0
  351. data/vendor/unity/auto/generate_config.yml +36 -0
  352. data/vendor/unity/auto/unity_test_summary.rb +2 -2
  353. data/vendor/unity/docs/Unity Summary.odt +0 -0
  354. data/vendor/unity/docs/Unity Summary.pdf +0 -0
  355. data/vendor/unity/docs/Unity Summary.txt +216 -0
  356. data/vendor/unity/docs/license.txt +31 -0
  357. data/vendor/unity/examples/helper/UnityHelper.c +10 -0
  358. data/vendor/unity/examples/helper/UnityHelper.h +12 -0
  359. data/vendor/unity/examples/makefile +40 -0
  360. data/vendor/unity/examples/rakefile.rb +32 -0
  361. data/vendor/unity/examples/rakefile_helper.rb +256 -0
  362. data/vendor/unity/examples/readme.txt +18 -0
  363. data/vendor/unity/examples/src/ProductionCode.c +24 -0
  364. data/vendor/unity/examples/src/ProductionCode.h +3 -0
  365. data/vendor/unity/examples/src/ProductionCode2.c +9 -0
  366. data/vendor/unity/examples/src/ProductionCode2.h +2 -0
  367. data/vendor/unity/examples/test/TestProductionCode.c +62 -0
  368. data/vendor/unity/examples/test/TestProductionCode2.c +31 -0
  369. data/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c +46 -0
  370. data/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c +50 -0
  371. data/vendor/unity/extras/fixture/build/MakefileWorker.mk +331 -0
  372. data/vendor/unity/extras/fixture/build/filterGcov.sh +61 -0
  373. data/vendor/unity/extras/fixture/rakefile.rb +37 -0
  374. data/vendor/unity/extras/fixture/rakefile_helper.rb +178 -0
  375. data/vendor/unity/extras/fixture/readme.txt +9 -0
  376. data/vendor/unity/extras/fixture/src/unity_fixture.c +381 -0
  377. data/vendor/unity/extras/fixture/src/unity_fixture.h +81 -0
  378. data/vendor/unity/extras/fixture/src/unity_fixture_internals.h +44 -0
  379. data/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +16 -0
  380. data/vendor/unity/extras/fixture/test/main/AllTests.c +21 -0
  381. data/vendor/unity/extras/fixture/test/testunity_fixture.c +39 -0
  382. data/vendor/unity/extras/fixture/test/unity_fixture_Test.c +321 -0
  383. data/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +40 -0
  384. data/vendor/unity/extras/fixture/test/unity_output_Spy.c +56 -0
  385. data/vendor/unity/extras/fixture/test/unity_output_Spy.h +17 -0
  386. data/vendor/unity/makefile +35 -0
  387. data/vendor/unity/rakefile.rb +59 -0
  388. data/vendor/unity/rakefile_helper.rb +240 -0
  389. data/vendor/unity/release/version.info +1 -1
  390. data/vendor/unity/src/unity.c +1 -1
  391. data/vendor/unity/src/unity_internals.h +5 -5
  392. data/vendor/unity/targets/gcc_32.yml +44 -0
  393. data/vendor/unity/targets/hitech_picc18.yml +101 -0
  394. data/vendor/unity/targets/iar_arm_v4.yml +89 -0
  395. data/vendor/unity/targets/iar_arm_v5.yml +79 -0
  396. data/vendor/unity/targets/iar_arm_v5_3.yml +79 -0
  397. data/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml +93 -0
  398. data/vendor/unity/targets/iar_cortexm3_v5.yml +83 -0
  399. data/vendor/unity/targets/iar_msp430.yml +94 -0
  400. data/vendor/unity/targets/iar_sh2a_v6.yml +85 -0
  401. data/vendor/unity/test/expectdata/testsample_cmd.c +54 -0
  402. data/vendor/unity/test/expectdata/testsample_def.c +50 -0
  403. data/vendor/unity/test/expectdata/testsample_mock_cmd.c +76 -0
  404. data/vendor/unity/test/expectdata/testsample_mock_def.c +72 -0
  405. data/vendor/unity/test/expectdata/testsample_mock_new1.c +85 -0
  406. data/vendor/unity/test/expectdata/testsample_mock_new2.c +85 -0
  407. data/vendor/unity/test/expectdata/testsample_mock_param.c +73 -0
  408. data/vendor/unity/test/expectdata/testsample_mock_run1.c +85 -0
  409. data/vendor/unity/test/expectdata/testsample_mock_run2.c +85 -0
  410. data/vendor/unity/test/expectdata/testsample_mock_yaml.c +86 -0
  411. data/vendor/unity/test/expectdata/testsample_new1.c +60 -0
  412. data/vendor/unity/test/expectdata/testsample_new2.c +63 -0
  413. data/vendor/unity/test/expectdata/testsample_param.c +51 -0
  414. data/vendor/unity/test/expectdata/testsample_run1.c +60 -0
  415. data/vendor/unity/test/expectdata/testsample_run2.c +63 -0
  416. data/vendor/unity/test/expectdata/testsample_yaml.c +64 -0
  417. data/vendor/unity/test/test_generate_test_runner.rb +94 -0
  418. data/vendor/unity/test/testdata/mocksample.c +51 -0
  419. data/vendor/unity/test/testdata/sample.yml +9 -0
  420. data/vendor/unity/test/testdata/testsample.c +51 -0
  421. data/vendor/unity/test/testparameterized.c +101 -0
  422. data/vendor/unity/test/testunity.c +2559 -0
  423. metadata +464 -53
  424. data/.gitignore +0 -6
  425. data/.gitmodules +0 -9
  426. data/.rspec +0 -1
@@ -0,0 +1,57 @@
1
+ /* AUTOGENERATED FILE. DO NOT EDIT. */
2
+ #include "unity.h"
3
+ #include "CException.h"
4
+
5
+ extern void setUp(void);
6
+ extern void tearDown(void);
7
+
8
+ extern void test_BasicTryDoesNothingIfNoThrow(void);
9
+ extern void test_BasicThrowAndCatch(void);
10
+ extern void test_BasicThrowAndCatch_WithMiniSyntax(void);
11
+ extern void test_VerifyVolatilesSurviveThrowAndCatch(void);
12
+ extern void test_ThrowFromASubFunctionAndCatchInRootFunc(void);
13
+ extern void test_ThrowAndCatchFromASubFunctionAndRethrowToCatchInRootFunc(void);
14
+ extern void test_ThrowAndCatchFromASubFunctionAndNoRethrowToCatchInRootFunc(void);
15
+ extern void test_CanHaveMultipleTryBlocksInASingleFunction(void);
16
+ extern void test_CanHaveNestedTryBlocksInASingleFunction_ThrowInside(void);
17
+ extern void test_CanHaveNestedTryBlocksInASingleFunction_ThrowOutside(void);
18
+ extern void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThisDoesntCorruptExceptionId(void);
19
+ extern void test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThatEachExceptionIdIndependent(void);
20
+ extern void test_AThrowWithoutATryCatchWillUseDefaultHandlerIfSpecified(void);
21
+ extern void test_AThrowWithoutOutsideATryCatchWillUseDefaultHandlerEvenAfterTryCatch(void);
22
+
23
+ static void runTest(UnityTestFunction test)
24
+ {
25
+ if (TEST_PROTECT())
26
+ {
27
+ test();
28
+ }
29
+ tearDown();
30
+ }
31
+
32
+
33
+ int main(void)
34
+ {
35
+ Unity.TestFile = __FILE__;
36
+ UnityBegin();
37
+
38
+ // RUN_TEST calls runTest
39
+ RUN_TEST(test_BasicTryDoesNothingIfNoThrow, 15);
40
+ RUN_TEST(test_BasicThrowAndCatch, 33);
41
+ RUN_TEST(test_BasicThrowAndCatch_WithMiniSyntax, 52);
42
+ RUN_TEST(test_VerifyVolatilesSurviveThrowAndCatch, 72);
43
+ RUN_TEST(test_ThrowFromASubFunctionAndCatchInRootFunc, 101);
44
+ RUN_TEST(test_ThrowAndCatchFromASubFunctionAndRethrowToCatchInRootFunc, 142);
45
+ RUN_TEST(test_ThrowAndCatchFromASubFunctionAndNoRethrowToCatchInRootFunc, 161);
46
+ RUN_TEST(test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThisDoesntCorruptExceptionId, 178);
47
+ RUN_TEST(test_ThrowAnErrorThenEnterATryBlockFromWithinCatch_VerifyThatEachExceptionIdIndependent, 196);
48
+ RUN_TEST(test_CanHaveMultipleTryBlocksInASingleFunction, 223);
49
+ RUN_TEST(test_CanHaveNestedTryBlocksInASingleFunction_ThrowInside, 248);
50
+ RUN_TEST(test_CanHaveNestedTryBlocksInASingleFunction_ThrowOutside, 272);
51
+ RUN_TEST(test_AThrowWithoutATryCatchWillUseDefaultHandlerIfSpecified, 296);
52
+ RUN_TEST(test_AThrowWithoutOutsideATryCatchWillUseDefaultHandlerEvenAfterTryCatch, 308);
53
+
54
+ UnityEnd();
55
+
56
+ return 0;
57
+ }
@@ -0,0 +1,94 @@
1
+ # ==========================================
2
+ # Unity Project - A Test Framework 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
+ if RUBY_PLATFORM =~/(win|w)32$/
8
+ begin
9
+ require 'Win32API'
10
+ rescue LoadError
11
+ puts "ERROR! \"Win32API\" library not found"
12
+ puts "\"Win32API\" is required for colour on a windows machine"
13
+ puts " try => \"gem install Win32API\" on the command line"
14
+ puts
15
+ end
16
+ # puts
17
+ # puts 'Windows Environment Detected...'
18
+ # puts 'Win32API Library Found.'
19
+ # puts
20
+ end
21
+
22
+ class ColourCommandLine
23
+ def initialize
24
+ if RUBY_PLATFORM =~/(win|w)32$/
25
+ get_std_handle = Win32API.new("kernel32", "GetStdHandle", ['L'], 'L')
26
+ @set_console_txt_attrb =
27
+ Win32API.new("kernel32","SetConsoleTextAttribute",['L','N'], 'I')
28
+ @hout = get_std_handle.call(-11)
29
+ end
30
+ end
31
+
32
+ def change_to(new_colour)
33
+ if RUBY_PLATFORM =~/(win|w)32$/
34
+ @set_console_txt_attrb.call(@hout,self.win32_colour(new_colour))
35
+ else
36
+ "\033[30;#{posix_colour(new_colour)};22m"
37
+ end
38
+ end
39
+
40
+ def win32_colour(colour)
41
+ case colour
42
+ when :black then 0
43
+ when :dark_blue then 1
44
+ when :dark_green then 2
45
+ when :dark_cyan then 3
46
+ when :dark_red then 4
47
+ when :dark_purple then 5
48
+ when :dark_yellow, :narrative then 6
49
+ when :default_white, :default, :dark_white then 7
50
+ when :silver then 8
51
+ when :blue then 9
52
+ when :green, :success then 10
53
+ when :cyan, :output then 11
54
+ when :red, :failure then 12
55
+ when :purple then 13
56
+ when :yellow then 14
57
+ when :white then 15
58
+ else
59
+ 0
60
+ end
61
+ end
62
+
63
+ def posix_colour(colour)
64
+ case colour
65
+ when :black then 30
66
+ when :red, :failure then 31
67
+ when :green, :success then 32
68
+ when :yellow then 33
69
+ when :blue, :narrative then 34
70
+ when :purple, :magenta then 35
71
+ when :cyan, :output then 36
72
+ when :white, :default_white, :default then 37
73
+ else
74
+ 30
75
+ end
76
+ end
77
+
78
+ def out_c(mode, colour, str)
79
+ case RUBY_PLATFORM
80
+ when /(win|w)32$/
81
+ change_to(colour)
82
+ $stdout.puts str if mode == :puts
83
+ $stdout.print str if mode == :print
84
+ change_to(:default_white)
85
+ else
86
+ $stdout.puts("#{change_to(colour)}#{str}\033[0m") if mode == :puts
87
+ $stdout.print("#{change_to(colour)}#{str}\033[0m") if mode == :print
88
+ end
89
+ end
90
+ end # ColourCommandLine
91
+
92
+ def colour_puts(role,str) ColourCommandLine.new.out_c(:puts, role, str) end
93
+ def colour_print(role,str) ColourCommandLine.new.out_c(:print, role, str) end
94
+
@@ -0,0 +1,39 @@
1
+ # ==========================================
2
+ # Unity Project - A Test Framework 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
+ require "#{File.expand_path(File.dirname(__FILE__))}/colour_prompt"
8
+
9
+ $colour_output = true
10
+
11
+ def report(message)
12
+ if not $colour_output
13
+ $stdout.puts(message)
14
+ else
15
+ message = message.join('\n') if (message.class == Array)
16
+ message.each_line do |line|
17
+ line.chomp!
18
+ colour = case(line)
19
+ when /(?:total\s+)?tests:?\s+(\d+)\s+(?:total\s+)?failures:?\s+\d+\s+Ignored:?/i
20
+ ($1.to_i == 0) ? :green : :red
21
+ when /PASS/
22
+ :green
23
+ when /^OK$/
24
+ :green
25
+ when /(?:FAIL|ERROR)/
26
+ :red
27
+ when /IGNORE/
28
+ :yellow
29
+ when /^(?:Creating|Compiling|Linking)/
30
+ :white
31
+ else
32
+ :silver
33
+ end
34
+ colour_puts(colour, line)
35
+ end
36
+ end
37
+ $stdout.flush
38
+ $stderr.flush
39
+ end
@@ -0,0 +1,36 @@
1
+ #this is a sample configuration file for generate_module
2
+ #you would use it by calling generate_module with the -ygenerate_config.yml option
3
+ #files like this are useful for customizing generate_module to your environment
4
+ :generate_module:
5
+ :defaults:
6
+ #these defaults are used in place of any missing options at the command line
7
+ :path_src: ../src/
8
+ :path_inc: ../src/
9
+ :path_tst: ../test/
10
+ :update_svn: true
11
+ :includes:
12
+ #use [] for no additional includes, otherwise list the includes on separate lines
13
+ :src:
14
+ - Defs.h
15
+ - Board.h
16
+ :inc: []
17
+ :tst:
18
+ - Defs.h
19
+ - Board.h
20
+ - Exception.h
21
+ :boilerplates:
22
+ #these are inserted at the top of generated files.
23
+ #just comment out or remove if not desired.
24
+ #use %1$s where you would like the file name to appear (path/extension not included)
25
+ :src: |
26
+ //-------------------------------------------
27
+ // %1$s.c
28
+ //-------------------------------------------
29
+ :inc: |
30
+ //-------------------------------------------
31
+ // %1$s.h
32
+ //-------------------------------------------
33
+ :tst: |
34
+ //-------------------------------------------
35
+ // Test%1$s.c : Units tests for %1$s.c
36
+ //-------------------------------------------
@@ -0,0 +1,202 @@
1
+ # ==========================================
2
+ # Unity Project - A Test Framework 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
+ # This script creates all the files with start code necessary for a new module.
8
+ # A simple module only requires a source file, header file, and test file.
9
+ # Triad modules require a source, header, and test file for each triad type (like model, conductor, and hardware).
10
+
11
+ require 'rubygems'
12
+ require 'fileutils'
13
+
14
+ HERE = File.expand_path(File.dirname(__FILE__)) + '/'
15
+
16
+ #help text when requested
17
+ HELP_TEXT = [ "\nGENERATE MODULE\n-------- ------",
18
+ "\nUsage: ruby generate_module [options] module_name",
19
+ " -i\"include\" sets the path to output headers to 'include' (DEFAULT ../src)",
20
+ " -s\"../src\" sets the path to output source to '../src' (DEFAULT ../src)",
21
+ " -t\"C:/test\" sets the path to output source to 'C:/test' (DEFAULT ../test)",
22
+ " -p\"MCH\" sets the output pattern to MCH.",
23
+ " dh - driver hardware.",
24
+ " dih - driver interrupt hardware.",
25
+ " mch - model conductor hardware.",
26
+ " mvp - model view presenter.",
27
+ " src - just a single source module. (DEFAULT)",
28
+ " -d destroy module instead of creating it.",
29
+ " -u update subversion too (requires subversion command line)",
30
+ " -y\"my.yml\" selects a different yaml config file for module generation",
31
+ "" ].join("\n")
32
+
33
+ #Built in patterns
34
+ PATTERNS = { 'src' => {'' => { :inc => [] } },
35
+ 'dh' => {'Driver' => { :inc => ['%1$sHardware.h'] },
36
+ 'Hardware' => { :inc => [] }
37
+ },
38
+ 'dih' => {'Driver' => { :inc => ['%1$sHardware.h', '%1$sInterrupt.h'] },
39
+ 'Interrupt'=> { :inc => ['%1$sHardware.h'] },
40
+ 'Hardware' => { :inc => [] }
41
+ },
42
+ 'mch' => {'Model' => { :inc => [] },
43
+ 'Conductor'=> { :inc => ['%1$sModel.h', '%1$sHardware.h'] },
44
+ 'Hardware' => { :inc => [] }
45
+ },
46
+ 'mvp' => {'Model' => { :inc => [] },
47
+ 'Presenter'=> { :inc => ['%1$sModel.h', '%1$sView.h'] },
48
+ 'View' => { :inc => [] }
49
+ }
50
+ }
51
+
52
+ #TEMPLATE_TST
53
+ TEMPLATE_TST = %q[#include "unity.h"
54
+ %2$s#include "%1$s.h"
55
+
56
+ void setUp(void)
57
+ {
58
+ }
59
+
60
+ void tearDown(void)
61
+ {
62
+ }
63
+
64
+ void test_%1$s_NeedToImplement(void)
65
+ {
66
+ TEST_IGNORE();
67
+ }
68
+ ]
69
+
70
+ #TEMPLATE_SRC
71
+ TEMPLATE_SRC = %q[%2$s#include "%1$s.h"
72
+ ]
73
+
74
+ #TEMPLATE_INC
75
+ TEMPLATE_INC = %q[#ifndef _%3$s_H
76
+ #define _%3$s_H%2$s
77
+
78
+ #endif // _%3$s_H
79
+ ]
80
+
81
+ # Parse the command line parameters.
82
+ ARGV.each do |arg|
83
+ case(arg)
84
+ when /^-d/ then @destroy = true
85
+ when /^-u/ then @update_svn = true
86
+ when /^-p(\w+)/ then @pattern = $1
87
+ when /^-s(.+)/ then @path_src = $1
88
+ when /^-i(.+)/ then @path_inc = $1
89
+ when /^-t(.+)/ then @path_tst = $1
90
+ when /^-y(.+)/ then @yaml_config = $1
91
+ when /^(\w+)/
92
+ raise "ERROR: You can't have more than one Module name specified!" unless @module_name.nil?
93
+ @module_name = arg
94
+ when /^-(h|-help)/
95
+ puts HELP_TEXT
96
+ exit
97
+ else
98
+ raise "ERROR: Unknown option specified '#{arg}'"
99
+ end
100
+ end
101
+ raise "ERROR: You must have a Module name specified! (use option -h for help)" if @module_name.nil?
102
+
103
+ #load yaml file if one was requested
104
+ if @yaml_config
105
+ require 'yaml'
106
+ cfg = YAML.load_file(HERE + @yaml_config)[:generate_module]
107
+ @path_src = cfg[:defaults][:path_src] if @path_src.nil?
108
+ @path_inc = cfg[:defaults][:path_inc] if @path_inc.nil?
109
+ @path_tst = cfg[:defaults][:path_tst] if @path_tst.nil?
110
+ @update_svn = cfg[:defaults][:update_svn] if @update_svn.nil?
111
+ @extra_inc = cfg[:includes]
112
+ @boilerplates = cfg[:boilerplates]
113
+ else
114
+ @boilerplates = {}
115
+ end
116
+
117
+ # Create default file paths if none were provided
118
+ @path_src = HERE + "../src/" if @path_src.nil?
119
+ @path_inc = @path_src if @path_inc.nil?
120
+ @path_tst = HERE + "../test/" if @path_tst.nil?
121
+ @path_src += '/' unless (@path_src[-1] == 47)
122
+ @path_inc += '/' unless (@path_inc[-1] == 47)
123
+ @path_tst += '/' unless (@path_tst[-1] == 47)
124
+ @pattern = 'src' if @pattern.nil?
125
+ @includes = { :src => [], :inc => [], :tst => [] }
126
+ @includes.merge!(@extra_inc) unless @extra_inc.nil?
127
+
128
+ #create triad definition
129
+ TRIAD = [ { :ext => '.c', :path => @path_src, :template => TEMPLATE_SRC, :inc => :src, :boilerplate => @boilerplates[:src] },
130
+ { :ext => '.h', :path => @path_inc, :template => TEMPLATE_INC, :inc => :inc, :boilerplate => @boilerplates[:inc] },
131
+ { :ext => '.c', :path => @path_tst+'Test', :template => TEMPLATE_TST, :inc => :tst, :boilerplate => @boilerplates[:tst] },
132
+ ]
133
+
134
+ #prepare the pattern for use
135
+ @patterns = PATTERNS[@pattern.downcase]
136
+ raise "ERROR: The design pattern specified isn't one that I recognize!" if @patterns.nil?
137
+
138
+ # Assemble the path/names of the files we need to work with.
139
+ files = []
140
+ TRIAD.each do |triad|
141
+ @patterns.each_pair do |pattern_file, pattern_traits|
142
+ files << {
143
+ :path => "#{triad[:path]}#{@module_name}#{pattern_file}#{triad[:ext]}",
144
+ :name => "#{@module_name}#{pattern_file}",
145
+ :template => triad[:template],
146
+ :boilerplate => triad[:boilerplate],
147
+ :includes => case(triad[:inc])
148
+ when :src then @includes[:src] | pattern_traits[:inc].map{|f| f % [@module_name]}
149
+ when :inc then @includes[:inc]
150
+ when :tst then @includes[:tst] | pattern_traits[:inc].map{|f| "Mock#{f}"% [@module_name]}
151
+ end
152
+ }
153
+ end
154
+ end
155
+
156
+ # destroy files if that was what was requested
157
+ if @destroy
158
+ files.each do |filespec|
159
+ file = filespec[:path]
160
+ if File.exist?(file)
161
+ if @update_svn
162
+ `svn delete \"#{file}\" --force`
163
+ puts "File #{file} deleted and removed from source control"
164
+ else
165
+ FileUtils.remove(file)
166
+ puts "File #{file} deleted"
167
+ end
168
+ else
169
+ puts "File #{file} does not exist so cannot be removed."
170
+ end
171
+ end
172
+ puts "Destroy Complete"
173
+ exit
174
+ end
175
+
176
+ #Abort if any module already exists
177
+ files.each do |file|
178
+ raise "ERROR: File #{file[:name]} already exists. Exiting." if File.exist?(file[:path])
179
+ end
180
+
181
+ # Create Source Modules
182
+ files.each_with_index do |file, i|
183
+ File.open(file[:path], 'w') do |f|
184
+ f.write(file[:boilerplate] % [file[:name]]) unless file[:boilerplate].nil?
185
+ f.write(file[:template] % [ file[:name],
186
+ file[:includes].map{|f| "#include \"#{f}\"\n"}.join,
187
+ file[:name].upcase ]
188
+ )
189
+ end
190
+ if (@update_svn)
191
+ `svn add \"#{file[:path]}\"`
192
+ if $?.exitstatus == 0
193
+ puts "File #{file[:path]} created and added to source control"
194
+ else
195
+ puts "File #{file[:path]} created but FAILED adding to source control!"
196
+ end
197
+ else
198
+ puts "File #{file[:path]} created"
199
+ end
200
+ end
201
+
202
+ puts 'Generate Complete'
@@ -0,0 +1,313 @@
1
+ # ==========================================
2
+ # Unity Project - A Test Framework 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
+ File.expand_path(File.join(File.dirname(__FILE__),'colour_prompt'))
8
+
9
+ class UnityTestRunnerGenerator
10
+
11
+ def initialize(options = nil)
12
+ @options = { :includes => [], :plugins => [], :framework => :unity }
13
+ case(options)
14
+ when NilClass then @options
15
+ when String then @options.merge!(UnityTestRunnerGenerator.grab_config(options))
16
+ when Hash then @options.merge!(options)
17
+ else raise "If you specify arguments, it should be a filename or a hash of options"
18
+ end
19
+ end
20
+
21
+ def self.grab_config(config_file)
22
+ options = { :includes => [], :plugins => [], :framework => :unity }
23
+ unless (config_file.nil? or config_file.empty?)
24
+ require 'yaml'
25
+ yaml_guts = YAML.load_file(config_file)
26
+ options.merge!(yaml_guts[:unity] ? yaml_guts[:unity] : yaml_guts[:cmock])
27
+ raise "No :unity or :cmock section found in #{config_file}" unless options
28
+ end
29
+ return(options)
30
+ end
31
+
32
+ def run(input_file, output_file, options=nil)
33
+ tests = []
34
+ testfile_includes = []
35
+ used_mocks = []
36
+
37
+ @options.merge!(options) unless options.nil?
38
+ module_name = File.basename(input_file)
39
+
40
+ #pull required data from source file
41
+ File.open(input_file, 'r') do |input|
42
+ tests = find_tests(input)
43
+ testfile_includes = find_includes(input)
44
+ used_mocks = find_mocks(testfile_includes)
45
+ end
46
+
47
+ #build runner file
48
+ generate(input_file, output_file, tests, used_mocks)
49
+
50
+ #determine which files were used to return them
51
+ all_files_used = [input_file, output_file]
52
+ all_files_used += testfile_includes.map {|filename| filename + '.c'} unless testfile_includes.empty?
53
+ all_files_used += @options[:includes] unless @options[:includes].empty?
54
+ return all_files_used.uniq
55
+ end
56
+
57
+ def generate(input_file, output_file, tests, used_mocks)
58
+ File.open(output_file, 'w') do |output|
59
+ create_header(output, used_mocks)
60
+ create_externs(output, tests, used_mocks)
61
+ create_mock_management(output, used_mocks)
62
+ create_suite_setup_and_teardown(output)
63
+ create_reset(output, used_mocks)
64
+ create_main(output, input_file, tests)
65
+ end
66
+ end
67
+
68
+ def find_tests(input_file)
69
+ tests_raw = []
70
+ tests_args = []
71
+ tests_and_line_numbers = []
72
+
73
+ input_file.rewind
74
+ source_raw = input_file.read
75
+ source_scrubbed = source_raw.gsub(/\/\/.*$/, '') # remove line comments
76
+ source_scrubbed = source_scrubbed.gsub(/\/\*.*?\*\//m, '') # remove block comments
77
+ lines = source_scrubbed.split(/(^\s*\#.*$) # Treat preprocessor directives as a logical line
78
+ | (;|\{|\}) /x) # Match ;, {, and } as end of lines
79
+
80
+ lines.each_with_index do |line, index|
81
+ #find tests
82
+ if line =~ /^((?:\s*TEST_CASE\s*\(.*?\)\s*)*)\s*void\s+(test.*?)\s*\(\s*(.*)\s*\)/
83
+ arguments = $1
84
+ name = $2
85
+ call = $3
86
+ args = nil
87
+ if (@options[:use_param_tests] and !arguments.empty?)
88
+ args = []
89
+ arguments.scan(/\s*TEST_CASE\s*\((.*)\)\s*$/) {|a| args << a[0]}
90
+ end
91
+ tests_and_line_numbers << { :test => name, :args => args, :call => call, :line_number => 0 }
92
+ tests_args = []
93
+ end
94
+ end
95
+
96
+ #determine line numbers and create tests to run
97
+ source_lines = source_raw.split("\n")
98
+ source_index = 0;
99
+ tests_and_line_numbers.size.times do |i|
100
+ source_lines[source_index..-1].each_with_index do |line, index|
101
+ if (line =~ /#{tests_and_line_numbers[i][:test]}/)
102
+ source_index += index
103
+ tests_and_line_numbers[i][:line_number] = source_index + 1
104
+ break
105
+ end
106
+ end
107
+ end
108
+
109
+ return tests_and_line_numbers
110
+ end
111
+
112
+ def find_includes(input_file)
113
+ input_file.rewind
114
+
115
+ #read in file
116
+ source = input_file.read
117
+
118
+ #remove comments (block and line, in three steps to ensure correct precedence)
119
+ source.gsub!(/\/\/(?:.+\/\*|\*(?:$|[^\/])).*$/, '') # remove line comments that comment out the start of blocks
120
+ source.gsub!(/\/\*.*?\*\//m, '') # remove block comments
121
+ source.gsub!(/\/\/.*$/, '') # remove line comments (all that remain)
122
+
123
+ #parse out includes
124
+ return source.scan(/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/).flatten
125
+ end
126
+
127
+ def find_mocks(includes)
128
+ mock_headers = []
129
+ includes.each do |include_file|
130
+ mock_headers << File.basename(include_file) if (include_file =~ /^mock/i)
131
+ end
132
+ return mock_headers
133
+ end
134
+
135
+ def create_header(output, mocks)
136
+ output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */')
137
+ create_runtest(output, mocks)
138
+ output.puts("\n//=======Automagically Detected Files To Include=====")
139
+ output.puts("#include \"#{@options[:framework].to_s}.h\"")
140
+ output.puts('#include "cmock.h"') unless (mocks.empty?)
141
+ @options[:includes].flatten.uniq.compact.each do |inc|
142
+ output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}")
143
+ end
144
+ output.puts('#include <setjmp.h>')
145
+ output.puts('#include <stdio.h>')
146
+ output.puts('#include "CException.h"') if @options[:plugins].include?(:cexception)
147
+ mocks.each do |mock|
148
+ output.puts("#include \"#{mock.gsub('.h','')}.h\"")
149
+ end
150
+ if @options[:enforce_strict_ordering]
151
+ output.puts('')
152
+ output.puts('int GlobalExpectCount;')
153
+ output.puts('int GlobalVerifyOrder;')
154
+ output.puts('char* GlobalOrderError;')
155
+ end
156
+ end
157
+
158
+ def create_externs(output, tests, mocks)
159
+ output.puts("\n//=======External Functions This Runner Calls=====")
160
+ output.puts("extern void setUp(void);")
161
+ output.puts("extern void tearDown(void);")
162
+ tests.each do |test|
163
+ output.puts("extern void #{test[:test]}(#{test[:call] || 'void'});")
164
+ end
165
+ output.puts('')
166
+ end
167
+
168
+ def create_mock_management(output, mocks)
169
+ unless (mocks.empty?)
170
+ output.puts("\n//=======Mock Management=====")
171
+ output.puts("static void CMock_Init(void)")
172
+ output.puts("{")
173
+ if @options[:enforce_strict_ordering]
174
+ output.puts(" GlobalExpectCount = 0;")
175
+ output.puts(" GlobalVerifyOrder = 0;")
176
+ output.puts(" GlobalOrderError = NULL;")
177
+ end
178
+ mocks.each do |mock|
179
+ output.puts(" #{mock}_Init();")
180
+ end
181
+ output.puts("}\n")
182
+
183
+ output.puts("static void CMock_Verify(void)")
184
+ output.puts("{")
185
+ mocks.each do |mock|
186
+ output.puts(" #{mock}_Verify();")
187
+ end
188
+ output.puts("}\n")
189
+
190
+ output.puts("static void CMock_Destroy(void)")
191
+ output.puts("{")
192
+ mocks.each do |mock|
193
+ output.puts(" #{mock}_Destroy();")
194
+ end
195
+ output.puts("}\n")
196
+ end
197
+ end
198
+
199
+ def create_suite_setup_and_teardown(output)
200
+ unless (@options[:suite_setup].nil?)
201
+ output.puts("\n//=======Suite Setup=====")
202
+ output.puts("static int suite_setup(void)")
203
+ output.puts("{")
204
+ output.puts(@options[:suite_setup])
205
+ output.puts("}")
206
+ end
207
+ unless (@options[:suite_teardown].nil?)
208
+ output.puts("\n//=======Suite Teardown=====")
209
+ output.puts("static int suite_teardown(int num_failures)")
210
+ output.puts("{")
211
+ output.puts(@options[:suite_teardown])
212
+ output.puts("}")
213
+ end
214
+ end
215
+
216
+ def create_runtest(output, used_mocks)
217
+ cexception = @options[:plugins].include? :cexception
218
+ va_args1 = @options[:use_param_tests] ? ', ...' : ''
219
+ va_args2 = @options[:use_param_tests] ? '__VA_ARGS__' : ''
220
+ output.puts("\n//=======Test Runner Used To Run Each Test Below=====")
221
+ output.puts("#define RUN_TEST_NO_ARGS") if @options[:use_param_tests]
222
+ output.puts("#define RUN_TEST(TestFunc, TestLineNum#{va_args1}) \\")
223
+ output.puts("{ \\")
224
+ output.puts(" Unity.CurrentTestName = #TestFunc#{va_args2.empty? ? '' : " \"(\" ##{va_args2} \")\""}; \\")
225
+ output.puts(" Unity.CurrentTestLineNumber = TestLineNum; \\")
226
+ output.puts(" Unity.NumberOfTests++; \\")
227
+ output.puts(" if (TEST_PROTECT()) \\")
228
+ output.puts(" { \\")
229
+ output.puts(" CEXCEPTION_T e; \\") if cexception
230
+ output.puts(" Try { \\") if cexception
231
+ output.puts(" CMock_Init(); \\") unless (used_mocks.empty?)
232
+ output.puts(" setUp(); \\")
233
+ output.puts(" TestFunc(#{va_args2}); \\")
234
+ output.puts(" CMock_Verify(); \\") unless (used_mocks.empty?)
235
+ output.puts(" } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, \"Unhandled Exception!\"); } \\") if cexception
236
+ output.puts(" } \\")
237
+ output.puts(" CMock_Destroy(); \\") unless (used_mocks.empty?)
238
+ output.puts(" if (TEST_PROTECT() && !TEST_IS_IGNORED) \\")
239
+ output.puts(" { \\")
240
+ output.puts(" tearDown(); \\")
241
+ output.puts(" } \\")
242
+ output.puts(" UnityConcludeTest(); \\")
243
+ output.puts("}\n")
244
+ end
245
+
246
+ def create_reset(output, used_mocks)
247
+ output.puts("\n//=======Test Reset Option=====")
248
+ output.puts("void resetTest()")
249
+ output.puts("{")
250
+ output.puts(" CMock_Verify();") unless (used_mocks.empty?)
251
+ output.puts(" CMock_Destroy();") unless (used_mocks.empty?)
252
+ output.puts(" tearDown();")
253
+ output.puts(" CMock_Init();") unless (used_mocks.empty?)
254
+ output.puts(" setUp();")
255
+ output.puts("}")
256
+ end
257
+
258
+ def create_main(output, filename, tests)
259
+ output.puts("\n\n//=======MAIN=====")
260
+ output.puts("int main(void)")
261
+ output.puts("{")
262
+ output.puts(" suite_setup();") unless @options[:suite_setup].nil?
263
+ output.puts(" Unity.TestFile = \"#{filename}\";")
264
+ output.puts(" UnityBegin();")
265
+ if (@options[:use_param_tests])
266
+ tests.each do |test|
267
+ if ((test[:args].nil?) or (test[:args].empty?))
268
+ output.puts(" RUN_TEST(#{test[:test]}, #{test[:line_number]}, RUN_TEST_NO_ARGS);")
269
+ else
270
+ test[:args].each {|args| output.puts(" RUN_TEST(#{test[:test]}, #{test[:line_number]}, #{args});")}
271
+ end
272
+ end
273
+ else
274
+ tests.each { |test| output.puts(" RUN_TEST(#{test[:test]}, #{test[:line_number]});") }
275
+ end
276
+ output.puts()
277
+ output.puts(" return #{@options[:suite_teardown].nil? ? "" : "suite_teardown"}(UnityEnd());")
278
+ output.puts("}")
279
+ end
280
+ end
281
+
282
+
283
+ if ($0 == __FILE__)
284
+ options = { :includes => [] }
285
+ yaml_file = nil
286
+
287
+ #parse out all the options first
288
+ ARGV.reject! do |arg|
289
+ case(arg)
290
+ when '-cexception'
291
+ options[:plugins] = [:cexception]; true
292
+ when /\.*\.yml/
293
+ options = UnityTestRunnerGenerator.grab_config(arg); true
294
+ else false
295
+ end
296
+ end
297
+
298
+ #make sure there is at least one parameter left (the input file)
299
+ if !ARGV[0]
300
+ puts ["usage: ruby #{__FILE__} (yaml) (options) input_test_file output_test_runner (includes)",
301
+ " blah.yml - will use config options in the yml file (see docs)",
302
+ " -cexception - include cexception support"].join("\n")
303
+ exit 1
304
+ end
305
+
306
+ #create the default test runner name if not specified
307
+ ARGV[1] = ARGV[0].gsub(".c","_Runner.c") if (!ARGV[1])
308
+
309
+ #everything else is an include file
310
+ options[:includes] ||= (ARGV.slice(2..-1).flatten.compact) if (ARGV.size > 2)
311
+
312
+ UnityTestRunnerGenerator.new(options).run(ARGV[0], ARGV[1])
313
+ end