ceedling 0.29.1 → 0.30.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 (1267) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +15 -16
  3. data/Gemfile.lock +1 -1
  4. data/README.md +108 -107
  5. data/Rakefile +11 -11
  6. data/assets/ceedling +3 -3
  7. data/assets/ceedling.cmd +0 -0
  8. data/assets/default_gitignore +5 -5
  9. data/assets/example_file.c +5 -5
  10. data/assets/example_file.h +6 -6
  11. data/assets/project_as_gem.yml +101 -97
  12. data/assets/project_with_guts.yml +102 -98
  13. data/assets/project_with_guts_gcov.yml +102 -98
  14. data/assets/project_with_guts_gcov_abortonuncovered.yml +93 -0
  15. data/assets/test_example_file.c +13 -13
  16. data/assets/test_example_file_boom.c +13 -13
  17. data/assets/test_example_file_success.c +14 -14
  18. data/assets/test_example_file_verbose.c +12 -12
  19. data/assets/uncovered_example_file.c +5 -0
  20. data/bin/ceedling +351 -339
  21. data/ceedling.gemspec +52 -36
  22. data/config/test_environment.rb +11 -11
  23. data/docs/Ceedling Basic Porting.pdf +0 -0
  24. data/docs/Ceedling Managing Release Code.pdf +0 -0
  25. data/docs/Ceedling Powerful Plugins.pdf +0 -0
  26. data/docs/Ceedling Working with IDEs.pdf +0 -0
  27. data/docs/CeedlingPacket.md +2213 -2134
  28. data/docs/CeedlingUpgrade.md +83 -83
  29. data/docs/ThrowTheSwitchCodingStandard.md +207 -207
  30. data/examples/blinky/project.yml +99 -99
  31. data/examples/blinky/rakefile.rb +31 -31
  32. data/examples/blinky/src/BlinkTask.c +21 -21
  33. data/examples/blinky/src/BlinkTask.h +6 -6
  34. data/examples/blinky/src/Configure.c +36 -36
  35. data/examples/blinky/src/Configure.h +6 -6
  36. data/examples/blinky/src/main.c +51 -51
  37. data/examples/blinky/src/main.h +9 -9
  38. data/examples/blinky/test/support/stub_interrupt.h +347 -347
  39. data/examples/blinky/test/support/stub_io.h +421 -421
  40. data/examples/blinky/test/support/stub_iom328p.h +883 -883
  41. data/examples/blinky/test/support/stub_sfr_defs.h +269 -269
  42. data/examples/blinky/test/test_BlinkTask.c +42 -42
  43. data/examples/blinky/test/test_Configure.c +29 -29
  44. data/examples/blinky/test/test_main.c +60 -60
  45. data/examples/temp_sensor/project.yml +66 -76
  46. data/examples/temp_sensor/rakefile.rb +6 -6
  47. data/examples/temp_sensor/src/AdcConductor.c +42 -42
  48. data/examples/temp_sensor/src/AdcConductor.h +13 -13
  49. data/examples/temp_sensor/src/AdcHardware.c +27 -27
  50. data/examples/temp_sensor/src/AdcHardware.h +11 -11
  51. data/examples/temp_sensor/src/AdcHardwareConfigurator.c +18 -18
  52. data/examples/temp_sensor/src/AdcHardwareConfigurator.h +10 -10
  53. data/examples/temp_sensor/src/AdcModel.c +33 -33
  54. data/examples/temp_sensor/src/AdcModel.h +13 -13
  55. data/examples/temp_sensor/src/AdcTemperatureSensor.c +51 -51
  56. data/examples/temp_sensor/src/AdcTemperatureSensor.h +10 -10
  57. data/examples/temp_sensor/src/Executor.c +25 -25
  58. data/examples/temp_sensor/src/Executor.h +9 -9
  59. data/examples/temp_sensor/src/IntrinsicsWrapper.c +18 -18
  60. data/examples/temp_sensor/src/IntrinsicsWrapper.h +7 -7
  61. data/examples/temp_sensor/src/Main.c +46 -46
  62. data/examples/temp_sensor/src/Main.h +7 -7
  63. data/examples/temp_sensor/src/Model.c +10 -10
  64. data/examples/temp_sensor/src/Model.h +8 -8
  65. data/examples/temp_sensor/src/ModelConfig.h +7 -7
  66. data/examples/temp_sensor/src/TaskScheduler.c +72 -72
  67. data/examples/temp_sensor/src/TaskScheduler.h +11 -11
  68. data/examples/temp_sensor/src/TemperatureCalculator.c +27 -27
  69. data/examples/temp_sensor/src/TemperatureCalculator.h +8 -8
  70. data/examples/temp_sensor/src/TemperatureFilter.c +38 -38
  71. data/examples/temp_sensor/src/TemperatureFilter.h +10 -10
  72. data/examples/temp_sensor/src/TimerConductor.c +15 -15
  73. data/examples/temp_sensor/src/TimerConductor.h +9 -9
  74. data/examples/temp_sensor/src/TimerConfigurator.c +51 -51
  75. data/examples/temp_sensor/src/TimerConfigurator.h +15 -15
  76. data/examples/temp_sensor/src/TimerHardware.c +15 -15
  77. data/examples/temp_sensor/src/TimerHardware.h +8 -8
  78. data/examples/temp_sensor/src/TimerInterruptConfigurator.c +55 -55
  79. data/examples/temp_sensor/src/TimerInterruptConfigurator.h +13 -13
  80. data/examples/temp_sensor/src/TimerInterruptHandler.c +25 -25
  81. data/examples/temp_sensor/src/TimerInterruptHandler.h +10 -10
  82. data/examples/temp_sensor/src/TimerModel.c +9 -9
  83. data/examples/temp_sensor/src/TimerModel.h +8 -8
  84. data/examples/temp_sensor/src/Types.h +90 -90
  85. data/examples/temp_sensor/src/UsartBaudRateRegisterCalculator.c +18 -18
  86. data/examples/temp_sensor/src/UsartBaudRateRegisterCalculator.h +8 -8
  87. data/examples/temp_sensor/src/UsartConductor.c +21 -21
  88. data/examples/temp_sensor/src/UsartConductor.h +7 -7
  89. data/examples/temp_sensor/src/UsartConfigurator.c +39 -39
  90. data/examples/temp_sensor/src/UsartConfigurator.h +13 -13
  91. data/examples/temp_sensor/src/UsartHardware.c +22 -22
  92. data/examples/temp_sensor/src/UsartHardware.h +9 -9
  93. data/examples/temp_sensor/src/UsartModel.c +34 -34
  94. data/examples/temp_sensor/src/UsartModel.h +10 -10
  95. data/examples/temp_sensor/src/UsartPutChar.c +16 -16
  96. data/examples/temp_sensor/src/UsartPutChar.h +8 -8
  97. data/examples/temp_sensor/src/UsartTransmitBufferStatus.c +7 -7
  98. data/examples/temp_sensor/src/UsartTransmitBufferStatus.h +8 -8
  99. data/examples/temp_sensor/test/TestAdcConductor.c +121 -121
  100. data/examples/temp_sensor/test/TestAdcHardware.c +44 -44
  101. data/examples/temp_sensor/test/TestAdcModel.c +33 -33
  102. data/examples/temp_sensor/test/TestExecutor.c +36 -36
  103. data/examples/temp_sensor/test/TestMain.c +24 -24
  104. data/examples/temp_sensor/test/TestModel.c +20 -20
  105. data/examples/temp_sensor/test/TestTaskScheduler.c +104 -104
  106. data/examples/temp_sensor/test/TestTemperatureCalculator.c +36 -36
  107. data/examples/temp_sensor/test/TestTemperatureFilter.c +79 -79
  108. data/examples/temp_sensor/test/TestTimerConductor.c +32 -32
  109. data/examples/temp_sensor/test/TestTimerHardware.c +26 -26
  110. data/examples/temp_sensor/test/TestTimerModel.c +18 -18
  111. data/examples/temp_sensor/test/TestUsartBaudRateRegisterCalculator.c +21 -21
  112. data/examples/temp_sensor/test/TestUsartConductor.c +40 -40
  113. data/examples/temp_sensor/test/TestUsartHardware.c +36 -36
  114. data/examples/temp_sensor/test/TestUsartModel.c +40 -40
  115. data/examples/temp_sensor/test/support/UnityHelper.c +12 -12
  116. data/examples/temp_sensor/test/support/UnityHelper.h +12 -12
  117. data/lib/ceedling.rb +99 -99
  118. data/lib/ceedling/build_invoker_utils.rb +39 -39
  119. data/lib/ceedling/cacheinator.rb +47 -47
  120. data/lib/ceedling/cacheinator_helper.rb +35 -31
  121. data/lib/ceedling/cmock_builder.rb +15 -15
  122. data/lib/ceedling/configurator.rb +372 -363
  123. data/lib/ceedling/configurator_builder.rb +463 -458
  124. data/lib/ceedling/configurator_plugins.rb +111 -111
  125. data/lib/ceedling/configurator_setup.rb +127 -127
  126. data/lib/ceedling/configurator_validator.rb +193 -193
  127. data/lib/ceedling/constants.rb +99 -97
  128. data/lib/ceedling/defaults.rb +447 -418
  129. data/lib/ceedling/dependinator.rb +97 -98
  130. data/lib/ceedling/erb_wrapper.rb +8 -8
  131. data/lib/ceedling/file_finder.rb +149 -149
  132. data/lib/ceedling/file_finder_helper.rb +56 -54
  133. data/lib/ceedling/file_path_utils.rb +202 -200
  134. data/lib/ceedling/file_system_utils.rb +69 -69
  135. data/lib/ceedling/file_system_wrapper.rb +9 -9
  136. data/lib/ceedling/file_wrapper.rb +83 -83
  137. data/lib/ceedling/flaginator.rb +74 -74
  138. data/lib/ceedling/generator.rb +186 -183
  139. data/lib/ceedling/generator_helper.rb +40 -40
  140. data/lib/ceedling/generator_test_results.rb +100 -100
  141. data/lib/ceedling/generator_test_results_sanity_checker.rb +65 -65
  142. data/lib/ceedling/generator_test_runner.rb +58 -56
  143. data/lib/ceedling/loginator.rb +31 -31
  144. data/lib/ceedling/makefile.rb +46 -46
  145. data/lib/ceedling/objects.yml +311 -310
  146. data/lib/ceedling/par_map.rb +19 -19
  147. data/lib/ceedling/plugin.rb +80 -80
  148. data/lib/ceedling/plugin_builder.rb +52 -52
  149. data/lib/ceedling/plugin_manager.rb +107 -107
  150. data/lib/ceedling/plugin_manager_helper.rb +19 -19
  151. data/lib/ceedling/plugin_reportinator.rb +76 -76
  152. data/lib/ceedling/plugin_reportinator_helper.rb +51 -51
  153. data/lib/ceedling/preprocessinator.rb +47 -42
  154. data/lib/ceedling/preprocessinator_extractor.rb +30 -30
  155. data/lib/ceedling/preprocessinator_file_handler.rb +21 -21
  156. data/lib/ceedling/preprocessinator_helper.rb +50 -46
  157. data/lib/ceedling/preprocessinator_includes_handler.rb +181 -181
  158. data/lib/ceedling/project_config_manager.rb +52 -46
  159. data/lib/ceedling/project_file_loader.rb +99 -99
  160. data/lib/ceedling/rake_utils.rb +17 -17
  161. data/lib/ceedling/rake_wrapper.rb +33 -33
  162. data/lib/ceedling/rakefile.rb +86 -86
  163. data/lib/ceedling/release_invoker.rb +98 -73
  164. data/lib/ceedling/release_invoker_helper.rb +19 -19
  165. data/lib/ceedling/reportinator.rb +26 -26
  166. data/lib/ceedling/rules_cmock.rake +9 -9
  167. data/lib/ceedling/rules_preprocess.rake +26 -26
  168. data/lib/ceedling/rules_release.rake +99 -86
  169. data/lib/ceedling/rules_release_deep_dependencies.rake +15 -15
  170. data/lib/ceedling/rules_tests.rake +73 -74
  171. data/lib/ceedling/rules_tests_deep_dependencies.rake +15 -15
  172. data/lib/ceedling/setupinator.rb +53 -53
  173. data/lib/ceedling/stream_wrapper.rb +28 -28
  174. data/lib/ceedling/streaminator.rb +40 -40
  175. data/lib/ceedling/streaminator_helper.rb +15 -15
  176. data/lib/ceedling/system_utils.rb +37 -37
  177. data/lib/ceedling/system_wrapper.rb +80 -80
  178. data/lib/ceedling/target_loader.rb +38 -38
  179. data/lib/ceedling/task_invoker.rb +122 -117
  180. data/lib/ceedling/tasks_base.rake +116 -105
  181. data/lib/ceedling/tasks_filesystem.rake +113 -112
  182. data/lib/ceedling/tasks_release.rake +30 -30
  183. data/lib/ceedling/tasks_release_deep_dependencies.rake +9 -9
  184. data/lib/ceedling/tasks_tests.rake +60 -60
  185. data/lib/ceedling/tasks_tests_deep_dependencies.rake +9 -9
  186. data/lib/ceedling/tasks_vendor.rake +35 -35
  187. data/lib/ceedling/test_includes_extractor.rb +111 -85
  188. data/lib/ceedling/test_invoker.rb +164 -188
  189. data/lib/ceedling/test_invoker_helper.rb +32 -32
  190. data/lib/ceedling/tool_executor.rb +229 -229
  191. data/lib/ceedling/tool_executor_helper.rb +164 -164
  192. data/lib/ceedling/verbosinator.rb +10 -10
  193. data/lib/ceedling/version.rb +50 -50
  194. data/lib/ceedling/yaml_wrapper.rb +17 -17
  195. data/license.txt +31 -31
  196. data/plugins/beep/README.md +22 -22
  197. data/plugins/beep/lib/beep.rb +40 -40
  198. data/plugins/bullseye/README.md +76 -0
  199. data/plugins/bullseye/assets/template.erb +15 -15
  200. data/plugins/bullseye/bullseye.rake +173 -169
  201. data/plugins/bullseye/config/defaults.yml +57 -57
  202. data/plugins/bullseye/lib/bullseye.rb +194 -194
  203. data/plugins/colour_report/README.md +20 -0
  204. data/plugins/colour_report/lib/colour_report.rb +16 -16
  205. data/plugins/command_hooks/README.md +53 -53
  206. data/plugins/command_hooks/lib/command_hooks.rb +92 -92
  207. data/plugins/compile_commands_json/README.md +29 -0
  208. data/plugins/compile_commands_json/lib/compile_commands_json.rb +35 -0
  209. data/plugins/dependencies/README.md +254 -0
  210. data/plugins/dependencies/config/defaults.yml +5 -0
  211. data/plugins/dependencies/dependencies.rake +144 -0
  212. data/plugins/dependencies/lib/dependencies.rb +231 -0
  213. data/plugins/fake_function_framework/README.md +250 -250
  214. data/plugins/fake_function_framework/Rakefile +18 -18
  215. data/plugins/fake_function_framework/examples/fff_example/project.yml +71 -71
  216. data/plugins/fake_function_framework/examples/fff_example/rakefile.rb +7 -7
  217. data/plugins/fake_function_framework/examples/fff_example/src/bar.c +1 -1
  218. data/plugins/fake_function_framework/examples/fff_example/src/bar.h +14 -14
  219. data/plugins/fake_function_framework/examples/fff_example/src/custom_types.h +6 -6
  220. data/plugins/fake_function_framework/examples/fff_example/src/display.c +6 -6
  221. data/plugins/fake_function_framework/examples/fff_example/src/display.h +16 -16
  222. data/plugins/fake_function_framework/examples/fff_example/src/event_processor.c +93 -93
  223. data/plugins/fake_function_framework/examples/fff_example/src/event_processor.h +11 -11
  224. data/plugins/fake_function_framework/examples/fff_example/src/foo.c +16 -16
  225. data/plugins/fake_function_framework/examples/fff_example/src/foo.h +8 -8
  226. data/plugins/fake_function_framework/examples/fff_example/src/subfolder/zzz.c +1 -1
  227. data/plugins/fake_function_framework/examples/fff_example/src/subfolder/zzz.h +6 -6
  228. data/plugins/fake_function_framework/examples/fff_example/test/test_event_processor.c +155 -155
  229. data/plugins/fake_function_framework/examples/fff_example/test/test_foo.c +47 -47
  230. data/plugins/fake_function_framework/lib/fake_function_framework.rb +87 -87
  231. data/plugins/fake_function_framework/lib/fff_mock_generator.rb +163 -163
  232. data/plugins/fake_function_framework/spec/fff_mock_header_generator_spec.rb +304 -304
  233. data/plugins/fake_function_framework/spec/fff_mock_source_generator_spec.rb +148 -148
  234. data/plugins/fake_function_framework/spec/header_generator.rb +50 -50
  235. data/plugins/fake_function_framework/spec/spec_helper.rb +96 -96
  236. data/plugins/fake_function_framework/src/fff_unity_helper.h +32 -32
  237. data/plugins/gcov/README.md +412 -101
  238. data/plugins/gcov/assets/template.erb +15 -15
  239. data/plugins/gcov/config/defaults.yml +51 -73
  240. data/plugins/gcov/gcov.rake +209 -220
  241. data/plugins/gcov/lib/gcov.rb +133 -113
  242. data/plugins/gcov/lib/gcov_constants.rb +48 -19
  243. data/plugins/gcov/lib/gcovr_reportinator.rb +331 -0
  244. data/plugins/gcov/lib/reportgenerator_reportinator.rb +153 -0
  245. data/plugins/gcov/lib/reportinator_helper.rb +15 -0
  246. data/plugins/json_tests_report/README.md +36 -0
  247. data/plugins/json_tests_report/lib/json_tests_report.rb +83 -0
  248. data/plugins/junit_tests_report/README.md +36 -36
  249. data/plugins/junit_tests_report/lib/junit_tests_report.rb +134 -130
  250. data/plugins/module_generator/README.md +105 -0
  251. data/plugins/module_generator/config/module_generator.yml +3 -3
  252. data/plugins/module_generator/lib/module_generator.rb +79 -70
  253. data/plugins/module_generator/module_generator.rake +62 -47
  254. data/plugins/raw_output_report/README.md +19 -0
  255. data/plugins/raw_output_report/lib/raw_output_report.rb +41 -41
  256. data/plugins/stdout_gtestlike_tests_report/README.md +19 -0
  257. data/plugins/stdout_gtestlike_tests_report/assets/template.erb +84 -84
  258. data/plugins/stdout_gtestlike_tests_report/assets/template.erb copy +59 -59
  259. data/plugins/stdout_gtestlike_tests_report/config/stdout_gtestlike_tests_report.yml +4 -4
  260. data/plugins/stdout_gtestlike_tests_report/lib/stdout_gtestlike_tests_report.rb +43 -43
  261. data/plugins/stdout_ide_tests_report/README.md +18 -0
  262. data/plugins/stdout_ide_tests_report/config/stdout_ide_tests_report.yml +4 -4
  263. data/plugins/stdout_ide_tests_report/lib/stdout_ide_tests_report.rb +44 -44
  264. data/plugins/stdout_pretty_tests_report/README.md +20 -0
  265. data/plugins/stdout_pretty_tests_report/assets/template.erb +59 -59
  266. data/plugins/stdout_pretty_tests_report/config/stdout_pretty_tests_report.yml +4 -4
  267. data/plugins/stdout_pretty_tests_report/lib/stdout_pretty_tests_report.rb +47 -47
  268. data/plugins/subprojects/README.md +63 -63
  269. data/plugins/subprojects/config/defaults.yml +33 -33
  270. data/plugins/subprojects/lib/subprojects.rb +92 -92
  271. data/plugins/subprojects/subprojects.rake +78 -78
  272. data/plugins/teamcity_tests_report/README.md +18 -0
  273. data/plugins/teamcity_tests_report/config/teamcity_tests_report.yml +4 -4
  274. data/plugins/teamcity_tests_report/lib/teamcity_tests_report.rb +57 -57
  275. data/plugins/warnings_report/README.md +19 -0
  276. data/plugins/warnings_report/lib/warnings_report.rb +69 -69
  277. data/plugins/xml_tests_report/README.md +36 -36
  278. data/plugins/xml_tests_report/lib/xml_tests_report.rb +110 -110
  279. data/spec/build_invoker_utils_spec.rb +54 -54
  280. data/spec/ceedling_spec.rb +154 -154
  281. data/spec/configurator_builder_spec.rb +6 -6
  282. data/spec/configurator_helper_spec.rb +4 -4
  283. data/spec/configurator_spec.rb +9 -9
  284. data/spec/file_finder_helper_spec.rb +53 -53
  285. data/spec/gcov/gcov_deployment_spec.rb +72 -70
  286. data/spec/gcov/gcov_test_cases_spec.rb +128 -91
  287. data/spec/generator_test_results_sanity_checker_spec.rb +88 -88
  288. data/spec/generator_test_results_spec.rb +107 -107
  289. data/spec/par_map_spec.rb +57 -57
  290. data/spec/preprocessinator_extractor_spec.rb +45 -45
  291. data/spec/preprocessinator_includes_handler_spec.rb +202 -202
  292. data/spec/reportinator_spec.rb +19 -19
  293. data/spec/spec_helper.rb +27 -27
  294. data/spec/spec_system_helper.rb +616 -615
  295. data/spec/support/test_example.fail +24 -24
  296. data/spec/support/test_example.pass +24 -24
  297. data/spec/support/test_example_empty.pass +14 -14
  298. data/spec/support/test_example_ignore.pass +24 -24
  299. data/spec/support/test_example_mangled.pass +21 -21
  300. data/spec/support/test_example_with_time.pass +24 -24
  301. data/spec/system/deployment_spec.rb +225 -225
  302. data/spec/system_utils_spec.rb +56 -56
  303. data/spec/target_loader_spec.rb +30 -30
  304. data/spec/tool_executor_helper_spec.rb +310 -310
  305. data/spec/uncatagorized_specs_spec.rb +8 -8
  306. data/vendor/behaviors/Manifest.txt +9 -9
  307. data/vendor/behaviors/Rakefile +19 -19
  308. data/vendor/behaviors/lib/behaviors.rb +76 -76
  309. data/vendor/behaviors/lib/behaviors/reporttask.rb +158 -158
  310. data/vendor/behaviors/test/behaviors_tasks_test.rb +73 -73
  311. data/vendor/behaviors/test/behaviors_test.rb +50 -50
  312. data/vendor/behaviors/test/tasks_test/Rakefile +19 -19
  313. data/vendor/behaviors/test/tasks_test/lib/user.rb +2 -2
  314. data/vendor/behaviors/test/tasks_test/test/user_test.rb +17 -17
  315. data/vendor/c_exception/Gemfile +4 -4
  316. data/vendor/c_exception/Gemfile.lock +12 -12
  317. data/vendor/c_exception/README.md +249 -162
  318. data/vendor/c_exception/docs/CException.md +332 -292
  319. data/vendor/c_exception/docs/ThrowTheSwitchCodingStandard.md +207 -207
  320. data/vendor/c_exception/lib/CException.c +46 -46
  321. data/vendor/c_exception/lib/CException.h +115 -115
  322. data/vendor/c_exception/lib/meson.build +11 -0
  323. data/vendor/c_exception/meson.build +48 -0
  324. data/vendor/c_exception/project.yml +37 -0
  325. data/vendor/c_exception/test/TestException.c +391 -391
  326. data/vendor/{cmock/vendor/c_exception/test → c_exception/test/support}/CExceptionConfig.h +46 -46
  327. data/vendor/c_exception/vendor/unity/README.md +220 -220
  328. data/vendor/c_exception/vendor/unity/auto/colour_prompt.rb +118 -118
  329. data/vendor/c_exception/vendor/unity/auto/colour_reporter.rb +39 -39
  330. data/vendor/c_exception/vendor/unity/auto/generate_config.yml +36 -36
  331. data/vendor/c_exception/vendor/unity/auto/generate_module.rb +308 -308
  332. data/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +437 -437
  333. data/vendor/c_exception/vendor/unity/auto/parse_output.rb +220 -220
  334. data/vendor/c_exception/vendor/unity/auto/stylize_as_junit.rb +252 -252
  335. data/vendor/c_exception/vendor/unity/auto/test_file_filter.rb +25 -25
  336. data/vendor/c_exception/vendor/unity/auto/type_sanitizer.rb +6 -6
  337. data/vendor/c_exception/vendor/unity/auto/unity_test_summary.py +139 -139
  338. data/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb +136 -136
  339. data/vendor/c_exception/vendor/unity/auto/unity_to_junit.py +146 -146
  340. data/vendor/c_exception/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +207 -207
  341. data/vendor/c_exception/vendor/unity/docs/UnityAssertionsReference.md +716 -716
  342. data/vendor/c_exception/vendor/unity/docs/UnityConfigurationGuide.md +398 -398
  343. data/vendor/c_exception/vendor/unity/docs/UnityGettingStartedGuide.md +191 -191
  344. data/vendor/c_exception/vendor/unity/docs/UnityHelperScriptsGuide.md +242 -242
  345. data/vendor/c_exception/vendor/unity/docs/license.txt +21 -21
  346. data/vendor/c_exception/vendor/unity/examples/example_1/makefile +71 -71
  347. data/vendor/c_exception/vendor/unity/examples/example_1/readme.txt +4 -4
  348. data/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode.c +24 -24
  349. data/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode.h +3 -3
  350. data/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode2.c +11 -11
  351. data/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode2.h +2 -2
  352. data/vendor/c_exception/vendor/unity/examples/example_1/test/TestProductionCode.c +62 -62
  353. data/vendor/c_exception/vendor/unity/examples/example_1/test/TestProductionCode2.c +31 -31
  354. data/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +53 -53
  355. data/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +57 -57
  356. data/vendor/c_exception/vendor/unity/examples/example_2/makefile +70 -70
  357. data/vendor/c_exception/vendor/unity/examples/example_2/readme.txt +4 -4
  358. data/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode.c +24 -24
  359. data/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode.h +3 -3
  360. data/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode2.c +11 -11
  361. data/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode2.h +2 -2
  362. data/vendor/c_exception/vendor/unity/examples/example_2/test/TestProductionCode.c +64 -64
  363. data/vendor/c_exception/vendor/unity/examples/example_2/test/TestProductionCode2.c +33 -33
  364. data/vendor/c_exception/vendor/unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c +8 -8
  365. data/vendor/c_exception/vendor/unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c +10 -10
  366. data/vendor/c_exception/vendor/unity/examples/example_2/test/test_runners/all_tests.c +12 -12
  367. data/vendor/c_exception/vendor/unity/examples/example_3/helper/UnityHelper.c +10 -10
  368. data/vendor/c_exception/vendor/unity/examples/example_3/helper/UnityHelper.h +12 -12
  369. data/vendor/c_exception/vendor/unity/examples/example_3/rakefile.rb +43 -43
  370. data/vendor/c_exception/vendor/unity/examples/example_3/rakefile_helper.rb +249 -249
  371. data/vendor/c_exception/vendor/unity/examples/example_3/readme.txt +13 -13
  372. data/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode.c +24 -24
  373. data/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode.h +3 -3
  374. data/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode2.c +11 -11
  375. data/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode2.h +2 -2
  376. data/vendor/c_exception/vendor/unity/examples/example_3/target_gcc_32.yml +46 -46
  377. data/vendor/c_exception/vendor/unity/examples/example_3/test/TestProductionCode.c +62 -62
  378. data/vendor/c_exception/vendor/unity/examples/example_3/test/TestProductionCode2.c +31 -31
  379. data/vendor/c_exception/vendor/unity/examples/unity_config.h +237 -237
  380. data/vendor/c_exception/vendor/unity/extras/eclipse/error_parsers.txt +26 -26
  381. data/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb +48 -48
  382. data/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb +178 -178
  383. data/vendor/c_exception/vendor/unity/extras/fixture/readme.txt +8 -8
  384. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +432 -432
  385. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h +83 -83
  386. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +51 -51
  387. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +47 -47
  388. data/vendor/c_exception/vendor/unity/extras/fixture/test/Makefile +74 -74
  389. data/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c +22 -22
  390. data/vendor/c_exception/vendor/unity/extras/fixture/test/template_fixture_tests.c +39 -39
  391. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +543 -543
  392. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +57 -57
  393. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c +57 -57
  394. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h +17 -17
  395. data/vendor/c_exception/vendor/unity/release/build.info +2 -2
  396. data/vendor/c_exception/vendor/unity/release/version.info +2 -2
  397. data/vendor/c_exception/vendor/unity/src/unity.c +1517 -1517
  398. data/vendor/c_exception/vendor/unity/src/unity.h +339 -339
  399. data/vendor/c_exception/vendor/unity/src/unity_internals.h +784 -784
  400. data/vendor/c_exception/vendor/unity/test/Makefile +63 -63
  401. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c +61 -61
  402. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c +57 -57
  403. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_head1.c +55 -55
  404. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_head1.h +15 -15
  405. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c +80 -80
  406. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c +76 -76
  407. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_head1.c +75 -75
  408. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_head1.h +13 -13
  409. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c +89 -89
  410. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c +89 -89
  411. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c +77 -77
  412. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c +89 -89
  413. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c +89 -89
  414. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c +90 -90
  415. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c +67 -67
  416. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c +70 -70
  417. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c +58 -58
  418. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c +67 -67
  419. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c +70 -70
  420. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c +71 -71
  421. data/vendor/c_exception/vendor/unity/test/rakefile +125 -125
  422. data/vendor/c_exception/vendor/unity/test/rakefile_helper.rb +260 -260
  423. data/vendor/c_exception/vendor/unity/test/spec/generate_module_existing_file_spec.rb +158 -158
  424. data/vendor/c_exception/vendor/unity/test/targets/clang_file.yml +78 -78
  425. data/vendor/c_exception/vendor/unity/test/targets/clang_strict.yml +78 -78
  426. data/vendor/c_exception/vendor/unity/test/targets/gcc_32.yml +49 -49
  427. data/vendor/c_exception/vendor/unity/test/targets/gcc_64.yml +50 -50
  428. data/vendor/c_exception/vendor/unity/test/targets/gcc_auto_limits.yml +47 -47
  429. data/vendor/c_exception/vendor/unity/test/targets/gcc_auto_stdint.yml +59 -59
  430. data/vendor/c_exception/vendor/unity/test/targets/gcc_manual_math.yml +47 -47
  431. data/vendor/c_exception/vendor/unity/test/targets/hitech_picc18.yml +101 -101
  432. data/vendor/c_exception/vendor/unity/test/targets/iar_arm_v4.yml +90 -90
  433. data/vendor/c_exception/vendor/unity/test/targets/iar_arm_v5.yml +80 -80
  434. data/vendor/c_exception/vendor/unity/test/targets/iar_arm_v5_3.yml +80 -80
  435. data/vendor/c_exception/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +94 -94
  436. data/vendor/c_exception/vendor/unity/test/targets/iar_cortexm3_v5.yml +84 -84
  437. data/vendor/c_exception/vendor/unity/test/targets/iar_msp430.yml +95 -95
  438. data/vendor/c_exception/vendor/unity/test/targets/iar_sh2a_v6.yml +86 -86
  439. data/vendor/c_exception/vendor/unity/test/testdata/CException.h +11 -11
  440. data/vendor/c_exception/vendor/unity/test/testdata/Defs.h +8 -8
  441. data/vendor/c_exception/vendor/unity/test/testdata/cmock.h +14 -14
  442. data/vendor/c_exception/vendor/unity/test/testdata/mockMock.h +13 -13
  443. data/vendor/c_exception/vendor/unity/test/testdata/testRunnerGenerator.c +183 -183
  444. data/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +67 -67
  445. data/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +192 -192
  446. data/vendor/c_exception/vendor/unity/test/tests/test_generate_test_runner.rb +1252 -1252
  447. data/vendor/c_exception/vendor/unity/test/tests/testparameterized.c +110 -110
  448. data/vendor/c_exception/vendor/unity/test/tests/testunity.c +4993 -4993
  449. data/vendor/cmock/Gemfile +8 -9
  450. data/vendor/cmock/LICENSE.txt +18 -18
  451. data/vendor/cmock/README.md +34 -34
  452. data/vendor/cmock/config/production_environment.rb +12 -14
  453. data/vendor/cmock/config/test_environment.rb +16 -16
  454. data/vendor/cmock/docs/CMock_Summary.md +806 -696
  455. data/vendor/cmock/docs/ThrowTheSwitchCodingStandard.md +207 -207
  456. data/vendor/cmock/examples/make_example/Makefile +30 -30
  457. data/vendor/cmock/examples/make_example/src/foo.c +5 -5
  458. data/vendor/cmock/examples/make_example/src/foo.h +5 -5
  459. data/vendor/cmock/examples/make_example/src/main.c +15 -15
  460. data/vendor/cmock/examples/make_example/test/test_foo.c +17 -17
  461. data/vendor/cmock/examples/make_example/test/test_main.c +15 -15
  462. data/vendor/cmock/examples/temp_sensor/gcc.yml +44 -44
  463. data/vendor/cmock/examples/temp_sensor/iar_v4.yml +92 -92
  464. data/vendor/cmock/examples/temp_sensor/iar_v5.yml +81 -81
  465. data/vendor/cmock/examples/temp_sensor/rakefile.rb +42 -42
  466. data/vendor/cmock/examples/temp_sensor/rakefile_helper.rb +268 -272
  467. data/vendor/cmock/examples/temp_sensor/src/AT91SAM7X256.h +2556 -2556
  468. data/vendor/cmock/examples/temp_sensor/src/AdcConductor.c +42 -42
  469. data/vendor/cmock/examples/temp_sensor/src/AdcConductor.h +11 -11
  470. data/vendor/cmock/examples/temp_sensor/src/AdcHardware.c +27 -27
  471. data/vendor/cmock/examples/temp_sensor/src/AdcHardware.h +9 -9
  472. data/vendor/cmock/examples/temp_sensor/src/AdcHardwareConfigurator.c +18 -18
  473. data/vendor/cmock/examples/temp_sensor/src/AdcHardwareConfigurator.h +10 -10
  474. data/vendor/cmock/examples/temp_sensor/src/AdcModel.c +33 -33
  475. data/vendor/cmock/examples/temp_sensor/src/AdcModel.h +13 -13
  476. data/vendor/cmock/examples/temp_sensor/src/AdcTemperatureSensor.c +51 -51
  477. data/vendor/cmock/examples/temp_sensor/src/AdcTemperatureSensor.h +10 -10
  478. data/vendor/cmock/examples/temp_sensor/src/Executor.c +25 -25
  479. data/vendor/cmock/examples/temp_sensor/src/Executor.h +9 -9
  480. data/vendor/cmock/examples/temp_sensor/src/IntrinsicsWrapper.c +18 -18
  481. data/vendor/cmock/examples/temp_sensor/src/IntrinsicsWrapper.h +7 -7
  482. data/vendor/cmock/examples/temp_sensor/src/Main.c +46 -46
  483. data/vendor/cmock/examples/temp_sensor/src/Main.h +7 -7
  484. data/vendor/cmock/examples/temp_sensor/src/Model.c +10 -10
  485. data/vendor/cmock/examples/temp_sensor/src/Model.h +8 -8
  486. data/vendor/cmock/examples/temp_sensor/src/ModelConfig.h +7 -7
  487. data/vendor/cmock/examples/temp_sensor/src/TaskScheduler.c +72 -72
  488. data/vendor/cmock/examples/temp_sensor/src/TaskScheduler.h +11 -11
  489. data/vendor/cmock/examples/temp_sensor/src/TemperatureCalculator.c +27 -27
  490. data/vendor/cmock/examples/temp_sensor/src/TemperatureCalculator.h +6 -6
  491. data/vendor/cmock/examples/temp_sensor/src/TemperatureFilter.c +39 -39
  492. data/vendor/cmock/examples/temp_sensor/src/TemperatureFilter.h +10 -10
  493. data/vendor/cmock/examples/temp_sensor/src/TimerConductor.c +15 -15
  494. data/vendor/cmock/examples/temp_sensor/src/TimerConductor.h +9 -9
  495. data/vendor/cmock/examples/temp_sensor/src/TimerConfigurator.c +51 -51
  496. data/vendor/cmock/examples/temp_sensor/src/TimerConfigurator.h +15 -15
  497. data/vendor/cmock/examples/temp_sensor/src/TimerHardware.c +15 -15
  498. data/vendor/cmock/examples/temp_sensor/src/TimerHardware.h +8 -8
  499. data/vendor/cmock/examples/temp_sensor/src/TimerInterruptConfigurator.c +55 -55
  500. data/vendor/cmock/examples/temp_sensor/src/TimerInterruptConfigurator.h +13 -13
  501. data/vendor/cmock/examples/temp_sensor/src/TimerInterruptHandler.c +25 -25
  502. data/vendor/cmock/examples/temp_sensor/src/TimerInterruptHandler.h +10 -10
  503. data/vendor/cmock/examples/temp_sensor/src/TimerModel.c +9 -9
  504. data/vendor/cmock/examples/temp_sensor/src/TimerModel.h +8 -8
  505. data/vendor/cmock/examples/temp_sensor/src/Types.h +103 -103
  506. data/vendor/cmock/examples/temp_sensor/src/UsartBaudRateRegisterCalculator.c +18 -18
  507. data/vendor/cmock/examples/temp_sensor/src/UsartBaudRateRegisterCalculator.h +6 -6
  508. data/vendor/cmock/examples/temp_sensor/src/UsartConductor.c +21 -21
  509. data/vendor/cmock/examples/temp_sensor/src/UsartConductor.h +7 -7
  510. data/vendor/cmock/examples/temp_sensor/src/UsartConfigurator.c +39 -39
  511. data/vendor/cmock/examples/temp_sensor/src/UsartConfigurator.h +13 -13
  512. data/vendor/cmock/examples/temp_sensor/src/UsartHardware.c +22 -22
  513. data/vendor/cmock/examples/temp_sensor/src/UsartHardware.h +9 -9
  514. data/vendor/cmock/examples/temp_sensor/src/UsartModel.c +34 -34
  515. data/vendor/cmock/examples/temp_sensor/src/UsartModel.h +10 -10
  516. data/vendor/cmock/examples/temp_sensor/src/UsartPutChar.c +16 -16
  517. data/vendor/cmock/examples/temp_sensor/src/UsartPutChar.h +8 -8
  518. data/vendor/cmock/examples/temp_sensor/src/UsartTransmitBufferStatus.c +7 -7
  519. data/vendor/cmock/examples/temp_sensor/src/UsartTransmitBufferStatus.h +8 -8
  520. data/vendor/cmock/examples/temp_sensor/test/TestAdcConductor.c +121 -121
  521. data/vendor/cmock/examples/temp_sensor/test/TestAdcHardware.c +44 -44
  522. data/vendor/cmock/examples/temp_sensor/test/TestAdcHardwareConfigurator.c +43 -43
  523. data/vendor/cmock/examples/temp_sensor/test/TestAdcModel.c +33 -33
  524. data/vendor/cmock/examples/temp_sensor/test/TestAdcTemperatureSensor.c +47 -47
  525. data/vendor/cmock/examples/temp_sensor/test/TestExecutor.c +36 -36
  526. data/vendor/cmock/examples/temp_sensor/test/TestMain.c +24 -24
  527. data/vendor/cmock/examples/temp_sensor/test/TestModel.c +20 -20
  528. data/vendor/cmock/examples/temp_sensor/test/TestTaskScheduler.c +104 -104
  529. data/vendor/cmock/examples/temp_sensor/test/TestTemperatureCalculator.c +33 -33
  530. data/vendor/cmock/examples/temp_sensor/test/TestTemperatureFilter.c +69 -69
  531. data/vendor/cmock/examples/temp_sensor/test/TestTimerConductor.c +32 -32
  532. data/vendor/cmock/examples/temp_sensor/test/TestTimerConfigurator.c +112 -112
  533. data/vendor/cmock/examples/temp_sensor/test/TestTimerHardware.c +26 -26
  534. data/vendor/cmock/examples/temp_sensor/test/TestTimerInterruptConfigurator.c +78 -78
  535. data/vendor/cmock/examples/temp_sensor/test/TestTimerInterruptHandler.c +66 -66
  536. data/vendor/cmock/examples/temp_sensor/test/TestTimerModel.c +18 -18
  537. data/vendor/cmock/examples/temp_sensor/test/TestUsartBaudRateRegisterCalculator.c +21 -21
  538. data/vendor/cmock/examples/temp_sensor/test/TestUsartConductor.c +40 -40
  539. data/vendor/cmock/examples/temp_sensor/test/TestUsartConfigurator.c +77 -77
  540. data/vendor/cmock/examples/temp_sensor/test/TestUsartHardware.c +37 -37
  541. data/vendor/cmock/examples/temp_sensor/test/TestUsartModel.c +40 -40
  542. data/vendor/cmock/examples/temp_sensor/test/TestUsartPutChar.c +43 -43
  543. data/vendor/cmock/examples/temp_sensor/test/TestUsartTransmitBufferStatus.c +22 -22
  544. data/vendor/cmock/lib/cmock.rb +104 -86
  545. data/vendor/cmock/lib/cmock_config.rb +173 -163
  546. data/vendor/cmock/lib/cmock_file_writer.rb +48 -44
  547. data/vendor/cmock/lib/cmock_generator.rb +333 -275
  548. data/vendor/cmock/lib/cmock_generator_plugin_array.rb +63 -63
  549. data/vendor/cmock/lib/cmock_generator_plugin_callback.rb +88 -88
  550. data/vendor/cmock/lib/cmock_generator_plugin_cexception.rb +49 -51
  551. data/vendor/cmock/lib/cmock_generator_plugin_expect.rb +100 -103
  552. data/vendor/cmock/lib/cmock_generator_plugin_expect_any_args.rb +50 -53
  553. data/vendor/cmock/lib/cmock_generator_plugin_ignore.rb +88 -75
  554. data/vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb +42 -42
  555. data/vendor/cmock/lib/cmock_generator_plugin_return_thru_ptr.rb +79 -79
  556. data/vendor/cmock/lib/cmock_generator_utils.rb +247 -253
  557. data/vendor/cmock/lib/cmock_header_parser.rb +595 -474
  558. data/vendor/cmock/lib/cmock_plugin_manager.rb +50 -55
  559. data/vendor/cmock/lib/cmock_unityhelper_parser.rb +77 -75
  560. data/vendor/cmock/meson.build +53 -72
  561. data/vendor/cmock/scripts/create_makefile.rb +203 -202
  562. data/vendor/cmock/scripts/create_mock.rb +8 -8
  563. data/vendor/cmock/scripts/create_runner.rb +18 -20
  564. data/vendor/cmock/scripts/test_summary.rb +18 -19
  565. data/vendor/cmock/src/cmock.c +216 -216
  566. data/vendor/cmock/src/cmock.h +41 -40
  567. data/vendor/cmock/src/cmock_internals.h +91 -91
  568. data/vendor/cmock/src/meson.build +12 -17
  569. data/vendor/cmock/test/c/TestCMockC.c +333 -333
  570. data/vendor/cmock/test/c/TestCMockC.yml +14 -14
  571. data/vendor/cmock/test/c/TestCMockCDynamic.c +186 -186
  572. data/vendor/cmock/test/c/TestCMockCDynamic.yml +12 -12
  573. data/vendor/cmock/test/c/TestCMockCDynamic_Runner.c +36 -36
  574. data/vendor/cmock/test/c/TestCMockC_Runner.c +41 -41
  575. data/vendor/cmock/test/iar/iar_v4/Resource/at91SAM7X256_FLASH.xcl +185 -185
  576. data/vendor/cmock/test/iar/iar_v4/Resource/at91SAM7X256_RAM.xcl +185 -185
  577. data/vendor/cmock/test/iar/iar_v4/Resource/ioat91sam7x256.ddf +2259 -2259
  578. data/vendor/cmock/test/iar/iar_v4/cmock_demo.dep +3691 -3691
  579. data/vendor/cmock/test/iar/iar_v4/cmock_demo.ewp +2581 -2581
  580. data/vendor/cmock/test/iar/iar_v4/incIAR/AT91SAM7X-EK.h +61 -61
  581. data/vendor/cmock/test/iar/iar_v4/incIAR/AT91SAM7X256.inc +2314 -2314
  582. data/vendor/cmock/test/iar/iar_v4/incIAR/AT91SAM7X256.rdf +4704 -4704
  583. data/vendor/cmock/test/iar/iar_v4/incIAR/AT91SAM7X256.tcl +3407 -3407
  584. data/vendor/cmock/test/iar/iar_v4/incIAR/AT91SAM7X256_inc.h +2268 -2268
  585. data/vendor/cmock/test/iar/iar_v4/incIAR/ioat91sam7x256.h +4380 -4380
  586. data/vendor/cmock/test/iar/iar_v4/incIAR/lib_AT91SAM7X256.h +4211 -4211
  587. data/vendor/cmock/test/iar/iar_v4/settings/cmock_demo.cspy.bat +32 -32
  588. data/vendor/cmock/test/iar/iar_v4/srcIAR/Cstartup.s79 +265 -265
  589. data/vendor/cmock/test/iar/iar_v4/srcIAR/Cstartup_SAM7.c +98 -98
  590. data/vendor/cmock/test/iar/iar_v5/Resource/at91SAM7X256_FLASH.icf +43 -43
  591. data/vendor/cmock/test/iar/iar_v5/Resource/at91SAM7X256_RAM.icf +42 -42
  592. data/vendor/cmock/test/iar/iar_v5/cmock_demo.dep +4204 -4204
  593. data/vendor/cmock/test/iar/iar_v5/cmock_demo.ewp +2426 -2426
  594. data/vendor/cmock/test/iar/iar_v5/incIAR/AT91SAM7X-EK.h +61 -61
  595. data/vendor/cmock/test/iar/iar_v5/incIAR/AT91SAM7X256_inc.h +2268 -2268
  596. data/vendor/cmock/test/iar/iar_v5/incIAR/lib_AT91SAM7X256.h +4211 -4211
  597. data/vendor/cmock/test/iar/iar_v5/incIAR/project.h +30 -30
  598. data/vendor/cmock/test/iar/iar_v5/settings/BasicInterrupt_SAM7X.cspy.bat +33 -33
  599. data/vendor/cmock/test/iar/iar_v5/settings/BasicInterrupt_SAM7X_FLASH_Debug.jlink +12 -12
  600. data/vendor/cmock/test/iar/iar_v5/settings/cmock_demo.cspy.bat +33 -33
  601. data/vendor/cmock/test/iar/iar_v5/settings/cmock_demo_Binary.jlink +12 -12
  602. data/vendor/cmock/test/iar/iar_v5/settings/cmock_demo_FLASH_Debug.jlink +12 -12
  603. data/vendor/cmock/test/iar/iar_v5/settings/cmock_demo_RAM_Debug.jlink +12 -12
  604. data/vendor/cmock/test/iar/iar_v5/srcIAR/Cstartup.s +299 -299
  605. data/vendor/cmock/test/iar/iar_v5/srcIAR/Cstartup_SAM7.c +98 -98
  606. data/vendor/cmock/test/rakefile +147 -106
  607. data/vendor/cmock/test/rakefile_helper.rb +403 -382
  608. data/vendor/cmock/test/system/systest_generator.rb +205 -193
  609. data/vendor/cmock/test/system/test_compilation/callingconv.h +11 -11
  610. data/vendor/cmock/test/system/test_compilation/config.yml +10 -10
  611. data/vendor/cmock/test/system/test_compilation/const.h +37 -37
  612. data/vendor/cmock/test/system/test_compilation/inline.h +23 -23
  613. data/vendor/cmock/test/system/test_compilation/osek.h +275 -275
  614. data/vendor/cmock/test/system/test_compilation/parsing.h +89 -89
  615. data/vendor/cmock/test/system/test_interactions/all_plugins_but_other_limits.yml +375 -375
  616. data/vendor/cmock/test/system/test_interactions/all_plugins_coexist.yml +460 -460
  617. data/vendor/cmock/test/system/test_interactions/array_and_pointer_handling.yml +446 -446
  618. data/vendor/cmock/test/system/test_interactions/basic_expect_and_return.yml +124 -124
  619. data/vendor/cmock/test/system/test_interactions/const_primitives_handling.yml +87 -87
  620. data/vendor/cmock/test/system/test_interactions/doesnt_leave_details_behind.yml +308 -308
  621. data/vendor/cmock/test/system/test_interactions/enforce_strict_ordering.yml +247 -247
  622. data/vendor/cmock/test/system/test_interactions/expect_and_return_custom_types.yml +108 -108
  623. data/vendor/cmock/test/system/test_interactions/expect_and_return_treat_as.yml +173 -173
  624. data/vendor/cmock/test/system/test_interactions/expect_and_throw.yml +170 -170
  625. data/vendor/cmock/test/system/test_interactions/expect_any_args.yml +238 -238
  626. data/vendor/cmock/test/system/test_interactions/fancy_pointer_handling.yml +210 -210
  627. data/vendor/cmock/test/system/test_interactions/function_pointer_handling.yml +83 -82
  628. data/vendor/cmock/test/system/test_interactions/ignore_and_return.yml +329 -329
  629. data/vendor/cmock/test/system/test_interactions/ignore_strict_mock_calling.yml +37 -37
  630. data/vendor/cmock/test/system/test_interactions/newer_standards_stuff1.yml +52 -52
  631. data/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_1.yml +91 -91
  632. data/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_2.yml +59 -59
  633. data/vendor/cmock/test/system/test_interactions/out_of_memory.yml +65 -65
  634. data/vendor/cmock/test/system/test_interactions/parsing_challenges.yml +242 -242
  635. data/vendor/cmock/test/system/test_interactions/return_thru_ptr_and_expect_any_args.yml +235 -235
  636. data/vendor/cmock/test/system/test_interactions/return_thru_ptr_ignore_arg.yml +231 -231
  637. data/vendor/cmock/test/system/test_interactions/skeleton.yml +55 -0
  638. data/vendor/cmock/test/system/test_interactions/skeleton_update.yml +76 -0
  639. data/vendor/cmock/test/system/test_interactions/struct_union_enum_expect_and_return.yml +277 -277
  640. data/vendor/cmock/test/system/test_interactions/struct_union_enum_expect_and_return_with_plugins.yml +280 -280
  641. data/vendor/cmock/test/system/test_interactions/stubs_with_callbacks.yml +221 -221
  642. data/vendor/cmock/test/system/test_interactions/unity_64bit_support.yml +77 -77
  643. data/vendor/cmock/test/system/test_interactions/unity_ignores.yml +139 -139
  644. data/vendor/cmock/test/system/test_interactions/unity_void_pointer_compare.yml +91 -91
  645. data/vendor/cmock/test/targets/clang_strict.yml +90 -90
  646. data/vendor/cmock/test/targets/gcc.yml +58 -58
  647. data/vendor/cmock/test/targets/gcc_64.yml +58 -58
  648. data/vendor/cmock/test/targets/gcc_tiny.yml +80 -80
  649. data/vendor/cmock/test/targets/iar_arm_v4.yml +110 -110
  650. data/vendor/cmock/test/targets/iar_arm_v5.yml +95 -95
  651. data/vendor/cmock/test/test_helper.rb +44 -44
  652. data/vendor/cmock/test/unit/cmock_config_test.rb +126 -123
  653. data/vendor/cmock/test/unit/cmock_config_test.yml +7 -6
  654. data/vendor/cmock/test/unit/cmock_file_writer_test.rb +27 -27
  655. data/vendor/cmock/test/unit/cmock_generator_main_test.rb +686 -551
  656. data/vendor/cmock/test/unit/cmock_generator_plugin_array_test.rb +141 -141
  657. data/vendor/cmock/test/unit/cmock_generator_plugin_callback_test.rb +281 -281
  658. data/vendor/cmock/test/unit/cmock_generator_plugin_cexception_test.rb +96 -96
  659. data/vendor/cmock/test/unit/cmock_generator_plugin_expect_a_test.rb +185 -183
  660. data/vendor/cmock/test/unit/cmock_generator_plugin_expect_any_args_test.rb +67 -67
  661. data/vendor/cmock/test/unit/cmock_generator_plugin_expect_b_test.rb +201 -200
  662. data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_arg_test.rb +116 -116
  663. data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_test.rb +119 -105
  664. data/vendor/cmock/test/unit/cmock_generator_plugin_return_thru_ptr_test.rb +136 -136
  665. data/vendor/cmock/test/unit/cmock_generator_utils_test.rb +398 -415
  666. data/vendor/cmock/test/unit/cmock_header_parser_test.rb +2717 -2000
  667. data/vendor/cmock/test/unit/cmock_plugin_manager_test.rb +100 -100
  668. data/vendor/cmock/test/unit/cmock_unityhelper_parser_test.rb +223 -223
  669. data/vendor/cmock/vendor/behaviors/Manifest.txt +9 -9
  670. data/vendor/cmock/vendor/behaviors/Rakefile +19 -19
  671. data/vendor/cmock/vendor/behaviors/lib/behaviors.rb +76 -76
  672. data/vendor/cmock/vendor/behaviors/lib/behaviors/reporttask.rb +158 -158
  673. data/vendor/cmock/vendor/behaviors/test/behaviors_tasks_test.rb +73 -73
  674. data/vendor/cmock/vendor/behaviors/test/behaviors_test.rb +50 -50
  675. data/vendor/cmock/vendor/behaviors/test/tasks_test/Rakefile +19 -19
  676. data/vendor/cmock/vendor/behaviors/test/tasks_test/lib/user.rb +2 -2
  677. data/vendor/cmock/vendor/behaviors/test/tasks_test/test/user_test.rb +17 -17
  678. data/vendor/cmock/vendor/c_exception/Gemfile +4 -4
  679. data/vendor/cmock/vendor/c_exception/Gemfile.lock +12 -12
  680. data/vendor/cmock/vendor/c_exception/README.md +249 -162
  681. data/vendor/cmock/vendor/c_exception/docs/CException.md +332 -292
  682. data/vendor/cmock/vendor/c_exception/docs/ThrowTheSwitchCodingStandard.md +207 -207
  683. data/vendor/cmock/vendor/c_exception/lib/CException.c +46 -46
  684. data/vendor/cmock/vendor/c_exception/lib/CException.h +115 -115
  685. data/vendor/cmock/vendor/c_exception/lib/meson.build +11 -0
  686. data/vendor/cmock/vendor/c_exception/meson.build +48 -0
  687. data/vendor/cmock/vendor/c_exception/project.yml +37 -0
  688. data/vendor/cmock/vendor/c_exception/test/TestException.c +391 -391
  689. data/vendor/{c_exception/test → cmock/vendor/c_exception/test/support}/CExceptionConfig.h +46 -46
  690. data/vendor/cmock/vendor/c_exception/vendor/unity/README.md +220 -0
  691. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_prompt.rb +118 -0
  692. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_reporter.rb +39 -0
  693. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_config.yml +36 -0
  694. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_module.rb +308 -0
  695. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +437 -0
  696. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/parse_output.rb +220 -0
  697. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/stylize_as_junit.rb +252 -0
  698. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/test_file_filter.rb +25 -0
  699. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/type_sanitizer.rb +6 -0
  700. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_test_summary.py +139 -0
  701. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb +136 -0
  702. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_to_junit.py +146 -0
  703. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +207 -0
  704. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
  705. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityAssertionsReference.md +716 -0
  706. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityConfigurationGuide.md +398 -0
  707. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityGettingStartedGuide.md +191 -0
  708. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityHelperScriptsGuide.md +242 -0
  709. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/license.txt +21 -0
  710. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/makefile +71 -0
  711. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/readme.txt +5 -0
  712. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode.c +24 -0
  713. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode.h +3 -0
  714. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode2.c +11 -0
  715. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode2.h +2 -0
  716. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/TestProductionCode.c +62 -0
  717. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/TestProductionCode2.c +31 -0
  718. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +53 -0
  719. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +57 -0
  720. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/makefile +70 -0
  721. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/readme.txt +5 -0
  722. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode.c +24 -0
  723. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode.h +3 -0
  724. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode2.c +11 -0
  725. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode2.h +2 -0
  726. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/test/TestProductionCode.c +64 -0
  727. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/test/TestProductionCode2.c +33 -0
  728. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c +9 -0
  729. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c +11 -0
  730. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/test/test_runners/all_tests.c +12 -0
  731. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/helper/UnityHelper.c +10 -0
  732. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/helper/UnityHelper.h +12 -0
  733. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/rakefile.rb +43 -0
  734. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/rakefile_helper.rb +249 -0
  735. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/readme.txt +13 -0
  736. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode.c +24 -0
  737. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode.h +3 -0
  738. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode2.c +11 -0
  739. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode2.h +2 -0
  740. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/target_gcc_32.yml +46 -0
  741. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/test/TestProductionCode.c +62 -0
  742. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/test/TestProductionCode2.c +31 -0
  743. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/unity_config.h +237 -0
  744. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/eclipse/error_parsers.txt +26 -0
  745. data/vendor/cmock/vendor/{unity → c_exception/vendor/unity}/extras/fixture/rakefile.rb +48 -44
  746. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb +178 -0
  747. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/readme.txt +9 -0
  748. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +432 -0
  749. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h +83 -0
  750. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +51 -0
  751. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +47 -0
  752. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/Makefile +74 -0
  753. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c +22 -0
  754. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/template_fixture_tests.c +39 -0
  755. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +543 -0
  756. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +57 -0
  757. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c +57 -0
  758. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h +17 -0
  759. data/vendor/cmock/vendor/c_exception/vendor/unity/release/build.info +2 -0
  760. data/vendor/cmock/vendor/c_exception/vendor/unity/release/version.info +2 -0
  761. data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.c +1517 -0
  762. data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.h +339 -0
  763. data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity_internals.h +784 -0
  764. data/vendor/cmock/vendor/c_exception/vendor/unity/test/Makefile +63 -0
  765. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c +61 -0
  766. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c +57 -0
  767. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_head1.c +55 -0
  768. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_head1.h +15 -0
  769. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c +80 -0
  770. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c +76 -0
  771. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_head1.c +75 -0
  772. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_head1.h +13 -0
  773. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c +89 -0
  774. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c +89 -0
  775. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c +77 -0
  776. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c +89 -0
  777. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c +89 -0
  778. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c +90 -0
  779. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c +67 -0
  780. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c +70 -0
  781. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c +58 -0
  782. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c +67 -0
  783. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c +70 -0
  784. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c +71 -0
  785. data/vendor/cmock/vendor/c_exception/vendor/unity/test/rakefile +125 -0
  786. data/vendor/cmock/vendor/c_exception/vendor/unity/test/rakefile_helper.rb +260 -0
  787. data/vendor/cmock/vendor/c_exception/vendor/unity/test/spec/generate_module_existing_file_spec.rb +158 -0
  788. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/clang_file.yml +78 -0
  789. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/clang_strict.yml +78 -0
  790. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_32.yml +49 -0
  791. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_64.yml +50 -0
  792. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_auto_limits.yml +47 -0
  793. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_auto_stdint.yml +59 -0
  794. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_manual_math.yml +47 -0
  795. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/hitech_picc18.yml +101 -0
  796. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_arm_v4.yml +90 -0
  797. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_arm_v5.yml +80 -0
  798. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_arm_v5_3.yml +80 -0
  799. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +94 -0
  800. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_cortexm3_v5.yml +84 -0
  801. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_msp430.yml +95 -0
  802. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_sh2a_v6.yml +86 -0
  803. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/CException.h +11 -0
  804. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/Defs.h +8 -0
  805. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/cmock.h +14 -0
  806. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/mockMock.h +13 -0
  807. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testRunnerGenerator.c +183 -0
  808. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +67 -0
  809. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +192 -0
  810. data/vendor/cmock/vendor/c_exception/vendor/unity/test/tests/test_generate_test_runner.rb +1252 -0
  811. data/vendor/cmock/vendor/c_exception/vendor/unity/test/tests/testparameterized.c +110 -0
  812. data/vendor/cmock/vendor/{unity → c_exception/vendor/unity}/test/tests/testunity.c +4993 -8168
  813. data/vendor/cmock/vendor/unity/CMakeLists.txt +133 -31
  814. data/vendor/cmock/vendor/unity/LICENSE.txt +21 -21
  815. data/vendor/cmock/vendor/unity/README.md +191 -191
  816. data/vendor/cmock/vendor/unity/auto/colour_prompt.rb +119 -119
  817. data/vendor/cmock/vendor/unity/auto/colour_reporter.rb +39 -39
  818. data/vendor/cmock/vendor/unity/auto/generate_config.yml +36 -36
  819. data/vendor/cmock/vendor/unity/auto/generate_module.rb +312 -309
  820. data/vendor/cmock/vendor/unity/auto/generate_test_runner.rb +511 -495
  821. data/vendor/cmock/vendor/unity/auto/parse_output.rb +322 -322
  822. data/vendor/cmock/vendor/unity/auto/run_test.erb +37 -36
  823. data/vendor/cmock/vendor/unity/auto/stylize_as_junit.rb +251 -251
  824. data/vendor/cmock/vendor/unity/auto/test_file_filter.rb +25 -25
  825. data/vendor/cmock/vendor/unity/auto/type_sanitizer.rb +6 -6
  826. data/vendor/cmock/vendor/unity/auto/unity_test_summary.py +139 -139
  827. data/vendor/cmock/vendor/unity/auto/unity_test_summary.rb +135 -135
  828. data/vendor/cmock/vendor/unity/auto/unity_to_junit.py +146 -146
  829. data/vendor/cmock/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +206 -206
  830. data/vendor/cmock/vendor/unity/docs/UnityAssertionsReference.md +831 -850
  831. data/vendor/cmock/vendor/unity/docs/UnityConfigurationGuide.md +563 -541
  832. data/vendor/cmock/vendor/unity/docs/UnityGettingStartedGuide.md +251 -251
  833. data/vendor/cmock/vendor/unity/docs/UnityHelperScriptsGuide.md +278 -266
  834. data/vendor/cmock/vendor/unity/examples/example_1/makefile +72 -72
  835. data/vendor/cmock/vendor/unity/examples/example_1/readme.txt +4 -4
  836. data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode.c +24 -24
  837. data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode.h +3 -3
  838. data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode2.c +11 -11
  839. data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode2.h +2 -2
  840. data/vendor/cmock/vendor/unity/examples/example_1/test/TestProductionCode.c +62 -62
  841. data/vendor/cmock/vendor/unity/examples/example_1/test/TestProductionCode2.c +31 -31
  842. data/vendor/cmock/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +53 -53
  843. data/vendor/cmock/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +57 -57
  844. data/vendor/cmock/vendor/unity/examples/example_2/makefile +71 -71
  845. data/vendor/cmock/vendor/unity/examples/example_2/readme.txt +4 -4
  846. data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode.c +24 -24
  847. data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode.h +3 -3
  848. data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode2.c +11 -11
  849. data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode2.h +2 -2
  850. data/vendor/cmock/vendor/unity/examples/example_2/test/TestProductionCode.c +64 -64
  851. data/vendor/cmock/vendor/unity/examples/example_2/test/TestProductionCode2.c +33 -33
  852. data/vendor/cmock/vendor/unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c +8 -8
  853. data/vendor/cmock/vendor/unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c +10 -10
  854. data/vendor/cmock/vendor/unity/examples/example_2/test/test_runners/all_tests.c +12 -12
  855. data/vendor/cmock/vendor/unity/examples/example_3/helper/UnityHelper.c +10 -10
  856. data/vendor/cmock/vendor/unity/examples/example_3/helper/UnityHelper.h +12 -12
  857. data/vendor/cmock/vendor/unity/examples/example_3/rakefile.rb +38 -38
  858. data/vendor/cmock/vendor/unity/examples/example_3/rakefile_helper.rb +250 -250
  859. data/vendor/cmock/vendor/unity/examples/example_3/readme.txt +13 -13
  860. data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode.c +24 -24
  861. data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode.h +3 -3
  862. data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode2.c +11 -11
  863. data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode2.h +2 -2
  864. data/vendor/cmock/vendor/unity/examples/example_3/target_gcc_32.yml +47 -47
  865. data/vendor/cmock/vendor/unity/examples/example_3/test/TestProductionCode.c +62 -62
  866. data/vendor/cmock/vendor/unity/examples/example_3/test/TestProductionCode2.c +31 -31
  867. data/vendor/cmock/vendor/unity/examples/example_4/meson.build +12 -17
  868. data/vendor/cmock/vendor/unity/examples/example_4/readme.txt +14 -14
  869. data/vendor/cmock/vendor/unity/examples/example_4/src/ProductionCode.c +24 -24
  870. data/vendor/cmock/vendor/unity/examples/example_4/src/ProductionCode.h +3 -3
  871. data/vendor/cmock/vendor/unity/examples/example_4/src/ProductionCode2.c +11 -11
  872. data/vendor/cmock/vendor/unity/examples/example_4/src/ProductionCode2.h +2 -2
  873. data/vendor/cmock/vendor/unity/examples/example_4/src/meson.build +16 -21
  874. data/vendor/cmock/vendor/unity/examples/example_4/subprojects/unity.wrap +4 -4
  875. data/vendor/cmock/vendor/unity/examples/example_4/test/TestProductionCode.c +63 -63
  876. data/vendor/cmock/vendor/unity/examples/example_4/test/TestProductionCode2.c +35 -35
  877. data/vendor/cmock/vendor/unity/examples/example_4/test/meson.build +7 -12
  878. data/vendor/cmock/vendor/unity/examples/example_4/test/test_runners/TestProductionCode2_Runner.c +53 -53
  879. data/vendor/cmock/vendor/unity/examples/example_4/test/test_runners/TestProductionCode_Runner.c +57 -57
  880. data/vendor/cmock/vendor/unity/examples/example_4/test/test_runners/meson.build +13 -16
  881. data/vendor/cmock/vendor/unity/examples/unity_config.h +244 -263
  882. data/vendor/cmock/vendor/unity/extras/eclipse/error_parsers.txt +26 -26
  883. data/vendor/cmock/vendor/unity/extras/fixture/readme.md +29 -17
  884. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c +310 -275
  885. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h +83 -83
  886. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h +50 -50
  887. data/vendor/cmock/vendor/unity/extras/fixture/test/Makefile +72 -72
  888. data/vendor/cmock/vendor/unity/extras/fixture/test/main/AllTests.c +20 -20
  889. data/vendor/cmock/vendor/unity/extras/fixture/test/template_fixture_tests.c +39 -39
  890. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c +245 -245
  891. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +32 -32
  892. data/vendor/cmock/vendor/unity/extras/memory/readme.md +49 -49
  893. data/vendor/cmock/vendor/unity/extras/memory/src/unity_memory.c +202 -202
  894. data/vendor/cmock/vendor/unity/extras/memory/src/unity_memory.h +60 -60
  895. data/vendor/cmock/vendor/unity/extras/memory/test/Makefile +78 -78
  896. data/vendor/cmock/vendor/unity/extras/memory/test/unity_memory_Test.c +325 -325
  897. data/vendor/cmock/vendor/unity/extras/memory/test/unity_memory_TestRunner.c +49 -49
  898. data/vendor/cmock/vendor/unity/extras/memory/test/unity_output_Spy.c +56 -56
  899. data/vendor/cmock/vendor/unity/extras/memory/test/unity_output_Spy.h +16 -16
  900. data/vendor/cmock/vendor/unity/meson.build +48 -69
  901. data/vendor/cmock/vendor/unity/src/meson.build +11 -16
  902. data/vendor/cmock/vendor/unity/src/unity.c +2109 -2085
  903. data/vendor/cmock/vendor/unity/src/unity.h +661 -617
  904. data/vendor/cmock/vendor/unity/src/unity_internals.h +1030 -1002
  905. data/vendor/cmock/vendor/unity/test/Makefile +159 -67
  906. data/vendor/cmock/vendor/unity/test/expectdata/testsample_cmd.c +61 -61
  907. data/vendor/cmock/vendor/unity/test/expectdata/testsample_def.c +57 -57
  908. data/vendor/cmock/vendor/unity/test/expectdata/testsample_head1.c +55 -55
  909. data/vendor/cmock/vendor/unity/test/expectdata/testsample_head1.h +15 -15
  910. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_cmd.c +80 -80
  911. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_def.c +76 -76
  912. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_head1.c +75 -75
  913. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_head1.h +13 -13
  914. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new1.c +89 -89
  915. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new2.c +89 -89
  916. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_param.c +77 -77
  917. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run1.c +89 -89
  918. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run2.c +89 -89
  919. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_yaml.c +90 -90
  920. data/vendor/cmock/vendor/unity/test/expectdata/testsample_new1.c +67 -67
  921. data/vendor/cmock/vendor/unity/test/expectdata/testsample_new2.c +70 -70
  922. data/vendor/cmock/vendor/unity/test/expectdata/testsample_param.c +58 -58
  923. data/vendor/cmock/vendor/unity/test/expectdata/testsample_run1.c +67 -67
  924. data/vendor/cmock/vendor/unity/test/expectdata/testsample_run2.c +70 -70
  925. data/vendor/cmock/vendor/unity/test/expectdata/testsample_yaml.c +71 -71
  926. data/vendor/cmock/vendor/unity/test/rakefile +163 -124
  927. data/vendor/cmock/vendor/unity/test/rakefile_helper.rb +315 -269
  928. data/vendor/cmock/vendor/unity/test/spec/generate_module_existing_file_spec.rb +158 -158
  929. data/vendor/cmock/vendor/unity/test/targets/ansi.yml +44 -49
  930. data/vendor/cmock/vendor/unity/test/targets/clang_file.yml +72 -78
  931. data/vendor/cmock/vendor/unity/test/targets/clang_strict.yml +71 -78
  932. data/vendor/cmock/vendor/unity/test/targets/gcc_32.yml +45 -49
  933. data/vendor/cmock/vendor/unity/test/targets/gcc_64.yml +46 -50
  934. data/vendor/cmock/vendor/unity/test/targets/gcc_auto_limits.yml +43 -47
  935. data/vendor/cmock/vendor/unity/test/targets/gcc_auto_stdint.yml +55 -59
  936. data/vendor/cmock/vendor/unity/test/targets/gcc_manual_math.yml +43 -47
  937. data/vendor/cmock/vendor/unity/test/targets/hitech_picc18.yml +91 -101
  938. data/vendor/cmock/vendor/unity/test/targets/iar_arm_v4.yml +98 -90
  939. data/vendor/cmock/vendor/unity/test/targets/iar_arm_v5.yml +92 -80
  940. data/vendor/cmock/vendor/unity/test/targets/iar_arm_v5_3.yml +92 -80
  941. data/vendor/cmock/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +90 -94
  942. data/vendor/cmock/vendor/unity/test/targets/iar_cortexm3_v5.yml +94 -84
  943. data/vendor/cmock/vendor/unity/test/targets/iar_msp430.yml +112 -95
  944. data/vendor/cmock/vendor/unity/test/targets/iar_sh2a_v6.yml +99 -86
  945. data/vendor/cmock/vendor/unity/test/testdata/CException.h +11 -11
  946. data/vendor/cmock/vendor/unity/test/testdata/Defs.h +8 -8
  947. data/vendor/cmock/vendor/unity/test/testdata/cmock.h +14 -14
  948. data/vendor/cmock/vendor/unity/test/testdata/mockMock.h +13 -13
  949. data/vendor/cmock/vendor/unity/test/testdata/testRunnerGenerator.c +189 -189
  950. data/vendor/cmock/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +70 -70
  951. data/vendor/cmock/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +197 -197
  952. data/vendor/cmock/vendor/unity/test/tests/self_assessment_utils.h +144 -0
  953. data/vendor/cmock/vendor/unity/test/tests/test_generate_test_runner.rb +1260 -1268
  954. data/vendor/cmock/vendor/unity/test/tests/test_unity_arrays.c +2874 -0
  955. data/vendor/cmock/vendor/unity/test/tests/test_unity_core.c +371 -0
  956. data/vendor/cmock/vendor/unity/test/tests/test_unity_doubles.c +773 -0
  957. data/vendor/cmock/vendor/unity/test/tests/test_unity_floats.c +884 -0
  958. data/vendor/cmock/vendor/unity/test/tests/test_unity_integers.c +2847 -0
  959. data/vendor/cmock/vendor/unity/test/tests/test_unity_integers_64.c +773 -0
  960. data/vendor/cmock/vendor/unity/test/tests/test_unity_memory.c +81 -0
  961. data/vendor/{unity/test/tests/testparameterized.c → cmock/vendor/unity/test/tests/test_unity_parameterized.c} +171 -171
  962. data/vendor/cmock/vendor/unity/test/tests/test_unity_strings.c +329 -0
  963. data/vendor/cmock/vendor/unity/unityConfig.cmake +1 -0
  964. data/vendor/deep_merge/MIT-LICENSE +20 -20
  965. data/vendor/deep_merge/README +94 -94
  966. data/vendor/deep_merge/Rakefile +28 -28
  967. data/vendor/deep_merge/lib/deep_merge.rb +211 -211
  968. data/vendor/deep_merge/test/test_deep_merge.rb +553 -553
  969. data/vendor/diy/History.txt +28 -28
  970. data/vendor/diy/README.rdoc +233 -233
  971. data/vendor/diy/Rakefile +33 -33
  972. data/vendor/diy/TODO.txt +9 -9
  973. data/vendor/diy/diy.gemspec +131 -131
  974. data/vendor/diy/lib/diy.rb +403 -403
  975. data/vendor/diy/lib/diy/factory.rb +36 -36
  976. data/vendor/diy/sample_code/car.rb +7 -7
  977. data/vendor/diy/sample_code/chassis.rb +5 -5
  978. data/vendor/diy/sample_code/diy_example.rb +26 -26
  979. data/vendor/diy/sample_code/engine.rb +5 -5
  980. data/vendor/diy/sample_code/objects.yml +10 -10
  981. data/vendor/diy/test/constructor.rb +119 -119
  982. data/vendor/diy/test/diy_test.rb +608 -608
  983. data/vendor/diy/test/factory_test.rb +79 -79
  984. data/vendor/diy/test/files/broken_construction.yml +7 -7
  985. data/vendor/diy/test/files/cat/cat.rb +3 -3
  986. data/vendor/diy/test/files/cat/extra_conflict.yml +5 -5
  987. data/vendor/diy/test/files/cat/heritage.rb +2 -2
  988. data/vendor/diy/test/files/cat/needs_input.yml +3 -3
  989. data/vendor/diy/test/files/cat/the_cat_lineage.rb +1 -1
  990. data/vendor/diy/test/files/dog/dog_model.rb +3 -3
  991. data/vendor/diy/test/files/dog/dog_presenter.rb +3 -3
  992. data/vendor/diy/test/files/dog/dog_view.rb +2 -2
  993. data/vendor/diy/test/files/dog/file_resolver.rb +2 -2
  994. data/vendor/diy/test/files/dog/other_thing.rb +2 -2
  995. data/vendor/diy/test/files/dog/simple.yml +11 -11
  996. data/vendor/diy/test/files/donkey/foo.rb +8 -8
  997. data/vendor/diy/test/files/donkey/foo/bar/qux.rb +7 -7
  998. data/vendor/diy/test/files/factory/beef.rb +5 -5
  999. data/vendor/diy/test/files/factory/dog.rb +6 -6
  1000. data/vendor/diy/test/files/factory/factory.yml +19 -19
  1001. data/vendor/diy/test/files/factory/farm/llama.rb +7 -7
  1002. data/vendor/diy/test/files/factory/farm/pork.rb +7 -7
  1003. data/vendor/diy/test/files/factory/kitten.rb +13 -13
  1004. data/vendor/diy/test/files/fud/objects.yml +13 -13
  1005. data/vendor/diy/test/files/fud/toy.rb +14 -14
  1006. data/vendor/diy/test/files/functions/attached_things_builder.rb +1 -1
  1007. data/vendor/diy/test/files/functions/invalid_method.yml +4 -4
  1008. data/vendor/diy/test/files/functions/method_extractor.rb +2 -2
  1009. data/vendor/diy/test/files/functions/nonsingleton_objects.yml +5 -5
  1010. data/vendor/diy/test/files/functions/objects.yml +21 -21
  1011. data/vendor/diy/test/files/functions/thing.rb +2 -2
  1012. data/vendor/diy/test/files/functions/thing_builder.rb +24 -24
  1013. data/vendor/diy/test/files/functions/things_builder.rb +2 -2
  1014. data/vendor/diy/test/files/gnu/objects.yml +14 -14
  1015. data/vendor/diy/test/files/gnu/thinger.rb +7 -7
  1016. data/vendor/diy/test/files/goat/base.rb +8 -8
  1017. data/vendor/diy/test/files/goat/can.rb +6 -6
  1018. data/vendor/diy/test/files/goat/goat.rb +6 -6
  1019. data/vendor/diy/test/files/goat/objects.yml +12 -12
  1020. data/vendor/diy/test/files/goat/paper.rb +6 -6
  1021. data/vendor/diy/test/files/goat/plane.rb +7 -7
  1022. data/vendor/diy/test/files/goat/shirt.rb +6 -6
  1023. data/vendor/diy/test/files/goat/wings.rb +8 -8
  1024. data/vendor/diy/test/files/horse/holder_thing.rb +3 -3
  1025. data/vendor/diy/test/files/horse/objects.yml +7 -7
  1026. data/vendor/diy/test/files/namespace/animal/bird.rb +5 -5
  1027. data/vendor/diy/test/files/namespace/animal/cat.rb +5 -5
  1028. data/vendor/diy/test/files/namespace/animal/reptile/hardshell/turtle.rb +8 -8
  1029. data/vendor/diy/test/files/namespace/animal/reptile/lizard.rb +7 -7
  1030. data/vendor/diy/test/files/namespace/bad_module_specified.yml +8 -8
  1031. data/vendor/diy/test/files/namespace/class_name_combine.yml +8 -8
  1032. data/vendor/diy/test/files/namespace/no_module_specified.yml +8 -8
  1033. data/vendor/diy/test/files/namespace/objects.yml +21 -21
  1034. data/vendor/diy/test/files/namespace/road.rb +2 -2
  1035. data/vendor/diy/test/files/namespace/sky.rb +2 -2
  1036. data/vendor/diy/test/files/namespace/subcontext.yml +22 -22
  1037. data/vendor/diy/test/files/non_singleton/air.rb +2 -2
  1038. data/vendor/diy/test/files/non_singleton/fat_cat.rb +3 -3
  1039. data/vendor/diy/test/files/non_singleton/objects.yml +19 -19
  1040. data/vendor/diy/test/files/non_singleton/pig.rb +3 -3
  1041. data/vendor/diy/test/files/non_singleton/thread_spinner.rb +3 -3
  1042. data/vendor/diy/test/files/non_singleton/tick.rb +3 -3
  1043. data/vendor/diy/test/files/non_singleton/yard.rb +2 -2
  1044. data/vendor/diy/test/files/yak/core_model.rb +3 -3
  1045. data/vendor/diy/test/files/yak/core_presenter.rb +3 -3
  1046. data/vendor/diy/test/files/yak/core_view.rb +1 -1
  1047. data/vendor/diy/test/files/yak/data_source.rb +1 -1
  1048. data/vendor/diy/test/files/yak/fringe_model.rb +3 -3
  1049. data/vendor/diy/test/files/yak/fringe_presenter.rb +3 -3
  1050. data/vendor/diy/test/files/yak/fringe_view.rb +1 -1
  1051. data/vendor/diy/test/files/yak/giant_squid.rb +3 -3
  1052. data/vendor/diy/test/files/yak/krill.rb +2 -2
  1053. data/vendor/diy/test/files/yak/my_objects.yml +21 -21
  1054. data/vendor/diy/test/files/yak/sub_sub_context_test.yml +27 -27
  1055. data/vendor/diy/test/test_helper.rb +55 -55
  1056. data/vendor/hardmock/CHANGES +78 -78
  1057. data/vendor/hardmock/LICENSE +7 -7
  1058. data/vendor/hardmock/README +70 -70
  1059. data/vendor/hardmock/Rakefile +8 -8
  1060. data/vendor/hardmock/config/environment.rb +12 -12
  1061. data/vendor/hardmock/lib/assert_error.rb +23 -23
  1062. data/vendor/hardmock/lib/extend_test_unit.rb +14 -14
  1063. data/vendor/hardmock/lib/hardmock.rb +86 -86
  1064. data/vendor/hardmock/lib/hardmock/errors.rb +22 -22
  1065. data/vendor/hardmock/lib/hardmock/expectation.rb +229 -229
  1066. data/vendor/hardmock/lib/hardmock/expectation_builder.rb +9 -9
  1067. data/vendor/hardmock/lib/hardmock/expector.rb +26 -26
  1068. data/vendor/hardmock/lib/hardmock/method_cleanout.rb +33 -33
  1069. data/vendor/hardmock/lib/hardmock/mock.rb +180 -180
  1070. data/vendor/hardmock/lib/hardmock/mock_control.rb +53 -53
  1071. data/vendor/hardmock/lib/hardmock/stubbing.rb +210 -210
  1072. data/vendor/hardmock/lib/hardmock/trapper.rb +31 -31
  1073. data/vendor/hardmock/lib/hardmock/utils.rb +9 -9
  1074. data/vendor/hardmock/lib/test_unit_before_after.rb +169 -169
  1075. data/vendor/hardmock/rake_tasks/rdoc.rake +19 -19
  1076. data/vendor/hardmock/rake_tasks/rdoc_options.rb +4 -4
  1077. data/vendor/hardmock/rake_tasks/test.rake +22 -22
  1078. data/vendor/hardmock/test/functional/assert_error_test.rb +52 -52
  1079. data/vendor/hardmock/test/functional/auto_verify_test.rb +178 -178
  1080. data/vendor/hardmock/test/functional/direct_mock_usage_test.rb +396 -396
  1081. data/vendor/hardmock/test/functional/hardmock_test.rb +434 -434
  1082. data/vendor/hardmock/test/functional/stubbing_test.rb +479 -479
  1083. data/vendor/hardmock/test/test_helper.rb +43 -43
  1084. data/vendor/hardmock/test/unit/expectation_builder_test.rb +19 -19
  1085. data/vendor/hardmock/test/unit/expectation_test.rb +372 -372
  1086. data/vendor/hardmock/test/unit/expector_test.rb +57 -57
  1087. data/vendor/hardmock/test/unit/method_cleanout_test.rb +36 -36
  1088. data/vendor/hardmock/test/unit/mock_control_test.rb +175 -175
  1089. data/vendor/hardmock/test/unit/mock_test.rb +279 -279
  1090. data/vendor/hardmock/test/unit/test_unit_before_after_test.rb +452 -452
  1091. data/vendor/hardmock/test/unit/trapper_test.rb +62 -62
  1092. data/vendor/hardmock/test/unit/verify_error_test.rb +40 -40
  1093. data/vendor/unity/CMakeLists.txt +133 -31
  1094. data/vendor/unity/LICENSE.txt +21 -21
  1095. data/vendor/unity/README.md +191 -191
  1096. data/vendor/unity/auto/colour_prompt.rb +119 -119
  1097. data/vendor/unity/auto/colour_reporter.rb +39 -39
  1098. data/vendor/unity/auto/generate_config.yml +36 -36
  1099. data/vendor/unity/auto/generate_module.rb +312 -309
  1100. data/vendor/unity/auto/generate_test_runner.rb +511 -495
  1101. data/vendor/unity/auto/parse_output.rb +322 -322
  1102. data/vendor/unity/auto/run_test.erb +37 -36
  1103. data/vendor/unity/auto/stylize_as_junit.rb +251 -251
  1104. data/vendor/unity/auto/test_file_filter.rb +25 -25
  1105. data/vendor/unity/auto/type_sanitizer.rb +6 -6
  1106. data/vendor/unity/auto/unity_test_summary.py +139 -139
  1107. data/vendor/unity/auto/unity_test_summary.rb +135 -135
  1108. data/vendor/unity/auto/unity_to_junit.py +146 -146
  1109. data/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +206 -206
  1110. data/vendor/unity/docs/UnityAssertionsReference.md +831 -850
  1111. data/vendor/unity/docs/UnityConfigurationGuide.md +563 -541
  1112. data/vendor/unity/docs/UnityGettingStartedGuide.md +251 -251
  1113. data/vendor/unity/docs/UnityHelperScriptsGuide.md +278 -266
  1114. data/vendor/unity/examples/example_1/makefile +72 -72
  1115. data/vendor/unity/examples/example_1/readme.txt +4 -4
  1116. data/vendor/unity/examples/example_1/src/ProductionCode.c +24 -24
  1117. data/vendor/unity/examples/example_1/src/ProductionCode.h +3 -3
  1118. data/vendor/unity/examples/example_1/src/ProductionCode2.c +11 -11
  1119. data/vendor/unity/examples/example_1/src/ProductionCode2.h +2 -2
  1120. data/vendor/unity/examples/example_1/test/TestProductionCode.c +62 -62
  1121. data/vendor/unity/examples/example_1/test/TestProductionCode2.c +31 -31
  1122. data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +53 -53
  1123. data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +57 -57
  1124. data/vendor/unity/examples/example_2/makefile +71 -71
  1125. data/vendor/unity/examples/example_2/readme.txt +4 -4
  1126. data/vendor/unity/examples/example_2/src/ProductionCode.c +24 -24
  1127. data/vendor/unity/examples/example_2/src/ProductionCode.h +3 -3
  1128. data/vendor/unity/examples/example_2/src/ProductionCode2.c +11 -11
  1129. data/vendor/unity/examples/example_2/src/ProductionCode2.h +2 -2
  1130. data/vendor/unity/examples/example_2/test/TestProductionCode.c +64 -64
  1131. data/vendor/unity/examples/example_2/test/TestProductionCode2.c +33 -33
  1132. data/vendor/unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c +8 -8
  1133. data/vendor/unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c +10 -10
  1134. data/vendor/unity/examples/example_2/test/test_runners/all_tests.c +12 -12
  1135. data/vendor/unity/examples/example_3/helper/UnityHelper.c +10 -10
  1136. data/vendor/unity/examples/example_3/helper/UnityHelper.h +12 -12
  1137. data/vendor/unity/examples/example_3/rakefile.rb +38 -38
  1138. data/vendor/unity/examples/example_3/rakefile_helper.rb +250 -250
  1139. data/vendor/unity/examples/example_3/readme.txt +13 -13
  1140. data/vendor/unity/examples/example_3/src/ProductionCode.c +24 -24
  1141. data/vendor/unity/examples/example_3/src/ProductionCode.h +3 -3
  1142. data/vendor/unity/examples/example_3/src/ProductionCode2.c +11 -11
  1143. data/vendor/unity/examples/example_3/src/ProductionCode2.h +2 -2
  1144. data/vendor/unity/examples/example_3/target_gcc_32.yml +47 -47
  1145. data/vendor/unity/examples/example_3/test/TestProductionCode.c +62 -62
  1146. data/vendor/unity/examples/example_3/test/TestProductionCode2.c +31 -31
  1147. data/vendor/unity/examples/example_4/meson.build +12 -17
  1148. data/vendor/unity/examples/example_4/readme.txt +14 -14
  1149. data/vendor/unity/examples/example_4/src/ProductionCode.c +24 -24
  1150. data/vendor/unity/examples/example_4/src/ProductionCode.h +3 -3
  1151. data/vendor/unity/examples/example_4/src/ProductionCode2.c +11 -11
  1152. data/vendor/unity/examples/example_4/src/ProductionCode2.h +2 -2
  1153. data/vendor/unity/examples/example_4/src/meson.build +16 -21
  1154. data/vendor/unity/examples/example_4/subprojects/unity.wrap +4 -4
  1155. data/vendor/unity/examples/example_4/test/TestProductionCode.c +63 -63
  1156. data/vendor/unity/examples/example_4/test/TestProductionCode2.c +35 -35
  1157. data/vendor/unity/examples/example_4/test/meson.build +7 -12
  1158. data/vendor/unity/examples/example_4/test/test_runners/TestProductionCode2_Runner.c +53 -53
  1159. data/vendor/unity/examples/example_4/test/test_runners/TestProductionCode_Runner.c +57 -57
  1160. data/vendor/unity/examples/example_4/test/test_runners/meson.build +13 -16
  1161. data/vendor/unity/examples/unity_config.h +244 -263
  1162. data/vendor/unity/extras/eclipse/error_parsers.txt +26 -26
  1163. data/vendor/unity/extras/fixture/readme.md +29 -17
  1164. data/vendor/unity/extras/fixture/src/unity_fixture.c +310 -275
  1165. data/vendor/unity/extras/fixture/src/unity_fixture.h +83 -83
  1166. data/vendor/unity/extras/fixture/src/unity_fixture_internals.h +50 -50
  1167. data/vendor/unity/extras/fixture/test/Makefile +72 -72
  1168. data/vendor/unity/extras/fixture/test/main/AllTests.c +20 -20
  1169. data/vendor/unity/extras/fixture/test/template_fixture_tests.c +39 -39
  1170. data/vendor/unity/extras/fixture/test/unity_fixture_Test.c +245 -245
  1171. data/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +32 -32
  1172. data/vendor/unity/extras/memory/readme.md +49 -49
  1173. data/vendor/unity/extras/memory/src/unity_memory.c +202 -202
  1174. data/vendor/unity/extras/memory/src/unity_memory.h +60 -60
  1175. data/vendor/unity/extras/memory/test/Makefile +78 -78
  1176. data/vendor/unity/extras/memory/test/unity_memory_Test.c +325 -325
  1177. data/vendor/unity/extras/memory/test/unity_memory_TestRunner.c +49 -49
  1178. data/vendor/unity/extras/memory/test/unity_output_Spy.c +56 -56
  1179. data/vendor/unity/extras/memory/test/unity_output_Spy.h +16 -16
  1180. data/vendor/unity/meson.build +48 -69
  1181. data/vendor/unity/src/meson.build +11 -16
  1182. data/vendor/unity/src/unity.c +2109 -2085
  1183. data/vendor/unity/src/unity.h +661 -617
  1184. data/vendor/unity/src/unity_internals.h +1030 -1002
  1185. data/vendor/unity/test/Makefile +159 -67
  1186. data/vendor/unity/test/expectdata/testsample_cmd.c +61 -61
  1187. data/vendor/unity/test/expectdata/testsample_def.c +57 -57
  1188. data/vendor/unity/test/expectdata/testsample_head1.c +55 -55
  1189. data/vendor/unity/test/expectdata/testsample_head1.h +15 -15
  1190. data/vendor/unity/test/expectdata/testsample_mock_cmd.c +80 -80
  1191. data/vendor/unity/test/expectdata/testsample_mock_def.c +76 -76
  1192. data/vendor/unity/test/expectdata/testsample_mock_head1.c +75 -75
  1193. data/vendor/unity/test/expectdata/testsample_mock_head1.h +13 -13
  1194. data/vendor/unity/test/expectdata/testsample_mock_new1.c +89 -89
  1195. data/vendor/unity/test/expectdata/testsample_mock_new2.c +89 -89
  1196. data/vendor/unity/test/expectdata/testsample_mock_param.c +77 -77
  1197. data/vendor/unity/test/expectdata/testsample_mock_run1.c +89 -89
  1198. data/vendor/unity/test/expectdata/testsample_mock_run2.c +89 -89
  1199. data/vendor/unity/test/expectdata/testsample_mock_yaml.c +90 -90
  1200. data/vendor/unity/test/expectdata/testsample_new1.c +67 -67
  1201. data/vendor/unity/test/expectdata/testsample_new2.c +70 -70
  1202. data/vendor/unity/test/expectdata/testsample_param.c +58 -58
  1203. data/vendor/unity/test/expectdata/testsample_run1.c +67 -67
  1204. data/vendor/unity/test/expectdata/testsample_run2.c +70 -70
  1205. data/vendor/unity/test/expectdata/testsample_yaml.c +71 -71
  1206. data/vendor/unity/test/rakefile +163 -124
  1207. data/vendor/unity/test/rakefile_helper.rb +315 -269
  1208. data/vendor/unity/test/spec/generate_module_existing_file_spec.rb +158 -158
  1209. data/vendor/unity/test/targets/ansi.yml +44 -49
  1210. data/vendor/unity/test/targets/clang_file.yml +72 -78
  1211. data/vendor/unity/test/targets/clang_strict.yml +71 -78
  1212. data/vendor/unity/test/targets/gcc_32.yml +45 -49
  1213. data/vendor/unity/test/targets/gcc_64.yml +46 -50
  1214. data/vendor/unity/test/targets/gcc_auto_limits.yml +43 -47
  1215. data/vendor/unity/test/targets/gcc_auto_stdint.yml +55 -59
  1216. data/vendor/unity/test/targets/gcc_manual_math.yml +43 -47
  1217. data/vendor/unity/test/targets/hitech_picc18.yml +91 -101
  1218. data/vendor/unity/test/targets/iar_arm_v4.yml +98 -90
  1219. data/vendor/unity/test/targets/iar_arm_v5.yml +92 -80
  1220. data/vendor/unity/test/targets/iar_arm_v5_3.yml +92 -80
  1221. data/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +90 -94
  1222. data/vendor/unity/test/targets/iar_cortexm3_v5.yml +94 -84
  1223. data/vendor/unity/test/targets/iar_msp430.yml +112 -95
  1224. data/vendor/unity/test/targets/iar_sh2a_v6.yml +99 -86
  1225. data/vendor/unity/test/testdata/CException.h +11 -11
  1226. data/vendor/unity/test/testdata/Defs.h +8 -8
  1227. data/vendor/unity/test/testdata/cmock.h +14 -14
  1228. data/vendor/unity/test/testdata/mockMock.h +13 -13
  1229. data/vendor/unity/test/testdata/testRunnerGenerator.c +189 -189
  1230. data/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +70 -70
  1231. data/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +197 -197
  1232. data/vendor/unity/test/tests/self_assessment_utils.h +144 -0
  1233. data/vendor/unity/test/tests/test_generate_test_runner.rb +1260 -1268
  1234. data/vendor/unity/test/tests/test_unity_arrays.c +2874 -0
  1235. data/vendor/unity/test/tests/test_unity_core.c +371 -0
  1236. data/vendor/unity/test/tests/test_unity_doubles.c +773 -0
  1237. data/vendor/unity/test/tests/test_unity_floats.c +884 -0
  1238. data/vendor/unity/test/tests/test_unity_integers.c +2847 -0
  1239. data/vendor/unity/test/tests/test_unity_integers_64.c +773 -0
  1240. data/vendor/unity/test/tests/test_unity_memory.c +81 -0
  1241. data/vendor/{cmock/vendor/unity/test/tests/testparameterized.c → unity/test/tests/test_unity_parameterized.c} +171 -171
  1242. data/vendor/unity/test/tests/test_unity_strings.c +329 -0
  1243. data/vendor/unity/unityConfig.cmake +1 -0
  1244. metadata +225 -62
  1245. data/ceedling.sublime-project +0 -28
  1246. data/ceedling.sublime-workspace +0 -1276
  1247. data/docs/CeedlingPacket.odt +0 -0
  1248. data/docs/CeedlingPacket.pdf +0 -0
  1249. data/plugins/bullseye/readme.txt +0 -0
  1250. data/vendor/c_exception/LICENSE.txt +0 -30
  1251. data/vendor/c_exception/Rakefile +0 -42
  1252. data/vendor/c_exception/makefile +0 -24
  1253. data/vendor/c_exception/test/TestException_Runner.c +0 -67
  1254. data/vendor/cmock/vendor/c_exception/LICENSE.txt +0 -30
  1255. data/vendor/cmock/vendor/c_exception/Rakefile +0 -42
  1256. data/vendor/cmock/vendor/c_exception/makefile +0 -24
  1257. data/vendor/cmock/vendor/c_exception/test/TestException_Runner.c +0 -67
  1258. data/vendor/cmock/vendor/unity/extras/fixture/rakefile_helper.rb +0 -183
  1259. data/vendor/cmock/vendor/unity/extras/memory/rakefile.rb +0 -45
  1260. data/vendor/cmock/vendor/unity/extras/memory/rakefile_helper.rb +0 -187
  1261. data/vendor/cmock/vendor/unity/src/CMakeLists.txt +0 -22
  1262. data/vendor/unity/extras/fixture/rakefile.rb +0 -44
  1263. data/vendor/unity/extras/fixture/rakefile_helper.rb +0 -183
  1264. data/vendor/unity/extras/memory/rakefile.rb +0 -45
  1265. data/vendor/unity/extras/memory/rakefile_helper.rb +0 -187
  1266. data/vendor/unity/src/CMakeLists.txt +0 -22
  1267. data/vendor/unity/test/tests/testunity.c +0 -8168
@@ -1,49 +1,49 @@
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 "unity_memory.h"
9
-
10
- extern void test_ForceMallocFail(void);
11
- extern void test_ReallocSmallerIsUnchanged(void);
12
- extern void test_ReallocSameIsUnchanged(void);
13
- extern void test_ReallocLargerNeeded(void);
14
- extern void test_ReallocNullPointerIsLikeMalloc(void);
15
- extern void test_ReallocSizeZeroFreesMemAndReturnsNullPointer(void);
16
- extern void test_CallocFillsWithZero(void);
17
- extern void test_FreeNULLSafety(void);
18
- extern void test_DetectsLeak(void);
19
- extern void test_BufferOverrunFoundDuringFree(void);
20
- extern void test_BufferOverrunFoundDuringRealloc(void);
21
- extern void test_BufferGuardWriteFoundDuringFree(void);
22
- extern void test_BufferGuardWriteFoundDuringRealloc(void);
23
- extern void test_MallocPastBufferFails(void);
24
- extern void test_CallocPastBufferFails(void);
25
- extern void test_MallocThenReallocGrowsMemoryInPlace(void);
26
- extern void test_ReallocFailDoesNotFreeMem(void);
27
-
28
- int main(void)
29
- {
30
- UnityBegin("unity_memory_Test.c");
31
- RUN_TEST(test_ForceMallocFail);
32
- RUN_TEST(test_ReallocSmallerIsUnchanged);
33
- RUN_TEST(test_ReallocSameIsUnchanged);
34
- RUN_TEST(test_ReallocLargerNeeded);
35
- RUN_TEST(test_ReallocNullPointerIsLikeMalloc);
36
- RUN_TEST(test_ReallocSizeZeroFreesMemAndReturnsNullPointer);
37
- RUN_TEST(test_CallocFillsWithZero);
38
- RUN_TEST(test_FreeNULLSafety);
39
- RUN_TEST(test_DetectsLeak);
40
- RUN_TEST(test_BufferOverrunFoundDuringFree);
41
- RUN_TEST(test_BufferOverrunFoundDuringRealloc);
42
- RUN_TEST(test_BufferGuardWriteFoundDuringFree);
43
- RUN_TEST(test_BufferGuardWriteFoundDuringRealloc);
44
- RUN_TEST(test_MallocPastBufferFails);
45
- RUN_TEST(test_CallocPastBufferFails);
46
- RUN_TEST(test_MallocThenReallocGrowsMemoryInPlace);
47
- RUN_TEST(test_ReallocFailDoesNotFreeMem);
48
- return UnityEnd();
49
- }
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 "unity_memory.h"
9
+
10
+ extern void test_ForceMallocFail(void);
11
+ extern void test_ReallocSmallerIsUnchanged(void);
12
+ extern void test_ReallocSameIsUnchanged(void);
13
+ extern void test_ReallocLargerNeeded(void);
14
+ extern void test_ReallocNullPointerIsLikeMalloc(void);
15
+ extern void test_ReallocSizeZeroFreesMemAndReturnsNullPointer(void);
16
+ extern void test_CallocFillsWithZero(void);
17
+ extern void test_FreeNULLSafety(void);
18
+ extern void test_DetectsLeak(void);
19
+ extern void test_BufferOverrunFoundDuringFree(void);
20
+ extern void test_BufferOverrunFoundDuringRealloc(void);
21
+ extern void test_BufferGuardWriteFoundDuringFree(void);
22
+ extern void test_BufferGuardWriteFoundDuringRealloc(void);
23
+ extern void test_MallocPastBufferFails(void);
24
+ extern void test_CallocPastBufferFails(void);
25
+ extern void test_MallocThenReallocGrowsMemoryInPlace(void);
26
+ extern void test_ReallocFailDoesNotFreeMem(void);
27
+
28
+ int main(void)
29
+ {
30
+ UnityBegin("unity_memory_Test.c");
31
+ RUN_TEST(test_ForceMallocFail);
32
+ RUN_TEST(test_ReallocSmallerIsUnchanged);
33
+ RUN_TEST(test_ReallocSameIsUnchanged);
34
+ RUN_TEST(test_ReallocLargerNeeded);
35
+ RUN_TEST(test_ReallocNullPointerIsLikeMalloc);
36
+ RUN_TEST(test_ReallocSizeZeroFreesMemAndReturnsNullPointer);
37
+ RUN_TEST(test_CallocFillsWithZero);
38
+ RUN_TEST(test_FreeNULLSafety);
39
+ RUN_TEST(test_DetectsLeak);
40
+ RUN_TEST(test_BufferOverrunFoundDuringFree);
41
+ RUN_TEST(test_BufferOverrunFoundDuringRealloc);
42
+ RUN_TEST(test_BufferGuardWriteFoundDuringFree);
43
+ RUN_TEST(test_BufferGuardWriteFoundDuringRealloc);
44
+ RUN_TEST(test_MallocPastBufferFails);
45
+ RUN_TEST(test_CallocPastBufferFails);
46
+ RUN_TEST(test_MallocThenReallocGrowsMemoryInPlace);
47
+ RUN_TEST(test_ReallocFailDoesNotFreeMem);
48
+ return UnityEnd();
49
+ }
@@ -1,56 +1,56 @@
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 "unity_output_Spy.h"
9
-
10
- #include <stdio.h>
11
- #include <string.h>
12
- #include <stdlib.h>
13
-
14
- static int size;
15
- static int count;
16
- static char* buffer;
17
- static int spy_enable;
18
-
19
- void UnityOutputCharSpy_Create(int s)
20
- {
21
- size = (s > 0) ? s : 0;
22
- count = 0;
23
- spy_enable = 0;
24
- buffer = malloc((size_t)size);
25
- TEST_ASSERT_NOT_NULL_MESSAGE(buffer, "Internal malloc failed in Spy Create():" __FILE__);
26
- memset(buffer, 0, (size_t)size);
27
- }
28
-
29
- void UnityOutputCharSpy_Destroy(void)
30
- {
31
- size = 0;
32
- free(buffer);
33
- }
34
-
35
- void UnityOutputCharSpy_OutputChar(int c)
36
- {
37
- if (spy_enable)
38
- {
39
- if (count < (size-1))
40
- buffer[count++] = (char)c;
41
- }
42
- else
43
- {
44
- putchar(c);
45
- }
46
- }
47
-
48
- const char * UnityOutputCharSpy_Get(void)
49
- {
50
- return buffer;
51
- }
52
-
53
- void UnityOutputCharSpy_Enable(int enable)
54
- {
55
- spy_enable = enable;
56
- }
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 "unity_output_Spy.h"
9
+
10
+ #include <stdio.h>
11
+ #include <string.h>
12
+ #include <stdlib.h>
13
+
14
+ static int size;
15
+ static int count;
16
+ static char* buffer;
17
+ static int spy_enable;
18
+
19
+ void UnityOutputCharSpy_Create(int s)
20
+ {
21
+ size = (s > 0) ? s : 0;
22
+ count = 0;
23
+ spy_enable = 0;
24
+ buffer = malloc((size_t)size);
25
+ TEST_ASSERT_NOT_NULL_MESSAGE(buffer, "Internal malloc failed in Spy Create():" __FILE__);
26
+ memset(buffer, 0, (size_t)size);
27
+ }
28
+
29
+ void UnityOutputCharSpy_Destroy(void)
30
+ {
31
+ size = 0;
32
+ free(buffer);
33
+ }
34
+
35
+ void UnityOutputCharSpy_OutputChar(int c)
36
+ {
37
+ if (spy_enable)
38
+ {
39
+ if (count < (size-1))
40
+ buffer[count++] = (char)c;
41
+ }
42
+ else
43
+ {
44
+ putchar(c);
45
+ }
46
+ }
47
+
48
+ const char * UnityOutputCharSpy_Get(void)
49
+ {
50
+ return buffer;
51
+ }
52
+
53
+ void UnityOutputCharSpy_Enable(int enable)
54
+ {
55
+ spy_enable = enable;
56
+ }
@@ -1,16 +1,16 @@
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
- #ifndef UNITY_OUTPUT_SPY_H
8
- #define UNITY_OUTPUT_SPY_H
9
-
10
- void UnityOutputCharSpy_Create(int s);
11
- void UnityOutputCharSpy_Destroy(void);
12
- void UnityOutputCharSpy_OutputChar(int c);
13
- const char * UnityOutputCharSpy_Get(void);
14
- void UnityOutputCharSpy_Enable(int enable);
15
-
16
- #endif
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
+ #ifndef UNITY_OUTPUT_SPY_H
8
+ #define UNITY_OUTPUT_SPY_H
9
+
10
+ void UnityOutputCharSpy_Create(int s);
11
+ void UnityOutputCharSpy_Destroy(void);
12
+ void UnityOutputCharSpy_OutputChar(int c);
13
+ const char * UnityOutputCharSpy_Get(void);
14
+ void UnityOutputCharSpy_Enable(int enable);
15
+
16
+ #endif
@@ -1,69 +1,48 @@
1
- ###################################################################################
2
- # #
3
- # NAME: meson.build #
4
- # #
5
- # AUTHOR: Mike Karlesky, Mark VanderVoord, Greg Williams. #
6
- # WRITTEN BY: Michael Brockus. #
7
- # #
8
- # License: MIT #
9
- # #
10
- ###################################################################################
11
-
12
-
13
-
14
- project('unity', 'c',
15
- license : 'MIT',
16
- meson_version : '>=0.52.0',
17
- default_options: [
18
- 'buildtype=minsize',
19
- 'optimization=3',
20
- 'warning_level=3',
21
- 'werror=true',
22
- ]
23
- )
24
- lang = 'c'
25
- cc = meson.get_compiler(lang)
26
-
27
-
28
- ##
29
- #
30
- # Meson: Add compiler flags
31
- #
32
- ##
33
- if cc.get_id() == 'clang'
34
- add_project_arguments(cc.get_supported_arguments(
35
- [
36
- '-Wweak-vtables', '-Wexit-time-destructors',
37
- '-Wglobal-constructors', '-Wmissing-noreturn'
38
- ]
39
- ), language: lang)
40
- endif
41
-
42
- if cc.get_argument_syntax() == 'gcc'
43
- add_project_arguments(cc.get_supported_arguments(
44
- [
45
- '-Wformat', '-Waddress', '-Winit-self', '-Wno-multichar',
46
- '-Wpointer-arith' , '-Wwrite-strings' ,
47
- '-Wno-parentheses' , '-Wno-type-limits' ,
48
- '-Wformat-security' , '-Wunreachable-code' ,
49
- '-Waggregate-return' , '-Wformat-nonliteral' ,
50
- '-Wmissing-prototypes' , '-Wold-style-definition' ,
51
- '-Wmissing-declarations', '-Wmissing-include-dirs' ,
52
- '-Wno-unused-parameter' , '-Wdeclaration-after-statement'
53
- ]
54
- ), language: lang)
55
- endif
56
-
57
- if cc.get_id() == 'msvc'
58
- add_project_arguments(cc.get_supported_arguments(
59
- [
60
- '/w44265', '/w44061', '/w44062',
61
- '/wd4018', '/wd4146', '/wd4244',
62
- '/wd4305',
63
- ]
64
- ), language: lang)
65
- endif
66
-
67
- subdir('src')
68
-
69
- unity_dep = declare_dependency(link_with: unity_lib, include_directories: unity_dir)
1
+ #
2
+ # build script written by : Michael Brockus.
3
+ # github repo author: Mike Karlesky, Mark VanderVoord, Greg Williams.
4
+ #
5
+ # license: MIT
6
+ #
7
+ project('unity', 'c',
8
+ license: 'MIT',
9
+ meson_version: '>=0.53.0',
10
+ default_options: ['layout=flat', 'warning_level=3', 'werror=true', 'c_std=c11']
11
+ )
12
+ lang = 'c'
13
+ cc = meson.get_compiler(lang)
14
+
15
+ #
16
+ # Meson: Add compiler flags
17
+ if cc.get_id() == 'clang'
18
+ add_project_arguments(cc.get_supported_arguments(
19
+ [
20
+ '-Wexit-time-destructors',
21
+ '-Wglobal-constructors',
22
+ '-Wmissing-prototypes',
23
+ '-Wmissing-noreturn',
24
+ '-Wno-missing-braces',
25
+ '-Wold-style-cast', '-Wpointer-arith', '-Wweak-vtables',
26
+ '-Wcast-align', '-Wconversion', '-Wcast-qual', '-Wshadow'
27
+ ]
28
+ ), language: lang)
29
+ endif
30
+
31
+ if cc.get_argument_syntax() == 'gcc'
32
+ add_project_arguments(cc.get_supported_arguments(
33
+ [
34
+ '-Wformat', '-Waddress', '-Winit-self', '-Wno-multichar',
35
+ '-Wpointer-arith' , '-Wwrite-strings' ,
36
+ '-Wno-parentheses' , '-Wno-type-limits' ,
37
+ '-Wformat-security' , '-Wunreachable-code' ,
38
+ '-Waggregate-return' , '-Wformat-nonliteral' ,
39
+ '-Wmissing-declarations', '-Wmissing-include-dirs' ,
40
+ '-Wno-unused-parameter'
41
+ ]
42
+ ), language: lang)
43
+ endif
44
+
45
+ #
46
+ # Sub directory to project source code
47
+ subdir('src')
48
+ unity_dep = declare_dependency(link_with: unity_lib, include_directories: unity_dir)
@@ -1,16 +1,11 @@
1
- ###################################################################################
2
- # #
3
- # NAME: meson.build #
4
- # #
5
- # AUTHOR: Mike Karlesky, Mark VanderVoord, Greg Williams. #
6
- # WRITTEN BY: Michael Brockus. #
7
- # #
8
- # License: MIT #
9
- # #
10
- ###################################################################################
11
-
12
- unity_dir = include_directories('.')
13
-
14
- unity_lib = static_library(meson.project_name(),
15
- sources: ['unity.c'],
16
- include_directories: unity_dir)
1
+ #
2
+ # build script written by : Michael Brockus.
3
+ # github repo author: Mike Karlesky, Mark VanderVoord, Greg Williams.
4
+ #
5
+ # license: MIT
6
+ #
7
+ unity_dir = include_directories('.')
8
+
9
+ unity_lib = static_library(meson.project_name(),
10
+ sources: ['unity.c'],
11
+ include_directories: unity_dir)
@@ -1,2085 +1,2109 @@
1
- /* =========================================================================
2
- Unity Project - A Test Framework for C
3
- Copyright (c) 2007-19 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 <stddef.h>
9
-
10
- #ifdef AVR
11
- #include <avr/pgmspace.h>
12
- #else
13
- #define PROGMEM
14
- #endif
15
-
16
- /* If omitted from header, declare overrideable prototypes here so they're ready for use */
17
- #ifdef UNITY_OMIT_OUTPUT_CHAR_HEADER_DECLARATION
18
- void UNITY_OUTPUT_CHAR(int);
19
- #endif
20
-
21
- /* Helpful macros for us to use here in Assert functions */
22
- #define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; UNITY_OUTPUT_FLUSH(); TEST_ABORT(); }
23
- #define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; UNITY_OUTPUT_FLUSH(); TEST_ABORT(); }
24
- #define RETURN_IF_FAIL_OR_IGNORE if (Unity.CurrentTestFailed || Unity.CurrentTestIgnored) return
25
-
26
- struct UNITY_STORAGE_T Unity;
27
-
28
- #ifdef UNITY_OUTPUT_COLOR
29
- const char PROGMEM UnityStrOk[] = "\033[42mOK\033[00m";
30
- const char PROGMEM UnityStrPass[] = "\033[42mPASS\033[00m";
31
- const char PROGMEM UnityStrFail[] = "\033[41mFAIL\033[00m";
32
- const char PROGMEM UnityStrIgnore[] = "\033[43mIGNORE\033[00m";
33
- #else
34
- const char PROGMEM UnityStrOk[] = "OK";
35
- const char PROGMEM UnityStrPass[] = "PASS";
36
- const char PROGMEM UnityStrFail[] = "FAIL";
37
- const char PROGMEM UnityStrIgnore[] = "IGNORE";
38
- #endif
39
- static const char PROGMEM UnityStrNull[] = "NULL";
40
- static const char PROGMEM UnityStrSpacer[] = ". ";
41
- static const char PROGMEM UnityStrExpected[] = " Expected ";
42
- static const char PROGMEM UnityStrWas[] = " Was ";
43
- static const char PROGMEM UnityStrGt[] = " to be greater than ";
44
- static const char PROGMEM UnityStrLt[] = " to be less than ";
45
- static const char PROGMEM UnityStrOrEqual[] = "or equal to ";
46
- static const char PROGMEM UnityStrElement[] = " Element ";
47
- static const char PROGMEM UnityStrByte[] = " Byte ";
48
- static const char PROGMEM UnityStrMemory[] = " Memory Mismatch.";
49
- static const char PROGMEM UnityStrDelta[] = " Values Not Within Delta ";
50
- static const char PROGMEM UnityStrPointless[] = " You Asked Me To Compare Nothing, Which Was Pointless.";
51
- static const char PROGMEM UnityStrNullPointerForExpected[] = " Expected pointer to be NULL";
52
- static const char PROGMEM UnityStrNullPointerForActual[] = " Actual pointer was NULL";
53
- #ifndef UNITY_EXCLUDE_FLOAT
54
- static const char PROGMEM UnityStrNot[] = "Not ";
55
- static const char PROGMEM UnityStrInf[] = "Infinity";
56
- static const char PROGMEM UnityStrNegInf[] = "Negative Infinity";
57
- static const char PROGMEM UnityStrNaN[] = "NaN";
58
- static const char PROGMEM UnityStrDet[] = "Determinate";
59
- static const char PROGMEM UnityStrInvalidFloatTrait[] = "Invalid Float Trait";
60
- #endif
61
- const char PROGMEM UnityStrErrShorthand[] = "Unity Shorthand Support Disabled";
62
- const char PROGMEM UnityStrErrFloat[] = "Unity Floating Point Disabled";
63
- const char PROGMEM UnityStrErrDouble[] = "Unity Double Precision Disabled";
64
- const char PROGMEM UnityStrErr64[] = "Unity 64-bit Support Disabled";
65
- static const char PROGMEM UnityStrBreaker[] = "-----------------------";
66
- static const char PROGMEM UnityStrResultsTests[] = " Tests ";
67
- static const char PROGMEM UnityStrResultsFailures[] = " Failures ";
68
- static const char PROGMEM UnityStrResultsIgnored[] = " Ignored ";
69
- static const char PROGMEM UnityStrDetail1Name[] = UNITY_DETAIL1_NAME " ";
70
- static const char PROGMEM UnityStrDetail2Name[] = " " UNITY_DETAIL2_NAME " ";
71
-
72
- /*-----------------------------------------------
73
- * Pretty Printers & Test Result Output Handlers
74
- *-----------------------------------------------*/
75
-
76
- /*-----------------------------------------------*/
77
- /* Local helper function to print characters. */
78
- static void UnityPrintChar(const char* pch)
79
- {
80
- /* printable characters plus CR & LF are printed */
81
- if ((*pch <= 126) && (*pch >= 32))
82
- {
83
- UNITY_OUTPUT_CHAR(*pch);
84
- }
85
- /* write escaped carriage returns */
86
- else if (*pch == 13)
87
- {
88
- UNITY_OUTPUT_CHAR('\\');
89
- UNITY_OUTPUT_CHAR('r');
90
- }
91
- /* write escaped line feeds */
92
- else if (*pch == 10)
93
- {
94
- UNITY_OUTPUT_CHAR('\\');
95
- UNITY_OUTPUT_CHAR('n');
96
- }
97
- /* unprintable characters are shown as codes */
98
- else
99
- {
100
- UNITY_OUTPUT_CHAR('\\');
101
- UNITY_OUTPUT_CHAR('x');
102
- UnityPrintNumberHex((UNITY_UINT)*pch, 2);
103
- }
104
- }
105
-
106
- /*-----------------------------------------------*/
107
- /* Local helper function to print ANSI escape strings e.g. "\033[42m". */
108
- #ifdef UNITY_OUTPUT_COLOR
109
- static UNITY_UINT UnityPrintAnsiEscapeString(const char* string)
110
- {
111
- const char* pch = string;
112
- UNITY_UINT count = 0;
113
-
114
- while (*pch && (*pch != 'm'))
115
- {
116
- UNITY_OUTPUT_CHAR(*pch);
117
- pch++;
118
- count++;
119
- }
120
- UNITY_OUTPUT_CHAR('m');
121
- count++;
122
-
123
- return count;
124
- }
125
- #endif
126
-
127
- /*-----------------------------------------------*/
128
- void UnityPrint(const char* string)
129
- {
130
- const char* pch = string;
131
-
132
- if (pch != NULL)
133
- {
134
- while (*pch)
135
- {
136
- #ifdef UNITY_OUTPUT_COLOR
137
- /* print ANSI escape code */
138
- if ((*pch == 27) && (*(pch + 1) == '['))
139
- {
140
- pch += UnityPrintAnsiEscapeString(pch);
141
- continue;
142
- }
143
- #endif
144
- UnityPrintChar(pch);
145
- pch++;
146
- }
147
- }
148
- }
149
-
150
- /*-----------------------------------------------*/
151
- #ifdef UNITY_INCLUDE_PRINT_FORMATTED
152
- void UnityPrintFormatted(const char* format, ...)
153
- {
154
- const char* pch = format;
155
- va_list va;
156
- va_start(va, format);
157
-
158
- if (pch != NULL)
159
- {
160
- while (*pch)
161
- {
162
- /* format identification character */
163
- if (*pch == '%')
164
- {
165
- pch++;
166
-
167
- if (pch != NULL)
168
- {
169
- switch (*pch)
170
- {
171
- case 'd':
172
- case 'i':
173
- {
174
- const int number = va_arg(va, int);
175
- UnityPrintNumber((UNITY_INT)number);
176
- break;
177
- }
178
- #ifndef UNITY_EXCLUDE_FLOAT_PRINT
179
- case 'f':
180
- case 'g':
181
- {
182
- const double number = va_arg(va, double);
183
- UnityPrintFloat((UNITY_DOUBLE)number);
184
- break;
185
- }
186
- #endif
187
- case 'u':
188
- {
189
- const unsigned int number = va_arg(va, unsigned int);
190
- UnityPrintNumberUnsigned((UNITY_UINT)number);
191
- break;
192
- }
193
- case 'b':
194
- {
195
- const unsigned int number = va_arg(va, unsigned int);
196
- const UNITY_UINT mask = (UNITY_UINT)0 - (UNITY_UINT)1;
197
- UNITY_OUTPUT_CHAR('0');
198
- UNITY_OUTPUT_CHAR('b');
199
- UnityPrintMask(mask, (UNITY_UINT)number);
200
- break;
201
- }
202
- case 'x':
203
- case 'X':
204
- case 'p':
205
- {
206
- const unsigned int number = va_arg(va, unsigned int);
207
- UNITY_OUTPUT_CHAR('0');
208
- UNITY_OUTPUT_CHAR('x');
209
- UnityPrintNumberHex((UNITY_UINT)number, 8);
210
- break;
211
- }
212
- case 'c':
213
- {
214
- const int ch = va_arg(va, int);
215
- UnityPrintChar((const char *)&ch);
216
- break;
217
- }
218
- case 's':
219
- {
220
- const char * string = va_arg(va, const char *);
221
- UnityPrint(string);
222
- break;
223
- }
224
- case '%':
225
- {
226
- UnityPrintChar(pch);
227
- break;
228
- }
229
- default:
230
- {
231
- /* print the unknown format character */
232
- UNITY_OUTPUT_CHAR('%');
233
- UnityPrintChar(pch);
234
- break;
235
- }
236
- }
237
- }
238
- }
239
- #ifdef UNITY_OUTPUT_COLOR
240
- /* print ANSI escape code */
241
- else if ((*pch == 27) && (*(pch + 1) == '['))
242
- {
243
- pch += UnityPrintAnsiEscapeString(pch);
244
- continue;
245
- }
246
- #endif
247
- else if (*pch == '\n')
248
- {
249
- UNITY_PRINT_EOL();
250
- }
251
- else
252
- {
253
- UnityPrintChar(pch);
254
- }
255
-
256
- pch++;
257
- }
258
- }
259
-
260
- va_end(va);
261
- }
262
- #endif /* ! UNITY_INCLUDE_PRINT_FORMATTED */
263
-
264
- /*-----------------------------------------------*/
265
- void UnityPrintLen(const char* string, const UNITY_UINT32 length)
266
- {
267
- const char* pch = string;
268
-
269
- if (pch != NULL)
270
- {
271
- while (*pch && ((UNITY_UINT32)(pch - string) < length))
272
- {
273
- /* printable characters plus CR & LF are printed */
274
- if ((*pch <= 126) && (*pch >= 32))
275
- {
276
- UNITY_OUTPUT_CHAR(*pch);
277
- }
278
- /* write escaped carriage returns */
279
- else if (*pch == 13)
280
- {
281
- UNITY_OUTPUT_CHAR('\\');
282
- UNITY_OUTPUT_CHAR('r');
283
- }
284
- /* write escaped line feeds */
285
- else if (*pch == 10)
286
- {
287
- UNITY_OUTPUT_CHAR('\\');
288
- UNITY_OUTPUT_CHAR('n');
289
- }
290
- /* unprintable characters are shown as codes */
291
- else
292
- {
293
- UNITY_OUTPUT_CHAR('\\');
294
- UNITY_OUTPUT_CHAR('x');
295
- UnityPrintNumberHex((UNITY_UINT)*pch, 2);
296
- }
297
- pch++;
298
- }
299
- }
300
- }
301
-
302
- /*-----------------------------------------------*/
303
- void UnityPrintNumberByStyle(const UNITY_INT number, const UNITY_DISPLAY_STYLE_T style)
304
- {
305
- if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
306
- {
307
- if (style == UNITY_DISPLAY_STYLE_CHAR)
308
- {
309
- /* printable characters plus CR & LF are printed */
310
- UNITY_OUTPUT_CHAR('\'');
311
- if ((number <= 126) && (number >= 32))
312
- {
313
- UNITY_OUTPUT_CHAR((int)number);
314
- }
315
- /* write escaped carriage returns */
316
- else if (number == 13)
317
- {
318
- UNITY_OUTPUT_CHAR('\\');
319
- UNITY_OUTPUT_CHAR('r');
320
- }
321
- /* write escaped line feeds */
322
- else if (number == 10)
323
- {
324
- UNITY_OUTPUT_CHAR('\\');
325
- UNITY_OUTPUT_CHAR('n');
326
- }
327
- /* unprintable characters are shown as codes */
328
- else
329
- {
330
- UNITY_OUTPUT_CHAR('\\');
331
- UNITY_OUTPUT_CHAR('x');
332
- UnityPrintNumberHex((UNITY_UINT)number, 2);
333
- }
334
- UNITY_OUTPUT_CHAR('\'');
335
- }
336
- else
337
- {
338
- UnityPrintNumber(number);
339
- }
340
- }
341
- else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT)
342
- {
343
- UnityPrintNumberUnsigned((UNITY_UINT)number);
344
- }
345
- else
346
- {
347
- UNITY_OUTPUT_CHAR('0');
348
- UNITY_OUTPUT_CHAR('x');
349
- UnityPrintNumberHex((UNITY_UINT)number, (char)((style & 0xF) * 2));
350
- }
351
- }
352
-
353
- /*-----------------------------------------------*/
354
- void UnityPrintNumber(const UNITY_INT number_to_print)
355
- {
356
- UNITY_UINT number = (UNITY_UINT)number_to_print;
357
-
358
- if (number_to_print < 0)
359
- {
360
- /* A negative number, including MIN negative */
361
- UNITY_OUTPUT_CHAR('-');
362
- number = (~number) + 1;
363
- }
364
- UnityPrintNumberUnsigned(number);
365
- }
366
-
367
- /*-----------------------------------------------
368
- * basically do an itoa using as little ram as possible */
369
- void UnityPrintNumberUnsigned(const UNITY_UINT number)
370
- {
371
- UNITY_UINT divisor = 1;
372
-
373
- /* figure out initial divisor */
374
- while (number / divisor > 9)
375
- {
376
- divisor *= 10;
377
- }
378
-
379
- /* now mod and print, then divide divisor */
380
- do
381
- {
382
- UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10)));
383
- divisor /= 10;
384
- } while (divisor > 0);
385
- }
386
-
387
- /*-----------------------------------------------*/
388
- void UnityPrintNumberHex(const UNITY_UINT number, const char nibbles_to_print)
389
- {
390
- int nibble;
391
- char nibbles = nibbles_to_print;
392
-
393
- if ((unsigned)nibbles > UNITY_MAX_NIBBLES)
394
- {
395
- nibbles = UNITY_MAX_NIBBLES;
396
- }
397
-
398
- while (nibbles > 0)
399
- {
400
- nibbles--;
401
- nibble = (int)(number >> (nibbles * 4)) & 0x0F;
402
- if (nibble <= 9)
403
- {
404
- UNITY_OUTPUT_CHAR((char)('0' + nibble));
405
- }
406
- else
407
- {
408
- UNITY_OUTPUT_CHAR((char)('A' - 10 + nibble));
409
- }
410
- }
411
- }
412
-
413
- /*-----------------------------------------------*/
414
- void UnityPrintMask(const UNITY_UINT mask, const UNITY_UINT number)
415
- {
416
- UNITY_UINT current_bit = (UNITY_UINT)1 << (UNITY_INT_WIDTH - 1);
417
- UNITY_INT32 i;
418
-
419
- for (i = 0; i < UNITY_INT_WIDTH; i++)
420
- {
421
- if (current_bit & mask)
422
- {
423
- if (current_bit & number)
424
- {
425
- UNITY_OUTPUT_CHAR('1');
426
- }
427
- else
428
- {
429
- UNITY_OUTPUT_CHAR('0');
430
- }
431
- }
432
- else
433
- {
434
- UNITY_OUTPUT_CHAR('X');
435
- }
436
- current_bit = current_bit >> 1;
437
- }
438
- }
439
-
440
- /*-----------------------------------------------*/
441
- #ifndef UNITY_EXCLUDE_FLOAT_PRINT
442
- /*
443
- * This function prints a floating-point value in a format similar to
444
- * printf("%.7g") on a single-precision machine or printf("%.9g") on a
445
- * double-precision machine. The 7th digit won't always be totally correct
446
- * in single-precision operation (for that level of accuracy, a more
447
- * complicated algorithm would be needed).
448
- */
449
- void UnityPrintFloat(const UNITY_DOUBLE input_number)
450
- {
451
- #ifdef UNITY_INCLUDE_DOUBLE
452
- static const int sig_digits = 9;
453
- static const UNITY_INT32 min_scaled = 100000000;
454
- static const UNITY_INT32 max_scaled = 1000000000;
455
- #else
456
- static const int sig_digits = 7;
457
- static const UNITY_INT32 min_scaled = 1000000;
458
- static const UNITY_INT32 max_scaled = 10000000;
459
- #endif
460
-
461
- UNITY_DOUBLE number = input_number;
462
-
463
- /* print minus sign (does not handle negative zero) */
464
- if (number < 0.0f)
465
- {
466
- UNITY_OUTPUT_CHAR('-');
467
- number = -number;
468
- }
469
-
470
- /* handle zero, NaN, and +/- infinity */
471
- if (number == 0.0f)
472
- {
473
- UnityPrint("0");
474
- }
475
- else if (isnan(number))
476
- {
477
- UnityPrint("nan");
478
- }
479
- else if (isinf(number))
480
- {
481
- UnityPrint("inf");
482
- }
483
- else
484
- {
485
- UNITY_INT32 n_int = 0, n;
486
- int exponent = 0;
487
- int decimals, digits;
488
- char buf[16] = {0};
489
-
490
- /*
491
- * Scale up or down by powers of 10. To minimize rounding error,
492
- * start with a factor/divisor of 10^10, which is the largest
493
- * power of 10 that can be represented exactly. Finally, compute
494
- * (exactly) the remaining power of 10 and perform one more
495
- * multiplication or division.
496
- */
497
- if (number < 1.0f)
498
- {
499
- UNITY_DOUBLE factor = 1.0f;
500
-
501
- while (number < (UNITY_DOUBLE)max_scaled / 1e10f) { number *= 1e10f; exponent -= 10; }
502
- while (number * factor < (UNITY_DOUBLE)min_scaled) { factor *= 10.0f; exponent--; }
503
-
504
- number *= factor;
505
- }
506
- else if (number > (UNITY_DOUBLE)max_scaled)
507
- {
508
- UNITY_DOUBLE divisor = 1.0f;
509
-
510
- while (number > (UNITY_DOUBLE)min_scaled * 1e10f) { number /= 1e10f; exponent += 10; }
511
- while (number / divisor > (UNITY_DOUBLE)max_scaled) { divisor *= 10.0f; exponent++; }
512
-
513
- number /= divisor;
514
- }
515
- else
516
- {
517
- /*
518
- * In this range, we can split off the integer part before
519
- * doing any multiplications. This reduces rounding error by
520
- * freeing up significant bits in the fractional part.
521
- */
522
- UNITY_DOUBLE factor = 1.0f;
523
- n_int = (UNITY_INT32)number;
524
- number -= (UNITY_DOUBLE)n_int;
525
-
526
- while (n_int < min_scaled) { n_int *= 10; factor *= 10.0f; exponent--; }
527
-
528
- number *= factor;
529
- }
530
-
531
- /* round to nearest integer */
532
- n = ((UNITY_INT32)(number + number) + 1) / 2;
533
-
534
- #ifndef UNITY_ROUND_TIES_AWAY_FROM_ZERO
535
- /* round to even if exactly between two integers */
536
- if ((n & 1) && (((UNITY_DOUBLE)n - number) == 0.5f))
537
- n--;
538
- #endif
539
-
540
- n += n_int;
541
-
542
- if (n >= max_scaled)
543
- {
544
- n = min_scaled;
545
- exponent++;
546
- }
547
-
548
- /* determine where to place decimal point */
549
- decimals = ((exponent <= 0) && (exponent >= -(sig_digits + 3))) ? (-exponent) : (sig_digits - 1);
550
- exponent += decimals;
551
-
552
- /* truncate trailing zeroes after decimal point */
553
- while ((decimals > 0) && ((n % 10) == 0))
554
- {
555
- n /= 10;
556
- decimals--;
557
- }
558
-
559
- /* build up buffer in reverse order */
560
- digits = 0;
561
- while ((n != 0) || (digits < (decimals + 1)))
562
- {
563
- buf[digits++] = (char)('0' + n % 10);
564
- n /= 10;
565
- }
566
- while (digits > 0)
567
- {
568
- if (digits == decimals) { UNITY_OUTPUT_CHAR('.'); }
569
- UNITY_OUTPUT_CHAR(buf[--digits]);
570
- }
571
-
572
- /* print exponent if needed */
573
- if (exponent != 0)
574
- {
575
- UNITY_OUTPUT_CHAR('e');
576
-
577
- if (exponent < 0)
578
- {
579
- UNITY_OUTPUT_CHAR('-');
580
- exponent = -exponent;
581
- }
582
- else
583
- {
584
- UNITY_OUTPUT_CHAR('+');
585
- }
586
-
587
- digits = 0;
588
- while ((exponent != 0) || (digits < 2))
589
- {
590
- buf[digits++] = (char)('0' + exponent % 10);
591
- exponent /= 10;
592
- }
593
- while (digits > 0)
594
- {
595
- UNITY_OUTPUT_CHAR(buf[--digits]);
596
- }
597
- }
598
- }
599
- }
600
- #endif /* ! UNITY_EXCLUDE_FLOAT_PRINT */
601
-
602
- /*-----------------------------------------------*/
603
- static void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line)
604
- {
605
- #ifdef UNITY_OUTPUT_FOR_ECLIPSE
606
- UNITY_OUTPUT_CHAR('(');
607
- UnityPrint(file);
608
- UNITY_OUTPUT_CHAR(':');
609
- UnityPrintNumber((UNITY_INT)line);
610
- UNITY_OUTPUT_CHAR(')');
611
- UNITY_OUTPUT_CHAR(' ');
612
- UnityPrint(Unity.CurrentTestName);
613
- UNITY_OUTPUT_CHAR(':');
614
- #else
615
- #ifdef UNITY_OUTPUT_FOR_IAR_WORKBENCH
616
- UnityPrint("<SRCREF line=");
617
- UnityPrintNumber((UNITY_INT)line);
618
- UnityPrint(" file=\"");
619
- UnityPrint(file);
620
- UNITY_OUTPUT_CHAR('"');
621
- UNITY_OUTPUT_CHAR('>');
622
- UnityPrint(Unity.CurrentTestName);
623
- UnityPrint("</SRCREF> ");
624
- #else
625
- #ifdef UNITY_OUTPUT_FOR_QT_CREATOR
626
- UnityPrint("file://");
627
- UnityPrint(file);
628
- UNITY_OUTPUT_CHAR(':');
629
- UnityPrintNumber((UNITY_INT)line);
630
- UNITY_OUTPUT_CHAR(' ');
631
- UnityPrint(Unity.CurrentTestName);
632
- UNITY_OUTPUT_CHAR(':');
633
- #else
634
- UnityPrint(file);
635
- UNITY_OUTPUT_CHAR(':');
636
- UnityPrintNumber((UNITY_INT)line);
637
- UNITY_OUTPUT_CHAR(':');
638
- UnityPrint(Unity.CurrentTestName);
639
- UNITY_OUTPUT_CHAR(':');
640
- #endif
641
- #endif
642
- #endif
643
- }
644
-
645
- /*-----------------------------------------------*/
646
- static void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line)
647
- {
648
- UnityTestResultsBegin(Unity.TestFile, line);
649
- UnityPrint(UnityStrFail);
650
- UNITY_OUTPUT_CHAR(':');
651
- }
652
-
653
- /*-----------------------------------------------*/
654
- void UnityConcludeTest(void)
655
- {
656
- if (Unity.CurrentTestIgnored)
657
- {
658
- Unity.TestIgnores++;
659
- }
660
- else if (!Unity.CurrentTestFailed)
661
- {
662
- UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber);
663
- UnityPrint(UnityStrPass);
664
- }
665
- else
666
- {
667
- Unity.TestFailures++;
668
- }
669
-
670
- Unity.CurrentTestFailed = 0;
671
- Unity.CurrentTestIgnored = 0;
672
- UNITY_PRINT_EXEC_TIME();
673
- UNITY_PRINT_EOL();
674
- UNITY_FLUSH_CALL();
675
- }
676
-
677
- /*-----------------------------------------------*/
678
- static void UnityAddMsgIfSpecified(const char* msg)
679
- {
680
- if (msg)
681
- {
682
- UnityPrint(UnityStrSpacer);
683
- #ifndef UNITY_EXCLUDE_DETAILS
684
- if (Unity.CurrentDetail1)
685
- {
686
- UnityPrint(UnityStrDetail1Name);
687
- UnityPrint(Unity.CurrentDetail1);
688
- if (Unity.CurrentDetail2)
689
- {
690
- UnityPrint(UnityStrDetail2Name);
691
- UnityPrint(Unity.CurrentDetail2);
692
- }
693
- UnityPrint(UnityStrSpacer);
694
- }
695
- #endif
696
- UnityPrint(msg);
697
- }
698
- }
699
-
700
- /*-----------------------------------------------*/
701
- static void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual)
702
- {
703
- UnityPrint(UnityStrExpected);
704
- if (expected != NULL)
705
- {
706
- UNITY_OUTPUT_CHAR('\'');
707
- UnityPrint(expected);
708
- UNITY_OUTPUT_CHAR('\'');
709
- }
710
- else
711
- {
712
- UnityPrint(UnityStrNull);
713
- }
714
- UnityPrint(UnityStrWas);
715
- if (actual != NULL)
716
- {
717
- UNITY_OUTPUT_CHAR('\'');
718
- UnityPrint(actual);
719
- UNITY_OUTPUT_CHAR('\'');
720
- }
721
- else
722
- {
723
- UnityPrint(UnityStrNull);
724
- }
725
- }
726
-
727
- /*-----------------------------------------------*/
728
- static void UnityPrintExpectedAndActualStringsLen(const char* expected,
729
- const char* actual,
730
- const UNITY_UINT32 length)
731
- {
732
- UnityPrint(UnityStrExpected);
733
- if (expected != NULL)
734
- {
735
- UNITY_OUTPUT_CHAR('\'');
736
- UnityPrintLen(expected, length);
737
- UNITY_OUTPUT_CHAR('\'');
738
- }
739
- else
740
- {
741
- UnityPrint(UnityStrNull);
742
- }
743
- UnityPrint(UnityStrWas);
744
- if (actual != NULL)
745
- {
746
- UNITY_OUTPUT_CHAR('\'');
747
- UnityPrintLen(actual, length);
748
- UNITY_OUTPUT_CHAR('\'');
749
- }
750
- else
751
- {
752
- UnityPrint(UnityStrNull);
753
- }
754
- }
755
-
756
- /*-----------------------------------------------
757
- * Assertion & Control Helpers
758
- *-----------------------------------------------*/
759
-
760
- /*-----------------------------------------------*/
761
- static int UnityIsOneArrayNull(UNITY_INTERNAL_PTR expected,
762
- UNITY_INTERNAL_PTR actual,
763
- const UNITY_LINE_TYPE lineNumber,
764
- const char* msg)
765
- {
766
- /* Both are NULL or same pointer */
767
- if (expected == actual) { return 0; }
768
-
769
- /* print and return true if just expected is NULL */
770
- if (expected == NULL)
771
- {
772
- UnityTestResultsFailBegin(lineNumber);
773
- UnityPrint(UnityStrNullPointerForExpected);
774
- UnityAddMsgIfSpecified(msg);
775
- return 1;
776
- }
777
-
778
- /* print and return true if just actual is NULL */
779
- if (actual == NULL)
780
- {
781
- UnityTestResultsFailBegin(lineNumber);
782
- UnityPrint(UnityStrNullPointerForActual);
783
- UnityAddMsgIfSpecified(msg);
784
- return 1;
785
- }
786
-
787
- return 0; /* return false if neither is NULL */
788
- }
789
-
790
- /*-----------------------------------------------
791
- * Assertion Functions
792
- *-----------------------------------------------*/
793
-
794
- /*-----------------------------------------------*/
795
- void UnityAssertBits(const UNITY_INT mask,
796
- const UNITY_INT expected,
797
- const UNITY_INT actual,
798
- const char* msg,
799
- const UNITY_LINE_TYPE lineNumber)
800
- {
801
- RETURN_IF_FAIL_OR_IGNORE;
802
-
803
- if ((mask & expected) != (mask & actual))
804
- {
805
- UnityTestResultsFailBegin(lineNumber);
806
- UnityPrint(UnityStrExpected);
807
- UnityPrintMask((UNITY_UINT)mask, (UNITY_UINT)expected);
808
- UnityPrint(UnityStrWas);
809
- UnityPrintMask((UNITY_UINT)mask, (UNITY_UINT)actual);
810
- UnityAddMsgIfSpecified(msg);
811
- UNITY_FAIL_AND_BAIL;
812
- }
813
- }
814
-
815
- /*-----------------------------------------------*/
816
- void UnityAssertEqualNumber(const UNITY_INT expected,
817
- const UNITY_INT actual,
818
- const char* msg,
819
- const UNITY_LINE_TYPE lineNumber,
820
- const UNITY_DISPLAY_STYLE_T style)
821
- {
822
- RETURN_IF_FAIL_OR_IGNORE;
823
-
824
- if (expected != actual)
825
- {
826
- UnityTestResultsFailBegin(lineNumber);
827
- UnityPrint(UnityStrExpected);
828
- UnityPrintNumberByStyle(expected, style);
829
- UnityPrint(UnityStrWas);
830
- UnityPrintNumberByStyle(actual, style);
831
- UnityAddMsgIfSpecified(msg);
832
- UNITY_FAIL_AND_BAIL;
833
- }
834
- }
835
-
836
- /*-----------------------------------------------*/
837
- void UnityAssertGreaterOrLessOrEqualNumber(const UNITY_INT threshold,
838
- const UNITY_INT actual,
839
- const UNITY_COMPARISON_T compare,
840
- const char *msg,
841
- const UNITY_LINE_TYPE lineNumber,
842
- const UNITY_DISPLAY_STYLE_T style)
843
- {
844
- int failed = 0;
845
- RETURN_IF_FAIL_OR_IGNORE;
846
-
847
- if ((threshold == actual) && (compare & UNITY_EQUAL_TO)) { return; }
848
- if ((threshold == actual)) { failed = 1; }
849
-
850
- if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
851
- {
852
- if ((actual > threshold) && (compare & UNITY_SMALLER_THAN)) { failed = 1; }
853
- if ((actual < threshold) && (compare & UNITY_GREATER_THAN)) { failed = 1; }
854
- }
855
- else /* UINT or HEX */
856
- {
857
- if (((UNITY_UINT)actual > (UNITY_UINT)threshold) && (compare & UNITY_SMALLER_THAN)) { failed = 1; }
858
- if (((UNITY_UINT)actual < (UNITY_UINT)threshold) && (compare & UNITY_GREATER_THAN)) { failed = 1; }
859
- }
860
-
861
- if (failed)
862
- {
863
- UnityTestResultsFailBegin(lineNumber);
864
- UnityPrint(UnityStrExpected);
865
- UnityPrintNumberByStyle(actual, style);
866
- if (compare & UNITY_GREATER_THAN) { UnityPrint(UnityStrGt); }
867
- if (compare & UNITY_SMALLER_THAN) { UnityPrint(UnityStrLt); }
868
- if (compare & UNITY_EQUAL_TO) { UnityPrint(UnityStrOrEqual); }
869
- UnityPrintNumberByStyle(threshold, style);
870
- UnityAddMsgIfSpecified(msg);
871
- UNITY_FAIL_AND_BAIL;
872
- }
873
- }
874
-
875
- #define UnityPrintPointlessAndBail() \
876
- { \
877
- UnityTestResultsFailBegin(lineNumber); \
878
- UnityPrint(UnityStrPointless); \
879
- UnityAddMsgIfSpecified(msg); \
880
- UNITY_FAIL_AND_BAIL; }
881
-
882
- /*-----------------------------------------------*/
883
- void UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,
884
- UNITY_INTERNAL_PTR actual,
885
- const UNITY_UINT32 num_elements,
886
- const char* msg,
887
- const UNITY_LINE_TYPE lineNumber,
888
- const UNITY_DISPLAY_STYLE_T style,
889
- const UNITY_FLAGS_T flags)
890
- {
891
- UNITY_UINT32 elements = num_elements;
892
- unsigned int length = style & 0xF;
893
- unsigned int increment = 0;
894
-
895
- RETURN_IF_FAIL_OR_IGNORE;
896
-
897
- if (num_elements == 0)
898
- {
899
- UnityPrintPointlessAndBail();
900
- }
901
-
902
- if (expected == actual)
903
- {
904
- return; /* Both are NULL or same pointer */
905
- }
906
-
907
- if (UnityIsOneArrayNull(expected, actual, lineNumber, msg))
908
- {
909
- UNITY_FAIL_AND_BAIL;
910
- }
911
-
912
- while ((elements > 0) && (elements--))
913
- {
914
- UNITY_INT expect_val;
915
- UNITY_INT actual_val;
916
-
917
- switch (length)
918
- {
919
- case 1:
920
- expect_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT8*)expected;
921
- actual_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT8*)actual;
922
- increment = sizeof(UNITY_INT8);
923
- break;
924
-
925
- case 2:
926
- expect_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT16*)expected;
927
- actual_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT16*)actual;
928
- increment = sizeof(UNITY_INT16);
929
- break;
930
-
931
- #ifdef UNITY_SUPPORT_64
932
- case 8:
933
- expect_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT64*)expected;
934
- actual_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT64*)actual;
935
- increment = sizeof(UNITY_INT64);
936
- break;
937
- #endif
938
-
939
- default: /* default is length 4 bytes */
940
- case 4:
941
- expect_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT32*)expected;
942
- actual_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT32*)actual;
943
- increment = sizeof(UNITY_INT32);
944
- length = 4;
945
- break;
946
- }
947
-
948
- if (expect_val != actual_val)
949
- {
950
- if ((style & UNITY_DISPLAY_RANGE_UINT) && (length < (UNITY_INT_WIDTH / 8)))
951
- { /* For UINT, remove sign extension (padding 1's) from signed type casts above */
952
- UNITY_INT mask = 1;
953
- mask = (mask << 8 * length) - 1;
954
- expect_val &= mask;
955
- actual_val &= mask;
956
- }
957
- UnityTestResultsFailBegin(lineNumber);
958
- UnityPrint(UnityStrElement);
959
- UnityPrintNumberUnsigned(num_elements - elements - 1);
960
- UnityPrint(UnityStrExpected);
961
- UnityPrintNumberByStyle(expect_val, style);
962
- UnityPrint(UnityStrWas);
963
- UnityPrintNumberByStyle(actual_val, style);
964
- UnityAddMsgIfSpecified(msg);
965
- UNITY_FAIL_AND_BAIL;
966
- }
967
- /* Walk through array by incrementing the pointers */
968
- if (flags == UNITY_ARRAY_TO_ARRAY)
969
- {
970
- expected = (UNITY_INTERNAL_PTR)((const char*)expected + increment);
971
- }
972
- actual = (UNITY_INTERNAL_PTR)((const char*)actual + increment);
973
- }
974
- }
975
-
976
- /*-----------------------------------------------*/
977
- #ifndef UNITY_EXCLUDE_FLOAT
978
- /* Wrap this define in a function with variable types as float or double */
979
- #define UNITY_FLOAT_OR_DOUBLE_WITHIN(delta, expected, actual, diff) \
980
- if (isinf(expected) && isinf(actual) && (((expected) < 0) == ((actual) < 0))) return 1; \
981
- if (UNITY_NAN_CHECK) return 1; \
982
- (diff) = (actual) - (expected); \
983
- if ((diff) < 0) (diff) = -(diff); \
984
- if ((delta) < 0) (delta) = -(delta); \
985
- return !(isnan(diff) || isinf(diff) || ((diff) > (delta)))
986
- /* This first part of this condition will catch any NaN or Infinite values */
987
- #ifndef UNITY_NAN_NOT_EQUAL_NAN
988
- #define UNITY_NAN_CHECK isnan(expected) && isnan(actual)
989
- #else
990
- #define UNITY_NAN_CHECK 0
991
- #endif
992
-
993
- #ifndef UNITY_EXCLUDE_FLOAT_PRINT
994
- #define UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT(expected, actual) \
995
- { \
996
- UnityPrint(UnityStrExpected); \
997
- UnityPrintFloat(expected); \
998
- UnityPrint(UnityStrWas); \
999
- UnityPrintFloat(actual); }
1000
- #else
1001
- #define UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT(expected, actual) \
1002
- UnityPrint(UnityStrDelta)
1003
- #endif /* UNITY_EXCLUDE_FLOAT_PRINT */
1004
-
1005
- /*-----------------------------------------------*/
1006
- static int UnityFloatsWithin(UNITY_FLOAT delta, UNITY_FLOAT expected, UNITY_FLOAT actual)
1007
- {
1008
- UNITY_FLOAT diff;
1009
- UNITY_FLOAT_OR_DOUBLE_WITHIN(delta, expected, actual, diff);
1010
- }
1011
-
1012
- /*-----------------------------------------------*/
1013
- void UnityAssertEqualFloatArray(UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* expected,
1014
- UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* actual,
1015
- const UNITY_UINT32 num_elements,
1016
- const char* msg,
1017
- const UNITY_LINE_TYPE lineNumber,
1018
- const UNITY_FLAGS_T flags)
1019
- {
1020
- UNITY_UINT32 elements = num_elements;
1021
- UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* ptr_expected = expected;
1022
- UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* ptr_actual = actual;
1023
-
1024
- RETURN_IF_FAIL_OR_IGNORE;
1025
-
1026
- if (elements == 0)
1027
- {
1028
- UnityPrintPointlessAndBail();
1029
- }
1030
-
1031
- if (expected == actual)
1032
- {
1033
- return; /* Both are NULL or same pointer */
1034
- }
1035
-
1036
- if (UnityIsOneArrayNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg))
1037
- {
1038
- UNITY_FAIL_AND_BAIL;
1039
- }
1040
-
1041
- while (elements--)
1042
- {
1043
- if (!UnityFloatsWithin(*ptr_expected * UNITY_FLOAT_PRECISION, *ptr_expected, *ptr_actual))
1044
- {
1045
- UnityTestResultsFailBegin(lineNumber);
1046
- UnityPrint(UnityStrElement);
1047
- UnityPrintNumberUnsigned(num_elements - elements - 1);
1048
- UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT((UNITY_DOUBLE)*ptr_expected, (UNITY_DOUBLE)*ptr_actual);
1049
- UnityAddMsgIfSpecified(msg);
1050
- UNITY_FAIL_AND_BAIL;
1051
- }
1052
- if (flags == UNITY_ARRAY_TO_ARRAY)
1053
- {
1054
- ptr_expected++;
1055
- }
1056
- ptr_actual++;
1057
- }
1058
- }
1059
-
1060
- /*-----------------------------------------------*/
1061
- void UnityAssertFloatsWithin(const UNITY_FLOAT delta,
1062
- const UNITY_FLOAT expected,
1063
- const UNITY_FLOAT actual,
1064
- const char* msg,
1065
- const UNITY_LINE_TYPE lineNumber)
1066
- {
1067
- RETURN_IF_FAIL_OR_IGNORE;
1068
-
1069
-
1070
- if (!UnityFloatsWithin(delta, expected, actual))
1071
- {
1072
- UnityTestResultsFailBegin(lineNumber);
1073
- UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT((UNITY_DOUBLE)expected, (UNITY_DOUBLE)actual);
1074
- UnityAddMsgIfSpecified(msg);
1075
- UNITY_FAIL_AND_BAIL;
1076
- }
1077
- }
1078
-
1079
- /*-----------------------------------------------*/
1080
- void UnityAssertFloatSpecial(const UNITY_FLOAT actual,
1081
- const char* msg,
1082
- const UNITY_LINE_TYPE lineNumber,
1083
- const UNITY_FLOAT_TRAIT_T style)
1084
- {
1085
- const char* trait_names[] = {UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet};
1086
- UNITY_INT should_be_trait = ((UNITY_INT)style & 1);
1087
- UNITY_INT is_trait = !should_be_trait;
1088
- UNITY_INT trait_index = (UNITY_INT)(style >> 1);
1089
-
1090
- RETURN_IF_FAIL_OR_IGNORE;
1091
-
1092
- switch (style)
1093
- {
1094
- case UNITY_FLOAT_IS_INF:
1095
- case UNITY_FLOAT_IS_NOT_INF:
1096
- is_trait = isinf(actual) && (actual > 0);
1097
- break;
1098
- case UNITY_FLOAT_IS_NEG_INF:
1099
- case UNITY_FLOAT_IS_NOT_NEG_INF:
1100
- is_trait = isinf(actual) && (actual < 0);
1101
- break;
1102
-
1103
- case UNITY_FLOAT_IS_NAN:
1104
- case UNITY_FLOAT_IS_NOT_NAN:
1105
- is_trait = isnan(actual) ? 1 : 0;
1106
- break;
1107
-
1108
- case UNITY_FLOAT_IS_DET: /* A determinate number is non infinite and not NaN. */
1109
- case UNITY_FLOAT_IS_NOT_DET:
1110
- is_trait = !isinf(actual) && !isnan(actual);
1111
- break;
1112
-
1113
- default:
1114
- trait_index = 0;
1115
- trait_names[0] = UnityStrInvalidFloatTrait;
1116
- break;
1117
- }
1118
-
1119
- if (is_trait != should_be_trait)
1120
- {
1121
- UnityTestResultsFailBegin(lineNumber);
1122
- UnityPrint(UnityStrExpected);
1123
- if (!should_be_trait)
1124
- {
1125
- UnityPrint(UnityStrNot);
1126
- }
1127
- UnityPrint(trait_names[trait_index]);
1128
- UnityPrint(UnityStrWas);
1129
- #ifndef UNITY_EXCLUDE_FLOAT_PRINT
1130
- UnityPrintFloat((UNITY_DOUBLE)actual);
1131
- #else
1132
- if (should_be_trait)
1133
- {
1134
- UnityPrint(UnityStrNot);
1135
- }
1136
- UnityPrint(trait_names[trait_index]);
1137
- #endif
1138
- UnityAddMsgIfSpecified(msg);
1139
- UNITY_FAIL_AND_BAIL;
1140
- }
1141
- }
1142
-
1143
- #endif /* not UNITY_EXCLUDE_FLOAT */
1144
-
1145
- /*-----------------------------------------------*/
1146
- #ifndef UNITY_EXCLUDE_DOUBLE
1147
- static int UnityDoublesWithin(UNITY_DOUBLE delta, UNITY_DOUBLE expected, UNITY_DOUBLE actual)
1148
- {
1149
- UNITY_DOUBLE diff;
1150
- UNITY_FLOAT_OR_DOUBLE_WITHIN(delta, expected, actual, diff);
1151
- }
1152
-
1153
- /*-----------------------------------------------*/
1154
- void UnityAssertEqualDoubleArray(UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* expected,
1155
- UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* actual,
1156
- const UNITY_UINT32 num_elements,
1157
- const char* msg,
1158
- const UNITY_LINE_TYPE lineNumber,
1159
- const UNITY_FLAGS_T flags)
1160
- {
1161
- UNITY_UINT32 elements = num_elements;
1162
- UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* ptr_expected = expected;
1163
- UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* ptr_actual = actual;
1164
-
1165
- RETURN_IF_FAIL_OR_IGNORE;
1166
-
1167
- if (elements == 0)
1168
- {
1169
- UnityPrintPointlessAndBail();
1170
- }
1171
-
1172
- if (expected == actual)
1173
- {
1174
- return; /* Both are NULL or same pointer */
1175
- }
1176
-
1177
- if (UnityIsOneArrayNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg))
1178
- {
1179
- UNITY_FAIL_AND_BAIL;
1180
- }
1181
-
1182
- while (elements--)
1183
- {
1184
- if (!UnityDoublesWithin(*ptr_expected * UNITY_DOUBLE_PRECISION, *ptr_expected, *ptr_actual))
1185
- {
1186
- UnityTestResultsFailBegin(lineNumber);
1187
- UnityPrint(UnityStrElement);
1188
- UnityPrintNumberUnsigned(num_elements - elements - 1);
1189
- UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT(*ptr_expected, *ptr_actual);
1190
- UnityAddMsgIfSpecified(msg);
1191
- UNITY_FAIL_AND_BAIL;
1192
- }
1193
- if (flags == UNITY_ARRAY_TO_ARRAY)
1194
- {
1195
- ptr_expected++;
1196
- }
1197
- ptr_actual++;
1198
- }
1199
- }
1200
-
1201
- /*-----------------------------------------------*/
1202
- void UnityAssertDoublesWithin(const UNITY_DOUBLE delta,
1203
- const UNITY_DOUBLE expected,
1204
- const UNITY_DOUBLE actual,
1205
- const char* msg,
1206
- const UNITY_LINE_TYPE lineNumber)
1207
- {
1208
- RETURN_IF_FAIL_OR_IGNORE;
1209
-
1210
- if (!UnityDoublesWithin(delta, expected, actual))
1211
- {
1212
- UnityTestResultsFailBegin(lineNumber);
1213
- UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT(expected, actual);
1214
- UnityAddMsgIfSpecified(msg);
1215
- UNITY_FAIL_AND_BAIL;
1216
- }
1217
- }
1218
-
1219
- /*-----------------------------------------------*/
1220
- void UnityAssertDoubleSpecial(const UNITY_DOUBLE actual,
1221
- const char* msg,
1222
- const UNITY_LINE_TYPE lineNumber,
1223
- const UNITY_FLOAT_TRAIT_T style)
1224
- {
1225
- const char* trait_names[] = {UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet};
1226
- UNITY_INT should_be_trait = ((UNITY_INT)style & 1);
1227
- UNITY_INT is_trait = !should_be_trait;
1228
- UNITY_INT trait_index = (UNITY_INT)(style >> 1);
1229
-
1230
- RETURN_IF_FAIL_OR_IGNORE;
1231
-
1232
- switch (style)
1233
- {
1234
- case UNITY_FLOAT_IS_INF:
1235
- case UNITY_FLOAT_IS_NOT_INF:
1236
- is_trait = isinf(actual) && (actual > 0);
1237
- break;
1238
- case UNITY_FLOAT_IS_NEG_INF:
1239
- case UNITY_FLOAT_IS_NOT_NEG_INF:
1240
- is_trait = isinf(actual) && (actual < 0);
1241
- break;
1242
-
1243
- case UNITY_FLOAT_IS_NAN:
1244
- case UNITY_FLOAT_IS_NOT_NAN:
1245
- is_trait = isnan(actual) ? 1 : 0;
1246
- break;
1247
-
1248
- case UNITY_FLOAT_IS_DET: /* A determinate number is non infinite and not NaN. */
1249
- case UNITY_FLOAT_IS_NOT_DET:
1250
- is_trait = !isinf(actual) && !isnan(actual);
1251
- break;
1252
-
1253
- default:
1254
- trait_index = 0;
1255
- trait_names[0] = UnityStrInvalidFloatTrait;
1256
- break;
1257
- }
1258
-
1259
- if (is_trait != should_be_trait)
1260
- {
1261
- UnityTestResultsFailBegin(lineNumber);
1262
- UnityPrint(UnityStrExpected);
1263
- if (!should_be_trait)
1264
- {
1265
- UnityPrint(UnityStrNot);
1266
- }
1267
- UnityPrint(trait_names[trait_index]);
1268
- UnityPrint(UnityStrWas);
1269
- #ifndef UNITY_EXCLUDE_FLOAT_PRINT
1270
- UnityPrintFloat(actual);
1271
- #else
1272
- if (should_be_trait)
1273
- {
1274
- UnityPrint(UnityStrNot);
1275
- }
1276
- UnityPrint(trait_names[trait_index]);
1277
- #endif
1278
- UnityAddMsgIfSpecified(msg);
1279
- UNITY_FAIL_AND_BAIL;
1280
- }
1281
- }
1282
-
1283
- #endif /* not UNITY_EXCLUDE_DOUBLE */
1284
-
1285
- /*-----------------------------------------------*/
1286
- void UnityAssertNumbersWithin(const UNITY_UINT delta,
1287
- const UNITY_INT expected,
1288
- const UNITY_INT actual,
1289
- const char* msg,
1290
- const UNITY_LINE_TYPE lineNumber,
1291
- const UNITY_DISPLAY_STYLE_T style)
1292
- {
1293
- RETURN_IF_FAIL_OR_IGNORE;
1294
-
1295
- if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
1296
- {
1297
- if (actual > expected)
1298
- {
1299
- Unity.CurrentTestFailed = (((UNITY_UINT)actual - (UNITY_UINT)expected) > delta);
1300
- }
1301
- else
1302
- {
1303
- Unity.CurrentTestFailed = (((UNITY_UINT)expected - (UNITY_UINT)actual) > delta);
1304
- }
1305
- }
1306
- else
1307
- {
1308
- if ((UNITY_UINT)actual > (UNITY_UINT)expected)
1309
- {
1310
- Unity.CurrentTestFailed = (((UNITY_UINT)actual - (UNITY_UINT)expected) > delta);
1311
- }
1312
- else
1313
- {
1314
- Unity.CurrentTestFailed = (((UNITY_UINT)expected - (UNITY_UINT)actual) > delta);
1315
- }
1316
- }
1317
-
1318
- if (Unity.CurrentTestFailed)
1319
- {
1320
- UnityTestResultsFailBegin(lineNumber);
1321
- UnityPrint(UnityStrDelta);
1322
- UnityPrintNumberByStyle((UNITY_INT)delta, style);
1323
- UnityPrint(UnityStrExpected);
1324
- UnityPrintNumberByStyle(expected, style);
1325
- UnityPrint(UnityStrWas);
1326
- UnityPrintNumberByStyle(actual, style);
1327
- UnityAddMsgIfSpecified(msg);
1328
- UNITY_FAIL_AND_BAIL;
1329
- }
1330
- }
1331
-
1332
- /*-----------------------------------------------*/
1333
- void UnityAssertNumbersArrayWithin(const UNITY_UINT delta,
1334
- UNITY_INTERNAL_PTR expected,
1335
- UNITY_INTERNAL_PTR actual,
1336
- const UNITY_UINT32 num_elements,
1337
- const char* msg,
1338
- const UNITY_LINE_TYPE lineNumber,
1339
- const UNITY_DISPLAY_STYLE_T style,
1340
- const UNITY_FLAGS_T flags)
1341
- {
1342
- UNITY_UINT32 elements = num_elements;
1343
- unsigned int length = style & 0xF;
1344
- unsigned int increment = 0;
1345
-
1346
- RETURN_IF_FAIL_OR_IGNORE;
1347
-
1348
- if (num_elements == 0)
1349
- {
1350
- UnityPrintPointlessAndBail();
1351
- }
1352
-
1353
- if (expected == actual)
1354
- {
1355
- return; /* Both are NULL or same pointer */
1356
- }
1357
-
1358
- if (UnityIsOneArrayNull(expected, actual, lineNumber, msg))
1359
- {
1360
- UNITY_FAIL_AND_BAIL;
1361
- }
1362
-
1363
- while ((elements > 0) && (elements--))
1364
- {
1365
- UNITY_INT expect_val;
1366
- UNITY_INT actual_val;
1367
-
1368
- switch (length)
1369
- {
1370
- case 1:
1371
- expect_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT8*)expected;
1372
- actual_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT8*)actual;
1373
- increment = sizeof(UNITY_INT8);
1374
- break;
1375
-
1376
- case 2:
1377
- expect_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT16*)expected;
1378
- actual_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT16*)actual;
1379
- increment = sizeof(UNITY_INT16);
1380
- break;
1381
-
1382
- #ifdef UNITY_SUPPORT_64
1383
- case 8:
1384
- expect_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT64*)expected;
1385
- actual_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT64*)actual;
1386
- increment = sizeof(UNITY_INT64);
1387
- break;
1388
- #endif
1389
-
1390
- default: /* default is length 4 bytes */
1391
- case 4:
1392
- expect_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT32*)expected;
1393
- actual_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT32*)actual;
1394
- increment = sizeof(UNITY_INT32);
1395
- length = 4;
1396
- break;
1397
- }
1398
-
1399
- if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
1400
- {
1401
- if (actual_val > expect_val)
1402
- {
1403
- Unity.CurrentTestFailed = (((UNITY_UINT)actual_val - (UNITY_UINT)expect_val) > delta);
1404
- }
1405
- else
1406
- {
1407
- Unity.CurrentTestFailed = (((UNITY_UINT)expect_val - (UNITY_UINT)actual_val) > delta);
1408
- }
1409
- }
1410
- else
1411
- {
1412
- if ((UNITY_UINT)actual_val > (UNITY_UINT)expect_val)
1413
- {
1414
- Unity.CurrentTestFailed = (((UNITY_UINT)actual_val - (UNITY_UINT)expect_val) > delta);
1415
- }
1416
- else
1417
- {
1418
- Unity.CurrentTestFailed = (((UNITY_UINT)expect_val - (UNITY_UINT)actual_val) > delta);
1419
- }
1420
- }
1421
-
1422
- if (Unity.CurrentTestFailed)
1423
- {
1424
- if ((style & UNITY_DISPLAY_RANGE_UINT) && (length < (UNITY_INT_WIDTH / 8)))
1425
- { /* For UINT, remove sign extension (padding 1's) from signed type casts above */
1426
- UNITY_INT mask = 1;
1427
- mask = (mask << 8 * length) - 1;
1428
- expect_val &= mask;
1429
- actual_val &= mask;
1430
- }
1431
- UnityTestResultsFailBegin(lineNumber);
1432
- UnityPrint(UnityStrDelta);
1433
- UnityPrintNumberByStyle((UNITY_INT)delta, style);
1434
- UnityPrint(UnityStrElement);
1435
- UnityPrintNumberUnsigned(num_elements - elements - 1);
1436
- UnityPrint(UnityStrExpected);
1437
- UnityPrintNumberByStyle(expect_val, style);
1438
- UnityPrint(UnityStrWas);
1439
- UnityPrintNumberByStyle(actual_val, style);
1440
- UnityAddMsgIfSpecified(msg);
1441
- UNITY_FAIL_AND_BAIL;
1442
- }
1443
- /* Walk through array by incrementing the pointers */
1444
- if (flags == UNITY_ARRAY_TO_ARRAY)
1445
- {
1446
- expected = (UNITY_INTERNAL_PTR)((const char*)expected + increment);
1447
- }
1448
- actual = (UNITY_INTERNAL_PTR)((const char*)actual + increment);
1449
- }
1450
- }
1451
-
1452
- /*-----------------------------------------------*/
1453
- void UnityAssertEqualString(const char* expected,
1454
- const char* actual,
1455
- const char* msg,
1456
- const UNITY_LINE_TYPE lineNumber)
1457
- {
1458
- UNITY_UINT32 i;
1459
-
1460
- RETURN_IF_FAIL_OR_IGNORE;
1461
-
1462
- /* if both pointers not null compare the strings */
1463
- if (expected && actual)
1464
- {
1465
- for (i = 0; expected[i] || actual[i]; i++)
1466
- {
1467
- if (expected[i] != actual[i])
1468
- {
1469
- Unity.CurrentTestFailed = 1;
1470
- break;
1471
- }
1472
- }
1473
- }
1474
- else
1475
- { /* handle case of one pointers being null (if both null, test should pass) */
1476
- if (expected != actual)
1477
- {
1478
- Unity.CurrentTestFailed = 1;
1479
- }
1480
- }
1481
-
1482
- if (Unity.CurrentTestFailed)
1483
- {
1484
- UnityTestResultsFailBegin(lineNumber);
1485
- UnityPrintExpectedAndActualStrings(expected, actual);
1486
- UnityAddMsgIfSpecified(msg);
1487
- UNITY_FAIL_AND_BAIL;
1488
- }
1489
- }
1490
-
1491
- /*-----------------------------------------------*/
1492
- void UnityAssertEqualStringLen(const char* expected,
1493
- const char* actual,
1494
- const UNITY_UINT32 length,
1495
- const char* msg,
1496
- const UNITY_LINE_TYPE lineNumber)
1497
- {
1498
- UNITY_UINT32 i;
1499
-
1500
- RETURN_IF_FAIL_OR_IGNORE;
1501
-
1502
- /* if both pointers not null compare the strings */
1503
- if (expected && actual)
1504
- {
1505
- for (i = 0; (i < length) && (expected[i] || actual[i]); i++)
1506
- {
1507
- if (expected[i] != actual[i])
1508
- {
1509
- Unity.CurrentTestFailed = 1;
1510
- break;
1511
- }
1512
- }
1513
- }
1514
- else
1515
- { /* handle case of one pointers being null (if both null, test should pass) */
1516
- if (expected != actual)
1517
- {
1518
- Unity.CurrentTestFailed = 1;
1519
- }
1520
- }
1521
-
1522
- if (Unity.CurrentTestFailed)
1523
- {
1524
- UnityTestResultsFailBegin(lineNumber);
1525
- UnityPrintExpectedAndActualStringsLen(expected, actual, length);
1526
- UnityAddMsgIfSpecified(msg);
1527
- UNITY_FAIL_AND_BAIL;
1528
- }
1529
- }
1530
-
1531
- /*-----------------------------------------------*/
1532
- void UnityAssertEqualStringArray(UNITY_INTERNAL_PTR expected,
1533
- const char** actual,
1534
- const UNITY_UINT32 num_elements,
1535
- const char* msg,
1536
- const UNITY_LINE_TYPE lineNumber,
1537
- const UNITY_FLAGS_T flags)
1538
- {
1539
- UNITY_UINT32 i = 0;
1540
- UNITY_UINT32 j = 0;
1541
- const char* expd = NULL;
1542
- const char* act = NULL;
1543
-
1544
- RETURN_IF_FAIL_OR_IGNORE;
1545
-
1546
- /* if no elements, it's an error */
1547
- if (num_elements == 0)
1548
- {
1549
- UnityPrintPointlessAndBail();
1550
- }
1551
-
1552
- if ((const void*)expected == (const void*)actual)
1553
- {
1554
- return; /* Both are NULL or same pointer */
1555
- }
1556
-
1557
- if (UnityIsOneArrayNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg))
1558
- {
1559
- UNITY_FAIL_AND_BAIL;
1560
- }
1561
-
1562
- if (flags != UNITY_ARRAY_TO_ARRAY)
1563
- {
1564
- expd = (const char*)expected;
1565
- }
1566
-
1567
- do
1568
- {
1569
- act = actual[j];
1570
- if (flags == UNITY_ARRAY_TO_ARRAY)
1571
- {
1572
- expd = ((const char* const*)expected)[j];
1573
- }
1574
-
1575
- /* if both pointers not null compare the strings */
1576
- if (expd && act)
1577
- {
1578
- for (i = 0; expd[i] || act[i]; i++)
1579
- {
1580
- if (expd[i] != act[i])
1581
- {
1582
- Unity.CurrentTestFailed = 1;
1583
- break;
1584
- }
1585
- }
1586
- }
1587
- else
1588
- { /* handle case of one pointers being null (if both null, test should pass) */
1589
- if (expd != act)
1590
- {
1591
- Unity.CurrentTestFailed = 1;
1592
- }
1593
- }
1594
-
1595
- if (Unity.CurrentTestFailed)
1596
- {
1597
- UnityTestResultsFailBegin(lineNumber);
1598
- if (num_elements > 1)
1599
- {
1600
- UnityPrint(UnityStrElement);
1601
- UnityPrintNumberUnsigned(j);
1602
- }
1603
- UnityPrintExpectedAndActualStrings(expd, act);
1604
- UnityAddMsgIfSpecified(msg);
1605
- UNITY_FAIL_AND_BAIL;
1606
- }
1607
- } while (++j < num_elements);
1608
- }
1609
-
1610
- /*-----------------------------------------------*/
1611
- void UnityAssertEqualMemory(UNITY_INTERNAL_PTR expected,
1612
- UNITY_INTERNAL_PTR actual,
1613
- const UNITY_UINT32 length,
1614
- const UNITY_UINT32 num_elements,
1615
- const char* msg,
1616
- const UNITY_LINE_TYPE lineNumber,
1617
- const UNITY_FLAGS_T flags)
1618
- {
1619
- UNITY_PTR_ATTRIBUTE const unsigned char* ptr_exp = (UNITY_PTR_ATTRIBUTE const unsigned char*)expected;
1620
- UNITY_PTR_ATTRIBUTE const unsigned char* ptr_act = (UNITY_PTR_ATTRIBUTE const unsigned char*)actual;
1621
- UNITY_UINT32 elements = num_elements;
1622
- UNITY_UINT32 bytes;
1623
-
1624
- RETURN_IF_FAIL_OR_IGNORE;
1625
-
1626
- if ((elements == 0) || (length == 0))
1627
- {
1628
- UnityPrintPointlessAndBail();
1629
- }
1630
-
1631
- if (expected == actual)
1632
- {
1633
- return; /* Both are NULL or same pointer */
1634
- }
1635
-
1636
- if (UnityIsOneArrayNull(expected, actual, lineNumber, msg))
1637
- {
1638
- UNITY_FAIL_AND_BAIL;
1639
- }
1640
-
1641
- while (elements--)
1642
- {
1643
- bytes = length;
1644
- while (bytes--)
1645
- {
1646
- if (*ptr_exp != *ptr_act)
1647
- {
1648
- UnityTestResultsFailBegin(lineNumber);
1649
- UnityPrint(UnityStrMemory);
1650
- if (num_elements > 1)
1651
- {
1652
- UnityPrint(UnityStrElement);
1653
- UnityPrintNumberUnsigned(num_elements - elements - 1);
1654
- }
1655
- UnityPrint(UnityStrByte);
1656
- UnityPrintNumberUnsigned(length - bytes - 1);
1657
- UnityPrint(UnityStrExpected);
1658
- UnityPrintNumberByStyle(*ptr_exp, UNITY_DISPLAY_STYLE_HEX8);
1659
- UnityPrint(UnityStrWas);
1660
- UnityPrintNumberByStyle(*ptr_act, UNITY_DISPLAY_STYLE_HEX8);
1661
- UnityAddMsgIfSpecified(msg);
1662
- UNITY_FAIL_AND_BAIL;
1663
- }
1664
- ptr_exp++;
1665
- ptr_act++;
1666
- }
1667
- if (flags == UNITY_ARRAY_TO_VAL)
1668
- {
1669
- ptr_exp = (UNITY_PTR_ATTRIBUTE const unsigned char*)expected;
1670
- }
1671
- }
1672
- }
1673
-
1674
- /*-----------------------------------------------*/
1675
-
1676
- static union
1677
- {
1678
- UNITY_INT8 i8;
1679
- UNITY_INT16 i16;
1680
- UNITY_INT32 i32;
1681
- #ifdef UNITY_SUPPORT_64
1682
- UNITY_INT64 i64;
1683
- #endif
1684
- #ifndef UNITY_EXCLUDE_FLOAT
1685
- float f;
1686
- #endif
1687
- #ifndef UNITY_EXCLUDE_DOUBLE
1688
- double d;
1689
- #endif
1690
- } UnityQuickCompare;
1691
-
1692
- UNITY_INTERNAL_PTR UnityNumToPtr(const UNITY_INT num, const UNITY_UINT8 size)
1693
- {
1694
- switch(size)
1695
- {
1696
- case 1:
1697
- UnityQuickCompare.i8 = (UNITY_INT8)num;
1698
- return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.i8);
1699
-
1700
- case 2:
1701
- UnityQuickCompare.i16 = (UNITY_INT16)num;
1702
- return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.i16);
1703
-
1704
- #ifdef UNITY_SUPPORT_64
1705
- case 8:
1706
- UnityQuickCompare.i64 = (UNITY_INT64)num;
1707
- return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.i64);
1708
- #endif
1709
-
1710
- default: /* 4 bytes */
1711
- UnityQuickCompare.i32 = (UNITY_INT32)num;
1712
- return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.i32);
1713
- }
1714
- }
1715
-
1716
- #ifndef UNITY_EXCLUDE_FLOAT
1717
- /*-----------------------------------------------*/
1718
- UNITY_INTERNAL_PTR UnityFloatToPtr(const float num)
1719
- {
1720
- UnityQuickCompare.f = num;
1721
- return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.f);
1722
- }
1723
- #endif
1724
-
1725
- #ifndef UNITY_EXCLUDE_DOUBLE
1726
- /*-----------------------------------------------*/
1727
- UNITY_INTERNAL_PTR UnityDoubleToPtr(const double num)
1728
- {
1729
- UnityQuickCompare.d = num;
1730
- return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.d);
1731
- }
1732
- #endif
1733
-
1734
- /*-----------------------------------------------
1735
- * Control Functions
1736
- *-----------------------------------------------*/
1737
-
1738
- /*-----------------------------------------------*/
1739
- void UnityFail(const char* msg, const UNITY_LINE_TYPE line)
1740
- {
1741
- RETURN_IF_FAIL_OR_IGNORE;
1742
-
1743
- UnityTestResultsBegin(Unity.TestFile, line);
1744
- UnityPrint(UnityStrFail);
1745
- if (msg != NULL)
1746
- {
1747
- UNITY_OUTPUT_CHAR(':');
1748
-
1749
- #ifndef UNITY_EXCLUDE_DETAILS
1750
- if (Unity.CurrentDetail1)
1751
- {
1752
- UnityPrint(UnityStrDetail1Name);
1753
- UnityPrint(Unity.CurrentDetail1);
1754
- if (Unity.CurrentDetail2)
1755
- {
1756
- UnityPrint(UnityStrDetail2Name);
1757
- UnityPrint(Unity.CurrentDetail2);
1758
- }
1759
- UnityPrint(UnityStrSpacer);
1760
- }
1761
- #endif
1762
- if (msg[0] != ' ')
1763
- {
1764
- UNITY_OUTPUT_CHAR(' ');
1765
- }
1766
- UnityPrint(msg);
1767
- }
1768
-
1769
- UNITY_FAIL_AND_BAIL;
1770
- }
1771
-
1772
- /*-----------------------------------------------*/
1773
- void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line)
1774
- {
1775
- RETURN_IF_FAIL_OR_IGNORE;
1776
-
1777
- UnityTestResultsBegin(Unity.TestFile, line);
1778
- UnityPrint(UnityStrIgnore);
1779
- if (msg != NULL)
1780
- {
1781
- UNITY_OUTPUT_CHAR(':');
1782
- UNITY_OUTPUT_CHAR(' ');
1783
- UnityPrint(msg);
1784
- }
1785
- UNITY_IGNORE_AND_BAIL;
1786
- }
1787
-
1788
- /*-----------------------------------------------*/
1789
- void UnityMessage(const char* msg, const UNITY_LINE_TYPE line)
1790
- {
1791
- UnityTestResultsBegin(Unity.TestFile, line);
1792
- UnityPrint("INFO");
1793
- if (msg != NULL)
1794
- {
1795
- UNITY_OUTPUT_CHAR(':');
1796
- UNITY_OUTPUT_CHAR(' ');
1797
- UnityPrint(msg);
1798
- }
1799
- UNITY_PRINT_EOL();
1800
- }
1801
-
1802
- /*-----------------------------------------------*/
1803
- void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum)
1804
- {
1805
- Unity.CurrentTestName = FuncName;
1806
- Unity.CurrentTestLineNumber = (UNITY_LINE_TYPE)FuncLineNum;
1807
- Unity.NumberOfTests++;
1808
- UNITY_CLR_DETAILS();
1809
- UNITY_EXEC_TIME_START();
1810
- if (TEST_PROTECT())
1811
- {
1812
- setUp();
1813
- Func();
1814
- }
1815
- if (TEST_PROTECT())
1816
- {
1817
- tearDown();
1818
- }
1819
- UNITY_EXEC_TIME_STOP();
1820
- UnityConcludeTest();
1821
- }
1822
-
1823
- /*-----------------------------------------------*/
1824
- void UnitySetTestFile(const char* filename)
1825
- {
1826
- Unity.TestFile = filename;
1827
- }
1828
-
1829
- /*-----------------------------------------------*/
1830
- void UnityBegin(const char* filename)
1831
- {
1832
- Unity.TestFile = filename;
1833
- Unity.CurrentTestName = NULL;
1834
- Unity.CurrentTestLineNumber = 0;
1835
- Unity.NumberOfTests = 0;
1836
- Unity.TestFailures = 0;
1837
- Unity.TestIgnores = 0;
1838
- Unity.CurrentTestFailed = 0;
1839
- Unity.CurrentTestIgnored = 0;
1840
-
1841
- UNITY_CLR_DETAILS();
1842
- UNITY_OUTPUT_START();
1843
- }
1844
-
1845
- /*-----------------------------------------------*/
1846
- int UnityEnd(void)
1847
- {
1848
- UNITY_PRINT_EOL();
1849
- UnityPrint(UnityStrBreaker);
1850
- UNITY_PRINT_EOL();
1851
- UnityPrintNumber((UNITY_INT)(Unity.NumberOfTests));
1852
- UnityPrint(UnityStrResultsTests);
1853
- UnityPrintNumber((UNITY_INT)(Unity.TestFailures));
1854
- UnityPrint(UnityStrResultsFailures);
1855
- UnityPrintNumber((UNITY_INT)(Unity.TestIgnores));
1856
- UnityPrint(UnityStrResultsIgnored);
1857
- UNITY_PRINT_EOL();
1858
- if (Unity.TestFailures == 0U)
1859
- {
1860
- UnityPrint(UnityStrOk);
1861
- }
1862
- else
1863
- {
1864
- UnityPrint(UnityStrFail);
1865
- #ifdef UNITY_DIFFERENTIATE_FINAL_FAIL
1866
- UNITY_OUTPUT_CHAR('E'); UNITY_OUTPUT_CHAR('D');
1867
- #endif
1868
- }
1869
- UNITY_PRINT_EOL();
1870
- UNITY_FLUSH_CALL();
1871
- UNITY_OUTPUT_COMPLETE();
1872
- return (int)(Unity.TestFailures);
1873
- }
1874
-
1875
- /*-----------------------------------------------
1876
- * Command Line Argument Support
1877
- *-----------------------------------------------*/
1878
- #ifdef UNITY_USE_COMMAND_LINE_ARGS
1879
-
1880
- char* UnityOptionIncludeNamed = NULL;
1881
- char* UnityOptionExcludeNamed = NULL;
1882
- int UnityVerbosity = 1;
1883
-
1884
- /*-----------------------------------------------*/
1885
- int UnityParseOptions(int argc, char** argv)
1886
- {
1887
- int i;
1888
- UnityOptionIncludeNamed = NULL;
1889
- UnityOptionExcludeNamed = NULL;
1890
-
1891
- for (i = 1; i < argc; i++)
1892
- {
1893
- if (argv[i][0] == '-')
1894
- {
1895
- switch (argv[i][1])
1896
- {
1897
- case 'l': /* list tests */
1898
- return -1;
1899
- case 'n': /* include tests with name including this string */
1900
- case 'f': /* an alias for -n */
1901
- if (argv[i][2] == '=')
1902
- {
1903
- UnityOptionIncludeNamed = &argv[i][3];
1904
- }
1905
- else if (++i < argc)
1906
- {
1907
- UnityOptionIncludeNamed = argv[i];
1908
- }
1909
- else
1910
- {
1911
- UnityPrint("ERROR: No Test String to Include Matches For");
1912
- UNITY_PRINT_EOL();
1913
- return 1;
1914
- }
1915
- break;
1916
- case 'q': /* quiet */
1917
- UnityVerbosity = 0;
1918
- break;
1919
- case 'v': /* verbose */
1920
- UnityVerbosity = 2;
1921
- break;
1922
- case 'x': /* exclude tests with name including this string */
1923
- if (argv[i][2] == '=')
1924
- {
1925
- UnityOptionExcludeNamed = &argv[i][3];
1926
- }
1927
- else if (++i < argc)
1928
- {
1929
- UnityOptionExcludeNamed = argv[i];
1930
- }
1931
- else
1932
- {
1933
- UnityPrint("ERROR: No Test String to Exclude Matches For");
1934
- UNITY_PRINT_EOL();
1935
- return 1;
1936
- }
1937
- break;
1938
- default:
1939
- UnityPrint("ERROR: Unknown Option ");
1940
- UNITY_OUTPUT_CHAR(argv[i][1]);
1941
- UNITY_PRINT_EOL();
1942
- return 1;
1943
- }
1944
- }
1945
- }
1946
-
1947
- return 0;
1948
- }
1949
-
1950
- /*-----------------------------------------------*/
1951
- int IsStringInBiggerString(const char* longstring, const char* shortstring)
1952
- {
1953
- const char* lptr = longstring;
1954
- const char* sptr = shortstring;
1955
- const char* lnext = lptr;
1956
-
1957
- if (*sptr == '*')
1958
- {
1959
- return 1;
1960
- }
1961
-
1962
- while (*lptr)
1963
- {
1964
- lnext = lptr + 1;
1965
-
1966
- /* If they current bytes match, go on to the next bytes */
1967
- while (*lptr && *sptr && (*lptr == *sptr))
1968
- {
1969
- lptr++;
1970
- sptr++;
1971
-
1972
- /* We're done if we match the entire string or up to a wildcard */
1973
- if (*sptr == '*')
1974
- return 1;
1975
- if (*sptr == ',')
1976
- return 1;
1977
- if (*sptr == '"')
1978
- return 1;
1979
- if (*sptr == '\'')
1980
- return 1;
1981
- if (*sptr == ':')
1982
- return 2;
1983
- if (*sptr == 0)
1984
- return 1;
1985
- }
1986
-
1987
- /* Otherwise we start in the long pointer 1 character further and try again */
1988
- lptr = lnext;
1989
- sptr = shortstring;
1990
- }
1991
-
1992
- return 0;
1993
- }
1994
-
1995
- /*-----------------------------------------------*/
1996
- int UnityStringArgumentMatches(const char* str)
1997
- {
1998
- int retval;
1999
- const char* ptr1;
2000
- const char* ptr2;
2001
- const char* ptrf;
2002
-
2003
- /* Go through the options and get the substrings for matching one at a time */
2004
- ptr1 = str;
2005
- while (ptr1[0] != 0)
2006
- {
2007
- if ((ptr1[0] == '"') || (ptr1[0] == '\''))
2008
- {
2009
- ptr1++;
2010
- }
2011
-
2012
- /* look for the start of the next partial */
2013
- ptr2 = ptr1;
2014
- ptrf = 0;
2015
- do
2016
- {
2017
- ptr2++;
2018
- if ((ptr2[0] == ':') && (ptr2[1] != 0) && (ptr2[0] != '\'') && (ptr2[0] != '"') && (ptr2[0] != ','))
2019
- {
2020
- ptrf = &ptr2[1];
2021
- }
2022
- } while ((ptr2[0] != 0) && (ptr2[0] != '\'') && (ptr2[0] != '"') && (ptr2[0] != ','));
2023
-
2024
- while ((ptr2[0] != 0) && ((ptr2[0] == ':') || (ptr2[0] == '\'') || (ptr2[0] == '"') || (ptr2[0] == ',')))
2025
- {
2026
- ptr2++;
2027
- }
2028
-
2029
- /* done if complete filename match */
2030
- retval = IsStringInBiggerString(Unity.TestFile, ptr1);
2031
- if (retval == 1)
2032
- {
2033
- return retval;
2034
- }
2035
-
2036
- /* done if testname match after filename partial match */
2037
- if ((retval == 2) && (ptrf != 0))
2038
- {
2039
- if (IsStringInBiggerString(Unity.CurrentTestName, ptrf))
2040
- {
2041
- return 1;
2042
- }
2043
- }
2044
-
2045
- /* done if complete testname match */
2046
- if (IsStringInBiggerString(Unity.CurrentTestName, ptr1) == 1)
2047
- {
2048
- return 1;
2049
- }
2050
-
2051
- ptr1 = ptr2;
2052
- }
2053
-
2054
- /* we couldn't find a match for any substrings */
2055
- return 0;
2056
- }
2057
-
2058
- /*-----------------------------------------------*/
2059
- int UnityTestMatches(void)
2060
- {
2061
- /* Check if this test name matches the included test pattern */
2062
- int retval;
2063
- if (UnityOptionIncludeNamed)
2064
- {
2065
- retval = UnityStringArgumentMatches(UnityOptionIncludeNamed);
2066
- }
2067
- else
2068
- {
2069
- retval = 1;
2070
- }
2071
-
2072
- /* Check if this test name matches the excluded test pattern */
2073
- if (UnityOptionExcludeNamed)
2074
- {
2075
- if (UnityStringArgumentMatches(UnityOptionExcludeNamed))
2076
- {
2077
- retval = 0;
2078
- }
2079
- }
2080
-
2081
- return retval;
2082
- }
2083
-
2084
- #endif /* UNITY_USE_COMMAND_LINE_ARGS */
2085
- /*-----------------------------------------------*/
1
+ /* =========================================================================
2
+ Unity Project - A Test Framework for C
3
+ Copyright (c) 2007-19 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 <stddef.h>
9
+
10
+ #ifdef AVR
11
+ #include <avr/pgmspace.h>
12
+ #else
13
+ #define PROGMEM
14
+ #endif
15
+
16
+ /* If omitted from header, declare overrideable prototypes here so they're ready for use */
17
+ #ifdef UNITY_OMIT_OUTPUT_CHAR_HEADER_DECLARATION
18
+ void UNITY_OUTPUT_CHAR(int);
19
+ #endif
20
+
21
+ /* Helpful macros for us to use here in Assert functions */
22
+ #define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; UNITY_OUTPUT_FLUSH(); TEST_ABORT(); }
23
+ #define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; UNITY_OUTPUT_FLUSH(); TEST_ABORT(); }
24
+ #define RETURN_IF_FAIL_OR_IGNORE if (Unity.CurrentTestFailed || Unity.CurrentTestIgnored) TEST_ABORT()
25
+
26
+ struct UNITY_STORAGE_T Unity;
27
+
28
+ #ifdef UNITY_OUTPUT_COLOR
29
+ const char PROGMEM UnityStrOk[] = "\033[42mOK\033[00m";
30
+ const char PROGMEM UnityStrPass[] = "\033[42mPASS\033[00m";
31
+ const char PROGMEM UnityStrFail[] = "\033[41mFAIL\033[00m";
32
+ const char PROGMEM UnityStrIgnore[] = "\033[43mIGNORE\033[00m";
33
+ #else
34
+ const char PROGMEM UnityStrOk[] = "OK";
35
+ const char PROGMEM UnityStrPass[] = "PASS";
36
+ const char PROGMEM UnityStrFail[] = "FAIL";
37
+ const char PROGMEM UnityStrIgnore[] = "IGNORE";
38
+ #endif
39
+ static const char PROGMEM UnityStrNull[] = "NULL";
40
+ static const char PROGMEM UnityStrSpacer[] = ". ";
41
+ static const char PROGMEM UnityStrExpected[] = " Expected ";
42
+ static const char PROGMEM UnityStrWas[] = " Was ";
43
+ static const char PROGMEM UnityStrGt[] = " to be greater than ";
44
+ static const char PROGMEM UnityStrLt[] = " to be less than ";
45
+ static const char PROGMEM UnityStrOrEqual[] = "or equal to ";
46
+ static const char PROGMEM UnityStrNotEqual[] = " to be not equal to ";
47
+ static const char PROGMEM UnityStrElement[] = " Element ";
48
+ static const char PROGMEM UnityStrByte[] = " Byte ";
49
+ static const char PROGMEM UnityStrMemory[] = " Memory Mismatch.";
50
+ static const char PROGMEM UnityStrDelta[] = " Values Not Within Delta ";
51
+ static const char PROGMEM UnityStrPointless[] = " You Asked Me To Compare Nothing, Which Was Pointless.";
52
+ static const char PROGMEM UnityStrNullPointerForExpected[] = " Expected pointer to be NULL";
53
+ static const char PROGMEM UnityStrNullPointerForActual[] = " Actual pointer was NULL";
54
+ #ifndef UNITY_EXCLUDE_FLOAT
55
+ static const char PROGMEM UnityStrNot[] = "Not ";
56
+ static const char PROGMEM UnityStrInf[] = "Infinity";
57
+ static const char PROGMEM UnityStrNegInf[] = "Negative Infinity";
58
+ static const char PROGMEM UnityStrNaN[] = "NaN";
59
+ static const char PROGMEM UnityStrDet[] = "Determinate";
60
+ static const char PROGMEM UnityStrInvalidFloatTrait[] = "Invalid Float Trait";
61
+ #endif
62
+ const char PROGMEM UnityStrErrShorthand[] = "Unity Shorthand Support Disabled";
63
+ const char PROGMEM UnityStrErrFloat[] = "Unity Floating Point Disabled";
64
+ const char PROGMEM UnityStrErrDouble[] = "Unity Double Precision Disabled";
65
+ const char PROGMEM UnityStrErr64[] = "Unity 64-bit Support Disabled";
66
+ static const char PROGMEM UnityStrBreaker[] = "-----------------------";
67
+ static const char PROGMEM UnityStrResultsTests[] = " Tests ";
68
+ static const char PROGMEM UnityStrResultsFailures[] = " Failures ";
69
+ static const char PROGMEM UnityStrResultsIgnored[] = " Ignored ";
70
+ static const char PROGMEM UnityStrDetail1Name[] = UNITY_DETAIL1_NAME " ";
71
+ static const char PROGMEM UnityStrDetail2Name[] = " " UNITY_DETAIL2_NAME " ";
72
+
73
+ /*-----------------------------------------------
74
+ * Pretty Printers & Test Result Output Handlers
75
+ *-----------------------------------------------*/
76
+
77
+ /*-----------------------------------------------*/
78
+ /* Local helper function to print characters. */
79
+ static void UnityPrintChar(const char* pch)
80
+ {
81
+ /* printable characters plus CR & LF are printed */
82
+ if ((*pch <= 126) && (*pch >= 32))
83
+ {
84
+ UNITY_OUTPUT_CHAR(*pch);
85
+ }
86
+ /* write escaped carriage returns */
87
+ else if (*pch == 13)
88
+ {
89
+ UNITY_OUTPUT_CHAR('\\');
90
+ UNITY_OUTPUT_CHAR('r');
91
+ }
92
+ /* write escaped line feeds */
93
+ else if (*pch == 10)
94
+ {
95
+ UNITY_OUTPUT_CHAR('\\');
96
+ UNITY_OUTPUT_CHAR('n');
97
+ }
98
+ /* unprintable characters are shown as codes */
99
+ else
100
+ {
101
+ UNITY_OUTPUT_CHAR('\\');
102
+ UNITY_OUTPUT_CHAR('x');
103
+ UnityPrintNumberHex((UNITY_UINT)*pch, 2);
104
+ }
105
+ }
106
+
107
+ /*-----------------------------------------------*/
108
+ /* Local helper function to print ANSI escape strings e.g. "\033[42m". */
109
+ #ifdef UNITY_OUTPUT_COLOR
110
+ static UNITY_UINT UnityPrintAnsiEscapeString(const char* string)
111
+ {
112
+ const char* pch = string;
113
+ UNITY_UINT count = 0;
114
+
115
+ while (*pch && (*pch != 'm'))
116
+ {
117
+ UNITY_OUTPUT_CHAR(*pch);
118
+ pch++;
119
+ count++;
120
+ }
121
+ UNITY_OUTPUT_CHAR('m');
122
+ count++;
123
+
124
+ return count;
125
+ }
126
+ #endif
127
+
128
+ /*-----------------------------------------------*/
129
+ void UnityPrint(const char* string)
130
+ {
131
+ const char* pch = string;
132
+
133
+ if (pch != NULL)
134
+ {
135
+ while (*pch)
136
+ {
137
+ #ifdef UNITY_OUTPUT_COLOR
138
+ /* print ANSI escape code */
139
+ if ((*pch == 27) && (*(pch + 1) == '['))
140
+ {
141
+ pch += UnityPrintAnsiEscapeString(pch);
142
+ continue;
143
+ }
144
+ #endif
145
+ UnityPrintChar(pch);
146
+ pch++;
147
+ }
148
+ }
149
+ }
150
+ /*-----------------------------------------------*/
151
+ void UnityPrintLen(const char* string, const UNITY_UINT32 length)
152
+ {
153
+ const char* pch = string;
154
+
155
+ if (pch != NULL)
156
+ {
157
+ while (*pch && ((UNITY_UINT32)(pch - string) < length))
158
+ {
159
+ /* printable characters plus CR & LF are printed */
160
+ if ((*pch <= 126) && (*pch >= 32))
161
+ {
162
+ UNITY_OUTPUT_CHAR(*pch);
163
+ }
164
+ /* write escaped carriage returns */
165
+ else if (*pch == 13)
166
+ {
167
+ UNITY_OUTPUT_CHAR('\\');
168
+ UNITY_OUTPUT_CHAR('r');
169
+ }
170
+ /* write escaped line feeds */
171
+ else if (*pch == 10)
172
+ {
173
+ UNITY_OUTPUT_CHAR('\\');
174
+ UNITY_OUTPUT_CHAR('n');
175
+ }
176
+ /* unprintable characters are shown as codes */
177
+ else
178
+ {
179
+ UNITY_OUTPUT_CHAR('\\');
180
+ UNITY_OUTPUT_CHAR('x');
181
+ UnityPrintNumberHex((UNITY_UINT)*pch, 2);
182
+ }
183
+ pch++;
184
+ }
185
+ }
186
+ }
187
+
188
+ /*-----------------------------------------------*/
189
+ void UnityPrintNumberByStyle(const UNITY_INT number, const UNITY_DISPLAY_STYLE_T style)
190
+ {
191
+ if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
192
+ {
193
+ if (style == UNITY_DISPLAY_STYLE_CHAR)
194
+ {
195
+ /* printable characters plus CR & LF are printed */
196
+ UNITY_OUTPUT_CHAR('\'');
197
+ if ((number <= 126) && (number >= 32))
198
+ {
199
+ UNITY_OUTPUT_CHAR((int)number);
200
+ }
201
+ /* write escaped carriage returns */
202
+ else if (number == 13)
203
+ {
204
+ UNITY_OUTPUT_CHAR('\\');
205
+ UNITY_OUTPUT_CHAR('r');
206
+ }
207
+ /* write escaped line feeds */
208
+ else if (number == 10)
209
+ {
210
+ UNITY_OUTPUT_CHAR('\\');
211
+ UNITY_OUTPUT_CHAR('n');
212
+ }
213
+ /* unprintable characters are shown as codes */
214
+ else
215
+ {
216
+ UNITY_OUTPUT_CHAR('\\');
217
+ UNITY_OUTPUT_CHAR('x');
218
+ UnityPrintNumberHex((UNITY_UINT)number, 2);
219
+ }
220
+ UNITY_OUTPUT_CHAR('\'');
221
+ }
222
+ else
223
+ {
224
+ UnityPrintNumber(number);
225
+ }
226
+ }
227
+ else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT)
228
+ {
229
+ UnityPrintNumberUnsigned((UNITY_UINT)number);
230
+ }
231
+ else
232
+ {
233
+ UNITY_OUTPUT_CHAR('0');
234
+ UNITY_OUTPUT_CHAR('x');
235
+ UnityPrintNumberHex((UNITY_UINT)number, (char)((style & 0xF) * 2));
236
+ }
237
+ }
238
+
239
+ /*-----------------------------------------------*/
240
+ void UnityPrintNumber(const UNITY_INT number_to_print)
241
+ {
242
+ UNITY_UINT number = (UNITY_UINT)number_to_print;
243
+
244
+ if (number_to_print < 0)
245
+ {
246
+ /* A negative number, including MIN negative */
247
+ UNITY_OUTPUT_CHAR('-');
248
+ number = (~number) + 1;
249
+ }
250
+ UnityPrintNumberUnsigned(number);
251
+ }
252
+
253
+ /*-----------------------------------------------
254
+ * basically do an itoa using as little ram as possible */
255
+ void UnityPrintNumberUnsigned(const UNITY_UINT number)
256
+ {
257
+ UNITY_UINT divisor = 1;
258
+
259
+ /* figure out initial divisor */
260
+ while (number / divisor > 9)
261
+ {
262
+ divisor *= 10;
263
+ }
264
+
265
+ /* now mod and print, then divide divisor */
266
+ do
267
+ {
268
+ UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10)));
269
+ divisor /= 10;
270
+ } while (divisor > 0);
271
+ }
272
+
273
+ /*-----------------------------------------------*/
274
+ void UnityPrintNumberHex(const UNITY_UINT number, const char nibbles_to_print)
275
+ {
276
+ int nibble;
277
+ char nibbles = nibbles_to_print;
278
+
279
+ if ((unsigned)nibbles > UNITY_MAX_NIBBLES)
280
+ {
281
+ nibbles = UNITY_MAX_NIBBLES;
282
+ }
283
+
284
+ while (nibbles > 0)
285
+ {
286
+ nibbles--;
287
+ nibble = (int)(number >> (nibbles * 4)) & 0x0F;
288
+ if (nibble <= 9)
289
+ {
290
+ UNITY_OUTPUT_CHAR((char)('0' + nibble));
291
+ }
292
+ else
293
+ {
294
+ UNITY_OUTPUT_CHAR((char)('A' - 10 + nibble));
295
+ }
296
+ }
297
+ }
298
+
299
+ /*-----------------------------------------------*/
300
+ void UnityPrintMask(const UNITY_UINT mask, const UNITY_UINT number)
301
+ {
302
+ UNITY_UINT current_bit = (UNITY_UINT)1 << (UNITY_INT_WIDTH - 1);
303
+ UNITY_INT32 i;
304
+
305
+ for (i = 0; i < UNITY_INT_WIDTH; i++)
306
+ {
307
+ if (current_bit & mask)
308
+ {
309
+ if (current_bit & number)
310
+ {
311
+ UNITY_OUTPUT_CHAR('1');
312
+ }
313
+ else
314
+ {
315
+ UNITY_OUTPUT_CHAR('0');
316
+ }
317
+ }
318
+ else
319
+ {
320
+ UNITY_OUTPUT_CHAR('X');
321
+ }
322
+ current_bit = current_bit >> 1;
323
+ }
324
+ }
325
+
326
+ /*-----------------------------------------------*/
327
+ #ifndef UNITY_EXCLUDE_FLOAT_PRINT
328
+ /*
329
+ * This function prints a floating-point value in a format similar to
330
+ * printf("%.7g") on a single-precision machine or printf("%.9g") on a
331
+ * double-precision machine. The 7th digit won't always be totally correct
332
+ * in single-precision operation (for that level of accuracy, a more
333
+ * complicated algorithm would be needed).
334
+ */
335
+ void UnityPrintFloat(const UNITY_DOUBLE input_number)
336
+ {
337
+ #ifdef UNITY_INCLUDE_DOUBLE
338
+ static const int sig_digits = 9;
339
+ static const UNITY_INT32 min_scaled = 100000000;
340
+ static const UNITY_INT32 max_scaled = 1000000000;
341
+ #else
342
+ static const int sig_digits = 7;
343
+ static const UNITY_INT32 min_scaled = 1000000;
344
+ static const UNITY_INT32 max_scaled = 10000000;
345
+ #endif
346
+
347
+ UNITY_DOUBLE number = input_number;
348
+
349
+ /* print minus sign (does not handle negative zero) */
350
+ if (number < 0.0f)
351
+ {
352
+ UNITY_OUTPUT_CHAR('-');
353
+ number = -number;
354
+ }
355
+
356
+ /* handle zero, NaN, and +/- infinity */
357
+ if (number == 0.0f)
358
+ {
359
+ UnityPrint("0");
360
+ }
361
+ else if (isnan(number))
362
+ {
363
+ UnityPrint("nan");
364
+ }
365
+ else if (isinf(number))
366
+ {
367
+ UnityPrint("inf");
368
+ }
369
+ else
370
+ {
371
+ UNITY_INT32 n_int = 0, n;
372
+ int exponent = 0;
373
+ int decimals, digits;
374
+ char buf[16] = {0};
375
+
376
+ /*
377
+ * Scale up or down by powers of 10. To minimize rounding error,
378
+ * start with a factor/divisor of 10^10, which is the largest
379
+ * power of 10 that can be represented exactly. Finally, compute
380
+ * (exactly) the remaining power of 10 and perform one more
381
+ * multiplication or division.
382
+ */
383
+ if (number < 1.0f)
384
+ {
385
+ UNITY_DOUBLE factor = 1.0f;
386
+
387
+ while (number < (UNITY_DOUBLE)max_scaled / 1e10f) { number *= 1e10f; exponent -= 10; }
388
+ while (number * factor < (UNITY_DOUBLE)min_scaled) { factor *= 10.0f; exponent--; }
389
+
390
+ number *= factor;
391
+ }
392
+ else if (number > (UNITY_DOUBLE)max_scaled)
393
+ {
394
+ UNITY_DOUBLE divisor = 1.0f;
395
+
396
+ while (number > (UNITY_DOUBLE)min_scaled * 1e10f) { number /= 1e10f; exponent += 10; }
397
+ while (number / divisor > (UNITY_DOUBLE)max_scaled) { divisor *= 10.0f; exponent++; }
398
+
399
+ number /= divisor;
400
+ }
401
+ else
402
+ {
403
+ /*
404
+ * In this range, we can split off the integer part before
405
+ * doing any multiplications. This reduces rounding error by
406
+ * freeing up significant bits in the fractional part.
407
+ */
408
+ UNITY_DOUBLE factor = 1.0f;
409
+ n_int = (UNITY_INT32)number;
410
+ number -= (UNITY_DOUBLE)n_int;
411
+
412
+ while (n_int < min_scaled) { n_int *= 10; factor *= 10.0f; exponent--; }
413
+
414
+ number *= factor;
415
+ }
416
+
417
+ /* round to nearest integer */
418
+ n = ((UNITY_INT32)(number + number) + 1) / 2;
419
+
420
+ #ifndef UNITY_ROUND_TIES_AWAY_FROM_ZERO
421
+ /* round to even if exactly between two integers */
422
+ if ((n & 1) && (((UNITY_DOUBLE)n - number) == 0.5f))
423
+ n--;
424
+ #endif
425
+
426
+ n += n_int;
427
+
428
+ if (n >= max_scaled)
429
+ {
430
+ n = min_scaled;
431
+ exponent++;
432
+ }
433
+
434
+ /* determine where to place decimal point */
435
+ decimals = ((exponent <= 0) && (exponent >= -(sig_digits + 3))) ? (-exponent) : (sig_digits - 1);
436
+ exponent += decimals;
437
+
438
+ /* truncate trailing zeroes after decimal point */
439
+ while ((decimals > 0) && ((n % 10) == 0))
440
+ {
441
+ n /= 10;
442
+ decimals--;
443
+ }
444
+
445
+ /* build up buffer in reverse order */
446
+ digits = 0;
447
+ while ((n != 0) || (digits < (decimals + 1)))
448
+ {
449
+ buf[digits++] = (char)('0' + n % 10);
450
+ n /= 10;
451
+ }
452
+ while (digits > 0)
453
+ {
454
+ if (digits == decimals) { UNITY_OUTPUT_CHAR('.'); }
455
+ UNITY_OUTPUT_CHAR(buf[--digits]);
456
+ }
457
+
458
+ /* print exponent if needed */
459
+ if (exponent != 0)
460
+ {
461
+ UNITY_OUTPUT_CHAR('e');
462
+
463
+ if (exponent < 0)
464
+ {
465
+ UNITY_OUTPUT_CHAR('-');
466
+ exponent = -exponent;
467
+ }
468
+ else
469
+ {
470
+ UNITY_OUTPUT_CHAR('+');
471
+ }
472
+
473
+ digits = 0;
474
+ while ((exponent != 0) || (digits < 2))
475
+ {
476
+ buf[digits++] = (char)('0' + exponent % 10);
477
+ exponent /= 10;
478
+ }
479
+ while (digits > 0)
480
+ {
481
+ UNITY_OUTPUT_CHAR(buf[--digits]);
482
+ }
483
+ }
484
+ }
485
+ }
486
+ #endif /* ! UNITY_EXCLUDE_FLOAT_PRINT */
487
+
488
+ /*-----------------------------------------------*/
489
+ static void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line)
490
+ {
491
+ #ifdef UNITY_OUTPUT_FOR_ECLIPSE
492
+ UNITY_OUTPUT_CHAR('(');
493
+ UnityPrint(file);
494
+ UNITY_OUTPUT_CHAR(':');
495
+ UnityPrintNumber((UNITY_INT)line);
496
+ UNITY_OUTPUT_CHAR(')');
497
+ UNITY_OUTPUT_CHAR(' ');
498
+ UnityPrint(Unity.CurrentTestName);
499
+ UNITY_OUTPUT_CHAR(':');
500
+ #else
501
+ #ifdef UNITY_OUTPUT_FOR_IAR_WORKBENCH
502
+ UnityPrint("<SRCREF line=");
503
+ UnityPrintNumber((UNITY_INT)line);
504
+ UnityPrint(" file=\"");
505
+ UnityPrint(file);
506
+ UNITY_OUTPUT_CHAR('"');
507
+ UNITY_OUTPUT_CHAR('>');
508
+ UnityPrint(Unity.CurrentTestName);
509
+ UnityPrint("</SRCREF> ");
510
+ #else
511
+ #ifdef UNITY_OUTPUT_FOR_QT_CREATOR
512
+ UnityPrint("file://");
513
+ UnityPrint(file);
514
+ UNITY_OUTPUT_CHAR(':');
515
+ UnityPrintNumber((UNITY_INT)line);
516
+ UNITY_OUTPUT_CHAR(' ');
517
+ UnityPrint(Unity.CurrentTestName);
518
+ UNITY_OUTPUT_CHAR(':');
519
+ #else
520
+ UnityPrint(file);
521
+ UNITY_OUTPUT_CHAR(':');
522
+ UnityPrintNumber((UNITY_INT)line);
523
+ UNITY_OUTPUT_CHAR(':');
524
+ UnityPrint(Unity.CurrentTestName);
525
+ UNITY_OUTPUT_CHAR(':');
526
+ #endif
527
+ #endif
528
+ #endif
529
+ }
530
+
531
+ /*-----------------------------------------------*/
532
+ static void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line)
533
+ {
534
+ UnityTestResultsBegin(Unity.TestFile, line);
535
+ UnityPrint(UnityStrFail);
536
+ UNITY_OUTPUT_CHAR(':');
537
+ }
538
+
539
+ /*-----------------------------------------------*/
540
+ void UnityConcludeTest(void)
541
+ {
542
+ if (Unity.CurrentTestIgnored)
543
+ {
544
+ Unity.TestIgnores++;
545
+ }
546
+ else if (!Unity.CurrentTestFailed)
547
+ {
548
+ UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber);
549
+ UnityPrint(UnityStrPass);
550
+ }
551
+ else
552
+ {
553
+ Unity.TestFailures++;
554
+ }
555
+
556
+ Unity.CurrentTestFailed = 0;
557
+ Unity.CurrentTestIgnored = 0;
558
+ UNITY_PRINT_EXEC_TIME();
559
+ UNITY_PRINT_EOL();
560
+ UNITY_FLUSH_CALL();
561
+ }
562
+
563
+ /*-----------------------------------------------*/
564
+ static void UnityAddMsgIfSpecified(const char* msg)
565
+ {
566
+ if (msg)
567
+ {
568
+ UnityPrint(UnityStrSpacer);
569
+
570
+ #ifdef UNITY_PRINT_TEST_CONTEXT
571
+ UNITY_PRINT_TEST_CONTEXT();
572
+ #endif
573
+ #ifndef UNITY_EXCLUDE_DETAILS
574
+ if (Unity.CurrentDetail1)
575
+ {
576
+ UnityPrint(UnityStrDetail1Name);
577
+ UnityPrint(Unity.CurrentDetail1);
578
+ if (Unity.CurrentDetail2)
579
+ {
580
+ UnityPrint(UnityStrDetail2Name);
581
+ UnityPrint(Unity.CurrentDetail2);
582
+ }
583
+ UnityPrint(UnityStrSpacer);
584
+ }
585
+ #endif
586
+ UnityPrint(msg);
587
+ }
588
+ }
589
+
590
+ /*-----------------------------------------------*/
591
+ static void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual)
592
+ {
593
+ UnityPrint(UnityStrExpected);
594
+ if (expected != NULL)
595
+ {
596
+ UNITY_OUTPUT_CHAR('\'');
597
+ UnityPrint(expected);
598
+ UNITY_OUTPUT_CHAR('\'');
599
+ }
600
+ else
601
+ {
602
+ UnityPrint(UnityStrNull);
603
+ }
604
+ UnityPrint(UnityStrWas);
605
+ if (actual != NULL)
606
+ {
607
+ UNITY_OUTPUT_CHAR('\'');
608
+ UnityPrint(actual);
609
+ UNITY_OUTPUT_CHAR('\'');
610
+ }
611
+ else
612
+ {
613
+ UnityPrint(UnityStrNull);
614
+ }
615
+ }
616
+
617
+ /*-----------------------------------------------*/
618
+ static void UnityPrintExpectedAndActualStringsLen(const char* expected,
619
+ const char* actual,
620
+ const UNITY_UINT32 length)
621
+ {
622
+ UnityPrint(UnityStrExpected);
623
+ if (expected != NULL)
624
+ {
625
+ UNITY_OUTPUT_CHAR('\'');
626
+ UnityPrintLen(expected, length);
627
+ UNITY_OUTPUT_CHAR('\'');
628
+ }
629
+ else
630
+ {
631
+ UnityPrint(UnityStrNull);
632
+ }
633
+ UnityPrint(UnityStrWas);
634
+ if (actual != NULL)
635
+ {
636
+ UNITY_OUTPUT_CHAR('\'');
637
+ UnityPrintLen(actual, length);
638
+ UNITY_OUTPUT_CHAR('\'');
639
+ }
640
+ else
641
+ {
642
+ UnityPrint(UnityStrNull);
643
+ }
644
+ }
645
+
646
+ /*-----------------------------------------------
647
+ * Assertion & Control Helpers
648
+ *-----------------------------------------------*/
649
+
650
+ /*-----------------------------------------------*/
651
+ static int UnityIsOneArrayNull(UNITY_INTERNAL_PTR expected,
652
+ UNITY_INTERNAL_PTR actual,
653
+ const UNITY_LINE_TYPE lineNumber,
654
+ const char* msg)
655
+ {
656
+ /* Both are NULL or same pointer */
657
+ if (expected == actual) { return 0; }
658
+
659
+ /* print and return true if just expected is NULL */
660
+ if (expected == NULL)
661
+ {
662
+ UnityTestResultsFailBegin(lineNumber);
663
+ UnityPrint(UnityStrNullPointerForExpected);
664
+ UnityAddMsgIfSpecified(msg);
665
+ return 1;
666
+ }
667
+
668
+ /* print and return true if just actual is NULL */
669
+ if (actual == NULL)
670
+ {
671
+ UnityTestResultsFailBegin(lineNumber);
672
+ UnityPrint(UnityStrNullPointerForActual);
673
+ UnityAddMsgIfSpecified(msg);
674
+ return 1;
675
+ }
676
+
677
+ return 0; /* return false if neither is NULL */
678
+ }
679
+
680
+ /*-----------------------------------------------
681
+ * Assertion Functions
682
+ *-----------------------------------------------*/
683
+
684
+ /*-----------------------------------------------*/
685
+ void UnityAssertBits(const UNITY_INT mask,
686
+ const UNITY_INT expected,
687
+ const UNITY_INT actual,
688
+ const char* msg,
689
+ const UNITY_LINE_TYPE lineNumber)
690
+ {
691
+ RETURN_IF_FAIL_OR_IGNORE;
692
+
693
+ if ((mask & expected) != (mask & actual))
694
+ {
695
+ UnityTestResultsFailBegin(lineNumber);
696
+ UnityPrint(UnityStrExpected);
697
+ UnityPrintMask((UNITY_UINT)mask, (UNITY_UINT)expected);
698
+ UnityPrint(UnityStrWas);
699
+ UnityPrintMask((UNITY_UINT)mask, (UNITY_UINT)actual);
700
+ UnityAddMsgIfSpecified(msg);
701
+ UNITY_FAIL_AND_BAIL;
702
+ }
703
+ }
704
+
705
+ /*-----------------------------------------------*/
706
+ void UnityAssertEqualNumber(const UNITY_INT expected,
707
+ const UNITY_INT actual,
708
+ const char* msg,
709
+ const UNITY_LINE_TYPE lineNumber,
710
+ const UNITY_DISPLAY_STYLE_T style)
711
+ {
712
+ RETURN_IF_FAIL_OR_IGNORE;
713
+
714
+ if (expected != actual)
715
+ {
716
+ UnityTestResultsFailBegin(lineNumber);
717
+ UnityPrint(UnityStrExpected);
718
+ UnityPrintNumberByStyle(expected, style);
719
+ UnityPrint(UnityStrWas);
720
+ UnityPrintNumberByStyle(actual, style);
721
+ UnityAddMsgIfSpecified(msg);
722
+ UNITY_FAIL_AND_BAIL;
723
+ }
724
+ }
725
+
726
+ /*-----------------------------------------------*/
727
+ void UnityAssertGreaterOrLessOrEqualNumber(const UNITY_INT threshold,
728
+ const UNITY_INT actual,
729
+ const UNITY_COMPARISON_T compare,
730
+ const char *msg,
731
+ const UNITY_LINE_TYPE lineNumber,
732
+ const UNITY_DISPLAY_STYLE_T style)
733
+ {
734
+ int failed = 0;
735
+ RETURN_IF_FAIL_OR_IGNORE;
736
+
737
+ if ((threshold == actual) && (compare & UNITY_EQUAL_TO)) { return; }
738
+ if ((threshold == actual)) { failed = 1; }
739
+
740
+ if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
741
+ {
742
+ if ((actual > threshold) && (compare & UNITY_SMALLER_THAN)) { failed = 1; }
743
+ if ((actual < threshold) && (compare & UNITY_GREATER_THAN)) { failed = 1; }
744
+ }
745
+ else /* UINT or HEX */
746
+ {
747
+ if (((UNITY_UINT)actual > (UNITY_UINT)threshold) && (compare & UNITY_SMALLER_THAN)) { failed = 1; }
748
+ if (((UNITY_UINT)actual < (UNITY_UINT)threshold) && (compare & UNITY_GREATER_THAN)) { failed = 1; }
749
+ }
750
+
751
+ if (failed)
752
+ {
753
+ UnityTestResultsFailBegin(lineNumber);
754
+ UnityPrint(UnityStrExpected);
755
+ UnityPrintNumberByStyle(actual, style);
756
+ if (compare & UNITY_GREATER_THAN) { UnityPrint(UnityStrGt); }
757
+ if (compare & UNITY_SMALLER_THAN) { UnityPrint(UnityStrLt); }
758
+ if (compare & UNITY_EQUAL_TO) { UnityPrint(UnityStrOrEqual); }
759
+ if (compare == UNITY_NOT_EQUAL) { UnityPrint(UnityStrNotEqual); }
760
+ UnityPrintNumberByStyle(threshold, style);
761
+ UnityAddMsgIfSpecified(msg);
762
+ UNITY_FAIL_AND_BAIL;
763
+ }
764
+ }
765
+
766
+ #define UnityPrintPointlessAndBail() \
767
+ { \
768
+ UnityTestResultsFailBegin(lineNumber); \
769
+ UnityPrint(UnityStrPointless); \
770
+ UnityAddMsgIfSpecified(msg); \
771
+ UNITY_FAIL_AND_BAIL; }
772
+
773
+ /*-----------------------------------------------*/
774
+ void UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,
775
+ UNITY_INTERNAL_PTR actual,
776
+ const UNITY_UINT32 num_elements,
777
+ const char* msg,
778
+ const UNITY_LINE_TYPE lineNumber,
779
+ const UNITY_DISPLAY_STYLE_T style,
780
+ const UNITY_FLAGS_T flags)
781
+ {
782
+ UNITY_UINT32 elements = num_elements;
783
+ unsigned int length = style & 0xF;
784
+ unsigned int increment = 0;
785
+
786
+ RETURN_IF_FAIL_OR_IGNORE;
787
+
788
+ if (num_elements == 0)
789
+ {
790
+ UnityPrintPointlessAndBail();
791
+ }
792
+
793
+ if (expected == actual)
794
+ {
795
+ return; /* Both are NULL or same pointer */
796
+ }
797
+
798
+ if (UnityIsOneArrayNull(expected, actual, lineNumber, msg))
799
+ {
800
+ UNITY_FAIL_AND_BAIL;
801
+ }
802
+
803
+ while ((elements > 0) && (elements--))
804
+ {
805
+ UNITY_INT expect_val;
806
+ UNITY_INT actual_val;
807
+
808
+ switch (length)
809
+ {
810
+ case 1:
811
+ expect_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT8*)expected;
812
+ actual_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT8*)actual;
813
+ increment = sizeof(UNITY_INT8);
814
+ break;
815
+
816
+ case 2:
817
+ expect_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT16*)expected;
818
+ actual_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT16*)actual;
819
+ increment = sizeof(UNITY_INT16);
820
+ break;
821
+
822
+ #ifdef UNITY_SUPPORT_64
823
+ case 8:
824
+ expect_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT64*)expected;
825
+ actual_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT64*)actual;
826
+ increment = sizeof(UNITY_INT64);
827
+ break;
828
+ #endif
829
+
830
+ default: /* default is length 4 bytes */
831
+ case 4:
832
+ expect_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT32*)expected;
833
+ actual_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT32*)actual;
834
+ increment = sizeof(UNITY_INT32);
835
+ length = 4;
836
+ break;
837
+ }
838
+
839
+ if (expect_val != actual_val)
840
+ {
841
+ if ((style & UNITY_DISPLAY_RANGE_UINT) && (length < (UNITY_INT_WIDTH / 8)))
842
+ { /* For UINT, remove sign extension (padding 1's) from signed type casts above */
843
+ UNITY_INT mask = 1;
844
+ mask = (mask << 8 * length) - 1;
845
+ expect_val &= mask;
846
+ actual_val &= mask;
847
+ }
848
+ UnityTestResultsFailBegin(lineNumber);
849
+ UnityPrint(UnityStrElement);
850
+ UnityPrintNumberUnsigned(num_elements - elements - 1);
851
+ UnityPrint(UnityStrExpected);
852
+ UnityPrintNumberByStyle(expect_val, style);
853
+ UnityPrint(UnityStrWas);
854
+ UnityPrintNumberByStyle(actual_val, style);
855
+ UnityAddMsgIfSpecified(msg);
856
+ UNITY_FAIL_AND_BAIL;
857
+ }
858
+ /* Walk through array by incrementing the pointers */
859
+ if (flags == UNITY_ARRAY_TO_ARRAY)
860
+ {
861
+ expected = (UNITY_INTERNAL_PTR)((const char*)expected + increment);
862
+ }
863
+ actual = (UNITY_INTERNAL_PTR)((const char*)actual + increment);
864
+ }
865
+ }
866
+
867
+ /*-----------------------------------------------*/
868
+ #ifndef UNITY_EXCLUDE_FLOAT
869
+ /* Wrap this define in a function with variable types as float or double */
870
+ #define UNITY_FLOAT_OR_DOUBLE_WITHIN(delta, expected, actual, diff) \
871
+ if (isinf(expected) && isinf(actual) && (((expected) < 0) == ((actual) < 0))) return 1; \
872
+ if (UNITY_NAN_CHECK) return 1; \
873
+ (diff) = (actual) - (expected); \
874
+ if ((diff) < 0) (diff) = -(diff); \
875
+ if ((delta) < 0) (delta) = -(delta); \
876
+ return !(isnan(diff) || isinf(diff) || ((diff) > (delta)))
877
+ /* This first part of this condition will catch any NaN or Infinite values */
878
+ #ifndef UNITY_NAN_NOT_EQUAL_NAN
879
+ #define UNITY_NAN_CHECK isnan(expected) && isnan(actual)
880
+ #else
881
+ #define UNITY_NAN_CHECK 0
882
+ #endif
883
+
884
+ #ifndef UNITY_EXCLUDE_FLOAT_PRINT
885
+ #define UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT(expected, actual) \
886
+ { \
887
+ UnityPrint(UnityStrExpected); \
888
+ UnityPrintFloat(expected); \
889
+ UnityPrint(UnityStrWas); \
890
+ UnityPrintFloat(actual); }
891
+ #else
892
+ #define UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT(expected, actual) \
893
+ UnityPrint(UnityStrDelta)
894
+ #endif /* UNITY_EXCLUDE_FLOAT_PRINT */
895
+
896
+ /*-----------------------------------------------*/
897
+ static int UnityFloatsWithin(UNITY_FLOAT delta, UNITY_FLOAT expected, UNITY_FLOAT actual)
898
+ {
899
+ UNITY_FLOAT diff;
900
+ UNITY_FLOAT_OR_DOUBLE_WITHIN(delta, expected, actual, diff);
901
+ }
902
+
903
+ /*-----------------------------------------------*/
904
+ void UnityAssertEqualFloatArray(UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* expected,
905
+ UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* actual,
906
+ const UNITY_UINT32 num_elements,
907
+ const char* msg,
908
+ const UNITY_LINE_TYPE lineNumber,
909
+ const UNITY_FLAGS_T flags)
910
+ {
911
+ UNITY_UINT32 elements = num_elements;
912
+ UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* ptr_expected = expected;
913
+ UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* ptr_actual = actual;
914
+
915
+ RETURN_IF_FAIL_OR_IGNORE;
916
+
917
+ if (elements == 0)
918
+ {
919
+ UnityPrintPointlessAndBail();
920
+ }
921
+
922
+ if (expected == actual)
923
+ {
924
+ return; /* Both are NULL or same pointer */
925
+ }
926
+
927
+ if (UnityIsOneArrayNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg))
928
+ {
929
+ UNITY_FAIL_AND_BAIL;
930
+ }
931
+
932
+ while (elements--)
933
+ {
934
+ if (!UnityFloatsWithin(*ptr_expected * UNITY_FLOAT_PRECISION, *ptr_expected, *ptr_actual))
935
+ {
936
+ UnityTestResultsFailBegin(lineNumber);
937
+ UnityPrint(UnityStrElement);
938
+ UnityPrintNumberUnsigned(num_elements - elements - 1);
939
+ UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT((UNITY_DOUBLE)*ptr_expected, (UNITY_DOUBLE)*ptr_actual);
940
+ UnityAddMsgIfSpecified(msg);
941
+ UNITY_FAIL_AND_BAIL;
942
+ }
943
+ if (flags == UNITY_ARRAY_TO_ARRAY)
944
+ {
945
+ ptr_expected++;
946
+ }
947
+ ptr_actual++;
948
+ }
949
+ }
950
+
951
+ /*-----------------------------------------------*/
952
+ void UnityAssertFloatsWithin(const UNITY_FLOAT delta,
953
+ const UNITY_FLOAT expected,
954
+ const UNITY_FLOAT actual,
955
+ const char* msg,
956
+ const UNITY_LINE_TYPE lineNumber)
957
+ {
958
+ RETURN_IF_FAIL_OR_IGNORE;
959
+
960
+
961
+ if (!UnityFloatsWithin(delta, expected, actual))
962
+ {
963
+ UnityTestResultsFailBegin(lineNumber);
964
+ UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT((UNITY_DOUBLE)expected, (UNITY_DOUBLE)actual);
965
+ UnityAddMsgIfSpecified(msg);
966
+ UNITY_FAIL_AND_BAIL;
967
+ }
968
+ }
969
+
970
+ /*-----------------------------------------------*/
971
+ void UnityAssertFloatSpecial(const UNITY_FLOAT actual,
972
+ const char* msg,
973
+ const UNITY_LINE_TYPE lineNumber,
974
+ const UNITY_FLOAT_TRAIT_T style)
975
+ {
976
+ const char* trait_names[] = {UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet};
977
+ UNITY_INT should_be_trait = ((UNITY_INT)style & 1);
978
+ UNITY_INT is_trait = !should_be_trait;
979
+ UNITY_INT trait_index = (UNITY_INT)(style >> 1);
980
+
981
+ RETURN_IF_FAIL_OR_IGNORE;
982
+
983
+ switch (style)
984
+ {
985
+ case UNITY_FLOAT_IS_INF:
986
+ case UNITY_FLOAT_IS_NOT_INF:
987
+ is_trait = isinf(actual) && (actual > 0);
988
+ break;
989
+ case UNITY_FLOAT_IS_NEG_INF:
990
+ case UNITY_FLOAT_IS_NOT_NEG_INF:
991
+ is_trait = isinf(actual) && (actual < 0);
992
+ break;
993
+
994
+ case UNITY_FLOAT_IS_NAN:
995
+ case UNITY_FLOAT_IS_NOT_NAN:
996
+ is_trait = isnan(actual) ? 1 : 0;
997
+ break;
998
+
999
+ case UNITY_FLOAT_IS_DET: /* A determinate number is non infinite and not NaN. */
1000
+ case UNITY_FLOAT_IS_NOT_DET:
1001
+ is_trait = !isinf(actual) && !isnan(actual);
1002
+ break;
1003
+
1004
+ default:
1005
+ trait_index = 0;
1006
+ trait_names[0] = UnityStrInvalidFloatTrait;
1007
+ break;
1008
+ }
1009
+
1010
+ if (is_trait != should_be_trait)
1011
+ {
1012
+ UnityTestResultsFailBegin(lineNumber);
1013
+ UnityPrint(UnityStrExpected);
1014
+ if (!should_be_trait)
1015
+ {
1016
+ UnityPrint(UnityStrNot);
1017
+ }
1018
+ UnityPrint(trait_names[trait_index]);
1019
+ UnityPrint(UnityStrWas);
1020
+ #ifndef UNITY_EXCLUDE_FLOAT_PRINT
1021
+ UnityPrintFloat((UNITY_DOUBLE)actual);
1022
+ #else
1023
+ if (should_be_trait)
1024
+ {
1025
+ UnityPrint(UnityStrNot);
1026
+ }
1027
+ UnityPrint(trait_names[trait_index]);
1028
+ #endif
1029
+ UnityAddMsgIfSpecified(msg);
1030
+ UNITY_FAIL_AND_BAIL;
1031
+ }
1032
+ }
1033
+
1034
+ #endif /* not UNITY_EXCLUDE_FLOAT */
1035
+
1036
+ /*-----------------------------------------------*/
1037
+ #ifndef UNITY_EXCLUDE_DOUBLE
1038
+ static int UnityDoublesWithin(UNITY_DOUBLE delta, UNITY_DOUBLE expected, UNITY_DOUBLE actual)
1039
+ {
1040
+ UNITY_DOUBLE diff;
1041
+ UNITY_FLOAT_OR_DOUBLE_WITHIN(delta, expected, actual, diff);
1042
+ }
1043
+
1044
+ /*-----------------------------------------------*/
1045
+ void UnityAssertEqualDoubleArray(UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* expected,
1046
+ UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* actual,
1047
+ const UNITY_UINT32 num_elements,
1048
+ const char* msg,
1049
+ const UNITY_LINE_TYPE lineNumber,
1050
+ const UNITY_FLAGS_T flags)
1051
+ {
1052
+ UNITY_UINT32 elements = num_elements;
1053
+ UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* ptr_expected = expected;
1054
+ UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* ptr_actual = actual;
1055
+
1056
+ RETURN_IF_FAIL_OR_IGNORE;
1057
+
1058
+ if (elements == 0)
1059
+ {
1060
+ UnityPrintPointlessAndBail();
1061
+ }
1062
+
1063
+ if (expected == actual)
1064
+ {
1065
+ return; /* Both are NULL or same pointer */
1066
+ }
1067
+
1068
+ if (UnityIsOneArrayNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg))
1069
+ {
1070
+ UNITY_FAIL_AND_BAIL;
1071
+ }
1072
+
1073
+ while (elements--)
1074
+ {
1075
+ if (!UnityDoublesWithin(*ptr_expected * UNITY_DOUBLE_PRECISION, *ptr_expected, *ptr_actual))
1076
+ {
1077
+ UnityTestResultsFailBegin(lineNumber);
1078
+ UnityPrint(UnityStrElement);
1079
+ UnityPrintNumberUnsigned(num_elements - elements - 1);
1080
+ UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT(*ptr_expected, *ptr_actual);
1081
+ UnityAddMsgIfSpecified(msg);
1082
+ UNITY_FAIL_AND_BAIL;
1083
+ }
1084
+ if (flags == UNITY_ARRAY_TO_ARRAY)
1085
+ {
1086
+ ptr_expected++;
1087
+ }
1088
+ ptr_actual++;
1089
+ }
1090
+ }
1091
+
1092
+ /*-----------------------------------------------*/
1093
+ void UnityAssertDoublesWithin(const UNITY_DOUBLE delta,
1094
+ const UNITY_DOUBLE expected,
1095
+ const UNITY_DOUBLE actual,
1096
+ const char* msg,
1097
+ const UNITY_LINE_TYPE lineNumber)
1098
+ {
1099
+ RETURN_IF_FAIL_OR_IGNORE;
1100
+
1101
+ if (!UnityDoublesWithin(delta, expected, actual))
1102
+ {
1103
+ UnityTestResultsFailBegin(lineNumber);
1104
+ UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT(expected, actual);
1105
+ UnityAddMsgIfSpecified(msg);
1106
+ UNITY_FAIL_AND_BAIL;
1107
+ }
1108
+ }
1109
+
1110
+ /*-----------------------------------------------*/
1111
+ void UnityAssertDoubleSpecial(const UNITY_DOUBLE actual,
1112
+ const char* msg,
1113
+ const UNITY_LINE_TYPE lineNumber,
1114
+ const UNITY_FLOAT_TRAIT_T style)
1115
+ {
1116
+ const char* trait_names[] = {UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet};
1117
+ UNITY_INT should_be_trait = ((UNITY_INT)style & 1);
1118
+ UNITY_INT is_trait = !should_be_trait;
1119
+ UNITY_INT trait_index = (UNITY_INT)(style >> 1);
1120
+
1121
+ RETURN_IF_FAIL_OR_IGNORE;
1122
+
1123
+ switch (style)
1124
+ {
1125
+ case UNITY_FLOAT_IS_INF:
1126
+ case UNITY_FLOAT_IS_NOT_INF:
1127
+ is_trait = isinf(actual) && (actual > 0);
1128
+ break;
1129
+ case UNITY_FLOAT_IS_NEG_INF:
1130
+ case UNITY_FLOAT_IS_NOT_NEG_INF:
1131
+ is_trait = isinf(actual) && (actual < 0);
1132
+ break;
1133
+
1134
+ case UNITY_FLOAT_IS_NAN:
1135
+ case UNITY_FLOAT_IS_NOT_NAN:
1136
+ is_trait = isnan(actual) ? 1 : 0;
1137
+ break;
1138
+
1139
+ case UNITY_FLOAT_IS_DET: /* A determinate number is non infinite and not NaN. */
1140
+ case UNITY_FLOAT_IS_NOT_DET:
1141
+ is_trait = !isinf(actual) && !isnan(actual);
1142
+ break;
1143
+
1144
+ default:
1145
+ trait_index = 0;
1146
+ trait_names[0] = UnityStrInvalidFloatTrait;
1147
+ break;
1148
+ }
1149
+
1150
+ if (is_trait != should_be_trait)
1151
+ {
1152
+ UnityTestResultsFailBegin(lineNumber);
1153
+ UnityPrint(UnityStrExpected);
1154
+ if (!should_be_trait)
1155
+ {
1156
+ UnityPrint(UnityStrNot);
1157
+ }
1158
+ UnityPrint(trait_names[trait_index]);
1159
+ UnityPrint(UnityStrWas);
1160
+ #ifndef UNITY_EXCLUDE_FLOAT_PRINT
1161
+ UnityPrintFloat(actual);
1162
+ #else
1163
+ if (should_be_trait)
1164
+ {
1165
+ UnityPrint(UnityStrNot);
1166
+ }
1167
+ UnityPrint(trait_names[trait_index]);
1168
+ #endif
1169
+ UnityAddMsgIfSpecified(msg);
1170
+ UNITY_FAIL_AND_BAIL;
1171
+ }
1172
+ }
1173
+
1174
+ #endif /* not UNITY_EXCLUDE_DOUBLE */
1175
+
1176
+ /*-----------------------------------------------*/
1177
+ void UnityAssertNumbersWithin(const UNITY_UINT delta,
1178
+ const UNITY_INT expected,
1179
+ const UNITY_INT actual,
1180
+ const char* msg,
1181
+ const UNITY_LINE_TYPE lineNumber,
1182
+ const UNITY_DISPLAY_STYLE_T style)
1183
+ {
1184
+ RETURN_IF_FAIL_OR_IGNORE;
1185
+
1186
+ if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
1187
+ {
1188
+ if (actual > expected)
1189
+ {
1190
+ Unity.CurrentTestFailed = (((UNITY_UINT)actual - (UNITY_UINT)expected) > delta);
1191
+ }
1192
+ else
1193
+ {
1194
+ Unity.CurrentTestFailed = (((UNITY_UINT)expected - (UNITY_UINT)actual) > delta);
1195
+ }
1196
+ }
1197
+ else
1198
+ {
1199
+ if ((UNITY_UINT)actual > (UNITY_UINT)expected)
1200
+ {
1201
+ Unity.CurrentTestFailed = (((UNITY_UINT)actual - (UNITY_UINT)expected) > delta);
1202
+ }
1203
+ else
1204
+ {
1205
+ Unity.CurrentTestFailed = (((UNITY_UINT)expected - (UNITY_UINT)actual) > delta);
1206
+ }
1207
+ }
1208
+
1209
+ if (Unity.CurrentTestFailed)
1210
+ {
1211
+ UnityTestResultsFailBegin(lineNumber);
1212
+ UnityPrint(UnityStrDelta);
1213
+ UnityPrintNumberByStyle((UNITY_INT)delta, style);
1214
+ UnityPrint(UnityStrExpected);
1215
+ UnityPrintNumberByStyle(expected, style);
1216
+ UnityPrint(UnityStrWas);
1217
+ UnityPrintNumberByStyle(actual, style);
1218
+ UnityAddMsgIfSpecified(msg);
1219
+ UNITY_FAIL_AND_BAIL;
1220
+ }
1221
+ }
1222
+
1223
+ /*-----------------------------------------------*/
1224
+ void UnityAssertNumbersArrayWithin(const UNITY_UINT delta,
1225
+ UNITY_INTERNAL_PTR expected,
1226
+ UNITY_INTERNAL_PTR actual,
1227
+ const UNITY_UINT32 num_elements,
1228
+ const char* msg,
1229
+ const UNITY_LINE_TYPE lineNumber,
1230
+ const UNITY_DISPLAY_STYLE_T style,
1231
+ const UNITY_FLAGS_T flags)
1232
+ {
1233
+ UNITY_UINT32 elements = num_elements;
1234
+ unsigned int length = style & 0xF;
1235
+ unsigned int increment = 0;
1236
+
1237
+ RETURN_IF_FAIL_OR_IGNORE;
1238
+
1239
+ if (num_elements == 0)
1240
+ {
1241
+ UnityPrintPointlessAndBail();
1242
+ }
1243
+
1244
+ if (expected == actual)
1245
+ {
1246
+ return; /* Both are NULL or same pointer */
1247
+ }
1248
+
1249
+ if (UnityIsOneArrayNull(expected, actual, lineNumber, msg))
1250
+ {
1251
+ UNITY_FAIL_AND_BAIL;
1252
+ }
1253
+
1254
+ while ((elements > 0) && (elements--))
1255
+ {
1256
+ UNITY_INT expect_val;
1257
+ UNITY_INT actual_val;
1258
+
1259
+ switch (length)
1260
+ {
1261
+ case 1:
1262
+ expect_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT8*)expected;
1263
+ actual_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT8*)actual;
1264
+ increment = sizeof(UNITY_INT8);
1265
+ break;
1266
+
1267
+ case 2:
1268
+ expect_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT16*)expected;
1269
+ actual_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT16*)actual;
1270
+ increment = sizeof(UNITY_INT16);
1271
+ break;
1272
+
1273
+ #ifdef UNITY_SUPPORT_64
1274
+ case 8:
1275
+ expect_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT64*)expected;
1276
+ actual_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT64*)actual;
1277
+ increment = sizeof(UNITY_INT64);
1278
+ break;
1279
+ #endif
1280
+
1281
+ default: /* default is length 4 bytes */
1282
+ case 4:
1283
+ expect_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT32*)expected;
1284
+ actual_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT32*)actual;
1285
+ increment = sizeof(UNITY_INT32);
1286
+ length = 4;
1287
+ break;
1288
+ }
1289
+
1290
+ if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
1291
+ {
1292
+ if (actual_val > expect_val)
1293
+ {
1294
+ Unity.CurrentTestFailed = (((UNITY_UINT)actual_val - (UNITY_UINT)expect_val) > delta);
1295
+ }
1296
+ else
1297
+ {
1298
+ Unity.CurrentTestFailed = (((UNITY_UINT)expect_val - (UNITY_UINT)actual_val) > delta);
1299
+ }
1300
+ }
1301
+ else
1302
+ {
1303
+ if ((UNITY_UINT)actual_val > (UNITY_UINT)expect_val)
1304
+ {
1305
+ Unity.CurrentTestFailed = (((UNITY_UINT)actual_val - (UNITY_UINT)expect_val) > delta);
1306
+ }
1307
+ else
1308
+ {
1309
+ Unity.CurrentTestFailed = (((UNITY_UINT)expect_val - (UNITY_UINT)actual_val) > delta);
1310
+ }
1311
+ }
1312
+
1313
+ if (Unity.CurrentTestFailed)
1314
+ {
1315
+ if ((style & UNITY_DISPLAY_RANGE_UINT) && (length < (UNITY_INT_WIDTH / 8)))
1316
+ { /* For UINT, remove sign extension (padding 1's) from signed type casts above */
1317
+ UNITY_INT mask = 1;
1318
+ mask = (mask << 8 * length) - 1;
1319
+ expect_val &= mask;
1320
+ actual_val &= mask;
1321
+ }
1322
+ UnityTestResultsFailBegin(lineNumber);
1323
+ UnityPrint(UnityStrDelta);
1324
+ UnityPrintNumberByStyle((UNITY_INT)delta, style);
1325
+ UnityPrint(UnityStrElement);
1326
+ UnityPrintNumberUnsigned(num_elements - elements - 1);
1327
+ UnityPrint(UnityStrExpected);
1328
+ UnityPrintNumberByStyle(expect_val, style);
1329
+ UnityPrint(UnityStrWas);
1330
+ UnityPrintNumberByStyle(actual_val, style);
1331
+ UnityAddMsgIfSpecified(msg);
1332
+ UNITY_FAIL_AND_BAIL;
1333
+ }
1334
+ /* Walk through array by incrementing the pointers */
1335
+ if (flags == UNITY_ARRAY_TO_ARRAY)
1336
+ {
1337
+ expected = (UNITY_INTERNAL_PTR)((const char*)expected + increment);
1338
+ }
1339
+ actual = (UNITY_INTERNAL_PTR)((const char*)actual + increment);
1340
+ }
1341
+ }
1342
+
1343
+ /*-----------------------------------------------*/
1344
+ void UnityAssertEqualString(const char* expected,
1345
+ const char* actual,
1346
+ const char* msg,
1347
+ const UNITY_LINE_TYPE lineNumber)
1348
+ {
1349
+ UNITY_UINT32 i;
1350
+
1351
+ RETURN_IF_FAIL_OR_IGNORE;
1352
+
1353
+ /* if both pointers not null compare the strings */
1354
+ if (expected && actual)
1355
+ {
1356
+ for (i = 0; expected[i] || actual[i]; i++)
1357
+ {
1358
+ if (expected[i] != actual[i])
1359
+ {
1360
+ Unity.CurrentTestFailed = 1;
1361
+ break;
1362
+ }
1363
+ }
1364
+ }
1365
+ else
1366
+ { /* handle case of one pointers being null (if both null, test should pass) */
1367
+ if (expected != actual)
1368
+ {
1369
+ Unity.CurrentTestFailed = 1;
1370
+ }
1371
+ }
1372
+
1373
+ if (Unity.CurrentTestFailed)
1374
+ {
1375
+ UnityTestResultsFailBegin(lineNumber);
1376
+ UnityPrintExpectedAndActualStrings(expected, actual);
1377
+ UnityAddMsgIfSpecified(msg);
1378
+ UNITY_FAIL_AND_BAIL;
1379
+ }
1380
+ }
1381
+
1382
+ /*-----------------------------------------------*/
1383
+ void UnityAssertEqualStringLen(const char* expected,
1384
+ const char* actual,
1385
+ const UNITY_UINT32 length,
1386
+ const char* msg,
1387
+ const UNITY_LINE_TYPE lineNumber)
1388
+ {
1389
+ UNITY_UINT32 i;
1390
+
1391
+ RETURN_IF_FAIL_OR_IGNORE;
1392
+
1393
+ /* if both pointers not null compare the strings */
1394
+ if (expected && actual)
1395
+ {
1396
+ for (i = 0; (i < length) && (expected[i] || actual[i]); i++)
1397
+ {
1398
+ if (expected[i] != actual[i])
1399
+ {
1400
+ Unity.CurrentTestFailed = 1;
1401
+ break;
1402
+ }
1403
+ }
1404
+ }
1405
+ else
1406
+ { /* handle case of one pointers being null (if both null, test should pass) */
1407
+ if (expected != actual)
1408
+ {
1409
+ Unity.CurrentTestFailed = 1;
1410
+ }
1411
+ }
1412
+
1413
+ if (Unity.CurrentTestFailed)
1414
+ {
1415
+ UnityTestResultsFailBegin(lineNumber);
1416
+ UnityPrintExpectedAndActualStringsLen(expected, actual, length);
1417
+ UnityAddMsgIfSpecified(msg);
1418
+ UNITY_FAIL_AND_BAIL;
1419
+ }
1420
+ }
1421
+
1422
+ /*-----------------------------------------------*/
1423
+ void UnityAssertEqualStringArray(UNITY_INTERNAL_PTR expected,
1424
+ const char** actual,
1425
+ const UNITY_UINT32 num_elements,
1426
+ const char* msg,
1427
+ const UNITY_LINE_TYPE lineNumber,
1428
+ const UNITY_FLAGS_T flags)
1429
+ {
1430
+ UNITY_UINT32 i = 0;
1431
+ UNITY_UINT32 j = 0;
1432
+ const char* expd = NULL;
1433
+ const char* act = NULL;
1434
+
1435
+ RETURN_IF_FAIL_OR_IGNORE;
1436
+
1437
+ /* if no elements, it's an error */
1438
+ if (num_elements == 0)
1439
+ {
1440
+ UnityPrintPointlessAndBail();
1441
+ }
1442
+
1443
+ if ((const void*)expected == (const void*)actual)
1444
+ {
1445
+ return; /* Both are NULL or same pointer */
1446
+ }
1447
+
1448
+ if (UnityIsOneArrayNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg))
1449
+ {
1450
+ UNITY_FAIL_AND_BAIL;
1451
+ }
1452
+
1453
+ if (flags != UNITY_ARRAY_TO_ARRAY)
1454
+ {
1455
+ expd = (const char*)expected;
1456
+ }
1457
+
1458
+ do
1459
+ {
1460
+ act = actual[j];
1461
+ if (flags == UNITY_ARRAY_TO_ARRAY)
1462
+ {
1463
+ expd = ((const char* const*)expected)[j];
1464
+ }
1465
+
1466
+ /* if both pointers not null compare the strings */
1467
+ if (expd && act)
1468
+ {
1469
+ for (i = 0; expd[i] || act[i]; i++)
1470
+ {
1471
+ if (expd[i] != act[i])
1472
+ {
1473
+ Unity.CurrentTestFailed = 1;
1474
+ break;
1475
+ }
1476
+ }
1477
+ }
1478
+ else
1479
+ { /* handle case of one pointers being null (if both null, test should pass) */
1480
+ if (expd != act)
1481
+ {
1482
+ Unity.CurrentTestFailed = 1;
1483
+ }
1484
+ }
1485
+
1486
+ if (Unity.CurrentTestFailed)
1487
+ {
1488
+ UnityTestResultsFailBegin(lineNumber);
1489
+ if (num_elements > 1)
1490
+ {
1491
+ UnityPrint(UnityStrElement);
1492
+ UnityPrintNumberUnsigned(j);
1493
+ }
1494
+ UnityPrintExpectedAndActualStrings(expd, act);
1495
+ UnityAddMsgIfSpecified(msg);
1496
+ UNITY_FAIL_AND_BAIL;
1497
+ }
1498
+ } while (++j < num_elements);
1499
+ }
1500
+
1501
+ /*-----------------------------------------------*/
1502
+ void UnityAssertEqualMemory(UNITY_INTERNAL_PTR expected,
1503
+ UNITY_INTERNAL_PTR actual,
1504
+ const UNITY_UINT32 length,
1505
+ const UNITY_UINT32 num_elements,
1506
+ const char* msg,
1507
+ const UNITY_LINE_TYPE lineNumber,
1508
+ const UNITY_FLAGS_T flags)
1509
+ {
1510
+ UNITY_PTR_ATTRIBUTE const unsigned char* ptr_exp = (UNITY_PTR_ATTRIBUTE const unsigned char*)expected;
1511
+ UNITY_PTR_ATTRIBUTE const unsigned char* ptr_act = (UNITY_PTR_ATTRIBUTE const unsigned char*)actual;
1512
+ UNITY_UINT32 elements = num_elements;
1513
+ UNITY_UINT32 bytes;
1514
+
1515
+ RETURN_IF_FAIL_OR_IGNORE;
1516
+
1517
+ if ((elements == 0) || (length == 0))
1518
+ {
1519
+ UnityPrintPointlessAndBail();
1520
+ }
1521
+
1522
+ if (expected == actual)
1523
+ {
1524
+ return; /* Both are NULL or same pointer */
1525
+ }
1526
+
1527
+ if (UnityIsOneArrayNull(expected, actual, lineNumber, msg))
1528
+ {
1529
+ UNITY_FAIL_AND_BAIL;
1530
+ }
1531
+
1532
+ while (elements--)
1533
+ {
1534
+ bytes = length;
1535
+ while (bytes--)
1536
+ {
1537
+ if (*ptr_exp != *ptr_act)
1538
+ {
1539
+ UnityTestResultsFailBegin(lineNumber);
1540
+ UnityPrint(UnityStrMemory);
1541
+ if (num_elements > 1)
1542
+ {
1543
+ UnityPrint(UnityStrElement);
1544
+ UnityPrintNumberUnsigned(num_elements - elements - 1);
1545
+ }
1546
+ UnityPrint(UnityStrByte);
1547
+ UnityPrintNumberUnsigned(length - bytes - 1);
1548
+ UnityPrint(UnityStrExpected);
1549
+ UnityPrintNumberByStyle(*ptr_exp, UNITY_DISPLAY_STYLE_HEX8);
1550
+ UnityPrint(UnityStrWas);
1551
+ UnityPrintNumberByStyle(*ptr_act, UNITY_DISPLAY_STYLE_HEX8);
1552
+ UnityAddMsgIfSpecified(msg);
1553
+ UNITY_FAIL_AND_BAIL;
1554
+ }
1555
+ ptr_exp++;
1556
+ ptr_act++;
1557
+ }
1558
+ if (flags == UNITY_ARRAY_TO_VAL)
1559
+ {
1560
+ ptr_exp = (UNITY_PTR_ATTRIBUTE const unsigned char*)expected;
1561
+ }
1562
+ }
1563
+ }
1564
+
1565
+ /*-----------------------------------------------*/
1566
+
1567
+ static union
1568
+ {
1569
+ UNITY_INT8 i8;
1570
+ UNITY_INT16 i16;
1571
+ UNITY_INT32 i32;
1572
+ #ifdef UNITY_SUPPORT_64
1573
+ UNITY_INT64 i64;
1574
+ #endif
1575
+ #ifndef UNITY_EXCLUDE_FLOAT
1576
+ float f;
1577
+ #endif
1578
+ #ifndef UNITY_EXCLUDE_DOUBLE
1579
+ double d;
1580
+ #endif
1581
+ } UnityQuickCompare;
1582
+
1583
+ UNITY_INTERNAL_PTR UnityNumToPtr(const UNITY_INT num, const UNITY_UINT8 size)
1584
+ {
1585
+ switch(size)
1586
+ {
1587
+ case 1:
1588
+ UnityQuickCompare.i8 = (UNITY_INT8)num;
1589
+ return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.i8);
1590
+
1591
+ case 2:
1592
+ UnityQuickCompare.i16 = (UNITY_INT16)num;
1593
+ return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.i16);
1594
+
1595
+ #ifdef UNITY_SUPPORT_64
1596
+ case 8:
1597
+ UnityQuickCompare.i64 = (UNITY_INT64)num;
1598
+ return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.i64);
1599
+ #endif
1600
+
1601
+ default: /* 4 bytes */
1602
+ UnityQuickCompare.i32 = (UNITY_INT32)num;
1603
+ return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.i32);
1604
+ }
1605
+ }
1606
+
1607
+ #ifndef UNITY_EXCLUDE_FLOAT
1608
+ /*-----------------------------------------------*/
1609
+ UNITY_INTERNAL_PTR UnityFloatToPtr(const float num)
1610
+ {
1611
+ UnityQuickCompare.f = num;
1612
+ return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.f);
1613
+ }
1614
+ #endif
1615
+
1616
+ #ifndef UNITY_EXCLUDE_DOUBLE
1617
+ /*-----------------------------------------------*/
1618
+ UNITY_INTERNAL_PTR UnityDoubleToPtr(const double num)
1619
+ {
1620
+ UnityQuickCompare.d = num;
1621
+ return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.d);
1622
+ }
1623
+ #endif
1624
+
1625
+ /*-----------------------------------------------
1626
+ * printf helper function
1627
+ *-----------------------------------------------*/
1628
+ #ifdef UNITY_INCLUDE_PRINT_FORMATTED
1629
+ static void UnityPrintFVA(const char* format, va_list va)
1630
+ {
1631
+ const char* pch = format;
1632
+ if (pch != NULL)
1633
+ {
1634
+ while (*pch)
1635
+ {
1636
+ /* format identification character */
1637
+ if (*pch == '%')
1638
+ {
1639
+ pch++;
1640
+
1641
+ if (pch != NULL)
1642
+ {
1643
+ switch (*pch)
1644
+ {
1645
+ case 'd':
1646
+ case 'i':
1647
+ {
1648
+ const int number = va_arg(va, int);
1649
+ UnityPrintNumber((UNITY_INT)number);
1650
+ break;
1651
+ }
1652
+ #ifndef UNITY_EXCLUDE_FLOAT_PRINT
1653
+ case 'f':
1654
+ case 'g':
1655
+ {
1656
+ const double number = va_arg(va, double);
1657
+ UnityPrintFloat((UNITY_DOUBLE)number);
1658
+ break;
1659
+ }
1660
+ #endif
1661
+ case 'u':
1662
+ {
1663
+ const unsigned int number = va_arg(va, unsigned int);
1664
+ UnityPrintNumberUnsigned((UNITY_UINT)number);
1665
+ break;
1666
+ }
1667
+ case 'b':
1668
+ {
1669
+ const unsigned int number = va_arg(va, unsigned int);
1670
+ const UNITY_UINT mask = (UNITY_UINT)0 - (UNITY_UINT)1;
1671
+ UNITY_OUTPUT_CHAR('0');
1672
+ UNITY_OUTPUT_CHAR('b');
1673
+ UnityPrintMask(mask, (UNITY_UINT)number);
1674
+ break;
1675
+ }
1676
+ case 'x':
1677
+ case 'X':
1678
+ case 'p':
1679
+ {
1680
+ const unsigned int number = va_arg(va, unsigned int);
1681
+ UNITY_OUTPUT_CHAR('0');
1682
+ UNITY_OUTPUT_CHAR('x');
1683
+ UnityPrintNumberHex((UNITY_UINT)number, 8);
1684
+ break;
1685
+ }
1686
+ case 'c':
1687
+ {
1688
+ const int ch = va_arg(va, int);
1689
+ UnityPrintChar((const char *)&ch);
1690
+ break;
1691
+ }
1692
+ case 's':
1693
+ {
1694
+ const char * string = va_arg(va, const char *);
1695
+ UnityPrint(string);
1696
+ break;
1697
+ }
1698
+ case '%':
1699
+ {
1700
+ UnityPrintChar(pch);
1701
+ break;
1702
+ }
1703
+ default:
1704
+ {
1705
+ /* print the unknown format character */
1706
+ UNITY_OUTPUT_CHAR('%');
1707
+ UnityPrintChar(pch);
1708
+ break;
1709
+ }
1710
+ }
1711
+ }
1712
+ }
1713
+ #ifdef UNITY_OUTPUT_COLOR
1714
+ /* print ANSI escape code */
1715
+ else if ((*pch == 27) && (*(pch + 1) == '['))
1716
+ {
1717
+ pch += UnityPrintAnsiEscapeString(pch);
1718
+ continue;
1719
+ }
1720
+ #endif
1721
+ else if (*pch == '\n')
1722
+ {
1723
+ UNITY_PRINT_EOL();
1724
+ }
1725
+ else
1726
+ {
1727
+ UnityPrintChar(pch);
1728
+ }
1729
+
1730
+ pch++;
1731
+ }
1732
+ }
1733
+ }
1734
+
1735
+ void UnityPrintF(const UNITY_LINE_TYPE line, const char* format, ...)
1736
+ {
1737
+ UnityTestResultsBegin(Unity.TestFile, line);
1738
+ UnityPrint("INFO");
1739
+ if(format != NULL)
1740
+ {
1741
+ UnityPrint(": ");
1742
+ va_list va;
1743
+ va_start(va, format);
1744
+ UnityPrintFVA(format, va);
1745
+ va_end(va);
1746
+ }
1747
+ UNITY_PRINT_EOL();
1748
+ }
1749
+ #endif /* ! UNITY_INCLUDE_PRINT_FORMATTED */
1750
+
1751
+
1752
+ /*-----------------------------------------------
1753
+ * Control Functions
1754
+ *-----------------------------------------------*/
1755
+
1756
+ /*-----------------------------------------------*/
1757
+ void UnityFail(const char* msg, const UNITY_LINE_TYPE line)
1758
+ {
1759
+ RETURN_IF_FAIL_OR_IGNORE;
1760
+
1761
+ UnityTestResultsBegin(Unity.TestFile, line);
1762
+ UnityPrint(UnityStrFail);
1763
+ if (msg != NULL)
1764
+ {
1765
+ UNITY_OUTPUT_CHAR(':');
1766
+
1767
+ #ifdef UNITY_PRINT_TEST_CONTEXT
1768
+ UNITY_PRINT_TEST_CONTEXT();
1769
+ #endif
1770
+ #ifndef UNITY_EXCLUDE_DETAILS
1771
+ if (Unity.CurrentDetail1)
1772
+ {
1773
+ UnityPrint(UnityStrDetail1Name);
1774
+ UnityPrint(Unity.CurrentDetail1);
1775
+ if (Unity.CurrentDetail2)
1776
+ {
1777
+ UnityPrint(UnityStrDetail2Name);
1778
+ UnityPrint(Unity.CurrentDetail2);
1779
+ }
1780
+ UnityPrint(UnityStrSpacer);
1781
+ }
1782
+ #endif
1783
+ if (msg[0] != ' ')
1784
+ {
1785
+ UNITY_OUTPUT_CHAR(' ');
1786
+ }
1787
+ UnityPrint(msg);
1788
+ }
1789
+
1790
+ UNITY_FAIL_AND_BAIL;
1791
+ }
1792
+
1793
+ /*-----------------------------------------------*/
1794
+ void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line)
1795
+ {
1796
+ RETURN_IF_FAIL_OR_IGNORE;
1797
+
1798
+ UnityTestResultsBegin(Unity.TestFile, line);
1799
+ UnityPrint(UnityStrIgnore);
1800
+ if (msg != NULL)
1801
+ {
1802
+ UNITY_OUTPUT_CHAR(':');
1803
+ UNITY_OUTPUT_CHAR(' ');
1804
+ UnityPrint(msg);
1805
+ }
1806
+ UNITY_IGNORE_AND_BAIL;
1807
+ }
1808
+
1809
+ /*-----------------------------------------------*/
1810
+ void UnityMessage(const char* msg, const UNITY_LINE_TYPE line)
1811
+ {
1812
+ UnityTestResultsBegin(Unity.TestFile, line);
1813
+ UnityPrint("INFO");
1814
+ if (msg != NULL)
1815
+ {
1816
+ UNITY_OUTPUT_CHAR(':');
1817
+ UNITY_OUTPUT_CHAR(' ');
1818
+ UnityPrint(msg);
1819
+ }
1820
+ UNITY_PRINT_EOL();
1821
+ }
1822
+
1823
+ /*-----------------------------------------------*/
1824
+ /* If we have not defined our own test runner, then include our default test runner to make life easier */
1825
+ #ifndef UNITY_SKIP_DEFAULT_RUNNER
1826
+ void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum)
1827
+ {
1828
+ Unity.CurrentTestName = FuncName;
1829
+ Unity.CurrentTestLineNumber = (UNITY_LINE_TYPE)FuncLineNum;
1830
+ Unity.NumberOfTests++;
1831
+ UNITY_CLR_DETAILS();
1832
+ UNITY_EXEC_TIME_START();
1833
+ if (TEST_PROTECT())
1834
+ {
1835
+ setUp();
1836
+ Func();
1837
+ }
1838
+ if (TEST_PROTECT())
1839
+ {
1840
+ tearDown();
1841
+ }
1842
+ UNITY_EXEC_TIME_STOP();
1843
+ UnityConcludeTest();
1844
+ }
1845
+ #endif
1846
+
1847
+ /*-----------------------------------------------*/
1848
+ void UnitySetTestFile(const char* filename)
1849
+ {
1850
+ Unity.TestFile = filename;
1851
+ }
1852
+
1853
+ /*-----------------------------------------------*/
1854
+ void UnityBegin(const char* filename)
1855
+ {
1856
+ Unity.TestFile = filename;
1857
+ Unity.CurrentTestName = NULL;
1858
+ Unity.CurrentTestLineNumber = 0;
1859
+ Unity.NumberOfTests = 0;
1860
+ Unity.TestFailures = 0;
1861
+ Unity.TestIgnores = 0;
1862
+ Unity.CurrentTestFailed = 0;
1863
+ Unity.CurrentTestIgnored = 0;
1864
+
1865
+ UNITY_CLR_DETAILS();
1866
+ UNITY_OUTPUT_START();
1867
+ }
1868
+
1869
+ /*-----------------------------------------------*/
1870
+ int UnityEnd(void)
1871
+ {
1872
+ UNITY_PRINT_EOL();
1873
+ UnityPrint(UnityStrBreaker);
1874
+ UNITY_PRINT_EOL();
1875
+ UnityPrintNumber((UNITY_INT)(Unity.NumberOfTests));
1876
+ UnityPrint(UnityStrResultsTests);
1877
+ UnityPrintNumber((UNITY_INT)(Unity.TestFailures));
1878
+ UnityPrint(UnityStrResultsFailures);
1879
+ UnityPrintNumber((UNITY_INT)(Unity.TestIgnores));
1880
+ UnityPrint(UnityStrResultsIgnored);
1881
+ UNITY_PRINT_EOL();
1882
+ if (Unity.TestFailures == 0U)
1883
+ {
1884
+ UnityPrint(UnityStrOk);
1885
+ }
1886
+ else
1887
+ {
1888
+ UnityPrint(UnityStrFail);
1889
+ #ifdef UNITY_DIFFERENTIATE_FINAL_FAIL
1890
+ UNITY_OUTPUT_CHAR('E'); UNITY_OUTPUT_CHAR('D');
1891
+ #endif
1892
+ }
1893
+ UNITY_PRINT_EOL();
1894
+ UNITY_FLUSH_CALL();
1895
+ UNITY_OUTPUT_COMPLETE();
1896
+ return (int)(Unity.TestFailures);
1897
+ }
1898
+
1899
+ /*-----------------------------------------------
1900
+ * Command Line Argument Support
1901
+ *-----------------------------------------------*/
1902
+ #ifdef UNITY_USE_COMMAND_LINE_ARGS
1903
+
1904
+ char* UnityOptionIncludeNamed = NULL;
1905
+ char* UnityOptionExcludeNamed = NULL;
1906
+ int UnityVerbosity = 1;
1907
+
1908
+ /*-----------------------------------------------*/
1909
+ int UnityParseOptions(int argc, char** argv)
1910
+ {
1911
+ int i;
1912
+ UnityOptionIncludeNamed = NULL;
1913
+ UnityOptionExcludeNamed = NULL;
1914
+
1915
+ for (i = 1; i < argc; i++)
1916
+ {
1917
+ if (argv[i][0] == '-')
1918
+ {
1919
+ switch (argv[i][1])
1920
+ {
1921
+ case 'l': /* list tests */
1922
+ return -1;
1923
+ case 'n': /* include tests with name including this string */
1924
+ case 'f': /* an alias for -n */
1925
+ if (argv[i][2] == '=')
1926
+ {
1927
+ UnityOptionIncludeNamed = &argv[i][3];
1928
+ }
1929
+ else if (++i < argc)
1930
+ {
1931
+ UnityOptionIncludeNamed = argv[i];
1932
+ }
1933
+ else
1934
+ {
1935
+ UnityPrint("ERROR: No Test String to Include Matches For");
1936
+ UNITY_PRINT_EOL();
1937
+ return 1;
1938
+ }
1939
+ break;
1940
+ case 'q': /* quiet */
1941
+ UnityVerbosity = 0;
1942
+ break;
1943
+ case 'v': /* verbose */
1944
+ UnityVerbosity = 2;
1945
+ break;
1946
+ case 'x': /* exclude tests with name including this string */
1947
+ if (argv[i][2] == '=')
1948
+ {
1949
+ UnityOptionExcludeNamed = &argv[i][3];
1950
+ }
1951
+ else if (++i < argc)
1952
+ {
1953
+ UnityOptionExcludeNamed = argv[i];
1954
+ }
1955
+ else
1956
+ {
1957
+ UnityPrint("ERROR: No Test String to Exclude Matches For");
1958
+ UNITY_PRINT_EOL();
1959
+ return 1;
1960
+ }
1961
+ break;
1962
+ default:
1963
+ UnityPrint("ERROR: Unknown Option ");
1964
+ UNITY_OUTPUT_CHAR(argv[i][1]);
1965
+ UNITY_PRINT_EOL();
1966
+ return 1;
1967
+ }
1968
+ }
1969
+ }
1970
+
1971
+ return 0;
1972
+ }
1973
+
1974
+ /*-----------------------------------------------*/
1975
+ int IsStringInBiggerString(const char* longstring, const char* shortstring)
1976
+ {
1977
+ const char* lptr = longstring;
1978
+ const char* sptr = shortstring;
1979
+ const char* lnext = lptr;
1980
+
1981
+ if (*sptr == '*')
1982
+ {
1983
+ return 1;
1984
+ }
1985
+
1986
+ while (*lptr)
1987
+ {
1988
+ lnext = lptr + 1;
1989
+
1990
+ /* If they current bytes match, go on to the next bytes */
1991
+ while (*lptr && *sptr && (*lptr == *sptr))
1992
+ {
1993
+ lptr++;
1994
+ sptr++;
1995
+
1996
+ /* We're done if we match the entire string or up to a wildcard */
1997
+ if (*sptr == '*')
1998
+ return 1;
1999
+ if (*sptr == ',')
2000
+ return 1;
2001
+ if (*sptr == '"')
2002
+ return 1;
2003
+ if (*sptr == '\'')
2004
+ return 1;
2005
+ if (*sptr == ':')
2006
+ return 2;
2007
+ if (*sptr == 0)
2008
+ return 1;
2009
+ }
2010
+
2011
+ /* Otherwise we start in the long pointer 1 character further and try again */
2012
+ lptr = lnext;
2013
+ sptr = shortstring;
2014
+ }
2015
+
2016
+ return 0;
2017
+ }
2018
+
2019
+ /*-----------------------------------------------*/
2020
+ int UnityStringArgumentMatches(const char* str)
2021
+ {
2022
+ int retval;
2023
+ const char* ptr1;
2024
+ const char* ptr2;
2025
+ const char* ptrf;
2026
+
2027
+ /* Go through the options and get the substrings for matching one at a time */
2028
+ ptr1 = str;
2029
+ while (ptr1[0] != 0)
2030
+ {
2031
+ if ((ptr1[0] == '"') || (ptr1[0] == '\''))
2032
+ {
2033
+ ptr1++;
2034
+ }
2035
+
2036
+ /* look for the start of the next partial */
2037
+ ptr2 = ptr1;
2038
+ ptrf = 0;
2039
+ do
2040
+ {
2041
+ ptr2++;
2042
+ if ((ptr2[0] == ':') && (ptr2[1] != 0) && (ptr2[0] != '\'') && (ptr2[0] != '"') && (ptr2[0] != ','))
2043
+ {
2044
+ ptrf = &ptr2[1];
2045
+ }
2046
+ } while ((ptr2[0] != 0) && (ptr2[0] != '\'') && (ptr2[0] != '"') && (ptr2[0] != ','));
2047
+
2048
+ while ((ptr2[0] != 0) && ((ptr2[0] == ':') || (ptr2[0] == '\'') || (ptr2[0] == '"') || (ptr2[0] == ',')))
2049
+ {
2050
+ ptr2++;
2051
+ }
2052
+
2053
+ /* done if complete filename match */
2054
+ retval = IsStringInBiggerString(Unity.TestFile, ptr1);
2055
+ if (retval == 1)
2056
+ {
2057
+ return retval;
2058
+ }
2059
+
2060
+ /* done if testname match after filename partial match */
2061
+ if ((retval == 2) && (ptrf != 0))
2062
+ {
2063
+ if (IsStringInBiggerString(Unity.CurrentTestName, ptrf))
2064
+ {
2065
+ return 1;
2066
+ }
2067
+ }
2068
+
2069
+ /* done if complete testname match */
2070
+ if (IsStringInBiggerString(Unity.CurrentTestName, ptr1) == 1)
2071
+ {
2072
+ return 1;
2073
+ }
2074
+
2075
+ ptr1 = ptr2;
2076
+ }
2077
+
2078
+ /* we couldn't find a match for any substrings */
2079
+ return 0;
2080
+ }
2081
+
2082
+ /*-----------------------------------------------*/
2083
+ int UnityTestMatches(void)
2084
+ {
2085
+ /* Check if this test name matches the included test pattern */
2086
+ int retval;
2087
+ if (UnityOptionIncludeNamed)
2088
+ {
2089
+ retval = UnityStringArgumentMatches(UnityOptionIncludeNamed);
2090
+ }
2091
+ else
2092
+ {
2093
+ retval = 1;
2094
+ }
2095
+
2096
+ /* Check if this test name matches the excluded test pattern */
2097
+ if (UnityOptionExcludeNamed)
2098
+ {
2099
+ if (UnityStringArgumentMatches(UnityOptionExcludeNamed))
2100
+ {
2101
+ retval = 0;
2102
+ }
2103
+ }
2104
+
2105
+ return retval;
2106
+ }
2107
+
2108
+ #endif /* UNITY_USE_COMMAND_LINE_ARGS */
2109
+ /*-----------------------------------------------*/