ceedling 0.28.3 → 0.29.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 (1101) hide show
  1. checksums.yaml +5 -5
  2. data/Gemfile +16 -16
  3. data/Gemfile.lock +17 -16
  4. data/README.md +107 -66
  5. data/Rakefile +11 -11
  6. data/assets/ceedling +3 -3
  7. data/assets/ceedling.cmd +1 -1
  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 +100 -90
  12. data/assets/project_with_guts.yml +101 -91
  13. data/assets/project_with_guts_gcov.yml +101 -91
  14. data/assets/test_example_file.c +13 -13
  15. data/assets/test_example_file_boom.c +13 -13
  16. data/assets/test_example_file_success.c +14 -14
  17. data/assets/test_example_file_verbose.c +12 -12
  18. data/bin/ceedling +337 -316
  19. data/ceedling.gemspec +36 -39
  20. data/ceedling.sublime-project +25 -0
  21. data/ceedling.sublime-workspace +1276 -0
  22. data/config/test_environment.rb +11 -11
  23. data/docs/CeedlingPacket.md +2119 -2060
  24. data/docs/ThrowTheSwitchCodingStandard.md +207 -207
  25. data/examples/blinky/project.yml +99 -98
  26. data/examples/blinky/rakefile.rb +31 -31
  27. data/examples/blinky/src/BlinkTask.c +21 -21
  28. data/examples/blinky/src/BlinkTask.h +6 -6
  29. data/examples/blinky/src/Configure.c +36 -36
  30. data/examples/blinky/src/Configure.h +6 -6
  31. data/examples/blinky/src/main.c +51 -51
  32. data/examples/blinky/src/main.h +9 -9
  33. data/examples/blinky/test/support/stub_interrupt.h +347 -347
  34. data/examples/blinky/test/support/stub_io.h +421 -421
  35. data/examples/blinky/test/support/stub_iom328p.h +883 -883
  36. data/examples/blinky/test/support/stub_sfr_defs.h +269 -269
  37. data/examples/blinky/test/test_BlinkTask.c +42 -42
  38. data/examples/blinky/test/test_Configure.c +29 -29
  39. data/examples/blinky/test/test_main.c +60 -60
  40. data/examples/temp_sensor/project.yml +76 -76
  41. data/examples/temp_sensor/rakefile.rb +6 -6
  42. data/examples/temp_sensor/src/AdcConductor.c +42 -42
  43. data/examples/temp_sensor/src/AdcConductor.h +13 -13
  44. data/examples/temp_sensor/src/AdcHardware.c +27 -27
  45. data/examples/temp_sensor/src/AdcHardware.h +11 -11
  46. data/examples/temp_sensor/src/AdcHardwareConfigurator.c +18 -18
  47. data/examples/temp_sensor/src/AdcHardwareConfigurator.h +10 -10
  48. data/examples/temp_sensor/src/AdcModel.c +33 -33
  49. data/examples/temp_sensor/src/AdcModel.h +13 -13
  50. data/examples/temp_sensor/src/AdcTemperatureSensor.c +51 -51
  51. data/examples/temp_sensor/src/AdcTemperatureSensor.h +10 -10
  52. data/examples/temp_sensor/src/Executor.c +25 -25
  53. data/examples/temp_sensor/src/Executor.h +9 -9
  54. data/examples/temp_sensor/src/IntrinsicsWrapper.c +18 -18
  55. data/examples/temp_sensor/src/IntrinsicsWrapper.h +7 -7
  56. data/examples/temp_sensor/src/Main.c +46 -46
  57. data/examples/temp_sensor/src/Main.h +7 -7
  58. data/examples/temp_sensor/src/Model.c +10 -10
  59. data/examples/temp_sensor/src/Model.h +8 -8
  60. data/examples/temp_sensor/src/ModelConfig.h +7 -7
  61. data/examples/temp_sensor/src/TaskScheduler.c +72 -72
  62. data/examples/temp_sensor/src/TaskScheduler.h +11 -11
  63. data/examples/temp_sensor/src/TemperatureCalculator.c +27 -27
  64. data/examples/temp_sensor/src/TemperatureCalculator.h +8 -8
  65. data/examples/temp_sensor/src/TemperatureFilter.c +38 -38
  66. data/examples/temp_sensor/src/TemperatureFilter.h +10 -10
  67. data/examples/temp_sensor/src/TimerConductor.c +15 -15
  68. data/examples/temp_sensor/src/TimerConductor.h +9 -9
  69. data/examples/temp_sensor/src/TimerConfigurator.c +51 -51
  70. data/examples/temp_sensor/src/TimerConfigurator.h +15 -15
  71. data/examples/temp_sensor/src/TimerHardware.c +15 -15
  72. data/examples/temp_sensor/src/TimerHardware.h +8 -8
  73. data/examples/temp_sensor/src/TimerInterruptConfigurator.c +55 -55
  74. data/examples/temp_sensor/src/TimerInterruptConfigurator.h +13 -13
  75. data/examples/temp_sensor/src/TimerInterruptHandler.c +25 -25
  76. data/examples/temp_sensor/src/TimerInterruptHandler.h +10 -10
  77. data/examples/temp_sensor/src/TimerModel.c +9 -9
  78. data/examples/temp_sensor/src/TimerModel.h +8 -8
  79. data/examples/temp_sensor/src/Types.h +90 -90
  80. data/examples/temp_sensor/src/UsartBaudRateRegisterCalculator.c +18 -18
  81. data/examples/temp_sensor/src/UsartBaudRateRegisterCalculator.h +8 -8
  82. data/examples/temp_sensor/src/UsartConductor.c +21 -21
  83. data/examples/temp_sensor/src/UsartConductor.h +7 -7
  84. data/examples/temp_sensor/src/UsartConfigurator.c +39 -39
  85. data/examples/temp_sensor/src/UsartConfigurator.h +13 -13
  86. data/examples/temp_sensor/src/UsartHardware.c +22 -22
  87. data/examples/temp_sensor/src/UsartHardware.h +9 -9
  88. data/examples/temp_sensor/src/UsartModel.c +34 -34
  89. data/examples/temp_sensor/src/UsartModel.h +10 -10
  90. data/examples/temp_sensor/src/UsartPutChar.c +16 -16
  91. data/examples/temp_sensor/src/UsartPutChar.h +8 -8
  92. data/examples/temp_sensor/src/UsartTransmitBufferStatus.c +7 -7
  93. data/examples/temp_sensor/src/UsartTransmitBufferStatus.h +8 -8
  94. data/examples/temp_sensor/test/TestAdcConductor.c +121 -121
  95. data/examples/temp_sensor/test/TestAdcHardware.c +44 -44
  96. data/examples/temp_sensor/test/TestAdcModel.c +33 -33
  97. data/examples/temp_sensor/test/TestExecutor.c +36 -36
  98. data/examples/temp_sensor/test/TestMain.c +24 -24
  99. data/examples/temp_sensor/test/TestModel.c +20 -20
  100. data/examples/temp_sensor/test/TestTaskScheduler.c +104 -104
  101. data/examples/temp_sensor/test/TestTemperatureCalculator.c +36 -36
  102. data/examples/temp_sensor/test/TestTemperatureFilter.c +79 -79
  103. data/examples/temp_sensor/test/TestTimerConductor.c +32 -32
  104. data/examples/temp_sensor/test/TestTimerHardware.c +26 -26
  105. data/examples/temp_sensor/test/TestTimerModel.c +18 -18
  106. data/examples/temp_sensor/test/TestUsartBaudRateRegisterCalculator.c +21 -21
  107. data/examples/temp_sensor/test/TestUsartConductor.c +40 -40
  108. data/examples/temp_sensor/test/TestUsartHardware.c +36 -36
  109. data/examples/temp_sensor/test/TestUsartModel.c +40 -40
  110. data/examples/temp_sensor/test/support/UnityHelper.c +12 -12
  111. data/examples/temp_sensor/test/support/UnityHelper.h +12 -12
  112. data/lib/ceedling.rb +99 -99
  113. data/lib/ceedling/build_invoker_utils.rb +39 -39
  114. data/lib/ceedling/cacheinator.rb +47 -42
  115. data/lib/ceedling/cacheinator_helper.rb +31 -12
  116. data/lib/ceedling/cmock_builder.rb +15 -15
  117. data/lib/ceedling/configurator.rb +363 -356
  118. data/lib/ceedling/configurator_builder.rb +458 -451
  119. data/lib/ceedling/configurator_plugins.rb +111 -111
  120. data/lib/ceedling/configurator_setup.rb +127 -127
  121. data/lib/ceedling/configurator_validator.rb +193 -193
  122. data/lib/ceedling/constants.rb +97 -97
  123. data/lib/ceedling/defaults.rb +418 -418
  124. data/lib/ceedling/dependinator.rb +98 -91
  125. data/lib/ceedling/erb_wrapper.rb +8 -8
  126. data/lib/ceedling/file_finder.rb +149 -149
  127. data/lib/ceedling/file_finder_helper.rb +54 -54
  128. data/lib/ceedling/file_path_utils.rb +200 -200
  129. data/lib/ceedling/file_system_utils.rb +69 -69
  130. data/lib/ceedling/file_system_wrapper.rb +9 -9
  131. data/lib/ceedling/file_wrapper.rb +83 -83
  132. data/lib/ceedling/flaginator.rb +74 -74
  133. data/lib/ceedling/generator.rb +183 -176
  134. data/lib/ceedling/generator_helper.rb +40 -40
  135. data/lib/ceedling/generator_test_results.rb +89 -89
  136. data/lib/ceedling/generator_test_results_sanity_checker.rb +65 -65
  137. data/lib/ceedling/generator_test_runner.rb +56 -52
  138. data/lib/ceedling/loginator.rb +31 -31
  139. data/lib/ceedling/makefile.rb +46 -46
  140. data/lib/ceedling/objects.yml +310 -307
  141. data/lib/ceedling/par_map.rb +19 -19
  142. data/lib/ceedling/plugin.rb +80 -80
  143. data/lib/ceedling/plugin_builder.rb +52 -52
  144. data/lib/ceedling/plugin_manager.rb +107 -107
  145. data/lib/ceedling/plugin_manager_helper.rb +19 -19
  146. data/lib/ceedling/plugin_reportinator.rb +76 -76
  147. data/lib/ceedling/plugin_reportinator_helper.rb +51 -51
  148. data/lib/ceedling/preprocessinator.rb +42 -43
  149. data/lib/ceedling/preprocessinator_extractor.rb +30 -30
  150. data/lib/ceedling/preprocessinator_file_handler.rb +21 -21
  151. data/lib/ceedling/preprocessinator_helper.rb +46 -46
  152. data/lib/ceedling/preprocessinator_includes_handler.rb +181 -96
  153. data/lib/ceedling/project_config_manager.rb +46 -37
  154. data/lib/ceedling/project_file_loader.rb +99 -99
  155. data/lib/ceedling/rake_utils.rb +17 -17
  156. data/lib/ceedling/rake_wrapper.rb +33 -33
  157. data/lib/ceedling/rakefile.rb +86 -86
  158. data/lib/ceedling/release_invoker.rb +73 -73
  159. data/lib/ceedling/release_invoker_helper.rb +19 -19
  160. data/lib/ceedling/reportinator.rb +26 -26
  161. data/lib/ceedling/rules_cmock.rake +9 -9
  162. data/lib/ceedling/rules_preprocess.rake +26 -26
  163. data/lib/ceedling/rules_release.rake +86 -86
  164. data/lib/ceedling/rules_release_deep_dependencies.rake +15 -15
  165. data/lib/ceedling/rules_tests.rake +74 -74
  166. data/lib/ceedling/rules_tests_deep_dependencies.rake +15 -15
  167. data/lib/ceedling/setupinator.rb +53 -53
  168. data/lib/ceedling/stream_wrapper.rb +28 -20
  169. data/lib/ceedling/streaminator.rb +40 -40
  170. data/lib/ceedling/streaminator_helper.rb +15 -15
  171. data/lib/ceedling/system_utils.rb +37 -37
  172. data/lib/ceedling/system_wrapper.rb +80 -80
  173. data/lib/ceedling/target_loader.rb +38 -38
  174. data/lib/ceedling/task_invoker.rb +117 -101
  175. data/lib/ceedling/tasks_base.rake +111 -112
  176. data/lib/ceedling/tasks_filesystem.rake +103 -100
  177. data/lib/ceedling/tasks_release.rake +30 -30
  178. data/lib/ceedling/tasks_release_deep_dependencies.rake +9 -9
  179. data/lib/ceedling/tasks_tests.rake +60 -55
  180. data/lib/ceedling/tasks_tests_deep_dependencies.rake +9 -9
  181. data/lib/ceedling/tasks_vendor.rake +35 -35
  182. data/lib/ceedling/test_includes_extractor.rb +85 -85
  183. data/lib/ceedling/test_invoker.rb +188 -164
  184. data/lib/ceedling/test_invoker_helper.rb +32 -32
  185. data/lib/ceedling/tool_executor.rb +229 -223
  186. data/lib/ceedling/tool_executor_helper.rb +164 -164
  187. data/lib/ceedling/verbosinator.rb +10 -10
  188. data/lib/ceedling/version.rb +36 -15
  189. data/lib/ceedling/yaml_wrapper.rb +17 -17
  190. data/license.txt +31 -31
  191. data/out.fail +22 -21
  192. data/plugins/beep/README.md +22 -22
  193. data/plugins/beep/lib/beep.rb +40 -40
  194. data/plugins/bullseye/assets/template.erb +15 -15
  195. data/plugins/bullseye/bullseye.rake +169 -169
  196. data/plugins/bullseye/config/defaults.yml +57 -57
  197. data/plugins/bullseye/lib/bullseye.rb +194 -194
  198. data/plugins/colour_report/lib/colour_report.rb +16 -0
  199. data/plugins/command_hooks/README.md +53 -52
  200. data/plugins/command_hooks/lib/command_hooks.rb +92 -75
  201. data/plugins/fake_function_framework/README.md +250 -250
  202. data/plugins/fake_function_framework/Rakefile +18 -18
  203. data/plugins/fake_function_framework/examples/fff_example/project.yml +71 -71
  204. data/plugins/fake_function_framework/examples/fff_example/rakefile.rb +7 -7
  205. data/plugins/fake_function_framework/examples/fff_example/src/bar.c +1 -1
  206. data/plugins/fake_function_framework/examples/fff_example/src/bar.h +14 -14
  207. data/plugins/fake_function_framework/examples/fff_example/src/custom_types.h +6 -6
  208. data/plugins/fake_function_framework/examples/fff_example/src/display.c +6 -6
  209. data/plugins/fake_function_framework/examples/fff_example/src/display.h +16 -16
  210. data/plugins/fake_function_framework/examples/fff_example/src/event_processor.c +93 -93
  211. data/plugins/fake_function_framework/examples/fff_example/src/event_processor.h +11 -11
  212. data/plugins/fake_function_framework/examples/fff_example/src/foo.c +16 -16
  213. data/plugins/fake_function_framework/examples/fff_example/src/foo.h +8 -8
  214. data/plugins/fake_function_framework/examples/fff_example/src/subfolder/zzz.c +1 -1
  215. data/plugins/fake_function_framework/examples/fff_example/src/subfolder/zzz.h +6 -6
  216. data/plugins/fake_function_framework/examples/fff_example/test/test_event_processor.c +155 -155
  217. data/plugins/fake_function_framework/examples/fff_example/test/test_foo.c +47 -47
  218. data/plugins/fake_function_framework/lib/fake_function_framework.rb +87 -87
  219. data/plugins/fake_function_framework/lib/fff_mock_generator.rb +163 -163
  220. data/plugins/fake_function_framework/spec/fff_mock_header_generator_spec.rb +304 -304
  221. data/plugins/fake_function_framework/spec/fff_mock_source_generator_spec.rb +148 -148
  222. data/plugins/fake_function_framework/spec/header_generator.rb +50 -50
  223. data/plugins/fake_function_framework/spec/spec_helper.rb +96 -96
  224. data/plugins/fake_function_framework/src/fff_unity_helper.h +32 -32
  225. data/plugins/gcov/README.md +101 -42
  226. data/plugins/gcov/assets/template.erb +15 -15
  227. data/plugins/gcov/config/defaults.yml +73 -66
  228. data/plugins/gcov/gcov.rake +220 -180
  229. data/plugins/gcov/lib/gcov.rb +113 -106
  230. data/plugins/gcov/lib/gcov_constants.rb +19 -18
  231. data/plugins/junit_tests_report/README.md +36 -0
  232. data/plugins/junit_tests_report/lib/junit_tests_report.rb +129 -118
  233. data/plugins/module_generator/config/module_generator.yml +3 -3
  234. data/plugins/module_generator/lib/module_generator.rb +70 -51
  235. data/plugins/module_generator/module_generator.rake +47 -43
  236. data/plugins/raw_output_report/lib/raw_output_report.rb +41 -41
  237. data/plugins/stdout_gtestlike_tests_report/assets/template.erb +84 -84
  238. data/plugins/stdout_gtestlike_tests_report/assets/template.erb copy +59 -59
  239. data/plugins/stdout_gtestlike_tests_report/config/stdout_gtestlike_tests_report.yml +4 -4
  240. data/plugins/stdout_gtestlike_tests_report/lib/stdout_gtestlike_tests_report.rb +43 -43
  241. data/plugins/stdout_ide_tests_report/config/stdout_ide_tests_report.yml +4 -4
  242. data/plugins/stdout_ide_tests_report/lib/stdout_ide_tests_report.rb +44 -44
  243. data/plugins/stdout_pretty_tests_report/assets/template.erb +59 -59
  244. data/plugins/stdout_pretty_tests_report/config/stdout_pretty_tests_report.yml +4 -4
  245. data/plugins/stdout_pretty_tests_report/lib/stdout_pretty_tests_report.rb +47 -47
  246. data/plugins/subprojects/README.md +63 -63
  247. data/plugins/subprojects/config/defaults.yml +33 -33
  248. data/plugins/subprojects/lib/subprojects.rb +92 -92
  249. data/plugins/subprojects/subprojects.rake +78 -78
  250. data/plugins/teamcity_tests_report/config/teamcity_tests_report.yml +4 -4
  251. data/plugins/teamcity_tests_report/lib/teamcity_tests_report.rb +57 -57
  252. data/plugins/warnings_report/lib/warnings_report.rb +69 -69
  253. data/plugins/xml_tests_report/README.md +36 -0
  254. data/plugins/xml_tests_report/lib/xml_tests_report.rb +110 -108
  255. data/spec/build_invoker_utils_spec.rb +54 -54
  256. data/spec/ceedling_spec.rb +154 -154
  257. data/spec/configurator_builder_spec.rb +6 -6
  258. data/spec/configurator_helper_spec.rb +4 -4
  259. data/spec/configurator_spec.rb +9 -9
  260. data/spec/file_finder_helper_spec.rb +53 -53
  261. data/spec/gcov/gcov_deployment_spec.rb +70 -70
  262. data/spec/gcov/gcov_test_cases_spec.rb +91 -91
  263. data/spec/generator_test_results_sanity_checker_spec.rb +88 -88
  264. data/spec/generator_test_results_spec.rb +107 -107
  265. data/spec/par_map_spec.rb +57 -57
  266. data/spec/preprocessinator_extractor_spec.rb +45 -45
  267. data/spec/preprocessinator_includes_handler_spec.rb +202 -186
  268. data/spec/reportinator_spec.rb +19 -19
  269. data/spec/spec_helper.rb +27 -27
  270. data/spec/spec_system_helper.rb +575 -481
  271. data/spec/support/test_example.fail +22 -22
  272. data/spec/support/test_example.pass +22 -22
  273. data/spec/support/test_example_empty.pass +14 -14
  274. data/spec/support/test_example_ignore.pass +22 -22
  275. data/spec/support/test_example_mangled.pass +20 -20
  276. data/spec/support/test_example_with_time.pass +22 -22
  277. data/spec/system/deployment_spec.rb +219 -197
  278. data/spec/system_utils_spec.rb +56 -56
  279. data/spec/target_loader_spec.rb +30 -30
  280. data/spec/tool_executor_helper_spec.rb +310 -310
  281. data/spec/uncatagorized_specs_spec.rb +8 -8
  282. data/vendor/behaviors/Manifest.txt +9 -9
  283. data/vendor/behaviors/Rakefile +19 -19
  284. data/vendor/behaviors/lib/behaviors.rb +76 -76
  285. data/vendor/behaviors/lib/behaviors/reporttask.rb +158 -158
  286. data/vendor/behaviors/test/behaviors_tasks_test.rb +73 -73
  287. data/vendor/behaviors/test/behaviors_test.rb +50 -50
  288. data/vendor/behaviors/test/tasks_test/Rakefile +19 -19
  289. data/vendor/behaviors/test/tasks_test/lib/user.rb +2 -2
  290. data/vendor/behaviors/test/tasks_test/test/user_test.rb +17 -17
  291. data/vendor/c_exception/Gemfile +4 -4
  292. data/vendor/c_exception/Gemfile.lock +12 -12
  293. data/vendor/c_exception/LICENSE.txt +30 -30
  294. data/vendor/c_exception/README.md +162 -162
  295. data/vendor/c_exception/Rakefile +42 -42
  296. data/vendor/c_exception/docs/CException.md +292 -292
  297. data/vendor/c_exception/docs/ThrowTheSwitchCodingStandard.md +207 -207
  298. data/vendor/c_exception/lib/CException.c +46 -46
  299. data/vendor/c_exception/lib/CException.h +115 -110
  300. data/vendor/c_exception/makefile +23 -23
  301. data/vendor/c_exception/test/CExceptionConfig.h +46 -46
  302. data/vendor/c_exception/test/TestException.c +391 -391
  303. data/vendor/c_exception/test/TestException_Runner.c +67 -67
  304. data/vendor/c_exception/vendor/unity/README.md +220 -0
  305. data/vendor/c_exception/vendor/unity/auto/colour_prompt.rb +118 -0
  306. data/vendor/c_exception/vendor/unity/auto/colour_reporter.rb +39 -0
  307. data/vendor/c_exception/vendor/unity/auto/generate_config.yml +36 -0
  308. data/vendor/c_exception/vendor/unity/auto/generate_module.rb +308 -0
  309. data/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +437 -0
  310. data/vendor/c_exception/vendor/unity/auto/parse_output.rb +220 -0
  311. data/vendor/c_exception/vendor/unity/auto/stylize_as_junit.rb +252 -0
  312. data/vendor/c_exception/vendor/unity/auto/test_file_filter.rb +25 -0
  313. data/vendor/c_exception/vendor/unity/auto/type_sanitizer.rb +6 -0
  314. data/vendor/c_exception/vendor/unity/auto/unity_test_summary.py +139 -0
  315. data/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb +136 -0
  316. data/vendor/c_exception/vendor/unity/auto/unity_to_junit.py +146 -0
  317. data/vendor/c_exception/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +207 -0
  318. data/vendor/c_exception/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
  319. data/vendor/c_exception/vendor/unity/docs/UnityAssertionsReference.md +716 -0
  320. data/vendor/c_exception/vendor/unity/docs/UnityConfigurationGuide.md +398 -0
  321. data/vendor/c_exception/vendor/unity/docs/UnityGettingStartedGuide.md +191 -0
  322. data/vendor/c_exception/vendor/unity/docs/UnityHelperScriptsGuide.md +242 -0
  323. data/vendor/{cmock → c_exception}/vendor/unity/docs/license.txt +21 -21
  324. data/vendor/c_exception/vendor/unity/examples/example_1/makefile +71 -0
  325. data/vendor/c_exception/vendor/unity/examples/example_1/readme.txt +5 -0
  326. data/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode.c +24 -0
  327. data/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode.h +3 -0
  328. data/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode2.c +11 -0
  329. data/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode2.h +2 -0
  330. data/vendor/c_exception/vendor/unity/examples/example_1/test/TestProductionCode.c +62 -0
  331. data/vendor/c_exception/vendor/unity/examples/example_1/test/TestProductionCode2.c +31 -0
  332. data/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +53 -0
  333. data/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +57 -0
  334. data/vendor/c_exception/vendor/unity/examples/example_2/makefile +70 -0
  335. data/vendor/c_exception/vendor/unity/examples/example_2/readme.txt +5 -0
  336. data/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode.c +24 -0
  337. data/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode.h +3 -0
  338. data/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode2.c +11 -0
  339. data/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode2.h +2 -0
  340. data/vendor/c_exception/vendor/unity/examples/example_2/test/TestProductionCode.c +64 -0
  341. data/vendor/c_exception/vendor/unity/examples/example_2/test/TestProductionCode2.c +33 -0
  342. data/vendor/c_exception/vendor/unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c +9 -0
  343. data/vendor/c_exception/vendor/unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c +11 -0
  344. data/vendor/c_exception/vendor/unity/examples/example_2/test/test_runners/all_tests.c +12 -0
  345. data/vendor/c_exception/vendor/unity/examples/example_3/helper/UnityHelper.c +10 -0
  346. data/vendor/c_exception/vendor/unity/examples/example_3/helper/UnityHelper.h +12 -0
  347. data/vendor/c_exception/vendor/unity/examples/example_3/rakefile.rb +43 -0
  348. data/vendor/c_exception/vendor/unity/examples/example_3/rakefile_helper.rb +249 -0
  349. data/vendor/c_exception/vendor/unity/examples/example_3/readme.txt +13 -0
  350. data/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode.c +24 -0
  351. data/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode.h +3 -0
  352. data/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode2.c +11 -0
  353. data/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode2.h +2 -0
  354. data/vendor/c_exception/vendor/unity/examples/example_3/target_gcc_32.yml +46 -0
  355. data/vendor/c_exception/vendor/unity/examples/example_3/test/TestProductionCode.c +62 -0
  356. data/vendor/c_exception/vendor/unity/examples/example_3/test/TestProductionCode2.c +31 -0
  357. data/vendor/c_exception/vendor/unity/examples/unity_config.h +237 -0
  358. data/vendor/c_exception/vendor/unity/extras/eclipse/error_parsers.txt +26 -0
  359. data/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb +48 -0
  360. data/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb +178 -0
  361. data/vendor/{cmock → c_exception}/vendor/unity/extras/fixture/readme.txt +8 -8
  362. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +432 -0
  363. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h +83 -0
  364. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +51 -0
  365. data/vendor/{unity → c_exception/vendor/unity}/extras/fixture/src/unity_fixture_malloc_overrides.h +47 -47
  366. data/vendor/c_exception/vendor/unity/extras/fixture/test/Makefile +74 -0
  367. data/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c +22 -0
  368. data/vendor/c_exception/vendor/unity/extras/fixture/test/template_fixture_tests.c +39 -0
  369. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +543 -0
  370. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +57 -0
  371. data/vendor/{cmock → c_exception}/vendor/unity/extras/fixture/test/unity_output_Spy.c +57 -57
  372. data/vendor/{cmock → c_exception}/vendor/unity/extras/fixture/test/unity_output_Spy.h +17 -17
  373. data/vendor/c_exception/vendor/unity/release/build.info +2 -0
  374. data/vendor/c_exception/vendor/unity/release/version.info +2 -0
  375. data/vendor/c_exception/vendor/unity/src/unity.c +1517 -0
  376. data/vendor/c_exception/vendor/unity/src/unity.h +339 -0
  377. data/vendor/c_exception/vendor/unity/src/unity_internals.h +784 -0
  378. data/vendor/c_exception/vendor/unity/test/Makefile +63 -0
  379. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c +61 -0
  380. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c +57 -0
  381. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_head1.c +55 -0
  382. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_head1.h +15 -0
  383. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c +80 -0
  384. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c +76 -0
  385. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_head1.c +75 -0
  386. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_head1.h +13 -0
  387. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c +89 -0
  388. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c +89 -0
  389. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c +77 -0
  390. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c +89 -0
  391. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c +89 -0
  392. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c +90 -0
  393. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c +67 -0
  394. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c +70 -0
  395. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c +58 -0
  396. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c +67 -0
  397. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c +70 -0
  398. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c +71 -0
  399. data/vendor/c_exception/vendor/unity/test/rakefile +125 -0
  400. data/vendor/c_exception/vendor/unity/test/rakefile_helper.rb +260 -0
  401. data/vendor/c_exception/vendor/unity/test/spec/generate_module_existing_file_spec.rb +158 -0
  402. data/vendor/c_exception/vendor/unity/test/targets/clang_file.yml +78 -0
  403. data/vendor/c_exception/vendor/unity/test/targets/clang_strict.yml +78 -0
  404. data/vendor/c_exception/vendor/unity/test/targets/gcc_32.yml +49 -0
  405. data/vendor/c_exception/vendor/unity/test/targets/gcc_64.yml +50 -0
  406. data/vendor/c_exception/vendor/unity/test/targets/gcc_auto_limits.yml +47 -0
  407. data/vendor/c_exception/vendor/unity/test/targets/gcc_auto_stdint.yml +59 -0
  408. data/vendor/c_exception/vendor/unity/test/targets/gcc_manual_math.yml +47 -0
  409. data/vendor/c_exception/vendor/unity/test/targets/hitech_picc18.yml +101 -0
  410. data/vendor/c_exception/vendor/unity/test/targets/iar_arm_v4.yml +90 -0
  411. data/vendor/c_exception/vendor/unity/test/targets/iar_arm_v5.yml +80 -0
  412. data/vendor/c_exception/vendor/unity/test/targets/iar_arm_v5_3.yml +80 -0
  413. data/vendor/c_exception/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +94 -0
  414. data/vendor/c_exception/vendor/unity/test/targets/iar_cortexm3_v5.yml +84 -0
  415. data/vendor/c_exception/vendor/unity/test/targets/iar_msp430.yml +95 -0
  416. data/vendor/c_exception/vendor/unity/test/targets/iar_sh2a_v6.yml +86 -0
  417. data/vendor/c_exception/vendor/unity/test/testdata/CException.h +11 -0
  418. data/vendor/c_exception/vendor/unity/test/testdata/Defs.h +8 -0
  419. data/vendor/c_exception/vendor/unity/test/testdata/cmock.h +14 -0
  420. data/vendor/c_exception/vendor/unity/test/testdata/mockMock.h +13 -0
  421. data/vendor/c_exception/vendor/unity/test/testdata/testRunnerGenerator.c +183 -0
  422. data/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +67 -0
  423. data/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +192 -0
  424. data/vendor/c_exception/vendor/unity/test/tests/test_generate_test_runner.rb +1252 -0
  425. data/vendor/c_exception/vendor/unity/test/tests/testparameterized.c +110 -0
  426. data/vendor/c_exception/vendor/unity/test/tests/testunity.c +4993 -0
  427. data/vendor/cmock/Gemfile +9 -9
  428. data/vendor/cmock/{docs/license.txt → LICENSE.txt} +18 -18
  429. data/vendor/cmock/README.md +34 -34
  430. data/vendor/cmock/config/production_environment.rb +14 -14
  431. data/vendor/cmock/config/test_environment.rb +16 -16
  432. data/vendor/cmock/docs/CMock_Summary.md +689 -603
  433. data/vendor/cmock/docs/ThrowTheSwitchCodingStandard.md +207 -207
  434. data/vendor/cmock/examples/make_example/Makefile +30 -30
  435. data/vendor/cmock/examples/make_example/src/foo.c +5 -5
  436. data/vendor/cmock/examples/make_example/src/foo.h +5 -5
  437. data/vendor/cmock/examples/make_example/src/main.c +15 -15
  438. data/vendor/cmock/examples/make_example/test/test_foo.c +17 -17
  439. data/vendor/cmock/examples/make_example/test/test_main.c +15 -15
  440. data/vendor/cmock/examples/temp_sensor/gcc.yml +44 -44
  441. data/vendor/cmock/examples/temp_sensor/iar_v4.yml +92 -92
  442. data/vendor/cmock/examples/temp_sensor/iar_v5.yml +81 -81
  443. data/vendor/cmock/examples/temp_sensor/rakefile.rb +42 -42
  444. data/vendor/cmock/examples/temp_sensor/rakefile_helper.rb +272 -272
  445. data/vendor/cmock/examples/temp_sensor/src/AT91SAM7X256.h +2556 -2556
  446. data/vendor/cmock/examples/temp_sensor/src/AdcConductor.c +42 -42
  447. data/vendor/cmock/examples/temp_sensor/src/AdcConductor.h +11 -11
  448. data/vendor/cmock/examples/temp_sensor/src/AdcHardware.c +27 -27
  449. data/vendor/cmock/examples/temp_sensor/src/AdcHardware.h +9 -9
  450. data/vendor/cmock/examples/temp_sensor/src/AdcHardwareConfigurator.c +18 -18
  451. data/vendor/cmock/examples/temp_sensor/src/AdcHardwareConfigurator.h +10 -10
  452. data/vendor/cmock/examples/temp_sensor/src/AdcModel.c +33 -33
  453. data/vendor/cmock/examples/temp_sensor/src/AdcModel.h +13 -13
  454. data/vendor/cmock/examples/temp_sensor/src/AdcTemperatureSensor.c +51 -51
  455. data/vendor/cmock/examples/temp_sensor/src/AdcTemperatureSensor.h +10 -10
  456. data/vendor/cmock/examples/temp_sensor/src/Executor.c +25 -25
  457. data/vendor/cmock/examples/temp_sensor/src/Executor.h +9 -9
  458. data/vendor/cmock/examples/temp_sensor/src/IntrinsicsWrapper.c +18 -18
  459. data/vendor/cmock/examples/temp_sensor/src/IntrinsicsWrapper.h +7 -7
  460. data/vendor/cmock/examples/temp_sensor/src/Main.c +46 -46
  461. data/vendor/cmock/examples/temp_sensor/src/Main.h +7 -7
  462. data/vendor/cmock/examples/temp_sensor/src/Model.c +10 -10
  463. data/vendor/cmock/examples/temp_sensor/src/Model.h +8 -8
  464. data/vendor/cmock/examples/temp_sensor/src/ModelConfig.h +7 -7
  465. data/vendor/cmock/examples/temp_sensor/src/TaskScheduler.c +72 -72
  466. data/vendor/cmock/examples/temp_sensor/src/TaskScheduler.h +11 -11
  467. data/vendor/cmock/examples/temp_sensor/src/TemperatureCalculator.c +27 -27
  468. data/vendor/cmock/examples/temp_sensor/src/TemperatureCalculator.h +6 -6
  469. data/vendor/cmock/examples/temp_sensor/src/TemperatureFilter.c +39 -39
  470. data/vendor/cmock/examples/temp_sensor/src/TemperatureFilter.h +10 -10
  471. data/vendor/cmock/examples/temp_sensor/src/TimerConductor.c +15 -15
  472. data/vendor/cmock/examples/temp_sensor/src/TimerConductor.h +9 -9
  473. data/vendor/cmock/examples/temp_sensor/src/TimerConfigurator.c +51 -51
  474. data/vendor/cmock/examples/temp_sensor/src/TimerConfigurator.h +15 -15
  475. data/vendor/cmock/examples/temp_sensor/src/TimerHardware.c +15 -15
  476. data/vendor/cmock/examples/temp_sensor/src/TimerHardware.h +8 -8
  477. data/vendor/cmock/examples/temp_sensor/src/TimerInterruptConfigurator.c +55 -55
  478. data/vendor/cmock/examples/temp_sensor/src/TimerInterruptConfigurator.h +13 -13
  479. data/vendor/cmock/examples/temp_sensor/src/TimerInterruptHandler.c +25 -25
  480. data/vendor/cmock/examples/temp_sensor/src/TimerInterruptHandler.h +10 -10
  481. data/vendor/cmock/examples/temp_sensor/src/TimerModel.c +9 -9
  482. data/vendor/cmock/examples/temp_sensor/src/TimerModel.h +8 -8
  483. data/vendor/cmock/examples/temp_sensor/src/Types.h +103 -103
  484. data/vendor/cmock/examples/temp_sensor/src/UsartBaudRateRegisterCalculator.c +18 -18
  485. data/vendor/cmock/examples/temp_sensor/src/UsartBaudRateRegisterCalculator.h +6 -6
  486. data/vendor/cmock/examples/temp_sensor/src/UsartConductor.c +21 -21
  487. data/vendor/cmock/examples/temp_sensor/src/UsartConductor.h +7 -7
  488. data/vendor/cmock/examples/temp_sensor/src/UsartConfigurator.c +39 -39
  489. data/vendor/cmock/examples/temp_sensor/src/UsartConfigurator.h +13 -13
  490. data/vendor/cmock/examples/temp_sensor/src/UsartHardware.c +22 -22
  491. data/vendor/cmock/examples/temp_sensor/src/UsartHardware.h +9 -9
  492. data/vendor/cmock/examples/temp_sensor/src/UsartModel.c +34 -34
  493. data/vendor/cmock/examples/temp_sensor/src/UsartModel.h +10 -10
  494. data/vendor/cmock/examples/temp_sensor/src/UsartPutChar.c +16 -16
  495. data/vendor/cmock/examples/temp_sensor/src/UsartPutChar.h +8 -8
  496. data/vendor/cmock/examples/temp_sensor/src/UsartTransmitBufferStatus.c +7 -7
  497. data/vendor/cmock/examples/temp_sensor/src/UsartTransmitBufferStatus.h +8 -8
  498. data/vendor/cmock/examples/temp_sensor/test/TestAdcConductor.c +121 -121
  499. data/vendor/cmock/examples/temp_sensor/test/TestAdcHardware.c +44 -44
  500. data/vendor/cmock/examples/temp_sensor/test/TestAdcHardwareConfigurator.c +43 -43
  501. data/vendor/cmock/examples/temp_sensor/test/TestAdcModel.c +33 -33
  502. data/vendor/cmock/examples/temp_sensor/test/TestAdcTemperatureSensor.c +47 -47
  503. data/vendor/cmock/examples/temp_sensor/test/TestExecutor.c +36 -36
  504. data/vendor/cmock/examples/temp_sensor/test/TestMain.c +24 -24
  505. data/vendor/cmock/examples/temp_sensor/test/TestModel.c +20 -20
  506. data/vendor/cmock/examples/temp_sensor/test/TestTaskScheduler.c +104 -104
  507. data/vendor/cmock/examples/temp_sensor/test/TestTemperatureCalculator.c +33 -33
  508. data/vendor/cmock/examples/temp_sensor/test/TestTemperatureFilter.c +69 -69
  509. data/vendor/cmock/examples/temp_sensor/test/TestTimerConductor.c +32 -32
  510. data/vendor/cmock/examples/temp_sensor/test/TestTimerConfigurator.c +112 -112
  511. data/vendor/cmock/examples/temp_sensor/test/TestTimerHardware.c +26 -26
  512. data/vendor/cmock/examples/temp_sensor/test/TestTimerInterruptConfigurator.c +78 -78
  513. data/vendor/cmock/examples/temp_sensor/test/TestTimerInterruptHandler.c +66 -66
  514. data/vendor/cmock/examples/temp_sensor/test/TestTimerModel.c +18 -18
  515. data/vendor/cmock/examples/temp_sensor/test/TestUsartBaudRateRegisterCalculator.c +21 -21
  516. data/vendor/cmock/examples/temp_sensor/test/TestUsartConductor.c +40 -40
  517. data/vendor/cmock/examples/temp_sensor/test/TestUsartConfigurator.c +77 -77
  518. data/vendor/cmock/examples/temp_sensor/test/TestUsartHardware.c +37 -37
  519. data/vendor/cmock/examples/temp_sensor/test/TestUsartModel.c +40 -40
  520. data/vendor/cmock/examples/temp_sensor/test/TestUsartPutChar.c +43 -43
  521. data/vendor/cmock/examples/temp_sensor/test/TestUsartTransmitBufferStatus.c +22 -22
  522. data/vendor/cmock/lib/cmock.rb +86 -86
  523. data/vendor/cmock/lib/cmock_config.rb +153 -145
  524. data/vendor/cmock/lib/cmock_file_writer.rb +44 -44
  525. data/vendor/cmock/lib/cmock_generator.rb +268 -264
  526. data/vendor/cmock/lib/cmock_generator_plugin_array.rb +63 -63
  527. data/vendor/cmock/lib/cmock_generator_plugin_callback.rb +88 -98
  528. data/vendor/cmock/lib/cmock_generator_plugin_cexception.rb +51 -51
  529. data/vendor/cmock/lib/cmock_generator_plugin_expect.rb +103 -104
  530. data/vendor/cmock/lib/cmock_generator_plugin_expect_any_args.rb +53 -54
  531. data/vendor/cmock/lib/cmock_generator_plugin_ignore.rb +75 -75
  532. data/vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb +42 -42
  533. data/vendor/cmock/lib/cmock_generator_plugin_return_thru_ptr.rb +79 -73
  534. data/vendor/cmock/lib/cmock_generator_utils.rb +253 -240
  535. data/vendor/cmock/lib/cmock_header_parser.rb +364 -337
  536. data/vendor/cmock/lib/cmock_plugin_manager.rb +55 -55
  537. data/vendor/cmock/lib/cmock_unityhelper_parser.rb +75 -75
  538. data/vendor/cmock/meson.build +72 -0
  539. data/vendor/cmock/scripts/create_makefile.rb +202 -202
  540. data/vendor/cmock/scripts/create_mock.rb +8 -8
  541. data/vendor/cmock/scripts/create_runner.rb +20 -20
  542. data/vendor/cmock/scripts/test_summary.rb +19 -19
  543. data/vendor/cmock/src/cmock.c +216 -210
  544. data/vendor/cmock/src/cmock.h +40 -38
  545. data/vendor/cmock/src/cmock_internals.h +91 -89
  546. data/vendor/cmock/src/meson.build +17 -0
  547. data/vendor/cmock/test/c/TestCMockC.c +333 -323
  548. data/vendor/cmock/test/c/TestCMockC.yml +14 -13
  549. data/vendor/cmock/test/c/TestCMockCDynamic.c +186 -186
  550. data/vendor/cmock/test/c/TestCMockCDynamic.yml +12 -12
  551. data/vendor/cmock/test/c/TestCMockCDynamic_Runner.c +36 -36
  552. data/vendor/cmock/test/c/TestCMockC_Runner.c +41 -39
  553. data/vendor/cmock/test/iar/iar_v4/Resource/at91SAM7X256_FLASH.xcl +185 -185
  554. data/vendor/cmock/test/iar/iar_v4/Resource/at91SAM7X256_RAM.xcl +185 -185
  555. data/vendor/cmock/test/iar/iar_v4/Resource/ioat91sam7x256.ddf +2259 -2259
  556. data/vendor/cmock/test/iar/iar_v4/cmock_demo.dep +3691 -3691
  557. data/vendor/cmock/test/iar/iar_v4/cmock_demo.ewp +2581 -2581
  558. data/vendor/cmock/test/iar/iar_v4/incIAR/AT91SAM7X-EK.h +61 -61
  559. data/vendor/cmock/test/iar/iar_v4/incIAR/AT91SAM7X256.inc +2314 -2314
  560. data/vendor/cmock/test/iar/iar_v4/incIAR/AT91SAM7X256.rdf +4704 -4704
  561. data/vendor/cmock/test/iar/iar_v4/incIAR/AT91SAM7X256.tcl +3407 -3407
  562. data/vendor/cmock/test/iar/iar_v4/incIAR/AT91SAM7X256_inc.h +2268 -2268
  563. data/vendor/cmock/test/iar/iar_v4/incIAR/ioat91sam7x256.h +4380 -4380
  564. data/vendor/cmock/test/iar/iar_v4/incIAR/lib_AT91SAM7X256.h +4211 -4211
  565. data/vendor/cmock/test/iar/iar_v4/settings/cmock_demo.cspy.bat +32 -32
  566. data/vendor/cmock/test/iar/iar_v4/srcIAR/Cstartup.s79 +265 -265
  567. data/vendor/cmock/test/iar/iar_v4/srcIAR/Cstartup_SAM7.c +98 -98
  568. data/vendor/cmock/test/iar/iar_v5/Resource/at91SAM7X256_FLASH.icf +43 -43
  569. data/vendor/cmock/test/iar/iar_v5/Resource/at91SAM7X256_RAM.icf +42 -42
  570. data/vendor/cmock/test/iar/iar_v5/cmock_demo.dep +4204 -4204
  571. data/vendor/cmock/test/iar/iar_v5/cmock_demo.ewp +2426 -2426
  572. data/vendor/cmock/test/iar/iar_v5/incIAR/AT91SAM7X-EK.h +61 -61
  573. data/vendor/cmock/test/iar/iar_v5/incIAR/AT91SAM7X256_inc.h +2268 -2268
  574. data/vendor/cmock/test/iar/iar_v5/incIAR/lib_AT91SAM7X256.h +4211 -4211
  575. data/vendor/cmock/test/iar/iar_v5/incIAR/project.h +30 -30
  576. data/vendor/cmock/test/iar/iar_v5/settings/BasicInterrupt_SAM7X.cspy.bat +33 -33
  577. data/vendor/cmock/test/iar/iar_v5/settings/BasicInterrupt_SAM7X_FLASH_Debug.jlink +12 -12
  578. data/vendor/cmock/test/iar/iar_v5/settings/cmock_demo.cspy.bat +33 -33
  579. data/vendor/cmock/test/iar/iar_v5/settings/cmock_demo_Binary.jlink +12 -12
  580. data/vendor/cmock/test/iar/iar_v5/settings/cmock_demo_FLASH_Debug.jlink +12 -12
  581. data/vendor/cmock/test/iar/iar_v5/settings/cmock_demo_RAM_Debug.jlink +12 -12
  582. data/vendor/cmock/test/iar/iar_v5/srcIAR/Cstartup.s +299 -299
  583. data/vendor/cmock/test/iar/iar_v5/srcIAR/Cstartup_SAM7.c +98 -98
  584. data/vendor/cmock/test/rakefile +106 -106
  585. data/vendor/cmock/test/rakefile_helper.rb +382 -381
  586. data/vendor/cmock/test/system/systest_generator.rb +193 -194
  587. data/vendor/cmock/test/system/test_compilation/callingconv.h +11 -11
  588. data/vendor/cmock/test/system/test_compilation/config.yml +9 -9
  589. data/vendor/cmock/test/system/test_compilation/const.h +37 -37
  590. data/vendor/cmock/test/system/test_compilation/osek.h +275 -275
  591. data/vendor/cmock/test/system/test_compilation/parsing.h +89 -52
  592. data/vendor/cmock/test/system/test_interactions/all_plugins_but_other_limits.yml +375 -375
  593. data/vendor/cmock/test/system/test_interactions/all_plugins_coexist.yml +459 -459
  594. data/vendor/cmock/test/system/test_interactions/array_and_pointer_handling.yml +446 -446
  595. data/vendor/cmock/test/system/test_interactions/basic_expect_and_return.yml +124 -124
  596. data/vendor/cmock/test/system/test_interactions/const_primitives_handling.yml +87 -87
  597. data/vendor/cmock/test/system/test_interactions/doesnt_leave_details_behind.yml +308 -308
  598. data/vendor/cmock/test/system/test_interactions/enforce_strict_ordering.yml +247 -247
  599. data/vendor/cmock/test/system/test_interactions/expect_and_return_custom_types.yml +108 -108
  600. data/vendor/cmock/test/system/test_interactions/expect_and_return_treat_as.yml +173 -173
  601. data/vendor/cmock/test/system/test_interactions/expect_and_throw.yml +170 -170
  602. data/vendor/cmock/test/system/test_interactions/expect_any_args.yml +238 -238
  603. data/vendor/cmock/test/system/test_interactions/fancy_pointer_handling.yml +210 -210
  604. data/vendor/cmock/test/system/test_interactions/function_pointer_handling.yml +82 -82
  605. data/vendor/cmock/test/system/test_interactions/ignore_and_return.yml +329 -329
  606. data/vendor/cmock/test/system/test_interactions/ignore_strict_mock_calling.yml +37 -37
  607. data/vendor/cmock/test/system/test_interactions/newer_standards_stuff1.yml +52 -52
  608. data/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_1.yml +91 -91
  609. data/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_2.yml +59 -59
  610. data/vendor/cmock/test/system/test_interactions/out_of_memory.yml +65 -65
  611. data/vendor/cmock/test/system/test_interactions/parsing_challenges.yml +242 -242
  612. data/vendor/cmock/test/system/test_interactions/return_thru_ptr_and_expect_any_args.yml +235 -235
  613. data/vendor/cmock/test/system/test_interactions/return_thru_ptr_ignore_arg.yml +231 -231
  614. data/vendor/cmock/test/system/test_interactions/struct_union_enum_expect_and_return.yml +277 -277
  615. data/vendor/cmock/test/system/test_interactions/struct_union_enum_expect_and_return_with_plugins.yml +280 -280
  616. data/vendor/cmock/test/system/test_interactions/stubs_with_callbacks.yml +221 -221
  617. data/vendor/cmock/test/system/test_interactions/unity_64bit_support.yml +77 -77
  618. data/vendor/cmock/test/system/test_interactions/unity_ignores.yml +139 -139
  619. data/vendor/cmock/test/system/test_interactions/unity_void_pointer_compare.yml +91 -0
  620. data/vendor/cmock/test/targets/clang_strict.yml +90 -90
  621. data/vendor/cmock/test/targets/gcc.yml +58 -58
  622. data/vendor/cmock/test/targets/gcc_64.yml +58 -58
  623. data/vendor/cmock/test/targets/gcc_tiny.yml +80 -80
  624. data/vendor/cmock/test/targets/iar_arm_v4.yml +110 -110
  625. data/vendor/cmock/test/targets/iar_arm_v5.yml +95 -95
  626. data/vendor/cmock/test/test_helper.rb +44 -44
  627. data/vendor/cmock/test/unit/cmock_config_test.rb +120 -120
  628. data/vendor/cmock/test/unit/cmock_config_test.yml +5 -5
  629. data/vendor/cmock/test/unit/cmock_file_writer_test.rb +27 -27
  630. data/vendor/cmock/test/unit/cmock_generator_main_test.rb +548 -542
  631. data/vendor/cmock/test/unit/cmock_generator_plugin_array_test.rb +141 -141
  632. data/vendor/cmock/test/unit/cmock_generator_plugin_callback_test.rb +281 -259
  633. data/vendor/cmock/test/unit/cmock_generator_plugin_cexception_test.rb +96 -96
  634. data/vendor/cmock/test/unit/cmock_generator_plugin_expect_a_test.rb +183 -186
  635. data/vendor/cmock/test/unit/cmock_generator_plugin_expect_any_args_test.rb +67 -60
  636. data/vendor/cmock/test/unit/cmock_generator_plugin_expect_b_test.rb +200 -203
  637. data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_arg_test.rb +116 -116
  638. data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_test.rb +105 -105
  639. data/vendor/cmock/test/unit/cmock_generator_plugin_return_thru_ptr_test.rb +136 -136
  640. data/vendor/cmock/test/unit/cmock_generator_utils_test.rb +415 -394
  641. data/vendor/cmock/test/unit/cmock_header_parser_test.rb +1728 -1699
  642. data/vendor/cmock/test/unit/cmock_plugin_manager_test.rb +100 -91
  643. data/vendor/cmock/test/unit/cmock_unityhelper_parser_test.rb +223 -223
  644. data/vendor/cmock/vendor/behaviors/Manifest.txt +9 -9
  645. data/vendor/cmock/vendor/behaviors/Rakefile +19 -19
  646. data/vendor/cmock/vendor/behaviors/lib/behaviors.rb +76 -76
  647. data/vendor/cmock/vendor/behaviors/lib/behaviors/reporttask.rb +158 -158
  648. data/vendor/cmock/vendor/behaviors/test/behaviors_tasks_test.rb +73 -73
  649. data/vendor/cmock/vendor/behaviors/test/behaviors_test.rb +50 -50
  650. data/vendor/cmock/vendor/behaviors/test/tasks_test/Rakefile +19 -19
  651. data/vendor/cmock/vendor/behaviors/test/tasks_test/lib/user.rb +2 -2
  652. data/vendor/cmock/vendor/behaviors/test/tasks_test/test/user_test.rb +17 -17
  653. data/vendor/cmock/vendor/c_exception/Gemfile +4 -4
  654. data/vendor/cmock/vendor/c_exception/Gemfile.lock +12 -12
  655. data/vendor/cmock/vendor/c_exception/LICENSE.txt +30 -30
  656. data/vendor/cmock/vendor/c_exception/README.md +162 -162
  657. data/vendor/cmock/vendor/c_exception/Rakefile +42 -42
  658. data/vendor/cmock/vendor/c_exception/docs/CException.md +292 -292
  659. data/vendor/cmock/vendor/c_exception/docs/ThrowTheSwitchCodingStandard.md +207 -207
  660. data/vendor/cmock/vendor/c_exception/lib/CException.c +46 -46
  661. data/vendor/cmock/vendor/c_exception/lib/CException.h +115 -110
  662. data/vendor/cmock/vendor/c_exception/makefile +23 -23
  663. data/vendor/cmock/vendor/c_exception/test/CExceptionConfig.h +46 -46
  664. data/vendor/cmock/vendor/c_exception/test/TestException.c +391 -391
  665. data/vendor/cmock/vendor/c_exception/test/TestException_Runner.c +67 -67
  666. data/vendor/cmock/vendor/unity/CMakeLists.txt +31 -0
  667. data/vendor/{unity/docs/license.txt → cmock/vendor/unity/LICENSE.txt} +21 -21
  668. data/vendor/cmock/vendor/unity/README.md +191 -231
  669. data/vendor/cmock/vendor/unity/auto/colour_prompt.rb +119 -118
  670. data/vendor/cmock/vendor/unity/auto/colour_reporter.rb +39 -39
  671. data/vendor/cmock/vendor/unity/auto/generate_config.yml +36 -36
  672. data/vendor/cmock/vendor/unity/auto/generate_module.rb +309 -308
  673. data/vendor/cmock/vendor/unity/auto/generate_test_runner.rb +495 -457
  674. data/vendor/cmock/vendor/unity/auto/parse_output.rb +322 -323
  675. data/vendor/cmock/vendor/unity/auto/run_test.erb +36 -0
  676. data/vendor/cmock/vendor/unity/auto/stylize_as_junit.rb +251 -252
  677. data/vendor/cmock/vendor/unity/auto/test_file_filter.rb +25 -25
  678. data/vendor/cmock/vendor/unity/auto/type_sanitizer.rb +6 -6
  679. data/vendor/cmock/vendor/unity/auto/unity_test_summary.py +139 -139
  680. data/vendor/cmock/vendor/unity/auto/unity_test_summary.rb +135 -136
  681. data/vendor/cmock/vendor/unity/auto/unity_to_junit.py +146 -146
  682. data/vendor/cmock/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +206 -206
  683. data/vendor/cmock/vendor/unity/docs/UnityAssertionsReference.md +850 -779
  684. data/vendor/cmock/vendor/unity/docs/UnityConfigurationGuide.md +541 -433
  685. data/vendor/cmock/vendor/unity/docs/UnityGettingStartedGuide.md +251 -192
  686. data/vendor/cmock/vendor/unity/docs/UnityHelperScriptsGuide.md +266 -260
  687. data/vendor/cmock/vendor/unity/examples/example_1/makefile +72 -71
  688. data/vendor/cmock/vendor/unity/examples/example_1/readme.txt +4 -4
  689. data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode.c +24 -24
  690. data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode.h +3 -3
  691. data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode2.c +11 -11
  692. data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode2.h +2 -2
  693. data/vendor/cmock/vendor/unity/examples/example_1/test/TestProductionCode.c +62 -62
  694. data/vendor/cmock/vendor/unity/examples/example_1/test/TestProductionCode2.c +31 -31
  695. data/vendor/cmock/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +53 -53
  696. data/vendor/cmock/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +57 -57
  697. data/vendor/cmock/vendor/unity/examples/example_2/makefile +71 -70
  698. data/vendor/cmock/vendor/unity/examples/example_2/readme.txt +4 -4
  699. data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode.c +24 -24
  700. data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode.h +3 -3
  701. data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode2.c +11 -11
  702. data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode2.h +2 -2
  703. data/vendor/cmock/vendor/unity/examples/example_2/test/TestProductionCode.c +64 -64
  704. data/vendor/cmock/vendor/unity/examples/example_2/test/TestProductionCode2.c +33 -33
  705. data/vendor/cmock/vendor/unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c +8 -8
  706. data/vendor/cmock/vendor/unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c +10 -10
  707. data/vendor/cmock/vendor/unity/examples/example_2/test/test_runners/all_tests.c +12 -12
  708. data/vendor/cmock/vendor/unity/examples/example_3/helper/UnityHelper.c +10 -10
  709. data/vendor/cmock/vendor/unity/examples/example_3/helper/UnityHelper.h +12 -12
  710. data/vendor/cmock/vendor/unity/examples/example_3/rakefile.rb +38 -43
  711. data/vendor/cmock/vendor/unity/examples/example_3/rakefile_helper.rb +250 -249
  712. data/vendor/cmock/vendor/unity/examples/example_3/readme.txt +13 -13
  713. data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode.c +24 -24
  714. data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode.h +3 -3
  715. data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode2.c +11 -11
  716. data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode2.h +2 -2
  717. data/vendor/cmock/vendor/unity/examples/example_3/target_gcc_32.yml +47 -46
  718. data/vendor/cmock/vendor/unity/examples/example_3/test/TestProductionCode.c +62 -62
  719. data/vendor/cmock/vendor/unity/examples/example_3/test/TestProductionCode2.c +31 -31
  720. data/vendor/cmock/vendor/unity/examples/example_4/meson.build +17 -0
  721. data/vendor/cmock/vendor/unity/examples/example_4/readme.txt +15 -0
  722. data/vendor/cmock/vendor/unity/examples/example_4/src/ProductionCode.c +24 -0
  723. data/vendor/cmock/vendor/unity/examples/example_4/src/ProductionCode.h +3 -0
  724. data/vendor/cmock/vendor/unity/examples/example_4/src/ProductionCode2.c +11 -0
  725. data/vendor/cmock/vendor/unity/examples/example_4/src/ProductionCode2.h +2 -0
  726. data/vendor/cmock/vendor/unity/examples/example_4/src/meson.build +21 -0
  727. data/vendor/cmock/vendor/unity/examples/example_4/subprojects/unity.wrap +4 -0
  728. data/vendor/cmock/vendor/unity/examples/example_4/test/TestProductionCode.c +63 -0
  729. data/vendor/cmock/vendor/unity/examples/example_4/test/TestProductionCode2.c +35 -0
  730. data/vendor/cmock/vendor/unity/examples/example_4/test/meson.build +12 -0
  731. data/vendor/cmock/vendor/unity/examples/example_4/test/test_runners/TestProductionCode2_Runner.c +53 -0
  732. data/vendor/cmock/vendor/unity/examples/example_4/test/test_runners/TestProductionCode_Runner.c +57 -0
  733. data/vendor/cmock/vendor/unity/examples/example_4/test/test_runners/meson.build +16 -0
  734. data/vendor/cmock/vendor/unity/examples/unity_config.h +263 -247
  735. data/vendor/cmock/vendor/unity/extras/eclipse/error_parsers.txt +26 -26
  736. data/vendor/cmock/vendor/unity/extras/fixture/rakefile.rb +44 -48
  737. data/vendor/cmock/vendor/unity/extras/fixture/rakefile_helper.rb +183 -178
  738. data/vendor/cmock/vendor/unity/extras/fixture/readme.md +17 -0
  739. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c +275 -436
  740. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h +83 -83
  741. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h +50 -51
  742. data/vendor/cmock/vendor/unity/extras/fixture/test/Makefile +72 -75
  743. data/vendor/cmock/vendor/unity/extras/fixture/test/main/AllTests.c +20 -22
  744. data/vendor/cmock/vendor/unity/extras/fixture/test/template_fixture_tests.c +39 -39
  745. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c +245 -543
  746. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +32 -57
  747. data/vendor/cmock/vendor/unity/extras/memory/rakefile.rb +45 -0
  748. data/vendor/cmock/vendor/unity/extras/memory/rakefile_helper.rb +187 -0
  749. data/vendor/cmock/vendor/unity/extras/memory/readme.md +49 -0
  750. data/vendor/cmock/vendor/unity/extras/memory/src/unity_memory.c +202 -0
  751. data/vendor/cmock/vendor/unity/extras/{fixture/src/unity_fixture_malloc_overrides.h → memory/src/unity_memory.h} +60 -47
  752. data/vendor/cmock/vendor/unity/extras/memory/test/Makefile +78 -0
  753. data/vendor/cmock/vendor/unity/extras/memory/test/unity_memory_Test.c +325 -0
  754. data/vendor/cmock/vendor/unity/extras/memory/test/unity_memory_TestRunner.c +49 -0
  755. data/vendor/{unity/extras/fixture → cmock/vendor/unity/extras/memory}/test/unity_output_Spy.c +56 -57
  756. data/vendor/{unity/extras/fixture → cmock/vendor/unity/extras/memory}/test/unity_output_Spy.h +16 -17
  757. data/vendor/cmock/vendor/unity/meson.build +69 -0
  758. data/vendor/cmock/vendor/unity/src/CMakeLists.txt +22 -0
  759. data/vendor/cmock/vendor/unity/src/meson.build +16 -0
  760. data/vendor/cmock/vendor/unity/src/unity.c +2085 -1572
  761. data/vendor/cmock/vendor/unity/src/unity.h +617 -503
  762. data/vendor/cmock/vendor/unity/src/unity_internals.h +1002 -924
  763. data/vendor/cmock/vendor/unity/test/Makefile +67 -68
  764. data/vendor/cmock/vendor/unity/test/expectdata/testsample_cmd.c +61 -61
  765. data/vendor/cmock/vendor/unity/test/expectdata/testsample_def.c +57 -57
  766. data/vendor/cmock/vendor/unity/test/expectdata/testsample_head1.c +55 -55
  767. data/vendor/cmock/vendor/unity/test/expectdata/testsample_head1.h +15 -15
  768. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_cmd.c +80 -80
  769. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_def.c +76 -76
  770. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_head1.c +75 -75
  771. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_head1.h +13 -13
  772. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new1.c +89 -89
  773. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new2.c +89 -89
  774. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_param.c +77 -77
  775. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run1.c +89 -89
  776. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run2.c +89 -89
  777. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_yaml.c +90 -90
  778. data/vendor/cmock/vendor/unity/test/expectdata/testsample_new1.c +67 -67
  779. data/vendor/cmock/vendor/unity/test/expectdata/testsample_new2.c +70 -70
  780. data/vendor/cmock/vendor/unity/test/expectdata/testsample_param.c +58 -58
  781. data/vendor/cmock/vendor/unity/test/expectdata/testsample_run1.c +67 -67
  782. data/vendor/cmock/vendor/unity/test/expectdata/testsample_run2.c +70 -70
  783. data/vendor/cmock/vendor/unity/test/expectdata/testsample_yaml.c +71 -71
  784. data/vendor/cmock/vendor/unity/test/rakefile +124 -125
  785. data/vendor/cmock/vendor/unity/test/rakefile_helper.rb +269 -260
  786. data/vendor/cmock/vendor/unity/test/spec/generate_module_existing_file_spec.rb +158 -158
  787. data/vendor/cmock/vendor/unity/test/targets/ansi.yml +49 -0
  788. data/vendor/cmock/vendor/unity/test/targets/clang_file.yml +78 -78
  789. data/vendor/cmock/vendor/unity/test/targets/clang_strict.yml +78 -78
  790. data/vendor/cmock/vendor/unity/test/targets/gcc_32.yml +49 -49
  791. data/vendor/cmock/vendor/unity/test/targets/gcc_64.yml +50 -50
  792. data/vendor/cmock/vendor/unity/test/targets/gcc_auto_limits.yml +47 -47
  793. data/vendor/cmock/vendor/unity/test/targets/gcc_auto_stdint.yml +59 -59
  794. data/vendor/cmock/vendor/unity/test/targets/gcc_manual_math.yml +47 -47
  795. data/vendor/cmock/vendor/unity/test/targets/hitech_picc18.yml +101 -101
  796. data/vendor/cmock/vendor/unity/test/targets/iar_arm_v4.yml +90 -90
  797. data/vendor/cmock/vendor/unity/test/targets/iar_arm_v5.yml +80 -80
  798. data/vendor/cmock/vendor/unity/test/targets/iar_arm_v5_3.yml +80 -80
  799. data/vendor/cmock/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +94 -94
  800. data/vendor/cmock/vendor/unity/test/targets/iar_cortexm3_v5.yml +84 -84
  801. data/vendor/cmock/vendor/unity/test/targets/iar_msp430.yml +95 -95
  802. data/vendor/cmock/vendor/unity/test/targets/iar_sh2a_v6.yml +86 -86
  803. data/vendor/cmock/vendor/unity/test/testdata/CException.h +11 -11
  804. data/vendor/cmock/vendor/unity/test/testdata/Defs.h +8 -8
  805. data/vendor/cmock/vendor/unity/test/testdata/cmock.h +14 -14
  806. data/vendor/cmock/vendor/unity/test/testdata/mockMock.h +13 -13
  807. data/vendor/cmock/vendor/unity/test/testdata/testRunnerGenerator.c +189 -186
  808. data/vendor/cmock/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +70 -70
  809. data/vendor/cmock/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +197 -195
  810. data/vendor/cmock/vendor/unity/test/tests/test_generate_test_runner.rb +1268 -1252
  811. data/vendor/cmock/vendor/unity/test/tests/testparameterized.c +171 -113
  812. data/vendor/cmock/vendor/unity/test/tests/testunity.c +8168 -5371
  813. data/vendor/deep_merge/MIT-LICENSE +20 -20
  814. data/vendor/deep_merge/README +94 -94
  815. data/vendor/deep_merge/Rakefile +28 -28
  816. data/vendor/deep_merge/lib/deep_merge.rb +211 -211
  817. data/vendor/deep_merge/test/test_deep_merge.rb +553 -553
  818. data/vendor/diy/History.txt +28 -28
  819. data/vendor/diy/README.rdoc +233 -233
  820. data/vendor/diy/Rakefile +33 -33
  821. data/vendor/diy/TODO.txt +9 -9
  822. data/vendor/diy/diy.gemspec +131 -131
  823. data/vendor/diy/lib/diy.rb +403 -403
  824. data/vendor/diy/lib/diy/factory.rb +36 -36
  825. data/vendor/diy/sample_code/car.rb +7 -7
  826. data/vendor/diy/sample_code/chassis.rb +5 -5
  827. data/vendor/diy/sample_code/diy_example.rb +26 -26
  828. data/vendor/diy/sample_code/engine.rb +5 -5
  829. data/vendor/diy/sample_code/objects.yml +10 -10
  830. data/vendor/diy/test/constructor.rb +119 -119
  831. data/vendor/diy/test/diy_test.rb +608 -608
  832. data/vendor/diy/test/factory_test.rb +79 -79
  833. data/vendor/diy/test/files/broken_construction.yml +7 -7
  834. data/vendor/diy/test/files/cat/cat.rb +3 -3
  835. data/vendor/diy/test/files/cat/extra_conflict.yml +5 -5
  836. data/vendor/diy/test/files/cat/heritage.rb +2 -2
  837. data/vendor/diy/test/files/cat/needs_input.yml +3 -3
  838. data/vendor/diy/test/files/cat/the_cat_lineage.rb +1 -1
  839. data/vendor/diy/test/files/dog/dog_model.rb +3 -3
  840. data/vendor/diy/test/files/dog/dog_presenter.rb +3 -3
  841. data/vendor/diy/test/files/dog/dog_view.rb +2 -2
  842. data/vendor/diy/test/files/dog/file_resolver.rb +2 -2
  843. data/vendor/diy/test/files/dog/other_thing.rb +2 -2
  844. data/vendor/diy/test/files/dog/simple.yml +11 -11
  845. data/vendor/diy/test/files/donkey/foo.rb +8 -8
  846. data/vendor/diy/test/files/donkey/foo/bar/qux.rb +7 -7
  847. data/vendor/diy/test/files/factory/beef.rb +5 -5
  848. data/vendor/diy/test/files/factory/dog.rb +6 -6
  849. data/vendor/diy/test/files/factory/factory.yml +19 -19
  850. data/vendor/diy/test/files/factory/farm/llama.rb +7 -7
  851. data/vendor/diy/test/files/factory/farm/pork.rb +7 -7
  852. data/vendor/diy/test/files/factory/kitten.rb +13 -13
  853. data/vendor/diy/test/files/fud/objects.yml +13 -13
  854. data/vendor/diy/test/files/fud/toy.rb +14 -14
  855. data/vendor/diy/test/files/functions/attached_things_builder.rb +1 -1
  856. data/vendor/diy/test/files/functions/invalid_method.yml +4 -4
  857. data/vendor/diy/test/files/functions/method_extractor.rb +2 -2
  858. data/vendor/diy/test/files/functions/nonsingleton_objects.yml +5 -5
  859. data/vendor/diy/test/files/functions/objects.yml +21 -21
  860. data/vendor/diy/test/files/functions/thing.rb +2 -2
  861. data/vendor/diy/test/files/functions/thing_builder.rb +24 -24
  862. data/vendor/diy/test/files/functions/things_builder.rb +2 -2
  863. data/vendor/diy/test/files/gnu/objects.yml +14 -14
  864. data/vendor/diy/test/files/gnu/thinger.rb +7 -7
  865. data/vendor/diy/test/files/goat/base.rb +8 -8
  866. data/vendor/diy/test/files/goat/can.rb +6 -6
  867. data/vendor/diy/test/files/goat/goat.rb +6 -6
  868. data/vendor/diy/test/files/goat/objects.yml +12 -12
  869. data/vendor/diy/test/files/goat/paper.rb +6 -6
  870. data/vendor/diy/test/files/goat/plane.rb +7 -7
  871. data/vendor/diy/test/files/goat/shirt.rb +6 -6
  872. data/vendor/diy/test/files/goat/wings.rb +8 -8
  873. data/vendor/diy/test/files/horse/holder_thing.rb +3 -3
  874. data/vendor/diy/test/files/horse/objects.yml +7 -7
  875. data/vendor/diy/test/files/namespace/animal/bird.rb +5 -5
  876. data/vendor/diy/test/files/namespace/animal/cat.rb +5 -5
  877. data/vendor/diy/test/files/namespace/animal/reptile/hardshell/turtle.rb +8 -8
  878. data/vendor/diy/test/files/namespace/animal/reptile/lizard.rb +7 -7
  879. data/vendor/diy/test/files/namespace/bad_module_specified.yml +8 -8
  880. data/vendor/diy/test/files/namespace/class_name_combine.yml +8 -8
  881. data/vendor/diy/test/files/namespace/no_module_specified.yml +8 -8
  882. data/vendor/diy/test/files/namespace/objects.yml +21 -21
  883. data/vendor/diy/test/files/namespace/road.rb +2 -2
  884. data/vendor/diy/test/files/namespace/sky.rb +2 -2
  885. data/vendor/diy/test/files/namespace/subcontext.yml +22 -22
  886. data/vendor/diy/test/files/non_singleton/air.rb +2 -2
  887. data/vendor/diy/test/files/non_singleton/fat_cat.rb +3 -3
  888. data/vendor/diy/test/files/non_singleton/objects.yml +19 -19
  889. data/vendor/diy/test/files/non_singleton/pig.rb +3 -3
  890. data/vendor/diy/test/files/non_singleton/thread_spinner.rb +3 -3
  891. data/vendor/diy/test/files/non_singleton/tick.rb +3 -3
  892. data/vendor/diy/test/files/non_singleton/yard.rb +2 -2
  893. data/vendor/diy/test/files/yak/core_model.rb +3 -3
  894. data/vendor/diy/test/files/yak/core_presenter.rb +3 -3
  895. data/vendor/diy/test/files/yak/core_view.rb +1 -1
  896. data/vendor/diy/test/files/yak/data_source.rb +1 -1
  897. data/vendor/diy/test/files/yak/fringe_model.rb +3 -3
  898. data/vendor/diy/test/files/yak/fringe_presenter.rb +3 -3
  899. data/vendor/diy/test/files/yak/fringe_view.rb +1 -1
  900. data/vendor/diy/test/files/yak/giant_squid.rb +3 -3
  901. data/vendor/diy/test/files/yak/krill.rb +2 -2
  902. data/vendor/diy/test/files/yak/my_objects.yml +21 -21
  903. data/vendor/diy/test/files/yak/sub_sub_context_test.yml +27 -27
  904. data/vendor/diy/test/test_helper.rb +55 -55
  905. data/vendor/hardmock/CHANGES +78 -78
  906. data/vendor/hardmock/LICENSE +7 -7
  907. data/vendor/hardmock/README +70 -70
  908. data/vendor/hardmock/Rakefile +8 -8
  909. data/vendor/hardmock/config/environment.rb +12 -12
  910. data/vendor/hardmock/lib/assert_error.rb +23 -23
  911. data/vendor/hardmock/lib/extend_test_unit.rb +14 -14
  912. data/vendor/hardmock/lib/hardmock.rb +86 -86
  913. data/vendor/hardmock/lib/hardmock/errors.rb +22 -22
  914. data/vendor/hardmock/lib/hardmock/expectation.rb +229 -229
  915. data/vendor/hardmock/lib/hardmock/expectation_builder.rb +9 -9
  916. data/vendor/hardmock/lib/hardmock/expector.rb +26 -26
  917. data/vendor/hardmock/lib/hardmock/method_cleanout.rb +33 -33
  918. data/vendor/hardmock/lib/hardmock/mock.rb +180 -180
  919. data/vendor/hardmock/lib/hardmock/mock_control.rb +53 -53
  920. data/vendor/hardmock/lib/hardmock/stubbing.rb +210 -210
  921. data/vendor/hardmock/lib/hardmock/trapper.rb +31 -31
  922. data/vendor/hardmock/lib/hardmock/utils.rb +9 -9
  923. data/vendor/hardmock/lib/test_unit_before_after.rb +169 -169
  924. data/vendor/hardmock/rake_tasks/rdoc.rake +19 -19
  925. data/vendor/hardmock/rake_tasks/rdoc_options.rb +4 -4
  926. data/vendor/hardmock/rake_tasks/test.rake +22 -22
  927. data/vendor/hardmock/test/functional/assert_error_test.rb +52 -52
  928. data/vendor/hardmock/test/functional/auto_verify_test.rb +178 -178
  929. data/vendor/hardmock/test/functional/direct_mock_usage_test.rb +396 -396
  930. data/vendor/hardmock/test/functional/hardmock_test.rb +434 -434
  931. data/vendor/hardmock/test/functional/stubbing_test.rb +479 -479
  932. data/vendor/hardmock/test/test_helper.rb +43 -43
  933. data/vendor/hardmock/test/unit/expectation_builder_test.rb +19 -19
  934. data/vendor/hardmock/test/unit/expectation_test.rb +372 -372
  935. data/vendor/hardmock/test/unit/expector_test.rb +57 -57
  936. data/vendor/hardmock/test/unit/method_cleanout_test.rb +36 -36
  937. data/vendor/hardmock/test/unit/mock_control_test.rb +175 -175
  938. data/vendor/hardmock/test/unit/mock_test.rb +279 -279
  939. data/vendor/hardmock/test/unit/test_unit_before_after_test.rb +452 -452
  940. data/vendor/hardmock/test/unit/trapper_test.rb +62 -62
  941. data/vendor/hardmock/test/unit/verify_error_test.rb +40 -40
  942. data/vendor/unity/CMakeLists.txt +31 -0
  943. data/vendor/unity/LICENSE.txt +21 -0
  944. data/vendor/unity/README.md +191 -231
  945. data/vendor/unity/auto/colour_prompt.rb +119 -118
  946. data/vendor/unity/auto/colour_reporter.rb +39 -39
  947. data/vendor/unity/auto/generate_config.yml +36 -36
  948. data/vendor/unity/auto/generate_module.rb +309 -308
  949. data/vendor/unity/auto/generate_test_runner.rb +495 -457
  950. data/vendor/unity/auto/parse_output.rb +322 -323
  951. data/vendor/unity/auto/run_test.erb +36 -0
  952. data/vendor/unity/auto/stylize_as_junit.rb +251 -252
  953. data/vendor/unity/auto/test_file_filter.rb +25 -25
  954. data/vendor/unity/auto/type_sanitizer.rb +6 -6
  955. data/vendor/unity/auto/unity_test_summary.py +139 -139
  956. data/vendor/unity/auto/unity_test_summary.rb +135 -136
  957. data/vendor/unity/auto/unity_to_junit.py +146 -146
  958. data/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +206 -206
  959. data/vendor/unity/docs/UnityAssertionsReference.md +850 -779
  960. data/vendor/unity/docs/UnityConfigurationGuide.md +541 -433
  961. data/vendor/unity/docs/UnityGettingStartedGuide.md +251 -192
  962. data/vendor/unity/docs/UnityHelperScriptsGuide.md +266 -260
  963. data/vendor/unity/examples/example_1/makefile +72 -71
  964. data/vendor/unity/examples/example_1/readme.txt +4 -4
  965. data/vendor/unity/examples/example_1/src/ProductionCode.c +24 -24
  966. data/vendor/unity/examples/example_1/src/ProductionCode.h +3 -3
  967. data/vendor/unity/examples/example_1/src/ProductionCode2.c +11 -11
  968. data/vendor/unity/examples/example_1/src/ProductionCode2.h +2 -2
  969. data/vendor/unity/examples/example_1/test/TestProductionCode.c +62 -62
  970. data/vendor/unity/examples/example_1/test/TestProductionCode2.c +31 -31
  971. data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +53 -53
  972. data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +57 -57
  973. data/vendor/unity/examples/example_2/makefile +71 -70
  974. data/vendor/unity/examples/example_2/readme.txt +4 -4
  975. data/vendor/unity/examples/example_2/src/ProductionCode.c +24 -24
  976. data/vendor/unity/examples/example_2/src/ProductionCode.h +3 -3
  977. data/vendor/unity/examples/example_2/src/ProductionCode2.c +11 -11
  978. data/vendor/unity/examples/example_2/src/ProductionCode2.h +2 -2
  979. data/vendor/unity/examples/example_2/test/TestProductionCode.c +64 -64
  980. data/vendor/unity/examples/example_2/test/TestProductionCode2.c +33 -33
  981. data/vendor/unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c +8 -8
  982. data/vendor/unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c +10 -10
  983. data/vendor/unity/examples/example_2/test/test_runners/all_tests.c +12 -12
  984. data/vendor/unity/examples/example_3/helper/UnityHelper.c +10 -10
  985. data/vendor/unity/examples/example_3/helper/UnityHelper.h +12 -12
  986. data/vendor/unity/examples/example_3/rakefile.rb +38 -43
  987. data/vendor/unity/examples/example_3/rakefile_helper.rb +250 -249
  988. data/vendor/unity/examples/example_3/readme.txt +13 -13
  989. data/vendor/unity/examples/example_3/src/ProductionCode.c +24 -24
  990. data/vendor/unity/examples/example_3/src/ProductionCode.h +3 -3
  991. data/vendor/unity/examples/example_3/src/ProductionCode2.c +11 -11
  992. data/vendor/unity/examples/example_3/src/ProductionCode2.h +2 -2
  993. data/vendor/unity/examples/example_3/target_gcc_32.yml +47 -46
  994. data/vendor/unity/examples/example_3/test/TestProductionCode.c +62 -62
  995. data/vendor/unity/examples/example_3/test/TestProductionCode2.c +31 -31
  996. data/vendor/unity/examples/example_4/meson.build +17 -0
  997. data/vendor/unity/examples/example_4/readme.txt +15 -0
  998. data/vendor/unity/examples/example_4/src/ProductionCode.c +24 -0
  999. data/vendor/unity/examples/example_4/src/ProductionCode.h +3 -0
  1000. data/vendor/unity/examples/example_4/src/ProductionCode2.c +11 -0
  1001. data/vendor/unity/examples/example_4/src/ProductionCode2.h +2 -0
  1002. data/vendor/unity/examples/example_4/src/meson.build +21 -0
  1003. data/vendor/unity/examples/example_4/subprojects/unity.wrap +4 -0
  1004. data/vendor/unity/examples/example_4/test/TestProductionCode.c +63 -0
  1005. data/vendor/unity/examples/example_4/test/TestProductionCode2.c +35 -0
  1006. data/vendor/unity/examples/example_4/test/meson.build +12 -0
  1007. data/vendor/unity/examples/example_4/test/test_runners/TestProductionCode2_Runner.c +53 -0
  1008. data/vendor/unity/examples/example_4/test/test_runners/TestProductionCode_Runner.c +57 -0
  1009. data/vendor/unity/examples/example_4/test/test_runners/meson.build +16 -0
  1010. data/vendor/unity/examples/unity_config.h +263 -247
  1011. data/vendor/unity/extras/eclipse/error_parsers.txt +26 -26
  1012. data/vendor/unity/extras/fixture/rakefile.rb +44 -48
  1013. data/vendor/unity/extras/fixture/rakefile_helper.rb +183 -178
  1014. data/vendor/unity/extras/fixture/readme.md +17 -0
  1015. data/vendor/unity/extras/fixture/src/unity_fixture.c +275 -436
  1016. data/vendor/unity/extras/fixture/src/unity_fixture.h +83 -83
  1017. data/vendor/unity/extras/fixture/src/unity_fixture_internals.h +50 -51
  1018. data/vendor/unity/extras/fixture/test/Makefile +72 -75
  1019. data/vendor/unity/extras/fixture/test/main/AllTests.c +20 -22
  1020. data/vendor/unity/extras/fixture/test/template_fixture_tests.c +39 -39
  1021. data/vendor/unity/extras/fixture/test/unity_fixture_Test.c +245 -543
  1022. data/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +32 -57
  1023. data/vendor/unity/extras/memory/rakefile.rb +45 -0
  1024. data/vendor/unity/extras/memory/rakefile_helper.rb +187 -0
  1025. data/vendor/unity/extras/memory/readme.md +49 -0
  1026. data/vendor/unity/extras/memory/src/unity_memory.c +202 -0
  1027. data/vendor/unity/extras/memory/src/unity_memory.h +60 -0
  1028. data/vendor/unity/extras/memory/test/Makefile +78 -0
  1029. data/vendor/unity/extras/memory/test/unity_memory_Test.c +325 -0
  1030. data/vendor/unity/extras/memory/test/unity_memory_TestRunner.c +49 -0
  1031. data/vendor/unity/extras/memory/test/unity_output_Spy.c +56 -0
  1032. data/vendor/unity/extras/memory/test/unity_output_Spy.h +16 -0
  1033. data/vendor/unity/meson.build +69 -0
  1034. data/vendor/unity/src/CMakeLists.txt +22 -0
  1035. data/vendor/unity/src/meson.build +16 -0
  1036. data/vendor/unity/src/unity.c +2085 -1572
  1037. data/vendor/unity/src/unity.h +617 -503
  1038. data/vendor/unity/src/unity_internals.h +1002 -924
  1039. data/vendor/unity/test/Makefile +67 -68
  1040. data/vendor/unity/test/expectdata/testsample_cmd.c +61 -61
  1041. data/vendor/unity/test/expectdata/testsample_def.c +57 -57
  1042. data/vendor/unity/test/expectdata/testsample_head1.c +55 -55
  1043. data/vendor/unity/test/expectdata/testsample_head1.h +15 -15
  1044. data/vendor/unity/test/expectdata/testsample_mock_cmd.c +80 -80
  1045. data/vendor/unity/test/expectdata/testsample_mock_def.c +76 -76
  1046. data/vendor/unity/test/expectdata/testsample_mock_head1.c +75 -75
  1047. data/vendor/unity/test/expectdata/testsample_mock_head1.h +13 -13
  1048. data/vendor/unity/test/expectdata/testsample_mock_new1.c +89 -89
  1049. data/vendor/unity/test/expectdata/testsample_mock_new2.c +89 -89
  1050. data/vendor/unity/test/expectdata/testsample_mock_param.c +77 -77
  1051. data/vendor/unity/test/expectdata/testsample_mock_run1.c +89 -89
  1052. data/vendor/unity/test/expectdata/testsample_mock_run2.c +89 -89
  1053. data/vendor/unity/test/expectdata/testsample_mock_yaml.c +90 -90
  1054. data/vendor/unity/test/expectdata/testsample_new1.c +67 -67
  1055. data/vendor/unity/test/expectdata/testsample_new2.c +70 -70
  1056. data/vendor/unity/test/expectdata/testsample_param.c +58 -58
  1057. data/vendor/unity/test/expectdata/testsample_run1.c +67 -67
  1058. data/vendor/unity/test/expectdata/testsample_run2.c +70 -70
  1059. data/vendor/unity/test/expectdata/testsample_yaml.c +71 -71
  1060. data/vendor/unity/test/rakefile +124 -125
  1061. data/vendor/unity/test/rakefile_helper.rb +269 -260
  1062. data/vendor/unity/test/spec/generate_module_existing_file_spec.rb +158 -158
  1063. data/vendor/unity/test/targets/ansi.yml +49 -0
  1064. data/vendor/unity/test/targets/clang_file.yml +78 -78
  1065. data/vendor/unity/test/targets/clang_strict.yml +78 -78
  1066. data/vendor/unity/test/targets/gcc_32.yml +49 -49
  1067. data/vendor/unity/test/targets/gcc_64.yml +50 -50
  1068. data/vendor/unity/test/targets/gcc_auto_limits.yml +47 -47
  1069. data/vendor/unity/test/targets/gcc_auto_stdint.yml +59 -59
  1070. data/vendor/unity/test/targets/gcc_manual_math.yml +47 -47
  1071. data/vendor/unity/test/targets/hitech_picc18.yml +101 -101
  1072. data/vendor/unity/test/targets/iar_arm_v4.yml +90 -90
  1073. data/vendor/unity/test/targets/iar_arm_v5.yml +80 -80
  1074. data/vendor/unity/test/targets/iar_arm_v5_3.yml +80 -80
  1075. data/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +94 -94
  1076. data/vendor/unity/test/targets/iar_cortexm3_v5.yml +84 -84
  1077. data/vendor/unity/test/targets/iar_msp430.yml +95 -95
  1078. data/vendor/unity/test/targets/iar_sh2a_v6.yml +86 -86
  1079. data/vendor/unity/test/testdata/CException.h +11 -11
  1080. data/vendor/unity/test/testdata/Defs.h +8 -8
  1081. data/vendor/unity/test/testdata/cmock.h +14 -14
  1082. data/vendor/unity/test/testdata/mockMock.h +13 -13
  1083. data/vendor/unity/test/testdata/testRunnerGenerator.c +189 -186
  1084. data/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +70 -70
  1085. data/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +197 -195
  1086. data/vendor/unity/test/tests/test_generate_test_runner.rb +1268 -1252
  1087. data/vendor/unity/test/tests/testparameterized.c +171 -113
  1088. data/vendor/unity/test/tests/testunity.c +8168 -5371
  1089. metadata +201 -27
  1090. data/lib/ceedling/version.rb.erb +0 -15
  1091. data/vendor/c_exception/release/build.info +0 -2
  1092. data/vendor/c_exception/release/version.info +0 -2
  1093. data/vendor/cmock/release/build.info +0 -2
  1094. data/vendor/cmock/release/version.info +0 -2
  1095. data/vendor/cmock/vendor/c_exception/release/build.info +0 -2
  1096. data/vendor/cmock/vendor/c_exception/release/version.info +0 -2
  1097. data/vendor/cmock/vendor/unity/release/build.info +0 -2
  1098. data/vendor/cmock/vendor/unity/release/version.info +0 -2
  1099. data/vendor/unity/extras/fixture/readme.txt +0 -9
  1100. data/vendor/unity/release/build.info +0 -2
  1101. data/vendor/unity/release/version.info +0 -2
@@ -0,0 +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,57 +1,56 @@
1
- /* Copyright (c) 2010 James Grenning and Contributed to Unity Project
2
- * ==========================================
3
- * Unity Project - A Test Framework for C
4
- * Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
5
- * [Released under MIT License. Please refer to license.txt for details]
6
- * ========================================== */
7
-
8
-
9
- #include "unity_output_Spy.h"
10
- #include "unity_fixture.h"
11
-
12
- #include <stdio.h>
13
- #include <string.h>
14
-
15
- static int size;
16
- static int count;
17
- static char* buffer;
18
- static int spy_enable;
19
-
20
- void UnityOutputCharSpy_Create(int s)
21
- {
22
- size = (s > 0) ? s : 0;
23
- count = 0;
24
- spy_enable = 0;
25
- buffer = malloc((size_t)size);
26
- TEST_ASSERT_NOT_NULL_MESSAGE(buffer, "Internal malloc failed in Spy Create():" __FILE__);
27
- memset(buffer, 0, (size_t)size);
28
- }
29
-
30
- void UnityOutputCharSpy_Destroy(void)
31
- {
32
- size = 0;
33
- free(buffer);
34
- }
35
-
36
- void UnityOutputCharSpy_OutputChar(int c)
37
- {
38
- if (spy_enable)
39
- {
40
- if (count < (size-1))
41
- buffer[count++] = (char)c;
42
- }
43
- else
44
- {
45
- putchar(c);
46
- }
47
- }
48
-
49
- const char * UnityOutputCharSpy_Get(void)
50
- {
51
- return buffer;
52
- }
53
-
54
- void UnityOutputCharSpy_Enable(int enable)
55
- {
56
- spy_enable = enable;
57
- }
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,17 +1,16 @@
1
- /* Copyright (c) 2010 James Grenning and Contributed to Unity Project
2
- * ==========================================
3
- * Unity Project - A Test Framework for C
4
- * Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
5
- * [Released under MIT License. Please refer to license.txt for details]
6
- * ========================================== */
7
-
8
- #ifndef D_unity_output_Spy_H
9
- #define D_unity_output_Spy_H
10
-
11
- void UnityOutputCharSpy_Create(int s);
12
- void UnityOutputCharSpy_Destroy(void);
13
- void UnityOutputCharSpy_OutputChar(int c);
14
- const char * UnityOutputCharSpy_Get(void);
15
- void UnityOutputCharSpy_Enable(int enable);
16
-
17
- #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
@@ -0,0 +1,69 @@
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)
@@ -0,0 +1,22 @@
1
+ ###################################################################################
2
+ # #
3
+ # NAME: CMakeLists.txt #
4
+ # #
5
+ # AUTHOR: Mike Karlesky, Mark VanderVoord, Greg Williams. #
6
+ # WRITTEN BY: Michael Brockus. #
7
+ # #
8
+ # License: MIT #
9
+ # #
10
+ ###################################################################################
11
+ cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
12
+
13
+
14
+ add_library(unity STATIC "unity.c")
15
+
16
+ install(TARGETS unity EXPORT unityConfig
17
+ ARCHIVE DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_INSTALL_LIBDIR}"
18
+ LIBRARY DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_INSTALL_LIBDIR}"
19
+ RUNTIME DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/${CMAKE_INSTALL_BINDIR}"
20
+ INCLUDES DESTINATION "${CMAKE_INSTALL_LIBDIR}")
21
+
22
+
@@ -0,0 +1,16 @@
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,1572 +1,2085 @@
1
- /* =========================================================================
2
- Unity Project - A Test Framework for C
3
- Copyright (c) 2007-14 Mike Karlesky, Mark VanderVoord, Greg Williams
4
- [Released under MIT License. Please refer to license.txt for details]
5
- ============================================================================ */
6
-
7
- #define UNITY_INCLUDE_SETUP_STUBS
8
- #include "unity.h"
9
- #include <stddef.h>
10
-
11
- /* If omitted from header, declare overrideable prototypes here so they're ready for use */
12
- #ifdef UNITY_OMIT_OUTPUT_CHAR_HEADER_DECLARATION
13
- void UNITY_OUTPUT_CHAR(int);
14
- #endif
15
-
16
- /* Helpful macros for us to use here in Assert functions */
17
- #define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; UNITY_OUTPUT_FLUSH(); TEST_ABORT(); }
18
- #define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; UNITY_OUTPUT_FLUSH(); TEST_ABORT(); }
19
- #define RETURN_IF_FAIL_OR_IGNORE if (Unity.CurrentTestFailed || Unity.CurrentTestIgnored) return
20
-
21
- struct UNITY_STORAGE_T Unity;
22
-
23
- #ifdef UNITY_OUTPUT_COLOR
24
- static const char UnityStrOk[] = "\033[42mOK\033[00m";
25
- static const char UnityStrPass[] = "\033[42mPASS\033[00m";
26
- static const char UnityStrFail[] = "\033[41mFAIL\033[00m";
27
- static const char UnityStrIgnore[] = "\033[43mIGNORE\033[00m";
28
- #else
29
- static const char UnityStrOk[] = "OK";
30
- static const char UnityStrPass[] = "PASS";
31
- static const char UnityStrFail[] = "FAIL";
32
- static const char UnityStrIgnore[] = "IGNORE";
33
- #endif
34
- static const char UnityStrNull[] = "NULL";
35
- static const char UnityStrSpacer[] = ". ";
36
- static const char UnityStrExpected[] = " Expected ";
37
- static const char UnityStrWas[] = " Was ";
38
- static const char UnityStrGt[] = " to be greater than ";
39
- static const char UnityStrLt[] = " to be less than ";
40
- static const char UnityStrOrEqual[] = "or equal to ";
41
- static const char UnityStrElement[] = " Element ";
42
- static const char UnityStrByte[] = " Byte ";
43
- static const char UnityStrMemory[] = " Memory Mismatch.";
44
- static const char UnityStrDelta[] = " Values Not Within Delta ";
45
- static const char UnityStrPointless[] = " You Asked Me To Compare Nothing, Which Was Pointless.";
46
- static const char UnityStrNullPointerForExpected[] = " Expected pointer to be NULL";
47
- static const char UnityStrNullPointerForActual[] = " Actual pointer was NULL";
48
- #ifndef UNITY_EXCLUDE_FLOAT
49
- static const char UnityStrNot[] = "Not ";
50
- static const char UnityStrInf[] = "Infinity";
51
- static const char UnityStrNegInf[] = "Negative Infinity";
52
- static const char UnityStrNaN[] = "NaN";
53
- static const char UnityStrDet[] = "Determinate";
54
- static const char UnityStrInvalidFloatTrait[] = "Invalid Float Trait";
55
- #endif
56
- const char UnityStrErrFloat[] = "Unity Floating Point Disabled";
57
- const char UnityStrErrDouble[] = "Unity Double Precision Disabled";
58
- const char UnityStrErr64[] = "Unity 64-bit Support Disabled";
59
- static const char UnityStrBreaker[] = "-----------------------";
60
- static const char UnityStrResultsTests[] = " Tests ";
61
- static const char UnityStrResultsFailures[] = " Failures ";
62
- static const char UnityStrResultsIgnored[] = " Ignored ";
63
- static const char UnityStrDetail1Name[] = UNITY_DETAIL1_NAME " ";
64
- static const char UnityStrDetail2Name[] = " " UNITY_DETAIL2_NAME " ";
65
-
66
- /*-----------------------------------------------
67
- * Pretty Printers & Test Result Output Handlers
68
- *-----------------------------------------------*/
69
-
70
- void UnityPrint(const char* string)
71
- {
72
- const char* pch = string;
73
-
74
- if (pch != NULL)
75
- {
76
- while (*pch)
77
- {
78
- /* printable characters plus CR & LF are printed */
79
- if ((*pch <= 126) && (*pch >= 32))
80
- {
81
- UNITY_OUTPUT_CHAR(*pch);
82
- }
83
- /* write escaped carriage returns */
84
- else if (*pch == 13)
85
- {
86
- UNITY_OUTPUT_CHAR('\\');
87
- UNITY_OUTPUT_CHAR('r');
88
- }
89
- /* write escaped line feeds */
90
- else if (*pch == 10)
91
- {
92
- UNITY_OUTPUT_CHAR('\\');
93
- UNITY_OUTPUT_CHAR('n');
94
- }
95
- #ifdef UNITY_OUTPUT_COLOR
96
- /* print ANSI escape code */
97
- else if (*pch == 27 && *(pch + 1) == '[')
98
- {
99
- while (*pch && *pch != 'm')
100
- {
101
- UNITY_OUTPUT_CHAR(*pch);
102
- pch++;
103
- }
104
- UNITY_OUTPUT_CHAR('m');
105
- }
106
- #endif
107
- /* unprintable characters are shown as codes */
108
- else
109
- {
110
- UNITY_OUTPUT_CHAR('\\');
111
- UNITY_OUTPUT_CHAR('x');
112
- UnityPrintNumberHex((UNITY_UINT)*pch, 2);
113
- }
114
- pch++;
115
- }
116
- }
117
- }
118
-
119
- void UnityPrintLen(const char* string, const UNITY_UINT32 length)
120
- {
121
- const char* pch = string;
122
-
123
- if (pch != NULL)
124
- {
125
- while (*pch && (UNITY_UINT32)(pch - string) < length)
126
- {
127
- /* printable characters plus CR & LF are printed */
128
- if ((*pch <= 126) && (*pch >= 32))
129
- {
130
- UNITY_OUTPUT_CHAR(*pch);
131
- }
132
- /* write escaped carriage returns */
133
- else if (*pch == 13)
134
- {
135
- UNITY_OUTPUT_CHAR('\\');
136
- UNITY_OUTPUT_CHAR('r');
137
- }
138
- /* write escaped line feeds */
139
- else if (*pch == 10)
140
- {
141
- UNITY_OUTPUT_CHAR('\\');
142
- UNITY_OUTPUT_CHAR('n');
143
- }
144
- /* unprintable characters are shown as codes */
145
- else
146
- {
147
- UNITY_OUTPUT_CHAR('\\');
148
- UNITY_OUTPUT_CHAR('x');
149
- UnityPrintNumberHex((UNITY_UINT)*pch, 2);
150
- }
151
- pch++;
152
- }
153
- }
154
- }
155
-
156
- /*-----------------------------------------------*/
157
- void UnityPrintNumberByStyle(const UNITY_INT number, const UNITY_DISPLAY_STYLE_T style)
158
- {
159
- if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
160
- {
161
- UnityPrintNumber(number);
162
- }
163
- else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT)
164
- {
165
- UnityPrintNumberUnsigned((UNITY_UINT)number);
166
- }
167
- else
168
- {
169
- UNITY_OUTPUT_CHAR('0');
170
- UNITY_OUTPUT_CHAR('x');
171
- UnityPrintNumberHex((UNITY_UINT)number, (char)((style & 0xF) * 2));
172
- }
173
- }
174
-
175
- /*-----------------------------------------------*/
176
- void UnityPrintNumber(const UNITY_INT number_to_print)
177
- {
178
- UNITY_UINT number = (UNITY_UINT)number_to_print;
179
-
180
- if (number_to_print < 0)
181
- {
182
- /* A negative number, including MIN negative */
183
- UNITY_OUTPUT_CHAR('-');
184
- number = (UNITY_UINT)(-number_to_print);
185
- }
186
- UnityPrintNumberUnsigned(number);
187
- }
188
-
189
- /*-----------------------------------------------
190
- * basically do an itoa using as little ram as possible */
191
- void UnityPrintNumberUnsigned(const UNITY_UINT number)
192
- {
193
- UNITY_UINT divisor = 1;
194
-
195
- /* figure out initial divisor */
196
- while (number / divisor > 9)
197
- {
198
- divisor *= 10;
199
- }
200
-
201
- /* now mod and print, then divide divisor */
202
- do
203
- {
204
- UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10)));
205
- divisor /= 10;
206
- } while (divisor > 0);
207
- }
208
-
209
- /*-----------------------------------------------*/
210
- void UnityPrintNumberHex(const UNITY_UINT number, const char nibbles_to_print)
211
- {
212
- int nibble;
213
- char nibbles = nibbles_to_print;
214
- if ((unsigned)nibbles > (2 * sizeof(number)))
215
- nibbles = 2 * sizeof(number);
216
-
217
- while (nibbles > 0)
218
- {
219
- nibbles--;
220
- nibble = (int)(number >> (nibbles * 4)) & 0x0F;
221
- if (nibble <= 9)
222
- {
223
- UNITY_OUTPUT_CHAR((char)('0' + nibble));
224
- }
225
- else
226
- {
227
- UNITY_OUTPUT_CHAR((char)('A' - 10 + nibble));
228
- }
229
- }
230
- }
231
-
232
- /*-----------------------------------------------*/
233
- void UnityPrintMask(const UNITY_UINT mask, const UNITY_UINT number)
234
- {
235
- UNITY_UINT current_bit = (UNITY_UINT)1 << (UNITY_INT_WIDTH - 1);
236
- UNITY_INT32 i;
237
-
238
- for (i = 0; i < UNITY_INT_WIDTH; i++)
239
- {
240
- if (current_bit & mask)
241
- {
242
- if (current_bit & number)
243
- {
244
- UNITY_OUTPUT_CHAR('1');
245
- }
246
- else
247
- {
248
- UNITY_OUTPUT_CHAR('0');
249
- }
250
- }
251
- else
252
- {
253
- UNITY_OUTPUT_CHAR('X');
254
- }
255
- current_bit = current_bit >> 1;
256
- }
257
- }
258
-
259
- /*-----------------------------------------------*/
260
- #ifndef UNITY_EXCLUDE_FLOAT_PRINT
261
- /* This function prints a floating-point value in a format similar to
262
- * printf("%.6g"). It can work with either single- or double-precision,
263
- * but for simplicity, it prints only 6 significant digits in either case.
264
- * Printing more than 6 digits accurately is hard (at least in the single-
265
- * precision case) and isn't attempted here. */
266
- void UnityPrintFloat(const UNITY_DOUBLE input_number)
267
- {
268
- UNITY_DOUBLE number = input_number;
269
-
270
- /* print minus sign (including for negative zero) */
271
- if (number < 0.0f || (number == 0.0f && 1.0f / number < 0.0f))
272
- {
273
- UNITY_OUTPUT_CHAR('-');
274
- number = -number;
275
- }
276
-
277
- /* handle zero, NaN, and +/- infinity */
278
- if (number == 0.0f) UnityPrint("0");
279
- else if (isnan(number)) UnityPrint("nan");
280
- else if (isinf(number)) UnityPrint("inf");
281
- else
282
- {
283
- int exponent = 0;
284
- int decimals, digits;
285
- UNITY_INT32 n;
286
- char buf[16];
287
-
288
- /* scale up or down by powers of 10 */
289
- while (number < 100000.0f / 1e6f) { number *= 1e6f; exponent -= 6; }
290
- while (number < 100000.0f) { number *= 10.0f; exponent--; }
291
- while (number > 1000000.0f * 1e6f) { number /= 1e6f; exponent += 6; }
292
- while (number > 1000000.0f) { number /= 10.0f; exponent++; }
293
-
294
- /* round to nearest integer */
295
- n = ((UNITY_INT32)(number + number) + 1) / 2;
296
- if (n > 999999)
297
- {
298
- n = 100000;
299
- exponent++;
300
- }
301
-
302
- /* determine where to place decimal point */
303
- decimals = (exponent <= 0 && exponent >= -9) ? -exponent : 5;
304
- exponent += decimals;
305
-
306
- /* truncate trailing zeroes after decimal point */
307
- while (decimals > 0 && n % 10 == 0)
308
- {
309
- n /= 10;
310
- decimals--;
311
- }
312
-
313
- /* build up buffer in reverse order */
314
- digits = 0;
315
- while (n != 0 || digits < decimals + 1)
316
- {
317
- buf[digits++] = (char)('0' + n % 10);
318
- n /= 10;
319
- }
320
- while (digits > 0)
321
- {
322
- if(digits == decimals) UNITY_OUTPUT_CHAR('.');
323
- UNITY_OUTPUT_CHAR(buf[--digits]);
324
- }
325
-
326
- /* print exponent if needed */
327
- if (exponent != 0)
328
- {
329
- UNITY_OUTPUT_CHAR('e');
330
-
331
- if(exponent < 0)
332
- {
333
- UNITY_OUTPUT_CHAR('-');
334
- exponent = -exponent;
335
- }
336
- else
337
- {
338
- UNITY_OUTPUT_CHAR('+');
339
- }
340
-
341
- digits = 0;
342
- while (exponent != 0 || digits < 2)
343
- {
344
- buf[digits++] = (char)('0' + exponent % 10);
345
- exponent /= 10;
346
- }
347
- while (digits > 0)
348
- {
349
- UNITY_OUTPUT_CHAR(buf[--digits]);
350
- }
351
- }
352
- }
353
- }
354
- #endif /* ! UNITY_EXCLUDE_FLOAT_PRINT */
355
-
356
- /*-----------------------------------------------*/
357
- static void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line)
358
- {
359
- UnityPrint(file);
360
- UNITY_OUTPUT_CHAR(':');
361
- UnityPrintNumber((UNITY_INT)line);
362
- UNITY_OUTPUT_CHAR(':');
363
- UnityPrint(Unity.CurrentTestName);
364
- UNITY_OUTPUT_CHAR(':');
365
- }
366
-
367
- /*-----------------------------------------------*/
368
- static void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line)
369
- {
370
- UnityTestResultsBegin(Unity.TestFile, line);
371
- UnityPrint(UnityStrFail);
372
- UNITY_OUTPUT_CHAR(':');
373
- }
374
-
375
- /*-----------------------------------------------*/
376
- void UnityConcludeTest(void)
377
- {
378
- if (Unity.CurrentTestIgnored)
379
- {
380
- Unity.TestIgnores++;
381
- }
382
- else if (!Unity.CurrentTestFailed)
383
- {
384
- UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber);
385
- UnityPrint(UnityStrPass);
386
- }
387
- else
388
- {
389
- Unity.TestFailures++;
390
- }
391
-
392
- Unity.CurrentTestFailed = 0;
393
- Unity.CurrentTestIgnored = 0;
394
- UNITY_EXEC_TIME_RESET();
395
- UNITY_PRINT_EOL();
396
- UNITY_FLUSH_CALL();
397
- }
398
-
399
- /*-----------------------------------------------*/
400
- static void UnityAddMsgIfSpecified(const char* msg)
401
- {
402
- if (msg)
403
- {
404
- UnityPrint(UnityStrSpacer);
405
- #ifndef UNITY_EXCLUDE_DETAILS
406
- if (Unity.CurrentDetail1)
407
- {
408
- UnityPrint(UnityStrDetail1Name);
409
- UnityPrint(Unity.CurrentDetail1);
410
- if (Unity.CurrentDetail2)
411
- {
412
- UnityPrint(UnityStrDetail2Name);
413
- UnityPrint(Unity.CurrentDetail2);
414
- }
415
- UnityPrint(UnityStrSpacer);
416
- }
417
- #endif
418
- UnityPrint(msg);
419
- }
420
- }
421
-
422
- /*-----------------------------------------------*/
423
- static void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual)
424
- {
425
- UnityPrint(UnityStrExpected);
426
- if (expected != NULL)
427
- {
428
- UNITY_OUTPUT_CHAR('\'');
429
- UnityPrint(expected);
430
- UNITY_OUTPUT_CHAR('\'');
431
- }
432
- else
433
- {
434
- UnityPrint(UnityStrNull);
435
- }
436
- UnityPrint(UnityStrWas);
437
- if (actual != NULL)
438
- {
439
- UNITY_OUTPUT_CHAR('\'');
440
- UnityPrint(actual);
441
- UNITY_OUTPUT_CHAR('\'');
442
- }
443
- else
444
- {
445
- UnityPrint(UnityStrNull);
446
- }
447
- }
448
-
449
- /*-----------------------------------------------*/
450
- static void UnityPrintExpectedAndActualStringsLen(const char* expected,
451
- const char* actual,
452
- const UNITY_UINT32 length)
453
- {
454
- UnityPrint(UnityStrExpected);
455
- if (expected != NULL)
456
- {
457
- UNITY_OUTPUT_CHAR('\'');
458
- UnityPrintLen(expected, length);
459
- UNITY_OUTPUT_CHAR('\'');
460
- }
461
- else
462
- {
463
- UnityPrint(UnityStrNull);
464
- }
465
- UnityPrint(UnityStrWas);
466
- if (actual != NULL)
467
- {
468
- UNITY_OUTPUT_CHAR('\'');
469
- UnityPrintLen(actual, length);
470
- UNITY_OUTPUT_CHAR('\'');
471
- }
472
- else
473
- {
474
- UnityPrint(UnityStrNull);
475
- }
476
- }
477
-
478
- /*-----------------------------------------------
479
- * Assertion & Control Helpers
480
- *-----------------------------------------------*/
481
-
482
- static int UnityIsOneArrayNull(UNITY_INTERNAL_PTR expected,
483
- UNITY_INTERNAL_PTR actual,
484
- const UNITY_LINE_TYPE lineNumber,
485
- const char* msg)
486
- {
487
- if (expected == actual) return 0; /* Both are NULL or same pointer */
488
-
489
- /* print and return true if just expected is NULL */
490
- if (expected == NULL)
491
- {
492
- UnityTestResultsFailBegin(lineNumber);
493
- UnityPrint(UnityStrNullPointerForExpected);
494
- UnityAddMsgIfSpecified(msg);
495
- return 1;
496
- }
497
-
498
- /* print and return true if just actual is NULL */
499
- if (actual == NULL)
500
- {
501
- UnityTestResultsFailBegin(lineNumber);
502
- UnityPrint(UnityStrNullPointerForActual);
503
- UnityAddMsgIfSpecified(msg);
504
- return 1;
505
- }
506
-
507
- return 0; /* return false if neither is NULL */
508
- }
509
-
510
- /*-----------------------------------------------
511
- * Assertion Functions
512
- *-----------------------------------------------*/
513
-
514
- void UnityAssertBits(const UNITY_INT mask,
515
- const UNITY_INT expected,
516
- const UNITY_INT actual,
517
- const char* msg,
518
- const UNITY_LINE_TYPE lineNumber)
519
- {
520
- RETURN_IF_FAIL_OR_IGNORE;
521
-
522
- if ((mask & expected) != (mask & actual))
523
- {
524
- UnityTestResultsFailBegin(lineNumber);
525
- UnityPrint(UnityStrExpected);
526
- UnityPrintMask((UNITY_UINT)mask, (UNITY_UINT)expected);
527
- UnityPrint(UnityStrWas);
528
- UnityPrintMask((UNITY_UINT)mask, (UNITY_UINT)actual);
529
- UnityAddMsgIfSpecified(msg);
530
- UNITY_FAIL_AND_BAIL;
531
- }
532
- }
533
-
534
- /*-----------------------------------------------*/
535
- void UnityAssertEqualNumber(const UNITY_INT expected,
536
- const UNITY_INT actual,
537
- const char* msg,
538
- const UNITY_LINE_TYPE lineNumber,
539
- const UNITY_DISPLAY_STYLE_T style)
540
- {
541
- RETURN_IF_FAIL_OR_IGNORE;
542
-
543
- if (expected != actual)
544
- {
545
- UnityTestResultsFailBegin(lineNumber);
546
- UnityPrint(UnityStrExpected);
547
- UnityPrintNumberByStyle(expected, style);
548
- UnityPrint(UnityStrWas);
549
- UnityPrintNumberByStyle(actual, style);
550
- UnityAddMsgIfSpecified(msg);
551
- UNITY_FAIL_AND_BAIL;
552
- }
553
- }
554
-
555
- /*-----------------------------------------------*/
556
- void UnityAssertGreaterOrLessOrEqualNumber(const UNITY_INT threshold,
557
- const UNITY_INT actual,
558
- const UNITY_COMPARISON_T compare,
559
- const char *msg,
560
- const UNITY_LINE_TYPE lineNumber,
561
- const UNITY_DISPLAY_STYLE_T style)
562
- {
563
- int failed = 0;
564
- RETURN_IF_FAIL_OR_IGNORE;
565
-
566
- if (threshold == actual && compare & UNITY_EQUAL_TO) return;
567
- if (threshold == actual) failed = 1;
568
-
569
- if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
570
- {
571
- if (actual > threshold && compare & UNITY_SMALLER_THAN) failed = 1;
572
- if (actual < threshold && compare & UNITY_GREATER_THAN) failed = 1;
573
- }
574
- else /* UINT or HEX */
575
- {
576
- if ((UNITY_UINT)actual > (UNITY_UINT)threshold && compare & UNITY_SMALLER_THAN) failed = 1;
577
- if ((UNITY_UINT)actual < (UNITY_UINT)threshold && compare & UNITY_GREATER_THAN) failed = 1;
578
- }
579
-
580
- if (failed)
581
- {
582
- UnityTestResultsFailBegin(lineNumber);
583
- UnityPrint(UnityStrExpected);
584
- UnityPrintNumberByStyle(actual, style);
585
- if (compare & UNITY_GREATER_THAN) UnityPrint(UnityStrGt);
586
- if (compare & UNITY_SMALLER_THAN) UnityPrint(UnityStrLt);
587
- if (compare & UNITY_EQUAL_TO) UnityPrint(UnityStrOrEqual);
588
- UnityPrintNumberByStyle(threshold, style);
589
- UnityAddMsgIfSpecified(msg);
590
- UNITY_FAIL_AND_BAIL;
591
- }
592
- }
593
-
594
- #define UnityPrintPointlessAndBail() \
595
- { \
596
- UnityTestResultsFailBegin(lineNumber); \
597
- UnityPrint(UnityStrPointless); \
598
- UnityAddMsgIfSpecified(msg); \
599
- UNITY_FAIL_AND_BAIL; }
600
-
601
- /*-----------------------------------------------*/
602
- void UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,
603
- UNITY_INTERNAL_PTR actual,
604
- const UNITY_UINT32 num_elements,
605
- const char* msg,
606
- const UNITY_LINE_TYPE lineNumber,
607
- const UNITY_DISPLAY_STYLE_T style,
608
- const UNITY_FLAGS_T flags)
609
- {
610
- UNITY_UINT32 elements = num_elements;
611
- unsigned int length = style & 0xF;
612
-
613
- RETURN_IF_FAIL_OR_IGNORE;
614
-
615
- if (num_elements == 0)
616
- {
617
- UnityPrintPointlessAndBail();
618
- }
619
-
620
- if (expected == actual) return; /* Both are NULL or same pointer */
621
- if (UnityIsOneArrayNull(expected, actual, lineNumber, msg))
622
- UNITY_FAIL_AND_BAIL;
623
-
624
- while ((elements > 0) && elements--)
625
- {
626
- UNITY_INT expect_val;
627
- UNITY_INT actual_val;
628
- switch (length)
629
- {
630
- case 1:
631
- expect_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT8*)expected;
632
- actual_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT8*)actual;
633
- break;
634
- case 2:
635
- expect_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT16*)expected;
636
- actual_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT16*)actual;
637
- break;
638
- #ifdef UNITY_SUPPORT_64
639
- case 8:
640
- expect_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT64*)expected;
641
- actual_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT64*)actual;
642
- break;
643
- #endif
644
- default: /* length 4 bytes */
645
- expect_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT32*)expected;
646
- actual_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT32*)actual;
647
- length = 4;
648
- break;
649
- }
650
-
651
- if (expect_val != actual_val)
652
- {
653
- if (style & UNITY_DISPLAY_RANGE_UINT && length < sizeof(expect_val))
654
- { /* For UINT, remove sign extension (padding 1's) from signed type casts above */
655
- UNITY_INT mask = 1;
656
- mask = (mask << 8 * length) - 1;
657
- expect_val &= mask;
658
- actual_val &= mask;
659
- }
660
- UnityTestResultsFailBegin(lineNumber);
661
- UnityPrint(UnityStrElement);
662
- UnityPrintNumberUnsigned(num_elements - elements - 1);
663
- UnityPrint(UnityStrExpected);
664
- UnityPrintNumberByStyle(expect_val, style);
665
- UnityPrint(UnityStrWas);
666
- UnityPrintNumberByStyle(actual_val, style);
667
- UnityAddMsgIfSpecified(msg);
668
- UNITY_FAIL_AND_BAIL;
669
- }
670
- if (flags == UNITY_ARRAY_TO_ARRAY)
671
- {
672
- expected = (UNITY_INTERNAL_PTR)(length + (const char*)expected);
673
- }
674
- actual = (UNITY_INTERNAL_PTR)(length + (const char*)actual);
675
- }
676
- }
677
-
678
- /*-----------------------------------------------*/
679
- #ifndef UNITY_EXCLUDE_FLOAT
680
- /* Wrap this define in a function with variable types as float or double */
681
- #define UNITY_FLOAT_OR_DOUBLE_WITHIN(delta, expected, actual, diff) \
682
- if (isinf(expected) && isinf(actual) && (((expected) < 0) == ((actual) < 0))) return 1; \
683
- if (UNITY_NAN_CHECK) return 1; \
684
- (diff) = (actual) - (expected); \
685
- if ((diff) < 0) (diff) = -(diff); \
686
- if ((delta) < 0) (delta) = -(delta); \
687
- return !(isnan(diff) || isinf(diff) || ((diff) > (delta)))
688
- /* This first part of this condition will catch any NaN or Infinite values */
689
- #ifndef UNITY_NAN_NOT_EQUAL_NAN
690
- #define UNITY_NAN_CHECK isnan(expected) && isnan(actual)
691
- #else
692
- #define UNITY_NAN_CHECK 0
693
- #endif
694
-
695
- #ifndef UNITY_EXCLUDE_FLOAT_PRINT
696
- #define UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT(expected, actual) \
697
- { \
698
- UnityPrint(UnityStrExpected); \
699
- UnityPrintFloat(expected); \
700
- UnityPrint(UnityStrWas); \
701
- UnityPrintFloat(actual); }
702
- #else
703
- #define UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT(expected, actual) \
704
- UnityPrint(UnityStrDelta)
705
- #endif /* UNITY_EXCLUDE_FLOAT_PRINT */
706
-
707
- static int UnityFloatsWithin(UNITY_FLOAT delta, UNITY_FLOAT expected, UNITY_FLOAT actual)
708
- {
709
- UNITY_FLOAT diff;
710
- UNITY_FLOAT_OR_DOUBLE_WITHIN(delta, expected, actual, diff);
711
- }
712
-
713
- void UnityAssertEqualFloatArray(UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* expected,
714
- UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* actual,
715
- const UNITY_UINT32 num_elements,
716
- const char* msg,
717
- const UNITY_LINE_TYPE lineNumber,
718
- const UNITY_FLAGS_T flags)
719
- {
720
- UNITY_UINT32 elements = num_elements;
721
- UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* ptr_expected = expected;
722
- UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* ptr_actual = actual;
723
-
724
- RETURN_IF_FAIL_OR_IGNORE;
725
-
726
- if (elements == 0)
727
- {
728
- UnityPrintPointlessAndBail();
729
- }
730
-
731
- if (expected == actual) return; /* Both are NULL or same pointer */
732
- if (UnityIsOneArrayNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg))
733
- UNITY_FAIL_AND_BAIL;
734
-
735
- while (elements--)
736
- {
737
- if (!UnityFloatsWithin(*ptr_expected * UNITY_FLOAT_PRECISION, *ptr_expected, *ptr_actual))
738
- {
739
- UnityTestResultsFailBegin(lineNumber);
740
- UnityPrint(UnityStrElement);
741
- UnityPrintNumberUnsigned(num_elements - elements - 1);
742
- UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT((UNITY_DOUBLE)*ptr_expected, (UNITY_DOUBLE)*ptr_actual);
743
- UnityAddMsgIfSpecified(msg);
744
- UNITY_FAIL_AND_BAIL;
745
- }
746
- if (flags == UNITY_ARRAY_TO_ARRAY)
747
- {
748
- ptr_expected++;
749
- }
750
- ptr_actual++;
751
- }
752
- }
753
-
754
- /*-----------------------------------------------*/
755
- void UnityAssertFloatsWithin(const UNITY_FLOAT delta,
756
- const UNITY_FLOAT expected,
757
- const UNITY_FLOAT actual,
758
- const char* msg,
759
- const UNITY_LINE_TYPE lineNumber)
760
- {
761
- RETURN_IF_FAIL_OR_IGNORE;
762
-
763
-
764
- if (!UnityFloatsWithin(delta, expected, actual))
765
- {
766
- UnityTestResultsFailBegin(lineNumber);
767
- UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT((UNITY_DOUBLE)expected, (UNITY_DOUBLE)actual);
768
- UnityAddMsgIfSpecified(msg);
769
- UNITY_FAIL_AND_BAIL;
770
- }
771
- }
772
-
773
- /*-----------------------------------------------*/
774
- void UnityAssertFloatSpecial(const UNITY_FLOAT actual,
775
- const char* msg,
776
- const UNITY_LINE_TYPE lineNumber,
777
- const UNITY_FLOAT_TRAIT_T style)
778
- {
779
- const char* trait_names[] = {UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet};
780
- UNITY_INT should_be_trait = ((UNITY_INT)style & 1);
781
- UNITY_INT is_trait = !should_be_trait;
782
- UNITY_INT trait_index = (UNITY_INT)(style >> 1);
783
-
784
- RETURN_IF_FAIL_OR_IGNORE;
785
-
786
- switch (style)
787
- {
788
- case UNITY_FLOAT_IS_INF:
789
- case UNITY_FLOAT_IS_NOT_INF:
790
- is_trait = isinf(actual) && (actual > 0);
791
- break;
792
- case UNITY_FLOAT_IS_NEG_INF:
793
- case UNITY_FLOAT_IS_NOT_NEG_INF:
794
- is_trait = isinf(actual) && (actual < 0);
795
- break;
796
-
797
- case UNITY_FLOAT_IS_NAN:
798
- case UNITY_FLOAT_IS_NOT_NAN:
799
- is_trait = isnan(actual) ? 1 : 0;
800
- break;
801
-
802
- case UNITY_FLOAT_IS_DET: /* A determinate number is non infinite and not NaN. */
803
- case UNITY_FLOAT_IS_NOT_DET:
804
- is_trait = !isinf(actual) && !isnan(actual);
805
- break;
806
-
807
- default:
808
- trait_index = 0;
809
- trait_names[0] = UnityStrInvalidFloatTrait;
810
- break;
811
- }
812
-
813
- if (is_trait != should_be_trait)
814
- {
815
- UnityTestResultsFailBegin(lineNumber);
816
- UnityPrint(UnityStrExpected);
817
- if (!should_be_trait)
818
- UnityPrint(UnityStrNot);
819
- UnityPrint(trait_names[trait_index]);
820
- UnityPrint(UnityStrWas);
821
- #ifndef UNITY_EXCLUDE_FLOAT_PRINT
822
- UnityPrintFloat((UNITY_DOUBLE)actual);
823
- #else
824
- if (should_be_trait)
825
- UnityPrint(UnityStrNot);
826
- UnityPrint(trait_names[trait_index]);
827
- #endif
828
- UnityAddMsgIfSpecified(msg);
829
- UNITY_FAIL_AND_BAIL;
830
- }
831
- }
832
-
833
- #endif /* not UNITY_EXCLUDE_FLOAT */
834
-
835
- /*-----------------------------------------------*/
836
- #ifndef UNITY_EXCLUDE_DOUBLE
837
- static int UnityDoublesWithin(UNITY_DOUBLE delta, UNITY_DOUBLE expected, UNITY_DOUBLE actual)
838
- {
839
- UNITY_DOUBLE diff;
840
- UNITY_FLOAT_OR_DOUBLE_WITHIN(delta, expected, actual, diff);
841
- }
842
-
843
- void UnityAssertEqualDoubleArray(UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* expected,
844
- UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* actual,
845
- const UNITY_UINT32 num_elements,
846
- const char* msg,
847
- const UNITY_LINE_TYPE lineNumber,
848
- const UNITY_FLAGS_T flags)
849
- {
850
- UNITY_UINT32 elements = num_elements;
851
- UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* ptr_expected = expected;
852
- UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* ptr_actual = actual;
853
-
854
- RETURN_IF_FAIL_OR_IGNORE;
855
-
856
- if (elements == 0)
857
- {
858
- UnityPrintPointlessAndBail();
859
- }
860
-
861
- if (expected == actual) return; /* Both are NULL or same pointer */
862
- if (UnityIsOneArrayNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg))
863
- UNITY_FAIL_AND_BAIL;
864
-
865
- while (elements--)
866
- {
867
- if (!UnityDoublesWithin(*ptr_expected * UNITY_DOUBLE_PRECISION, *ptr_expected, *ptr_actual))
868
- {
869
- UnityTestResultsFailBegin(lineNumber);
870
- UnityPrint(UnityStrElement);
871
- UnityPrintNumberUnsigned(num_elements - elements - 1);
872
- UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT(*ptr_expected, *ptr_actual);
873
- UnityAddMsgIfSpecified(msg);
874
- UNITY_FAIL_AND_BAIL;
875
- }
876
- if (flags == UNITY_ARRAY_TO_ARRAY)
877
- {
878
- ptr_expected++;
879
- }
880
- ptr_actual++;
881
- }
882
- }
883
-
884
- /*-----------------------------------------------*/
885
- void UnityAssertDoublesWithin(const UNITY_DOUBLE delta,
886
- const UNITY_DOUBLE expected,
887
- const UNITY_DOUBLE actual,
888
- const char* msg,
889
- const UNITY_LINE_TYPE lineNumber)
890
- {
891
- RETURN_IF_FAIL_OR_IGNORE;
892
-
893
- if (!UnityDoublesWithin(delta, expected, actual))
894
- {
895
- UnityTestResultsFailBegin(lineNumber);
896
- UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT(expected, actual);
897
- UnityAddMsgIfSpecified(msg);
898
- UNITY_FAIL_AND_BAIL;
899
- }
900
- }
901
-
902
- /*-----------------------------------------------*/
903
-
904
- void UnityAssertDoubleSpecial(const UNITY_DOUBLE actual,
905
- const char* msg,
906
- const UNITY_LINE_TYPE lineNumber,
907
- const UNITY_FLOAT_TRAIT_T style)
908
- {
909
- const char* trait_names[] = {UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet};
910
- UNITY_INT should_be_trait = ((UNITY_INT)style & 1);
911
- UNITY_INT is_trait = !should_be_trait;
912
- UNITY_INT trait_index = (UNITY_INT)(style >> 1);
913
-
914
- RETURN_IF_FAIL_OR_IGNORE;
915
-
916
- switch (style)
917
- {
918
- case UNITY_FLOAT_IS_INF:
919
- case UNITY_FLOAT_IS_NOT_INF:
920
- is_trait = isinf(actual) && (actual > 0);
921
- break;
922
- case UNITY_FLOAT_IS_NEG_INF:
923
- case UNITY_FLOAT_IS_NOT_NEG_INF:
924
- is_trait = isinf(actual) && (actual < 0);
925
- break;
926
-
927
- case UNITY_FLOAT_IS_NAN:
928
- case UNITY_FLOAT_IS_NOT_NAN:
929
- is_trait = isnan(actual) ? 1 : 0;
930
- break;
931
-
932
- case UNITY_FLOAT_IS_DET: /* A determinate number is non infinite and not NaN. */
933
- case UNITY_FLOAT_IS_NOT_DET:
934
- is_trait = !isinf(actual) && !isnan(actual);
935
- break;
936
-
937
- default:
938
- trait_index = 0;
939
- trait_names[0] = UnityStrInvalidFloatTrait;
940
- break;
941
- }
942
-
943
- if (is_trait != should_be_trait)
944
- {
945
- UnityTestResultsFailBegin(lineNumber);
946
- UnityPrint(UnityStrExpected);
947
- if (!should_be_trait)
948
- UnityPrint(UnityStrNot);
949
- UnityPrint(trait_names[trait_index]);
950
- UnityPrint(UnityStrWas);
951
- #ifndef UNITY_EXCLUDE_FLOAT_PRINT
952
- UnityPrintFloat(actual);
953
- #else
954
- if (should_be_trait)
955
- UnityPrint(UnityStrNot);
956
- UnityPrint(trait_names[trait_index]);
957
- #endif
958
- UnityAddMsgIfSpecified(msg);
959
- UNITY_FAIL_AND_BAIL;
960
- }
961
- }
962
-
963
- #endif /* not UNITY_EXCLUDE_DOUBLE */
964
-
965
- /*-----------------------------------------------*/
966
- void UnityAssertNumbersWithin(const UNITY_UINT delta,
967
- const UNITY_INT expected,
968
- const UNITY_INT actual,
969
- const char* msg,
970
- const UNITY_LINE_TYPE lineNumber,
971
- const UNITY_DISPLAY_STYLE_T style)
972
- {
973
- RETURN_IF_FAIL_OR_IGNORE;
974
-
975
- if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
976
- {
977
- if (actual > expected)
978
- Unity.CurrentTestFailed = (UNITY_UINT)((UNITY_UINT)(actual - expected) > delta);
979
- else
980
- Unity.CurrentTestFailed = (UNITY_UINT)((UNITY_UINT)(expected - actual) > delta);
981
- }
982
- else
983
- {
984
- if ((UNITY_UINT)actual > (UNITY_UINT)expected)
985
- Unity.CurrentTestFailed = (UNITY_UINT)((UNITY_UINT)(actual - expected) > delta);
986
- else
987
- Unity.CurrentTestFailed = (UNITY_UINT)((UNITY_UINT)(expected - actual) > delta);
988
- }
989
-
990
- if (Unity.CurrentTestFailed)
991
- {
992
- UnityTestResultsFailBegin(lineNumber);
993
- UnityPrint(UnityStrDelta);
994
- UnityPrintNumberByStyle((UNITY_INT)delta, style);
995
- UnityPrint(UnityStrExpected);
996
- UnityPrintNumberByStyle(expected, style);
997
- UnityPrint(UnityStrWas);
998
- UnityPrintNumberByStyle(actual, style);
999
- UnityAddMsgIfSpecified(msg);
1000
- UNITY_FAIL_AND_BAIL;
1001
- }
1002
- }
1003
-
1004
- /*-----------------------------------------------*/
1005
- void UnityAssertEqualString(const char* expected,
1006
- const char* actual,
1007
- const char* msg,
1008
- const UNITY_LINE_TYPE lineNumber)
1009
- {
1010
- UNITY_UINT32 i;
1011
-
1012
- RETURN_IF_FAIL_OR_IGNORE;
1013
-
1014
- /* if both pointers not null compare the strings */
1015
- if (expected && actual)
1016
- {
1017
- for (i = 0; expected[i] || actual[i]; i++)
1018
- {
1019
- if (expected[i] != actual[i])
1020
- {
1021
- Unity.CurrentTestFailed = 1;
1022
- break;
1023
- }
1024
- }
1025
- }
1026
- else
1027
- { /* handle case of one pointers being null (if both null, test should pass) */
1028
- if (expected != actual)
1029
- {
1030
- Unity.CurrentTestFailed = 1;
1031
- }
1032
- }
1033
-
1034
- if (Unity.CurrentTestFailed)
1035
- {
1036
- UnityTestResultsFailBegin(lineNumber);
1037
- UnityPrintExpectedAndActualStrings(expected, actual);
1038
- UnityAddMsgIfSpecified(msg);
1039
- UNITY_FAIL_AND_BAIL;
1040
- }
1041
- }
1042
-
1043
- /*-----------------------------------------------*/
1044
- void UnityAssertEqualStringLen(const char* expected,
1045
- const char* actual,
1046
- const UNITY_UINT32 length,
1047
- const char* msg,
1048
- const UNITY_LINE_TYPE lineNumber)
1049
- {
1050
- UNITY_UINT32 i;
1051
-
1052
- RETURN_IF_FAIL_OR_IGNORE;
1053
-
1054
- /* if both pointers not null compare the strings */
1055
- if (expected && actual)
1056
- {
1057
- for (i = 0; (i < length) && (expected[i] || actual[i]); i++)
1058
- {
1059
- if (expected[i] != actual[i])
1060
- {
1061
- Unity.CurrentTestFailed = 1;
1062
- break;
1063
- }
1064
- }
1065
- }
1066
- else
1067
- { /* handle case of one pointers being null (if both null, test should pass) */
1068
- if (expected != actual)
1069
- {
1070
- Unity.CurrentTestFailed = 1;
1071
- }
1072
- }
1073
-
1074
- if (Unity.CurrentTestFailed)
1075
- {
1076
- UnityTestResultsFailBegin(lineNumber);
1077
- UnityPrintExpectedAndActualStringsLen(expected, actual, length);
1078
- UnityAddMsgIfSpecified(msg);
1079
- UNITY_FAIL_AND_BAIL;
1080
- }
1081
- }
1082
-
1083
- /*-----------------------------------------------*/
1084
- void UnityAssertEqualStringArray(UNITY_INTERNAL_PTR expected,
1085
- const char** actual,
1086
- const UNITY_UINT32 num_elements,
1087
- const char* msg,
1088
- const UNITY_LINE_TYPE lineNumber,
1089
- const UNITY_FLAGS_T flags)
1090
- {
1091
- UNITY_UINT32 i = 0;
1092
- UNITY_UINT32 j = 0;
1093
- const char* expd = NULL;
1094
- const char* act = NULL;
1095
-
1096
- RETURN_IF_FAIL_OR_IGNORE;
1097
-
1098
- /* if no elements, it's an error */
1099
- if (num_elements == 0)
1100
- {
1101
- UnityPrintPointlessAndBail();
1102
- }
1103
-
1104
- if ((const void*)expected == (const void*)actual)
1105
- {
1106
- return; /* Both are NULL or same pointer */
1107
- }
1108
-
1109
- if (UnityIsOneArrayNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg))
1110
- {
1111
- UNITY_FAIL_AND_BAIL;
1112
- }
1113
-
1114
- if (flags != UNITY_ARRAY_TO_ARRAY)
1115
- {
1116
- expd = (const char*)expected;
1117
- }
1118
-
1119
- do
1120
- {
1121
- act = actual[j];
1122
- if (flags == UNITY_ARRAY_TO_ARRAY)
1123
- {
1124
- expd = ((const char* const*)expected)[j];
1125
- }
1126
-
1127
- /* if both pointers not null compare the strings */
1128
- if (expd && act)
1129
- {
1130
- for (i = 0; expd[i] || act[i]; i++)
1131
- {
1132
- if (expd[i] != act[i])
1133
- {
1134
- Unity.CurrentTestFailed = 1;
1135
- break;
1136
- }
1137
- }
1138
- }
1139
- else
1140
- { /* handle case of one pointers being null (if both null, test should pass) */
1141
- if (expd != act)
1142
- {
1143
- Unity.CurrentTestFailed = 1;
1144
- }
1145
- }
1146
-
1147
- if (Unity.CurrentTestFailed)
1148
- {
1149
- UnityTestResultsFailBegin(lineNumber);
1150
- if (num_elements > 1)
1151
- {
1152
- UnityPrint(UnityStrElement);
1153
- UnityPrintNumberUnsigned(j);
1154
- }
1155
- UnityPrintExpectedAndActualStrings(expd, act);
1156
- UnityAddMsgIfSpecified(msg);
1157
- UNITY_FAIL_AND_BAIL;
1158
- }
1159
- } while (++j < num_elements);
1160
- }
1161
-
1162
- /*-----------------------------------------------*/
1163
- void UnityAssertEqualMemory(UNITY_INTERNAL_PTR expected,
1164
- UNITY_INTERNAL_PTR actual,
1165
- const UNITY_UINT32 length,
1166
- const UNITY_UINT32 num_elements,
1167
- const char* msg,
1168
- const UNITY_LINE_TYPE lineNumber,
1169
- const UNITY_FLAGS_T flags)
1170
- {
1171
- UNITY_PTR_ATTRIBUTE const unsigned char* ptr_exp = (UNITY_PTR_ATTRIBUTE const unsigned char*)expected;
1172
- UNITY_PTR_ATTRIBUTE const unsigned char* ptr_act = (UNITY_PTR_ATTRIBUTE const unsigned char*)actual;
1173
- UNITY_UINT32 elements = num_elements;
1174
- UNITY_UINT32 bytes;
1175
-
1176
- RETURN_IF_FAIL_OR_IGNORE;
1177
-
1178
- if ((elements == 0) || (length == 0))
1179
- {
1180
- UnityPrintPointlessAndBail();
1181
- }
1182
-
1183
- if (expected == actual) return; /* Both are NULL or same pointer */
1184
- if (UnityIsOneArrayNull(expected, actual, lineNumber, msg))
1185
- UNITY_FAIL_AND_BAIL;
1186
-
1187
- while (elements--)
1188
- {
1189
- bytes = length;
1190
- while (bytes--)
1191
- {
1192
- if (*ptr_exp != *ptr_act)
1193
- {
1194
- UnityTestResultsFailBegin(lineNumber);
1195
- UnityPrint(UnityStrMemory);
1196
- if (num_elements > 1)
1197
- {
1198
- UnityPrint(UnityStrElement);
1199
- UnityPrintNumberUnsigned(num_elements - elements - 1);
1200
- }
1201
- UnityPrint(UnityStrByte);
1202
- UnityPrintNumberUnsigned(length - bytes - 1);
1203
- UnityPrint(UnityStrExpected);
1204
- UnityPrintNumberByStyle(*ptr_exp, UNITY_DISPLAY_STYLE_HEX8);
1205
- UnityPrint(UnityStrWas);
1206
- UnityPrintNumberByStyle(*ptr_act, UNITY_DISPLAY_STYLE_HEX8);
1207
- UnityAddMsgIfSpecified(msg);
1208
- UNITY_FAIL_AND_BAIL;
1209
- }
1210
- ptr_exp++;
1211
- ptr_act++;
1212
- }
1213
- if (flags == UNITY_ARRAY_TO_VAL)
1214
- {
1215
- ptr_exp = (UNITY_PTR_ATTRIBUTE const unsigned char*)expected;
1216
- }
1217
- }
1218
- }
1219
-
1220
- /*-----------------------------------------------*/
1221
-
1222
- static union
1223
- {
1224
- UNITY_INT8 i8;
1225
- UNITY_INT16 i16;
1226
- UNITY_INT32 i32;
1227
- #ifdef UNITY_SUPPORT_64
1228
- UNITY_INT64 i64;
1229
- #endif
1230
- #ifndef UNITY_EXCLUDE_FLOAT
1231
- float f;
1232
- #endif
1233
- #ifndef UNITY_EXCLUDE_DOUBLE
1234
- double d;
1235
- #endif
1236
- } UnityQuickCompare;
1237
-
1238
- UNITY_INTERNAL_PTR UnityNumToPtr(const UNITY_INT num, const UNITY_UINT8 size)
1239
- {
1240
- switch(size)
1241
- {
1242
- case 1:
1243
- UnityQuickCompare.i8 = (UNITY_INT8)num;
1244
- return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.i8);
1245
-
1246
- case 2:
1247
- UnityQuickCompare.i16 = (UNITY_INT16)num;
1248
- return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.i16);
1249
-
1250
- #ifdef UNITY_SUPPORT_64
1251
- case 8:
1252
- UnityQuickCompare.i64 = (UNITY_INT64)num;
1253
- return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.i64);
1254
- #endif
1255
- default: /* 4 bytes */
1256
- UnityQuickCompare.i32 = (UNITY_INT32)num;
1257
- return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.i32);
1258
- }
1259
- }
1260
-
1261
- #ifndef UNITY_EXCLUDE_FLOAT
1262
- UNITY_INTERNAL_PTR UnityFloatToPtr(const float num)
1263
- {
1264
- UnityQuickCompare.f = num;
1265
- return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.f);
1266
- }
1267
- #endif
1268
-
1269
- #ifndef UNITY_EXCLUDE_DOUBLE
1270
- UNITY_INTERNAL_PTR UnityDoubleToPtr(const double num)
1271
- {
1272
- UnityQuickCompare.d = num;
1273
- return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.d);
1274
- }
1275
- #endif
1276
-
1277
- /*-----------------------------------------------
1278
- * Control Functions
1279
- *-----------------------------------------------*/
1280
-
1281
- void UnityFail(const char* msg, const UNITY_LINE_TYPE line)
1282
- {
1283
- RETURN_IF_FAIL_OR_IGNORE;
1284
-
1285
- UnityTestResultsBegin(Unity.TestFile, line);
1286
- UnityPrint(UnityStrFail);
1287
- if (msg != NULL)
1288
- {
1289
- UNITY_OUTPUT_CHAR(':');
1290
-
1291
- #ifndef UNITY_EXCLUDE_DETAILS
1292
- if (Unity.CurrentDetail1)
1293
- {
1294
- UnityPrint(UnityStrDetail1Name);
1295
- UnityPrint(Unity.CurrentDetail1);
1296
- if (Unity.CurrentDetail2)
1297
- {
1298
- UnityPrint(UnityStrDetail2Name);
1299
- UnityPrint(Unity.CurrentDetail2);
1300
- }
1301
- UnityPrint(UnityStrSpacer);
1302
- }
1303
- #endif
1304
- if (msg[0] != ' ')
1305
- {
1306
- UNITY_OUTPUT_CHAR(' ');
1307
- }
1308
- UnityPrint(msg);
1309
- }
1310
-
1311
- UNITY_FAIL_AND_BAIL;
1312
- }
1313
-
1314
- /*-----------------------------------------------*/
1315
- void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line)
1316
- {
1317
- RETURN_IF_FAIL_OR_IGNORE;
1318
-
1319
- UnityTestResultsBegin(Unity.TestFile, line);
1320
- UnityPrint(UnityStrIgnore);
1321
- if (msg != NULL)
1322
- {
1323
- UNITY_OUTPUT_CHAR(':');
1324
- UNITY_OUTPUT_CHAR(' ');
1325
- UnityPrint(msg);
1326
- }
1327
- UNITY_IGNORE_AND_BAIL;
1328
- }
1329
-
1330
- /*-----------------------------------------------*/
1331
- void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum)
1332
- {
1333
- Unity.CurrentTestName = FuncName;
1334
- Unity.CurrentTestLineNumber = (UNITY_LINE_TYPE)FuncLineNum;
1335
- Unity.NumberOfTests++;
1336
- UNITY_CLR_DETAILS();
1337
- if (TEST_PROTECT())
1338
- {
1339
- setUp();
1340
- Func();
1341
- }
1342
- if (TEST_PROTECT())
1343
- {
1344
- tearDown();
1345
- }
1346
- UnityConcludeTest();
1347
- }
1348
-
1349
- /*-----------------------------------------------*/
1350
- void UnityBegin(const char* filename)
1351
- {
1352
- Unity.TestFile = filename;
1353
- Unity.CurrentTestName = NULL;
1354
- Unity.CurrentTestLineNumber = 0;
1355
- Unity.NumberOfTests = 0;
1356
- Unity.TestFailures = 0;
1357
- Unity.TestIgnores = 0;
1358
- Unity.CurrentTestFailed = 0;
1359
- Unity.CurrentTestIgnored = 0;
1360
- UNITY_EXEC_TIME_RESET();
1361
-
1362
- UNITY_CLR_DETAILS();
1363
- UNITY_OUTPUT_START();
1364
- }
1365
-
1366
- /*-----------------------------------------------*/
1367
- int UnityEnd(void)
1368
- {
1369
- UNITY_PRINT_EOL();
1370
- UnityPrint(UnityStrBreaker);
1371
- UNITY_PRINT_EOL();
1372
- UnityPrintNumber((UNITY_INT)(Unity.NumberOfTests));
1373
- UnityPrint(UnityStrResultsTests);
1374
- UnityPrintNumber((UNITY_INT)(Unity.TestFailures));
1375
- UnityPrint(UnityStrResultsFailures);
1376
- UnityPrintNumber((UNITY_INT)(Unity.TestIgnores));
1377
- UnityPrint(UnityStrResultsIgnored);
1378
- UNITY_PRINT_EOL();
1379
- if (Unity.TestFailures == 0U)
1380
- {
1381
- UnityPrint(UnityStrOk);
1382
- }
1383
- else
1384
- {
1385
- UnityPrint(UnityStrFail);
1386
- #ifdef UNITY_DIFFERENTIATE_FINAL_FAIL
1387
- UNITY_OUTPUT_CHAR('E'); UNITY_OUTPUT_CHAR('D');
1388
- #endif
1389
- }
1390
- UNITY_PRINT_EOL();
1391
- UNITY_FLUSH_CALL();
1392
- UNITY_OUTPUT_COMPLETE();
1393
- return (int)(Unity.TestFailures);
1394
- }
1395
-
1396
- /*-----------------------------------------------
1397
- * Command Line Argument Support
1398
- *-----------------------------------------------*/
1399
- #ifdef UNITY_USE_COMMAND_LINE_ARGS
1400
-
1401
- char* UnityOptionIncludeNamed = NULL;
1402
- char* UnityOptionExcludeNamed = NULL;
1403
- int UnityVerbosity = 1;
1404
-
1405
- int UnityParseOptions(int argc, char** argv)
1406
- {
1407
- UnityOptionIncludeNamed = NULL;
1408
- UnityOptionExcludeNamed = NULL;
1409
-
1410
- for (int i = 1; i < argc; i++)
1411
- {
1412
- if (argv[i][0] == '-')
1413
- {
1414
- switch (argv[i][1])
1415
- {
1416
- case 'l': /* list tests */
1417
- return -1;
1418
- case 'n': /* include tests with name including this string */
1419
- case 'f': /* an alias for -n */
1420
- if (argv[i][2] == '=')
1421
- UnityOptionIncludeNamed = &argv[i][3];
1422
- else if (++i < argc)
1423
- UnityOptionIncludeNamed = argv[i];
1424
- else
1425
- {
1426
- UnityPrint("ERROR: No Test String to Include Matches For");
1427
- UNITY_PRINT_EOL();
1428
- return 1;
1429
- }
1430
- break;
1431
- case 'q': /* quiet */
1432
- UnityVerbosity = 0;
1433
- break;
1434
- case 'v': /* verbose */
1435
- UnityVerbosity = 2;
1436
- break;
1437
- case 'x': /* exclude tests with name including this string */
1438
- if (argv[i][2] == '=')
1439
- UnityOptionExcludeNamed = &argv[i][3];
1440
- else if (++i < argc)
1441
- UnityOptionExcludeNamed = argv[i];
1442
- else
1443
- {
1444
- UnityPrint("ERROR: No Test String to Exclude Matches For");
1445
- UNITY_PRINT_EOL();
1446
- return 1;
1447
- }
1448
- break;
1449
- default:
1450
- UnityPrint("ERROR: Unknown Option ");
1451
- UNITY_OUTPUT_CHAR(argv[i][1]);
1452
- UNITY_PRINT_EOL();
1453
- return 1;
1454
- }
1455
- }
1456
- }
1457
-
1458
- return 0;
1459
- }
1460
-
1461
- int IsStringInBiggerString(const char* longstring, const char* shortstring)
1462
- {
1463
- const char* lptr = longstring;
1464
- const char* sptr = shortstring;
1465
- const char* lnext = lptr;
1466
-
1467
- if (*sptr == '*')
1468
- return 1;
1469
-
1470
- while (*lptr)
1471
- {
1472
- lnext = lptr + 1;
1473
-
1474
- /* If they current bytes match, go on to the next bytes */
1475
- while (*lptr && *sptr && (*lptr == *sptr))
1476
- {
1477
- lptr++;
1478
- sptr++;
1479
-
1480
- /* We're done if we match the entire string or up to a wildcard */
1481
- if (*sptr == '*')
1482
- return 1;
1483
- if (*sptr == ',')
1484
- return 1;
1485
- if (*sptr == '"')
1486
- return 1;
1487
- if (*sptr == '\'')
1488
- return 1;
1489
- if (*sptr == ':')
1490
- return 2;
1491
- if (*sptr == 0)
1492
- return 1;
1493
- }
1494
-
1495
- /* Otherwise we start in the long pointer 1 character further and try again */
1496
- lptr = lnext;
1497
- sptr = shortstring;
1498
- }
1499
- return 0;
1500
- }
1501
-
1502
- int UnityStringArgumentMatches(const char* str)
1503
- {
1504
- int retval;
1505
- const char* ptr1;
1506
- const char* ptr2;
1507
- const char* ptrf;
1508
-
1509
- /* Go through the options and get the substrings for matching one at a time */
1510
- ptr1 = str;
1511
- while (ptr1[0] != 0)
1512
- {
1513
- if ((ptr1[0] == '"') || (ptr1[0] == '\''))
1514
- ptr1++;
1515
-
1516
- /* look for the start of the next partial */
1517
- ptr2 = ptr1;
1518
- ptrf = 0;
1519
- do
1520
- {
1521
- ptr2++;
1522
- if ((ptr2[0] == ':') && (ptr2[1] != 0) && (ptr2[0] != '\'') && (ptr2[0] != '"') && (ptr2[0] != ','))
1523
- ptrf = &ptr2[1];
1524
- } while ((ptr2[0] != 0) && (ptr2[0] != '\'') && (ptr2[0] != '"') && (ptr2[0] != ','));
1525
- while ((ptr2[0] != 0) && ((ptr2[0] == ':') || (ptr2[0] == '\'') || (ptr2[0] == '"') || (ptr2[0] == ',')))
1526
- ptr2++;
1527
-
1528
- /* done if complete filename match */
1529
- retval = IsStringInBiggerString(Unity.TestFile, ptr1);
1530
- if (retval == 1)
1531
- return retval;
1532
-
1533
- /* done if testname match after filename partial match */
1534
- if ((retval == 2) && (ptrf != 0))
1535
- {
1536
- if (IsStringInBiggerString(Unity.CurrentTestName, ptrf))
1537
- return 1;
1538
- }
1539
-
1540
- /* done if complete testname match */
1541
- if (IsStringInBiggerString(Unity.CurrentTestName, ptr1) == 1)
1542
- return 1;
1543
-
1544
- ptr1 = ptr2;
1545
- }
1546
-
1547
- /* we couldn't find a match for any substrings */
1548
- return 0;
1549
- }
1550
-
1551
- int UnityTestMatches(void)
1552
- {
1553
- /* Check if this test name matches the included test pattern */
1554
- int retval;
1555
- if (UnityOptionIncludeNamed)
1556
- {
1557
- retval = UnityStringArgumentMatches(UnityOptionIncludeNamed);
1558
- }
1559
- else
1560
- retval = 1;
1561
-
1562
- /* Check if this test name matches the excluded test pattern */
1563
- if (UnityOptionExcludeNamed)
1564
- {
1565
- if (UnityStringArgumentMatches(UnityOptionExcludeNamed))
1566
- retval = 0;
1567
- }
1568
- return retval;
1569
- }
1570
-
1571
- #endif /* UNITY_USE_COMMAND_LINE_ARGS */
1572
- /*-----------------------------------------------*/
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
+ /*-----------------------------------------------*/