ceedling 0.20.3 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (407) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -0
  3. data/Gemfile.lock +1 -0
  4. data/Rakefile +1 -0
  5. data/bin/ceedling +79 -26
  6. data/lib/ceedling/configurator_plugins.rb +0 -18
  7. data/lib/ceedling/rules_cmock.rake +1 -1
  8. data/lib/ceedling/tasks_base.rake +5 -1
  9. data/lib/ceedling/tasks_tests.rake +12 -9
  10. data/lib/ceedling/version.rb +1 -1
  11. data/lib/ceedling/version.rb.erb +1 -1
  12. data/plugins/fake_function_framework/README.md +250 -0
  13. data/plugins/fake_function_framework/Rakefile +19 -0
  14. data/plugins/fake_function_framework/examples/fff_example/project.yml +71 -0
  15. data/plugins/fake_function_framework/examples/fff_example/rakefile.rb +7 -0
  16. data/plugins/fake_function_framework/examples/fff_example/src/bar.c +1 -0
  17. data/plugins/fake_function_framework/examples/fff_example/src/bar.h +13 -0
  18. data/plugins/fake_function_framework/examples/fff_example/src/custom_types.h +6 -0
  19. data/plugins/fake_function_framework/examples/fff_example/src/display.c +7 -0
  20. data/plugins/fake_function_framework/examples/fff_example/src/display.h +16 -0
  21. data/plugins/fake_function_framework/examples/fff_example/src/event_processor.c +92 -0
  22. data/plugins/fake_function_framework/examples/fff_example/src/event_processor.h +11 -0
  23. data/plugins/fake_function_framework/examples/fff_example/src/foo.c +16 -0
  24. data/plugins/fake_function_framework/examples/fff_example/src/foo.h +8 -0
  25. data/plugins/fake_function_framework/examples/fff_example/src/subfolder/zzz.c +1 -0
  26. data/plugins/fake_function_framework/examples/fff_example/src/subfolder/zzz.h +6 -0
  27. data/plugins/fake_function_framework/examples/fff_example/test/test_event_processor.c +155 -0
  28. data/plugins/fake_function_framework/examples/fff_example/test/test_foo.c +47 -0
  29. data/plugins/fake_function_framework/lib/fake_function_framework.rb +87 -0
  30. data/plugins/fake_function_framework/lib/fff_mock_generator.rb +159 -0
  31. data/plugins/fake_function_framework/spec/fff_mock_generator_spec.rb +464 -0
  32. data/plugins/fake_function_framework/spec/spec_helper.rb +96 -0
  33. data/plugins/fake_function_framework/src/fff_unity_helper.h +33 -0
  34. data/plugins/fake_function_framework/vendor/fff/LICENSE +25 -0
  35. data/plugins/fake_function_framework/vendor/fff/Makefile +10 -0
  36. data/plugins/fake_function_framework/vendor/fff/README.md +454 -0
  37. data/plugins/fake_function_framework/vendor/fff/buildandtest +15 -0
  38. data/plugins/fake_function_framework/vendor/fff/examples/Makefile +7 -0
  39. data/plugins/fake_function_framework/vendor/fff/examples/driver_testing/Makefile +64 -0
  40. data/plugins/fake_function_framework/vendor/fff/examples/driver_testing/driver.c +24 -0
  41. data/plugins/fake_function_framework/vendor/fff/examples/driver_testing/driver.h +11 -0
  42. data/plugins/fake_function_framework/vendor/fff/examples/driver_testing/driver.test.cpp +50 -0
  43. data/plugins/fake_function_framework/vendor/fff/examples/driver_testing/driver.test.fff.cpp +62 -0
  44. data/plugins/fake_function_framework/vendor/fff/examples/driver_testing/hardware_abstraction.h +15 -0
  45. data/plugins/fake_function_framework/vendor/fff/examples/driver_testing/registers.h +13 -0
  46. data/plugins/fake_function_framework/vendor/fff/examples/embedded_ui/DISPLAY.h +17 -0
  47. data/plugins/fake_function_framework/vendor/fff/examples/embedded_ui/Kata.txt +25 -0
  48. data/plugins/fake_function_framework/vendor/fff/examples/embedded_ui/Makefile +67 -0
  49. data/plugins/fake_function_framework/vendor/fff/examples/embedded_ui/SYSTEM.h +21 -0
  50. data/plugins/fake_function_framework/vendor/fff/examples/embedded_ui/UI.c +48 -0
  51. data/plugins/fake_function_framework/vendor/fff/examples/embedded_ui/UI.h +12 -0
  52. data/plugins/fake_function_framework/vendor/fff/examples/embedded_ui/UI_test_ansic.c +183 -0
  53. data/plugins/fake_function_framework/vendor/fff/examples/embedded_ui/UI_test_cpp.cpp +136 -0
  54. data/plugins/fake_function_framework/vendor/fff/examples/embedded_ui/test_suite_template.c +34 -0
  55. data/plugins/fake_function_framework/vendor/fff/fakegen.rb +420 -0
  56. data/plugins/fake_function_framework/vendor/fff/fff.h +5112 -0
  57. data/plugins/fake_function_framework/vendor/fff/gtest/Makefile +22 -0
  58. data/plugins/fake_function_framework/vendor/fff/gtest/gtest-all.cc +9118 -0
  59. data/plugins/fake_function_framework/vendor/fff/gtest/gtest-main.cc +6 -0
  60. data/plugins/fake_function_framework/vendor/fff/gtest/gtest.h +19537 -0
  61. data/plugins/fake_function_framework/vendor/fff/test/Makefile +81 -0
  62. data/plugins/fake_function_framework/vendor/fff/test/c_test_framework.h +15 -0
  63. data/plugins/fake_function_framework/vendor/fff/test/fff_test_c.c +108 -0
  64. data/plugins/fake_function_framework/vendor/fff/test/fff_test_cpp.cpp +45 -0
  65. data/plugins/fake_function_framework/vendor/fff/test/fff_test_global_c.c +76 -0
  66. data/plugins/fake_function_framework/vendor/fff/test/fff_test_global_cpp.cpp +23 -0
  67. data/plugins/fake_function_framework/vendor/fff/test/global_fakes.c +13 -0
  68. data/plugins/fake_function_framework/vendor/fff/test/global_fakes.h +37 -0
  69. data/plugins/fake_function_framework/vendor/fff/test/test_cases.include +276 -0
  70. data/plugins/gcov/README.md +9 -0
  71. data/plugins/gcov/{template.erb → assets/template.erb} +1 -1
  72. data/plugins/gcov/{defaults.yml → config/defaults.yml} +10 -1
  73. data/plugins/gcov/gcov.rake +20 -8
  74. data/plugins/gcov/{gcov.rb → lib/gcov.rb} +13 -24
  75. data/plugins/module_generator/module_generator.rake +3 -3
  76. data/plugins/warnings_report/lib/warnings_report.rb +69 -0
  77. data/plugins/xml_tests_report/lib/xml_tests_report.rb +108 -0
  78. data/spec/spec_system_helper.rb +1 -1
  79. data/vendor/c_exception/lib/CException.h +1 -1
  80. data/vendor/c_exception/vendor/unity/auto/generate_module.rb +16 -16
  81. data/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +61 -21
  82. data/vendor/c_exception/vendor/unity/auto/stylize_as_junit.rb +5 -1
  83. data/vendor/c_exception/vendor/unity/auto/unity_to_junit.py +146 -0
  84. data/vendor/c_exception/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
  85. data/vendor/c_exception/vendor/unity/docs/UnityAssertionsReference.pdf +0 -0
  86. data/vendor/c_exception/vendor/unity/docs/UnityConfigurationGuide.pdf +0 -0
  87. data/vendor/c_exception/vendor/unity/docs/UnityGettingStartedGuide.pdf +0 -0
  88. data/vendor/c_exception/vendor/unity/docs/UnityHelperScriptsGuide.pdf +0 -0
  89. data/vendor/c_exception/vendor/unity/examples/example_1/makefile +1 -1
  90. data/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode.c +7 -7
  91. data/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode2.c +2 -2
  92. data/vendor/c_exception/vendor/unity/examples/example_1/test/TestProductionCode.c +14 -14
  93. data/vendor/c_exception/vendor/unity/examples/example_1/test/TestProductionCode2.c +2 -2
  94. data/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +5 -5
  95. data/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +5 -5
  96. data/vendor/c_exception/vendor/unity/examples/unity_config.h +257 -0
  97. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +9 -8
  98. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +1 -0
  99. data/vendor/c_exception/vendor/unity/extras/fixture/test/Makefile +28 -8
  100. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +57 -17
  101. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +3 -0
  102. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c +2 -3
  103. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h +1 -1
  104. data/vendor/c_exception/vendor/unity/release/version.info +1 -1
  105. data/vendor/c_exception/vendor/unity/src/unity.c +336 -191
  106. data/vendor/c_exception/vendor/unity/src/unity.h +73 -69
  107. data/vendor/c_exception/vendor/unity/src/unity_internals.h +119 -90
  108. data/vendor/c_exception/vendor/unity/test/Makefile +51 -0
  109. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c +5 -5
  110. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c +5 -5
  111. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_head1.c +5 -5
  112. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c +6 -6
  113. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c +6 -6
  114. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_head1.c +6 -6
  115. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c +6 -6
  116. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c +8 -8
  117. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c +6 -6
  118. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c +6 -6
  119. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c +8 -8
  120. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c +7 -7
  121. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c +5 -5
  122. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c +7 -7
  123. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c +5 -5
  124. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c +5 -5
  125. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c +7 -7
  126. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c +6 -6
  127. data/vendor/c_exception/vendor/unity/test/rakefile +5 -0
  128. data/vendor/c_exception/vendor/unity/test/rakefile_helper.rb +9 -7
  129. data/vendor/c_exception/vendor/unity/test/targets/clang_file.yml +1 -0
  130. data/vendor/c_exception/vendor/unity/test/targets/clang_strict.yml +3 -0
  131. data/vendor/c_exception/vendor/unity/test/targets/gcc_32.yml +1 -0
  132. data/vendor/c_exception/vendor/unity/test/targets/gcc_64.yml +1 -0
  133. data/vendor/c_exception/vendor/unity/test/targets/gcc_auto_limits.yml +1 -0
  134. data/vendor/c_exception/vendor/unity/test/targets/gcc_auto_sizeof.yml +1 -0
  135. data/vendor/c_exception/vendor/unity/test/targets/gcc_auto_stdint.yml +1 -0
  136. data/vendor/c_exception/vendor/unity/test/targets/gcc_manual_math.yml +1 -0
  137. data/vendor/c_exception/vendor/unity/test/targets/iar_arm_v4.yml +1 -0
  138. data/vendor/c_exception/vendor/unity/test/targets/iar_arm_v5.yml +1 -0
  139. data/vendor/c_exception/vendor/unity/test/targets/iar_arm_v5_3.yml +1 -0
  140. data/vendor/c_exception/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +1 -0
  141. data/vendor/c_exception/vendor/unity/test/targets/iar_cortexm3_v5.yml +1 -0
  142. data/vendor/c_exception/vendor/unity/test/targets/iar_msp430.yml +1 -0
  143. data/vendor/c_exception/vendor/unity/test/targets/iar_sh2a_v6.yml +1 -0
  144. data/vendor/c_exception/vendor/unity/test/testdata/CException.h +11 -0
  145. data/vendor/c_exception/vendor/unity/test/testdata/Defs.h +8 -0
  146. data/vendor/c_exception/vendor/unity/test/testdata/cmock.h +14 -0
  147. data/vendor/c_exception/vendor/unity/test/testdata/mockMock.h +13 -0
  148. data/vendor/c_exception/vendor/unity/test/testdata/testRunnerGenerator.c +183 -0
  149. data/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +65 -0
  150. data/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +192 -0
  151. data/vendor/c_exception/vendor/unity/test/tests/test_generate_test_runner.rb +1221 -71
  152. data/vendor/c_exception/vendor/unity/test/tests/testparameterized.c +1 -1
  153. data/vendor/c_exception/vendor/unity/test/tests/testunity.c +127 -5
  154. data/vendor/cmock/docs/CMock_Summary.md +1 -1
  155. data/vendor/cmock/lib/cmock_generator.rb +7 -2
  156. data/vendor/cmock/lib/cmock_header_parser.rb +29 -9
  157. data/vendor/cmock/scripts/create_mock.rb +1 -1
  158. data/vendor/cmock/test/system/test_compilation/const.h +15 -0
  159. data/vendor/cmock/test/unit/cmock_generator_main_test.rb +4 -4
  160. data/vendor/cmock/test/unit/cmock_header_parser_test.rb +136 -73
  161. data/vendor/cmock/vendor/c_exception/lib/CException.h +1 -1
  162. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_module.rb +16 -16
  163. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +61 -21
  164. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/stylize_as_junit.rb +5 -1
  165. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_to_junit.py +146 -0
  166. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
  167. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityAssertionsReference.pdf +0 -0
  168. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityConfigurationGuide.pdf +0 -0
  169. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityGettingStartedGuide.pdf +0 -0
  170. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityHelperScriptsGuide.pdf +0 -0
  171. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/makefile +1 -1
  172. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode.c +7 -7
  173. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode2.c +2 -2
  174. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/TestProductionCode.c +14 -14
  175. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/TestProductionCode2.c +2 -2
  176. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +5 -5
  177. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +5 -5
  178. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/unity_config.h +257 -0
  179. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +9 -8
  180. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +1 -0
  181. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/Makefile +28 -8
  182. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +57 -17
  183. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +3 -0
  184. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c +2 -3
  185. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h +1 -1
  186. data/vendor/cmock/vendor/c_exception/vendor/unity/release/version.info +1 -1
  187. data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.c +336 -191
  188. data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.h +73 -69
  189. data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity_internals.h +119 -90
  190. data/vendor/cmock/vendor/c_exception/vendor/unity/test/Makefile +51 -0
  191. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c +5 -5
  192. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c +5 -5
  193. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_head1.c +5 -5
  194. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c +6 -6
  195. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c +6 -6
  196. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_head1.c +6 -6
  197. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c +6 -6
  198. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c +8 -8
  199. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c +6 -6
  200. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c +6 -6
  201. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c +8 -8
  202. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c +7 -7
  203. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c +5 -5
  204. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c +7 -7
  205. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c +5 -5
  206. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c +5 -5
  207. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c +7 -7
  208. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c +6 -6
  209. data/vendor/cmock/vendor/c_exception/vendor/unity/test/rakefile +5 -0
  210. data/vendor/cmock/vendor/c_exception/vendor/unity/test/rakefile_helper.rb +9 -7
  211. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/clang_file.yml +1 -0
  212. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/clang_strict.yml +3 -0
  213. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_32.yml +1 -0
  214. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_64.yml +1 -0
  215. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_auto_limits.yml +1 -0
  216. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_auto_sizeof.yml +1 -0
  217. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_auto_stdint.yml +1 -0
  218. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_manual_math.yml +1 -0
  219. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_arm_v4.yml +1 -0
  220. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_arm_v5.yml +1 -0
  221. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_arm_v5_3.yml +1 -0
  222. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +1 -0
  223. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_cortexm3_v5.yml +1 -0
  224. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_msp430.yml +1 -0
  225. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_sh2a_v6.yml +1 -0
  226. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/CException.h +11 -0
  227. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/Defs.h +8 -0
  228. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/cmock.h +14 -0
  229. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/mockMock.h +13 -0
  230. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testRunnerGenerator.c +183 -0
  231. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +65 -0
  232. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +192 -0
  233. data/vendor/cmock/vendor/c_exception/vendor/unity/test/tests/test_generate_test_runner.rb +1221 -71
  234. data/vendor/cmock/vendor/c_exception/vendor/unity/test/tests/testparameterized.c +1 -1
  235. data/vendor/cmock/vendor/c_exception/vendor/unity/test/tests/testunity.c +127 -5
  236. data/vendor/cmock/vendor/unity/auto/generate_module.rb +16 -16
  237. data/vendor/cmock/vendor/unity/auto/generate_test_runner.rb +61 -21
  238. data/vendor/cmock/vendor/unity/auto/stylize_as_junit.rb +5 -1
  239. data/vendor/cmock/vendor/unity/auto/unity_to_junit.py +146 -0
  240. data/vendor/cmock/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
  241. data/vendor/cmock/vendor/unity/docs/UnityAssertionsReference.pdf +0 -0
  242. data/vendor/cmock/vendor/unity/docs/UnityConfigurationGuide.pdf +0 -0
  243. data/vendor/cmock/vendor/unity/docs/UnityGettingStartedGuide.pdf +0 -0
  244. data/vendor/cmock/vendor/unity/docs/UnityHelperScriptsGuide.pdf +0 -0
  245. data/vendor/cmock/vendor/unity/examples/example_1/makefile +1 -1
  246. data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode.c +7 -7
  247. data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode2.c +2 -2
  248. data/vendor/cmock/vendor/unity/examples/example_1/test/TestProductionCode.c +14 -14
  249. data/vendor/cmock/vendor/unity/examples/example_1/test/TestProductionCode2.c +2 -2
  250. data/vendor/cmock/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +5 -5
  251. data/vendor/cmock/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +5 -5
  252. data/vendor/cmock/vendor/unity/examples/unity_config.h +257 -0
  253. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c +3 -0
  254. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c +5 -2
  255. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.c +1 -2
  256. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.h +1 -1
  257. data/vendor/cmock/vendor/unity/src/unity.c +329 -186
  258. data/vendor/cmock/vendor/unity/src/unity.h +73 -69
  259. data/vendor/cmock/vendor/unity/src/unity_internals.h +119 -94
  260. data/vendor/cmock/vendor/unity/test/Makefile +4 -5
  261. data/vendor/cmock/vendor/unity/test/expectdata/testsample_cmd.c +5 -5
  262. data/vendor/cmock/vendor/unity/test/expectdata/testsample_def.c +5 -5
  263. data/vendor/cmock/vendor/unity/test/expectdata/testsample_head1.c +5 -5
  264. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_cmd.c +6 -6
  265. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_def.c +6 -6
  266. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_head1.c +6 -6
  267. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new1.c +6 -6
  268. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new2.c +8 -8
  269. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_param.c +6 -6
  270. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run1.c +6 -6
  271. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run2.c +8 -8
  272. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_yaml.c +7 -7
  273. data/vendor/cmock/vendor/unity/test/expectdata/testsample_new1.c +5 -5
  274. data/vendor/cmock/vendor/unity/test/expectdata/testsample_new2.c +7 -7
  275. data/vendor/cmock/vendor/unity/test/expectdata/testsample_param.c +5 -5
  276. data/vendor/cmock/vendor/unity/test/expectdata/testsample_run1.c +5 -5
  277. data/vendor/cmock/vendor/unity/test/expectdata/testsample_run2.c +7 -7
  278. data/vendor/cmock/vendor/unity/test/expectdata/testsample_yaml.c +6 -6
  279. data/vendor/cmock/vendor/unity/test/rakefile +5 -0
  280. data/vendor/cmock/vendor/unity/test/rakefile_helper.rb +9 -7
  281. data/vendor/cmock/vendor/unity/test/targets/clang_file.yml +1 -0
  282. data/vendor/cmock/vendor/unity/test/targets/clang_strict.yml +3 -0
  283. data/vendor/cmock/vendor/unity/test/targets/gcc_32.yml +1 -0
  284. data/vendor/cmock/vendor/unity/test/targets/gcc_64.yml +1 -0
  285. data/vendor/cmock/vendor/unity/test/targets/gcc_auto_limits.yml +1 -0
  286. data/vendor/cmock/vendor/unity/test/targets/gcc_auto_sizeof.yml +1 -0
  287. data/vendor/cmock/vendor/unity/test/targets/gcc_auto_stdint.yml +1 -0
  288. data/vendor/cmock/vendor/unity/test/targets/gcc_manual_math.yml +1 -0
  289. data/vendor/cmock/vendor/unity/test/targets/iar_arm_v4.yml +1 -0
  290. data/vendor/cmock/vendor/unity/test/targets/iar_arm_v5.yml +1 -0
  291. data/vendor/cmock/vendor/unity/test/targets/iar_arm_v5_3.yml +1 -0
  292. data/vendor/cmock/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +1 -0
  293. data/vendor/cmock/vendor/unity/test/targets/iar_cortexm3_v5.yml +1 -0
  294. data/vendor/cmock/vendor/unity/test/targets/iar_msp430.yml +1 -0
  295. data/vendor/cmock/vendor/unity/test/targets/iar_sh2a_v6.yml +1 -0
  296. data/vendor/cmock/vendor/unity/test/testdata/CException.h +11 -0
  297. data/vendor/cmock/vendor/unity/test/testdata/Defs.h +8 -0
  298. data/vendor/cmock/vendor/unity/test/testdata/cmock.h +14 -0
  299. data/vendor/cmock/vendor/unity/test/testdata/mockMock.h +13 -0
  300. data/vendor/cmock/vendor/unity/test/testdata/testRunnerGenerator.c +183 -0
  301. data/vendor/cmock/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +65 -0
  302. data/vendor/cmock/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +192 -0
  303. data/vendor/cmock/vendor/unity/test/tests/test_generate_test_runner.rb +1221 -71
  304. data/vendor/cmock/vendor/unity/test/tests/testparameterized.c +1 -1
  305. data/vendor/cmock/vendor/unity/test/tests/testunity.c +104 -7
  306. data/vendor/deep_merge/README +94 -94
  307. data/vendor/deep_merge/Rakefile +28 -28
  308. data/vendor/deep_merge/lib/deep_merge.rb +211 -211
  309. data/vendor/deep_merge/test/test_deep_merge.rb +553 -553
  310. data/vendor/unity/auto/generate_module.rb +16 -16
  311. data/vendor/unity/auto/generate_test_runner.rb +61 -21
  312. data/vendor/unity/auto/stylize_as_junit.rb +5 -1
  313. data/vendor/unity/auto/unity_to_junit.py +146 -0
  314. data/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
  315. data/vendor/unity/docs/UnityAssertionsReference.pdf +0 -0
  316. data/vendor/unity/docs/UnityConfigurationGuide.pdf +0 -0
  317. data/vendor/unity/docs/UnityGettingStartedGuide.pdf +0 -0
  318. data/vendor/unity/docs/UnityHelperScriptsGuide.pdf +0 -0
  319. data/vendor/unity/examples/example_1/makefile +1 -1
  320. data/vendor/unity/examples/example_1/src/ProductionCode.c +7 -7
  321. data/vendor/unity/examples/example_1/src/ProductionCode2.c +2 -2
  322. data/vendor/unity/examples/example_1/test/TestProductionCode.c +14 -14
  323. data/vendor/unity/examples/example_1/test/TestProductionCode2.c +2 -2
  324. data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +5 -5
  325. data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +5 -5
  326. data/vendor/unity/examples/unity_config.h +257 -0
  327. data/vendor/unity/extras/fixture/src/unity_fixture.c +3 -0
  328. data/vendor/unity/extras/fixture/test/unity_fixture_Test.c +5 -2
  329. data/vendor/unity/extras/fixture/test/unity_output_Spy.c +1 -2
  330. data/vendor/unity/extras/fixture/test/unity_output_Spy.h +1 -1
  331. data/vendor/unity/src/unity.c +329 -186
  332. data/vendor/unity/src/unity.h +73 -69
  333. data/vendor/unity/src/unity_internals.h +119 -94
  334. data/vendor/unity/test/Makefile +4 -5
  335. data/vendor/unity/test/expectdata/testsample_cmd.c +5 -5
  336. data/vendor/unity/test/expectdata/testsample_def.c +5 -5
  337. data/vendor/unity/test/expectdata/testsample_head1.c +5 -5
  338. data/vendor/unity/test/expectdata/testsample_mock_cmd.c +6 -6
  339. data/vendor/unity/test/expectdata/testsample_mock_def.c +6 -6
  340. data/vendor/unity/test/expectdata/testsample_mock_head1.c +6 -6
  341. data/vendor/unity/test/expectdata/testsample_mock_new1.c +6 -6
  342. data/vendor/unity/test/expectdata/testsample_mock_new2.c +8 -8
  343. data/vendor/unity/test/expectdata/testsample_mock_param.c +6 -6
  344. data/vendor/unity/test/expectdata/testsample_mock_run1.c +6 -6
  345. data/vendor/unity/test/expectdata/testsample_mock_run2.c +8 -8
  346. data/vendor/unity/test/expectdata/testsample_mock_yaml.c +7 -7
  347. data/vendor/unity/test/expectdata/testsample_new1.c +5 -5
  348. data/vendor/unity/test/expectdata/testsample_new2.c +7 -7
  349. data/vendor/unity/test/expectdata/testsample_param.c +5 -5
  350. data/vendor/unity/test/expectdata/testsample_run1.c +5 -5
  351. data/vendor/unity/test/expectdata/testsample_run2.c +7 -7
  352. data/vendor/unity/test/expectdata/testsample_yaml.c +6 -6
  353. data/vendor/unity/test/rakefile +5 -0
  354. data/vendor/unity/test/rakefile_helper.rb +9 -7
  355. data/vendor/unity/test/targets/clang_file.yml +1 -0
  356. data/vendor/unity/test/targets/clang_strict.yml +3 -0
  357. data/vendor/unity/test/targets/gcc_32.yml +1 -0
  358. data/vendor/unity/test/targets/gcc_64.yml +1 -0
  359. data/vendor/unity/test/targets/gcc_auto_limits.yml +1 -0
  360. data/vendor/unity/test/targets/gcc_auto_sizeof.yml +1 -0
  361. data/vendor/unity/test/targets/gcc_auto_stdint.yml +1 -0
  362. data/vendor/unity/test/targets/gcc_manual_math.yml +1 -0
  363. data/vendor/unity/test/targets/iar_arm_v4.yml +1 -0
  364. data/vendor/unity/test/targets/iar_arm_v5.yml +1 -0
  365. data/vendor/unity/test/targets/iar_arm_v5_3.yml +1 -0
  366. data/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +1 -0
  367. data/vendor/unity/test/targets/iar_cortexm3_v5.yml +1 -0
  368. data/vendor/unity/test/targets/iar_msp430.yml +1 -0
  369. data/vendor/unity/test/targets/iar_sh2a_v6.yml +1 -0
  370. data/vendor/unity/test/testdata/CException.h +11 -0
  371. data/vendor/unity/test/testdata/Defs.h +8 -0
  372. data/vendor/unity/test/testdata/cmock.h +14 -0
  373. data/vendor/unity/test/testdata/mockMock.h +13 -0
  374. data/vendor/unity/test/testdata/testRunnerGenerator.c +183 -0
  375. data/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +65 -0
  376. data/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +192 -0
  377. data/vendor/unity/test/tests/test_generate_test_runner.rb +1221 -71
  378. data/vendor/unity/test/tests/testparameterized.c +1 -1
  379. data/vendor/unity/test/tests/testunity.c +104 -7
  380. metadata +124 -32
  381. data/plugins/gcov/readme.txt +0 -0
  382. data/plugins/warnings_report/warnings_report.rb +0 -71
  383. data/plugins/xml_tests_report/xml_tests_report.rb +0 -110
  384. data/vendor/c_exception/vendor/unity/docs/Unity Summary.odt +0 -0
  385. data/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf +0 -0
  386. data/vendor/c_exception/vendor/unity/docs/Unity Summary.txt +0 -224
  387. data/vendor/c_exception/vendor/unity/test/testdata/mocksample.c +0 -51
  388. data/vendor/c_exception/vendor/unity/test/testdata/sample.yml +0 -9
  389. data/vendor/c_exception/vendor/unity/test/testdata/testsample.c +0 -68
  390. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.odt +0 -0
  391. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf +0 -0
  392. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.txt +0 -224
  393. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/mocksample.c +0 -51
  394. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/sample.yml +0 -9
  395. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testsample.c +0 -68
  396. data/vendor/cmock/vendor/unity/docs/Unity Summary.odt +0 -0
  397. data/vendor/cmock/vendor/unity/docs/Unity Summary.pdf +0 -0
  398. data/vendor/cmock/vendor/unity/docs/Unity Summary.txt +0 -224
  399. data/vendor/cmock/vendor/unity/test/testdata/mocksample.c +0 -51
  400. data/vendor/cmock/vendor/unity/test/testdata/sample.yml +0 -9
  401. data/vendor/cmock/vendor/unity/test/testdata/testsample.c +0 -68
  402. data/vendor/unity/docs/Unity Summary.odt +0 -0
  403. data/vendor/unity/docs/Unity Summary.pdf +0 -0
  404. data/vendor/unity/docs/Unity Summary.txt +0 -224
  405. data/vendor/unity/test/testdata/mocksample.c +0 -51
  406. data/vendor/unity/test/testdata/sample.yml +0 -9
  407. data/vendor/unity/test/testdata/testsample.c +0 -68
@@ -15,6 +15,7 @@ struct _UnityFixture
15
15
  const char* NameFilter;
16
16
  const char* GroupFilter;
17
17
  };
18
+ extern struct _UnityFixture UnityFixture;
18
19
 
19
20
  typedef void unityfunction(void);
20
21
  void UnityTestRunner(unityfunction* setup,
@@ -1,4 +1,7 @@
1
1
  CC = gcc
2
+ ifeq ($(shell uname -s), Darwin)
3
+ CC = clang
4
+ endif
2
5
  #DEBUG = -O0 -g
3
6
  CFLAGS += -std=c99
4
7
  CFLAGS += -pedantic
@@ -15,33 +18,48 @@ SRC = ../src/unity_fixture.c \
15
18
  main/AllTests.c
16
19
 
17
20
  INC_DIR = -I../src -I../../../src/
21
+ BUILD_DIR = ../build
18
22
  TARGET = ../build/fixture_tests.exe
19
23
 
20
24
  all: default noStdlibMalloc 32bits
21
25
 
22
- default: ../build/
23
- $(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET)
26
+ default: $(BUILD_DIR)
27
+ $(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -D UNITY_SUPPORT_64
24
28
  @ echo "default build"
25
29
  ./$(TARGET)
26
30
 
27
- 32bits: ../build/
31
+ 32bits: $(BUILD_DIR)
28
32
  $(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -m32
29
33
  @ echo "32bits build"
30
34
  ./$(TARGET)
31
35
 
32
- noStdlibMalloc: ../build/
36
+ noStdlibMalloc: $(BUILD_DIR)
33
37
  $(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -D UNITY_EXCLUDE_STDLIB_MALLOC
34
38
  @ echo "build with noStdlibMalloc"
35
39
  ./$(TARGET)
36
40
 
41
+ clang89: ../build/
42
+ clang $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -m32 -std=c89 -Wno-comment
43
+ clang $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -m32 \
44
+ -D UNITY_EXCLUDE_STDLIB_MALLOC -std=c89 -Wno-comment ; ./$(TARGET)
45
+
37
46
  clangEverything:
38
- clang $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -m64 -Weverything
47
+ clang $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -Weverything
39
48
 
40
- ../build :
41
- mkdir -p ../build
49
+ $(BUILD_DIR):
50
+ mkdir -p $(BUILD_DIR)
42
51
 
43
52
  clean:
44
- rm -f $(TARGET)
53
+ rm -f $(TARGET) $(BUILD_DIR)/*.gc*
54
+
55
+ coverage: $(BUILD_DIR)
56
+ cd $(BUILD_DIR) && \
57
+ $(CC) $(DEFINES) $(foreach i, $(SRC), ../test/$(i)) $(INC_DIR) -o $(TARGET) -fprofile-arcs -ftest-coverage
58
+ rm -f $(BUILD_DIR)/*.gcda
59
+ ./$(TARGET) > /dev/null ; ./$(TARGET) -v > /dev/null
60
+ cd $(BUILD_DIR) && \
61
+ gcov unity_fixture.c | head -3
62
+ grep '###' $(BUILD_DIR)/unity_fixture.c.gcov -C2 || true # Show uncovered lines
45
63
 
46
64
  # These extended flags DO get included before any target build runs
47
65
  CFLAGS += -Wbad-function-cast
@@ -56,5 +74,7 @@ CFLAGS += -Wstrict-overflow=5
56
74
  CFLAGS += -Wstrict-prototypes
57
75
  CFLAGS += -Wswitch-default
58
76
  CFLAGS += -Wundef
77
+ CFLAGS += -Wno-error=undef # Warning only, this should not stop the build
78
+ CFLAGS += -Wunreachable-code
59
79
  CFLAGS += -Wunused
60
80
  CFLAGS += -fstrict-aliasing
@@ -10,8 +10,6 @@
10
10
  #include <stdlib.h>
11
11
  #include <string.h>
12
12
 
13
- extern struct _UnityFixture UnityFixture;
14
-
15
13
  TEST_GROUP(UnityFixture);
16
14
 
17
15
  TEST_SETUP(UnityFixture)
@@ -138,6 +136,22 @@ TEST(UnityFixture, FreeNULLSafety)
138
136
  free(NULL);
139
137
  }
140
138
 
139
+ TEST(UnityFixture, ConcludeTestIncrementsFailCount)
140
+ {
141
+ _U_UINT savedFails = Unity.TestFailures;
142
+ _U_UINT savedIgnores = Unity.TestIgnores;
143
+ UnityOutputCharSpy_Enable(1);
144
+ Unity.CurrentTestFailed = 1;
145
+ UnityConcludeFixtureTest(); // Resets TestFailed for this test to pass
146
+ Unity.CurrentTestIgnored = 1;
147
+ UnityConcludeFixtureTest(); // Resets TestIgnored
148
+ UnityOutputCharSpy_Enable(0);
149
+ TEST_ASSERT_EQUAL(savedFails + 1, Unity.TestFailures);
150
+ TEST_ASSERT_EQUAL(savedIgnores + 1, Unity.TestIgnores);
151
+ Unity.TestFailures = savedFails;
152
+ Unity.TestIgnores = savedIgnores;
153
+ }
154
+
141
155
  //------------------------------------------------------------
142
156
 
143
157
  TEST_GROUP(UnityCommandOptions);
@@ -278,6 +292,21 @@ TEST(UnityCommandOptions, UnknownCommandIsIgnored)
278
292
  TEST_ASSERT_EQUAL(98, UnityFixture.RepeatCount);
279
293
  }
280
294
 
295
+ TEST(UnityCommandOptions, GroupOrNameFilterWithoutStringFails)
296
+ {
297
+ TEST_ASSERT_EQUAL(1, UnityGetCommandLineOptions(3, unknownCommand));
298
+ TEST_ASSERT_EQUAL(1, UnityGetCommandLineOptions(5, unknownCommand));
299
+ TEST_ASSERT_EQUAL(1, UnityMain(3, unknownCommand, NULL));
300
+ }
301
+
302
+ TEST(UnityCommandOptions, GroupFilterReallyFilters)
303
+ {
304
+ _U_UINT saved = Unity.NumberOfTests;
305
+ TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(4, unknownCommand));
306
+ UnityIgnoreTest(NULL, "non-matching", NULL);
307
+ TEST_ASSERT_EQUAL(saved, Unity.NumberOfTests);
308
+ }
309
+
281
310
  IGNORE_TEST(UnityCommandOptions, TestShouldBeIgnored)
282
311
  {
283
312
  TEST_FAIL_MESSAGE("This test should not run!");
@@ -314,6 +343,9 @@ TEST_TEAR_DOWN(LeakDetection)
314
343
  }
315
344
 
316
345
  // This tricky set of defines lets us see if we are using the Spy, returns 1 if true
346
+ #ifdef __STDC_VERSION__
347
+
348
+ #if __STDC_VERSION__ >= 199901L
317
349
  #define USING_SPY_AS(a) EXPAND_AND_USE_2ND(ASSIGN_VALUE(a), 0)
318
350
  #define ASSIGN_VALUE(a) VAL_##a
319
351
  #define VAL_UnityOutputCharSpy_OutputChar 0, 1
@@ -322,6 +354,16 @@ TEST_TEAR_DOWN(LeakDetection)
322
354
  #if USING_SPY_AS(UNITY_OUTPUT_CHAR)
323
355
  #define USING_OUTPUT_SPY // UNITY_OUTPUT_CHAR = UnityOutputCharSpy_OutputChar
324
356
  #endif
357
+ #endif // >= 199901
358
+
359
+ #else // __STDC_VERSION__ else
360
+ #define UnityOutputCharSpy_OutputChar 42
361
+ #if UNITY_OUTPUT_CHAR == UnityOutputCharSpy_OutputChar // Works if no -Wundef -Werror
362
+ #define USING_OUTPUT_SPY
363
+ #endif
364
+ #undef UnityOutputCharSpy_OutputChar
365
+ #endif // __STDC_VERSION__
366
+
325
367
  TEST(LeakDetection, DetectsLeak)
326
368
  {
327
369
  #ifndef USING_OUTPUT_SPY
@@ -343,12 +385,11 @@ TEST(LeakDetection, DetectsLeak)
343
385
  TEST(LeakDetection, BufferOverrunFoundDuringFree)
344
386
  {
345
387
  #ifndef USING_OUTPUT_SPY
346
- UNITY_PRINT_EOL();
347
388
  TEST_IGNORE();
348
389
  #else
349
390
  void* m = malloc(10);
350
- TEST_ASSERT_NOT_NULL(m);
351
391
  char* s = (char*)m;
392
+ TEST_ASSERT_NOT_NULL(m);
352
393
  s[10] = (char)0xFF;
353
394
  UnityOutputCharSpy_Enable(1);
354
395
  EXPECT_ABORT_BEGIN
@@ -363,12 +404,11 @@ TEST(LeakDetection, BufferOverrunFoundDuringFree)
363
404
  TEST(LeakDetection, BufferOverrunFoundDuringRealloc)
364
405
  {
365
406
  #ifndef USING_OUTPUT_SPY
366
- UNITY_PRINT_EOL();
367
407
  TEST_IGNORE();
368
408
  #else
369
409
  void* m = malloc(10);
370
- TEST_ASSERT_NOT_NULL(m);
371
410
  char* s = (char*)m;
411
+ TEST_ASSERT_NOT_NULL(m);
372
412
  s[10] = (char)0xFF;
373
413
  UnityOutputCharSpy_Enable(1);
374
414
  EXPECT_ABORT_BEGIN
@@ -383,12 +423,11 @@ TEST(LeakDetection, BufferOverrunFoundDuringRealloc)
383
423
  TEST(LeakDetection, BufferGuardWriteFoundDuringFree)
384
424
  {
385
425
  #ifndef USING_OUTPUT_SPY
386
- UNITY_PRINT_EOL();
387
426
  TEST_IGNORE();
388
427
  #else
389
428
  void* m = malloc(10);
390
- TEST_ASSERT_NOT_NULL(m);
391
429
  char* s = (char*)m;
430
+ TEST_ASSERT_NOT_NULL(m);
392
431
  s[-1] = (char)0x00; // Will not detect 0
393
432
  s[-2] = (char)0x01;
394
433
  UnityOutputCharSpy_Enable(1);
@@ -404,12 +443,11 @@ TEST(LeakDetection, BufferGuardWriteFoundDuringFree)
404
443
  TEST(LeakDetection, BufferGuardWriteFoundDuringRealloc)
405
444
  {
406
445
  #ifndef USING_OUTPUT_SPY
407
- UNITY_PRINT_EOL();
408
446
  TEST_IGNORE();
409
447
  #else
410
448
  void* m = malloc(10);
411
- TEST_ASSERT_NOT_NULL(m);
412
449
  char* s = (char*)m;
450
+ TEST_ASSERT_NOT_NULL(m);
413
451
  s[-1] = (char)0x0A;
414
452
  UnityOutputCharSpy_Enable(1);
415
453
  EXPECT_ABORT_BEGIN
@@ -424,7 +462,6 @@ TEST(LeakDetection, BufferGuardWriteFoundDuringRealloc)
424
462
  TEST(LeakDetection, PointerSettingMax)
425
463
  {
426
464
  #ifndef USING_OUTPUT_SPY
427
- UNITY_PRINT_EOL();
428
465
  TEST_IGNORE();
429
466
  #else
430
467
  int i;
@@ -450,8 +487,8 @@ TEST(InternalMalloc, MallocPastBufferFails)
450
487
  {
451
488
  #ifdef UNITY_EXCLUDE_STDLIB_MALLOC
452
489
  void* m = malloc(UNITY_INTERNAL_HEAP_SIZE_BYTES/2 + 1);
453
- TEST_ASSERT_NOT_NULL(m);
454
490
  void* n = malloc(UNITY_INTERNAL_HEAP_SIZE_BYTES/2);
491
+ TEST_ASSERT_NOT_NULL(m);
455
492
  TEST_ASSERT_NULL(n);
456
493
  free(m);
457
494
  #endif
@@ -461,8 +498,8 @@ TEST(InternalMalloc, CallocPastBufferFails)
461
498
  {
462
499
  #ifdef UNITY_EXCLUDE_STDLIB_MALLOC
463
500
  void* m = calloc(1, UNITY_INTERNAL_HEAP_SIZE_BYTES/2 + 1);
464
- TEST_ASSERT_NOT_NULL(m);
465
501
  void* n = calloc(1, UNITY_INTERNAL_HEAP_SIZE_BYTES/2);
502
+ TEST_ASSERT_NOT_NULL(m);
466
503
  TEST_ASSERT_NULL(n);
467
504
  free(m);
468
505
  #endif
@@ -472,8 +509,8 @@ TEST(InternalMalloc, MallocThenReallocGrowsMemoryInPlace)
472
509
  {
473
510
  #ifdef UNITY_EXCLUDE_STDLIB_MALLOC
474
511
  void* m = malloc(UNITY_INTERNAL_HEAP_SIZE_BYTES/2 + 1);
475
- TEST_ASSERT_NOT_NULL(m);
476
512
  void* n = realloc(m, UNITY_INTERNAL_HEAP_SIZE_BYTES/2 + 9);
513
+ TEST_ASSERT_NOT_NULL(m);
477
514
  TEST_ASSERT_EQUAL(m, n);
478
515
  free(n);
479
516
  #endif
@@ -483,14 +520,17 @@ TEST(InternalMalloc, ReallocFailDoesNotFreeMem)
483
520
  {
484
521
  #ifdef UNITY_EXCLUDE_STDLIB_MALLOC
485
522
  void* m = malloc(UNITY_INTERNAL_HEAP_SIZE_BYTES/2);
486
- TEST_ASSERT_NOT_NULL(m);
487
523
  void* n1 = malloc(10);
488
524
  void* out_of_mem = realloc(n1, UNITY_INTERNAL_HEAP_SIZE_BYTES/2 + 1);
489
- TEST_ASSERT_NULL(out_of_mem);
490
525
  void* n2 = malloc(10);
526
+ TEST_ASSERT_NOT_NULL(m);
527
+ if (out_of_mem == NULL)
528
+ {
529
+ free(n1);
530
+ TEST_ASSERT_NULL(out_of_mem);
531
+ }
491
532
  TEST_ASSERT_NOT_EQUAL(n2, n1);
492
533
  free(n2);
493
- free(n1);
494
534
  free(m);
495
535
  #endif
496
536
  }
@@ -19,6 +19,7 @@ TEST_GROUP_RUNNER(UnityFixture)
19
19
  RUN_TEST_CASE(UnityFixture, CallocFillsWithZero);
20
20
  RUN_TEST_CASE(UnityFixture, PointerSet);
21
21
  RUN_TEST_CASE(UnityFixture, FreeNULLSafety);
22
+ RUN_TEST_CASE(UnityFixture, ConcludeTestIncrementsFailCount);
22
23
  }
23
24
 
24
25
  TEST_GROUP_RUNNER(UnityCommandOptions)
@@ -32,6 +33,8 @@ TEST_GROUP_RUNNER(UnityCommandOptions)
32
33
  RUN_TEST_CASE(UnityCommandOptions, MultipleOptions);
33
34
  RUN_TEST_CASE(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified);
34
35
  RUN_TEST_CASE(UnityCommandOptions, UnknownCommandIsIgnored);
36
+ RUN_TEST_CASE(UnityCommandOptions, GroupOrNameFilterWithoutStringFails);
37
+ RUN_TEST_CASE(UnityCommandOptions, GroupFilterReallyFilters);
35
38
  RUN_TEST_CASE(UnityCommandOptions, TestShouldBeIgnored);
36
39
  }
37
40
 
@@ -19,7 +19,7 @@ static int spy_enable;
19
19
 
20
20
  void UnityOutputCharSpy_Create(int s)
21
21
  {
22
- size = s;
22
+ size = (s > 0) ? s : 0;
23
23
  count = 0;
24
24
  spy_enable = 0;
25
25
  buffer = malloc((size_t)size);
@@ -33,7 +33,7 @@ void UnityOutputCharSpy_Destroy(void)
33
33
  free(buffer);
34
34
  }
35
35
 
36
- int UnityOutputCharSpy_OutputChar(int c)
36
+ void UnityOutputCharSpy_OutputChar(int c)
37
37
  {
38
38
  if (spy_enable)
39
39
  {
@@ -44,7 +44,6 @@ int UnityOutputCharSpy_OutputChar(int c)
44
44
  {
45
45
  putchar(c);
46
46
  }
47
- return c;
48
47
  }
49
48
 
50
49
  const char * UnityOutputCharSpy_Get(void)
@@ -10,7 +10,7 @@
10
10
 
11
11
  void UnityOutputCharSpy_Create(int s);
12
12
  void UnityOutputCharSpy_Destroy(void);
13
- int UnityOutputCharSpy_OutputChar(int c);
13
+ void UnityOutputCharSpy_OutputChar(int c);
14
14
  const char * UnityOutputCharSpy_Get(void);
15
15
  void UnityOutputCharSpy_Enable(int enable);
16
16
 
@@ -1,2 +1,2 @@
1
- 2.3.0
1
+ 2.3.2
2
2
 
@@ -7,57 +7,64 @@
7
7
  #include "unity.h"
8
8
  #include <stddef.h>
9
9
 
10
+ /* If omitted from header, declare overrideable prototypes here so they're ready for use */
11
+ #ifdef UNITY_OMIT_OUTPUT_CHAR_HEADER_DECLARATION
12
+ void UNITY_OUTPUT_CHAR(int);
13
+ #endif
14
+
15
+ /* Helpful macros for us to use here */
10
16
  #define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; longjmp(Unity.AbortFrame, 1); }
11
17
  #define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; longjmp(Unity.AbortFrame, 1); }
12
- /// return prematurely if we are already in failure or ignore state
18
+
19
+ /* return prematurely if we are already in failure or ignore state */
13
20
  #define UNITY_SKIP_EXECUTION { if ((Unity.CurrentTestFailed != 0) || (Unity.CurrentTestIgnored != 0)) {return;} }
14
21
 
15
22
  struct _Unity Unity;
16
23
 
17
- const char UnityStrOk[] = "OK";
18
- const char UnityStrPass[] = "PASS";
19
- const char UnityStrFail[] = "FAIL";
20
- const char UnityStrIgnore[] = "IGNORE";
21
- const char UnityStrNull[] = "NULL";
22
- const char UnityStrSpacer[] = ". ";
23
- const char UnityStrExpected[] = " Expected ";
24
- const char UnityStrWas[] = " Was ";
25
- const char UnityStrTo[] = " To ";
26
- const char UnityStrElement[] = " Element ";
27
- const char UnityStrByte[] = " Byte ";
28
- const char UnityStrMemory[] = " Memory Mismatch.";
29
- const char UnityStrDelta[] = " Values Not Within Delta ";
30
- const char UnityStrPointless[] = " You Asked Me To Compare Nothing, Which Was Pointless.";
31
- const char UnityStrNullPointerForExpected[] = " Expected pointer to be NULL";
32
- const char UnityStrNullPointerForActual[] = " Actual pointer was NULL";
33
- const char UnityStrNot[] = "Not ";
34
- const char UnityStrInf[] = "Infinity";
35
- const char UnityStrNegInf[] = "Negative Infinity";
36
- const char UnityStrNaN[] = "NaN";
37
- const char UnityStrDet[] = "Determinate";
38
- const char UnityStrErrFloat[] = "Unity Floating Point Disabled";
39
- const char UnityStrErrDouble[] = "Unity Double Precision Disabled";
40
- const char UnityStrErr64[] = "Unity 64-bit Support Disabled";
41
- const char UnityStrBreaker[] = "-----------------------";
42
- const char UnityStrResultsTests[] = " Tests ";
43
- const char UnityStrResultsFailures[] = " Failures ";
44
- const char UnityStrResultsIgnored[] = " Ignored ";
45
- const char UnityStrDetail1Name[] = UNITY_DETAIL1_NAME " ";
46
- const char UnityStrDetail2Name[] = " " UNITY_DETAIL2_NAME " ";
24
+ static const char UnityStrOk[] = "OK";
25
+ static const char UnityStrPass[] = "PASS";
26
+ static const char UnityStrFail[] = "FAIL";
27
+ static const char UnityStrIgnore[] = "IGNORE";
28
+ static const char UnityStrNull[] = "NULL";
29
+ static const char UnityStrSpacer[] = ". ";
30
+ static const char UnityStrExpected[] = " Expected ";
31
+ static const char UnityStrWas[] = " Was ";
32
+ static const char UnityStrElement[] = " Element ";
33
+ static const char UnityStrByte[] = " Byte ";
34
+ static const char UnityStrMemory[] = " Memory Mismatch.";
35
+ static const char UnityStrDelta[] = " Values Not Within Delta ";
36
+ static const char UnityStrPointless[] = " You Asked Me To Compare Nothing, Which Was Pointless.";
37
+ static const char UnityStrNullPointerForExpected[] = " Expected pointer to be NULL";
38
+ static const char UnityStrNullPointerForActual[] = " Actual pointer was NULL";
39
+ static const char UnityStrNot[] = "Not ";
40
+ static const char UnityStrInf[] = "Infinity";
41
+ static const char UnityStrNegInf[] = "Negative Infinity";
42
+ static const char UnityStrNaN[] = "NaN";
43
+ static const char UnityStrDet[] = "Determinate";
44
+ static const char UnityStrInvalidFloatTrait[] = "Invalid Float Trait";
45
+ const char UnityStrErrFloat[] = "Unity Floating Point Disabled";
46
+ const char UnityStrErrDouble[] = "Unity Double Precision Disabled";
47
+ const char UnityStrErr64[] = "Unity 64-bit Support Disabled";
48
+ static const char UnityStrBreaker[] = "-----------------------";
49
+ static const char UnityStrResultsTests[] = " Tests ";
50
+ static const char UnityStrResultsFailures[] = " Failures ";
51
+ static const char UnityStrResultsIgnored[] = " Ignored ";
52
+ static const char UnityStrDetail1Name[] = UNITY_DETAIL1_NAME " ";
53
+ static const char UnityStrDetail2Name[] = " " UNITY_DETAIL2_NAME " ";
47
54
 
48
55
  #ifdef UNITY_FLOAT_NEEDS_ZERO
49
- // Dividing by these constants produces +/- infinity.
50
- // The rationale is given in UnityAssertFloatIsInf's body.
56
+ /* Dividing by these constants produces +/- infinity.
57
+ * The rationale is given in UnityAssertFloatIsInf's body. */
51
58
  static const _UF f_zero = 0.0f;
52
59
  #endif
53
60
 
54
- // compiler-generic print formatting masks
55
- const _U_UINT UnitySizeMask[] =
61
+ /* compiler-generic print formatting masks */
62
+ static const _U_UINT UnitySizeMask[] =
56
63
  {
57
- 255u, // 0xFF
58
- 65535u, // 0xFFFF
64
+ 255u, /* 0xFF */
65
+ 65535u, /* 0xFFFF */
59
66
  65535u,
60
- 4294967295u, // 0xFFFFFFFF
67
+ 4294967295u, /* 0xFFFFFFFF */
61
68
  4294967295u,
62
69
  4294967295u,
63
70
  4294967295u
@@ -66,12 +73,9 @@ const _U_UINT UnitySizeMask[] =
66
73
  #endif
67
74
  };
68
75
 
69
- void UnityPrintFail(void);
70
- void UnityPrintOk(void);
71
-
72
- //-----------------------------------------------
73
- // Pretty Printers & Test Result Output Handlers
74
- //-----------------------------------------------
76
+ /*-----------------------------------------------
77
+ * Pretty Printers & Test Result Output Handlers
78
+ *-----------------------------------------------*/
75
79
 
76
80
  void UnityPrint(const char* string)
77
81
  {
@@ -81,24 +85,24 @@ void UnityPrint(const char* string)
81
85
  {
82
86
  while (*pch)
83
87
  {
84
- // printable characters plus CR & LF are printed
88
+ /* printable characters plus CR & LF are printed */
85
89
  if ((*pch <= 126) && (*pch >= 32))
86
90
  {
87
91
  UNITY_OUTPUT_CHAR(*pch);
88
92
  }
89
- //write escaped carriage returns
93
+ /* write escaped carriage returns */
90
94
  else if (*pch == 13)
91
95
  {
92
96
  UNITY_OUTPUT_CHAR('\\');
93
97
  UNITY_OUTPUT_CHAR('r');
94
98
  }
95
- //write escaped line feeds
99
+ /* write escaped line feeds */
96
100
  else if (*pch == 10)
97
101
  {
98
102
  UNITY_OUTPUT_CHAR('\\');
99
103
  UNITY_OUTPUT_CHAR('n');
100
104
  }
101
- // unprintable characters are shown as codes
105
+ /* unprintable characters are shown as codes */
102
106
  else
103
107
  {
104
108
  UNITY_OUTPUT_CHAR('\\');
@@ -118,24 +122,24 @@ void UnityPrintLen(const char* string, const _UU32 length)
118
122
  {
119
123
  while (*pch && (_UU32)(pch - string) < length)
120
124
  {
121
- // printable characters plus CR & LF are printed
125
+ /* printable characters plus CR & LF are printed */
122
126
  if ((*pch <= 126) && (*pch >= 32))
123
127
  {
124
128
  UNITY_OUTPUT_CHAR(*pch);
125
129
  }
126
- //write escaped carriage returns
130
+ /* write escaped carriage returns */
127
131
  else if (*pch == 13)
128
132
  {
129
133
  UNITY_OUTPUT_CHAR('\\');
130
134
  UNITY_OUTPUT_CHAR('r');
131
135
  }
132
- //write escaped line feeds
136
+ /* write escaped line feeds */
133
137
  else if (*pch == 10)
134
138
  {
135
139
  UNITY_OUTPUT_CHAR('\\');
136
140
  UNITY_OUTPUT_CHAR('n');
137
141
  }
138
- // unprintable characters are shown as codes
142
+ /* unprintable characters are shown as codes */
139
143
  else
140
144
  {
141
145
  UNITY_OUTPUT_CHAR('\\');
@@ -146,7 +150,7 @@ void UnityPrintLen(const char* string, const _UU32 length)
146
150
  }
147
151
  }
148
152
 
149
- //-----------------------------------------------
153
+ /*-----------------------------------------------*/
150
154
  void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style)
151
155
  {
152
156
  if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
@@ -163,63 +167,33 @@ void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T s
163
167
  }
164
168
  }
165
169
 
166
- //-----------------------------------------------
167
- /// basically do an itoa using as little ram as possible
170
+ /*-----------------------------------------------*/
168
171
  void UnityPrintNumber(const _U_SINT number_to_print)
169
172
  {
170
- _U_UINT divisor = 1;
171
- _U_UINT next_divisor;
172
- _U_UINT number;
173
+ _U_UINT number = (_U_UINT)number_to_print;
173
174
 
174
175
  if (number_to_print < 0)
175
176
  {
176
- //A negative number, including MIN negative
177
+ /* A negative number, including MIN negative */
177
178
  UNITY_OUTPUT_CHAR('-');
178
179
  number = (_U_UINT)(-number_to_print);
179
180
  }
180
- else
181
- {
182
- //Non-negative number
183
- number = (_U_UINT)number_to_print;
184
- }
185
-
186
- // figure out initial divisor
187
- while (number / divisor > 9)
188
- {
189
- next_divisor = divisor * 10;
190
- if (next_divisor > divisor)
191
- divisor = next_divisor;
192
- else
193
- break;
194
- }
195
-
196
- // now mod and print, then divide divisor
197
- do
198
- {
199
- UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10)));
200
- divisor /= 10;
201
- }
202
- while (divisor > 0);
181
+ UnityPrintNumberUnsigned(number);
203
182
  }
204
183
 
205
- //-----------------------------------------------
206
- /// basically do an itoa using as little ram as possible
184
+ /*-----------------------------------------------
185
+ * basically do an itoa using as little ram as possible */
207
186
  void UnityPrintNumberUnsigned(const _U_UINT number)
208
187
  {
209
188
  _U_UINT divisor = 1;
210
- _U_UINT next_divisor;
211
189
 
212
- // figure out initial divisor
190
+ /* figure out initial divisor */
213
191
  while (number / divisor > 9)
214
192
  {
215
- next_divisor = divisor * 10;
216
- if (next_divisor > divisor)
217
- divisor = next_divisor;
218
- else
219
- break;
193
+ divisor *= 10;
220
194
  }
221
195
 
222
- // now mod and print, then divide divisor
196
+ /* now mod and print, then divide divisor */
223
197
  do
224
198
  {
225
199
  UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10)));
@@ -228,7 +202,7 @@ void UnityPrintNumberUnsigned(const _U_UINT number)
228
202
  while (divisor > 0);
229
203
  }
230
204
 
231
- //-----------------------------------------------
205
+ /*-----------------------------------------------*/
232
206
  void UnityPrintNumberHex(const _U_UINT number, const char nibbles_to_print)
233
207
  {
234
208
  _U_UINT nibble;
@@ -250,7 +224,7 @@ void UnityPrintNumberHex(const _U_UINT number, const char nibbles_to_print)
250
224
  }
251
225
  }
252
226
 
253
- //-----------------------------------------------
227
+ /*-----------------------------------------------*/
254
228
  void UnityPrintMask(const _U_UINT mask, const _U_UINT number)
255
229
  {
256
230
  _U_UINT current_bit = (_U_UINT)1 << (UNITY_INT_WIDTH - 1);
@@ -277,7 +251,7 @@ void UnityPrintMask(const _U_UINT mask, const _U_UINT number)
277
251
  }
278
252
  }
279
253
 
280
- //-----------------------------------------------
254
+ /*-----------------------------------------------*/
281
255
  #ifdef UNITY_FLOAT_VERBOSE
282
256
  #include <stdio.h>
283
257
 
@@ -297,7 +271,7 @@ void UnityPrintFloat(_UF number)
297
271
  }
298
272
  #endif
299
273
 
300
- //-----------------------------------------------
274
+ /*-----------------------------------------------*/
301
275
 
302
276
  void UnityPrintFail(void);
303
277
  void UnityPrintFail(void)
@@ -311,7 +285,7 @@ void UnityPrintOk(void)
311
285
  UnityPrint(UnityStrOk);
312
286
  }
313
287
 
314
- //-----------------------------------------------
288
+ /*-----------------------------------------------*/
315
289
  static void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line);
316
290
  static void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line)
317
291
  {
@@ -328,7 +302,7 @@ static void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line)
328
302
  #endif
329
303
  }
330
304
 
331
- //-----------------------------------------------
305
+ /*-----------------------------------------------*/
332
306
  static void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line);
333
307
  static void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line)
334
308
  {
@@ -341,7 +315,7 @@ static void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line)
341
315
  UNITY_OUTPUT_CHAR(':');
342
316
  }
343
317
 
344
- //-----------------------------------------------
318
+ /*-----------------------------------------------*/
345
319
  void UnityConcludeTest(void)
346
320
  {
347
321
  if (Unity.CurrentTestIgnored)
@@ -361,9 +335,10 @@ void UnityConcludeTest(void)
361
335
  Unity.CurrentTestFailed = 0;
362
336
  Unity.CurrentTestIgnored = 0;
363
337
  UNITY_PRINT_EOL();
338
+ UNITY_FLUSH_CALL();
364
339
  }
365
340
 
366
- //-----------------------------------------------
341
+ /*-----------------------------------------------*/
367
342
  static void UnityAddMsgIfSpecified(const char* msg);
368
343
  static void UnityAddMsgIfSpecified(const char* msg)
369
344
  {
@@ -387,7 +362,7 @@ static void UnityAddMsgIfSpecified(const char* msg)
387
362
  }
388
363
  }
389
364
 
390
- //-----------------------------------------------
365
+ /*-----------------------------------------------*/
391
366
  static void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual);
392
367
  static void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual)
393
368
  {
@@ -415,7 +390,7 @@ static void UnityPrintExpectedAndActualStrings(const char* expected, const char*
415
390
  }
416
391
  }
417
392
 
418
- //-----------------------------------------------
393
+ /*-----------------------------------------------*/
419
394
  static void UnityPrintExpectedAndActualStringsLen(const char* expected, const char* actual, const _UU32 length)
420
395
  {
421
396
  UnityPrint(UnityStrExpected);
@@ -444,17 +419,17 @@ static void UnityPrintExpectedAndActualStringsLen(const char* expected, const ch
444
419
 
445
420
 
446
421
 
447
- //-----------------------------------------------
448
- // Assertion & Control Helpers
449
- //-----------------------------------------------
422
+ /*-----------------------------------------------
423
+ * Assertion & Control Helpers
424
+ *-----------------------------------------------*/
450
425
 
451
426
  static int UnityCheckArraysForNull(UNITY_INTERNAL_PTR expected, UNITY_INTERNAL_PTR actual, const UNITY_LINE_TYPE lineNumber, const char* msg)
452
427
  {
453
- //return true if they are both NULL
428
+ /* return true if they are both NULL */
454
429
  if ((expected == NULL) && (actual == NULL))
455
430
  return 1;
456
431
 
457
- //throw error if just expected is NULL
432
+ /* throw error if just expected is NULL */
458
433
  if (expected == NULL)
459
434
  {
460
435
  UnityTestResultsFailBegin(lineNumber);
@@ -463,7 +438,7 @@ static int UnityCheckArraysForNull(UNITY_INTERNAL_PTR expected, UNITY_INTERNAL_P
463
438
  UNITY_FAIL_AND_BAIL;
464
439
  }
465
440
 
466
- //throw error if just actual is NULL
441
+ /* throw error if just actual is NULL */
467
442
  if (actual == NULL)
468
443
  {
469
444
  UnityTestResultsFailBegin(lineNumber);
@@ -472,13 +447,13 @@ static int UnityCheckArraysForNull(UNITY_INTERNAL_PTR expected, UNITY_INTERNAL_P
472
447
  UNITY_FAIL_AND_BAIL;
473
448
  }
474
449
 
475
- //return false if neither is NULL
450
+ /* return false if neither is NULL */
476
451
  return 0;
477
452
  }
478
453
 
479
- //-----------------------------------------------
480
- // Assertion Functions
481
- //-----------------------------------------------
454
+ /*-----------------------------------------------
455
+ * Assertion Functions
456
+ *-----------------------------------------------*/
482
457
 
483
458
  void UnityAssertBits(const _U_SINT mask,
484
459
  const _U_SINT expected,
@@ -500,7 +475,7 @@ void UnityAssertBits(const _U_SINT mask,
500
475
  }
501
476
  }
502
477
 
503
- //-----------------------------------------------
478
+ /*-----------------------------------------------*/
504
479
  void UnityAssertEqualNumber(const _U_SINT expected,
505
480
  const _U_SINT actual,
506
481
  const char* msg,
@@ -521,7 +496,14 @@ void UnityAssertEqualNumber(const _U_SINT expected,
521
496
  }
522
497
  }
523
498
 
524
- //-----------------------------------------------
499
+ #define UnityPrintPointlessAndBail() \
500
+ { \
501
+ UnityTestResultsFailBegin(lineNumber); \
502
+ UnityPrint(UnityStrPointless); \
503
+ UnityAddMsgIfSpecified(msg); \
504
+ UNITY_FAIL_AND_BAIL; }
505
+
506
+ /*-----------------------------------------------*/
525
507
  void UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,
526
508
  UNITY_INTERNAL_PTR actual,
527
509
  const _UU32 num_elements,
@@ -537,18 +519,15 @@ void UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,
537
519
 
538
520
  if (elements == 0)
539
521
  {
540
- UnityTestResultsFailBegin(lineNumber);
541
- UnityPrint(UnityStrPointless);
542
- UnityAddMsgIfSpecified(msg);
543
- UNITY_FAIL_AND_BAIL;
522
+ UnityPrintPointlessAndBail();
544
523
  }
545
524
 
546
525
  if (UnityCheckArraysForNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg) == 1)
547
526
  return;
548
527
 
549
- // If style is UNITY_DISPLAY_STYLE_INT, we'll fall into the default case rather than the INT16 or INT32 (etc) case
550
- // as UNITY_DISPLAY_STYLE_INT includes a flag for UNITY_DISPLAY_RANGE_AUTO, which the width-specific
551
- // variants do not. Therefore remove this flag.
528
+ /* If style is UNITY_DISPLAY_STYLE_INT, we'll fall into the default case rather than the INT16 or INT32 (etc) case
529
+ * as UNITY_DISPLAY_STYLE_INT includes a flag for UNITY_DISPLAY_RANGE_AUTO, which the width-specific
530
+ * variants do not. Therefore remove this flag. */
552
531
  switch(style & (UNITY_DISPLAY_STYLE_T)(~UNITY_DISPLAY_RANGE_AUTO))
553
532
  {
554
533
  case UNITY_DISPLAY_STYLE_HEX8:
@@ -638,7 +617,7 @@ void UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,
638
617
  }
639
618
  }
640
619
 
641
- //-----------------------------------------------
620
+ /*-----------------------------------------------*/
642
621
  #ifndef UNITY_EXCLUDE_FLOAT
643
622
  void UnityAssertEqualFloatArray(UNITY_PTR_ATTRIBUTE const _UF* expected,
644
623
  UNITY_PTR_ATTRIBUTE const _UF* actual,
@@ -655,10 +634,7 @@ void UnityAssertEqualFloatArray(UNITY_PTR_ATTRIBUTE const _UF* expected,
655
634
 
656
635
  if (elements == 0)
657
636
  {
658
- UnityTestResultsFailBegin(lineNumber);
659
- UnityPrint(UnityStrPointless);
660
- UnityAddMsgIfSpecified(msg);
661
- UNITY_FAIL_AND_BAIL;
637
+ UnityPrintPointlessAndBail();
662
638
  }
663
639
 
664
640
  if (UnityCheckArraysForNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg) == 1)
@@ -668,13 +644,13 @@ void UnityAssertEqualFloatArray(UNITY_PTR_ATTRIBUTE const _UF* expected,
668
644
  {
669
645
  diff = *ptr_expected - *ptr_actual;
670
646
  if (diff < 0.0f)
671
- diff = 0.0f - diff;
647
+ diff = 0.0f - diff;
672
648
  tol = UNITY_FLOAT_PRECISION * *ptr_expected;
673
649
  if (tol < 0.0f)
674
650
  tol = 0.0f - tol;
675
651
 
676
- //This first part of this condition will catch any NaN or Infinite values
677
- if ((diff * 0.0f != 0.0f) || (diff > tol))
652
+ /* This first part of this condition will catch any NaN or Infinite values */
653
+ if (isnan(diff) || isinf(diff) || (diff > tol))
678
654
  {
679
655
  UnityTestResultsFailBegin(lineNumber);
680
656
  UnityPrint(UnityStrElement);
@@ -695,7 +671,7 @@ void UnityAssertEqualFloatArray(UNITY_PTR_ATTRIBUTE const _UF* expected,
695
671
  }
696
672
  }
697
673
 
698
- //-----------------------------------------------
674
+ /*-----------------------------------------------*/
699
675
  void UnityAssertFloatsWithin(const _UF delta,
700
676
  const _UF expected,
701
677
  const _UF actual,
@@ -716,8 +692,8 @@ void UnityAssertFloatsWithin(const _UF delta,
716
692
  pos_delta = 0.0f - pos_delta;
717
693
  }
718
694
 
719
- //This first part of this condition will catch any NaN or Infinite values
720
- if ((diff * 0.0f != 0.0f) || (pos_delta < diff))
695
+ /* This first part of this condition will catch any NaN or Infinite values */
696
+ if (isnan(diff) || isinf(diff) || (pos_delta < diff))
721
697
  {
722
698
  UnityTestResultsFailBegin(lineNumber);
723
699
  #ifdef UNITY_FLOAT_VERBOSE
@@ -733,7 +709,7 @@ void UnityAssertFloatsWithin(const _UF delta,
733
709
  }
734
710
  }
735
711
 
736
- //-----------------------------------------------
712
+ /*-----------------------------------------------*/
737
713
  void UnityAssertFloatSpecial(const _UF actual,
738
714
  const char* msg,
739
715
  const UNITY_LINE_TYPE lineNumber,
@@ -748,8 +724,8 @@ void UnityAssertFloatSpecial(const _UF actual,
748
724
 
749
725
  switch(style)
750
726
  {
751
- //To determine Inf / Neg Inf, we compare to an Inf / Neg Inf value we create on the fly
752
- //We are using a variable to hold the zero value because some compilers complain about dividing by zero otherwise
727
+ /* To determine Inf / Neg Inf, we compare to an Inf / Neg Inf value we create on the fly
728
+ * We are using a variable to hold the zero value because some compilers complain about dividing by zero otherwise */
753
729
  case UNITY_FLOAT_IS_INF:
754
730
  case UNITY_FLOAT_IS_NOT_INF:
755
731
  is_trait = isinf(actual) & ispos(actual);
@@ -759,13 +735,13 @@ void UnityAssertFloatSpecial(const _UF actual,
759
735
  is_trait = isinf(actual) & isneg(actual);
760
736
  break;
761
737
 
762
- //NaN is the only floating point value that does NOT equal itself. Therefore if Actual == Actual, then it is NOT NaN.
738
+ /* NaN is the only floating point value that does NOT equal itself. Therefore if Actual == Actual, then it is NOT NaN. */
763
739
  case UNITY_FLOAT_IS_NAN:
764
740
  case UNITY_FLOAT_IS_NOT_NAN:
765
741
  is_trait = isnan(actual);
766
742
  break;
767
743
 
768
- //A determinate number is non infinite and not NaN. (therefore the opposite of the two above)
744
+ /* A determinate number is non infinite and not NaN. (therefore the opposite of the two above) */
769
745
  case UNITY_FLOAT_IS_DET:
770
746
  case UNITY_FLOAT_IS_NOT_DET:
771
747
  if (isinf(actual) | isnan(actual))
@@ -775,6 +751,8 @@ void UnityAssertFloatSpecial(const _UF actual,
775
751
  break;
776
752
 
777
753
  default:
754
+ trait_index = 0;
755
+ trait_names[0] = UnityStrInvalidFloatTrait;
778
756
  break;
779
757
  }
780
758
 
@@ -798,9 +776,9 @@ void UnityAssertFloatSpecial(const _UF actual,
798
776
  }
799
777
  }
800
778
 
801
- #endif //not UNITY_EXCLUDE_FLOAT
779
+ #endif /* not UNITY_EXCLUDE_FLOAT */
802
780
 
803
- //-----------------------------------------------
781
+ /*-----------------------------------------------*/
804
782
  #ifndef UNITY_EXCLUDE_DOUBLE
805
783
  void UnityAssertEqualDoubleArray(UNITY_PTR_ATTRIBUTE const _UD* expected,
806
784
  UNITY_PTR_ATTRIBUTE const _UD* actual,
@@ -817,10 +795,7 @@ void UnityAssertEqualDoubleArray(UNITY_PTR_ATTRIBUTE const _UD* expected,
817
795
 
818
796
  if (elements == 0)
819
797
  {
820
- UnityTestResultsFailBegin(lineNumber);
821
- UnityPrint(UnityStrPointless);
822
- UnityAddMsgIfSpecified(msg);
823
- UNITY_FAIL_AND_BAIL;
798
+ UnityPrintPointlessAndBail();
824
799
  }
825
800
 
826
801
  if (UnityCheckArraysForNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg) == 1)
@@ -835,8 +810,8 @@ void UnityAssertEqualDoubleArray(UNITY_PTR_ATTRIBUTE const _UD* expected,
835
810
  if (tol < 0.0)
836
811
  tol = 0.0 - tol;
837
812
 
838
- //This first part of this condition will catch any NaN or Infinite values
839
- if ((diff * 0.0 != 0.0) || (diff > tol))
813
+ /* This first part of this condition will catch any NaN or Infinite values */
814
+ if (isnan(diff) || isinf(diff) || (diff > tol))
840
815
  {
841
816
  UnityTestResultsFailBegin(lineNumber);
842
817
  UnityPrint(UnityStrElement);
@@ -857,7 +832,7 @@ void UnityAssertEqualDoubleArray(UNITY_PTR_ATTRIBUTE const _UD* expected,
857
832
  }
858
833
  }
859
834
 
860
- //-----------------------------------------------
835
+ /*-----------------------------------------------*/
861
836
  void UnityAssertDoublesWithin(const _UD delta,
862
837
  const _UD expected,
863
838
  const _UD actual,
@@ -878,8 +853,8 @@ void UnityAssertDoublesWithin(const _UD delta,
878
853
  pos_delta = 0.0 - pos_delta;
879
854
  }
880
855
 
881
- //This first part of this condition will catch any NaN or Infinite values
882
- if ((diff * 0.0 != 0.0) || (pos_delta < diff))
856
+ /* This first part of this condition will catch any NaN or Infinite values */
857
+ if (isnan(diff) || isinf(diff) || (pos_delta < diff))
883
858
  {
884
859
  UnityTestResultsFailBegin(lineNumber);
885
860
  #ifdef UNITY_DOUBLE_VERBOSE
@@ -895,7 +870,7 @@ void UnityAssertDoublesWithin(const _UD delta,
895
870
  }
896
871
  }
897
872
 
898
- //-----------------------------------------------
873
+ /*-----------------------------------------------*/
899
874
 
900
875
  void UnityAssertDoubleSpecial(const _UD actual,
901
876
  const char* msg,
@@ -905,14 +880,14 @@ void UnityAssertDoubleSpecial(const _UD actual,
905
880
  const char* trait_names[] = { UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet };
906
881
  _U_SINT should_be_trait = ((_U_SINT)style & 1);
907
882
  _U_SINT is_trait = !should_be_trait;
908
- _U_SINT trait_index = style >> 1;
883
+ _U_SINT trait_index = (_U_SINT)(style >> 1);
909
884
 
910
885
  UNITY_SKIP_EXECUTION;
911
886
 
912
887
  switch(style)
913
888
  {
914
- //To determine Inf / Neg Inf, we compare to an Inf / Neg Inf value we create on the fly
915
- //We are using a variable to hold the zero value because some compilers complain about dividing by zero otherwise
889
+ /* To determine Inf / Neg Inf, we compare to an Inf / Neg Inf value we create on the fly
890
+ * We are using a variable to hold the zero value because some compilers complain about dividing by zero otherwise */
916
891
  case UNITY_FLOAT_IS_INF:
917
892
  case UNITY_FLOAT_IS_NOT_INF:
918
893
  is_trait = isinf(actual) & ispos(actual);
@@ -922,13 +897,13 @@ void UnityAssertDoubleSpecial(const _UD actual,
922
897
  is_trait = isinf(actual) & isneg(actual);
923
898
  break;
924
899
 
925
- //NaN is the only floating point value that does NOT equal itself. Therefore if Actual == Actual, then it is NOT NaN.
900
+ /* NaN is the only floating point value that does NOT equal itself. Therefore if Actual == Actual, then it is NOT NaN. */
926
901
  case UNITY_FLOAT_IS_NAN:
927
902
  case UNITY_FLOAT_IS_NOT_NAN:
928
903
  is_trait = isnan(actual);
929
904
  break;
930
905
 
931
- //A determinate number is non infinite and not NaN. (therefore the opposite of the two above)
906
+ /* A determinate number is non infinite and not NaN. (therefore the opposite of the two above) */
932
907
  case UNITY_FLOAT_IS_DET:
933
908
  case UNITY_FLOAT_IS_NOT_DET:
934
909
  if (isinf(actual) | isnan(actual))
@@ -938,6 +913,8 @@ void UnityAssertDoubleSpecial(const _UD actual,
938
913
  break;
939
914
 
940
915
  default:
916
+ trait_index = 0;
917
+ trait_names[0] = UnityStrInvalidFloatTrait;
941
918
  break;
942
919
  }
943
920
 
@@ -962,9 +939,9 @@ void UnityAssertDoubleSpecial(const _UD actual,
962
939
  }
963
940
 
964
941
 
965
- #endif // not UNITY_EXCLUDE_DOUBLE
942
+ #endif /* not UNITY_EXCLUDE_DOUBLE */
966
943
 
967
- //-----------------------------------------------
944
+ /*-----------------------------------------------*/
968
945
  void UnityAssertNumbersWithin( const _U_UINT delta,
969
946
  const _U_SINT expected,
970
947
  const _U_SINT actual,
@@ -1003,7 +980,7 @@ void UnityAssertNumbersWithin( const _U_UINT delta,
1003
980
  }
1004
981
  }
1005
982
 
1006
- //-----------------------------------------------
983
+ /*-----------------------------------------------*/
1007
984
  void UnityAssertEqualString(const char* expected,
1008
985
  const char* actual,
1009
986
  const char* msg,
@@ -1013,7 +990,7 @@ void UnityAssertEqualString(const char* expected,
1013
990
 
1014
991
  UNITY_SKIP_EXECUTION;
1015
992
 
1016
- // if both pointers not null compare the strings
993
+ /* if both pointers not null compare the strings */
1017
994
  if (expected && actual)
1018
995
  {
1019
996
  for (i = 0; expected[i] || actual[i]; i++)
@@ -1026,7 +1003,7 @@ void UnityAssertEqualString(const char* expected,
1026
1003
  }
1027
1004
  }
1028
1005
  else
1029
- { // handle case of one pointers being null (if both null, test should pass)
1006
+ { /* handle case of one pointers being null (if both null, test should pass) */
1030
1007
  if (expected != actual)
1031
1008
  {
1032
1009
  Unity.CurrentTestFailed = 1;
@@ -1042,7 +1019,7 @@ void UnityAssertEqualString(const char* expected,
1042
1019
  }
1043
1020
  }
1044
1021
 
1045
- //-----------------------------------------------
1022
+ /*-----------------------------------------------*/
1046
1023
  void UnityAssertEqualStringLen(const char* expected,
1047
1024
  const char* actual,
1048
1025
  const _UU32 length,
@@ -1053,7 +1030,7 @@ void UnityAssertEqualStringLen(const char* expected,
1053
1030
 
1054
1031
  UNITY_SKIP_EXECUTION;
1055
1032
 
1056
- // if both pointers not null compare the strings
1033
+ /* if both pointers not null compare the strings */
1057
1034
  if (expected && actual)
1058
1035
  {
1059
1036
  for (i = 0; (expected[i] || actual[i]) && i < length; i++)
@@ -1066,7 +1043,7 @@ void UnityAssertEqualStringLen(const char* expected,
1066
1043
  }
1067
1044
  }
1068
1045
  else
1069
- { // handle case of one pointers being null (if both null, test should pass)
1046
+ { /* handle case of one pointers being null (if both null, test should pass) */
1070
1047
  if (expected != actual)
1071
1048
  {
1072
1049
  Unity.CurrentTestFailed = 1;
@@ -1083,7 +1060,7 @@ void UnityAssertEqualStringLen(const char* expected,
1083
1060
  }
1084
1061
 
1085
1062
 
1086
- //-----------------------------------------------
1063
+ /*-----------------------------------------------*/
1087
1064
  void UnityAssertEqualStringArray( const char** expected,
1088
1065
  const char** actual,
1089
1066
  const _UU32 num_elements,
@@ -1094,13 +1071,10 @@ void UnityAssertEqualStringArray( const char** expected,
1094
1071
 
1095
1072
  UNITY_SKIP_EXECUTION;
1096
1073
 
1097
- // if no elements, it's an error
1074
+ /* if no elements, it's an error */
1098
1075
  if (num_elements == 0)
1099
1076
  {
1100
- UnityTestResultsFailBegin(lineNumber);
1101
- UnityPrint(UnityStrPointless);
1102
- UnityAddMsgIfSpecified(msg);
1103
- UNITY_FAIL_AND_BAIL;
1077
+ UnityPrintPointlessAndBail();
1104
1078
  }
1105
1079
 
1106
1080
  if (UnityCheckArraysForNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg) == 1)
@@ -1108,7 +1082,7 @@ void UnityAssertEqualStringArray( const char** expected,
1108
1082
 
1109
1083
  do
1110
1084
  {
1111
- // if both pointers not null compare the strings
1085
+ /* if both pointers not null compare the strings */
1112
1086
  if (expected[j] && actual[j])
1113
1087
  {
1114
1088
  for (i = 0; expected[j][i] || actual[j][i]; i++)
@@ -1121,7 +1095,7 @@ void UnityAssertEqualStringArray( const char** expected,
1121
1095
  }
1122
1096
  }
1123
1097
  else
1124
- { // handle case of one pointers being null (if both null, test should pass)
1098
+ { /* handle case of one pointers being null (if both null, test should pass) */
1125
1099
  if (expected[j] != actual[j])
1126
1100
  {
1127
1101
  Unity.CurrentTestFailed = 1;
@@ -1143,7 +1117,7 @@ void UnityAssertEqualStringArray( const char** expected,
1143
1117
  } while (++j < num_elements);
1144
1118
  }
1145
1119
 
1146
- //-----------------------------------------------
1120
+ /*-----------------------------------------------*/
1147
1121
  void UnityAssertEqualMemory( UNITY_INTERNAL_PTR expected,
1148
1122
  UNITY_INTERNAL_PTR actual,
1149
1123
  const _UU32 length,
@@ -1160,10 +1134,7 @@ void UnityAssertEqualMemory( UNITY_INTERNAL_PTR expected,
1160
1134
 
1161
1135
  if ((elements == 0) || (length == 0))
1162
1136
  {
1163
- UnityTestResultsFailBegin(lineNumber);
1164
- UnityPrint(UnityStrPointless);
1165
- UnityAddMsgIfSpecified(msg);
1166
- UNITY_FAIL_AND_BAIL;
1137
+ UnityPrintPointlessAndBail();
1167
1138
  }
1168
1139
 
1169
1140
  if (UnityCheckArraysForNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg) == 1)
@@ -1171,7 +1142,7 @@ void UnityAssertEqualMemory( UNITY_INTERNAL_PTR expected,
1171
1142
 
1172
1143
  while (elements--)
1173
1144
  {
1174
- /////////////////////////////////////
1145
+ /* /////////////////////////////////// */
1175
1146
  bytes = length;
1176
1147
  while (bytes--)
1177
1148
  {
@@ -1196,14 +1167,14 @@ void UnityAssertEqualMemory( UNITY_INTERNAL_PTR expected,
1196
1167
  ptr_exp = (UNITY_INTERNAL_PTR)((_UP)ptr_exp + 1);
1197
1168
  ptr_act = (UNITY_INTERNAL_PTR)((_UP)ptr_act + 1);
1198
1169
  }
1199
- /////////////////////////////////////
1170
+ /* /////////////////////////////////// */
1200
1171
 
1201
1172
  }
1202
1173
  }
1203
1174
 
1204
- //-----------------------------------------------
1205
- // Control Functions
1206
- //-----------------------------------------------
1175
+ /*-----------------------------------------------
1176
+ * Control Functions
1177
+ *-----------------------------------------------*/
1207
1178
 
1208
1179
  void UnityFail(const char* msg, const UNITY_LINE_TYPE line)
1209
1180
  {
@@ -1238,7 +1209,7 @@ void UnityFail(const char* msg, const UNITY_LINE_TYPE line)
1238
1209
  UNITY_FAIL_AND_BAIL;
1239
1210
  }
1240
1211
 
1241
- //-----------------------------------------------
1212
+ /*-----------------------------------------------*/
1242
1213
  void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line)
1243
1214
  {
1244
1215
  UNITY_SKIP_EXECUTION;
@@ -1254,10 +1225,8 @@ void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line)
1254
1225
  UNITY_IGNORE_AND_BAIL;
1255
1226
  }
1256
1227
 
1257
- //-----------------------------------------------
1228
+ /*-----------------------------------------------*/
1258
1229
  #if defined(UNITY_WEAK_ATTRIBUTE)
1259
- void setUp(void);
1260
- void tearDown(void);
1261
1230
  UNITY_WEAK_ATTRIBUTE void setUp(void) { }
1262
1231
  UNITY_WEAK_ATTRIBUTE void tearDown(void) { }
1263
1232
  #elif defined(UNITY_WEAK_PRAGMA)
@@ -1265,11 +1234,8 @@ void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line)
1265
1234
  void setUp(void) { }
1266
1235
  # pragma weak tearDown
1267
1236
  void tearDown(void) { }
1268
- #else
1269
- void setUp(void);
1270
- void tearDown(void);
1271
1237
  #endif
1272
- //-----------------------------------------------
1238
+ /*-----------------------------------------------*/
1273
1239
  void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum)
1274
1240
  {
1275
1241
  Unity.CurrentTestName = FuncName;
@@ -1288,7 +1254,7 @@ void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int
1288
1254
  UnityConcludeTest();
1289
1255
  }
1290
1256
 
1291
- //-----------------------------------------------
1257
+ /*-----------------------------------------------*/
1292
1258
  void UnityBegin(const char* filename)
1293
1259
  {
1294
1260
  Unity.TestFile = filename;
@@ -1304,7 +1270,7 @@ void UnityBegin(const char* filename)
1304
1270
  UNITY_OUTPUT_START();
1305
1271
  }
1306
1272
 
1307
- //-----------------------------------------------
1273
+ /*-----------------------------------------------*/
1308
1274
  int UnityEnd(void)
1309
1275
  {
1310
1276
  UNITY_PRINT_EOL();
@@ -1324,10 +1290,189 @@ int UnityEnd(void)
1324
1290
  else
1325
1291
  {
1326
1292
  UnityPrintFail();
1293
+ #ifdef UNITY_DIFFERENTIATE_FINAL_FAIL
1294
+ UNITY_OUTPUT_CHAR('E'); UNITY_OUTPUT_CHAR('D');
1295
+ #endif
1327
1296
  }
1328
1297
  UNITY_PRINT_EOL();
1298
+ UNITY_FLUSH_CALL();
1329
1299
  UNITY_OUTPUT_COMPLETE();
1330
1300
  return (int)(Unity.TestFailures);
1331
1301
  }
1332
1302
 
1333
- //-----------------------------------------------
1303
+ /*-----------------------------------------------
1304
+ * Command Line Argument Support
1305
+ *-----------------------------------------------*/
1306
+ #ifdef UNITY_USE_COMMAND_LINE_ARGS
1307
+
1308
+ char* UnityOptionIncludeNamed = NULL;
1309
+ char* UnityOptionExcludeNamed = NULL;
1310
+ int UnityVerbosity = 1;
1311
+
1312
+ int UnityParseOptions(int argc, char** argv)
1313
+ {
1314
+ UnityOptionIncludeNamed = NULL;
1315
+ UnityOptionExcludeNamed = NULL;
1316
+
1317
+ for (int i = 1; i < argc; i++)
1318
+ {
1319
+ if (argv[i][0] == '-')
1320
+ {
1321
+ switch(argv[i][1])
1322
+ {
1323
+ case 'l': /* list tests */
1324
+ return -1;
1325
+ case 'n': /* include tests with name including this string */
1326
+ case 'f': /* an alias for -n */
1327
+ if (argv[i][2] == '=')
1328
+ UnityOptionIncludeNamed = &argv[i][3];
1329
+ else if (++i < argc)
1330
+ UnityOptionIncludeNamed = argv[i];
1331
+ else
1332
+ {
1333
+ UnityPrint("ERROR: No Test String to Include Matches For");
1334
+ UNITY_PRINT_EOL();
1335
+ return 1;
1336
+ }
1337
+ break;
1338
+ case 'q': /* quiet */
1339
+ UnityVerbosity = 0;
1340
+ break;
1341
+ case 'v': /* verbose */
1342
+ UnityVerbosity = 2;
1343
+ break;
1344
+ case 'x': /* exclude tests with name including this string */
1345
+ if (argv[i][2] == '=')
1346
+ UnityOptionExcludeNamed = &argv[i][3];
1347
+ else if (++i < argc)
1348
+ UnityOptionExcludeNamed = argv[i];
1349
+ else
1350
+ {
1351
+ UnityPrint("ERROR: No Test String to Exclude Matches For");
1352
+ UNITY_PRINT_EOL();
1353
+ return 1;
1354
+ }
1355
+ break;
1356
+ default:
1357
+ UnityPrint("ERROR: Unknown Option ");
1358
+ UNITY_OUTPUT_CHAR(argv[i][1]);
1359
+ UNITY_PRINT_EOL();
1360
+ return 1;
1361
+ }
1362
+ }
1363
+ }
1364
+
1365
+ return 0;
1366
+ }
1367
+
1368
+ int IsStringInBiggerString(const char* longstring, const char* shortstring)
1369
+ {
1370
+ char* lptr = (char*)longstring;
1371
+ char* sptr = (char*)shortstring;
1372
+ char* lnext = lptr;
1373
+
1374
+ if (*sptr == '*')
1375
+ return 1;
1376
+
1377
+ while (*lptr)
1378
+ {
1379
+ lnext = lptr + 1;
1380
+
1381
+ /* If they current bytes match, go on to the next bytes */
1382
+ while (*lptr && *sptr && (*lptr == *sptr))
1383
+ {
1384
+ lptr++;
1385
+ sptr++;
1386
+
1387
+ /* We're done if we match the entire string or up to a wildcard */
1388
+ if (*sptr == '*')
1389
+ return 1;
1390
+ if (*sptr == ',')
1391
+ return 1;
1392
+ if (*sptr == '"')
1393
+ return 1;
1394
+ if (*sptr == '\'')
1395
+ return 1;
1396
+ if (*sptr == ':')
1397
+ return 2;
1398
+ if (*sptr == 0)
1399
+ return 1;
1400
+ }
1401
+
1402
+ /* Otherwise we start in the long pointer 1 character further and try again */
1403
+ lptr = lnext;
1404
+ sptr = (char*)shortstring;
1405
+ }
1406
+ return 0;
1407
+ }
1408
+
1409
+ int UnityStringArgumentMatches(const char* str)
1410
+ {
1411
+ int retval;
1412
+ const char* ptr1;
1413
+ const char* ptr2;
1414
+ const char* ptrf;
1415
+
1416
+ //Go through the options and get the substrings for matching one at a time
1417
+ ptr1 = str;
1418
+ while (ptr1[0] != 0)
1419
+ {
1420
+ if ((ptr1[0] == '"') || (ptr1[0] == '\''))
1421
+ ptr1++;
1422
+
1423
+ //look for the start of the next partial
1424
+ ptr2 = ptr1;
1425
+ ptrf = 0;
1426
+ do {
1427
+ ptr2++;
1428
+ if ((ptr2[0] == ':') && (ptr2[1] != 0) && (ptr2[0] != '\'') && (ptr2[0] != '"') && (ptr2[0] != ','))
1429
+ ptrf = &ptr2[1];
1430
+ } while ((ptr2[0] != 0) && (ptr2[0] != '\'') && (ptr2[0] != '"') && (ptr2[0] != ','));
1431
+ while ((ptr2[0] != 0) && ((ptr2[0] == ':') || (ptr2[0] == '\'') || (ptr2[0] == '"') || (ptr2[0] == ',')))
1432
+ ptr2++;
1433
+
1434
+ //done if complete filename match
1435
+ retval = IsStringInBiggerString(Unity.TestFile, ptr1);
1436
+ if (retval == 1)
1437
+ return retval;
1438
+
1439
+ //done if testname match after filename partial match
1440
+ if ((retval == 2) && (ptrf != 0))
1441
+ {
1442
+ if (IsStringInBiggerString(Unity.CurrentTestName, ptrf))
1443
+ return 1;
1444
+ }
1445
+
1446
+ //done if complete testname match
1447
+ if (IsStringInBiggerString(Unity.CurrentTestName, ptr1) == 1)
1448
+ return 1;
1449
+
1450
+ ptr1 = ptr2;
1451
+ }
1452
+
1453
+ //we couldn't find a match for any substrings
1454
+ return 0;
1455
+ }
1456
+
1457
+ int UnityTestMatches(void)
1458
+ {
1459
+ /* Check if this test name matches the included test pattern */
1460
+ int retval;
1461
+ if (UnityOptionIncludeNamed)
1462
+ {
1463
+ retval = UnityStringArgumentMatches(UnityOptionIncludeNamed);
1464
+ }
1465
+ else
1466
+ retval = 1;
1467
+
1468
+ /* Check if this test name matches the excluded test pattern */
1469
+ if (UnityOptionExcludeNamed)
1470
+ {
1471
+ if (UnityStringArgumentMatches(UnityOptionExcludeNamed))
1472
+ retval = 0;
1473
+ }
1474
+ return retval;
1475
+ }
1476
+
1477
+ #endif /* UNITY_USE_COMMAND_LINE_ARGS */
1478
+ /*-----------------------------------------------*/