ceedling 0.25.0 → 0.27.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (434) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/assets/project_as_gem.yml +13 -0
  4. data/assets/project_with_guts.yml +13 -0
  5. data/bin/ceedling +91 -67
  6. data/docs/CeedlingPacket.md +61 -23
  7. data/docs/CeedlingPacket.odt +0 -0
  8. data/docs/CeedlingPacket.pdf +0 -0
  9. data/docs/ThrowTheSwitchCodingStandard.md +207 -0
  10. data/examples/temp_sensor/test/TestTemperatureCalculator.c +4 -1
  11. data/lib/ceedling/configurator.rb +14 -1
  12. data/lib/ceedling/configurator_builder.rb +2 -1
  13. data/lib/ceedling/configurator_validator.rb +12 -3
  14. data/lib/ceedling/constants.rb +3 -1
  15. data/lib/ceedling/defaults.rb +12 -1
  16. data/lib/ceedling/file_finder.rb +3 -0
  17. data/lib/ceedling/file_path_utils.rb +1 -1
  18. data/lib/ceedling/file_wrapper.rb +4 -4
  19. data/lib/ceedling/generator.rb +12 -3
  20. data/lib/ceedling/preprocessinator_helper.rb +5 -5
  21. data/lib/ceedling/preprocessinator_includes_handler.rb +10 -1
  22. data/lib/ceedling/project_config_manager.rb +1 -2
  23. data/lib/ceedling/project_file_loader.rb +27 -9
  24. data/lib/ceedling/rakefile.rb +6 -6
  25. data/lib/ceedling/release_invoker.rb +21 -6
  26. data/lib/ceedling/rules_release.rake +9 -5
  27. data/lib/ceedling/rules_tests.rake +6 -1
  28. data/lib/ceedling/setupinator.rb +1 -0
  29. data/lib/ceedling/tasks_base.rake +3 -0
  30. data/lib/ceedling/tasks_filesystem.rake +10 -7
  31. data/lib/ceedling/tasks_release.rake +3 -1
  32. data/lib/ceedling/test_includes_extractor.rb +16 -12
  33. data/lib/ceedling/test_invoker.rb +40 -0
  34. data/lib/ceedling/version.rb +3 -3
  35. data/lib/ceedling/version.rb.erb +1 -1
  36. data/plugins/command_hooks/lib/command_hooks.rb +1 -1
  37. data/plugins/fake_function_framework/examples/fff_example/src/bar.h +1 -0
  38. data/plugins/fake_function_framework/examples/fff_example/src/event_processor.c +1 -0
  39. data/plugins/fake_function_framework/lib/fff_mock_generator.rb +4 -0
  40. data/plugins/fake_function_framework/spec/{fff_mock_generator_spec.rb → fff_mock_header_generator_spec.rb} +34 -194
  41. data/plugins/fake_function_framework/spec/fff_mock_source_generator_spec.rb +149 -0
  42. data/plugins/fake_function_framework/spec/header_generator.rb +51 -0
  43. data/plugins/junit_tests_report/lib/junit_tests_report.rb +115 -0
  44. data/plugins/subprojects/README.md +63 -0
  45. data/plugins/subprojects/config/defaults.yml +33 -0
  46. data/plugins/subprojects/lib/subprojects.rb +92 -0
  47. data/plugins/subprojects/subprojects.rake +78 -0
  48. data/spec/preprocessinator_includes_handler_spec.rb +15 -5
  49. data/spec/spec_helper.rb +2 -2
  50. data/spec/spec_system_helper.rb +49 -1
  51. data/spec/system/deployment_spec.rb +29 -0
  52. data/vendor/c_exception/README.md +8 -2
  53. data/vendor/c_exception/docs/{readme.txt → CException.md} +133 -102
  54. data/vendor/c_exception/docs/ThrowTheSwitchCodingStandard.md +207 -0
  55. data/vendor/c_exception/vendor/unity/README.md +19 -10
  56. data/vendor/c_exception/vendor/unity/auto/colour_prompt.rb +67 -64
  57. data/vendor/c_exception/vendor/unity/auto/colour_reporter.rb +20 -20
  58. data/vendor/c_exception/vendor/unity/auto/generate_module.rb +149 -142
  59. data/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +234 -232
  60. data/vendor/c_exception/vendor/unity/auto/parse_output.rb +220 -0
  61. data/vendor/c_exception/vendor/unity/auto/stylize_as_junit.rb +108 -120
  62. data/vendor/c_exception/vendor/unity/auto/test_file_filter.rb +11 -9
  63. data/vendor/c_exception/vendor/unity/auto/type_sanitizer.rb +1 -3
  64. data/vendor/c_exception/vendor/unity/auto/unity_test_summary.py +6 -2
  65. data/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb +45 -57
  66. data/vendor/c_exception/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +207 -0
  67. data/vendor/c_exception/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
  68. data/vendor/c_exception/vendor/unity/docs/UnityAssertionsReference.md +716 -0
  69. data/vendor/c_exception/vendor/unity/docs/UnityConfigurationGuide.md +398 -0
  70. data/vendor/c_exception/vendor/unity/docs/UnityGettingStartedGuide.md +191 -0
  71. data/vendor/c_exception/vendor/unity/docs/UnityHelperScriptsGuide.md +242 -0
  72. data/vendor/c_exception/vendor/unity/examples/example_1/makefile +22 -17
  73. data/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +1 -1
  74. data/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +1 -1
  75. data/vendor/c_exception/vendor/unity/examples/example_2/makefile +16 -17
  76. data/vendor/c_exception/vendor/unity/examples/example_3/rakefile.rb +15 -15
  77. data/vendor/c_exception/vendor/unity/examples/example_3/rakefile_helper.rb +93 -100
  78. data/vendor/c_exception/vendor/unity/examples/example_3/readme.txt +4 -10
  79. data/vendor/c_exception/vendor/unity/examples/unity_config.h +14 -26
  80. data/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb +12 -12
  81. data/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb +87 -88
  82. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +15 -8
  83. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h +6 -1
  84. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +3 -0
  85. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +1 -0
  86. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +1 -1
  87. data/vendor/c_exception/vendor/unity/src/unity.c +396 -330
  88. data/vendor/c_exception/vendor/unity/src/unity.h +50 -4
  89. data/vendor/c_exception/vendor/unity/src/unity_internals.h +119 -84
  90. data/vendor/c_exception/vendor/unity/test/Makefile +17 -17
  91. data/vendor/c_exception/vendor/unity/test/rakefile +63 -3
  92. data/vendor/c_exception/vendor/unity/test/rakefile_helper.rb +108 -105
  93. data/vendor/c_exception/vendor/unity/test/spec/generate_module_existing_file_spec.rb +158 -0
  94. data/vendor/c_exception/vendor/unity/test/targets/clang_file.yml +0 -6
  95. data/vendor/c_exception/vendor/unity/test/targets/clang_strict.yml +1 -9
  96. data/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +2 -0
  97. data/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +2 -2
  98. data/vendor/c_exception/vendor/unity/test/tests/test_generate_test_runner.rb +5 -5
  99. data/vendor/c_exception/vendor/unity/test/tests/testunity.c +1338 -151
  100. data/vendor/cmock/README.md +10 -1
  101. data/vendor/cmock/config/test_environment.rb +7 -7
  102. data/vendor/cmock/docs/CMock_Summary.md +325 -128
  103. data/vendor/cmock/docs/ThrowTheSwitchCodingStandard.md +207 -0
  104. data/vendor/cmock/examples/make_example/Makefile +2 -2
  105. data/vendor/cmock/examples/temp_sensor/gcc.yml +5 -4
  106. data/vendor/cmock/examples/temp_sensor/iar_v4.yml +5 -4
  107. data/vendor/cmock/examples/temp_sensor/iar_v5.yml +5 -4
  108. data/vendor/cmock/examples/temp_sensor/rakefile.rb +11 -1
  109. data/vendor/cmock/examples/temp_sensor/rakefile_helper.rb +12 -10
  110. data/vendor/cmock/lib/cmock.rb +0 -3
  111. data/vendor/cmock/lib/cmock_generator_plugin_callback.rb +6 -2
  112. data/vendor/cmock/lib/cmock_generator_plugin_return_thru_ptr.rb +2 -1
  113. data/vendor/cmock/lib/cmock_header_parser.rb +5 -6
  114. data/vendor/cmock/release/version.info +1 -1
  115. data/vendor/cmock/scripts/create_makefile.rb +4 -2
  116. data/vendor/cmock/scripts/test_summary.rb +17 -9
  117. data/vendor/cmock/src/cmock.c +1 -0
  118. data/vendor/cmock/src/cmock.h +1 -1
  119. data/vendor/cmock/src/cmock_internals.h +14 -1
  120. data/vendor/cmock/test/c/TestCMockC.yml +4 -4
  121. data/vendor/cmock/test/c/TestCMockCDynamic.yml +4 -4
  122. data/vendor/cmock/{iar → test/iar}/iar_v4/Resource/SAM7_FLASH.mac +0 -0
  123. data/vendor/cmock/{iar → test/iar}/iar_v4/Resource/SAM7_RAM.mac +0 -0
  124. data/vendor/cmock/{iar → test/iar}/iar_v4/Resource/SAM7_SIM.mac +0 -0
  125. data/vendor/cmock/{iar → test/iar}/iar_v4/Resource/at91SAM7X256_FLASH.xcl +0 -0
  126. data/vendor/cmock/{iar → test/iar}/iar_v4/Resource/at91SAM7X256_RAM.xcl +0 -0
  127. data/vendor/cmock/{iar → test/iar}/iar_v4/Resource/ioat91sam7x256.ddf +0 -0
  128. data/vendor/cmock/{iar → test/iar}/iar_v4/cmock_demo.dep +0 -0
  129. data/vendor/cmock/{iar → test/iar}/iar_v4/cmock_demo.ewd +0 -0
  130. data/vendor/cmock/{iar → test/iar}/iar_v4/cmock_demo.ewp +0 -0
  131. data/vendor/cmock/{iar → test/iar}/iar_v4/cmock_demo.eww +0 -0
  132. data/vendor/cmock/{iar → test/iar}/iar_v4/incIAR/AT91SAM7X-EK.h +0 -0
  133. data/vendor/cmock/{iar → test/iar}/iar_v4/incIAR/AT91SAM7X256.inc +0 -0
  134. data/vendor/cmock/{iar → test/iar}/iar_v4/incIAR/AT91SAM7X256.rdf +0 -0
  135. data/vendor/cmock/{iar → test/iar}/iar_v4/incIAR/AT91SAM7X256.tcl +0 -0
  136. data/vendor/cmock/{iar → test/iar}/iar_v4/incIAR/AT91SAM7X256_inc.h +0 -0
  137. data/vendor/cmock/{iar → test/iar}/iar_v4/incIAR/ioat91sam7x256.h +0 -0
  138. data/vendor/cmock/{iar → test/iar}/iar_v4/incIAR/lib_AT91SAM7X256.h +0 -0
  139. data/vendor/cmock/{iar → test/iar}/iar_v4/settings/cmock_demo.cspy.bat +0 -0
  140. data/vendor/cmock/{iar → test/iar}/iar_v4/settings/cmock_demo.dbgdt +0 -0
  141. data/vendor/cmock/{iar → test/iar}/iar_v4/settings/cmock_demo.dni +0 -0
  142. data/vendor/cmock/{iar → test/iar}/iar_v4/settings/cmock_demo.wsdt +0 -0
  143. data/vendor/cmock/{iar → test/iar}/iar_v4/srcIAR/Cstartup.s79 +0 -0
  144. data/vendor/cmock/{iar → test/iar}/iar_v4/srcIAR/Cstartup_SAM7.c +0 -0
  145. data/vendor/cmock/{iar → test/iar}/iar_v5/Resource/SAM7_FLASH.mac +0 -0
  146. data/vendor/cmock/{iar → test/iar}/iar_v5/Resource/SAM7_RAM.mac +0 -0
  147. data/vendor/cmock/{iar → test/iar}/iar_v5/Resource/SAM7_SIM.mac +0 -0
  148. data/vendor/cmock/{iar → test/iar}/iar_v5/Resource/at91SAM7X256_FLASH.icf +0 -0
  149. data/vendor/cmock/{iar → test/iar}/iar_v5/Resource/at91SAM7X256_RAM.icf +0 -0
  150. data/vendor/cmock/{iar → test/iar}/iar_v5/cmock_demo.dep +0 -0
  151. data/vendor/cmock/{iar → test/iar}/iar_v5/cmock_demo.ewd +0 -0
  152. data/vendor/cmock/{iar → test/iar}/iar_v5/cmock_demo.ewp +0 -0
  153. data/vendor/cmock/{iar → test/iar}/iar_v5/cmock_demo.eww +0 -0
  154. data/vendor/cmock/{iar → test/iar}/iar_v5/incIAR/AT91SAM7X-EK.h +0 -0
  155. data/vendor/cmock/{iar → test/iar}/iar_v5/incIAR/AT91SAM7X256_inc.h +0 -0
  156. data/vendor/cmock/{iar → test/iar}/iar_v5/incIAR/lib_AT91SAM7X256.h +0 -0
  157. data/vendor/cmock/{iar → test/iar}/iar_v5/incIAR/project.h +0 -0
  158. data/vendor/cmock/{iar → test/iar}/iar_v5/settings/BasicInterrupt_SAM7X.cspy.bat +0 -0
  159. data/vendor/cmock/{iar → test/iar}/iar_v5/settings/BasicInterrupt_SAM7X.dbgdt +0 -0
  160. data/vendor/cmock/{iar → test/iar}/iar_v5/settings/BasicInterrupt_SAM7X.dni +0 -0
  161. data/vendor/cmock/{iar → test/iar}/iar_v5/settings/BasicInterrupt_SAM7X.wsdt +0 -0
  162. data/vendor/cmock/{iar → test/iar}/iar_v5/settings/BasicInterrupt_SAM7X_FLASH_Debug.jlink +0 -0
  163. data/vendor/cmock/{iar → test/iar}/iar_v5/settings/cmock_demo.cspy.bat +0 -0
  164. data/vendor/cmock/{iar → test/iar}/iar_v5/settings/cmock_demo.dbgdt +0 -0
  165. data/vendor/cmock/{iar → test/iar}/iar_v5/settings/cmock_demo.dni +0 -0
  166. data/vendor/cmock/{iar → test/iar}/iar_v5/settings/cmock_demo.wsdt +0 -0
  167. data/vendor/cmock/{iar → test/iar}/iar_v5/settings/cmock_demo_Binary.jlink +0 -0
  168. data/vendor/cmock/{iar → test/iar}/iar_v5/settings/cmock_demo_FLASH_Debug.jlink +0 -0
  169. data/vendor/cmock/{iar → test/iar}/iar_v5/settings/cmock_demo_RAM_Debug.jlink +0 -0
  170. data/vendor/cmock/{iar → test/iar}/iar_v5/srcIAR/Cstartup.s +0 -0
  171. data/vendor/cmock/{iar → test/iar}/iar_v5/srcIAR/Cstartup_SAM7.c +0 -0
  172. data/vendor/cmock/{Rakefile → test/rakefile} +9 -9
  173. data/vendor/cmock/{rakefile_helper.rb → test/rakefile_helper.rb} +13 -13
  174. data/vendor/cmock/test/system/test_compilation/config.yml +4 -4
  175. data/vendor/cmock/test/system/test_interactions/parsing_challenges.yml +2 -0
  176. data/vendor/cmock/{targets → test/targets}/clang_strict.yml +11 -11
  177. data/vendor/cmock/{targets → test/targets}/gcc.yml +9 -9
  178. data/vendor/cmock/{targets → test/targets}/gcc_64.yml +9 -9
  179. data/vendor/cmock/{targets → test/targets}/gcc_tiny.yml +9 -9
  180. data/vendor/cmock/{targets → test/targets}/iar_arm_v4.yml +9 -9
  181. data/vendor/cmock/{targets → test/targets}/iar_arm_v5.yml +10 -10
  182. data/vendor/cmock/test/test_helper.rb +4 -8
  183. data/vendor/cmock/test/unit/cmock_config_test.rb +1 -1
  184. data/vendor/cmock/test/unit/cmock_file_writer_test.rb +1 -1
  185. data/vendor/cmock/test/unit/cmock_generator_main_test.rb +1 -1
  186. data/vendor/cmock/test/unit/cmock_generator_plugin_array_test.rb +1 -1
  187. data/vendor/cmock/test/unit/cmock_generator_plugin_callback_test.rb +3 -1
  188. data/vendor/cmock/test/unit/cmock_generator_plugin_cexception_test.rb +1 -1
  189. data/vendor/cmock/test/unit/cmock_generator_plugin_expect_a_test.rb +1 -1
  190. data/vendor/cmock/test/unit/cmock_generator_plugin_expect_any_args_test.rb +1 -1
  191. data/vendor/cmock/test/unit/cmock_generator_plugin_expect_b_test.rb +1 -1
  192. data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_arg_test.rb +1 -1
  193. data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_test.rb +1 -1
  194. data/vendor/cmock/test/unit/cmock_generator_plugin_return_thru_ptr_test.rb +1 -1
  195. data/vendor/cmock/test/unit/cmock_generator_utils_test.rb +1 -1
  196. data/vendor/cmock/test/unit/cmock_header_parser_test.rb +15 -2
  197. data/vendor/cmock/test/unit/cmock_plugin_manager_test.rb +6 -10
  198. data/vendor/cmock/test/unit/cmock_unityhelper_parser_test.rb +1 -1
  199. data/vendor/cmock/vendor/c_exception/README.md +8 -2
  200. data/vendor/cmock/vendor/c_exception/docs/{readme.txt → CException.md} +133 -102
  201. data/vendor/cmock/vendor/c_exception/docs/ThrowTheSwitchCodingStandard.md +207 -0
  202. data/vendor/cmock/vendor/c_exception/vendor/unity/README.md +19 -10
  203. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_prompt.rb +67 -64
  204. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_reporter.rb +20 -20
  205. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_module.rb +149 -142
  206. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +234 -232
  207. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/parse_output.rb +220 -0
  208. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/stylize_as_junit.rb +108 -120
  209. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/test_file_filter.rb +11 -9
  210. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/type_sanitizer.rb +1 -3
  211. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_test_summary.py +6 -2
  212. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb +45 -57
  213. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +207 -0
  214. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
  215. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityAssertionsReference.md +716 -0
  216. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityConfigurationGuide.md +398 -0
  217. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityGettingStartedGuide.md +191 -0
  218. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityHelperScriptsGuide.md +242 -0
  219. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/makefile +22 -17
  220. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +1 -1
  221. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +1 -1
  222. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/makefile +16 -17
  223. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/rakefile.rb +15 -15
  224. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/rakefile_helper.rb +93 -100
  225. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/readme.txt +4 -10
  226. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/unity_config.h +14 -26
  227. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb +12 -12
  228. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb +87 -88
  229. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +15 -8
  230. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h +6 -1
  231. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +3 -0
  232. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +1 -0
  233. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +1 -1
  234. data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.c +396 -330
  235. data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.h +50 -4
  236. data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity_internals.h +119 -84
  237. data/vendor/cmock/vendor/c_exception/vendor/unity/test/Makefile +17 -17
  238. data/vendor/cmock/vendor/c_exception/vendor/unity/test/rakefile +63 -3
  239. data/vendor/cmock/vendor/c_exception/vendor/unity/test/rakefile_helper.rb +108 -105
  240. data/vendor/cmock/vendor/c_exception/vendor/unity/test/spec/generate_module_existing_file_spec.rb +158 -0
  241. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/clang_file.yml +0 -6
  242. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/clang_strict.yml +1 -9
  243. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +2 -0
  244. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +2 -2
  245. data/vendor/cmock/vendor/c_exception/vendor/unity/test/tests/test_generate_test_runner.rb +5 -5
  246. data/vendor/cmock/vendor/c_exception/vendor/unity/test/tests/testunity.c +1338 -151
  247. data/vendor/cmock/vendor/unity/README.md +19 -10
  248. data/vendor/cmock/vendor/unity/auto/colour_prompt.rb +67 -64
  249. data/vendor/cmock/vendor/unity/auto/colour_reporter.rb +20 -20
  250. data/vendor/cmock/vendor/unity/auto/generate_module.rb +149 -142
  251. data/vendor/cmock/vendor/unity/auto/generate_test_runner.rb +234 -232
  252. data/vendor/cmock/vendor/unity/auto/parse_output.rb +220 -0
  253. data/vendor/cmock/vendor/unity/auto/stylize_as_junit.rb +108 -120
  254. data/vendor/cmock/vendor/unity/auto/test_file_filter.rb +11 -9
  255. data/vendor/cmock/vendor/unity/auto/type_sanitizer.rb +1 -3
  256. data/vendor/cmock/vendor/unity/auto/unity_test_summary.py +6 -2
  257. data/vendor/cmock/vendor/unity/auto/unity_test_summary.rb +45 -57
  258. data/vendor/cmock/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +207 -0
  259. data/vendor/cmock/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
  260. data/vendor/cmock/vendor/unity/docs/UnityAssertionsReference.md +716 -0
  261. data/vendor/cmock/vendor/unity/docs/UnityConfigurationGuide.md +398 -0
  262. data/vendor/cmock/vendor/unity/docs/UnityGettingStartedGuide.md +191 -0
  263. data/vendor/cmock/vendor/unity/docs/UnityHelperScriptsGuide.md +242 -0
  264. data/vendor/cmock/vendor/unity/examples/example_1/makefile +22 -17
  265. data/vendor/cmock/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +1 -1
  266. data/vendor/cmock/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +1 -1
  267. data/vendor/cmock/vendor/unity/examples/example_2/makefile +16 -17
  268. data/vendor/cmock/vendor/unity/examples/example_3/rakefile.rb +15 -15
  269. data/vendor/cmock/vendor/unity/examples/example_3/rakefile_helper.rb +93 -100
  270. data/vendor/cmock/vendor/unity/examples/example_3/readme.txt +4 -10
  271. data/vendor/cmock/vendor/unity/examples/unity_config.h +14 -26
  272. data/vendor/cmock/vendor/unity/extras/fixture/rakefile.rb +12 -12
  273. data/vendor/cmock/vendor/unity/extras/fixture/rakefile_helper.rb +87 -88
  274. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c +15 -8
  275. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h +6 -1
  276. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h +3 -0
  277. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +1 -0
  278. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c +1 -1
  279. data/vendor/cmock/vendor/unity/release/version.info +1 -1
  280. data/vendor/cmock/vendor/unity/src/unity.c +396 -330
  281. data/vendor/cmock/vendor/unity/src/unity.h +50 -4
  282. data/vendor/cmock/vendor/unity/src/unity_internals.h +119 -84
  283. data/vendor/cmock/vendor/unity/test/Makefile +17 -17
  284. data/vendor/cmock/vendor/unity/test/rakefile +63 -3
  285. data/vendor/cmock/vendor/unity/test/rakefile_helper.rb +108 -105
  286. data/vendor/cmock/vendor/unity/test/spec/generate_module_existing_file_spec.rb +158 -0
  287. data/vendor/cmock/vendor/unity/test/targets/clang_file.yml +0 -6
  288. data/vendor/cmock/vendor/unity/test/targets/clang_strict.yml +1 -9
  289. data/vendor/cmock/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +2 -0
  290. data/vendor/cmock/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +2 -2
  291. data/vendor/cmock/vendor/unity/test/tests/test_generate_test_runner.rb +5 -5
  292. data/vendor/cmock/vendor/unity/test/tests/testunity.c +1338 -151
  293. data/vendor/deep_merge/Rakefile +1 -1
  294. data/vendor/unity/README.md +19 -10
  295. data/vendor/unity/auto/colour_prompt.rb +67 -64
  296. data/vendor/unity/auto/colour_reporter.rb +20 -20
  297. data/vendor/unity/auto/generate_module.rb +149 -142
  298. data/vendor/unity/auto/generate_test_runner.rb +234 -232
  299. data/vendor/unity/auto/parse_output.rb +220 -0
  300. data/vendor/unity/auto/stylize_as_junit.rb +108 -120
  301. data/vendor/unity/auto/test_file_filter.rb +11 -9
  302. data/vendor/unity/auto/type_sanitizer.rb +1 -3
  303. data/vendor/unity/auto/unity_test_summary.py +6 -2
  304. data/vendor/unity/auto/unity_test_summary.rb +45 -57
  305. data/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +207 -0
  306. data/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
  307. data/vendor/unity/docs/UnityAssertionsReference.md +716 -0
  308. data/vendor/unity/docs/UnityConfigurationGuide.md +398 -0
  309. data/vendor/unity/docs/UnityGettingStartedGuide.md +191 -0
  310. data/vendor/unity/docs/UnityHelperScriptsGuide.md +242 -0
  311. data/vendor/unity/examples/example_1/makefile +22 -17
  312. data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +1 -1
  313. data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +1 -1
  314. data/vendor/unity/examples/example_2/makefile +16 -17
  315. data/vendor/unity/examples/example_3/rakefile.rb +15 -15
  316. data/vendor/unity/examples/example_3/rakefile_helper.rb +93 -100
  317. data/vendor/unity/examples/example_3/readme.txt +4 -10
  318. data/vendor/unity/examples/unity_config.h +14 -26
  319. data/vendor/unity/extras/fixture/rakefile.rb +12 -12
  320. data/vendor/unity/extras/fixture/rakefile_helper.rb +87 -88
  321. data/vendor/unity/extras/fixture/src/unity_fixture.c +15 -8
  322. data/vendor/unity/extras/fixture/src/unity_fixture.h +6 -1
  323. data/vendor/unity/extras/fixture/src/unity_fixture_internals.h +3 -0
  324. data/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +1 -0
  325. data/vendor/unity/extras/fixture/test/unity_fixture_Test.c +1 -1
  326. data/vendor/unity/release/version.info +1 -1
  327. data/vendor/unity/src/unity.c +396 -330
  328. data/vendor/unity/src/unity.h +50 -4
  329. data/vendor/unity/src/unity_internals.h +119 -84
  330. data/vendor/unity/test/Makefile +17 -17
  331. data/vendor/unity/test/rakefile +63 -3
  332. data/vendor/unity/test/rakefile_helper.rb +108 -105
  333. data/vendor/unity/test/spec/generate_module_existing_file_spec.rb +158 -0
  334. data/vendor/unity/test/targets/clang_file.yml +0 -6
  335. data/vendor/unity/test/targets/clang_strict.yml +1 -9
  336. data/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +2 -0
  337. data/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +2 -2
  338. data/vendor/unity/test/tests/test_generate_test_runner.rb +5 -5
  339. data/vendor/unity/test/tests/testunity.c +1338 -151
  340. metadata +102 -157
  341. data/test_graveyard/integration/paths.yml +0 -17
  342. data/test_graveyard/integration/paths_test.rb +0 -80
  343. data/test_graveyard/integration/rake_rules_aux_dependencies_test.rb +0 -75
  344. data/test_graveyard/integration/rake_rules_cmock_test.rb +0 -74
  345. data/test_graveyard/integration/rake_rules_preprocess_test.rb +0 -178
  346. data/test_graveyard/integration/rake_rules_test.rb +0 -268
  347. data/test_graveyard/integration/rake_tasks_test.rb +0 -103
  348. data/test_graveyard/integration_test_helper.rb +0 -34
  349. data/test_graveyard/rakefile_rules.rb +0 -10
  350. data/test_graveyard/rakefile_rules_aux_dependencies.rb +0 -10
  351. data/test_graveyard/rakefile_rules_cmock.rb +0 -10
  352. data/test_graveyard/rakefile_rules_preprocess.rb +0 -10
  353. data/test_graveyard/rakefile_tasks.rb +0 -10
  354. data/test_graveyard/system/file_system_dependencies.yml +0 -20
  355. data/test_graveyard/system/file_system_kitchen_sink.yml +0 -20
  356. data/test_graveyard/system/file_system_mocks.yml +0 -20
  357. data/test_graveyard/system/file_system_preprocess.yml +0 -20
  358. data/test_graveyard/system/file_system_simple.yml +0 -20
  359. data/test_graveyard/system/file_system_test.rb +0 -78
  360. data/test_graveyard/system/mocks/include/a_file.h +0 -2
  361. data/test_graveyard/system/mocks/include/other_stuff.h +0 -2
  362. data/test_graveyard/system/mocks/include/stuff.h +0 -3
  363. data/test_graveyard/system/mocks/source/a_file.c +0 -9
  364. data/test_graveyard/system/mocks/test/test_a_file.c +0 -41
  365. data/test_graveyard/system/mocks/test/test_no_file.c +0 -14
  366. data/test_graveyard/system/project_mocks.yml +0 -43
  367. data/test_graveyard/system/project_mocks_test.rb +0 -38
  368. data/test_graveyard/system/project_simple.yml +0 -36
  369. data/test_graveyard/system/project_simple_test.rb +0 -39
  370. data/test_graveyard/system/rule_mocks_test.rb +0 -44
  371. data/test_graveyard/system/rule_runners_test.rb +0 -44
  372. data/test_graveyard/system/simple/include/other_stuff.h +0 -2
  373. data/test_graveyard/system/simple/include/stuff.h +0 -3
  374. data/test_graveyard/system/simple/source/other_stuff.c +0 -6
  375. data/test_graveyard/system/simple/source/stuff.c +0 -7
  376. data/test_graveyard/system/simple/test/test_other_stuff.c +0 -30
  377. data/test_graveyard/system/simple/test/test_stuff.c +0 -51
  378. data/test_graveyard/system_test_helper.rb +0 -73
  379. data/test_graveyard/test_helper.rb +0 -93
  380. data/test_graveyard/unit/busted/configurator_builder_test.rb +0 -569
  381. data/test_graveyard/unit/busted/configurator_helper_test.rb +0 -234
  382. data/test_graveyard/unit/busted/configurator_test.rb +0 -232
  383. data/test_graveyard/unit/busted/configurator_validator_test.rb +0 -169
  384. data/test_graveyard/unit/busted/deep_merge_fix_test.rb +0 -55
  385. data/test_graveyard/unit/busted/dependinator_test.rb +0 -129
  386. data/test_graveyard/unit/busted/file_finder_helper_test.rb +0 -45
  387. data/test_graveyard/unit/busted/file_finder_test.rb +0 -114
  388. data/test_graveyard/unit/busted/file_path_utils_test.rb +0 -97
  389. data/test_graveyard/unit/busted/file_system_utils_test.rb +0 -21
  390. data/test_graveyard/unit/busted/generator_test.rb +0 -187
  391. data/test_graveyard/unit/busted/generator_test_results_test.rb +0 -129
  392. data/test_graveyard/unit/busted/generator_test_runner_test.rb +0 -475
  393. data/test_graveyard/unit/busted/preprocessinator_file_handler_test.rb +0 -39
  394. data/test_graveyard/unit/busted/preprocessinator_helper_test.rb +0 -156
  395. data/test_graveyard/unit/busted/preprocessinator_includes_handler_test.rb +0 -93
  396. data/test_graveyard/unit/busted/preprocessinator_test.rb +0 -57
  397. data/test_graveyard/unit/busted/project_file_loader_test.rb +0 -142
  398. data/test_graveyard/unit/busted/setupinator_test.rb +0 -45
  399. data/test_graveyard/unit/busted/streaminator_test.rb +0 -49
  400. data/test_graveyard/unit/busted/task_invoker_test.rb +0 -69
  401. data/test_graveyard/unit/busted/test_includes_extractor_test.rb +0 -111
  402. data/test_graveyard/unit/busted/test_invoker_helper_test.rb +0 -62
  403. data/test_graveyard/unit/busted/test_invoker_test.rb +0 -47
  404. data/test_graveyard/unit/busted/tool_executor_helper_test.rb +0 -100
  405. data/test_graveyard/unit/busted/tool_executor_test.rb +0 -351
  406. data/test_graveyard/unit/busted/verbosinator_test.rb +0 -65
  407. data/test_graveyard/unit/preprocessinator_extractor_test.rb +0 -731
  408. data/test_graveyard/unit_test_helper.rb +0 -16
  409. data/vendor/c_exception/docs/CExceptionSummary.odt +0 -0
  410. data/vendor/c_exception/docs/CExceptionSummary.pdf +0 -0
  411. data/vendor/c_exception/vendor/unity/auto/parseOutput.rb +0 -191
  412. data/vendor/c_exception/vendor/unity/docs/UnityAssertionsReference.pdf +0 -0
  413. data/vendor/c_exception/vendor/unity/docs/UnityConfigurationGuide.pdf +0 -0
  414. data/vendor/c_exception/vendor/unity/docs/UnityGettingStartedGuide.pdf +0 -0
  415. data/vendor/c_exception/vendor/unity/docs/UnityHelperScriptsGuide.pdf +0 -0
  416. data/vendor/cmock/docs/CMock Summary.odt +0 -0
  417. data/vendor/cmock/docs/CMock Summary.pdf +0 -0
  418. data/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.odt +0 -0
  419. data/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.pdf +0 -0
  420. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/parseOutput.rb +0 -191
  421. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityAssertionsReference.pdf +0 -0
  422. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityConfigurationGuide.pdf +0 -0
  423. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityGettingStartedGuide.pdf +0 -0
  424. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityHelperScriptsGuide.pdf +0 -0
  425. data/vendor/cmock/vendor/unity/auto/parseOutput.rb +0 -191
  426. data/vendor/cmock/vendor/unity/docs/UnityAssertionsReference.pdf +0 -0
  427. data/vendor/cmock/vendor/unity/docs/UnityConfigurationGuide.pdf +0 -0
  428. data/vendor/cmock/vendor/unity/docs/UnityGettingStartedGuide.pdf +0 -0
  429. data/vendor/cmock/vendor/unity/docs/UnityHelperScriptsGuide.pdf +0 -0
  430. data/vendor/unity/auto/parseOutput.rb +0 -191
  431. data/vendor/unity/docs/UnityAssertionsReference.pdf +0 -0
  432. data/vendor/unity/docs/UnityConfigurationGuide.pdf +0 -0
  433. data/vendor/unity/docs/UnityGettingStartedGuide.pdf +0 -0
  434. data/vendor/unity/docs/UnityHelperScriptsGuide.pdf +0 -0
@@ -6,28 +6,27 @@
6
6
 
7
7
  require 'yaml'
8
8
  require 'fileutils'
9
- require HERE+'../../auto/unity_test_summary'
10
- require HERE+'../../auto/generate_test_runner'
11
- require HERE+'../../auto/colour_reporter'
9
+ require HERE + '../../auto/unity_test_summary'
10
+ require HERE + '../../auto/generate_test_runner'
11
+ require HERE + '../../auto/colour_reporter'
12
12
 
13
13
  module RakefileHelpers
14
-
15
- C_EXTENSION = '.c'
14
+ C_EXTENSION = '.c'.freeze
16
15
 
17
16
  def load_configuration(config_file)
18
- unless ($configured)
19
- $cfg_file = HERE+"../../test/targets/#{config_file}" unless (config_file =~ /[\\|\/]/)
20
- $cfg = YAML.load(File.read($cfg_file))
21
- $colour_output = false unless $cfg['colour']
22
- $configured = true if (config_file != DEFAULT_CONFIG_FILE)
23
- end
17
+ return if $configured
18
+
19
+ $cfg_file = HERE + "../../test/targets/#{config_file}" unless config_file =~ /[\\|\/]/
20
+ $cfg = YAML.load(File.read($cfg_file))
21
+ $colour_output = false unless $cfg['colour']
22
+ $configured = true if config_file != DEFAULT_CONFIG_FILE
24
23
  end
25
24
 
26
25
  def configure_clean
27
26
  CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil?
28
27
  end
29
28
 
30
- def configure_toolchain(config_file=DEFAULT_CONFIG_FILE)
29
+ def configure_toolchain(config_file = DEFAULT_CONFIG_FILE)
31
30
  config_file += '.yml' unless config_file =~ /\.yml$/
32
31
  config_file = config_file unless config_file =~ /[\\|\/]/
33
32
  load_configuration(config_file)
@@ -35,105 +34,105 @@ module RakefileHelpers
35
34
  end
36
35
 
37
36
  def tackit(strings)
38
- if strings.is_a?(Array)
39
- result = "\"#{strings.join}\""
40
- else
41
- result = strings
42
- end
43
- return result
37
+ result = if strings.is_a?(Array)
38
+ "\"#{strings.join}\""
39
+ else
40
+ strings
41
+ end
42
+ result
44
43
  end
45
44
 
46
45
  def squash(prefix, items)
47
46
  result = ''
48
47
  items.each { |item| result += " #{prefix}#{tackit(item)}" }
49
- return result
48
+ result
50
49
  end
51
50
 
52
51
  def build_compiler_fields
53
- command = tackit($cfg['compiler']['path'])
54
- if $cfg['compiler']['defines']['items'].nil?
55
- defines = ''
56
- else
57
- defines = squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items'] + ['UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar'])
58
- end
52
+ command = tackit($cfg['compiler']['path'])
53
+ defines = if $cfg['compiler']['defines']['items'].nil?
54
+ ''
55
+ else
56
+ squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items'] + ['UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar'])
57
+ end
59
58
  options = squash('', $cfg['compiler']['options'])
60
59
  includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items'])
61
60
  includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR)
62
- return {:command => command, :defines => defines, :options => options, :includes => includes}
61
+
62
+ { command: command, defines: defines, options: options, includes: includes }
63
63
  end
64
64
 
65
- def compile(file, defines=[])
65
+ def compile(file, _defines = [])
66
66
  compiler = build_compiler_fields
67
- unity_include = $cfg['compiler']['includes']['prefix']+'../../src'
68
- cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{unity_include} #{file} " +
69
- "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" +
70
- "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}"
67
+ unity_include = $cfg['compiler']['includes']['prefix'] + '../../src'
68
+ cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{unity_include} #{file} " \
69
+ "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" \
70
+ "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}"
71
+
71
72
  execute(cmd_str)
72
73
  end
73
74
 
74
75
  def build_linker_fields
75
- command = tackit($cfg['linker']['path'])
76
- if $cfg['linker']['options'].nil?
77
- options = ''
78
- else
79
- options = squash('', $cfg['linker']['options'])
80
- end
81
- if ($cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?)
82
- includes = ''
83
- else
84
- includes = squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items'])
85
- end
86
- includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR)
87
- return {:command => command, :options => options, :includes => includes}
76
+ command = tackit($cfg['linker']['path'])
77
+ options = if $cfg['linker']['options'].nil?
78
+ ''
79
+ else
80
+ squash('', $cfg['linker']['options'])
81
+ end
82
+ includes = if $cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?
83
+ ''
84
+ else
85
+ squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items'])
86
+ end.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR)
87
+
88
+ { command: command, options: options, includes: includes }
88
89
  end
89
90
 
90
91
  def link_it(exe_name, obj_list)
91
92
  linker = build_linker_fields
92
93
  cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " +
93
- (obj_list.map{|obj|"#{$cfg['linker']['object_files']['path']}#{obj} "}).join +
94
- $cfg['linker']['bin_files']['prefix'] + ' ' +
95
- $cfg['linker']['bin_files']['destination'] +
96
- exe_name + $cfg['linker']['bin_files']['extension']
94
+ (obj_list.map { |obj| "#{$cfg['linker']['object_files']['path']}#{obj} " }).join +
95
+ $cfg['linker']['bin_files']['prefix'] + ' ' +
96
+ $cfg['linker']['bin_files']['destination'] +
97
+ exe_name + $cfg['linker']['bin_files']['extension']
97
98
  execute(cmd_str)
98
99
  end
99
100
 
100
101
  def build_simulator_fields
101
102
  return nil if $cfg['simulator'].nil?
102
- if $cfg['simulator']['path'].nil?
103
- command = ''
104
- else
105
- command = (tackit($cfg['simulator']['path']) + ' ')
106
- end
107
- if $cfg['simulator']['pre_support'].nil?
108
- pre_support = ''
109
- else
110
- pre_support = squash('', $cfg['simulator']['pre_support'])
111
- end
112
- if $cfg['simulator']['post_support'].nil?
113
- post_support = ''
114
- else
115
- post_support = squash('', $cfg['simulator']['post_support'])
116
- end
117
- return {:command => command, :pre_support => pre_support, :post_support => post_support}
103
+ command = if $cfg['simulator']['path'].nil?
104
+ ''
105
+ else
106
+ (tackit($cfg['simulator']['path']) + ' ')
107
+ end
108
+ pre_support = if $cfg['simulator']['pre_support'].nil?
109
+ ''
110
+ else
111
+ squash('', $cfg['simulator']['pre_support'])
112
+ end
113
+ post_support = if $cfg['simulator']['post_support'].nil?
114
+ ''
115
+ else
116
+ squash('', $cfg['simulator']['post_support'])
117
+ end
118
+ { command: command, pre_support: pre_support, post_support: post_support }
118
119
  end
119
120
 
120
- def execute(command_string, verbose=true)
121
+ def execute(command_string, verbose = true)
121
122
  report command_string
122
123
  output = `#{command_string}`.chomp
123
- report(output) if (verbose && !output.nil? && (output.length > 0))
124
- if ($?.exitstatus != 0)
125
- raise "Command failed. (Returned #{$?.exitstatus})"
126
- end
127
- return output
124
+ report(output) if verbose && !output.nil? && !output.empty?
125
+ raise "Command failed. (Returned #{$?.exitstatus})" if $?.exitstatus != 0
126
+ output
128
127
  end
129
128
 
130
129
  def report_summary
131
130
  summary = UnityTestSummary.new
132
- summary.set_root_path(HERE)
131
+ summary.root = HERE
133
132
  results_glob = "#{$cfg['compiler']['build_path']}*.test*"
134
- results_glob.gsub!(/\\/, '/')
133
+ results_glob.tr!('\\', '/')
135
134
  results = Dir[results_glob]
136
- summary.set_targets(results)
135
+ summary.targets = results
137
136
  summary.run
138
137
  end
139
138
 
@@ -146,34 +145,34 @@ module RakefileHelpers
146
145
  $cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil?
147
146
 
148
147
  # Get a list of all source files needed
149
- src_files = Dir[HERE+'src/*.c']
150
- src_files += Dir[HERE+'test/*.c']
151
- src_files += Dir[HERE+'test/main/*.c']
148
+ src_files = Dir[HERE + 'src/*.c']
149
+ src_files += Dir[HERE + 'test/*.c']
150
+ src_files += Dir[HERE + 'test/main/*.c']
152
151
  src_files << '../../src/unity.c'
153
152
 
154
153
  # Build object files
155
154
  src_files.each { |f| compile(f, test_defines) }
156
- obj_list = src_files.map {|f| File.basename(f.ext($cfg['compiler']['object_files']['extension'])) }
155
+ obj_list = src_files.map { |f| File.basename(f.ext($cfg['compiler']['object_files']['extension'])) }
157
156
 
158
157
  # Link the test executable
159
- test_base = "framework_test"
158
+ test_base = 'framework_test'
160
159
  link_it(test_base, obj_list)
161
160
 
162
161
  # Execute unit test and generate results file
163
162
  simulator = build_simulator_fields
164
163
  executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension']
165
- if simulator.nil?
166
- cmd_str = executable + " -v -r"
167
- else
168
- cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}"
169
- end
164
+ cmd_str = if simulator.nil?
165
+ executable + ' -v -r'
166
+ else
167
+ "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}"
168
+ end
170
169
  output = execute(cmd_str)
171
170
  test_results = $cfg['compiler']['build_path'] + test_base
172
- if output.match(/OK$/m).nil?
173
- test_results += '.testfail'
174
- else
175
- test_results += '.testpass'
176
- end
171
+ test_results += if output.match(/OK$/m).nil?
172
+ '.testfail'
173
+ else
174
+ '.testpass'
175
+ end
177
176
  File.open(test_results, 'w') { |f| f.print output }
178
177
  end
179
178
  end
@@ -5,9 +5,9 @@
5
5
  * [Released under MIT License. Please refer to license.txt for details]
6
6
  * ========================================== */
7
7
 
8
- #include <string.h>
9
8
  #include "unity_fixture.h"
10
9
  #include "unity_internals.h"
10
+ #include <string.h>
11
11
 
12
12
  struct UNITY_FIXTURE_T UnityFixture;
13
13
 
@@ -71,7 +71,8 @@ void UnityTestRunner(unityfunction* setup,
71
71
  const char* printableName,
72
72
  const char* group,
73
73
  const char* name,
74
- const char* file, unsigned int line)
74
+ const char* file,
75
+ unsigned int line)
75
76
  {
76
77
  if (testSelected(name) && groupSelected(group))
77
78
  {
@@ -81,7 +82,12 @@ void UnityTestRunner(unityfunction* setup,
81
82
  if (!UnityFixture.Verbose)
82
83
  UNITY_OUTPUT_CHAR('.');
83
84
  else
85
+ {
84
86
  UnityPrint(printableName);
87
+ #ifndef UNITY_REPEAT_TEST_NAME
88
+ Unity.CurrentTestName = NULL;
89
+ #endif
90
+ }
85
91
 
86
92
  Unity.NumberOfTests++;
87
93
  UnityMalloc_StartTest();
@@ -193,7 +199,7 @@ void* unity_malloc(size_t size)
193
199
  }
194
200
  else
195
201
  {
196
- guard = (Guard*) &unity_heap[heap_index];
202
+ guard = (Guard*)&unity_heap[heap_index];
197
203
  heap_index += total_size;
198
204
  }
199
205
  #else
@@ -285,7 +291,7 @@ void* unity_realloc(void* oldMem, size_t size)
285
291
  if (oldMem == unity_heap + heap_index - guard->size - sizeof(end) &&
286
292
  heap_index + size - guard->size <= UNITY_INTERNAL_HEAP_SIZE_BYTES)
287
293
  {
288
- release_memory(oldMem); /* Not thread-safe, like unity_heap generally */
294
+ release_memory(oldMem); /* Not thread-safe, like unity_heap generally */
289
295
  return unity_malloc(size); /* No memcpy since data is in place */
290
296
  }
291
297
  #endif
@@ -305,8 +311,7 @@ struct PointerPair
305
311
  void* old_value;
306
312
  };
307
313
 
308
- enum { MAX_POINTERS = 50 };
309
- static struct PointerPair pointer_store[MAX_POINTERS];
314
+ static struct PointerPair pointer_store[UNITY_MAX_POINTERS];
310
315
  static int pointer_index = 0;
311
316
 
312
317
  void UnityPointer_Init(void)
@@ -316,7 +321,7 @@ void UnityPointer_Init(void)
316
321
 
317
322
  void UnityPointer_Set(void** pointer, void* newValue, UNITY_LINE_TYPE line)
318
323
  {
319
- if (pointer_index >= MAX_POINTERS)
324
+ if (pointer_index >= UNITY_MAX_POINTERS)
320
325
  {
321
326
  UNITY_TEST_FAIL(line, "Too many pointers set");
322
327
  }
@@ -391,7 +396,9 @@ int UnityGetCommandLineOptions(int argc, const char* argv[])
391
396
  i++;
392
397
  }
393
398
  }
394
- } else {
399
+ }
400
+ else
401
+ {
395
402
  /* ignore unknown parameter */
396
403
  i++;
397
404
  }
@@ -49,6 +49,7 @@ int UnityMain(int argc, const char* argv[], void (*runAllTests)(void));
49
49
  }\
50
50
  void TEST_##group##_##name##_(void)
51
51
 
52
+ /* Call this for each test, insider the group runner */
52
53
  #define RUN_TEST_CASE(group, name) \
53
54
  { void TEST_##group##_##name##_run(void);\
54
55
  TEST_##group##_##name##_run(); }
@@ -64,6 +65,8 @@ int UnityMain(int argc, const char* argv[], void (*runAllTests)(void));
64
65
  TEST_##group##_GROUP_RUNNER(); }
65
66
 
66
67
  /* CppUTest Compatibility Macros */
68
+ #ifndef UNITY_EXCLUDE_CPPUTEST_ASSERTS
69
+ /* Sets a pointer and automatically restores it to its old value after teardown */
67
70
  #define UT_PTR_SET(ptr, newPointerValue) UnityPointer_Set((void**)&(ptr), (void*)(newPointerValue), __LINE__)
68
71
  #define TEST_ASSERT_POINTERS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_PTR((expected), (actual))
69
72
  #define TEST_ASSERT_BYTES_EQUAL(expected, actual) TEST_ASSERT_EQUAL_HEX8(0xff & (expected), 0xff & (actual))
@@ -71,8 +74,10 @@ int UnityMain(int argc, const char* argv[], void (*runAllTests)(void));
71
74
  #define CHECK(condition) TEST_ASSERT_TRUE((condition))
72
75
  #define LONGS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_INT((expected), (actual))
73
76
  #define STRCMP_EQUAL(expected, actual) TEST_ASSERT_EQUAL_STRING((expected), (actual))
74
- #define DOUBLES_EQUAL(expected, actual, delta) TEST_ASSERT_FLOAT_WITHIN(((expected), (actual), (delta))
77
+ #define DOUBLES_EQUAL(expected, actual, delta) TEST_ASSERT_DOUBLE_WITHIN((delta), (expected), (actual))
78
+ #endif
75
79
 
80
+ /* You must compile with malloc replacement, as defined in unity_fixture_malloc_overrides.h */
76
81
  void UnityMalloc_MakeMallocFailAfterCount(int count);
77
82
 
78
83
  #endif /* UNITY_FIXTURE_H_ */
@@ -40,6 +40,9 @@ void UnityConcludeFixtureTest(void);
40
40
  void UnityPointer_Set(void** ptr, void* newValue, UNITY_LINE_TYPE line);
41
41
  void UnityPointer_UndoAllSets(void);
42
42
  void UnityPointer_Init(void);
43
+ #ifndef UNITY_MAX_POINTERS
44
+ #define UNITY_MAX_POINTERS 5
45
+ #endif
43
46
 
44
47
  #ifdef __cplusplus
45
48
  }
@@ -26,6 +26,7 @@
26
26
  * For example, when using FreeRTOS UNITY_FIXTURE_MALLOC becomes pvPortMalloc()
27
27
  * and UNITY_FIXTURE_FREE becomes vPortFree(). */
28
28
  #if !defined(UNITY_FIXTURE_MALLOC) || !defined(UNITY_FIXTURE_FREE)
29
+ #include <stdlib.h>
29
30
  #define UNITY_FIXTURE_MALLOC(size) malloc(size)
30
31
  #define UNITY_FIXTURE_FREE(ptr) free(ptr)
31
32
  #else
@@ -465,7 +465,7 @@ TEST(LeakDetection, PointerSettingMax)
465
465
  TEST_IGNORE();
466
466
  #else
467
467
  int i;
468
- for (i = 0; i < 50; i++) UT_PTR_SET(pointer1, &int1);
468
+ for (i = 0; i < UNITY_MAX_POINTERS; i++) UT_PTR_SET(pointer1, &int1);
469
469
  UnityOutputCharSpy_Enable(1);
470
470
  EXPECT_ABORT_BEGIN
471
471
  UT_PTR_SET(pointer1, &int1);
@@ -12,12 +12,10 @@
12
12
  void UNITY_OUTPUT_CHAR(int);
13
13
  #endif
14
14
 
15
- /* Helpful macros for us to use here */
16
- #define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; longjmp(Unity.AbortFrame, 1); }
17
- #define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; longjmp(Unity.AbortFrame, 1); }
18
-
19
- /* return prematurely if we are already in failure or ignore state */
20
- #define UNITY_SKIP_EXECUTION { if ((Unity.CurrentTestFailed != 0) || (Unity.CurrentTestIgnored != 0)) {return;} }
15
+ /* Helpful macros for us to use here in Assert functions */
16
+ #define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; TEST_ABORT(); }
17
+ #define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; TEST_ABORT(); }
18
+ #define RETURN_IF_FAIL_OR_IGNORE if (Unity.CurrentTestFailed || Unity.CurrentTestIgnored) return
21
19
 
22
20
  struct UNITY_STORAGE_T Unity;
23
21
 
@@ -54,21 +52,6 @@ static const char UnityStrResultsIgnored[] = " Ignored ";
54
52
  static const char UnityStrDetail1Name[] = UNITY_DETAIL1_NAME " ";
55
53
  static const char UnityStrDetail2Name[] = " " UNITY_DETAIL2_NAME " ";
56
54
 
57
- /* compiler-generic print formatting masks */
58
- static const UNITY_UINT UnitySizeMask[] =
59
- {
60
- 255u, /* 0xFF */
61
- 65535u, /* 0xFFFF */
62
- 65535u,
63
- 4294967295u, /* 0xFFFFFFFF */
64
- 4294967295u,
65
- 4294967295u,
66
- 4294967295u
67
- #ifdef UNITY_SUPPORT_64
68
- ,0xFFFFFFFFFFFFFFFF
69
- #endif
70
- };
71
-
72
55
  /*-----------------------------------------------
73
56
  * Pretty Printers & Test Result Output Handlers
74
57
  *-----------------------------------------------*/
@@ -110,7 +93,6 @@ void UnityPrint(const char* string)
110
93
  }
111
94
  }
112
95
 
113
- void UnityPrintLen(const char* string, const UNITY_UINT32 length);
114
96
  void UnityPrintLen(const char* string, const UNITY_UINT32 length)
115
97
  {
116
98
  const char* pch = string;
@@ -157,13 +139,13 @@ void UnityPrintNumberByStyle(const UNITY_INT number, const UNITY_DISPLAY_STYLE_T
157
139
  }
158
140
  else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT)
159
141
  {
160
- UnityPrintNumberUnsigned( (UNITY_UINT)number & UnitySizeMask[((UNITY_UINT)style & (UNITY_UINT)0x0F) - 1] );
142
+ UnityPrintNumberUnsigned((UNITY_UINT)number);
161
143
  }
162
144
  else
163
145
  {
164
146
  UNITY_OUTPUT_CHAR('0');
165
147
  UNITY_OUTPUT_CHAR('x');
166
- UnityPrintNumberHex((UNITY_UINT)number, (char)((style & 0x000F) << 1));
148
+ UnityPrintNumberHex((UNITY_UINT)number, (char)((style & 0xF) * 2));
167
149
  }
168
150
  }
169
151
 
@@ -198,19 +180,21 @@ void UnityPrintNumberUnsigned(const UNITY_UINT number)
198
180
  {
199
181
  UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10)));
200
182
  divisor /= 10;
201
- }
202
- while (divisor > 0);
183
+ } while (divisor > 0);
203
184
  }
204
185
 
205
186
  /*-----------------------------------------------*/
206
187
  void UnityPrintNumberHex(const UNITY_UINT number, const char nibbles_to_print)
207
188
  {
208
- UNITY_UINT nibble;
189
+ int nibble;
209
190
  char nibbles = nibbles_to_print;
191
+ if ((unsigned)nibbles > (2 * sizeof(number)))
192
+ nibbles = 2 * sizeof(number);
210
193
 
211
194
  while (nibbles > 0)
212
195
  {
213
- nibble = (number >> (--nibbles << 2)) & 0x0000000F;
196
+ nibbles--;
197
+ nibble = (int)(number >> (nibbles * 4)) & 0x0F;
214
198
  if (nibble <= 9)
215
199
  {
216
200
  UNITY_OUTPUT_CHAR((char)('0' + nibble));
@@ -250,65 +234,115 @@ void UnityPrintMask(const UNITY_UINT mask, const UNITY_UINT number)
250
234
  }
251
235
 
252
236
  /*-----------------------------------------------*/
253
- #ifdef UNITY_FLOAT_VERBOSE
254
- #include <stdio.h>
255
-
256
- #ifndef UNITY_VERBOSE_NUMBER_MAX_LENGTH
257
- # ifdef UNITY_DOUBLE_VERBOSE
258
- # define UNITY_VERBOSE_NUMBER_MAX_LENGTH 317
259
- # else
260
- # define UNITY_VERBOSE_NUMBER_MAX_LENGTH 47
261
- # endif
262
- #endif
263
-
264
- void UnityPrintFloat(UNITY_DOUBLE number)
237
+ #ifndef UNITY_EXCLUDE_FLOAT_PRINT
238
+ static void UnityPrintDecimalAndNumberWithLeadingZeros(UNITY_INT32 fraction_part, UNITY_INT32 divisor)
265
239
  {
266
- char TempBuffer[UNITY_VERBOSE_NUMBER_MAX_LENGTH + 1];
267
- snprintf(TempBuffer, sizeof(TempBuffer), "%.6f", number);
268
- UnityPrint(TempBuffer);
240
+ UNITY_OUTPUT_CHAR('.');
241
+ while (divisor > 0)
242
+ {
243
+ UNITY_OUTPUT_CHAR('0' + fraction_part / divisor);
244
+ fraction_part %= divisor;
245
+ divisor /= 10;
246
+ if (fraction_part == 0) break; /* Truncate trailing 0's */
247
+ }
269
248
  }
249
+ #ifndef UNITY_ROUND_TIES_AWAY_FROM_ZERO
250
+ /* If rounds up && remainder 0.5 && result odd && below cutoff for double precision issues */
251
+ #define ROUND_TIES_TO_EVEN(orig, num_int, num) \
252
+ if (num_int > (num) && (num) - (num_int-1) <= 0.5 && (num_int & 1) == 1 && orig < 1e22) \
253
+ num_int -= 1 /* => a tie to round down to even */
254
+ #else
255
+ #define ROUND_TIES_TO_EVEN(orig, num_int, num) /* Remove macro */
270
256
  #endif
271
257
 
272
- /*-----------------------------------------------*/
273
-
274
- void UnityPrintFail(void);
275
- void UnityPrintFail(void)
258
+ /* Printing floating point numbers is hard. Some goals of this implementation: works for embedded
259
+ * systems, floats or doubles, and has a reasonable format. The key paper in this area,
260
+ * 'How to Print Floating-Point Numbers Accurately' by Steele & White, shows an approximation by
261
+ * scaling called Dragon 2. This code uses a similar idea. The other core algorithm uses casts and
262
+ * floating subtraction to give exact remainders after the decimal, to be scaled into an integer.
263
+ * Extra trailing 0's are excluded. The output defaults to rounding to nearest, ties to even. You
264
+ * can enable rounding ties away from zero. Note: UNITY_DOUBLE param can typedef to float or double
265
+
266
+ * The old version required compiling in snprintf. For reference, with a similar format as now:
267
+ * char buf[19];
268
+ * if (number > 4294967296.0 || -number > 4294967296.0) snprintf(buf, sizeof buf, "%.8e", number);
269
+ * else snprintf(buf, sizeof buf, "%.6f", number);
270
+ * UnityPrint(buf);
271
+ */
272
+ void UnityPrintFloat(const UNITY_DOUBLE input_number)
276
273
  {
277
- UnityPrint(UnityStrFail);
278
- }
274
+ UNITY_DOUBLE number;
279
275
 
280
- void UnityPrintOk(void);
281
- void UnityPrintOk(void)
282
- {
283
- UnityPrint(UnityStrOk);
276
+ if (input_number < 0)
277
+ {
278
+ UNITY_OUTPUT_CHAR('-');
279
+ number = -input_number;
280
+ } else
281
+ {
282
+ number = input_number;
283
+ }
284
+
285
+ if (isnan(number)) UnityPrint(UnityStrNaN);
286
+ else if (isinf(number)) UnityPrintLen(UnityStrInf, 3);
287
+ else if (number <= 0.0000005 && number > 0) UnityPrint("0.000000..."); /* Small number */
288
+ else if (number < 4294967295.9999995) /* Rounded result fits in 32 bits, "%.6f" format */
289
+ {
290
+ const UNITY_INT32 divisor = 1000000/10;
291
+ UNITY_UINT32 integer_part = (UNITY_UINT32)number;
292
+ UNITY_INT32 fraction_part = (UNITY_INT32)((number - (UNITY_DOUBLE)integer_part)*1000000.0 + 0.5);
293
+ /* Double precision calculation gives best performance for six rounded decimal places */
294
+ ROUND_TIES_TO_EVEN(number, fraction_part, (number - (UNITY_DOUBLE)integer_part)*1000000.0);
295
+
296
+ if (fraction_part == 1000000) /* Carry across the decimal point */
297
+ {
298
+ fraction_part = 0;
299
+ integer_part += 1;
300
+ }
301
+
302
+ UnityPrintNumberUnsigned(integer_part);
303
+ UnityPrintDecimalAndNumberWithLeadingZeros(fraction_part, divisor);
304
+ }
305
+ else /* Number is larger, use exponential format of 9 digits, "%.8e" */
306
+ {
307
+ const UNITY_INT32 divisor = 1000000000/10;
308
+ UNITY_INT32 integer_part;
309
+ UNITY_DOUBLE_TYPE divide = 10.0;
310
+ int exponent = 9;
311
+
312
+ while (number / divide >= 1000000000.0 - 0.5)
313
+ {
314
+ divide *= 10;
315
+ exponent++;
316
+ }
317
+ integer_part = (UNITY_INT32)(number / divide + 0.5);
318
+ /* Double precision calculation required for float, to produce 9 rounded digits */
319
+ ROUND_TIES_TO_EVEN(number, integer_part, number / divide);
320
+
321
+ UNITY_OUTPUT_CHAR('0' + integer_part / divisor);
322
+ UnityPrintDecimalAndNumberWithLeadingZeros(integer_part % divisor, divisor / 10);
323
+ UNITY_OUTPUT_CHAR('e');
324
+ UNITY_OUTPUT_CHAR('+');
325
+ if (exponent < 10) UNITY_OUTPUT_CHAR('0');
326
+ UnityPrintNumber(exponent);
327
+ }
284
328
  }
329
+ #endif /* ! UNITY_EXCLUDE_FLOAT_PRINT */
285
330
 
286
331
  /*-----------------------------------------------*/
287
- static void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line);
288
332
  static void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line)
289
333
  {
290
- #ifndef UNITY_FIXTURES
291
334
  UnityPrint(file);
292
335
  UNITY_OUTPUT_CHAR(':');
293
336
  UnityPrintNumber((UNITY_INT)line);
294
337
  UNITY_OUTPUT_CHAR(':');
295
338
  UnityPrint(Unity.CurrentTestName);
296
339
  UNITY_OUTPUT_CHAR(':');
297
- #else
298
- UNITY_UNUSED(file);
299
- UNITY_UNUSED(line);
300
- #endif
301
340
  }
302
341
 
303
342
  /*-----------------------------------------------*/
304
- static void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line);
305
343
  static void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line)
306
344
  {
307
- #ifndef UNITY_FIXTURES
308
345
  UnityTestResultsBegin(Unity.TestFile, line);
309
- #else
310
- UNITY_UNUSED(line);
311
- #endif
312
346
  UnityPrint(UnityStrFail);
313
347
  UNITY_OUTPUT_CHAR(':');
314
348
  }
@@ -337,7 +371,6 @@ void UnityConcludeTest(void)
337
371
  }
338
372
 
339
373
  /*-----------------------------------------------*/
340
- static void UnityAddMsgIfSpecified(const char* msg);
341
374
  static void UnityAddMsgIfSpecified(const char* msg)
342
375
  {
343
376
  if (msg)
@@ -361,7 +394,6 @@ static void UnityAddMsgIfSpecified(const char* msg)
361
394
  }
362
395
 
363
396
  /*-----------------------------------------------*/
364
- static void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual);
365
397
  static void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual)
366
398
  {
367
399
  UnityPrint(UnityStrExpected);
@@ -373,7 +405,7 @@ static void UnityPrintExpectedAndActualStrings(const char* expected, const char*
373
405
  }
374
406
  else
375
407
  {
376
- UnityPrint(UnityStrNull);
408
+ UnityPrint(UnityStrNull);
377
409
  }
378
410
  UnityPrint(UnityStrWas);
379
411
  if (actual != NULL)
@@ -384,12 +416,14 @@ static void UnityPrintExpectedAndActualStrings(const char* expected, const char*
384
416
  }
385
417
  else
386
418
  {
387
- UnityPrint(UnityStrNull);
419
+ UnityPrint(UnityStrNull);
388
420
  }
389
421
  }
390
422
 
391
423
  /*-----------------------------------------------*/
392
- static void UnityPrintExpectedAndActualStringsLen(const char* expected, const char* actual, const UNITY_UINT32 length)
424
+ static void UnityPrintExpectedAndActualStringsLen(const char* expected,
425
+ const char* actual,
426
+ const UNITY_UINT32 length)
393
427
  {
394
428
  UnityPrint(UnityStrExpected);
395
429
  if (expected != NULL)
@@ -400,7 +434,7 @@ static void UnityPrintExpectedAndActualStringsLen(const char* expected, const ch
400
434
  }
401
435
  else
402
436
  {
403
- UnityPrint(UnityStrNull);
437
+ UnityPrint(UnityStrNull);
404
438
  }
405
439
  UnityPrint(UnityStrWas);
406
440
  if (actual != NULL)
@@ -411,42 +445,40 @@ static void UnityPrintExpectedAndActualStringsLen(const char* expected, const ch
411
445
  }
412
446
  else
413
447
  {
414
- UnityPrint(UnityStrNull);
448
+ UnityPrint(UnityStrNull);
415
449
  }
416
450
  }
417
451
 
418
-
419
-
420
452
  /*-----------------------------------------------
421
453
  * Assertion & Control Helpers
422
454
  *-----------------------------------------------*/
423
455
 
424
- static int UnityCheckArraysForNull(UNITY_INTERNAL_PTR expected, UNITY_INTERNAL_PTR actual, const UNITY_LINE_TYPE lineNumber, const char* msg)
456
+ static int UnityIsOneArrayNull(UNITY_INTERNAL_PTR expected,
457
+ UNITY_INTERNAL_PTR actual,
458
+ const UNITY_LINE_TYPE lineNumber,
459
+ const char* msg)
425
460
  {
426
- /* return true if they are both NULL */
427
- if ((expected == NULL) && (actual == NULL))
428
- return 1;
461
+ if (expected == actual) return 0; /* Both are NULL or same pointer */
429
462
 
430
- /* throw error if just expected is NULL */
463
+ /* print and return true if just expected is NULL */
431
464
  if (expected == NULL)
432
465
  {
433
466
  UnityTestResultsFailBegin(lineNumber);
434
467
  UnityPrint(UnityStrNullPointerForExpected);
435
468
  UnityAddMsgIfSpecified(msg);
436
- UNITY_FAIL_AND_BAIL;
469
+ return 1;
437
470
  }
438
471
 
439
- /* throw error if just actual is NULL */
472
+ /* print and return true if just actual is NULL */
440
473
  if (actual == NULL)
441
474
  {
442
475
  UnityTestResultsFailBegin(lineNumber);
443
476
  UnityPrint(UnityStrNullPointerForActual);
444
477
  UnityAddMsgIfSpecified(msg);
445
- UNITY_FAIL_AND_BAIL;
478
+ return 1;
446
479
  }
447
480
 
448
- /* return false if neither is NULL */
449
- return 0;
481
+ return 0; /* return false if neither is NULL */
450
482
  }
451
483
 
452
484
  /*-----------------------------------------------
@@ -459,7 +491,7 @@ void UnityAssertBits(const UNITY_INT mask,
459
491
  const char* msg,
460
492
  const UNITY_LINE_TYPE lineNumber)
461
493
  {
462
- UNITY_SKIP_EXECUTION;
494
+ RETURN_IF_FAIL_OR_IGNORE;
463
495
 
464
496
  if ((mask & expected) != (mask & actual))
465
497
  {
@@ -480,7 +512,7 @@ void UnityAssertEqualNumber(const UNITY_INT expected,
480
512
  const UNITY_LINE_TYPE lineNumber,
481
513
  const UNITY_DISPLAY_STYLE_T style)
482
514
  {
483
- UNITY_SKIP_EXECUTION;
515
+ RETURN_IF_FAIL_OR_IGNORE;
484
516
 
485
517
  if (expected != actual)
486
518
  {
@@ -507,122 +539,86 @@ void UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,
507
539
  const UNITY_UINT32 num_elements,
508
540
  const char* msg,
509
541
  const UNITY_LINE_TYPE lineNumber,
510
- const UNITY_DISPLAY_STYLE_T style)
542
+ const UNITY_DISPLAY_STYLE_T style,
543
+ const UNITY_FLAGS_T flags)
511
544
  {
512
545
  UNITY_UINT32 elements = num_elements;
513
- UNITY_INTERNAL_PTR ptr_exp = (UNITY_INTERNAL_PTR)expected;
514
- UNITY_INTERNAL_PTR ptr_act = (UNITY_INTERNAL_PTR)actual;
546
+ unsigned int length = style & 0xF;
515
547
 
516
- UNITY_SKIP_EXECUTION;
548
+ RETURN_IF_FAIL_OR_IGNORE;
517
549
 
518
- if (elements == 0)
550
+ if (num_elements == 0)
519
551
  {
520
552
  UnityPrintPointlessAndBail();
521
553
  }
522
554
 
523
- if (UnityCheckArraysForNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg) == 1)
524
- return;
555
+ if (expected == actual) return; /* Both are NULL or same pointer */
556
+ if (UnityIsOneArrayNull(expected, actual, lineNumber, msg))
557
+ UNITY_FAIL_AND_BAIL;
525
558
 
526
- /* If style is UNITY_DISPLAY_STYLE_INT, we'll fall into the default case rather than the INT16 or INT32 (etc) case
527
- * as UNITY_DISPLAY_STYLE_INT includes a flag for UNITY_DISPLAY_RANGE_AUTO, which the width-specific
528
- * variants do not. Therefore remove this flag. */
529
- switch(style & (UNITY_DISPLAY_STYLE_T)(~UNITY_DISPLAY_RANGE_AUTO))
559
+ while (elements--)
530
560
  {
531
- case UNITY_DISPLAY_STYLE_HEX8:
532
- case UNITY_DISPLAY_STYLE_INT8:
533
- case UNITY_DISPLAY_STYLE_UINT8:
534
- while (elements--)
535
- {
536
- if (*(UNITY_PTR_ATTRIBUTE const UNITY_INT8*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const UNITY_INT8*)ptr_act)
537
- {
538
- UnityTestResultsFailBegin(lineNumber);
539
- UnityPrint(UnityStrElement);
540
- UnityPrintNumberUnsigned(num_elements - elements - 1);
541
- UnityPrint(UnityStrExpected);
542
- UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const UNITY_INT8*)ptr_exp, style);
543
- UnityPrint(UnityStrWas);
544
- UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const UNITY_INT8*)ptr_act, style);
545
- UnityAddMsgIfSpecified(msg);
546
- UNITY_FAIL_AND_BAIL;
547
- }
548
- ptr_exp = (UNITY_INTERNAL_PTR)((UNITY_PTR)ptr_exp + 1);
549
- ptr_act = (UNITY_INTERNAL_PTR)((UNITY_PTR)ptr_act + 1);
550
- }
551
- break;
552
- case UNITY_DISPLAY_STYLE_HEX16:
553
- case UNITY_DISPLAY_STYLE_INT16:
554
- case UNITY_DISPLAY_STYLE_UINT16:
555
- while (elements--)
556
- {
557
- if (*(UNITY_PTR_ATTRIBUTE const UNITY_INT16*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const UNITY_INT16*)ptr_act)
558
- {
559
- UnityTestResultsFailBegin(lineNumber);
560
- UnityPrint(UnityStrElement);
561
- UnityPrintNumberUnsigned(num_elements - elements - 1);
562
- UnityPrint(UnityStrExpected);
563
- UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const UNITY_INT16*)ptr_exp, style);
564
- UnityPrint(UnityStrWas);
565
- UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const UNITY_INT16*)ptr_act, style);
566
- UnityAddMsgIfSpecified(msg);
567
- UNITY_FAIL_AND_BAIL;
568
- }
569
- ptr_exp = (UNITY_INTERNAL_PTR)((UNITY_PTR)ptr_exp + 2);
570
- ptr_act = (UNITY_INTERNAL_PTR)((UNITY_PTR)ptr_act + 2);
571
- }
572
- break;
561
+ UNITY_INT expect_val;
562
+ UNITY_INT actual_val;
563
+ switch (length)
564
+ {
565
+ case 1:
566
+ expect_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT8*)expected;
567
+ actual_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT8*)actual;
568
+ break;
569
+ case 2:
570
+ expect_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT16*)expected;
571
+ actual_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT16*)actual;
572
+ break;
573
573
  #ifdef UNITY_SUPPORT_64
574
- case UNITY_DISPLAY_STYLE_HEX64:
575
- case UNITY_DISPLAY_STYLE_INT64:
576
- case UNITY_DISPLAY_STYLE_UINT64:
577
- while (elements--)
578
- {
579
- if (*(UNITY_PTR_ATTRIBUTE const UNITY_INT64*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const UNITY_INT64*)ptr_act)
580
- {
581
- UnityTestResultsFailBegin(lineNumber);
582
- UnityPrint(UnityStrElement);
583
- UnityPrintNumberUnsigned(num_elements - elements - 1);
584
- UnityPrint(UnityStrExpected);
585
- UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const UNITY_INT64*)ptr_exp, style);
586
- UnityPrint(UnityStrWas);
587
- UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const UNITY_INT64*)ptr_act, style);
588
- UnityAddMsgIfSpecified(msg);
589
- UNITY_FAIL_AND_BAIL;
590
- }
591
- ptr_exp = (UNITY_INTERNAL_PTR)((UNITY_PTR)ptr_exp + 8);
592
- ptr_act = (UNITY_INTERNAL_PTR)((UNITY_PTR)ptr_act + 8);
593
- }
594
- break;
574
+ case 8:
575
+ expect_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT64*)expected;
576
+ actual_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT64*)actual;
577
+ break;
595
578
  #endif
596
- default:
597
- while (elements--)
598
- {
599
- if (*(UNITY_PTR_ATTRIBUTE const UNITY_INT32*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const UNITY_INT32*)ptr_act)
600
- {
601
- UnityTestResultsFailBegin(lineNumber);
602
- UnityPrint(UnityStrElement);
603
- UnityPrintNumberUnsigned(num_elements - elements - 1);
604
- UnityPrint(UnityStrExpected);
605
- UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const UNITY_INT32*)ptr_exp, style);
606
- UnityPrint(UnityStrWas);
607
- UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const UNITY_INT32*)ptr_act, style);
608
- UnityAddMsgIfSpecified(msg);
609
- UNITY_FAIL_AND_BAIL;
610
- }
611
- ptr_exp = (UNITY_INTERNAL_PTR)((UNITY_PTR)ptr_exp + 4);
612
- ptr_act = (UNITY_INTERNAL_PTR)((UNITY_PTR)ptr_act + 4);
579
+ default: /* length 4 bytes */
580
+ expect_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT32*)expected;
581
+ actual_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT32*)actual;
582
+ length = 4;
583
+ break;
584
+ }
585
+
586
+ if (expect_val != actual_val)
587
+ {
588
+ if (style & UNITY_DISPLAY_RANGE_UINT && length < sizeof(expect_val))
589
+ { /* For UINT, remove sign extension (padding 1's) from signed type casts above */
590
+ UNITY_INT mask = 1;
591
+ mask = (mask << 8 * length) - 1;
592
+ expect_val &= mask;
593
+ actual_val &= mask;
613
594
  }
614
- break;
595
+ UnityTestResultsFailBegin(lineNumber);
596
+ UnityPrint(UnityStrElement);
597
+ UnityPrintNumberUnsigned(num_elements - elements - 1);
598
+ UnityPrint(UnityStrExpected);
599
+ UnityPrintNumberByStyle(expect_val, style);
600
+ UnityPrint(UnityStrWas);
601
+ UnityPrintNumberByStyle(actual_val, style);
602
+ UnityAddMsgIfSpecified(msg);
603
+ UNITY_FAIL_AND_BAIL;
604
+ }
605
+ if (flags == UNITY_ARRAY_TO_ARRAY)
606
+ {
607
+ expected = (UNITY_INTERNAL_PTR)(length + (const char*)expected);
608
+ }
609
+ actual = (UNITY_INTERNAL_PTR)(length + (const char*)actual);
615
610
  }
616
611
  }
617
612
 
618
613
  /*-----------------------------------------------*/
614
+ #ifndef UNITY_EXCLUDE_FLOAT
619
615
  /* Wrap this define in a function with variable types as float or double */
620
616
  #define UNITY_FLOAT_OR_DOUBLE_WITHIN(delta, expected, actual, diff) \
621
- if (isinf(expected) && isinf(actual) && (isneg(expected) == isneg(actual))) return 1; \
617
+ if (isinf(expected) && isinf(actual) && ((expected < 0) == (actual < 0))) return 1; \
622
618
  if (UNITY_NAN_CHECK) return 1; \
623
619
  diff = actual - expected; \
624
- if (diff < 0.0f) diff = 0.0f - diff; \
625
- if (delta < 0.0f) delta = 0.0f - delta; \
620
+ if (diff < 0) diff = -diff; \
621
+ if (delta < 0) delta = -delta; \
626
622
  return !(isnan(diff) || isinf(diff) || (diff > delta))
627
623
  /* This first part of this condition will catch any NaN or Infinite values */
628
624
  #ifndef UNITY_NAN_NOT_EQUAL_NAN
@@ -631,7 +627,18 @@ void UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,
631
627
  #define UNITY_NAN_CHECK 0
632
628
  #endif
633
629
 
634
- #ifndef UNITY_EXCLUDE_FLOAT
630
+ #ifndef UNITY_EXCLUDE_FLOAT_PRINT
631
+ #define UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT(expected, actual) \
632
+ { \
633
+ UnityPrint(UnityStrExpected); \
634
+ UnityPrintFloat(expected); \
635
+ UnityPrint(UnityStrWas); \
636
+ UnityPrintFloat(actual); }
637
+ #else
638
+ #define UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT(expected, actual) \
639
+ UnityPrint(UnityStrDelta)
640
+ #endif /* UNITY_EXCLUDE_FLOAT_PRINT */
641
+
635
642
  static int UnityFloatsWithin(UNITY_FLOAT delta, UNITY_FLOAT expected, UNITY_FLOAT actual)
636
643
  {
637
644
  UNITY_FLOAT diff;
@@ -642,21 +649,23 @@ void UnityAssertEqualFloatArray(UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* expected,
642
649
  UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* actual,
643
650
  const UNITY_UINT32 num_elements,
644
651
  const char* msg,
645
- const UNITY_LINE_TYPE lineNumber)
652
+ const UNITY_LINE_TYPE lineNumber,
653
+ const UNITY_FLAGS_T flags)
646
654
  {
647
655
  UNITY_UINT32 elements = num_elements;
648
656
  UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* ptr_expected = expected;
649
657
  UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* ptr_actual = actual;
650
658
 
651
- UNITY_SKIP_EXECUTION;
659
+ RETURN_IF_FAIL_OR_IGNORE;
652
660
 
653
661
  if (elements == 0)
654
662
  {
655
663
  UnityPrintPointlessAndBail();
656
664
  }
657
665
 
658
- if (UnityCheckArraysForNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg) == 1)
659
- return;
666
+ if (expected == actual) return; /* Both are NULL or same pointer */
667
+ if (UnityIsOneArrayNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg))
668
+ UNITY_FAIL_AND_BAIL;
660
669
 
661
670
  while (elements--)
662
671
  {
@@ -665,18 +674,14 @@ void UnityAssertEqualFloatArray(UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* expected,
665
674
  UnityTestResultsFailBegin(lineNumber);
666
675
  UnityPrint(UnityStrElement);
667
676
  UnityPrintNumberUnsigned(num_elements - elements - 1);
668
- #ifdef UNITY_FLOAT_VERBOSE
669
- UnityPrint(UnityStrExpected);
670
- UnityPrintFloat(*ptr_expected);
671
- UnityPrint(UnityStrWas);
672
- UnityPrintFloat(*ptr_actual);
673
- #else
674
- UnityPrint(UnityStrDelta);
675
- #endif
677
+ UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT((UNITY_DOUBLE)*ptr_expected, (UNITY_DOUBLE)*ptr_actual);
676
678
  UnityAddMsgIfSpecified(msg);
677
679
  UNITY_FAIL_AND_BAIL;
678
680
  }
679
- ptr_expected++;
681
+ if (flags == UNITY_ARRAY_TO_ARRAY)
682
+ {
683
+ ptr_expected++;
684
+ }
680
685
  ptr_actual++;
681
686
  }
682
687
  }
@@ -688,20 +693,13 @@ void UnityAssertFloatsWithin(const UNITY_FLOAT delta,
688
693
  const char* msg,
689
694
  const UNITY_LINE_TYPE lineNumber)
690
695
  {
691
- UNITY_SKIP_EXECUTION;
696
+ RETURN_IF_FAIL_OR_IGNORE;
692
697
 
693
698
 
694
699
  if (!UnityFloatsWithin(delta, expected, actual))
695
700
  {
696
701
  UnityTestResultsFailBegin(lineNumber);
697
- #ifdef UNITY_FLOAT_VERBOSE
698
- UnityPrint(UnityStrExpected);
699
- UnityPrintFloat(expected);
700
- UnityPrint(UnityStrWas);
701
- UnityPrintFloat(actual);
702
- #else
703
- UnityPrint(UnityStrDelta);
704
- #endif
702
+ UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT((UNITY_DOUBLE)expected, (UNITY_DOUBLE)actual);
705
703
  UnityAddMsgIfSpecified(msg);
706
704
  UNITY_FAIL_AND_BAIL;
707
705
  }
@@ -713,22 +711,22 @@ void UnityAssertFloatSpecial(const UNITY_FLOAT actual,
713
711
  const UNITY_LINE_TYPE lineNumber,
714
712
  const UNITY_FLOAT_TRAIT_T style)
715
713
  {
716
- const char* trait_names[] = { UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet };
717
- UNITY_INT should_be_trait = ((UNITY_INT)style & 1);
718
- UNITY_INT is_trait = !should_be_trait;
719
- UNITY_INT trait_index = (UNITY_INT)(style >> 1);
714
+ const char* trait_names[] = {UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet};
715
+ UNITY_INT should_be_trait = ((UNITY_INT)style & 1);
716
+ UNITY_INT is_trait = !should_be_trait;
717
+ UNITY_INT trait_index = (UNITY_INT)(style >> 1);
720
718
 
721
- UNITY_SKIP_EXECUTION;
719
+ RETURN_IF_FAIL_OR_IGNORE;
722
720
 
723
- switch(style)
721
+ switch (style)
724
722
  {
725
723
  case UNITY_FLOAT_IS_INF:
726
724
  case UNITY_FLOAT_IS_NOT_INF:
727
- is_trait = isinf(actual) & ispos(actual);
725
+ is_trait = isinf(actual) && (actual > 0);
728
726
  break;
729
727
  case UNITY_FLOAT_IS_NEG_INF:
730
728
  case UNITY_FLOAT_IS_NOT_NEG_INF:
731
- is_trait = isinf(actual) & isneg(actual);
729
+ is_trait = isinf(actual) && (actual < 0);
732
730
  break;
733
731
 
734
732
  case UNITY_FLOAT_IS_NAN:
@@ -736,13 +734,9 @@ void UnityAssertFloatSpecial(const UNITY_FLOAT actual,
736
734
  is_trait = isnan(actual) ? 1 : 0;
737
735
  break;
738
736
 
739
- /* A determinate number is non infinite and not NaN. (therefore the opposite of the two above) */
740
- case UNITY_FLOAT_IS_DET:
737
+ case UNITY_FLOAT_IS_DET: /* A determinate number is non infinite and not NaN. */
741
738
  case UNITY_FLOAT_IS_NOT_DET:
742
- if (isinf(actual) || isnan(actual))
743
- is_trait = 0;
744
- else
745
- is_trait = 1;
739
+ is_trait = !isinf(actual) && !isnan(actual);
746
740
  break;
747
741
 
748
742
  default:
@@ -759,8 +753,8 @@ void UnityAssertFloatSpecial(const UNITY_FLOAT actual,
759
753
  UnityPrint(UnityStrNot);
760
754
  UnityPrint(trait_names[trait_index]);
761
755
  UnityPrint(UnityStrWas);
762
- #ifdef UNITY_FLOAT_VERBOSE
763
- UnityPrintFloat(actual);
756
+ #ifndef UNITY_EXCLUDE_FLOAT_PRINT
757
+ UnityPrintFloat((UNITY_DOUBLE)actual);
764
758
  #else
765
759
  if (should_be_trait)
766
760
  UnityPrint(UnityStrNot);
@@ -785,21 +779,23 @@ void UnityAssertEqualDoubleArray(UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* expecte
785
779
  UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* actual,
786
780
  const UNITY_UINT32 num_elements,
787
781
  const char* msg,
788
- const UNITY_LINE_TYPE lineNumber)
782
+ const UNITY_LINE_TYPE lineNumber,
783
+ const UNITY_FLAGS_T flags)
789
784
  {
790
785
  UNITY_UINT32 elements = num_elements;
791
786
  UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* ptr_expected = expected;
792
787
  UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* ptr_actual = actual;
793
788
 
794
- UNITY_SKIP_EXECUTION;
789
+ RETURN_IF_FAIL_OR_IGNORE;
795
790
 
796
791
  if (elements == 0)
797
792
  {
798
793
  UnityPrintPointlessAndBail();
799
794
  }
800
795
 
801
- if (UnityCheckArraysForNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg) == 1)
802
- return;
796
+ if (expected == actual) return; /* Both are NULL or same pointer */
797
+ if (UnityIsOneArrayNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg))
798
+ UNITY_FAIL_AND_BAIL;
803
799
 
804
800
  while (elements--)
805
801
  {
@@ -808,18 +804,14 @@ void UnityAssertEqualDoubleArray(UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* expecte
808
804
  UnityTestResultsFailBegin(lineNumber);
809
805
  UnityPrint(UnityStrElement);
810
806
  UnityPrintNumberUnsigned(num_elements - elements - 1);
811
- #ifdef UNITY_DOUBLE_VERBOSE
812
- UnityPrint(UnityStrExpected);
813
- UnityPrintFloat((float)(*ptr_expected));
814
- UnityPrint(UnityStrWas);
815
- UnityPrintFloat((float)(*ptr_actual));
816
- #else
817
- UnityPrint(UnityStrDelta);
818
- #endif
807
+ UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT(*ptr_expected, *ptr_actual);
819
808
  UnityAddMsgIfSpecified(msg);
820
809
  UNITY_FAIL_AND_BAIL;
821
810
  }
822
- ptr_expected++;
811
+ if (flags == UNITY_ARRAY_TO_ARRAY)
812
+ {
813
+ ptr_expected++;
814
+ }
823
815
  ptr_actual++;
824
816
  }
825
817
  }
@@ -831,19 +823,12 @@ void UnityAssertDoublesWithin(const UNITY_DOUBLE delta,
831
823
  const char* msg,
832
824
  const UNITY_LINE_TYPE lineNumber)
833
825
  {
834
- UNITY_SKIP_EXECUTION;
826
+ RETURN_IF_FAIL_OR_IGNORE;
835
827
 
836
828
  if (!UnityDoublesWithin(delta, expected, actual))
837
829
  {
838
830
  UnityTestResultsFailBegin(lineNumber);
839
- #ifdef UNITY_DOUBLE_VERBOSE
840
- UnityPrint(UnityStrExpected);
841
- UnityPrintFloat((float)expected);
842
- UnityPrint(UnityStrWas);
843
- UnityPrintFloat((float)actual);
844
- #else
845
- UnityPrint(UnityStrDelta);
846
- #endif
831
+ UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT(expected, actual);
847
832
  UnityAddMsgIfSpecified(msg);
848
833
  UNITY_FAIL_AND_BAIL;
849
834
  }
@@ -856,22 +841,22 @@ void UnityAssertDoubleSpecial(const UNITY_DOUBLE actual,
856
841
  const UNITY_LINE_TYPE lineNumber,
857
842
  const UNITY_FLOAT_TRAIT_T style)
858
843
  {
859
- const char* trait_names[] = { UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet };
860
- UNITY_INT should_be_trait = ((UNITY_INT)style & 1);
861
- UNITY_INT is_trait = !should_be_trait;
862
- UNITY_INT trait_index = (UNITY_INT)(style >> 1);
844
+ const char* trait_names[] = {UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet};
845
+ UNITY_INT should_be_trait = ((UNITY_INT)style & 1);
846
+ UNITY_INT is_trait = !should_be_trait;
847
+ UNITY_INT trait_index = (UNITY_INT)(style >> 1);
863
848
 
864
- UNITY_SKIP_EXECUTION;
849
+ RETURN_IF_FAIL_OR_IGNORE;
865
850
 
866
- switch(style)
851
+ switch (style)
867
852
  {
868
853
  case UNITY_FLOAT_IS_INF:
869
854
  case UNITY_FLOAT_IS_NOT_INF:
870
- is_trait = isinf(actual) & ispos(actual);
855
+ is_trait = isinf(actual) && (actual > 0);
871
856
  break;
872
857
  case UNITY_FLOAT_IS_NEG_INF:
873
858
  case UNITY_FLOAT_IS_NOT_NEG_INF:
874
- is_trait = isinf(actual) & isneg(actual);
859
+ is_trait = isinf(actual) && (actual < 0);
875
860
  break;
876
861
 
877
862
  case UNITY_FLOAT_IS_NAN:
@@ -879,13 +864,9 @@ void UnityAssertDoubleSpecial(const UNITY_DOUBLE actual,
879
864
  is_trait = isnan(actual) ? 1 : 0;
880
865
  break;
881
866
 
882
- /* A determinate number is non infinite and not NaN. (therefore the opposite of the two above) */
883
- case UNITY_FLOAT_IS_DET:
867
+ case UNITY_FLOAT_IS_DET: /* A determinate number is non infinite and not NaN. */
884
868
  case UNITY_FLOAT_IS_NOT_DET:
885
- if (isinf(actual) || isnan(actual))
886
- is_trait = 0;
887
- else
888
- is_trait = 1;
869
+ is_trait = !isinf(actual) && !isnan(actual);
889
870
  break;
890
871
 
891
872
  default:
@@ -902,7 +883,7 @@ void UnityAssertDoubleSpecial(const UNITY_DOUBLE actual,
902
883
  UnityPrint(UnityStrNot);
903
884
  UnityPrint(trait_names[trait_index]);
904
885
  UnityPrint(UnityStrWas);
905
- #ifdef UNITY_DOUBLE_VERBOSE
886
+ #ifndef UNITY_EXCLUDE_FLOAT_PRINT
906
887
  UnityPrintFloat(actual);
907
888
  #else
908
889
  if (should_be_trait)
@@ -914,32 +895,31 @@ void UnityAssertDoubleSpecial(const UNITY_DOUBLE actual,
914
895
  }
915
896
  }
916
897
 
917
-
918
898
  #endif /* not UNITY_EXCLUDE_DOUBLE */
919
899
 
920
900
  /*-----------------------------------------------*/
921
- void UnityAssertNumbersWithin( const UNITY_UINT delta,
922
- const UNITY_INT expected,
923
- const UNITY_INT actual,
924
- const char* msg,
925
- const UNITY_LINE_TYPE lineNumber,
926
- const UNITY_DISPLAY_STYLE_T style)
901
+ void UnityAssertNumbersWithin(const UNITY_UINT delta,
902
+ const UNITY_INT expected,
903
+ const UNITY_INT actual,
904
+ const char* msg,
905
+ const UNITY_LINE_TYPE lineNumber,
906
+ const UNITY_DISPLAY_STYLE_T style)
927
907
  {
928
- UNITY_SKIP_EXECUTION;
908
+ RETURN_IF_FAIL_OR_IGNORE;
929
909
 
930
910
  if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
931
911
  {
932
912
  if (actual > expected)
933
- Unity.CurrentTestFailed = ((UNITY_UINT)(actual - expected) > delta);
913
+ Unity.CurrentTestFailed = (UNITY_UINT)((UNITY_UINT)(actual - expected) > delta);
934
914
  else
935
- Unity.CurrentTestFailed = ((UNITY_UINT)(expected - actual) > delta);
915
+ Unity.CurrentTestFailed = (UNITY_UINT)((UNITY_UINT)(expected - actual) > delta);
936
916
  }
937
917
  else
938
918
  {
939
919
  if ((UNITY_UINT)actual > (UNITY_UINT)expected)
940
- Unity.CurrentTestFailed = ((UNITY_UINT)(actual - expected) > delta);
920
+ Unity.CurrentTestFailed = (UNITY_UINT)((UNITY_UINT)(actual - expected) > delta);
941
921
  else
942
- Unity.CurrentTestFailed = ((UNITY_UINT)(expected - actual) > delta);
922
+ Unity.CurrentTestFailed = (UNITY_UINT)((UNITY_UINT)(expected - actual) > delta);
943
923
  }
944
924
 
945
925
  if (Unity.CurrentTestFailed)
@@ -964,7 +944,7 @@ void UnityAssertEqualString(const char* expected,
964
944
  {
965
945
  UNITY_UINT32 i;
966
946
 
967
- UNITY_SKIP_EXECUTION;
947
+ RETURN_IF_FAIL_OR_IGNORE;
968
948
 
969
949
  /* if both pointers not null compare the strings */
970
950
  if (expected && actual)
@@ -988,23 +968,23 @@ void UnityAssertEqualString(const char* expected,
988
968
 
989
969
  if (Unity.CurrentTestFailed)
990
970
  {
991
- UnityTestResultsFailBegin(lineNumber);
992
- UnityPrintExpectedAndActualStrings(expected, actual);
993
- UnityAddMsgIfSpecified(msg);
994
- UNITY_FAIL_AND_BAIL;
971
+ UnityTestResultsFailBegin(lineNumber);
972
+ UnityPrintExpectedAndActualStrings(expected, actual);
973
+ UnityAddMsgIfSpecified(msg);
974
+ UNITY_FAIL_AND_BAIL;
995
975
  }
996
976
  }
997
977
 
998
978
  /*-----------------------------------------------*/
999
979
  void UnityAssertEqualStringLen(const char* expected,
1000
- const char* actual,
1001
- const UNITY_UINT32 length,
1002
- const char* msg,
1003
- const UNITY_LINE_TYPE lineNumber)
980
+ const char* actual,
981
+ const UNITY_UINT32 length,
982
+ const char* msg,
983
+ const UNITY_LINE_TYPE lineNumber)
1004
984
  {
1005
985
  UNITY_UINT32 i;
1006
986
 
1007
- UNITY_SKIP_EXECUTION;
987
+ RETURN_IF_FAIL_OR_IGNORE;
1008
988
 
1009
989
  /* if both pointers not null compare the strings */
1010
990
  if (expected && actual)
@@ -1028,24 +1008,27 @@ void UnityAssertEqualStringLen(const char* expected,
1028
1008
 
1029
1009
  if (Unity.CurrentTestFailed)
1030
1010
  {
1031
- UnityTestResultsFailBegin(lineNumber);
1032
- UnityPrintExpectedAndActualStringsLen(expected, actual, length);
1033
- UnityAddMsgIfSpecified(msg);
1034
- UNITY_FAIL_AND_BAIL;
1011
+ UnityTestResultsFailBegin(lineNumber);
1012
+ UnityPrintExpectedAndActualStringsLen(expected, actual, length);
1013
+ UnityAddMsgIfSpecified(msg);
1014
+ UNITY_FAIL_AND_BAIL;
1035
1015
  }
1036
1016
  }
1037
1017
 
1038
-
1039
1018
  /*-----------------------------------------------*/
1040
- void UnityAssertEqualStringArray( const char** expected,
1041
- const char** actual,
1042
- const UNITY_UINT32 num_elements,
1043
- const char* msg,
1044
- const UNITY_LINE_TYPE lineNumber)
1019
+ void UnityAssertEqualStringArray(UNITY_INTERNAL_PTR expected,
1020
+ const char** actual,
1021
+ const UNITY_UINT32 num_elements,
1022
+ const char* msg,
1023
+ const UNITY_LINE_TYPE lineNumber,
1024
+ const UNITY_FLAGS_T flags)
1045
1025
  {
1046
- UNITY_UINT32 i, j = 0;
1026
+ UNITY_UINT32 i = 0;
1027
+ UNITY_UINT32 j = 0;
1028
+ const char* exp = NULL;
1029
+ const char* act = NULL;
1047
1030
 
1048
- UNITY_SKIP_EXECUTION;
1031
+ RETURN_IF_FAIL_OR_IGNORE;
1049
1032
 
1050
1033
  /* if no elements, it's an error */
1051
1034
  if (num_elements == 0)
@@ -1053,17 +1036,35 @@ void UnityAssertEqualStringArray( const char** expected,
1053
1036
  UnityPrintPointlessAndBail();
1054
1037
  }
1055
1038
 
1056
- if (UnityCheckArraysForNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg) == 1)
1057
- return;
1039
+ if ((const void*)expected == (const void*)actual)
1040
+ {
1041
+ return; /* Both are NULL or same pointer */
1042
+ }
1043
+
1044
+ if (UnityIsOneArrayNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg))
1045
+ {
1046
+ UNITY_FAIL_AND_BAIL;
1047
+ }
1048
+
1049
+ if (flags != UNITY_ARRAY_TO_ARRAY)
1050
+ {
1051
+ exp = (const char*)expected;
1052
+ }
1058
1053
 
1059
1054
  do
1060
1055
  {
1056
+ act = actual[j];
1057
+ if (flags == UNITY_ARRAY_TO_ARRAY)
1058
+ {
1059
+ exp = ((const char* const*)expected)[j];
1060
+ }
1061
+
1061
1062
  /* if both pointers not null compare the strings */
1062
- if (expected[j] && actual[j])
1063
+ if (exp && act)
1063
1064
  {
1064
- for (i = 0; expected[j][i] || actual[j][i]; i++)
1065
+ for (i = 0; exp[i] || act[i]; i++)
1065
1066
  {
1066
- if (expected[j][i] != actual[j][i])
1067
+ if (exp[i] != act[i])
1067
1068
  {
1068
1069
  Unity.CurrentTestFailed = 1;
1069
1070
  break;
@@ -1072,7 +1073,7 @@ void UnityAssertEqualStringArray( const char** expected,
1072
1073
  }
1073
1074
  else
1074
1075
  { /* handle case of one pointers being null (if both null, test should pass) */
1075
- if (expected[j] != actual[j])
1076
+ if (exp != act)
1076
1077
  {
1077
1078
  Unity.CurrentTestFailed = 1;
1078
1079
  }
@@ -1086,7 +1087,7 @@ void UnityAssertEqualStringArray( const char** expected,
1086
1087
  UnityPrint(UnityStrElement);
1087
1088
  UnityPrintNumberUnsigned(j);
1088
1089
  }
1089
- UnityPrintExpectedAndActualStrings((const char*)(expected[j]), (const char*)(actual[j]));
1090
+ UnityPrintExpectedAndActualStrings(exp, act);
1090
1091
  UnityAddMsgIfSpecified(msg);
1091
1092
  UNITY_FAIL_AND_BAIL;
1092
1093
  }
@@ -1094,27 +1095,29 @@ void UnityAssertEqualStringArray( const char** expected,
1094
1095
  }
1095
1096
 
1096
1097
  /*-----------------------------------------------*/
1097
- void UnityAssertEqualMemory( UNITY_INTERNAL_PTR expected,
1098
- UNITY_INTERNAL_PTR actual,
1099
- const UNITY_UINT32 length,
1100
- const UNITY_UINT32 num_elements,
1101
- const char* msg,
1102
- const UNITY_LINE_TYPE lineNumber)
1098
+ void UnityAssertEqualMemory(UNITY_INTERNAL_PTR expected,
1099
+ UNITY_INTERNAL_PTR actual,
1100
+ const UNITY_UINT32 length,
1101
+ const UNITY_UINT32 num_elements,
1102
+ const char* msg,
1103
+ const UNITY_LINE_TYPE lineNumber,
1104
+ const UNITY_FLAGS_T flags)
1103
1105
  {
1104
1106
  UNITY_PTR_ATTRIBUTE const unsigned char* ptr_exp = (UNITY_PTR_ATTRIBUTE const unsigned char*)expected;
1105
1107
  UNITY_PTR_ATTRIBUTE const unsigned char* ptr_act = (UNITY_PTR_ATTRIBUTE const unsigned char*)actual;
1106
1108
  UNITY_UINT32 elements = num_elements;
1107
1109
  UNITY_UINT32 bytes;
1108
1110
 
1109
- UNITY_SKIP_EXECUTION;
1111
+ RETURN_IF_FAIL_OR_IGNORE;
1110
1112
 
1111
1113
  if ((elements == 0) || (length == 0))
1112
1114
  {
1113
1115
  UnityPrintPointlessAndBail();
1114
1116
  }
1115
1117
 
1116
- if (UnityCheckArraysForNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg) == 1)
1117
- return;
1118
+ if (expected == actual) return; /* Both are NULL or same pointer */
1119
+ if (UnityIsOneArrayNull(expected, actual, lineNumber, msg))
1120
+ UNITY_FAIL_AND_BAIL;
1118
1121
 
1119
1122
  while (elements--)
1120
1123
  {
@@ -1139,22 +1142,83 @@ void UnityAssertEqualMemory( UNITY_INTERNAL_PTR expected,
1139
1142
  UnityAddMsgIfSpecified(msg);
1140
1143
  UNITY_FAIL_AND_BAIL;
1141
1144
  }
1142
- ptr_exp = (UNITY_INTERNAL_PTR)((UNITY_PTR)ptr_exp + 1);
1143
- ptr_act = (UNITY_INTERNAL_PTR)((UNITY_PTR)ptr_act + 1);
1145
+ ptr_exp++;
1146
+ ptr_act++;
1147
+ }
1148
+ if (flags == UNITY_ARRAY_TO_VAL)
1149
+ {
1150
+ ptr_exp = (UNITY_PTR_ATTRIBUTE const unsigned char*)expected;
1144
1151
  }
1145
1152
  }
1146
1153
  }
1147
1154
 
1155
+ /*-----------------------------------------------*/
1156
+
1157
+ static union
1158
+ {
1159
+ UNITY_INT8 i8;
1160
+ UNITY_INT16 i16;
1161
+ UNITY_INT32 i32;
1162
+ #ifdef UNITY_SUPPORT_64
1163
+ UNITY_INT64 i64;
1164
+ #endif
1165
+ #ifndef UNITY_EXCLUDE_FLOAT
1166
+ float f;
1167
+ #endif
1168
+ #ifndef UNITY_EXCLUDE_DOUBLE
1169
+ double d;
1170
+ #endif
1171
+ } UnityQuickCompare;
1172
+
1173
+ UNITY_INTERNAL_PTR UnityNumToPtr(const UNITY_INT num, const UNITY_UINT8 size)
1174
+ {
1175
+ switch(size)
1176
+ {
1177
+ case 1:
1178
+ UnityQuickCompare.i8 = (UNITY_INT8)num;
1179
+ return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.i8);
1180
+
1181
+ case 2:
1182
+ UnityQuickCompare.i16 = (UNITY_INT16)num;
1183
+ return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.i16);
1184
+
1185
+ #ifdef UNITY_SUPPORT_64
1186
+ case 8:
1187
+ UnityQuickCompare.i64 = (UNITY_INT64)num;
1188
+ return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.i64);
1189
+ #endif
1190
+ default: /* 4 bytes */
1191
+ UnityQuickCompare.i32 = (UNITY_INT32)num;
1192
+ return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.i32);
1193
+ }
1194
+ }
1195
+
1196
+ #ifndef UNITY_EXCLUDE_FLOAT
1197
+ UNITY_INTERNAL_PTR UnityFloatToPtr(const float num)
1198
+ {
1199
+ UnityQuickCompare.f = num;
1200
+ return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.f);
1201
+ }
1202
+ #endif
1203
+
1204
+ #ifndef UNITY_EXCLUDE_DOUBLE
1205
+ UNITY_INTERNAL_PTR UnityDoubleToPtr(const double num)
1206
+ {
1207
+ UnityQuickCompare.d = num;
1208
+ return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.d);
1209
+ }
1210
+ #endif
1211
+
1148
1212
  /*-----------------------------------------------
1149
1213
  * Control Functions
1150
1214
  *-----------------------------------------------*/
1151
1215
 
1152
1216
  void UnityFail(const char* msg, const UNITY_LINE_TYPE line)
1153
1217
  {
1154
- UNITY_SKIP_EXECUTION;
1218
+ RETURN_IF_FAIL_OR_IGNORE;
1155
1219
 
1156
1220
  UnityTestResultsBegin(Unity.TestFile, line);
1157
- UnityPrintFail();
1221
+ UnityPrint(UnityStrFail);
1158
1222
  if (msg != NULL)
1159
1223
  {
1160
1224
  UNITY_OUTPUT_CHAR(':');
@@ -1185,29 +1249,30 @@ void UnityFail(const char* msg, const UNITY_LINE_TYPE line)
1185
1249
  /*-----------------------------------------------*/
1186
1250
  void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line)
1187
1251
  {
1188
- UNITY_SKIP_EXECUTION;
1252
+ RETURN_IF_FAIL_OR_IGNORE;
1189
1253
 
1190
1254
  UnityTestResultsBegin(Unity.TestFile, line);
1191
1255
  UnityPrint(UnityStrIgnore);
1192
1256
  if (msg != NULL)
1193
1257
  {
1194
- UNITY_OUTPUT_CHAR(':');
1195
- UNITY_OUTPUT_CHAR(' ');
1196
- UnityPrint(msg);
1258
+ UNITY_OUTPUT_CHAR(':');
1259
+ UNITY_OUTPUT_CHAR(' ');
1260
+ UnityPrint(msg);
1197
1261
  }
1198
1262
  UNITY_IGNORE_AND_BAIL;
1199
1263
  }
1200
1264
 
1201
1265
  /*-----------------------------------------------*/
1202
1266
  #if defined(UNITY_WEAK_ATTRIBUTE)
1203
- UNITY_WEAK_ATTRIBUTE void setUp(void) { }
1204
- UNITY_WEAK_ATTRIBUTE void tearDown(void) { }
1267
+ UNITY_WEAK_ATTRIBUTE void setUp(void) { }
1268
+ UNITY_WEAK_ATTRIBUTE void tearDown(void) { }
1205
1269
  #elif defined(UNITY_WEAK_PRAGMA)
1206
- # pragma weak setUp
1207
- void setUp(void) { }
1208
- # pragma weak tearDown
1209
- void tearDown(void) { }
1270
+ #pragma weak setUp
1271
+ void setUp(void) { }
1272
+ #pragma weak tearDown
1273
+ void tearDown(void) { }
1210
1274
  #endif
1275
+
1211
1276
  /*-----------------------------------------------*/
1212
1277
  void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum)
1213
1278
  {
@@ -1220,7 +1285,7 @@ void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int
1220
1285
  setUp();
1221
1286
  Func();
1222
1287
  }
1223
- if (TEST_PROTECT() && !(Unity.CurrentTestIgnored))
1288
+ if (TEST_PROTECT())
1224
1289
  {
1225
1290
  tearDown();
1226
1291
  }
@@ -1258,11 +1323,11 @@ int UnityEnd(void)
1258
1323
  UNITY_PRINT_EOL();
1259
1324
  if (Unity.TestFailures == 0U)
1260
1325
  {
1261
- UnityPrintOk();
1326
+ UnityPrint(UnityStrOk);
1262
1327
  }
1263
1328
  else
1264
1329
  {
1265
- UnityPrintFail();
1330
+ UnityPrint(UnityStrFail);
1266
1331
  #ifdef UNITY_DIFFERENTIATE_FINAL_FAIL
1267
1332
  UNITY_OUTPUT_CHAR('E'); UNITY_OUTPUT_CHAR('D');
1268
1333
  #endif
@@ -1280,7 +1345,7 @@ int UnityEnd(void)
1280
1345
 
1281
1346
  char* UnityOptionIncludeNamed = NULL;
1282
1347
  char* UnityOptionExcludeNamed = NULL;
1283
- int UnityVerbosity = 1;
1348
+ int UnityVerbosity = 1;
1284
1349
 
1285
1350
  int UnityParseOptions(int argc, char** argv)
1286
1351
  {
@@ -1291,7 +1356,7 @@ int UnityParseOptions(int argc, char** argv)
1291
1356
  {
1292
1357
  if (argv[i][0] == '-')
1293
1358
  {
1294
- switch(argv[i][1])
1359
+ switch (argv[i][1])
1295
1360
  {
1296
1361
  case 'l': /* list tests */
1297
1362
  return -1;
@@ -1340,9 +1405,9 @@ int UnityParseOptions(int argc, char** argv)
1340
1405
 
1341
1406
  int IsStringInBiggerString(const char* longstring, const char* shortstring)
1342
1407
  {
1343
- char* lptr = (char*)longstring;
1344
- char* sptr = (char*)shortstring;
1345
- char* lnext = lptr;
1408
+ const char* lptr = longstring;
1409
+ const char* sptr = shortstring;
1410
+ const char* lnext = lptr;
1346
1411
 
1347
1412
  if (*sptr == '*')
1348
1413
  return 1;
@@ -1374,7 +1439,7 @@ int IsStringInBiggerString(const char* longstring, const char* shortstring)
1374
1439
 
1375
1440
  /* Otherwise we start in the long pointer 1 character further and try again */
1376
1441
  lptr = lnext;
1377
- sptr = (char*)shortstring;
1442
+ sptr = shortstring;
1378
1443
  }
1379
1444
  return 0;
1380
1445
  }
@@ -1396,7 +1461,8 @@ int UnityStringArgumentMatches(const char* str)
1396
1461
  /* look for the start of the next partial */
1397
1462
  ptr2 = ptr1;
1398
1463
  ptrf = 0;
1399
- do {
1464
+ do
1465
+ {
1400
1466
  ptr2++;
1401
1467
  if ((ptr2[0] == ':') && (ptr2[1] != 0) && (ptr2[0] != '\'') && (ptr2[0] != '"') && (ptr2[0] != ','))
1402
1468
  ptrf = &ptr2[1];