ceedling 0.13.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (308) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +1 -1
  3. data/Gemfile.lock +18 -14
  4. data/README.md +6 -4
  5. data/assets/project_as_gem.yml +1 -1
  6. data/assets/rakefile_as_gem.rb +2 -0
  7. data/assets/rakefile_with_guts.rb +3 -1
  8. data/ceedling.gemspec +1 -0
  9. data/examples/blinky/rakefile.rb +2 -2
  10. data/examples/temp_sensor/rakefile.rb +1 -1
  11. data/examples/temp_sensor/src/TemperatureFilter.c +1 -2
  12. data/examples/temp_sensor/test/TestTemperatureCalculator.c +1 -1
  13. data/examples/temp_sensor/test/TestTemperatureFilter.c +12 -2
  14. data/lib/ceedling.rb +94 -22
  15. data/lib/{build_invoker_utils.rb → ceedling/build_invoker_utils.rb} +27 -27
  16. data/lib/{cacheinator.rb → ceedling/cacheinator.rb} +42 -42
  17. data/lib/{cacheinator_helper.rb → ceedling/cacheinator_helper.rb} +12 -12
  18. data/lib/{cmock_builder.rb → ceedling/cmock_builder.rb} +15 -15
  19. data/lib/{configurator.rb → ceedling/configurator.rb} +333 -329
  20. data/lib/{configurator_builder.rb → ceedling/configurator_builder.rb} +437 -437
  21. data/lib/{configurator_plugins.rb → ceedling/configurator_plugins.rb} +124 -124
  22. data/lib/{configurator_setup.rb → ceedling/configurator_setup.rb} +124 -124
  23. data/lib/{configurator_validator.rb → ceedling/configurator_validator.rb} +184 -184
  24. data/lib/{constants.rb → ceedling/constants.rb} +20 -17
  25. data/lib/{defaults.rb → ceedling/defaults.rb} +19 -18
  26. data/lib/{dependinator.rb → ceedling/dependinator.rb} +92 -92
  27. data/lib/{erb_wrapper.rb → ceedling/erb_wrapper.rb} +8 -8
  28. data/lib/{file_finder.rb → ceedling/file_finder.rb} +132 -132
  29. data/lib/{file_finder_helper.rb → ceedling/file_finder_helper.rb} +54 -54
  30. data/lib/{file_path_utils.rb → ceedling/file_path_utils.rb} +189 -189
  31. data/lib/{file_system_utils.rb → ceedling/file_system_utils.rb} +69 -69
  32. data/lib/{file_system_wrapper.rb → ceedling/file_system_wrapper.rb} +9 -9
  33. data/lib/{file_wrapper.rb → ceedling/file_wrapper.rb} +79 -79
  34. data/lib/{flaginator.rb → ceedling/flaginator.rb} +54 -54
  35. data/lib/{generator.rb → ceedling/generator.rb} +164 -164
  36. data/lib/{generator_helper.rb → ceedling/generator_helper.rb} +40 -40
  37. data/lib/{generator_test_results.rb → ceedling/generator_test_results.rb} +86 -89
  38. data/lib/{generator_test_results_sanity_checker.rb → ceedling/generator_test_results_sanity_checker.rb} +64 -62
  39. data/lib/{generator_test_runner.rb → ceedling/generator_test_runner.rb} +63 -63
  40. data/lib/{loginator.rb → ceedling/loginator.rb} +31 -31
  41. data/lib/{makefile.rb → ceedling/makefile.rb} +0 -0
  42. data/lib/{objects.yml → ceedling/objects.yml} +0 -0
  43. data/lib/{par_map.rb → ceedling/par_map.rb} +0 -0
  44. data/lib/{plugin.rb → ceedling/plugin.rb} +80 -80
  45. data/lib/{plugin_builder.rb → ceedling/plugin_builder.rb} +52 -52
  46. data/lib/{plugin_manager.rb → ceedling/plugin_manager.rb} +107 -107
  47. data/lib/{plugin_manager_helper.rb → ceedling/plugin_manager_helper.rb} +19 -19
  48. data/lib/{plugin_reportinator.rb → ceedling/plugin_reportinator.rb} +2 -2
  49. data/lib/{plugin_reportinator_helper.rb → ceedling/plugin_reportinator_helper.rb} +1 -1
  50. data/lib/{preprocessinator.rb → ceedling/preprocessinator.rb} +43 -43
  51. data/lib/{preprocessinator_extractor.rb → ceedling/preprocessinator_extractor.rb} +30 -30
  52. data/lib/{preprocessinator_file_handler.rb → ceedling/preprocessinator_file_handler.rb} +21 -21
  53. data/lib/{preprocessinator_helper.rb → ceedling/preprocessinator_helper.rb} +46 -46
  54. data/lib/ceedling/preprocessinator_includes_handler.rb +82 -0
  55. data/lib/{project_config_manager.rb → ceedling/project_config_manager.rb} +38 -38
  56. data/lib/{project_file_loader.rb → ceedling/project_file_loader.rb} +64 -64
  57. data/lib/{rake_utils.rb → ceedling/rake_utils.rb} +17 -17
  58. data/lib/{rake_wrapper.rb → ceedling/rake_wrapper.rb} +33 -33
  59. data/lib/{rakefile.rb → ceedling/rakefile.rb} +78 -74
  60. data/lib/{release_invoker.rb → ceedling/release_invoker.rb} +58 -58
  61. data/lib/{release_invoker_helper.rb → ceedling/release_invoker_helper.rb} +16 -16
  62. data/lib/{reportinator.rb → ceedling/reportinator.rb} +9 -9
  63. data/lib/{rules_cmock.rake → ceedling/rules_cmock.rake} +9 -9
  64. data/lib/{rules_preprocess.rake → ceedling/rules_preprocess.rake} +26 -26
  65. data/lib/{rules_release.rake → ceedling/rules_release.rake} +79 -79
  66. data/lib/{rules_release_deep_dependencies.rake → ceedling/rules_release_deep_dependencies.rake} +15 -15
  67. data/lib/{rules_tests.rake → ceedling/rules_tests.rake} +59 -59
  68. data/lib/{rules_tests_deep_dependencies.rake → ceedling/rules_tests_deep_dependencies.rake} +15 -15
  69. data/lib/{setupinator.rb → ceedling/setupinator.rb} +51 -51
  70. data/lib/{stream_wrapper.rb → ceedling/stream_wrapper.rb} +20 -20
  71. data/lib/{streaminator.rb → ceedling/streaminator.rb} +40 -41
  72. data/lib/{streaminator_helper.rb → ceedling/streaminator_helper.rb} +15 -15
  73. data/lib/{system_utils.rb → ceedling/system_utils.rb} +0 -0
  74. data/lib/{system_wrapper.rb → ceedling/system_wrapper.rb} +76 -76
  75. data/lib/{target_loader.rb → ceedling/target_loader.rb} +0 -0
  76. data/lib/{task_invoker.rb → ceedling/task_invoker.rb} +89 -89
  77. data/lib/{tasks_base.rake → ceedling/tasks_base.rake} +104 -104
  78. data/lib/{tasks_filesystem.rake → ceedling/tasks_filesystem.rake} +91 -91
  79. data/lib/{tasks_release.rake → ceedling/tasks_release.rake} +28 -28
  80. data/lib/{tasks_release_deep_dependencies.rake → ceedling/tasks_release_deep_dependencies.rake} +9 -9
  81. data/lib/{tasks_tests.rake → ceedling/tasks_tests.rake} +52 -52
  82. data/lib/{tasks_tests_deep_dependencies.rake → ceedling/tasks_tests_deep_dependencies.rake} +9 -9
  83. data/lib/{tasks_vendor.rake → ceedling/tasks_vendor.rake} +36 -36
  84. data/lib/{test_includes_extractor.rb → ceedling/test_includes_extractor.rb} +81 -81
  85. data/lib/{test_invoker.rb → ceedling/test_invoker.rb} +97 -97
  86. data/lib/{test_invoker_helper.rb → ceedling/test_invoker_helper.rb} +28 -28
  87. data/lib/{tool_executor.rb → ceedling/tool_executor.rb} +215 -212
  88. data/lib/{tool_executor_helper.rb → ceedling/tool_executor_helper.rb} +115 -115
  89. data/lib/{verbosinator.rb → ceedling/verbosinator.rb} +10 -10
  90. data/lib/ceedling/version.rb +1 -1
  91. data/lib/{yaml_wrapper.rb → ceedling/yaml_wrapper.rb} +17 -16
  92. data/license.txt +31 -0
  93. data/plugins/bullseye/lib/bullseye.rb +2 -2
  94. data/plugins/gcov/gcov.rb +2 -2
  95. data/plugins/module_generator/lib/module_generator.rb +4 -3
  96. data/plugins/stdout_ide_tests_report/lib/stdout_ide_tests_report.rb +8 -8
  97. data/plugins/stdout_pretty_tests_report/lib/stdout_pretty_tests_report.rb +3 -3
  98. data/plugins/teamcity_tests_report/config/teamcity_tests_report.yml +4 -0
  99. data/plugins/teamcity_tests_report/lib/teamcity_tests_report.rb +57 -0
  100. data/plugins/xml_tests_report/xml_tests_report.rb +4 -4
  101. data/release/version.info +1 -1
  102. data/spec/ceedling_spec.rb +154 -0
  103. data/spec/par_map_spec.rb +1 -1
  104. data/spec/preprocessinator_extractor_spec.rb +26 -27
  105. data/spec/preprocessinator_includes_handler_spec.rb +175 -0
  106. data/spec/spec_helper.rb +8 -27
  107. data/test_graveyard/integration/paths_test.rb +2 -2
  108. data/test_graveyard/unit/busted/configurator_builder_test.rb +2 -2
  109. data/test_graveyard/unit/busted/configurator_test.rb +1 -1
  110. data/test_graveyard/unit/busted/configurator_validator_test.rb +1 -1
  111. data/test_graveyard/unit/busted/dependinator_test.rb +1 -1
  112. data/test_graveyard/unit/busted/file_finder_helper_test.rb +1 -1
  113. data/test_graveyard/unit/busted/file_finder_test.rb +1 -1
  114. data/test_graveyard/unit/busted/file_path_utils_test.rb +1 -1
  115. data/test_graveyard/unit/busted/file_system_utils_test.rb +1 -1
  116. data/test_graveyard/unit/busted/generator_test.rb +1 -1
  117. data/test_graveyard/unit/busted/generator_test_results_test.rb +1 -1
  118. data/test_graveyard/unit/busted/generator_test_runner_test.rb +1 -1
  119. data/test_graveyard/unit/busted/preprocessinator_file_handler_test.rb +1 -1
  120. data/test_graveyard/unit/busted/preprocessinator_helper_test.rb +1 -1
  121. data/test_graveyard/unit/busted/preprocessinator_includes_handler_test.rb +1 -1
  122. data/test_graveyard/unit/busted/preprocessinator_test.rb +1 -1
  123. data/test_graveyard/unit/busted/project_file_loader_test.rb +1 -1
  124. data/test_graveyard/unit/busted/setupinator_test.rb +1 -1
  125. data/test_graveyard/unit/busted/streaminator_test.rb +2 -2
  126. data/test_graveyard/unit/busted/task_invoker_test.rb +1 -1
  127. data/test_graveyard/unit/busted/test_includes_extractor_test.rb +1 -1
  128. data/test_graveyard/unit/busted/test_invoker_helper_test.rb +1 -1
  129. data/test_graveyard/unit/busted/test_invoker_test.rb +1 -1
  130. data/test_graveyard/unit/busted/tool_executor_helper_test.rb +1 -1
  131. data/test_graveyard/unit/busted/tool_executor_test.rb +1 -1
  132. data/test_graveyard/unit/busted/verbosinator_test.rb +1 -1
  133. data/test_graveyard/unit/preprocessinator_extractor_test.rb +1 -1
  134. data/vendor/c_exception/Gemfile +4 -0
  135. data/vendor/c_exception/lib/CException.h +1 -1
  136. data/vendor/c_exception/test/TestException.c +25 -14
  137. data/vendor/c_exception/test/TestException_Runner.c +74 -57
  138. data/vendor/cmock/Gemfile +11 -0
  139. data/vendor/cmock/lib/cmock_generator.rb +13 -12
  140. data/vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb +44 -0
  141. data/vendor/cmock/lib/cmock_generator_plugin_return_thru_ptr.rb +74 -0
  142. data/vendor/cmock/lib/cmock_generator_utils.rb +67 -42
  143. data/vendor/cmock/src/cmock.c +20 -30
  144. data/vendor/cmock/src/cmock.h +1 -0
  145. data/vendor/cmock/src/cmock_internals.h +43 -0
  146. data/vendor/cmock/test/c/TestCMockC.c +79 -36
  147. data/vendor/cmock/test/c/TestCMockC_Runner.c +2 -0
  148. data/vendor/cmock/test/spec/cmock_file_writer_spec.rb +21 -1
  149. data/vendor/cmock/test/spec/cmock_generator_plugin_array_spec.rb +52 -0
  150. data/vendor/cmock/test/system/test_interactions/all_plugins_coexist.yml +2 -0
  151. data/vendor/cmock/test/system/test_interactions/return_thru_ptr_ignore_arg.yml +235 -0
  152. data/vendor/cmock/test/test_helper.rb +10 -5
  153. data/vendor/cmock/test/unit/cmock_generator_main_test.rb +38 -0
  154. data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_arg_test.rb +116 -0
  155. data/vendor/cmock/test/unit/cmock_generator_plugin_return_thru_ptr_test.rb +134 -0
  156. data/vendor/cmock/test/unit/cmock_generator_utils_test.rb +58 -33
  157. data/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.odt +0 -0
  158. data/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.pdf +0 -0
  159. data/vendor/cmock/vendor/c_exception/docs/license.txt +30 -0
  160. data/vendor/cmock/vendor/c_exception/docs/readme.txt +236 -0
  161. data/vendor/cmock/vendor/c_exception/lib/CException.c +39 -0
  162. data/vendor/cmock/vendor/c_exception/lib/CException.h +70 -0
  163. data/vendor/cmock/vendor/c_exception/makefile +24 -0
  164. data/vendor/cmock/vendor/c_exception/rakefile.rb +41 -0
  165. data/vendor/cmock/vendor/c_exception/release/build.info +2 -0
  166. data/vendor/cmock/vendor/c_exception/release/version.info +2 -0
  167. data/vendor/cmock/vendor/c_exception/test/CExceptionConfig.h +27 -0
  168. data/vendor/cmock/vendor/c_exception/test/TestException.c +291 -0
  169. data/vendor/cmock/vendor/c_exception/test/TestException_Runner.c +62 -0
  170. data/vendor/cmock/vendor/unity/auto/colour_prompt.rb +94 -0
  171. data/vendor/cmock/vendor/unity/auto/colour_reporter.rb +39 -0
  172. data/vendor/cmock/vendor/unity/auto/generate_config.yml +36 -0
  173. data/vendor/cmock/vendor/unity/auto/generate_module.rb +202 -0
  174. data/vendor/cmock/vendor/unity/auto/generate_test_runner.rb +313 -0
  175. data/vendor/cmock/vendor/unity/auto/test_file_filter.rb +23 -0
  176. data/vendor/cmock/vendor/unity/auto/unity_test_summary.rb +139 -0
  177. data/vendor/cmock/vendor/unity/docs/Unity Summary.odt +0 -0
  178. data/vendor/cmock/vendor/unity/docs/Unity Summary.pdf +0 -0
  179. data/vendor/cmock/vendor/unity/docs/Unity Summary.txt +217 -0
  180. data/vendor/cmock/vendor/unity/docs/license.txt +31 -0
  181. data/vendor/cmock/vendor/unity/examples/helper/UnityHelper.c +10 -0
  182. data/vendor/cmock/vendor/unity/examples/helper/UnityHelper.h +12 -0
  183. data/vendor/cmock/vendor/unity/examples/makefile +40 -0
  184. data/vendor/cmock/vendor/unity/examples/rakefile.rb +32 -0
  185. data/vendor/cmock/vendor/unity/examples/rakefile_helper.rb +256 -0
  186. data/vendor/cmock/vendor/unity/examples/readme.txt +18 -0
  187. data/vendor/cmock/vendor/unity/examples/src/ProductionCode.c +24 -0
  188. data/vendor/cmock/vendor/unity/examples/src/ProductionCode.h +3 -0
  189. data/vendor/cmock/vendor/unity/examples/src/ProductionCode2.c +9 -0
  190. data/vendor/cmock/vendor/unity/examples/src/ProductionCode2.h +2 -0
  191. data/vendor/cmock/vendor/unity/examples/test/TestProductionCode.c +62 -0
  192. data/vendor/cmock/vendor/unity/examples/test/TestProductionCode2.c +31 -0
  193. data/vendor/cmock/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c +46 -0
  194. data/vendor/cmock/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c +50 -0
  195. data/vendor/{unity → cmock/vendor/unity}/extras/fixture/build/MakefileWorker.mk +0 -0
  196. data/vendor/{unity → cmock/vendor/unity}/extras/fixture/build/filterGcov.sh +0 -0
  197. data/vendor/cmock/vendor/unity/extras/fixture/rakefile.rb +37 -0
  198. data/vendor/cmock/vendor/unity/extras/fixture/rakefile_helper.rb +178 -0
  199. data/vendor/cmock/vendor/unity/extras/fixture/readme.txt +9 -0
  200. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c +381 -0
  201. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h +81 -0
  202. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h +44 -0
  203. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +16 -0
  204. data/vendor/cmock/vendor/unity/extras/fixture/test/main/AllTests.c +21 -0
  205. data/vendor/cmock/vendor/unity/extras/fixture/test/testunity_fixture.c +39 -0
  206. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c +321 -0
  207. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +40 -0
  208. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.c +56 -0
  209. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.h +17 -0
  210. data/vendor/cmock/vendor/unity/makefile +35 -0
  211. data/vendor/cmock/vendor/unity/rakefile.rb +48 -0
  212. data/vendor/cmock/vendor/unity/rakefile_helper.rb +240 -0
  213. data/vendor/cmock/vendor/unity/release/build.info +2 -0
  214. data/vendor/cmock/vendor/unity/release/version.info +2 -0
  215. data/vendor/cmock/vendor/unity/src/unity.c +979 -0
  216. data/vendor/cmock/vendor/unity/src/unity.h +232 -0
  217. data/vendor/cmock/vendor/unity/src/unity_internals.h +424 -0
  218. data/vendor/cmock/vendor/unity/targets/gcc.yml +43 -0
  219. data/vendor/cmock/vendor/unity/targets/gcc_64.yml +44 -0
  220. data/vendor/cmock/vendor/unity/targets/hitech_picc18.yml +101 -0
  221. data/vendor/cmock/vendor/unity/targets/iar_arm_v4.yml +89 -0
  222. data/vendor/cmock/vendor/unity/targets/iar_arm_v5.yml +79 -0
  223. data/vendor/cmock/vendor/unity/targets/iar_arm_v5_3.yml +79 -0
  224. data/vendor/cmock/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml +93 -0
  225. data/vendor/cmock/vendor/unity/targets/iar_cortexm3_v5.yml +83 -0
  226. data/vendor/cmock/vendor/unity/targets/iar_msp430.yml +94 -0
  227. data/vendor/cmock/vendor/unity/targets/iar_sh2a_v6.yml +85 -0
  228. data/vendor/cmock/vendor/unity/test/expectdata/testsample_cmd.c +54 -0
  229. data/vendor/cmock/vendor/unity/test/expectdata/testsample_def.c +50 -0
  230. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_cmd.c +76 -0
  231. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_def.c +72 -0
  232. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new1.c +85 -0
  233. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new2.c +85 -0
  234. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_param.c +73 -0
  235. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run1.c +85 -0
  236. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run2.c +85 -0
  237. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_yaml.c +86 -0
  238. data/vendor/cmock/vendor/unity/test/expectdata/testsample_new1.c +60 -0
  239. data/vendor/cmock/vendor/unity/test/expectdata/testsample_new2.c +63 -0
  240. data/vendor/cmock/vendor/unity/test/expectdata/testsample_param.c +51 -0
  241. data/vendor/cmock/vendor/unity/test/expectdata/testsample_run1.c +60 -0
  242. data/vendor/cmock/vendor/unity/test/expectdata/testsample_run2.c +63 -0
  243. data/vendor/cmock/vendor/unity/test/expectdata/testsample_yaml.c +64 -0
  244. data/vendor/cmock/vendor/unity/test/test_generate_test_runner.rb +94 -0
  245. data/vendor/cmock/vendor/unity/test/testdata/mocksample.c +51 -0
  246. data/vendor/cmock/vendor/unity/test/testdata/sample.yml +9 -0
  247. data/vendor/cmock/vendor/unity/test/testdata/testsample.c +51 -0
  248. data/vendor/cmock/vendor/unity/test/testparameterized.c +101 -0
  249. data/vendor/cmock/vendor/unity/test/testunity.c +2024 -0
  250. data/vendor/unity/Gemfile +4 -0
  251. data/vendor/unity/auto/generate_test_runner.rb +6 -3
  252. data/vendor/unity/examples/makefile +2 -2
  253. data/vendor/unity/examples/rakefile.rb +13 -2
  254. data/vendor/unity/extras/fixture/rakefile.rb +1 -1
  255. data/vendor/unity/extras/fixture/rakefile_helper.rb +4 -3
  256. data/vendor/unity/extras/fixture/src/unity_fixture.c +15 -12
  257. data/vendor/unity/extras/fixture/src/unity_fixture.h +5 -5
  258. data/vendor/unity/extras/fixture/src/unity_fixture_internals.h +1 -1
  259. data/vendor/unity/extras/fixture/test/unity_fixture_Test.c +6 -3
  260. data/vendor/unity/makefile +2 -2
  261. data/vendor/unity/src/unity.c +183 -16
  262. data/vendor/unity/src/unity.h +18 -5
  263. data/vendor/unity/src/unity_internals.h +57 -23
  264. data/vendor/unity/targets/gcc_64.yml +45 -0
  265. data/vendor/unity/test/testunity.c +436 -28
  266. metadata +200 -137
  267. data/ceedling-0.13.0.rc4.gem +0 -0
  268. data/ceedling.sublime-project +0 -8
  269. data/ceedling.sublime-workspace +0 -365
  270. data/lib/preprocessinator_includes_handler.rb +0 -55
  271. data/tags +0 -977
  272. data/vendor/cmock/vendor/hardmock/CHANGES +0 -78
  273. data/vendor/cmock/vendor/hardmock/LICENSE +0 -7
  274. data/vendor/cmock/vendor/hardmock/README +0 -70
  275. data/vendor/cmock/vendor/hardmock/Rakefile +0 -8
  276. data/vendor/cmock/vendor/hardmock/config/environment.rb +0 -12
  277. data/vendor/cmock/vendor/hardmock/lib/assert_error.rb +0 -23
  278. data/vendor/cmock/vendor/hardmock/lib/extend_test_unit.rb +0 -14
  279. data/vendor/cmock/vendor/hardmock/lib/hardmock.rb +0 -86
  280. data/vendor/cmock/vendor/hardmock/lib/hardmock/errors.rb +0 -22
  281. data/vendor/cmock/vendor/hardmock/lib/hardmock/expectation.rb +0 -229
  282. data/vendor/cmock/vendor/hardmock/lib/hardmock/expectation_builder.rb +0 -9
  283. data/vendor/cmock/vendor/hardmock/lib/hardmock/expector.rb +0 -26
  284. data/vendor/cmock/vendor/hardmock/lib/hardmock/method_cleanout.rb +0 -33
  285. data/vendor/cmock/vendor/hardmock/lib/hardmock/mock.rb +0 -180
  286. data/vendor/cmock/vendor/hardmock/lib/hardmock/mock_control.rb +0 -53
  287. data/vendor/cmock/vendor/hardmock/lib/hardmock/stubbing.rb +0 -210
  288. data/vendor/cmock/vendor/hardmock/lib/hardmock/trapper.rb +0 -31
  289. data/vendor/cmock/vendor/hardmock/lib/hardmock/utils.rb +0 -9
  290. data/vendor/cmock/vendor/hardmock/lib/test_unit_before_after.rb +0 -169
  291. data/vendor/cmock/vendor/hardmock/rake_tasks/rdoc.rake +0 -19
  292. data/vendor/cmock/vendor/hardmock/rake_tasks/rdoc_options.rb +0 -4
  293. data/vendor/cmock/vendor/hardmock/rake_tasks/test.rake +0 -22
  294. data/vendor/cmock/vendor/hardmock/test/functional/assert_error_test.rb +0 -52
  295. data/vendor/cmock/vendor/hardmock/test/functional/auto_verify_test.rb +0 -178
  296. data/vendor/cmock/vendor/hardmock/test/functional/direct_mock_usage_test.rb +0 -396
  297. data/vendor/cmock/vendor/hardmock/test/functional/hardmock_test.rb +0 -434
  298. data/vendor/cmock/vendor/hardmock/test/functional/stubbing_test.rb +0 -479
  299. data/vendor/cmock/vendor/hardmock/test/test_helper.rb +0 -43
  300. data/vendor/cmock/vendor/hardmock/test/unit/expectation_builder_test.rb +0 -19
  301. data/vendor/cmock/vendor/hardmock/test/unit/expectation_test.rb +0 -372
  302. data/vendor/cmock/vendor/hardmock/test/unit/expector_test.rb +0 -57
  303. data/vendor/cmock/vendor/hardmock/test/unit/method_cleanout_test.rb +0 -36
  304. data/vendor/cmock/vendor/hardmock/test/unit/mock_control_test.rb +0 -175
  305. data/vendor/cmock/vendor/hardmock/test/unit/mock_test.rb +0 -279
  306. data/vendor/cmock/vendor/hardmock/test/unit/test_unit_before_after_test.rb +0 -452
  307. data/vendor/cmock/vendor/hardmock/test/unit/trapper_test.rb +0 -62
  308. data/vendor/cmock/vendor/hardmock/test/unit/verify_error_test.rb +0 -40
@@ -0,0 +1,979 @@
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
+ #include "unity.h"
8
+ #include <stdio.h>
9
+ #include <string.h>
10
+
11
+ #define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); }
12
+ #define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); }
13
+ /// return prematurely if we are already in failure or ignore state
14
+ #define UNITY_SKIP_EXECUTION { if ((Unity.CurrentTestFailed != 0) || (Unity.CurrentTestIgnored != 0)) {return;} }
15
+ #define UNITY_PRINT_EOL { UNITY_OUTPUT_CHAR('\n'); }
16
+
17
+ struct _Unity Unity = { 0 };
18
+
19
+ const char* UnityStrNull = "NULL";
20
+ const char* UnityStrSpacer = ". ";
21
+ const char* UnityStrExpected = " Expected ";
22
+ const char* UnityStrWas = " Was ";
23
+ const char* UnityStrTo = " To ";
24
+ const char* UnityStrElement = " Element ";
25
+ const char* UnityStrByte = " Byte ";
26
+ const char* UnityStrMemory = " Memory Mismatch.";
27
+ const char* UnityStrDelta = " Values Not Within Delta ";
28
+ const char* UnityStrPointless= " You Asked Me To Compare Nothing, Which Was Pointless.";
29
+ const char* UnityStrNullPointerForExpected= " Expected pointer to be NULL";
30
+ const char* UnityStrNullPointerForActual = " Actual pointer was NULL";
31
+
32
+ // compiler-generic print formatting masks
33
+ const _U_UINT UnitySizeMask[] =
34
+ {
35
+ 255u, // 0xFF
36
+ 65535u, // 0xFFFF
37
+ 65535u,
38
+ 4294967295u, // 0xFFFFFFFF
39
+ 4294967295u,
40
+ 4294967295u,
41
+ 4294967295u
42
+ #ifdef UNITY_SUPPORT_64
43
+ ,0xFFFFFFFFFFFFFFFF
44
+ #endif
45
+ };
46
+
47
+ void UnityPrintFail(void);
48
+ void UnityPrintOk(void);
49
+
50
+ //-----------------------------------------------
51
+ // Pretty Printers & Test Result Output Handlers
52
+ //-----------------------------------------------
53
+
54
+ void UnityPrint(const char* string)
55
+ {
56
+ const char* pch = string;
57
+
58
+ if (pch != NULL)
59
+ {
60
+ while (*pch)
61
+ {
62
+ // printable characters plus CR & LF are printed
63
+ if ((*pch <= 126) && (*pch >= 32))
64
+ {
65
+ UNITY_OUTPUT_CHAR(*pch);
66
+ }
67
+ //write escaped carriage returns
68
+ else if (*pch == 13)
69
+ {
70
+ UNITY_OUTPUT_CHAR('\\');
71
+ UNITY_OUTPUT_CHAR('r');
72
+ }
73
+ //write escaped line feeds
74
+ else if (*pch == 10)
75
+ {
76
+ UNITY_OUTPUT_CHAR('\\');
77
+ UNITY_OUTPUT_CHAR('n');
78
+ }
79
+ // unprintable characters are shown as codes
80
+ else
81
+ {
82
+ UNITY_OUTPUT_CHAR('\\');
83
+ UnityPrintNumberHex((_U_SINT)*pch, 2);
84
+ }
85
+ pch++;
86
+ }
87
+ }
88
+ }
89
+
90
+ //-----------------------------------------------
91
+ void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style)
92
+ {
93
+ if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
94
+ {
95
+ UnityPrintNumber(number);
96
+ }
97
+ else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT)
98
+ {
99
+ UnityPrintNumberUnsigned( (_U_UINT)number & UnitySizeMask[((_U_UINT)style & (_U_UINT)0x0F) - 1] );
100
+ }
101
+ else
102
+ {
103
+ UnityPrintNumberHex((_U_UINT)number, (style & 0x000F) << 1);
104
+ }
105
+ }
106
+
107
+ //-----------------------------------------------
108
+ /// basically do an itoa using as little ram as possible
109
+ void UnityPrintNumber(const _U_SINT number_to_print)
110
+ {
111
+ _U_SINT divisor = 1;
112
+ _U_SINT next_divisor;
113
+ _U_SINT number = number_to_print;
114
+
115
+ if (number < 0)
116
+ {
117
+ UNITY_OUTPUT_CHAR('-');
118
+ number = -number;
119
+ }
120
+
121
+ // figure out initial divisor
122
+ while (number / divisor > 9)
123
+ {
124
+ next_divisor = divisor * 10;
125
+ if (next_divisor > divisor)
126
+ divisor = next_divisor;
127
+ else
128
+ break;
129
+ }
130
+
131
+ // now mod and print, then divide divisor
132
+ do
133
+ {
134
+ UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10)));
135
+ divisor /= 10;
136
+ }
137
+ while (divisor > 0);
138
+ }
139
+
140
+ //-----------------------------------------------
141
+ /// basically do an itoa using as little ram as possible
142
+ void UnityPrintNumberUnsigned(const _U_UINT number)
143
+ {
144
+ _U_UINT divisor = 1;
145
+ _U_UINT next_divisor;
146
+
147
+ // figure out initial divisor
148
+ while (number / divisor > 9)
149
+ {
150
+ next_divisor = divisor * 10;
151
+ if (next_divisor > divisor)
152
+ divisor = next_divisor;
153
+ else
154
+ break;
155
+ }
156
+
157
+ // now mod and print, then divide divisor
158
+ do
159
+ {
160
+ UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10)));
161
+ divisor /= 10;
162
+ }
163
+ while (divisor > 0);
164
+ }
165
+
166
+ //-----------------------------------------------
167
+ void UnityPrintNumberHex(const _U_UINT number, const char nibbles_to_print)
168
+ {
169
+ _U_UINT nibble;
170
+ char nibbles = nibbles_to_print;
171
+ UNITY_OUTPUT_CHAR('0');
172
+ UNITY_OUTPUT_CHAR('x');
173
+
174
+ while (nibbles > 0)
175
+ {
176
+ nibble = (number >> (--nibbles << 2)) & 0x0000000F;
177
+ if (nibble <= 9)
178
+ {
179
+ UNITY_OUTPUT_CHAR((char)('0' + nibble));
180
+ }
181
+ else
182
+ {
183
+ UNITY_OUTPUT_CHAR((char)('A' - 10 + nibble));
184
+ }
185
+ }
186
+ }
187
+
188
+ //-----------------------------------------------
189
+ void UnityPrintMask(const _U_UINT mask, const _U_UINT number)
190
+ {
191
+ _U_UINT current_bit = (_U_UINT)1 << (UNITY_INT_WIDTH - 1);
192
+ _US32 i;
193
+
194
+ for (i = 0; i < UNITY_INT_WIDTH; i++)
195
+ {
196
+ if (current_bit & mask)
197
+ {
198
+ if (current_bit & number)
199
+ {
200
+ UNITY_OUTPUT_CHAR('1');
201
+ }
202
+ else
203
+ {
204
+ UNITY_OUTPUT_CHAR('0');
205
+ }
206
+ }
207
+ else
208
+ {
209
+ UNITY_OUTPUT_CHAR('X');
210
+ }
211
+ current_bit = current_bit >> 1;
212
+ }
213
+ }
214
+
215
+ //-----------------------------------------------
216
+ #ifdef UNITY_FLOAT_VERBOSE
217
+ void UnityPrintFloat(_UF number)
218
+ {
219
+ char TempBuffer[32];
220
+ sprintf(TempBuffer, "%.6f", number);
221
+ UnityPrint(TempBuffer);
222
+ }
223
+ #endif
224
+
225
+ //-----------------------------------------------
226
+
227
+ void UnityPrintFail(void)
228
+ {
229
+ UnityPrint("FAIL");
230
+ }
231
+
232
+ void UnityPrintOk(void)
233
+ {
234
+ UnityPrint("OK");
235
+ }
236
+
237
+ //-----------------------------------------------
238
+ void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line)
239
+ {
240
+ UnityPrint(file);
241
+ UNITY_OUTPUT_CHAR(':');
242
+ UnityPrintNumber(line);
243
+ UNITY_OUTPUT_CHAR(':');
244
+ UnityPrint(Unity.CurrentTestName);
245
+ UNITY_OUTPUT_CHAR(':');
246
+ }
247
+
248
+ //-----------------------------------------------
249
+ void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line)
250
+ {
251
+ UnityTestResultsBegin(Unity.TestFile, line);
252
+ UnityPrint("FAIL:");
253
+ }
254
+
255
+ //-----------------------------------------------
256
+ void UnityConcludeTest(void)
257
+ {
258
+ if (Unity.CurrentTestIgnored)
259
+ {
260
+ Unity.TestIgnores++;
261
+ }
262
+ else if (!Unity.CurrentTestFailed)
263
+ {
264
+ UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber);
265
+ UnityPrint("PASS");
266
+ UNITY_PRINT_EOL;
267
+ }
268
+ else
269
+ {
270
+ Unity.TestFailures++;
271
+ }
272
+
273
+ Unity.CurrentTestFailed = 0;
274
+ Unity.CurrentTestIgnored = 0;
275
+ }
276
+
277
+ //-----------------------------------------------
278
+ void UnityAddMsgIfSpecified(const char* msg)
279
+ {
280
+ if (msg)
281
+ {
282
+ UnityPrint(UnityStrSpacer);
283
+ UnityPrint(msg);
284
+ }
285
+ }
286
+
287
+ //-----------------------------------------------
288
+ void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual)
289
+ {
290
+ UnityPrint(UnityStrExpected);
291
+ if (expected != NULL)
292
+ {
293
+ UNITY_OUTPUT_CHAR('\'');
294
+ UnityPrint(expected);
295
+ UNITY_OUTPUT_CHAR('\'');
296
+ }
297
+ else
298
+ {
299
+ UnityPrint(UnityStrNull);
300
+ }
301
+ UnityPrint(UnityStrWas);
302
+ if (actual != NULL)
303
+ {
304
+ UNITY_OUTPUT_CHAR('\'');
305
+ UnityPrint(actual);
306
+ UNITY_OUTPUT_CHAR('\'');
307
+ }
308
+ else
309
+ {
310
+ UnityPrint(UnityStrNull);
311
+ }
312
+ }
313
+
314
+ //-----------------------------------------------
315
+ // Assertion & Control Helpers
316
+ //-----------------------------------------------
317
+
318
+ int UnityCheckArraysForNull(const void* expected, const void* actual, const UNITY_LINE_TYPE lineNumber, const char* msg)
319
+ {
320
+ //return true if they are both NULL
321
+ if ((expected == NULL) && (actual == NULL))
322
+ return 1;
323
+
324
+ //throw error if just expected is NULL
325
+ if (expected == NULL)
326
+ {
327
+ UnityTestResultsFailBegin(lineNumber);
328
+ UnityPrint(UnityStrNullPointerForExpected);
329
+ UnityAddMsgIfSpecified(msg);
330
+ UNITY_FAIL_AND_BAIL;
331
+ }
332
+
333
+ //throw error if just actual is NULL
334
+ if (actual == NULL)
335
+ {
336
+ UnityTestResultsFailBegin(lineNumber);
337
+ UnityPrint(UnityStrNullPointerForActual);
338
+ UnityAddMsgIfSpecified(msg);
339
+ UNITY_FAIL_AND_BAIL;
340
+ }
341
+
342
+ //return false if neither is NULL
343
+ return 0;
344
+ }
345
+
346
+ //-----------------------------------------------
347
+ // Assertion Functions
348
+ //-----------------------------------------------
349
+
350
+ void UnityAssertBits(const _U_SINT mask,
351
+ const _U_SINT expected,
352
+ const _U_SINT actual,
353
+ const char* msg,
354
+ const UNITY_LINE_TYPE lineNumber)
355
+ {
356
+ UNITY_SKIP_EXECUTION;
357
+
358
+ if ((mask & expected) != (mask & actual))
359
+ {
360
+ UnityTestResultsFailBegin(lineNumber);
361
+ UnityPrint(UnityStrExpected);
362
+ UnityPrintMask(mask, expected);
363
+ UnityPrint(UnityStrWas);
364
+ UnityPrintMask(mask, actual);
365
+ UnityAddMsgIfSpecified(msg);
366
+ UNITY_FAIL_AND_BAIL;
367
+ }
368
+ }
369
+
370
+ //-----------------------------------------------
371
+ void UnityAssertEqualNumber(const _U_SINT expected,
372
+ const _U_SINT actual,
373
+ const char* msg,
374
+ const UNITY_LINE_TYPE lineNumber,
375
+ const UNITY_DISPLAY_STYLE_T style)
376
+ {
377
+ UNITY_SKIP_EXECUTION;
378
+
379
+ if (expected != actual)
380
+ {
381
+ UnityTestResultsFailBegin(lineNumber);
382
+ UnityPrint(UnityStrExpected);
383
+ UnityPrintNumberByStyle(expected, style);
384
+ UnityPrint(UnityStrWas);
385
+ UnityPrintNumberByStyle(actual, style);
386
+ UnityAddMsgIfSpecified(msg);
387
+ UNITY_FAIL_AND_BAIL;
388
+ }
389
+ }
390
+
391
+ //-----------------------------------------------
392
+ void UnityAssertEqualIntArray(const _U_SINT* expected,
393
+ const _U_SINT* actual,
394
+ const _UU32 num_elements,
395
+ const char* msg,
396
+ const UNITY_LINE_TYPE lineNumber,
397
+ const UNITY_DISPLAY_STYLE_T style)
398
+ {
399
+ _UU32 elements = num_elements;
400
+ const _US8* ptr_exp = (_US8*)expected;
401
+ const _US8* ptr_act = (_US8*)actual;
402
+
403
+ UNITY_SKIP_EXECUTION;
404
+
405
+ if (elements == 0)
406
+ {
407
+ UnityTestResultsFailBegin(lineNumber);
408
+ UnityPrint(UnityStrPointless);
409
+ UnityAddMsgIfSpecified(msg);
410
+ UNITY_FAIL_AND_BAIL;
411
+ }
412
+
413
+ if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1)
414
+ return;
415
+
416
+ switch(style)
417
+ {
418
+ case UNITY_DISPLAY_STYLE_HEX8:
419
+ case UNITY_DISPLAY_STYLE_INT8:
420
+ case UNITY_DISPLAY_STYLE_UINT8:
421
+ while (elements--)
422
+ {
423
+ if (*ptr_exp != *ptr_act)
424
+ {
425
+ UnityTestResultsFailBegin(lineNumber);
426
+ UnityPrint(UnityStrElement);
427
+ UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
428
+ UnityPrint(UnityStrExpected);
429
+ UnityPrintNumberByStyle(*ptr_exp, style);
430
+ UnityPrint(UnityStrWas);
431
+ UnityPrintNumberByStyle(*ptr_act, style);
432
+ UnityAddMsgIfSpecified(msg);
433
+ UNITY_FAIL_AND_BAIL;
434
+ }
435
+ ptr_exp += 1;
436
+ ptr_act += 1;
437
+ }
438
+ break;
439
+ case UNITY_DISPLAY_STYLE_HEX16:
440
+ case UNITY_DISPLAY_STYLE_INT16:
441
+ case UNITY_DISPLAY_STYLE_UINT16:
442
+ while (elements--)
443
+ {
444
+ if (*(_US16*)ptr_exp != *(_US16*)ptr_act)
445
+ {
446
+ UnityTestResultsFailBegin(lineNumber);
447
+ UnityPrint(UnityStrElement);
448
+ UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
449
+ UnityPrint(UnityStrExpected);
450
+ UnityPrintNumberByStyle(*(_US16*)ptr_exp, style);
451
+ UnityPrint(UnityStrWas);
452
+ UnityPrintNumberByStyle(*(_US16*)ptr_act, style);
453
+ UnityAddMsgIfSpecified(msg);
454
+ UNITY_FAIL_AND_BAIL;
455
+ }
456
+ ptr_exp += 2;
457
+ ptr_act += 2;
458
+ }
459
+ break;
460
+ #ifdef UNITY_SUPPORT_64
461
+ case UNITY_DISPLAY_STYLE_HEX64:
462
+ case UNITY_DISPLAY_STYLE_INT64:
463
+ case UNITY_DISPLAY_STYLE_UINT64:
464
+ while (elements--)
465
+ {
466
+ if (*(_US64*)ptr_exp != *(_US64*)ptr_act)
467
+ {
468
+ UnityTestResultsFailBegin(lineNumber);
469
+ UnityPrint(UnityStrElement);
470
+ UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
471
+ UnityPrint(UnityStrExpected);
472
+ UnityPrintNumberByStyle(*(_US64*)ptr_exp, style);
473
+ UnityPrint(UnityStrWas);
474
+ UnityPrintNumberByStyle(*(_US64*)ptr_act, style);
475
+ UnityAddMsgIfSpecified(msg);
476
+ UNITY_FAIL_AND_BAIL;
477
+ }
478
+ ptr_exp += 8;
479
+ ptr_act += 8;
480
+ }
481
+ break;
482
+ #endif
483
+ default:
484
+ while (elements--)
485
+ {
486
+ if (*(_US32*)ptr_exp != *(_US32*)ptr_act)
487
+ {
488
+ UnityTestResultsFailBegin(lineNumber);
489
+ UnityPrint(UnityStrElement);
490
+ UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
491
+ UnityPrint(UnityStrExpected);
492
+ UnityPrintNumberByStyle(*(_US32*)ptr_exp, style);
493
+ UnityPrint(UnityStrWas);
494
+ UnityPrintNumberByStyle(*(_US32*)ptr_act, style);
495
+ UnityAddMsgIfSpecified(msg);
496
+ UNITY_FAIL_AND_BAIL;
497
+ }
498
+ ptr_exp += 4;
499
+ ptr_act += 4;
500
+ }
501
+ break;
502
+ }
503
+ }
504
+
505
+ //-----------------------------------------------
506
+ #ifndef UNITY_EXCLUDE_FLOAT
507
+ void UnityAssertEqualFloatArray(const _UF* expected,
508
+ const _UF* actual,
509
+ const _UU32 num_elements,
510
+ const char* msg,
511
+ const UNITY_LINE_TYPE lineNumber)
512
+ {
513
+ _UU32 elements = num_elements;
514
+ const _UF* ptr_expected = expected;
515
+ const _UF* ptr_actual = actual;
516
+ _UF diff, tol;
517
+
518
+ UNITY_SKIP_EXECUTION;
519
+
520
+ if (elements == 0)
521
+ {
522
+ UnityTestResultsFailBegin(lineNumber);
523
+ UnityPrint(UnityStrPointless);
524
+ UnityAddMsgIfSpecified(msg);
525
+ UNITY_FAIL_AND_BAIL;
526
+ }
527
+
528
+ if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1)
529
+ return;
530
+
531
+ while (elements--)
532
+ {
533
+ diff = *ptr_expected - *ptr_actual;
534
+ if (diff < 0.0)
535
+ diff = 0.0 - diff;
536
+ tol = UNITY_FLOAT_PRECISION * *ptr_expected;
537
+ if (tol < 0.0)
538
+ tol = 0.0 - tol;
539
+ if (diff > tol)
540
+ {
541
+ UnityTestResultsFailBegin(lineNumber);
542
+ UnityPrint(UnityStrElement);
543
+ UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
544
+ #ifdef UNITY_FLOAT_VERBOSE
545
+ UnityPrint(UnityStrExpected);
546
+ UnityPrintFloat(*ptr_expected);
547
+ UnityPrint(UnityStrWas);
548
+ UnityPrintFloat(*ptr_actual);
549
+ #else
550
+ UnityPrint(UnityStrDelta);
551
+ #endif
552
+ UnityAddMsgIfSpecified(msg);
553
+ UNITY_FAIL_AND_BAIL;
554
+ }
555
+ ptr_expected++;
556
+ ptr_actual++;
557
+ }
558
+ }
559
+
560
+ //-----------------------------------------------
561
+ void UnityAssertFloatsWithin(const _UF delta,
562
+ const _UF expected,
563
+ const _UF actual,
564
+ const char* msg,
565
+ const UNITY_LINE_TYPE lineNumber)
566
+ {
567
+ _UF diff = actual - expected;
568
+ _UF pos_delta = delta;
569
+
570
+ UNITY_SKIP_EXECUTION;
571
+
572
+ if (diff < 0)
573
+ {
574
+ diff = 0.0f - diff;
575
+ }
576
+ if (pos_delta < 0)
577
+ {
578
+ pos_delta = 0.0f - pos_delta;
579
+ }
580
+
581
+ if (pos_delta < diff)
582
+ {
583
+ UnityTestResultsFailBegin(lineNumber);
584
+ #ifdef UNITY_FLOAT_VERBOSE
585
+ UnityPrint(UnityStrExpected);
586
+ UnityPrintFloat(expected);
587
+ UnityPrint(UnityStrWas);
588
+ UnityPrintFloat(actual);
589
+ #else
590
+ UnityPrint(UnityStrDelta);
591
+ #endif
592
+ UnityAddMsgIfSpecified(msg);
593
+ UNITY_FAIL_AND_BAIL;
594
+ }
595
+ }
596
+
597
+ #endif //not UNITY_EXCLUDE_FLOAT
598
+
599
+ //-----------------------------------------------
600
+ #ifndef UNITY_EXCLUDE_DOUBLE
601
+ void UnityAssertEqualDoubleArray(const _UD* expected,
602
+ const _UD* actual,
603
+ const _UU32 num_elements,
604
+ const char* msg,
605
+ const UNITY_LINE_TYPE lineNumber)
606
+ {
607
+ _UU32 elements = num_elements;
608
+ const _UD* ptr_expected = expected;
609
+ const _UD* ptr_actual = actual;
610
+ _UD diff, tol;
611
+
612
+ UNITY_SKIP_EXECUTION;
613
+
614
+ if (elements == 0)
615
+ {
616
+ UnityTestResultsFailBegin(lineNumber);
617
+ UnityPrint(UnityStrPointless);
618
+ UnityAddMsgIfSpecified(msg);
619
+ UNITY_FAIL_AND_BAIL;
620
+ }
621
+
622
+ if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1)
623
+ return;
624
+
625
+ while (elements--)
626
+ {
627
+ diff = *ptr_expected - *ptr_actual;
628
+ if (diff < 0.0)
629
+ diff = 0.0 - diff;
630
+ tol = UNITY_DOUBLE_PRECISION * *ptr_expected;
631
+ if (tol < 0.0)
632
+ tol = 0.0 - tol;
633
+ if (diff > tol)
634
+ {
635
+ UnityTestResultsFailBegin(lineNumber);
636
+ UnityPrint(UnityStrElement);
637
+ UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
638
+ #ifdef UNITY_DOUBLE_VERBOSE
639
+ UnityPrint(UnityStrExpected);
640
+ UnityPrintFloat((float)(*ptr_expected));
641
+ UnityPrint(UnityStrWas);
642
+ UnityPrintFloat((float)(*ptr_actual));
643
+ #else
644
+ UnityPrint(UnityStrDelta);
645
+ #endif
646
+ UnityAddMsgIfSpecified(msg);
647
+ UNITY_FAIL_AND_BAIL;
648
+ }
649
+ ptr_expected++;
650
+ ptr_actual++;
651
+ }
652
+ }
653
+
654
+ //-----------------------------------------------
655
+ void UnityAssertDoublesWithin(const _UD delta,
656
+ const _UD expected,
657
+ const _UD actual,
658
+ const char* msg,
659
+ const UNITY_LINE_TYPE lineNumber)
660
+ {
661
+ _UD diff = actual - expected;
662
+ _UD pos_delta = delta;
663
+
664
+ UNITY_SKIP_EXECUTION;
665
+
666
+ if (diff < 0)
667
+ {
668
+ diff = 0.0f - diff;
669
+ }
670
+ if (pos_delta < 0)
671
+ {
672
+ pos_delta = 0.0f - pos_delta;
673
+ }
674
+
675
+ if (pos_delta < diff)
676
+ {
677
+ UnityTestResultsFailBegin(lineNumber);
678
+ #ifdef UNITY_DOUBLE_VERBOSE
679
+ UnityPrint(UnityStrExpected);
680
+ UnityPrintFloat((float)expected);
681
+ UnityPrint(UnityStrWas);
682
+ UnityPrintFloat((float)actual);
683
+ #else
684
+ UnityPrint(UnityStrDelta);
685
+ #endif
686
+ UnityAddMsgIfSpecified(msg);
687
+ UNITY_FAIL_AND_BAIL;
688
+ }
689
+ }
690
+
691
+ #endif // not UNITY_EXCLUDE_DOUBLE
692
+
693
+ //-----------------------------------------------
694
+ void UnityAssertNumbersWithin( const _U_SINT delta,
695
+ const _U_SINT expected,
696
+ const _U_SINT actual,
697
+ const char* msg,
698
+ const UNITY_LINE_TYPE lineNumber,
699
+ const UNITY_DISPLAY_STYLE_T style)
700
+ {
701
+ UNITY_SKIP_EXECUTION;
702
+
703
+ if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
704
+ {
705
+ if (actual > expected)
706
+ Unity.CurrentTestFailed = ((actual - expected) > delta);
707
+ else
708
+ Unity.CurrentTestFailed = ((expected - actual) > delta);
709
+ }
710
+ else
711
+ {
712
+ if ((_U_UINT)actual > (_U_UINT)expected)
713
+ Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) > (_U_UINT)delta);
714
+ else
715
+ Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) > (_U_UINT)delta);
716
+ }
717
+
718
+ if (Unity.CurrentTestFailed)
719
+ {
720
+ UnityTestResultsFailBegin(lineNumber);
721
+ UnityPrint(UnityStrDelta);
722
+ UnityPrintNumberByStyle(delta, style);
723
+ UnityPrint(UnityStrExpected);
724
+ UnityPrintNumberByStyle(expected, style);
725
+ UnityPrint(UnityStrWas);
726
+ UnityPrintNumberByStyle(actual, style);
727
+ UnityAddMsgIfSpecified(msg);
728
+ UNITY_FAIL_AND_BAIL;
729
+ }
730
+ }
731
+
732
+ //-----------------------------------------------
733
+ void UnityAssertEqualString(const char* expected,
734
+ const char* actual,
735
+ const char* msg,
736
+ const UNITY_LINE_TYPE lineNumber)
737
+ {
738
+ _UU32 i;
739
+
740
+ UNITY_SKIP_EXECUTION;
741
+
742
+ // if both pointers not null compare the strings
743
+ if (expected && actual)
744
+ {
745
+ for (i = 0; expected[i] || actual[i]; i++)
746
+ {
747
+ if (expected[i] != actual[i])
748
+ {
749
+ Unity.CurrentTestFailed = 1;
750
+ break;
751
+ }
752
+ }
753
+ }
754
+ else
755
+ { // handle case of one pointers being null (if both null, test should pass)
756
+ if (expected != actual)
757
+ {
758
+ Unity.CurrentTestFailed = 1;
759
+ }
760
+ }
761
+
762
+ if (Unity.CurrentTestFailed)
763
+ {
764
+ UnityTestResultsFailBegin(lineNumber);
765
+ UnityPrintExpectedAndActualStrings(expected, actual);
766
+ UnityAddMsgIfSpecified(msg);
767
+ UNITY_FAIL_AND_BAIL;
768
+ }
769
+ }
770
+
771
+ //-----------------------------------------------
772
+ void UnityAssertEqualStringArray( const char** expected,
773
+ const char** actual,
774
+ const _UU32 num_elements,
775
+ const char* msg,
776
+ const UNITY_LINE_TYPE lineNumber)
777
+ {
778
+ _UU32 i, j = 0;
779
+
780
+ UNITY_SKIP_EXECUTION;
781
+
782
+ // if no elements, it's an error
783
+ if (num_elements == 0)
784
+ {
785
+ UnityTestResultsFailBegin(lineNumber);
786
+ UnityPrint(UnityStrPointless);
787
+ UnityAddMsgIfSpecified(msg);
788
+ UNITY_FAIL_AND_BAIL;
789
+ }
790
+
791
+ if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1)
792
+ return;
793
+
794
+ do
795
+ {
796
+ // if both pointers not null compare the strings
797
+ if (expected[j] && actual[j])
798
+ {
799
+ for (i = 0; expected[j][i] || actual[j][i]; i++)
800
+ {
801
+ if (expected[j][i] != actual[j][i])
802
+ {
803
+ Unity.CurrentTestFailed = 1;
804
+ break;
805
+ }
806
+ }
807
+ }
808
+ else
809
+ { // handle case of one pointers being null (if both null, test should pass)
810
+ if (expected[j] != actual[j])
811
+ {
812
+ Unity.CurrentTestFailed = 1;
813
+ }
814
+ }
815
+
816
+ if (Unity.CurrentTestFailed)
817
+ {
818
+ UnityTestResultsFailBegin(lineNumber);
819
+ if (num_elements > 1)
820
+ {
821
+ UnityPrint(UnityStrElement);
822
+ UnityPrintNumberByStyle((num_elements - j - 1), UNITY_DISPLAY_STYLE_UINT);
823
+ }
824
+ UnityPrintExpectedAndActualStrings((const char*)(expected[j]), (const char*)(actual[j]));
825
+ UnityAddMsgIfSpecified(msg);
826
+ UNITY_FAIL_AND_BAIL;
827
+ }
828
+ } while (++j < num_elements);
829
+ }
830
+
831
+ //-----------------------------------------------
832
+ void UnityAssertEqualMemory( const void* expected,
833
+ const void* actual,
834
+ const _UU32 length,
835
+ const _UU32 num_elements,
836
+ const char* msg,
837
+ const UNITY_LINE_TYPE lineNumber)
838
+ {
839
+ unsigned char* ptr_exp = (unsigned char*)expected;
840
+ unsigned char* ptr_act = (unsigned char*)actual;
841
+ _UU32 elements = num_elements;
842
+ _UU32 bytes;
843
+
844
+ UNITY_SKIP_EXECUTION;
845
+
846
+ if ((elements == 0) || (length == 0))
847
+ {
848
+ UnityTestResultsFailBegin(lineNumber);
849
+ UnityPrint(UnityStrPointless);
850
+ UnityAddMsgIfSpecified(msg);
851
+ UNITY_FAIL_AND_BAIL;
852
+ }
853
+
854
+ if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1)
855
+ return;
856
+
857
+ while (elements--)
858
+ {
859
+ /////////////////////////////////////
860
+ bytes = length;
861
+ while (bytes--)
862
+ {
863
+ if (*ptr_exp != *ptr_act)
864
+ {
865
+ UnityTestResultsFailBegin(lineNumber);
866
+ UnityPrint(UnityStrMemory);
867
+ if (num_elements > 1)
868
+ {
869
+ UnityPrint(UnityStrElement);
870
+ UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
871
+ }
872
+ UnityPrint(UnityStrByte);
873
+ UnityPrintNumberByStyle((length - bytes - 1), UNITY_DISPLAY_STYLE_UINT);
874
+ UnityPrint(UnityStrExpected);
875
+ UnityPrintNumberByStyle(*ptr_exp, UNITY_DISPLAY_STYLE_HEX8);
876
+ UnityPrint(UnityStrWas);
877
+ UnityPrintNumberByStyle(*ptr_act, UNITY_DISPLAY_STYLE_HEX8);
878
+ UnityAddMsgIfSpecified(msg);
879
+ UNITY_FAIL_AND_BAIL;
880
+ }
881
+ ptr_exp += 1;
882
+ ptr_act += 1;
883
+ }
884
+ /////////////////////////////////////
885
+
886
+ }
887
+ }
888
+
889
+ //-----------------------------------------------
890
+ // Control Functions
891
+ //-----------------------------------------------
892
+
893
+ void UnityFail(const char* msg, const UNITY_LINE_TYPE line)
894
+ {
895
+ UNITY_SKIP_EXECUTION;
896
+
897
+ UnityTestResultsBegin(Unity.TestFile, line);
898
+ UnityPrintFail();
899
+ if (msg != NULL)
900
+ {
901
+ UNITY_OUTPUT_CHAR(':');
902
+ if (msg[0] != ' ')
903
+ {
904
+ UNITY_OUTPUT_CHAR(' ');
905
+ }
906
+ UnityPrint(msg);
907
+ }
908
+ UNITY_FAIL_AND_BAIL;
909
+ }
910
+
911
+ //-----------------------------------------------
912
+ void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line)
913
+ {
914
+ UNITY_SKIP_EXECUTION;
915
+
916
+ UnityTestResultsBegin(Unity.TestFile, line);
917
+ UnityPrint("IGNORE");
918
+ if (msg != NULL)
919
+ {
920
+ UNITY_OUTPUT_CHAR(':');
921
+ UNITY_OUTPUT_CHAR(' ');
922
+ UnityPrint(msg);
923
+ }
924
+ UNITY_IGNORE_AND_BAIL;
925
+ }
926
+
927
+ //-----------------------------------------------
928
+ void setUp(void);
929
+ void tearDown(void);
930
+ void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum)
931
+ {
932
+ Unity.CurrentTestName = FuncName;
933
+ Unity.CurrentTestLineNumber = FuncLineNum;
934
+ Unity.NumberOfTests++;
935
+ if (TEST_PROTECT())
936
+ {
937
+ setUp();
938
+ Func();
939
+ }
940
+ if (TEST_PROTECT() && !(Unity.CurrentTestIgnored))
941
+ {
942
+ tearDown();
943
+ }
944
+ UnityConcludeTest();
945
+ }
946
+
947
+ //-----------------------------------------------
948
+ void UnityBegin(void)
949
+ {
950
+ Unity.NumberOfTests = 0;
951
+ Unity.TestFailures = 0;
952
+ Unity.TestIgnores = 0;
953
+ Unity.CurrentTestFailed = 0;
954
+ Unity.CurrentTestIgnored = 0;
955
+ }
956
+
957
+ //-----------------------------------------------
958
+ int UnityEnd(void)
959
+ {
960
+ UnityPrint("-----------------------");
961
+ UNITY_PRINT_EOL;
962
+ UnityPrintNumber(Unity.NumberOfTests);
963
+ UnityPrint(" Tests ");
964
+ UnityPrintNumber(Unity.TestFailures);
965
+ UnityPrint(" Failures ");
966
+ UnityPrintNumber(Unity.TestIgnores);
967
+ UnityPrint(" Ignored");
968
+ UNITY_PRINT_EOL;
969
+ if (Unity.TestFailures == 0U)
970
+ {
971
+ UnityPrintOk();
972
+ }
973
+ else
974
+ {
975
+ UnityPrintFail();
976
+ }
977
+ UNITY_PRINT_EOL;
978
+ return Unity.TestFailures;
979
+ }