ceedling 0.18.0 → 0.19.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 (626) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +17 -13
  3. data/ceedling-0.18.0.gem +0 -0
  4. data/docs/CeedlingPacket.md +7 -5
  5. data/lib/ceedling/configurator_builder.rb +10 -21
  6. data/lib/ceedling/configurator_setup.rb +16 -17
  7. data/lib/ceedling/constants.rb +4 -3
  8. data/lib/ceedling/defaults.rb +9 -4
  9. data/lib/ceedling/dependinator.rb +0 -1
  10. data/lib/ceedling/file_path_utils.rb +22 -26
  11. data/lib/ceedling/flaginator.rb +5 -5
  12. data/lib/ceedling/generator.rb +8 -7
  13. data/lib/ceedling/preprocessinator_file_handler.rb +6 -6
  14. data/lib/ceedling/preprocessinator_includes_handler.rb +1 -1
  15. data/lib/ceedling/rules_release.rake +5 -3
  16. data/lib/ceedling/rules_tests.rake +2 -1
  17. data/lib/ceedling/tasks_base.rake +1 -1
  18. data/lib/ceedling/tasks_vendor.rake +9 -10
  19. data/lib/ceedling/tool_executor.rb +23 -22
  20. data/lib/ceedling/version.rb +3 -3
  21. data/plugins/module_generator/lib/module_generator.rb +3 -3
  22. data/plugins/xml_tests_report/xml_tests_report.rb +1 -1
  23. data/spec/preprocessinator_includes_handler_spec.rb +1 -1
  24. data/spec/spec_system_helper.rb +192 -192
  25. data/vendor/c_exception/vendor/unity/Gemfile +4 -0
  26. data/vendor/c_exception/vendor/unity/Gemfile.lock +12 -0
  27. data/vendor/c_exception/vendor/unity/auto/colour_prompt.rb +115 -0
  28. data/vendor/c_exception/vendor/unity/auto/colour_reporter.rb +39 -0
  29. data/vendor/c_exception/vendor/unity/auto/generate_config.yml +36 -0
  30. data/vendor/c_exception/vendor/unity/auto/generate_module.rb +202 -0
  31. data/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +320 -0
  32. data/vendor/c_exception/vendor/unity/auto/parseOutput.rb +189 -0
  33. data/vendor/c_exception/vendor/unity/auto/test_file_filter.rb +23 -0
  34. data/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb +139 -0
  35. data/vendor/c_exception/vendor/unity/docs/Unity Summary.odt +0 -0
  36. data/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf +0 -0
  37. data/vendor/c_exception/vendor/unity/docs/Unity Summary.txt +216 -0
  38. data/vendor/c_exception/vendor/unity/docs/license.txt +31 -0
  39. data/vendor/c_exception/vendor/unity/examples/example_1/makefile +41 -0
  40. data/vendor/c_exception/vendor/unity/examples/example_1/readme.txt +5 -0
  41. data/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode.c +24 -0
  42. data/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode.h +3 -0
  43. data/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode2.c +9 -0
  44. data/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode2.h +2 -0
  45. data/vendor/c_exception/vendor/unity/examples/example_1/test/TestProductionCode.c +62 -0
  46. data/vendor/c_exception/vendor/unity/examples/example_1/test/TestProductionCode2.c +31 -0
  47. data/vendor/{unity/examples/example_3/test/no_ruby → c_exception/vendor/unity/examples/example_1/test/test_runners}/TestProductionCode2_Runner.c +16 -3
  48. data/vendor/{unity/examples/example_3/test/no_ruby → c_exception/vendor/unity/examples/example_1/test/test_runners}/TestProductionCode_Runner.c +16 -3
  49. data/vendor/c_exception/vendor/unity/examples/example_2/makefile +45 -0
  50. data/vendor/c_exception/vendor/unity/examples/example_2/readme.txt +5 -0
  51. data/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode.c +24 -0
  52. data/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode.h +3 -0
  53. data/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode2.c +9 -0
  54. data/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode2.h +2 -0
  55. data/vendor/c_exception/vendor/unity/examples/example_2/test/TestProductionCode.c +64 -0
  56. data/vendor/c_exception/vendor/unity/examples/example_2/test/TestProductionCode2.c +33 -0
  57. data/vendor/c_exception/vendor/unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c +9 -0
  58. data/vendor/c_exception/vendor/unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c +11 -0
  59. data/vendor/c_exception/vendor/unity/examples/example_2/test/test_runners/all_tests.c +12 -0
  60. data/vendor/c_exception/vendor/unity/examples/example_3/helper/UnityHelper.c +10 -0
  61. data/vendor/c_exception/vendor/unity/examples/example_3/helper/UnityHelper.h +12 -0
  62. data/vendor/c_exception/vendor/unity/examples/example_3/makefile +41 -0
  63. data/vendor/c_exception/vendor/unity/examples/example_3/rakefile.rb +44 -0
  64. data/vendor/c_exception/vendor/unity/examples/example_3/rakefile_helper.rb +256 -0
  65. data/vendor/c_exception/vendor/unity/examples/example_3/readme.txt +19 -0
  66. data/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode.c +24 -0
  67. data/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode.h +3 -0
  68. data/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode2.c +9 -0
  69. data/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode2.h +2 -0
  70. data/vendor/c_exception/vendor/unity/examples/example_3/target_gcc_32.yml +46 -0
  71. data/vendor/c_exception/vendor/unity/examples/example_3/test/TestProductionCode.c +62 -0
  72. data/vendor/c_exception/vendor/unity/examples/example_3/test/TestProductionCode2.c +31 -0
  73. data/vendor/c_exception/vendor/unity/examples/example_3/test/no_ruby/TestProductionCode2_Runner.c +46 -0
  74. data/vendor/c_exception/vendor/unity/examples/example_3/test/no_ruby/TestProductionCode_Runner.c +50 -0
  75. data/vendor/c_exception/vendor/unity/extras/eclipse/error_parsers.txt +26 -0
  76. data/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb +37 -0
  77. data/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb +179 -0
  78. data/vendor/c_exception/vendor/unity/extras/fixture/readme.txt +9 -0
  79. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +387 -0
  80. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h +82 -0
  81. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +44 -0
  82. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +16 -0
  83. data/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c +21 -0
  84. data/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c +39 -0
  85. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +341 -0
  86. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +41 -0
  87. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c +56 -0
  88. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h +17 -0
  89. data/vendor/c_exception/vendor/unity/makefile +37 -0
  90. data/vendor/c_exception/vendor/unity/rakefile.rb +61 -0
  91. data/vendor/c_exception/vendor/unity/rakefile_helper.rb +249 -0
  92. data/vendor/c_exception/vendor/unity/release/build.info +2 -0
  93. data/vendor/c_exception/vendor/unity/release/version.info +2 -0
  94. data/vendor/c_exception/vendor/unity/src/unity.c +1145 -0
  95. data/vendor/c_exception/vendor/unity/src/unity.h +307 -0
  96. data/vendor/c_exception/vendor/unity/src/unity_internals.h +620 -0
  97. data/vendor/c_exception/vendor/unity/targets/clang_strict.yml +83 -0
  98. data/vendor/c_exception/vendor/unity/targets/gcc_32.yml +44 -0
  99. data/vendor/c_exception/vendor/unity/targets/gcc_64.yml +45 -0
  100. data/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml +101 -0
  101. data/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml +89 -0
  102. data/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml +79 -0
  103. data/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml +79 -0
  104. data/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml +93 -0
  105. data/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml +83 -0
  106. data/vendor/c_exception/vendor/unity/targets/iar_msp430.yml +94 -0
  107. data/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml +85 -0
  108. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c +57 -0
  109. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c +53 -0
  110. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c +79 -0
  111. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c +75 -0
  112. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c +88 -0
  113. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c +88 -0
  114. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c +76 -0
  115. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c +88 -0
  116. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c +88 -0
  117. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c +89 -0
  118. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c +63 -0
  119. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c +66 -0
  120. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c +54 -0
  121. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c +63 -0
  122. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c +66 -0
  123. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c +67 -0
  124. data/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb +88 -0
  125. data/vendor/c_exception/vendor/unity/test/testdata/mocksample.c +51 -0
  126. data/vendor/c_exception/vendor/unity/test/testdata/sample.yml +9 -0
  127. data/vendor/c_exception/vendor/unity/test/testdata/testsample.c +51 -0
  128. data/vendor/c_exception/vendor/unity/test/testparameterized.c +101 -0
  129. data/vendor/c_exception/vendor/unity/test/testunity.c +3447 -0
  130. data/vendor/cmock/README.md +1 -1
  131. data/vendor/cmock/Rakefile +106 -104
  132. data/vendor/cmock/config/production_environment.rb +14 -14
  133. data/vendor/cmock/config/test_environment.rb +16 -16
  134. data/vendor/cmock/docs/CMock_Summary.md +9 -0
  135. data/vendor/cmock/docs/license.txt +2 -2
  136. data/vendor/cmock/examples/make_example/Makefile +30 -0
  137. data/vendor/cmock/examples/make_example/src/foo.c +5 -0
  138. data/vendor/cmock/examples/make_example/src/foo.h +5 -0
  139. data/vendor/cmock/examples/make_example/src/main.c +15 -0
  140. data/vendor/cmock/examples/make_example/test/test_foo.c +17 -0
  141. data/vendor/cmock/examples/make_example/test/test_main.c +15 -0
  142. data/vendor/cmock/examples/{gcc.yml → temp_sensor/gcc.yml} +43 -43
  143. data/vendor/cmock/examples/{iar_v4.yml → temp_sensor/iar_v4.yml} +91 -91
  144. data/vendor/cmock/examples/{iar_v5.yml → temp_sensor/iar_v5.yml} +80 -80
  145. data/vendor/cmock/examples/{rakefile.rb → temp_sensor/rakefile.rb} +32 -32
  146. data/vendor/cmock/examples/{rakefile_helper.rb → temp_sensor/rakefile_helper.rb} +270 -270
  147. data/vendor/cmock/examples/{src → temp_sensor/src}/AT91SAM7X256.h +2556 -2556
  148. data/vendor/cmock/examples/{src → temp_sensor/src}/AdcConductor.c +42 -42
  149. data/vendor/cmock/examples/{src → temp_sensor/src}/AdcConductor.h +11 -11
  150. data/vendor/cmock/examples/{src → temp_sensor/src}/AdcHardware.c +27 -27
  151. data/vendor/cmock/examples/{src → temp_sensor/src}/AdcHardware.h +9 -9
  152. data/vendor/cmock/examples/{src → temp_sensor/src}/AdcHardwareConfigurator.c +18 -18
  153. data/vendor/cmock/examples/{src → temp_sensor/src}/AdcHardwareConfigurator.h +10 -10
  154. data/vendor/cmock/examples/{src → temp_sensor/src}/AdcModel.c +33 -33
  155. data/vendor/cmock/examples/{src → temp_sensor/src}/AdcModel.h +13 -13
  156. data/vendor/cmock/examples/{src → temp_sensor/src}/AdcTemperatureSensor.c +51 -51
  157. data/vendor/cmock/examples/{src → temp_sensor/src}/AdcTemperatureSensor.h +10 -10
  158. data/vendor/cmock/examples/{src → temp_sensor/src}/Executor.c +25 -25
  159. data/vendor/cmock/examples/{src → temp_sensor/src}/Executor.h +9 -9
  160. data/vendor/cmock/examples/{src → temp_sensor/src}/IntrinsicsWrapper.c +18 -18
  161. data/vendor/cmock/examples/{src → temp_sensor/src}/IntrinsicsWrapper.h +7 -7
  162. data/vendor/cmock/examples/{src → temp_sensor/src}/Main.c +46 -46
  163. data/vendor/cmock/examples/{src → temp_sensor/src}/Main.h +7 -7
  164. data/vendor/cmock/examples/{src → temp_sensor/src}/Model.c +10 -10
  165. data/vendor/cmock/examples/{src → temp_sensor/src}/Model.h +8 -8
  166. data/vendor/cmock/examples/{src → temp_sensor/src}/ModelConfig.h +7 -7
  167. data/vendor/cmock/examples/{src → temp_sensor/src}/TaskScheduler.c +72 -72
  168. data/vendor/cmock/examples/{src → temp_sensor/src}/TaskScheduler.h +11 -11
  169. data/vendor/cmock/examples/{src → temp_sensor/src}/TemperatureCalculator.c +27 -27
  170. data/vendor/cmock/examples/{src → temp_sensor/src}/TemperatureCalculator.h +6 -6
  171. data/vendor/cmock/examples/{src → temp_sensor/src}/TemperatureFilter.c +39 -39
  172. data/vendor/cmock/examples/{src → temp_sensor/src}/TemperatureFilter.h +10 -10
  173. data/vendor/cmock/examples/{src → temp_sensor/src}/TimerConductor.c +15 -15
  174. data/vendor/cmock/examples/{src → temp_sensor/src}/TimerConductor.h +9 -9
  175. data/vendor/cmock/examples/{src → temp_sensor/src}/TimerConfigurator.c +51 -51
  176. data/vendor/cmock/examples/{src → temp_sensor/src}/TimerConfigurator.h +15 -15
  177. data/vendor/cmock/examples/{src → temp_sensor/src}/TimerHardware.c +15 -15
  178. data/vendor/cmock/examples/{src → temp_sensor/src}/TimerHardware.h +8 -8
  179. data/vendor/cmock/examples/{src → temp_sensor/src}/TimerInterruptConfigurator.c +55 -55
  180. data/vendor/cmock/examples/{src → temp_sensor/src}/TimerInterruptConfigurator.h +13 -13
  181. data/vendor/cmock/examples/{src → temp_sensor/src}/TimerInterruptHandler.c +25 -25
  182. data/vendor/cmock/examples/{src → temp_sensor/src}/TimerInterruptHandler.h +10 -10
  183. data/vendor/cmock/examples/{src → temp_sensor/src}/TimerModel.c +9 -9
  184. data/vendor/cmock/examples/{src → temp_sensor/src}/TimerModel.h +8 -8
  185. data/vendor/cmock/examples/{src → temp_sensor/src}/Types.h +103 -103
  186. data/vendor/cmock/examples/{src → temp_sensor/src}/UsartBaudRateRegisterCalculator.c +18 -18
  187. data/vendor/cmock/examples/{src → temp_sensor/src}/UsartBaudRateRegisterCalculator.h +6 -6
  188. data/vendor/cmock/examples/{src → temp_sensor/src}/UsartConductor.c +21 -21
  189. data/vendor/cmock/examples/{src → temp_sensor/src}/UsartConductor.h +7 -7
  190. data/vendor/cmock/examples/{src → temp_sensor/src}/UsartConfigurator.c +39 -39
  191. data/vendor/cmock/examples/{src → temp_sensor/src}/UsartConfigurator.h +13 -13
  192. data/vendor/cmock/examples/{src → temp_sensor/src}/UsartHardware.c +22 -22
  193. data/vendor/cmock/examples/{src → temp_sensor/src}/UsartHardware.h +9 -9
  194. data/vendor/cmock/examples/{src → temp_sensor/src}/UsartModel.c +34 -34
  195. data/vendor/cmock/examples/{src → temp_sensor/src}/UsartModel.h +10 -10
  196. data/vendor/cmock/examples/{src → temp_sensor/src}/UsartPutChar.c +16 -16
  197. data/vendor/cmock/examples/{src → temp_sensor/src}/UsartPutChar.h +8 -8
  198. data/vendor/cmock/examples/{src → temp_sensor/src}/UsartTransmitBufferStatus.c +7 -7
  199. data/vendor/cmock/examples/{src → temp_sensor/src}/UsartTransmitBufferStatus.h +8 -8
  200. data/vendor/cmock/examples/{test → temp_sensor/test}/TestAdcConductor.c +121 -121
  201. data/vendor/cmock/examples/{test → temp_sensor/test}/TestAdcHardware.c +44 -44
  202. data/vendor/cmock/examples/{test → temp_sensor/test}/TestAdcHardwareConfigurator.c +43 -43
  203. data/vendor/cmock/examples/{test → temp_sensor/test}/TestAdcModel.c +33 -33
  204. data/vendor/cmock/examples/{test → temp_sensor/test}/TestAdcTemperatureSensor.c +47 -47
  205. data/vendor/cmock/examples/{test → temp_sensor/test}/TestExecutor.c +36 -36
  206. data/vendor/cmock/examples/{test → temp_sensor/test}/TestMain.c +24 -24
  207. data/vendor/cmock/examples/{test → temp_sensor/test}/TestModel.c +20 -20
  208. data/vendor/cmock/examples/{test → temp_sensor/test}/TestTaskScheduler.c +104 -104
  209. data/vendor/cmock/examples/{test → temp_sensor/test}/TestTemperatureCalculator.c +33 -33
  210. data/vendor/cmock/examples/{test → temp_sensor/test}/TestTemperatureFilter.c +69 -69
  211. data/vendor/cmock/examples/{test → temp_sensor/test}/TestTimerConductor.c +32 -32
  212. data/vendor/cmock/examples/{test → temp_sensor/test}/TestTimerConfigurator.c +112 -112
  213. data/vendor/cmock/examples/{test → temp_sensor/test}/TestTimerHardware.c +26 -26
  214. data/vendor/cmock/examples/{test → temp_sensor/test}/TestTimerInterruptConfigurator.c +78 -78
  215. data/vendor/cmock/examples/{test → temp_sensor/test}/TestTimerInterruptHandler.c +66 -66
  216. data/vendor/cmock/examples/{test → temp_sensor/test}/TestTimerModel.c +18 -18
  217. data/vendor/cmock/examples/{test → temp_sensor/test}/TestUsartBaudRateRegisterCalculator.c +21 -21
  218. data/vendor/cmock/examples/{test → temp_sensor/test}/TestUsartConductor.c +40 -40
  219. data/vendor/cmock/examples/{test → temp_sensor/test}/TestUsartConfigurator.c +77 -77
  220. data/vendor/cmock/examples/{test → temp_sensor/test}/TestUsartHardware.c +37 -37
  221. data/vendor/cmock/examples/{test → temp_sensor/test}/TestUsartModel.c +36 -36
  222. data/vendor/cmock/examples/{test → temp_sensor/test}/TestUsartPutChar.c +43 -43
  223. data/vendor/cmock/examples/{test → temp_sensor/test}/TestUsartTransmitBufferStatus.c +22 -22
  224. data/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_FLASH.xcl +185 -185
  225. data/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_RAM.xcl +185 -185
  226. data/vendor/cmock/iar/iar_v4/Resource/ioat91sam7x256.ddf +2259 -2259
  227. data/vendor/cmock/iar/iar_v4/cmock_demo.dep +3691 -3691
  228. data/vendor/cmock/iar/iar_v4/cmock_demo.ewp +2581 -2581
  229. data/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X-EK.h +61 -61
  230. data/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.inc +2314 -2314
  231. data/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.rdf +4704 -4704
  232. data/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.tcl +3407 -3407
  233. data/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256_inc.h +2268 -2268
  234. data/vendor/cmock/iar/iar_v4/incIAR/ioat91sam7x256.h +4380 -4380
  235. data/vendor/cmock/iar/iar_v4/incIAR/lib_AT91SAM7X256.h +4211 -4211
  236. data/vendor/cmock/iar/iar_v4/settings/cmock_demo.cspy.bat +32 -32
  237. data/vendor/cmock/iar/iar_v4/srcIAR/Cstartup.s79 +265 -265
  238. data/vendor/cmock/iar/iar_v4/srcIAR/Cstartup_SAM7.c +98 -98
  239. data/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_FLASH.icf +43 -43
  240. data/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_RAM.icf +42 -42
  241. data/vendor/cmock/iar/iar_v5/cmock_demo.dep +4204 -4204
  242. data/vendor/cmock/iar/iar_v5/cmock_demo.ewp +2426 -2426
  243. data/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X-EK.h +61 -61
  244. data/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X256_inc.h +2268 -2268
  245. data/vendor/cmock/iar/iar_v5/incIAR/lib_AT91SAM7X256.h +4211 -4211
  246. data/vendor/cmock/iar/iar_v5/incIAR/project.h +30 -30
  247. data/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.cspy.bat +33 -33
  248. data/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X_FLASH_Debug.jlink +12 -12
  249. data/vendor/cmock/iar/iar_v5/settings/cmock_demo.cspy.bat +33 -33
  250. data/vendor/cmock/iar/iar_v5/settings/cmock_demo_Binary.jlink +12 -12
  251. data/vendor/cmock/iar/iar_v5/settings/cmock_demo_FLASH_Debug.jlink +12 -12
  252. data/vendor/cmock/iar/iar_v5/settings/cmock_demo_RAM_Debug.jlink +12 -12
  253. data/vendor/cmock/iar/iar_v5/srcIAR/Cstartup.s +299 -299
  254. data/vendor/cmock/iar/iar_v5/srcIAR/Cstartup_SAM7.c +98 -98
  255. data/vendor/cmock/lib/cmock.rb +89 -89
  256. data/vendor/cmock/lib/cmock_config.rb +134 -133
  257. data/vendor/cmock/lib/cmock_file_writer.rb +40 -33
  258. data/vendor/cmock/lib/cmock_generator.rb +234 -215
  259. data/vendor/cmock/lib/cmock_generator_plugin_array.rb +63 -63
  260. data/vendor/cmock/lib/cmock_generator_plugin_callback.rb +96 -78
  261. data/vendor/cmock/lib/cmock_generator_plugin_cexception.rb +52 -51
  262. data/vendor/cmock/lib/cmock_generator_plugin_expect.rb +104 -86
  263. data/vendor/cmock/lib/cmock_generator_plugin_expect_any_args.rb +68 -68
  264. data/vendor/cmock/lib/cmock_generator_plugin_ignore.rb +72 -71
  265. data/vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb +1 -1
  266. data/vendor/cmock/lib/cmock_generator_plugin_return_thru_ptr.rb +2 -2
  267. data/vendor/cmock/lib/cmock_generator_utils.rb +228 -213
  268. data/vendor/cmock/lib/cmock_header_parser.rb +1 -1
  269. data/vendor/cmock/lib/cmock_plugin_manager.rb +40 -40
  270. data/vendor/cmock/lib/cmock_unityhelper_parser.rb +75 -75
  271. data/vendor/cmock/rakefile_helper.rb +381 -381
  272. data/vendor/cmock/release/build.info +1 -1
  273. data/vendor/cmock/release/version.info +1 -1
  274. data/vendor/cmock/scripts/create_makefile.rb +161 -0
  275. data/vendor/cmock/scripts/create_mock.rb +8 -0
  276. data/vendor/cmock/scripts/create_runner.rb +20 -0
  277. data/vendor/cmock/scripts/test_summary.rb +11 -0
  278. data/vendor/cmock/src/cmock.c +203 -192
  279. data/vendor/cmock/src/cmock.h +38 -36
  280. data/vendor/cmock/src/cmock_internals.h +11 -1
  281. data/vendor/cmock/targets/clang_strict.yml +90 -85
  282. data/vendor/cmock/targets/gcc.yml +58 -55
  283. data/vendor/cmock/targets/gcc_64.yml +58 -55
  284. data/vendor/cmock/targets/gcc_tiny.yml +80 -0
  285. data/vendor/cmock/targets/iar_arm_v4.yml +110 -108
  286. data/vendor/cmock/targets/iar_arm_v5.yml +95 -93
  287. data/vendor/cmock/test/c/TestCMockC.c +323 -323
  288. data/vendor/cmock/test/c/TestCMockC.yml +1 -0
  289. data/vendor/cmock/test/c/TestCMockCDynamic.c +186 -186
  290. data/vendor/cmock/test/c/TestCMockCDynamic_Runner.c +36 -36
  291. data/vendor/cmock/test/c/TestCMockC_Runner.c +39 -39
  292. data/vendor/cmock/test/system/systest_generator.rb +194 -194
  293. data/vendor/cmock/test/system/test_compilation/callingconv.h +11 -11
  294. data/vendor/cmock/test/system/test_compilation/osek.h +275 -275
  295. data/vendor/cmock/test/system/test_compilation/parsing.h +2 -0
  296. data/vendor/cmock/test/system/test_interactions/all_plugins_but_other_limits.yml +375 -375
  297. data/vendor/cmock/test/system/test_interactions/all_plugins_coexist.yml +459 -389
  298. data/vendor/cmock/test/system/test_interactions/array_and_pointer_handling.yml +62 -0
  299. data/vendor/cmock/test/system/test_interactions/doesnt_leave_details_behind.yml +308 -0
  300. data/vendor/cmock/test/system/test_interactions/enforce_strict_ordering.yml +23 -23
  301. data/vendor/cmock/test/system/test_interactions/out_of_memory.yml +65 -0
  302. data/vendor/cmock/test/system/test_interactions/parsing_challenges.yml +38 -20
  303. data/vendor/cmock/test/system/test_interactions/struct_union_enum_expect_and_return_with_plugins.yml +280 -0
  304. data/vendor/cmock/test/test_helper.rb +47 -47
  305. data/vendor/cmock/test/unit/cmock_config_test.rb +118 -118
  306. data/vendor/cmock/test/unit/cmock_config_test.yml +5 -5
  307. data/vendor/cmock/test/unit/cmock_file_writer_test.rb +27 -27
  308. data/vendor/cmock/test/unit/cmock_generator_main_test.rb +507 -489
  309. data/vendor/cmock/test/unit/cmock_generator_plugin_array_test.rb +133 -133
  310. data/vendor/cmock/test/unit/cmock_generator_plugin_callback_test.rb +257 -189
  311. data/vendor/cmock/test/unit/cmock_generator_plugin_cexception_test.rb +96 -93
  312. data/vendor/cmock/test/unit/cmock_generator_plugin_expect_a_test.rb +186 -0
  313. data/vendor/cmock/test/unit/cmock_generator_plugin_expect_any_args_test.rb +60 -81
  314. data/vendor/cmock/test/unit/{cmock_generator_plugin_expect_test.rb → cmock_generator_plugin_expect_b_test.rb} +202 -205
  315. data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_arg_test.rb +116 -116
  316. data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_test.rb +105 -103
  317. data/vendor/cmock/test/unit/cmock_generator_plugin_return_thru_ptr_test.rb +134 -134
  318. data/vendor/cmock/test/unit/cmock_generator_utils_test.rb +377 -334
  319. data/vendor/cmock/test/unit/cmock_header_parser_test.rb +1381 -1337
  320. data/vendor/cmock/test/unit/cmock_plugin_manager_test.rb +95 -95
  321. data/vendor/cmock/test/unit/cmock_unityhelper_parser_test.rb +223 -223
  322. data/vendor/cmock/vendor/c_exception/Gemfile +4 -0
  323. data/vendor/cmock/vendor/c_exception/Gemfile.lock +12 -0
  324. data/vendor/cmock/vendor/c_exception/LICENSE.txt +30 -0
  325. data/vendor/cmock/vendor/c_exception/README.md +146 -0
  326. data/vendor/cmock/vendor/c_exception/Rakefile +42 -0
  327. data/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.odt +0 -0
  328. data/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.pdf +0 -0
  329. data/vendor/cmock/vendor/c_exception/docs/readme.txt +242 -0
  330. data/vendor/cmock/vendor/c_exception/lib/CException.c +46 -0
  331. data/vendor/cmock/vendor/c_exception/lib/CException.h +86 -0
  332. data/vendor/cmock/vendor/c_exception/makefile +24 -0
  333. data/vendor/cmock/vendor/c_exception/release/build.info +2 -0
  334. data/vendor/cmock/vendor/c_exception/release/version.info +2 -0
  335. data/vendor/cmock/vendor/c_exception/test/CExceptionConfig.h +46 -0
  336. data/vendor/cmock/vendor/c_exception/test/TestException.c +342 -0
  337. data/vendor/cmock/vendor/c_exception/test/TestException_Runner.c +74 -0
  338. data/vendor/cmock/vendor/c_exception/vendor/unity/Gemfile +4 -0
  339. data/vendor/cmock/vendor/c_exception/vendor/unity/Gemfile.lock +12 -0
  340. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_prompt.rb +115 -0
  341. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_reporter.rb +39 -0
  342. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_config.yml +36 -0
  343. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_module.rb +202 -0
  344. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +320 -0
  345. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/parseOutput.rb +189 -0
  346. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/test_file_filter.rb +23 -0
  347. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb +139 -0
  348. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.odt +0 -0
  349. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf +0 -0
  350. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.txt +216 -0
  351. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/license.txt +31 -0
  352. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/makefile +41 -0
  353. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/readme.txt +5 -0
  354. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode.c +24 -0
  355. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode.h +3 -0
  356. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode2.c +9 -0
  357. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode2.h +2 -0
  358. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/TestProductionCode.c +62 -0
  359. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/TestProductionCode2.c +31 -0
  360. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +46 -0
  361. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +50 -0
  362. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/makefile +45 -0
  363. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/readme.txt +5 -0
  364. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode.c +24 -0
  365. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode.h +3 -0
  366. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode2.c +9 -0
  367. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode2.h +2 -0
  368. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/test/TestProductionCode.c +64 -0
  369. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/test/TestProductionCode2.c +33 -0
  370. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c +9 -0
  371. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c +11 -0
  372. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/test/test_runners/all_tests.c +12 -0
  373. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/helper/UnityHelper.c +10 -0
  374. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/helper/UnityHelper.h +12 -0
  375. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/makefile +41 -0
  376. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/rakefile.rb +44 -0
  377. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/rakefile_helper.rb +256 -0
  378. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/readme.txt +19 -0
  379. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode.c +24 -0
  380. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode.h +3 -0
  381. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode2.c +9 -0
  382. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode2.h +2 -0
  383. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/target_gcc_32.yml +46 -0
  384. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/test/TestProductionCode.c +62 -0
  385. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/test/TestProductionCode2.c +31 -0
  386. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/test/no_ruby/TestProductionCode2_Runner.c +46 -0
  387. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/test/no_ruby/TestProductionCode_Runner.c +50 -0
  388. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/eclipse/error_parsers.txt +26 -0
  389. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb +37 -0
  390. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb +179 -0
  391. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/readme.txt +9 -0
  392. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +387 -0
  393. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h +82 -0
  394. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +44 -0
  395. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +16 -0
  396. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c +21 -0
  397. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c +39 -0
  398. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +341 -0
  399. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +41 -0
  400. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c +56 -0
  401. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h +17 -0
  402. data/vendor/cmock/vendor/c_exception/vendor/unity/makefile +37 -0
  403. data/vendor/cmock/vendor/c_exception/vendor/unity/rakefile.rb +61 -0
  404. data/vendor/cmock/vendor/c_exception/vendor/unity/rakefile_helper.rb +249 -0
  405. data/vendor/cmock/vendor/c_exception/vendor/unity/release/build.info +2 -0
  406. data/vendor/cmock/vendor/c_exception/vendor/unity/release/version.info +2 -0
  407. data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.c +1145 -0
  408. data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.h +307 -0
  409. data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity_internals.h +620 -0
  410. data/vendor/cmock/vendor/c_exception/vendor/unity/targets/clang_strict.yml +83 -0
  411. data/vendor/cmock/vendor/c_exception/vendor/unity/targets/gcc_32.yml +44 -0
  412. data/vendor/cmock/vendor/c_exception/vendor/unity/targets/gcc_64.yml +45 -0
  413. data/vendor/cmock/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml +101 -0
  414. data/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml +89 -0
  415. data/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml +79 -0
  416. data/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml +79 -0
  417. data/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml +93 -0
  418. data/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml +83 -0
  419. data/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_msp430.yml +94 -0
  420. data/vendor/cmock/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml +85 -0
  421. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c +57 -0
  422. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c +53 -0
  423. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c +79 -0
  424. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c +75 -0
  425. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c +88 -0
  426. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c +88 -0
  427. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c +76 -0
  428. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c +88 -0
  429. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c +88 -0
  430. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c +89 -0
  431. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c +63 -0
  432. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c +66 -0
  433. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c +54 -0
  434. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c +63 -0
  435. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c +66 -0
  436. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c +67 -0
  437. data/vendor/cmock/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb +88 -0
  438. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/mocksample.c +51 -0
  439. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/sample.yml +9 -0
  440. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testsample.c +51 -0
  441. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testparameterized.c +101 -0
  442. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testunity.c +3447 -0
  443. data/vendor/cmock/vendor/unity/README.md +211 -0
  444. data/vendor/cmock/vendor/unity/auto/colour_prompt.rb +115 -0
  445. data/vendor/cmock/vendor/unity/auto/colour_reporter.rb +39 -0
  446. data/vendor/cmock/vendor/unity/auto/generate_config.yml +36 -0
  447. data/vendor/cmock/vendor/unity/auto/generate_module.rb +202 -0
  448. data/vendor/cmock/vendor/unity/auto/generate_test_runner.rb +374 -0
  449. data/vendor/cmock/vendor/unity/auto/parseOutput.rb +191 -0
  450. data/vendor/cmock/vendor/unity/auto/test_file_filter.rb +23 -0
  451. data/vendor/cmock/vendor/unity/auto/type_sanitizer.rb +8 -0
  452. data/vendor/cmock/vendor/unity/auto/unity_test_summary.py +135 -0
  453. data/vendor/cmock/vendor/unity/auto/unity_test_summary.rb +148 -0
  454. data/vendor/cmock/vendor/unity/docs/Unity Summary.odt +0 -0
  455. data/vendor/cmock/vendor/unity/docs/Unity Summary.pdf +0 -0
  456. data/vendor/cmock/vendor/unity/docs/Unity Summary.txt +224 -0
  457. data/vendor/cmock/vendor/unity/docs/license.txt +21 -0
  458. data/vendor/{unity/examples/example_3 → cmock/vendor/unity/examples/example_1}/makefile +9 -5
  459. data/vendor/cmock/vendor/unity/examples/example_1/readme.txt +5 -0
  460. data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode.c +24 -0
  461. data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode.h +3 -0
  462. data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode2.c +11 -0
  463. data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode2.h +2 -0
  464. data/vendor/cmock/vendor/unity/examples/example_1/test/TestProductionCode.c +62 -0
  465. data/vendor/cmock/vendor/unity/examples/example_1/test/TestProductionCode2.c +31 -0
  466. data/vendor/cmock/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +53 -0
  467. data/vendor/cmock/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +57 -0
  468. data/vendor/cmock/vendor/unity/examples/example_2/makefile +71 -0
  469. data/vendor/cmock/vendor/unity/examples/example_2/readme.txt +5 -0
  470. data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode.c +24 -0
  471. data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode.h +3 -0
  472. data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode2.c +11 -0
  473. data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode2.h +2 -0
  474. data/vendor/cmock/vendor/unity/examples/example_2/test/TestProductionCode.c +64 -0
  475. data/vendor/cmock/vendor/unity/examples/example_2/test/TestProductionCode2.c +33 -0
  476. data/vendor/cmock/vendor/unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c +9 -0
  477. data/vendor/cmock/vendor/unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c +11 -0
  478. data/vendor/cmock/vendor/unity/examples/example_2/test/test_runners/all_tests.c +12 -0
  479. data/vendor/cmock/vendor/unity/examples/example_3/helper/UnityHelper.c +10 -0
  480. data/vendor/cmock/vendor/unity/examples/example_3/helper/UnityHelper.h +12 -0
  481. data/vendor/cmock/vendor/unity/examples/example_3/rakefile.rb +43 -0
  482. data/vendor/cmock/vendor/unity/examples/example_3/rakefile_helper.rb +256 -0
  483. data/vendor/cmock/vendor/unity/examples/example_3/readme.txt +19 -0
  484. data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode.c +24 -0
  485. data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode.h +3 -0
  486. data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode2.c +11 -0
  487. data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode2.h +2 -0
  488. data/vendor/cmock/vendor/unity/examples/example_3/target_gcc_32.yml +46 -0
  489. data/vendor/cmock/vendor/unity/examples/example_3/test/TestProductionCode.c +62 -0
  490. data/vendor/cmock/vendor/unity/examples/example_3/test/TestProductionCode2.c +31 -0
  491. data/vendor/cmock/vendor/unity/extras/eclipse/error_parsers.txt +26 -0
  492. data/vendor/cmock/vendor/unity/extras/fixture/rakefile.rb +48 -0
  493. data/vendor/cmock/vendor/unity/extras/fixture/rakefile_helper.rb +179 -0
  494. data/vendor/cmock/vendor/unity/extras/fixture/readme.txt +9 -0
  495. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c +423 -0
  496. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h +78 -0
  497. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h +46 -0
  498. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +45 -0
  499. data/vendor/cmock/vendor/unity/extras/fixture/test/Makefile +19 -0
  500. data/vendor/cmock/vendor/unity/extras/fixture/test/main/AllTests.c +21 -0
  501. data/vendor/cmock/vendor/unity/extras/fixture/test/testunity_fixture.c +39 -0
  502. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c +373 -0
  503. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +43 -0
  504. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.c +57 -0
  505. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.h +17 -0
  506. data/vendor/cmock/vendor/unity/release/build.info +2 -0
  507. data/vendor/cmock/vendor/unity/release/version.info +2 -0
  508. data/vendor/cmock/vendor/unity/src/unity.c +1324 -0
  509. data/vendor/cmock/vendor/unity/src/unity.h +285 -0
  510. data/vendor/cmock/vendor/unity/src/unity_internals.h +758 -0
  511. data/vendor/cmock/vendor/unity/test/expectdata/testsample_cmd.c +57 -0
  512. data/vendor/cmock/vendor/unity/test/expectdata/testsample_def.c +53 -0
  513. data/vendor/cmock/vendor/unity/test/expectdata/testsample_head1.c +51 -0
  514. data/vendor/cmock/vendor/unity/test/expectdata/testsample_head1.h +12 -0
  515. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_cmd.c +80 -0
  516. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_def.c +76 -0
  517. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_head1.c +75 -0
  518. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_head1.h +11 -0
  519. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new1.c +89 -0
  520. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new2.c +89 -0
  521. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_param.c +77 -0
  522. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run1.c +89 -0
  523. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run2.c +89 -0
  524. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_yaml.c +90 -0
  525. data/vendor/cmock/vendor/unity/test/expectdata/testsample_new1.c +63 -0
  526. data/vendor/cmock/vendor/unity/test/expectdata/testsample_new2.c +66 -0
  527. data/vendor/cmock/vendor/unity/test/expectdata/testsample_param.c +54 -0
  528. data/vendor/cmock/vendor/unity/test/expectdata/testsample_run1.c +63 -0
  529. data/vendor/cmock/vendor/unity/test/expectdata/testsample_run2.c +66 -0
  530. data/vendor/cmock/vendor/unity/test/expectdata/testsample_yaml.c +67 -0
  531. data/vendor/cmock/vendor/unity/test/rakefile +60 -0
  532. data/vendor/cmock/vendor/unity/test/rakefile_helper.rb +255 -0
  533. data/vendor/cmock/vendor/unity/test/targets/clang_file.yml +84 -0
  534. data/vendor/cmock/vendor/unity/test/targets/clang_strict.yml +84 -0
  535. data/vendor/cmock/vendor/unity/test/targets/gcc_32.yml +50 -0
  536. data/vendor/cmock/vendor/unity/test/targets/gcc_64.yml +51 -0
  537. data/vendor/cmock/vendor/unity/test/targets/gcc_auto_limits.yml +47 -0
  538. data/vendor/cmock/vendor/unity/test/targets/gcc_auto_sizeof.yml +48 -0
  539. data/vendor/cmock/vendor/unity/test/targets/gcc_auto_stdint.yml +59 -0
  540. data/vendor/cmock/vendor/unity/test/targets/gcc_manual_math.yml +47 -0
  541. data/vendor/cmock/vendor/unity/test/targets/hitech_picc18.yml +101 -0
  542. data/vendor/cmock/vendor/unity/test/targets/iar_arm_v4.yml +89 -0
  543. data/vendor/cmock/vendor/unity/test/targets/iar_arm_v5.yml +79 -0
  544. data/vendor/cmock/vendor/unity/test/targets/iar_arm_v5_3.yml +79 -0
  545. data/vendor/cmock/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +93 -0
  546. data/vendor/cmock/vendor/unity/test/targets/iar_cortexm3_v5.yml +83 -0
  547. data/vendor/cmock/vendor/unity/test/targets/iar_msp430.yml +94 -0
  548. data/vendor/cmock/vendor/unity/test/targets/iar_sh2a_v6.yml +85 -0
  549. data/vendor/cmock/vendor/unity/test/testdata/mocksample.c +51 -0
  550. data/vendor/cmock/vendor/unity/test/testdata/sample.yml +9 -0
  551. data/vendor/cmock/vendor/unity/test/testdata/testsample.c +51 -0
  552. data/vendor/cmock/vendor/unity/test/tests/test_generate_test_runner.rb +102 -0
  553. data/vendor/cmock/vendor/unity/test/tests/testparameterized.c +104 -0
  554. data/vendor/cmock/vendor/unity/test/tests/testunity.c +3656 -0
  555. data/vendor/unity/README.md +211 -203
  556. data/vendor/unity/auto/colour_reporter.rb +38 -38
  557. data/vendor/unity/auto/generate_config.yml +36 -36
  558. data/vendor/unity/auto/generate_module.rb +202 -202
  559. data/vendor/unity/auto/generate_test_runner.rb +389 -347
  560. data/vendor/unity/auto/parseOutput.rb +2 -0
  561. data/vendor/unity/auto/unity_test_summary.py +135 -135
  562. data/vendor/unity/auto/unity_test_summary.rb +148 -139
  563. data/vendor/unity/docs/Unity Summary.odt +0 -0
  564. data/vendor/unity/docs/Unity Summary.pdf +0 -0
  565. data/vendor/unity/docs/Unity Summary.txt +224 -216
  566. data/vendor/unity/docs/license.txt +21 -21
  567. data/vendor/unity/examples/example_1/makefile +7 -3
  568. data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +29 -9
  569. data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +26 -6
  570. data/vendor/unity/examples/example_2/makefile +7 -4
  571. data/vendor/unity/extras/fixture/rakefile.rb +48 -48
  572. data/vendor/unity/extras/fixture/rakefile_helper.rb +179 -179
  573. data/vendor/unity/extras/fixture/src/unity_fixture.c +123 -78
  574. data/vendor/unity/extras/fixture/src/unity_fixture.h +6 -14
  575. data/vendor/unity/extras/fixture/src/unity_fixture_internals.h +12 -15
  576. data/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +25 -0
  577. data/vendor/unity/extras/fixture/test/Makefile +35 -0
  578. data/vendor/unity/extras/fixture/test/main/AllTests.c +2 -1
  579. data/vendor/unity/extras/fixture/test/unity_fixture_Test.c +99 -4
  580. data/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +10 -0
  581. data/vendor/unity/extras/fixture/test/unity_output_Spy.c +3 -1
  582. data/vendor/unity/release/build.info +1 -1
  583. data/vendor/unity/release/version.info +1 -1
  584. data/vendor/unity/src/unity.c +1324 -1177
  585. data/vendor/unity/src/unity.h +285 -272
  586. data/vendor/unity/src/unity_internals.h +758 -692
  587. data/vendor/unity/test/expectdata/testsample_head1.c +51 -0
  588. data/vendor/unity/test/expectdata/testsample_head1.h +12 -0
  589. data/vendor/unity/test/expectdata/testsample_mock_cmd.c +1 -0
  590. data/vendor/unity/test/expectdata/testsample_mock_def.c +1 -0
  591. data/vendor/unity/test/expectdata/testsample_mock_head1.c +75 -0
  592. data/vendor/unity/test/expectdata/testsample_mock_head1.h +11 -0
  593. data/vendor/unity/test/expectdata/testsample_mock_new1.c +3 -2
  594. data/vendor/unity/test/expectdata/testsample_mock_new2.c +1 -0
  595. data/vendor/unity/test/expectdata/testsample_mock_param.c +1 -0
  596. data/vendor/unity/test/expectdata/testsample_mock_run1.c +3 -2
  597. data/vendor/unity/test/expectdata/testsample_mock_run2.c +1 -0
  598. data/vendor/unity/test/expectdata/testsample_mock_yaml.c +4 -3
  599. data/vendor/unity/test/expectdata/testsample_new1.c +2 -2
  600. data/vendor/unity/test/expectdata/testsample_run1.c +2 -2
  601. data/vendor/unity/test/expectdata/testsample_yaml.c +3 -3
  602. data/vendor/unity/test/rakefile +60 -60
  603. data/vendor/unity/test/rakefile_helper.rb +255 -249
  604. data/vendor/unity/test/targets/clang_file.yml +83 -0
  605. data/vendor/unity/test/targets/clang_strict.yml +83 -83
  606. data/vendor/unity/test/targets/gcc_32.yml +49 -49
  607. data/vendor/unity/test/targets/gcc_64.yml +50 -50
  608. data/vendor/unity/test/targets/gcc_auto_limits.yml +46 -46
  609. data/vendor/unity/test/targets/gcc_auto_sizeof.yml +47 -47
  610. data/vendor/unity/test/targets/gcc_auto_stdint.yml +58 -58
  611. data/vendor/unity/test/targets/gcc_manual_math.yml +46 -0
  612. data/vendor/unity/test/targets/hitech_picc18.yml +101 -101
  613. data/vendor/unity/test/targets/iar_arm_v4.yml +89 -89
  614. data/vendor/unity/test/targets/iar_arm_v5.yml +79 -79
  615. data/vendor/unity/test/targets/iar_arm_v5_3.yml +79 -79
  616. data/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +93 -93
  617. data/vendor/unity/test/targets/iar_cortexm3_v5.yml +83 -83
  618. data/vendor/unity/test/targets/iar_msp430.yml +94 -94
  619. data/vendor/unity/test/targets/iar_sh2a_v6.yml +85 -85
  620. data/vendor/unity/test/testdata/mocksample.c +51 -51
  621. data/vendor/unity/test/testdata/sample.yml +8 -8
  622. data/vendor/unity/test/testdata/testsample.c +51 -51
  623. data/vendor/unity/test/tests/test_generate_test_runner.rb +102 -88
  624. data/vendor/unity/test/tests/testparameterized.c +104 -101
  625. data/vendor/unity/test/tests/testunity.c +3676 -3447
  626. metadata +549 -191
@@ -8,6 +8,31 @@
8
8
  #ifndef UNITY_FIXTURE_MALLOC_OVERRIDES_H_
9
9
  #define UNITY_FIXTURE_MALLOC_OVERRIDES_H_
10
10
 
11
+ #include <stddef.h>
12
+
13
+ #ifdef UNITY_EXCLUDE_STDLIB_MALLOC
14
+ // Define this macro to remove the use of stdlib.h, malloc, and free.
15
+ // Many embedded systems do not have a heap or malloc/free by default.
16
+ // This internal unity_malloc() provides allocated memory deterministically from
17
+ // the end of an array only, unity_free() only releases from end-of-array,
18
+ // blocks are not coalesced, and memory not freed in LIFO order is stranded.
19
+ #ifndef UNITY_INTERNAL_HEAP_SIZE_BYTES
20
+ #define UNITY_INTERNAL_HEAP_SIZE_BYTES 256
21
+ #endif
22
+ #endif
23
+
24
+ // These functions are used by the Unity Fixture to allocate and release memory
25
+ // on the heap and can be overridden with platform-specific implementations.
26
+ // For example, when using FreeRTOS UNITY_FIXTURE_MALLOC becomes pvPortMalloc()
27
+ // and UNITY_FIXTURE_FREE becomes vPortFree().
28
+ #if !defined(UNITY_FIXTURE_MALLOC) || !defined(UNITY_FIXTURE_FREE)
29
+ #define UNITY_FIXTURE_MALLOC(size) malloc(size)
30
+ #define UNITY_FIXTURE_FREE(ptr) free(ptr)
31
+ #else
32
+ extern void* UNITY_FIXTURE_MALLOC(size_t size);
33
+ extern void UNITY_FIXTURE_FREE(void* ptr);
34
+ #endif
35
+
11
36
  #define malloc unity_malloc
12
37
  #define calloc unity_calloc
13
38
  #define realloc unity_realloc
@@ -0,0 +1,35 @@
1
+ CC = gcc
2
+ CFLAGS += -Werror
3
+ CFLAGS += -std=c99
4
+ CFLAGS += -pedantic
5
+ CFLAGS += -Wundef
6
+ DEFINES = -D UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar
7
+ SRC = ../src/unity_fixture.c \
8
+ ../../../src/unity.c \
9
+ unity_fixture_Test.c \
10
+ unity_fixture_TestRunner.c \
11
+ unity_output_Spy.c \
12
+ main/AllTests.c
13
+
14
+ INC_DIR = -I../src -I../../../src/
15
+ TARGET = fixture_tests.exe
16
+
17
+ all: default noStdlibMalloc 32bits
18
+
19
+ default:
20
+ $(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET)
21
+ @ echo "default build"
22
+ ./$(TARGET)
23
+
24
+ 32bits:
25
+ $(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -m32
26
+ @ echo "32bits build"
27
+ ./$(TARGET)
28
+
29
+ noStdlibMalloc:
30
+ $(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -D UNITY_EXCLUDE_STDLIB_MALLOC
31
+ @ echo "build with noStdlibMalloc"
32
+ ./$(TARGET)
33
+
34
+ clangEverything:
35
+ $(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -m64 -Weverything # || true #prevents make from failing
@@ -11,7 +11,8 @@ static void runAllTests(void)
11
11
  {
12
12
  RUN_TEST_GROUP(UnityFixture);
13
13
  RUN_TEST_GROUP(UnityCommandOptions);
14
- RUN_TEST_GROUP(LeakDetection)
14
+ RUN_TEST_GROUP(LeakDetection);
15
+ RUN_TEST_GROUP(InternalMalloc);
15
16
  }
16
17
 
17
18
  int main(int argc, const char* argv[])
@@ -79,9 +79,10 @@ TEST(UnityFixture, ReallocLargerNeeded)
79
79
  {
80
80
  void* m1 = malloc(10);
81
81
  void* m2;
82
+ CHECK(m1);
82
83
  strcpy((char*)m1, "123456789");
83
84
  m2 = realloc(m1, 15);
84
- CHECK(m1 != m2);
85
+ // CHECK(m1 != m2); //Depends on implementation
85
86
  STRCMP_EQUAL("123456789", m2);
86
87
  free(m2);
87
88
  }
@@ -104,6 +105,7 @@ TEST(UnityFixture, CallocFillsWithZero)
104
105
  {
105
106
  void* m = calloc(3, sizeof(char));
106
107
  char* s = (char*)m;
108
+ CHECK(m);
107
109
  TEST_ASSERT_BYTES_EQUAL(0, s[0]);
108
110
  TEST_ASSERT_BYTES_EQUAL(0, s[1]);
109
111
  TEST_ASSERT_BYTES_EQUAL(0, s[2]);
@@ -132,6 +134,11 @@ TEST(UnityFixture, PointerSet)
132
134
  TEST_ASSERT_POINTERS_EQUAL(&c2, p2);
133
135
  }
134
136
 
137
+ TEST(UnityFixture, FreeNULLSafety)
138
+ {
139
+ free(NULL);
140
+ }
141
+
135
142
  //------------------------------------------------------------
136
143
 
137
144
  TEST_GROUP(UnityCommandOptions);
@@ -272,6 +279,10 @@ TEST(UnityCommandOptions, UnknownCommandIsIgnored)
272
279
  TEST_ASSERT_EQUAL(98, UnityFixture.RepeatCount);
273
280
  }
274
281
 
282
+ IGNORE_TEST(UnityCommandOptions, TestShouldBeIgnored)
283
+ {
284
+ TEST_FAIL_MESSAGE("This test should not run!");
285
+ }
275
286
 
276
287
  //------------------------------------------------------------
277
288
 
@@ -279,7 +290,11 @@ TEST_GROUP(LeakDetection);
279
290
 
280
291
  TEST_SETUP(LeakDetection)
281
292
  {
293
+ #ifdef UNITY_EXCLUDE_STDLIB_MALLOC
294
+ UnityOutputCharSpy_Create(200);
295
+ #else
282
296
  UnityOutputCharSpy_Create(1000);
297
+ #endif
283
298
  }
284
299
 
285
300
  TEST_TEAR_DOWN(LeakDetection)
@@ -299,22 +314,41 @@ TEST_TEAR_DOWN(LeakDetection)
299
314
  memcpy(Unity.AbortFrame, TestAbortFrame, sizeof(jmp_buf)); \
300
315
  }
301
316
 
317
+ // This tricky set of defines lets us see if we are using the Spy, returns 1 if true, else 0
318
+ #define USING_SPY_AS(a) EXPAND_AND_USE_2ND(ASSIGN_VALUE(a), 0)
319
+ #define ASSIGN_VALUE(a) VAL_FUNC_##a
320
+ #define VAL_FUNC_UnityOutputCharSpy_OutputChar() 0, 1
321
+ #define EXPAND_AND_USE_2ND(a, b) SECOND_PARAM(a, b, throwaway)
322
+ #define SECOND_PARAM(a, b, ...) b
323
+ #if USING_SPY_AS(UNITY_OUTPUT_CHAR())
324
+ #define USING_OUTPUT_SPY
325
+ #endif
302
326
  TEST(LeakDetection, DetectsLeak)
303
327
  {
328
+ #ifndef USING_OUTPUT_SPY
329
+ TEST_IGNORE_MESSAGE("Build with '-D UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar' to enable tests");
330
+ #else
304
331
  void* m = malloc(10);
332
+ TEST_ASSERT_NOT_NULL(m);
305
333
  UnityOutputCharSpy_Enable(1);
306
334
  EXPECT_ABORT_BEGIN
307
335
  UnityMalloc_EndTest();
308
336
  EXPECT_ABORT_END
309
337
  UnityOutputCharSpy_Enable(0);
338
+ Unity.CurrentTestFailed = 0;
310
339
  CHECK(strstr(UnityOutputCharSpy_Get(), "This test leaks!"));
311
340
  free(m);
312
- Unity.CurrentTestFailed = 0;
341
+ #endif
313
342
  }
314
343
 
315
344
  TEST(LeakDetection, BufferOverrunFoundDuringFree)
316
345
  {
346
+ #ifndef USING_OUTPUT_SPY
347
+ UNITY_PRINT_EOL();
348
+ TEST_IGNORE();
349
+ #else
317
350
  void* m = malloc(10);
351
+ TEST_ASSERT_NOT_NULL(m);
318
352
  char* s = (char*)m;
319
353
  s[10] = (char)0xFF;
320
354
  UnityOutputCharSpy_Enable(1);
@@ -322,13 +356,19 @@ TEST(LeakDetection, BufferOverrunFoundDuringFree)
322
356
  free(m);
323
357
  EXPECT_ABORT_END
324
358
  UnityOutputCharSpy_Enable(0);
325
- CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during free()"));
326
359
  Unity.CurrentTestFailed = 0;
360
+ CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during free()"));
361
+ #endif
327
362
  }
328
363
 
329
364
  TEST(LeakDetection, BufferOverrunFoundDuringRealloc)
330
365
  {
366
+ #ifndef USING_OUTPUT_SPY
367
+ UNITY_PRINT_EOL();
368
+ TEST_IGNORE();
369
+ #else
331
370
  void* m = malloc(10);
371
+ TEST_ASSERT_NOT_NULL(m);
332
372
  char* s = (char*)m;
333
373
  s[10] = (char)0xFF;
334
374
  UnityOutputCharSpy_Enable(1);
@@ -336,6 +376,61 @@ TEST(LeakDetection, BufferOverrunFoundDuringRealloc)
336
376
  m = realloc(m, 100);
337
377
  EXPECT_ABORT_END
338
378
  UnityOutputCharSpy_Enable(0);
339
- CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during realloc()"));
340
379
  Unity.CurrentTestFailed = 0;
380
+ CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during realloc()"));
381
+ #endif
382
+ }
383
+
384
+ TEST_GROUP(InternalMalloc);
385
+
386
+ TEST_SETUP(InternalMalloc) { }
387
+ TEST_TEAR_DOWN(InternalMalloc) { }
388
+
389
+ TEST(InternalMalloc, MallocPastBufferFails)
390
+ {
391
+ #ifdef UNITY_EXCLUDE_STDLIB_MALLOC
392
+ void* m = malloc(UNITY_INTERNAL_HEAP_SIZE_BYTES/2 + 1);
393
+ TEST_ASSERT_NOT_NULL(m);
394
+ void* n = malloc(UNITY_INTERNAL_HEAP_SIZE_BYTES/2);
395
+ TEST_ASSERT_NULL(n);
396
+ free(m);
397
+ #endif
398
+ }
399
+
400
+ TEST(InternalMalloc, CallocPastBufferFails)
401
+ {
402
+ #ifdef UNITY_EXCLUDE_STDLIB_MALLOC
403
+ void* m = calloc(1, UNITY_INTERNAL_HEAP_SIZE_BYTES/2 + 1);
404
+ TEST_ASSERT_NOT_NULL(m);
405
+ void* n = calloc(1, UNITY_INTERNAL_HEAP_SIZE_BYTES/2);
406
+ TEST_ASSERT_NULL(n);
407
+ free(m);
408
+ #endif
409
+ }
410
+
411
+ TEST(InternalMalloc, MallocThenReallocGrowsMemoryInPlace)
412
+ {
413
+ #ifdef UNITY_EXCLUDE_STDLIB_MALLOC
414
+ void* m = malloc(UNITY_INTERNAL_HEAP_SIZE_BYTES/2 + 1);
415
+ TEST_ASSERT_NOT_NULL(m);
416
+ void* n = realloc(m, UNITY_INTERNAL_HEAP_SIZE_BYTES/2 + 9);
417
+ TEST_ASSERT_EQUAL(m, n);
418
+ free(n);
419
+ #endif
420
+ }
421
+
422
+ TEST(InternalMalloc, ReallocFailDoesNotFreeMem)
423
+ {
424
+ #ifdef UNITY_EXCLUDE_STDLIB_MALLOC
425
+ void* m = malloc(UNITY_INTERNAL_HEAP_SIZE_BYTES/2);
426
+ TEST_ASSERT_NOT_NULL(m);
427
+ void* n1 = malloc(10);
428
+ void* out_of_mem = realloc(n1, UNITY_INTERNAL_HEAP_SIZE_BYTES/2 + 1);
429
+ TEST_ASSERT_NULL(out_of_mem);
430
+ void* n2 = malloc(10);
431
+ TEST_ASSERT_NOT_EQUAL(n2, n1);
432
+ free(n2);
433
+ free(n1);
434
+ free(m);
435
+ #endif
341
436
  }
@@ -18,6 +18,7 @@ TEST_GROUP_RUNNER(UnityFixture)
18
18
  RUN_TEST_CASE(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer);
19
19
  RUN_TEST_CASE(UnityFixture, CallocFillsWithZero);
20
20
  RUN_TEST_CASE(UnityFixture, PointerSet);
21
+ RUN_TEST_CASE(UnityFixture, FreeNULLSafety);
21
22
  }
22
23
 
23
24
  TEST_GROUP_RUNNER(UnityCommandOptions)
@@ -31,6 +32,7 @@ TEST_GROUP_RUNNER(UnityCommandOptions)
31
32
  RUN_TEST_CASE(UnityCommandOptions, MultipleOptions);
32
33
  RUN_TEST_CASE(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified);
33
34
  RUN_TEST_CASE(UnityCommandOptions, UnknownCommandIsIgnored);
35
+ RUN_TEST_CASE(UnityCommandOptions, TestShouldBeIgnored);
34
36
  }
35
37
 
36
38
  TEST_GROUP_RUNNER(LeakDetection)
@@ -39,3 +41,11 @@ TEST_GROUP_RUNNER(LeakDetection)
39
41
  RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringFree);
40
42
  RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringRealloc);
41
43
  }
44
+
45
+ TEST_GROUP_RUNNER(InternalMalloc)
46
+ {
47
+ RUN_TEST_CASE(InternalMalloc, MallocPastBufferFails);
48
+ RUN_TEST_CASE(InternalMalloc, CallocPastBufferFails);
49
+ RUN_TEST_CASE(InternalMalloc, MallocThenReallocGrowsMemoryInPlace);
50
+ RUN_TEST_CASE(InternalMalloc, ReallocFailDoesNotFreeMem);
51
+ }
@@ -7,8 +7,9 @@
7
7
 
8
8
 
9
9
  #include "unity_output_Spy.h"
10
+ #include "unity_fixture.h"
11
+
10
12
  #include <stdio.h>
11
- #include <stdlib.h>
12
13
  #include <string.h>
13
14
 
14
15
  static int size;
@@ -22,6 +23,7 @@ void UnityOutputCharSpy_Create(int s)
22
23
  count = 0;
23
24
  spy_enable = 0;
24
25
  buffer = malloc(size);
26
+ TEST_ASSERT_NOT_NULL_MESSAGE(buffer, "Internal malloc failed in Spy Create():" __FILE__);
25
27
  memset(buffer, 0, size);
26
28
  }
27
29
 
@@ -1,2 +1,2 @@
1
- 118
1
+ 119
2
2
 
@@ -1,2 +1,2 @@
1
- 2.2.0
1
+ 2.3.0
2
2
 
@@ -1,1177 +1,1324 @@
1
- /* =========================================================================
2
- Unity Project - A Test Framework for C
3
- Copyright (c) 2007-14 Mike Karlesky, Mark VanderVoord, Greg Williams
4
- [Released under MIT License. Please refer to license.txt for details]
5
- ============================================================================ */
6
-
7
- #include "unity.h"
8
-
9
- #define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; longjmp(Unity.AbortFrame, 1); }
10
- #define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; longjmp(Unity.AbortFrame, 1); }
11
- /// return prematurely if we are already in failure or ignore state
12
- #define UNITY_SKIP_EXECUTION { if ((Unity.CurrentTestFailed != 0) || (Unity.CurrentTestIgnored != 0)) {return;} }
13
- #define UNITY_PRINT_EOL { UNITY_OUTPUT_CHAR('\n'); }
14
-
15
- struct _Unity Unity;
16
-
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
-
46
- #ifndef UNITY_EXCLUDE_FLOAT
47
- // Dividing by these constants produces +/- infinity.
48
- // The rationale is given in UnityAssertFloatIsInf's body.
49
- static const _UF f_zero = 0.0f;
50
- #ifndef UNITY_EXCLUDE_DOUBLE
51
- static const _UD d_zero = 0.0;
52
- #endif
53
- #endif
54
-
55
- // compiler-generic print formatting masks
56
- const _U_UINT UnitySizeMask[] =
57
- {
58
- 255u, // 0xFF
59
- 65535u, // 0xFFFF
60
- 65535u,
61
- 4294967295u, // 0xFFFFFFFF
62
- 4294967295u,
63
- 4294967295u,
64
- 4294967295u
65
- #ifdef UNITY_SUPPORT_64
66
- ,0xFFFFFFFFFFFFFFFF
67
- #endif
68
- };
69
-
70
- void UnityPrintFail(void);
71
- void UnityPrintOk(void);
72
-
73
- //-----------------------------------------------
74
- // Pretty Printers & Test Result Output Handlers
75
- //-----------------------------------------------
76
-
77
- void UnityPrint(const char* string)
78
- {
79
- const char* pch = string;
80
-
81
- if (pch != NULL)
82
- {
83
- while (*pch)
84
- {
85
- // printable characters plus CR & LF are printed
86
- if ((*pch <= 126) && (*pch >= 32))
87
- {
88
- UNITY_OUTPUT_CHAR(*pch);
89
- }
90
- //write escaped carriage returns
91
- else if (*pch == 13)
92
- {
93
- UNITY_OUTPUT_CHAR('\\');
94
- UNITY_OUTPUT_CHAR('r');
95
- }
96
- //write escaped line feeds
97
- else if (*pch == 10)
98
- {
99
- UNITY_OUTPUT_CHAR('\\');
100
- UNITY_OUTPUT_CHAR('n');
101
- }
102
- // unprintable characters are shown as codes
103
- else
104
- {
105
- UNITY_OUTPUT_CHAR('\\');
106
- UnityPrintNumberHex((_U_UINT)*pch, 2);
107
- }
108
- pch++;
109
- }
110
- }
111
- }
112
-
113
- //-----------------------------------------------
114
- void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style)
115
- {
116
- if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
117
- {
118
- UnityPrintNumber(number);
119
- }
120
- else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT)
121
- {
122
- UnityPrintNumberUnsigned( (_U_UINT)number & UnitySizeMask[((_U_UINT)style & (_U_UINT)0x0F) - 1] );
123
- }
124
- else
125
- {
126
- UnityPrintNumberHex((_U_UINT)number, (char)((style & 0x000F) << 1));
127
- }
128
- }
129
-
130
- //-----------------------------------------------
131
- /// basically do an itoa using as little ram as possible
132
- void UnityPrintNumber(const _U_SINT number_to_print)
133
- {
134
- _U_SINT divisor = 1;
135
- _U_SINT next_divisor;
136
- _U_UINT number;
137
-
138
- if (number_to_print == (1l << (UNITY_LONG_WIDTH-1)))
139
- {
140
- //The largest representable negative number
141
- UNITY_OUTPUT_CHAR('-');
142
- number = (1ul << (UNITY_LONG_WIDTH-1));
143
- }
144
- else if (number_to_print < 0)
145
- {
146
- //Some other negative number
147
- UNITY_OUTPUT_CHAR('-');
148
- number = (_U_UINT)(-number_to_print);
149
- }
150
- else
151
- {
152
- //Positive number
153
- number = (_U_UINT)number_to_print;
154
- }
155
-
156
- // figure out initial divisor
157
- while (number / divisor > 9)
158
- {
159
- next_divisor = divisor * 10;
160
- if (next_divisor > divisor)
161
- divisor = next_divisor;
162
- else
163
- break;
164
- }
165
-
166
- // now mod and print, then divide divisor
167
- do
168
- {
169
- UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10)));
170
- divisor /= 10;
171
- }
172
- while (divisor > 0);
173
- }
174
-
175
- //-----------------------------------------------
176
- /// basically do an itoa using as little ram as possible
177
- void UnityPrintNumberUnsigned(const _U_UINT number)
178
- {
179
- _U_UINT divisor = 1;
180
- _U_UINT next_divisor;
181
-
182
- // figure out initial divisor
183
- while (number / divisor > 9)
184
- {
185
- next_divisor = divisor * 10;
186
- if (next_divisor > divisor)
187
- divisor = next_divisor;
188
- else
189
- break;
190
- }
191
-
192
- // now mod and print, then divide divisor
193
- do
194
- {
195
- UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10)));
196
- divisor /= 10;
197
- }
198
- while (divisor > 0);
199
- }
200
-
201
- //-----------------------------------------------
202
- void UnityPrintNumberHex(const _U_UINT number, const char nibbles_to_print)
203
- {
204
- _U_UINT nibble;
205
- char nibbles = nibbles_to_print;
206
- UNITY_OUTPUT_CHAR('0');
207
- UNITY_OUTPUT_CHAR('x');
208
-
209
- while (nibbles > 0)
210
- {
211
- nibble = (number >> (--nibbles << 2)) & 0x0000000F;
212
- if (nibble <= 9)
213
- {
214
- UNITY_OUTPUT_CHAR((char)('0' + nibble));
215
- }
216
- else
217
- {
218
- UNITY_OUTPUT_CHAR((char)('A' - 10 + nibble));
219
- }
220
- }
221
- }
222
-
223
- //-----------------------------------------------
224
- void UnityPrintMask(const _U_UINT mask, const _U_UINT number)
225
- {
226
- _U_UINT current_bit = (_U_UINT)1 << (UNITY_INT_WIDTH - 1);
227
- _US32 i;
228
-
229
- for (i = 0; i < UNITY_INT_WIDTH; i++)
230
- {
231
- if (current_bit & mask)
232
- {
233
- if (current_bit & number)
234
- {
235
- UNITY_OUTPUT_CHAR('1');
236
- }
237
- else
238
- {
239
- UNITY_OUTPUT_CHAR('0');
240
- }
241
- }
242
- else
243
- {
244
- UNITY_OUTPUT_CHAR('X');
245
- }
246
- current_bit = current_bit >> 1;
247
- }
248
- }
249
-
250
- //-----------------------------------------------
251
- #ifdef UNITY_FLOAT_VERBOSE
252
- #include <string.h>
253
- void UnityPrintFloat(_UF number)
254
- {
255
- char TempBuffer[32];
256
- sprintf(TempBuffer, "%.6f", number);
257
- UnityPrint(TempBuffer);
258
- }
259
- #endif
260
-
261
- //-----------------------------------------------
262
-
263
- void UnityPrintFail(void)
264
- {
265
- UnityPrint(UnityStrFail);
266
- }
267
-
268
- void UnityPrintOk(void)
269
- {
270
- UnityPrint(UnityStrOk);
271
- }
272
-
273
- //-----------------------------------------------
274
- static void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line)
275
- {
276
- UnityPrint(file);
277
- UNITY_OUTPUT_CHAR(':');
278
- UnityPrintNumber((_U_SINT)line);
279
- UNITY_OUTPUT_CHAR(':');
280
- UnityPrint(Unity.CurrentTestName);
281
- UNITY_OUTPUT_CHAR(':');
282
- }
283
-
284
- //-----------------------------------------------
285
- static void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line)
286
- {
287
- UnityTestResultsBegin(Unity.TestFile, line);
288
- UnityPrint(UnityStrFail);
289
- UNITY_OUTPUT_CHAR(':');
290
- }
291
-
292
- //-----------------------------------------------
293
- void UnityConcludeTest(void)
294
- {
295
- if (Unity.CurrentTestIgnored)
296
- {
297
- Unity.TestIgnores++;
298
- }
299
- else if (!Unity.CurrentTestFailed)
300
- {
301
- UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber);
302
- UnityPrint(UnityStrPass);
303
- }
304
- else
305
- {
306
- Unity.TestFailures++;
307
- }
308
-
309
- Unity.CurrentTestFailed = 0;
310
- Unity.CurrentTestIgnored = 0;
311
- UNITY_PRINT_EOL;
312
- }
313
-
314
- //-----------------------------------------------
315
- static void UnityAddMsgIfSpecified(const char* msg)
316
- {
317
- if (msg)
318
- {
319
- UnityPrint(UnityStrSpacer);
320
- UnityPrint(msg);
321
- }
322
- }
323
-
324
- //-----------------------------------------------
325
- static void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual)
326
- {
327
- UnityPrint(UnityStrExpected);
328
- if (expected != NULL)
329
- {
330
- UNITY_OUTPUT_CHAR('\'');
331
- UnityPrint(expected);
332
- UNITY_OUTPUT_CHAR('\'');
333
- }
334
- else
335
- {
336
- UnityPrint(UnityStrNull);
337
- }
338
- UnityPrint(UnityStrWas);
339
- if (actual != NULL)
340
- {
341
- UNITY_OUTPUT_CHAR('\'');
342
- UnityPrint(actual);
343
- UNITY_OUTPUT_CHAR('\'');
344
- }
345
- else
346
- {
347
- UnityPrint(UnityStrNull);
348
- }
349
- }
350
-
351
- //-----------------------------------------------
352
- // Assertion & Control Helpers
353
- //-----------------------------------------------
354
-
355
- static int UnityCheckArraysForNull(UNITY_PTR_ATTRIBUTE const void* expected, UNITY_PTR_ATTRIBUTE const void* actual, const UNITY_LINE_TYPE lineNumber, const char* msg)
356
- {
357
- //return true if they are both NULL
358
- if ((expected == NULL) && (actual == NULL))
359
- return 1;
360
-
361
- //throw error if just expected is NULL
362
- if (expected == NULL)
363
- {
364
- UnityTestResultsFailBegin(lineNumber);
365
- UnityPrint(UnityStrNullPointerForExpected);
366
- UnityAddMsgIfSpecified(msg);
367
- UNITY_FAIL_AND_BAIL;
368
- }
369
-
370
- //throw error if just actual is NULL
371
- if (actual == NULL)
372
- {
373
- UnityTestResultsFailBegin(lineNumber);
374
- UnityPrint(UnityStrNullPointerForActual);
375
- UnityAddMsgIfSpecified(msg);
376
- UNITY_FAIL_AND_BAIL;
377
- }
378
-
379
- //return false if neither is NULL
380
- return 0;
381
- }
382
-
383
- //-----------------------------------------------
384
- // Assertion Functions
385
- //-----------------------------------------------
386
-
387
- void UnityAssertBits(const _U_SINT mask,
388
- const _U_SINT expected,
389
- const _U_SINT actual,
390
- const char* msg,
391
- const UNITY_LINE_TYPE lineNumber)
392
- {
393
- UNITY_SKIP_EXECUTION;
394
-
395
- if ((mask & expected) != (mask & actual))
396
- {
397
- UnityTestResultsFailBegin(lineNumber);
398
- UnityPrint(UnityStrExpected);
399
- UnityPrintMask((_U_UINT)mask, (_U_UINT)expected);
400
- UnityPrint(UnityStrWas);
401
- UnityPrintMask((_U_UINT)mask, (_U_UINT)actual);
402
- UnityAddMsgIfSpecified(msg);
403
- UNITY_FAIL_AND_BAIL;
404
- }
405
- }
406
-
407
- //-----------------------------------------------
408
- void UnityAssertEqualNumber(const _U_SINT expected,
409
- const _U_SINT actual,
410
- const char* msg,
411
- const UNITY_LINE_TYPE lineNumber,
412
- const UNITY_DISPLAY_STYLE_T style)
413
- {
414
- UNITY_SKIP_EXECUTION;
415
-
416
- if (expected != actual)
417
- {
418
- UnityTestResultsFailBegin(lineNumber);
419
- UnityPrint(UnityStrExpected);
420
- UnityPrintNumberByStyle(expected, style);
421
- UnityPrint(UnityStrWas);
422
- UnityPrintNumberByStyle(actual, style);
423
- UnityAddMsgIfSpecified(msg);
424
- UNITY_FAIL_AND_BAIL;
425
- }
426
- }
427
-
428
- //-----------------------------------------------
429
- void UnityAssertEqualIntArray(UNITY_PTR_ATTRIBUTE const void* expected,
430
- UNITY_PTR_ATTRIBUTE const void* actual,
431
- const _UU32 num_elements,
432
- const char* msg,
433
- const UNITY_LINE_TYPE lineNumber,
434
- const UNITY_DISPLAY_STYLE_T style)
435
- {
436
- _UU32 elements = num_elements;
437
- UNITY_PTR_ATTRIBUTE const _US8* ptr_exp = (UNITY_PTR_ATTRIBUTE const _US8*)expected;
438
- UNITY_PTR_ATTRIBUTE const _US8* ptr_act = (UNITY_PTR_ATTRIBUTE const _US8*)actual;
439
-
440
- UNITY_SKIP_EXECUTION;
441
-
442
- if (elements == 0)
443
- {
444
- UnityTestResultsFailBegin(lineNumber);
445
- UnityPrint(UnityStrPointless);
446
- UnityAddMsgIfSpecified(msg);
447
- UNITY_FAIL_AND_BAIL;
448
- }
449
-
450
- if (UnityCheckArraysForNull((UNITY_PTR_ATTRIBUTE const void*)expected, (UNITY_PTR_ATTRIBUTE const void*)actual, lineNumber, msg) == 1)
451
- return;
452
-
453
- // If style is UNITY_DISPLAY_STYLE_INT, we'll fall into the default case rather than the INT16 or INT32 (etc) case
454
- // as UNITY_DISPLAY_STYLE_INT includes a flag for UNITY_DISPLAY_RANGE_AUTO, which the width-specific
455
- // variants do not. Therefore remove this flag.
456
- switch(style & (UNITY_DISPLAY_STYLE_T)(~UNITY_DISPLAY_RANGE_AUTO))
457
- {
458
- case UNITY_DISPLAY_STYLE_HEX8:
459
- case UNITY_DISPLAY_STYLE_INT8:
460
- case UNITY_DISPLAY_STYLE_UINT8:
461
- while (elements--)
462
- {
463
- if (*ptr_exp != *ptr_act)
464
- {
465
- UnityTestResultsFailBegin(lineNumber);
466
- UnityPrint(UnityStrElement);
467
- UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
468
- UnityPrint(UnityStrExpected);
469
- UnityPrintNumberByStyle(*ptr_exp, style);
470
- UnityPrint(UnityStrWas);
471
- UnityPrintNumberByStyle(*ptr_act, style);
472
- UnityAddMsgIfSpecified(msg);
473
- UNITY_FAIL_AND_BAIL;
474
- }
475
- ptr_exp += 1;
476
- ptr_act += 1;
477
- }
478
- break;
479
- case UNITY_DISPLAY_STYLE_HEX16:
480
- case UNITY_DISPLAY_STYLE_INT16:
481
- case UNITY_DISPLAY_STYLE_UINT16:
482
- while (elements--)
483
- {
484
- if (*(UNITY_PTR_ATTRIBUTE const _US16*)(void*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const _US16*)(void*)ptr_act)
485
- {
486
- UnityTestResultsFailBegin(lineNumber);
487
- UnityPrint(UnityStrElement);
488
- UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
489
- UnityPrint(UnityStrExpected);
490
- UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US16*)(void*)ptr_exp, style);
491
- UnityPrint(UnityStrWas);
492
- UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US16*)(void*)ptr_act, style);
493
- UnityAddMsgIfSpecified(msg);
494
- UNITY_FAIL_AND_BAIL;
495
- }
496
- ptr_exp += 2;
497
- ptr_act += 2;
498
- }
499
- break;
500
- #ifdef UNITY_SUPPORT_64
501
- case UNITY_DISPLAY_STYLE_HEX64:
502
- case UNITY_DISPLAY_STYLE_INT64:
503
- case UNITY_DISPLAY_STYLE_UINT64:
504
- while (elements--)
505
- {
506
- if (*(UNITY_PTR_ATTRIBUTE const _US64*)(void*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const _US64*)(void*)ptr_act)
507
- {
508
- UnityTestResultsFailBegin(lineNumber);
509
- UnityPrint(UnityStrElement);
510
- UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
511
- UnityPrint(UnityStrExpected);
512
- UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US64*)(void*)ptr_exp, style);
513
- UnityPrint(UnityStrWas);
514
- UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US64*)(void*)ptr_act, style);
515
- UnityAddMsgIfSpecified(msg);
516
- UNITY_FAIL_AND_BAIL;
517
- }
518
- ptr_exp += 8;
519
- ptr_act += 8;
520
- }
521
- break;
522
- #endif
523
- default:
524
- while (elements--)
525
- {
526
- if (*(UNITY_PTR_ATTRIBUTE const _US32*)(void*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const _US32*)(void*)ptr_act)
527
- {
528
- UnityTestResultsFailBegin(lineNumber);
529
- UnityPrint(UnityStrElement);
530
- UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
531
- UnityPrint(UnityStrExpected);
532
- UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US32*)(void*)ptr_exp, style);
533
- UnityPrint(UnityStrWas);
534
- UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US32*)(void*)ptr_act, style);
535
- UnityAddMsgIfSpecified(msg);
536
- UNITY_FAIL_AND_BAIL;
537
- }
538
- ptr_exp += 4;
539
- ptr_act += 4;
540
- }
541
- break;
542
- }
543
- }
544
-
545
- //-----------------------------------------------
546
- #ifndef UNITY_EXCLUDE_FLOAT
547
- void UnityAssertEqualFloatArray(UNITY_PTR_ATTRIBUTE const _UF* expected,
548
- UNITY_PTR_ATTRIBUTE const _UF* actual,
549
- const _UU32 num_elements,
550
- const char* msg,
551
- const UNITY_LINE_TYPE lineNumber)
552
- {
553
- _UU32 elements = num_elements;
554
- UNITY_PTR_ATTRIBUTE const _UF* ptr_expected = expected;
555
- UNITY_PTR_ATTRIBUTE const _UF* ptr_actual = actual;
556
- _UF diff, tol;
557
-
558
- UNITY_SKIP_EXECUTION;
559
-
560
- if (elements == 0)
561
- {
562
- UnityTestResultsFailBegin(lineNumber);
563
- UnityPrint(UnityStrPointless);
564
- UnityAddMsgIfSpecified(msg);
565
- UNITY_FAIL_AND_BAIL;
566
- }
567
-
568
- if (UnityCheckArraysForNull((UNITY_PTR_ATTRIBUTE const void*)expected, (UNITY_PTR_ATTRIBUTE const void*)actual, lineNumber, msg) == 1)
569
- return;
570
-
571
- while (elements--)
572
- {
573
- diff = *ptr_expected - *ptr_actual;
574
- if (diff < 0.0f)
575
- diff = 0.0f - diff;
576
- tol = UNITY_FLOAT_PRECISION * *ptr_expected;
577
- if (tol < 0.0f)
578
- tol = 0.0f - tol;
579
-
580
- //This first part of this condition will catch any NaN or Infinite values
581
- if ((diff * 0.0f != 0.0f) || (diff > tol))
582
- {
583
- UnityTestResultsFailBegin(lineNumber);
584
- UnityPrint(UnityStrElement);
585
- UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
586
- #ifdef UNITY_FLOAT_VERBOSE
587
- UnityPrint(UnityStrExpected);
588
- UnityPrintFloat(*ptr_expected);
589
- UnityPrint(UnityStrWas);
590
- UnityPrintFloat(*ptr_actual);
591
- #else
592
- UnityPrint(UnityStrDelta);
593
- #endif
594
- UnityAddMsgIfSpecified(msg);
595
- UNITY_FAIL_AND_BAIL;
596
- }
597
- ptr_expected++;
598
- ptr_actual++;
599
- }
600
- }
601
-
602
- //-----------------------------------------------
603
- void UnityAssertFloatsWithin(const _UF delta,
604
- const _UF expected,
605
- const _UF actual,
606
- const char* msg,
607
- const UNITY_LINE_TYPE lineNumber)
608
- {
609
- _UF diff = actual - expected;
610
- _UF pos_delta = delta;
611
-
612
- UNITY_SKIP_EXECUTION;
613
-
614
- if (diff < 0.0f)
615
- {
616
- diff = 0.0f - diff;
617
- }
618
- if (pos_delta < 0.0f)
619
- {
620
- pos_delta = 0.0f - pos_delta;
621
- }
622
-
623
- //This first part of this condition will catch any NaN or Infinite values
624
- if ((diff * 0.0f != 0.0f) || (pos_delta < diff))
625
- {
626
- UnityTestResultsFailBegin(lineNumber);
627
- #ifdef UNITY_FLOAT_VERBOSE
628
- UnityPrint(UnityStrExpected);
629
- UnityPrintFloat(expected);
630
- UnityPrint(UnityStrWas);
631
- UnityPrintFloat(actual);
632
- #else
633
- UnityPrint(UnityStrDelta);
634
- #endif
635
- UnityAddMsgIfSpecified(msg);
636
- UNITY_FAIL_AND_BAIL;
637
- }
638
- }
639
-
640
- //-----------------------------------------------
641
- void UnityAssertFloatSpecial(const _UF actual,
642
- const char* msg,
643
- const UNITY_LINE_TYPE lineNumber,
644
- const UNITY_FLOAT_TRAIT_T style)
645
- {
646
- const char* trait_names[] = { UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet };
647
- _U_SINT should_be_trait = ((_U_SINT)style & 1);
648
- _U_SINT is_trait = !should_be_trait;
649
- _U_SINT trait_index = style >> 1;
650
-
651
- UNITY_SKIP_EXECUTION;
652
-
653
- switch(style)
654
- {
655
- //To determine Inf / Neg Inf, we compare to an Inf / Neg Inf value we create on the fly
656
- //We are using a variable to hold the zero value because some compilers complain about dividing by zero otherwise
657
- case UNITY_FLOAT_IS_INF:
658
- case UNITY_FLOAT_IS_NOT_INF:
659
- is_trait = ((1.0f / f_zero) == actual) ? 1 : 0;
660
- break;
661
- case UNITY_FLOAT_IS_NEG_INF:
662
- case UNITY_FLOAT_IS_NOT_NEG_INF:
663
- is_trait = ((-1.0f / f_zero) == actual) ? 1 : 0;
664
- break;
665
-
666
- //NaN is the only floating point value that does NOT equal itself. Therefore if Actual == Actual, then it is NOT NaN.
667
- case UNITY_FLOAT_IS_NAN:
668
- case UNITY_FLOAT_IS_NOT_NAN:
669
- is_trait = (actual == actual) ? 0 : 1;
670
- break;
671
-
672
- //A determinate number is non infinite and not NaN. (therefore the opposite of the two above)
673
- case UNITY_FLOAT_IS_DET:
674
- case UNITY_FLOAT_IS_NOT_DET:
675
- if ( (actual != actual) || ((1.0f / f_zero) == actual) || ((-1.0f / f_zero) == actual) )
676
- is_trait = 0;
677
- else
678
- is_trait = 1;
679
- break;
680
- default:
681
- ;
682
- }
683
-
684
- if (is_trait != should_be_trait)
685
- {
686
- UnityTestResultsFailBegin(lineNumber);
687
- UnityPrint(UnityStrExpected);
688
- if (!should_be_trait)
689
- UnityPrint(UnityStrNot);
690
- UnityPrint(trait_names[trait_index]);
691
- UnityPrint(UnityStrWas);
692
- #ifdef UNITY_FLOAT_VERBOSE
693
- UnityPrintFloat(actual);
694
- #else
695
- if (should_be_trait)
696
- UnityPrint(UnityStrNot);
697
- UnityPrint(trait_names[trait_index]);
698
- #endif
699
- UnityAddMsgIfSpecified(msg);
700
- UNITY_FAIL_AND_BAIL;
701
- }
702
- }
703
-
704
- #endif //not UNITY_EXCLUDE_FLOAT
705
-
706
- //-----------------------------------------------
707
- #ifndef UNITY_EXCLUDE_DOUBLE
708
- void UnityAssertEqualDoubleArray(UNITY_PTR_ATTRIBUTE const _UD* expected,
709
- UNITY_PTR_ATTRIBUTE const _UD* actual,
710
- const _UU32 num_elements,
711
- const char* msg,
712
- const UNITY_LINE_TYPE lineNumber)
713
- {
714
- _UU32 elements = num_elements;
715
- UNITY_PTR_ATTRIBUTE const _UD* ptr_expected = expected;
716
- UNITY_PTR_ATTRIBUTE const _UD* ptr_actual = actual;
717
- _UD diff, tol;
718
-
719
- UNITY_SKIP_EXECUTION;
720
-
721
- if (elements == 0)
722
- {
723
- UnityTestResultsFailBegin(lineNumber);
724
- UnityPrint(UnityStrPointless);
725
- UnityAddMsgIfSpecified(msg);
726
- UNITY_FAIL_AND_BAIL;
727
- }
728
-
729
- if (UnityCheckArraysForNull((UNITY_PTR_ATTRIBUTE void*)expected, (UNITY_PTR_ATTRIBUTE void*)actual, lineNumber, msg) == 1)
730
- return;
731
-
732
- while (elements--)
733
- {
734
- diff = *ptr_expected - *ptr_actual;
735
- if (diff < 0.0)
736
- diff = 0.0 - diff;
737
- tol = UNITY_DOUBLE_PRECISION * *ptr_expected;
738
- if (tol < 0.0)
739
- tol = 0.0 - tol;
740
-
741
- //This first part of this condition will catch any NaN or Infinite values
742
- if ((diff * 0.0 != 0.0) || (diff > tol))
743
- {
744
- UnityTestResultsFailBegin(lineNumber);
745
- UnityPrint(UnityStrElement);
746
- UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
747
- #ifdef UNITY_DOUBLE_VERBOSE
748
- UnityPrint(UnityStrExpected);
749
- UnityPrintFloat((float)(*ptr_expected));
750
- UnityPrint(UnityStrWas);
751
- UnityPrintFloat((float)(*ptr_actual));
752
- #else
753
- UnityPrint(UnityStrDelta);
754
- #endif
755
- UnityAddMsgIfSpecified(msg);
756
- UNITY_FAIL_AND_BAIL;
757
- }
758
- ptr_expected++;
759
- ptr_actual++;
760
- }
761
- }
762
-
763
- //-----------------------------------------------
764
- void UnityAssertDoublesWithin(const _UD delta,
765
- const _UD expected,
766
- const _UD actual,
767
- const char* msg,
768
- const UNITY_LINE_TYPE lineNumber)
769
- {
770
- _UD diff = actual - expected;
771
- _UD pos_delta = delta;
772
-
773
- UNITY_SKIP_EXECUTION;
774
-
775
- if (diff < 0.0)
776
- {
777
- diff = 0.0 - diff;
778
- }
779
- if (pos_delta < 0.0)
780
- {
781
- pos_delta = 0.0 - pos_delta;
782
- }
783
-
784
- //This first part of this condition will catch any NaN or Infinite values
785
- if ((diff * 0.0 != 0.0) || (pos_delta < diff))
786
- {
787
- UnityTestResultsFailBegin(lineNumber);
788
- #ifdef UNITY_DOUBLE_VERBOSE
789
- UnityPrint(UnityStrExpected);
790
- UnityPrintFloat((float)expected);
791
- UnityPrint(UnityStrWas);
792
- UnityPrintFloat((float)actual);
793
- #else
794
- UnityPrint(UnityStrDelta);
795
- #endif
796
- UnityAddMsgIfSpecified(msg);
797
- UNITY_FAIL_AND_BAIL;
798
- }
799
- }
800
-
801
- //-----------------------------------------------
802
-
803
- void UnityAssertDoubleSpecial(const _UD actual,
804
- const char* msg,
805
- const UNITY_LINE_TYPE lineNumber,
806
- const UNITY_FLOAT_TRAIT_T style)
807
- {
808
- const char* trait_names[] = { UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet };
809
- _U_SINT should_be_trait = ((_U_SINT)style & 1);
810
- _U_SINT is_trait = !should_be_trait;
811
- _U_SINT trait_index = style >> 1;
812
-
813
- UNITY_SKIP_EXECUTION;
814
-
815
- switch(style)
816
- {
817
- //To determine Inf / Neg Inf, we compare to an Inf / Neg Inf value we create on the fly
818
- //We are using a variable to hold the zero value because some compilers complain about dividing by zero otherwise
819
- case UNITY_FLOAT_IS_INF:
820
- case UNITY_FLOAT_IS_NOT_INF:
821
- is_trait = ((1.0 / d_zero) == actual) ? 1 : 0;
822
- break;
823
- case UNITY_FLOAT_IS_NEG_INF:
824
- case UNITY_FLOAT_IS_NOT_NEG_INF:
825
- is_trait = ((-1.0 / d_zero) == actual) ? 1 : 0;
826
- break;
827
-
828
- //NaN is the only floating point value that does NOT equal itself. Therefore if Actual == Actual, then it is NOT NaN.
829
- case UNITY_FLOAT_IS_NAN:
830
- case UNITY_FLOAT_IS_NOT_NAN:
831
- is_trait = (actual == actual) ? 0 : 1;
832
- break;
833
-
834
- //A determinate number is non infinite and not NaN. (therefore the opposite of the two above)
835
- case UNITY_FLOAT_IS_DET:
836
- case UNITY_FLOAT_IS_NOT_DET:
837
- if ( (actual != actual) || ((1.0 / d_zero) == actual) || ((-1.0 / d_zero) == actual) )
838
- is_trait = 0;
839
- else
840
- is_trait = 1;
841
- break;
842
- default:
843
- ;
844
- }
845
-
846
- if (is_trait != should_be_trait)
847
- {
848
- UnityTestResultsFailBegin(lineNumber);
849
- UnityPrint(UnityStrExpected);
850
- if (!should_be_trait)
851
- UnityPrint(UnityStrNot);
852
- UnityPrint(trait_names[trait_index]);
853
- UnityPrint(UnityStrWas);
854
- #ifdef UNITY_DOUBLE_VERBOSE
855
- UnityPrintFloat(actual);
856
- #else
857
- if (should_be_trait)
858
- UnityPrint(UnityStrNot);
859
- UnityPrint(trait_names[trait_index]);
860
- #endif
861
- UnityAddMsgIfSpecified(msg);
862
- UNITY_FAIL_AND_BAIL;
863
- }
864
- }
865
-
866
-
867
- #endif // not UNITY_EXCLUDE_DOUBLE
868
-
869
- //-----------------------------------------------
870
- void UnityAssertNumbersWithin( const _U_SINT delta,
871
- const _U_SINT expected,
872
- const _U_SINT actual,
873
- const char* msg,
874
- const UNITY_LINE_TYPE lineNumber,
875
- const UNITY_DISPLAY_STYLE_T style)
876
- {
877
- UNITY_SKIP_EXECUTION;
878
-
879
- if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
880
- {
881
- if (actual > expected)
882
- Unity.CurrentTestFailed = ((actual - expected) > delta);
883
- else
884
- Unity.CurrentTestFailed = ((expected - actual) > delta);
885
- }
886
- else
887
- {
888
- if ((_U_UINT)actual > (_U_UINT)expected)
889
- Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) > (_U_UINT)delta);
890
- else
891
- Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) > (_U_UINT)delta);
892
- }
893
-
894
- if (Unity.CurrentTestFailed)
895
- {
896
- UnityTestResultsFailBegin(lineNumber);
897
- UnityPrint(UnityStrDelta);
898
- UnityPrintNumberByStyle(delta, style);
899
- UnityPrint(UnityStrExpected);
900
- UnityPrintNumberByStyle(expected, style);
901
- UnityPrint(UnityStrWas);
902
- UnityPrintNumberByStyle(actual, style);
903
- UnityAddMsgIfSpecified(msg);
904
- UNITY_FAIL_AND_BAIL;
905
- }
906
- }
907
-
908
- //-----------------------------------------------
909
- void UnityAssertEqualString(const char* expected,
910
- const char* actual,
911
- const char* msg,
912
- const UNITY_LINE_TYPE lineNumber)
913
- {
914
- _UU32 i;
915
-
916
- UNITY_SKIP_EXECUTION;
917
-
918
- // if both pointers not null compare the strings
919
- if (expected && actual)
920
- {
921
- for (i = 0; expected[i] || actual[i]; i++)
922
- {
923
- if (expected[i] != actual[i])
924
- {
925
- Unity.CurrentTestFailed = 1;
926
- break;
927
- }
928
- }
929
- }
930
- else
931
- { // handle case of one pointers being null (if both null, test should pass)
932
- if (expected != actual)
933
- {
934
- Unity.CurrentTestFailed = 1;
935
- }
936
- }
937
-
938
- if (Unity.CurrentTestFailed)
939
- {
940
- UnityTestResultsFailBegin(lineNumber);
941
- UnityPrintExpectedAndActualStrings(expected, actual);
942
- UnityAddMsgIfSpecified(msg);
943
- UNITY_FAIL_AND_BAIL;
944
- }
945
- }
946
-
947
- //-----------------------------------------------
948
- void UnityAssertEqualStringArray( const char** expected,
949
- const char** actual,
950
- const _UU32 num_elements,
951
- const char* msg,
952
- const UNITY_LINE_TYPE lineNumber)
953
- {
954
- _UU32 i, j = 0;
955
-
956
- UNITY_SKIP_EXECUTION;
957
-
958
- // if no elements, it's an error
959
- if (num_elements == 0)
960
- {
961
- UnityTestResultsFailBegin(lineNumber);
962
- UnityPrint(UnityStrPointless);
963
- UnityAddMsgIfSpecified(msg);
964
- UNITY_FAIL_AND_BAIL;
965
- }
966
-
967
- if (UnityCheckArraysForNull((UNITY_PTR_ATTRIBUTE void*)expected, (UNITY_PTR_ATTRIBUTE void*)actual, lineNumber, msg) == 1)
968
- return;
969
-
970
- do
971
- {
972
- // if both pointers not null compare the strings
973
- if (expected[j] && actual[j])
974
- {
975
- for (i = 0; expected[j][i] || actual[j][i]; i++)
976
- {
977
- if (expected[j][i] != actual[j][i])
978
- {
979
- Unity.CurrentTestFailed = 1;
980
- break;
981
- }
982
- }
983
- }
984
- else
985
- { // handle case of one pointers being null (if both null, test should pass)
986
- if (expected[j] != actual[j])
987
- {
988
- Unity.CurrentTestFailed = 1;
989
- }
990
- }
991
-
992
- if (Unity.CurrentTestFailed)
993
- {
994
- UnityTestResultsFailBegin(lineNumber);
995
- if (num_elements > 1)
996
- {
997
- UnityPrint(UnityStrElement);
998
- UnityPrintNumberByStyle((j), UNITY_DISPLAY_STYLE_UINT);
999
- }
1000
- UnityPrintExpectedAndActualStrings((const char*)(expected[j]), (const char*)(actual[j]));
1001
- UnityAddMsgIfSpecified(msg);
1002
- UNITY_FAIL_AND_BAIL;
1003
- }
1004
- } while (++j < num_elements);
1005
- }
1006
-
1007
- //-----------------------------------------------
1008
- void UnityAssertEqualMemory( UNITY_PTR_ATTRIBUTE const void* expected,
1009
- UNITY_PTR_ATTRIBUTE const void* actual,
1010
- const _UU32 length,
1011
- const _UU32 num_elements,
1012
- const char* msg,
1013
- const UNITY_LINE_TYPE lineNumber)
1014
- {
1015
- UNITY_PTR_ATTRIBUTE const unsigned char* ptr_exp = (UNITY_PTR_ATTRIBUTE const unsigned char*)expected;
1016
- UNITY_PTR_ATTRIBUTE const unsigned char* ptr_act = (UNITY_PTR_ATTRIBUTE const unsigned char*)actual;
1017
- _UU32 elements = num_elements;
1018
- _UU32 bytes;
1019
-
1020
- UNITY_SKIP_EXECUTION;
1021
-
1022
- if ((elements == 0) || (length == 0))
1023
- {
1024
- UnityTestResultsFailBegin(lineNumber);
1025
- UnityPrint(UnityStrPointless);
1026
- UnityAddMsgIfSpecified(msg);
1027
- UNITY_FAIL_AND_BAIL;
1028
- }
1029
-
1030
- if (UnityCheckArraysForNull((UNITY_PTR_ATTRIBUTE const void*)expected, (UNITY_PTR_ATTRIBUTE const void*)actual, lineNumber, msg) == 1)
1031
- return;
1032
-
1033
- while (elements--)
1034
- {
1035
- /////////////////////////////////////
1036
- bytes = length;
1037
- while (bytes--)
1038
- {
1039
- if (*ptr_exp != *ptr_act)
1040
- {
1041
- UnityTestResultsFailBegin(lineNumber);
1042
- UnityPrint(UnityStrMemory);
1043
- if (num_elements > 1)
1044
- {
1045
- UnityPrint(UnityStrElement);
1046
- UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
1047
- }
1048
- UnityPrint(UnityStrByte);
1049
- UnityPrintNumberByStyle((length - bytes - 1), UNITY_DISPLAY_STYLE_UINT);
1050
- UnityPrint(UnityStrExpected);
1051
- UnityPrintNumberByStyle(*ptr_exp, UNITY_DISPLAY_STYLE_HEX8);
1052
- UnityPrint(UnityStrWas);
1053
- UnityPrintNumberByStyle(*ptr_act, UNITY_DISPLAY_STYLE_HEX8);
1054
- UnityAddMsgIfSpecified(msg);
1055
- UNITY_FAIL_AND_BAIL;
1056
- }
1057
- ptr_exp += 1;
1058
- ptr_act += 1;
1059
- }
1060
- /////////////////////////////////////
1061
-
1062
- }
1063
- }
1064
-
1065
- //-----------------------------------------------
1066
- // Control Functions
1067
- //-----------------------------------------------
1068
-
1069
- void UnityFail(const char* msg, const UNITY_LINE_TYPE line)
1070
- {
1071
- UNITY_SKIP_EXECUTION;
1072
-
1073
- UnityTestResultsBegin(Unity.TestFile, line);
1074
- UnityPrintFail();
1075
- if (msg != NULL)
1076
- {
1077
- UNITY_OUTPUT_CHAR(':');
1078
- if (msg[0] != ' ')
1079
- {
1080
- UNITY_OUTPUT_CHAR(' ');
1081
- }
1082
- UnityPrint(msg);
1083
- }
1084
- UNITY_FAIL_AND_BAIL;
1085
- }
1086
-
1087
- //-----------------------------------------------
1088
- void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line)
1089
- {
1090
- UNITY_SKIP_EXECUTION;
1091
-
1092
- UnityTestResultsBegin(Unity.TestFile, line);
1093
- UnityPrint(UnityStrIgnore);
1094
- if (msg != NULL)
1095
- {
1096
- UNITY_OUTPUT_CHAR(':');
1097
- UNITY_OUTPUT_CHAR(' ');
1098
- UnityPrint(msg);
1099
- }
1100
- UNITY_IGNORE_AND_BAIL;
1101
- }
1102
-
1103
- //-----------------------------------------------
1104
- #if defined(UNITY_WEAK_ATTRIBUTE)
1105
- void setUp(void);
1106
- void tearDown(void);
1107
- UNITY_WEAK_ATTRIBUTE void setUp(void) { }
1108
- UNITY_WEAK_ATTRIBUTE void tearDown(void) { }
1109
- #elif defined(UNITY_WEAK_PRAGMA)
1110
- # pragma weak setUp
1111
- void setUp(void);
1112
- # pragma weak tearDown
1113
- void tearDown(void);
1114
- #else
1115
- void setUp(void);
1116
- void tearDown(void);
1117
- #endif
1118
- //-----------------------------------------------
1119
- void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum)
1120
- {
1121
- Unity.CurrentTestName = FuncName;
1122
- Unity.CurrentTestLineNumber = (UNITY_LINE_TYPE)FuncLineNum;
1123
- Unity.NumberOfTests++;
1124
- if (TEST_PROTECT())
1125
- {
1126
- setUp();
1127
- Func();
1128
- }
1129
- if (TEST_PROTECT() && !(Unity.CurrentTestIgnored))
1130
- {
1131
- tearDown();
1132
- }
1133
- UnityConcludeTest();
1134
- }
1135
-
1136
- //-----------------------------------------------
1137
- void UnityBegin(const char* filename)
1138
- {
1139
- Unity.TestFile = filename;
1140
- Unity.CurrentTestName = NULL;
1141
- Unity.CurrentTestLineNumber = 0;
1142
- Unity.NumberOfTests = 0;
1143
- Unity.TestFailures = 0;
1144
- Unity.TestIgnores = 0;
1145
- Unity.CurrentTestFailed = 0;
1146
- Unity.CurrentTestIgnored = 0;
1147
-
1148
- UNITY_OUTPUT_START();
1149
- }
1150
-
1151
- //-----------------------------------------------
1152
- int UnityEnd(void)
1153
- {
1154
- UNITY_PRINT_EOL;
1155
- UnityPrint(UnityStrBreaker);
1156
- UNITY_PRINT_EOL;
1157
- UnityPrintNumber((_U_SINT)(Unity.NumberOfTests));
1158
- UnityPrint(UnityStrResultsTests);
1159
- UnityPrintNumber((_U_SINT)(Unity.TestFailures));
1160
- UnityPrint(UnityStrResultsFailures);
1161
- UnityPrintNumber((_U_SINT)(Unity.TestIgnores));
1162
- UnityPrint(UnityStrResultsIgnored);
1163
- UNITY_PRINT_EOL;
1164
- if (Unity.TestFailures == 0U)
1165
- {
1166
- UnityPrintOk();
1167
- }
1168
- else
1169
- {
1170
- UnityPrintFail();
1171
- }
1172
- UNITY_PRINT_EOL;
1173
- UNITY_OUTPUT_COMPLETE();
1174
- return (int)(Unity.TestFailures);
1175
- }
1176
-
1177
- //-----------------------------------------------
1
+ /* =========================================================================
2
+ Unity Project - A Test Framework for C
3
+ Copyright (c) 2007-14 Mike Karlesky, Mark VanderVoord, Greg Williams
4
+ [Released under MIT License. Please refer to license.txt for details]
5
+ ============================================================================ */
6
+
7
+ #include "unity.h"
8
+ #include <stddef.h>
9
+
10
+ #define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; longjmp(Unity.AbortFrame, 1); }
11
+ #define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; longjmp(Unity.AbortFrame, 1); }
12
+ /// return prematurely if we are already in failure or ignore state
13
+ #define UNITY_SKIP_EXECUTION { if ((Unity.CurrentTestFailed != 0) || (Unity.CurrentTestIgnored != 0)) {return;} }
14
+
15
+ struct _Unity Unity;
16
+
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 " ";
47
+
48
+ #ifdef UNITY_FLOAT_NEEDS_ZERO
49
+ // Dividing by these constants produces +/- infinity.
50
+ // The rationale is given in UnityAssertFloatIsInf's body.
51
+ static const _UF f_zero = 0.0f;
52
+ #endif
53
+
54
+ // compiler-generic print formatting masks
55
+ const _U_UINT UnitySizeMask[] =
56
+ {
57
+ 255u, // 0xFF
58
+ 65535u, // 0xFFFF
59
+ 65535u,
60
+ 4294967295u, // 0xFFFFFFFF
61
+ 4294967295u,
62
+ 4294967295u,
63
+ 4294967295u
64
+ #ifdef UNITY_SUPPORT_64
65
+ ,0xFFFFFFFFFFFFFFFF
66
+ #endif
67
+ };
68
+
69
+ void UnityPrintFail(void);
70
+ void UnityPrintOk(void);
71
+
72
+ //-----------------------------------------------
73
+ // Pretty Printers & Test Result Output Handlers
74
+ //-----------------------------------------------
75
+
76
+ void UnityPrint(const char* string)
77
+ {
78
+ const char* pch = string;
79
+
80
+ if (pch != NULL)
81
+ {
82
+ while (*pch)
83
+ {
84
+ // printable characters plus CR & LF are printed
85
+ if ((*pch <= 126) && (*pch >= 32))
86
+ {
87
+ UNITY_OUTPUT_CHAR(*pch);
88
+ }
89
+ //write escaped carriage returns
90
+ else if (*pch == 13)
91
+ {
92
+ UNITY_OUTPUT_CHAR('\\');
93
+ UNITY_OUTPUT_CHAR('r');
94
+ }
95
+ //write escaped line feeds
96
+ else if (*pch == 10)
97
+ {
98
+ UNITY_OUTPUT_CHAR('\\');
99
+ UNITY_OUTPUT_CHAR('n');
100
+ }
101
+ // unprintable characters are shown as codes
102
+ else
103
+ {
104
+ UNITY_OUTPUT_CHAR('\\');
105
+ UnityPrintNumberHex((_U_UINT)*pch, 2);
106
+ }
107
+ pch++;
108
+ }
109
+ }
110
+ }
111
+
112
+ void UnityPrintLen(const char* string, const _UU32 length);
113
+ void UnityPrintLen(const char* string, const _UU32 length)
114
+ {
115
+ const char* pch = string;
116
+
117
+ if (pch != NULL)
118
+ {
119
+ while (*pch && (_UU32)(pch - string) < length)
120
+ {
121
+ // printable characters plus CR & LF are printed
122
+ if ((*pch <= 126) && (*pch >= 32))
123
+ {
124
+ UNITY_OUTPUT_CHAR(*pch);
125
+ }
126
+ //write escaped carriage returns
127
+ else if (*pch == 13)
128
+ {
129
+ UNITY_OUTPUT_CHAR('\\');
130
+ UNITY_OUTPUT_CHAR('r');
131
+ }
132
+ //write escaped line feeds
133
+ else if (*pch == 10)
134
+ {
135
+ UNITY_OUTPUT_CHAR('\\');
136
+ UNITY_OUTPUT_CHAR('n');
137
+ }
138
+ // unprintable characters are shown as codes
139
+ else
140
+ {
141
+ UNITY_OUTPUT_CHAR('\\');
142
+ UnityPrintNumberHex((_U_UINT)*pch, 2);
143
+ }
144
+ pch++;
145
+ }
146
+ }
147
+ }
148
+
149
+ //-----------------------------------------------
150
+ void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style)
151
+ {
152
+ if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
153
+ {
154
+ UnityPrintNumber(number);
155
+ }
156
+ else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT)
157
+ {
158
+ UnityPrintNumberUnsigned( (_U_UINT)number & UnitySizeMask[((_U_UINT)style & (_U_UINT)0x0F) - 1] );
159
+ }
160
+ else
161
+ {
162
+ UnityPrintNumberHex((_U_UINT)number, (char)((style & 0x000F) << 1));
163
+ }
164
+ }
165
+
166
+ //-----------------------------------------------
167
+ /// basically do an itoa using as little ram as possible
168
+ void UnityPrintNumber(const _U_SINT number_to_print)
169
+ {
170
+ _U_UINT divisor = 1;
171
+ _U_UINT next_divisor;
172
+ _U_UINT number;
173
+
174
+ if (number_to_print < 0)
175
+ {
176
+ //A negative number, including MIN negative
177
+ UNITY_OUTPUT_CHAR('-');
178
+ number = (_U_UINT)(-number_to_print);
179
+ }
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);
203
+ }
204
+
205
+ //-----------------------------------------------
206
+ /// basically do an itoa using as little ram as possible
207
+ void UnityPrintNumberUnsigned(const _U_UINT number)
208
+ {
209
+ _U_UINT divisor = 1;
210
+ _U_UINT next_divisor;
211
+
212
+ // figure out initial divisor
213
+ while (number / divisor > 9)
214
+ {
215
+ next_divisor = divisor * 10;
216
+ if (next_divisor > divisor)
217
+ divisor = next_divisor;
218
+ else
219
+ break;
220
+ }
221
+
222
+ // now mod and print, then divide divisor
223
+ do
224
+ {
225
+ UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10)));
226
+ divisor /= 10;
227
+ }
228
+ while (divisor > 0);
229
+ }
230
+
231
+ //-----------------------------------------------
232
+ void UnityPrintNumberHex(const _U_UINT number, const char nibbles_to_print)
233
+ {
234
+ _U_UINT nibble;
235
+ char nibbles = nibbles_to_print;
236
+ UNITY_OUTPUT_CHAR('0');
237
+ UNITY_OUTPUT_CHAR('x');
238
+
239
+ while (nibbles > 0)
240
+ {
241
+ nibble = (number >> (--nibbles << 2)) & 0x0000000F;
242
+ if (nibble <= 9)
243
+ {
244
+ UNITY_OUTPUT_CHAR((char)('0' + nibble));
245
+ }
246
+ else
247
+ {
248
+ UNITY_OUTPUT_CHAR((char)('A' - 10 + nibble));
249
+ }
250
+ }
251
+ }
252
+
253
+ //-----------------------------------------------
254
+ void UnityPrintMask(const _U_UINT mask, const _U_UINT number)
255
+ {
256
+ _U_UINT current_bit = (_U_UINT)1 << (UNITY_INT_WIDTH - 1);
257
+ _US32 i;
258
+
259
+ for (i = 0; i < UNITY_INT_WIDTH; i++)
260
+ {
261
+ if (current_bit & mask)
262
+ {
263
+ if (current_bit & number)
264
+ {
265
+ UNITY_OUTPUT_CHAR('1');
266
+ }
267
+ else
268
+ {
269
+ UNITY_OUTPUT_CHAR('0');
270
+ }
271
+ }
272
+ else
273
+ {
274
+ UNITY_OUTPUT_CHAR('X');
275
+ }
276
+ current_bit = current_bit >> 1;
277
+ }
278
+ }
279
+
280
+ //-----------------------------------------------
281
+ #ifdef UNITY_FLOAT_VERBOSE
282
+ #include <stdio.h>
283
+ void UnityPrintFloat(_UF number)
284
+ {
285
+ char TempBuffer[32];
286
+ sprintf(TempBuffer, "%.6f", number);
287
+ UnityPrint(TempBuffer);
288
+ }
289
+ #endif
290
+
291
+ //-----------------------------------------------
292
+
293
+ void UnityPrintFail(void);
294
+ void UnityPrintFail(void)
295
+ {
296
+ UnityPrint(UnityStrFail);
297
+ }
298
+
299
+ void UnityPrintOk(void);
300
+ void UnityPrintOk(void)
301
+ {
302
+ UnityPrint(UnityStrOk);
303
+ }
304
+
305
+ //-----------------------------------------------
306
+ static void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line);
307
+ static void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line)
308
+ {
309
+ #ifndef UNITY_FIXTURES
310
+ UnityPrint(file);
311
+ UNITY_OUTPUT_CHAR(':');
312
+ UnityPrintNumber((_U_SINT)line);
313
+ UNITY_OUTPUT_CHAR(':');
314
+ UnityPrint(Unity.CurrentTestName);
315
+ UNITY_OUTPUT_CHAR(':');
316
+ #else
317
+ UNITY_UNUSED(file);
318
+ UNITY_UNUSED(line);
319
+ #endif
320
+ }
321
+
322
+ //-----------------------------------------------
323
+ static void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line);
324
+ static void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line)
325
+ {
326
+ #ifndef UNITY_FIXTURES
327
+ UnityTestResultsBegin(Unity.TestFile, line);
328
+ #else
329
+ UNITY_UNUSED(line);
330
+ #endif
331
+ UnityPrint(UnityStrFail);
332
+ UNITY_OUTPUT_CHAR(':');
333
+ }
334
+
335
+ //-----------------------------------------------
336
+ void UnityConcludeTest(void)
337
+ {
338
+ if (Unity.CurrentTestIgnored)
339
+ {
340
+ Unity.TestIgnores++;
341
+ }
342
+ else if (!Unity.CurrentTestFailed)
343
+ {
344
+ UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber);
345
+ UnityPrint(UnityStrPass);
346
+ }
347
+ else
348
+ {
349
+ Unity.TestFailures++;
350
+ }
351
+
352
+ Unity.CurrentTestFailed = 0;
353
+ Unity.CurrentTestIgnored = 0;
354
+ UNITY_PRINT_EOL();
355
+ }
356
+
357
+ //-----------------------------------------------
358
+ static void UnityAddMsgIfSpecified(const char* msg);
359
+ static void UnityAddMsgIfSpecified(const char* msg)
360
+ {
361
+ if (msg)
362
+ {
363
+ UnityPrint(UnityStrSpacer);
364
+ #ifndef UNITY_EXCLUDE_DETAILS
365
+ if (Unity.CurrentDetail1)
366
+ {
367
+ UnityPrint(UnityStrDetail1Name);
368
+ UnityPrint(Unity.CurrentDetail1);
369
+ if (Unity.CurrentDetail2)
370
+ {
371
+ UnityPrint(UnityStrDetail2Name);
372
+ UnityPrint(Unity.CurrentDetail2);
373
+ }
374
+ UnityPrint(UnityStrSpacer);
375
+ }
376
+ #endif
377
+ UnityPrint(msg);
378
+ }
379
+ }
380
+
381
+ //-----------------------------------------------
382
+ static void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual);
383
+ static void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual)
384
+ {
385
+ UnityPrint(UnityStrExpected);
386
+ if (expected != NULL)
387
+ {
388
+ UNITY_OUTPUT_CHAR('\'');
389
+ UnityPrint(expected);
390
+ UNITY_OUTPUT_CHAR('\'');
391
+ }
392
+ else
393
+ {
394
+ UnityPrint(UnityStrNull);
395
+ }
396
+ UnityPrint(UnityStrWas);
397
+ if (actual != NULL)
398
+ {
399
+ UNITY_OUTPUT_CHAR('\'');
400
+ UnityPrint(actual);
401
+ UNITY_OUTPUT_CHAR('\'');
402
+ }
403
+ else
404
+ {
405
+ UnityPrint(UnityStrNull);
406
+ }
407
+ }
408
+
409
+ //-----------------------------------------------
410
+ static void UnityPrintExpectedAndActualStringsLen(const char* expected, const char* actual, const _UU32 length)
411
+ {
412
+ UnityPrint(UnityStrExpected);
413
+ if (expected != NULL)
414
+ {
415
+ UNITY_OUTPUT_CHAR('\'');
416
+ UnityPrintLen(expected, length);
417
+ UNITY_OUTPUT_CHAR('\'');
418
+ }
419
+ else
420
+ {
421
+ UnityPrint(UnityStrNull);
422
+ }
423
+ UnityPrint(UnityStrWas);
424
+ if (actual != NULL)
425
+ {
426
+ UNITY_OUTPUT_CHAR('\'');
427
+ UnityPrintLen(actual, length);
428
+ UNITY_OUTPUT_CHAR('\'');
429
+ }
430
+ else
431
+ {
432
+ UnityPrint(UnityStrNull);
433
+ }
434
+ }
435
+
436
+
437
+
438
+ //-----------------------------------------------
439
+ // Assertion & Control Helpers
440
+ //-----------------------------------------------
441
+
442
+ static int UnityCheckArraysForNull(UNITY_INTERNAL_PTR expected, UNITY_INTERNAL_PTR actual, const UNITY_LINE_TYPE lineNumber, const char* msg)
443
+ {
444
+ //return true if they are both NULL
445
+ if ((expected == NULL) && (actual == NULL))
446
+ return 1;
447
+
448
+ //throw error if just expected is NULL
449
+ if (expected == NULL)
450
+ {
451
+ UnityTestResultsFailBegin(lineNumber);
452
+ UnityPrint(UnityStrNullPointerForExpected);
453
+ UnityAddMsgIfSpecified(msg);
454
+ UNITY_FAIL_AND_BAIL;
455
+ }
456
+
457
+ //throw error if just actual is NULL
458
+ if (actual == NULL)
459
+ {
460
+ UnityTestResultsFailBegin(lineNumber);
461
+ UnityPrint(UnityStrNullPointerForActual);
462
+ UnityAddMsgIfSpecified(msg);
463
+ UNITY_FAIL_AND_BAIL;
464
+ }
465
+
466
+ //return false if neither is NULL
467
+ return 0;
468
+ }
469
+
470
+ //-----------------------------------------------
471
+ // Assertion Functions
472
+ //-----------------------------------------------
473
+
474
+ void UnityAssertBits(const _U_SINT mask,
475
+ const _U_SINT expected,
476
+ const _U_SINT actual,
477
+ const char* msg,
478
+ const UNITY_LINE_TYPE lineNumber)
479
+ {
480
+ UNITY_SKIP_EXECUTION;
481
+
482
+ if ((mask & expected) != (mask & actual))
483
+ {
484
+ UnityTestResultsFailBegin(lineNumber);
485
+ UnityPrint(UnityStrExpected);
486
+ UnityPrintMask((_U_UINT)mask, (_U_UINT)expected);
487
+ UnityPrint(UnityStrWas);
488
+ UnityPrintMask((_U_UINT)mask, (_U_UINT)actual);
489
+ UnityAddMsgIfSpecified(msg);
490
+ UNITY_FAIL_AND_BAIL;
491
+ }
492
+ }
493
+
494
+ //-----------------------------------------------
495
+ void UnityAssertEqualNumber(const _U_SINT expected,
496
+ const _U_SINT actual,
497
+ const char* msg,
498
+ const UNITY_LINE_TYPE lineNumber,
499
+ const UNITY_DISPLAY_STYLE_T style)
500
+ {
501
+ UNITY_SKIP_EXECUTION;
502
+
503
+ if (expected != actual)
504
+ {
505
+ UnityTestResultsFailBegin(lineNumber);
506
+ UnityPrint(UnityStrExpected);
507
+ UnityPrintNumberByStyle(expected, style);
508
+ UnityPrint(UnityStrWas);
509
+ UnityPrintNumberByStyle(actual, style);
510
+ UnityAddMsgIfSpecified(msg);
511
+ UNITY_FAIL_AND_BAIL;
512
+ }
513
+ }
514
+
515
+ //-----------------------------------------------
516
+ void UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,
517
+ UNITY_INTERNAL_PTR actual,
518
+ const _UU32 num_elements,
519
+ const char* msg,
520
+ const UNITY_LINE_TYPE lineNumber,
521
+ const UNITY_DISPLAY_STYLE_T style)
522
+ {
523
+ _UU32 elements = num_elements;
524
+ UNITY_INTERNAL_PTR ptr_exp = (UNITY_INTERNAL_PTR)expected;
525
+ UNITY_INTERNAL_PTR ptr_act = (UNITY_INTERNAL_PTR)actual;
526
+
527
+ UNITY_SKIP_EXECUTION;
528
+
529
+ if (elements == 0)
530
+ {
531
+ UnityTestResultsFailBegin(lineNumber);
532
+ UnityPrint(UnityStrPointless);
533
+ UnityAddMsgIfSpecified(msg);
534
+ UNITY_FAIL_AND_BAIL;
535
+ }
536
+
537
+ if (UnityCheckArraysForNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg) == 1)
538
+ return;
539
+
540
+ // If style is UNITY_DISPLAY_STYLE_INT, we'll fall into the default case rather than the INT16 or INT32 (etc) case
541
+ // as UNITY_DISPLAY_STYLE_INT includes a flag for UNITY_DISPLAY_RANGE_AUTO, which the width-specific
542
+ // variants do not. Therefore remove this flag.
543
+ switch(style & (UNITY_DISPLAY_STYLE_T)(~UNITY_DISPLAY_RANGE_AUTO))
544
+ {
545
+ case UNITY_DISPLAY_STYLE_HEX8:
546
+ case UNITY_DISPLAY_STYLE_INT8:
547
+ case UNITY_DISPLAY_STYLE_UINT8:
548
+ while (elements--)
549
+ {
550
+ if (*(UNITY_PTR_ATTRIBUTE const _US8*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const _US8*)ptr_act)
551
+ {
552
+ UnityTestResultsFailBegin(lineNumber);
553
+ UnityPrint(UnityStrElement);
554
+ UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
555
+ UnityPrint(UnityStrExpected);
556
+ UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US8*)ptr_exp, style);
557
+ UnityPrint(UnityStrWas);
558
+ UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US8*)ptr_act, style);
559
+ UnityAddMsgIfSpecified(msg);
560
+ UNITY_FAIL_AND_BAIL;
561
+ }
562
+ ptr_exp = (UNITY_INTERNAL_PTR)((_UP)ptr_exp + 1);
563
+ ptr_act = (UNITY_INTERNAL_PTR)((_UP)ptr_act + 1);
564
+ }
565
+ break;
566
+ case UNITY_DISPLAY_STYLE_HEX16:
567
+ case UNITY_DISPLAY_STYLE_INT16:
568
+ case UNITY_DISPLAY_STYLE_UINT16:
569
+ while (elements--)
570
+ {
571
+ if (*(UNITY_PTR_ATTRIBUTE const _US16*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const _US16*)ptr_act)
572
+ {
573
+ UnityTestResultsFailBegin(lineNumber);
574
+ UnityPrint(UnityStrElement);
575
+ UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
576
+ UnityPrint(UnityStrExpected);
577
+ UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US16*)ptr_exp, style);
578
+ UnityPrint(UnityStrWas);
579
+ UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US16*)ptr_act, style);
580
+ UnityAddMsgIfSpecified(msg);
581
+ UNITY_FAIL_AND_BAIL;
582
+ }
583
+ ptr_exp = (UNITY_INTERNAL_PTR)((_UP)ptr_exp + 2);
584
+ ptr_act = (UNITY_INTERNAL_PTR)((_UP)ptr_act + 2);
585
+ }
586
+ break;
587
+ #ifdef UNITY_SUPPORT_64
588
+ case UNITY_DISPLAY_STYLE_HEX64:
589
+ case UNITY_DISPLAY_STYLE_INT64:
590
+ case UNITY_DISPLAY_STYLE_UINT64:
591
+ while (elements--)
592
+ {
593
+ if (*(UNITY_PTR_ATTRIBUTE const _US64*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const _US64*)ptr_act)
594
+ {
595
+ UnityTestResultsFailBegin(lineNumber);
596
+ UnityPrint(UnityStrElement);
597
+ UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
598
+ UnityPrint(UnityStrExpected);
599
+ UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US64*)ptr_exp, style);
600
+ UnityPrint(UnityStrWas);
601
+ UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US64*)ptr_act, style);
602
+ UnityAddMsgIfSpecified(msg);
603
+ UNITY_FAIL_AND_BAIL;
604
+ }
605
+ ptr_exp = (UNITY_INTERNAL_PTR)((_UP)ptr_exp + 8);
606
+ ptr_act = (UNITY_INTERNAL_PTR)((_UP)ptr_act + 8);
607
+ }
608
+ break;
609
+ #endif
610
+ default:
611
+ while (elements--)
612
+ {
613
+ if (*(UNITY_PTR_ATTRIBUTE const _US32*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const _US32*)ptr_act)
614
+ {
615
+ UnityTestResultsFailBegin(lineNumber);
616
+ UnityPrint(UnityStrElement);
617
+ UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
618
+ UnityPrint(UnityStrExpected);
619
+ UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US32*)ptr_exp, style);
620
+ UnityPrint(UnityStrWas);
621
+ UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US32*)ptr_act, style);
622
+ UnityAddMsgIfSpecified(msg);
623
+ UNITY_FAIL_AND_BAIL;
624
+ }
625
+ ptr_exp = (UNITY_INTERNAL_PTR)((_UP)ptr_exp + 4);
626
+ ptr_act = (UNITY_INTERNAL_PTR)((_UP)ptr_act + 4);
627
+ }
628
+ break;
629
+ }
630
+ }
631
+
632
+ //-----------------------------------------------
633
+ #ifndef UNITY_EXCLUDE_FLOAT
634
+ void UnityAssertEqualFloatArray(UNITY_PTR_ATTRIBUTE const _UF* expected,
635
+ UNITY_PTR_ATTRIBUTE const _UF* actual,
636
+ const _UU32 num_elements,
637
+ const char* msg,
638
+ const UNITY_LINE_TYPE lineNumber)
639
+ {
640
+ _UU32 elements = num_elements;
641
+ UNITY_PTR_ATTRIBUTE const _UF* ptr_expected = expected;
642
+ UNITY_PTR_ATTRIBUTE const _UF* ptr_actual = actual;
643
+ _UF diff, tol;
644
+
645
+ UNITY_SKIP_EXECUTION;
646
+
647
+ if (elements == 0)
648
+ {
649
+ UnityTestResultsFailBegin(lineNumber);
650
+ UnityPrint(UnityStrPointless);
651
+ UnityAddMsgIfSpecified(msg);
652
+ UNITY_FAIL_AND_BAIL;
653
+ }
654
+
655
+ if (UnityCheckArraysForNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg) == 1)
656
+ return;
657
+
658
+ while (elements--)
659
+ {
660
+ diff = *ptr_expected - *ptr_actual;
661
+ if (diff < 0.0f)
662
+ diff = 0.0f - diff;
663
+ tol = UNITY_FLOAT_PRECISION * *ptr_expected;
664
+ if (tol < 0.0f)
665
+ tol = 0.0f - tol;
666
+
667
+ //This first part of this condition will catch any NaN or Infinite values
668
+ if ((diff * 0.0f != 0.0f) || (diff > tol))
669
+ {
670
+ UnityTestResultsFailBegin(lineNumber);
671
+ UnityPrint(UnityStrElement);
672
+ UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
673
+ #ifdef UNITY_FLOAT_VERBOSE
674
+ UnityPrint(UnityStrExpected);
675
+ UnityPrintFloat(*ptr_expected);
676
+ UnityPrint(UnityStrWas);
677
+ UnityPrintFloat(*ptr_actual);
678
+ #else
679
+ UnityPrint(UnityStrDelta);
680
+ #endif
681
+ UnityAddMsgIfSpecified(msg);
682
+ UNITY_FAIL_AND_BAIL;
683
+ }
684
+ ptr_expected++;
685
+ ptr_actual++;
686
+ }
687
+ }
688
+
689
+ //-----------------------------------------------
690
+ void UnityAssertFloatsWithin(const _UF delta,
691
+ const _UF expected,
692
+ const _UF actual,
693
+ const char* msg,
694
+ const UNITY_LINE_TYPE lineNumber)
695
+ {
696
+ _UF diff = actual - expected;
697
+ _UF pos_delta = delta;
698
+
699
+ UNITY_SKIP_EXECUTION;
700
+
701
+ if (diff < 0.0f)
702
+ {
703
+ diff = 0.0f - diff;
704
+ }
705
+ if (pos_delta < 0.0f)
706
+ {
707
+ pos_delta = 0.0f - pos_delta;
708
+ }
709
+
710
+ //This first part of this condition will catch any NaN or Infinite values
711
+ if ((diff * 0.0f != 0.0f) || (pos_delta < diff))
712
+ {
713
+ UnityTestResultsFailBegin(lineNumber);
714
+ #ifdef UNITY_FLOAT_VERBOSE
715
+ UnityPrint(UnityStrExpected);
716
+ UnityPrintFloat(expected);
717
+ UnityPrint(UnityStrWas);
718
+ UnityPrintFloat(actual);
719
+ #else
720
+ UnityPrint(UnityStrDelta);
721
+ #endif
722
+ UnityAddMsgIfSpecified(msg);
723
+ UNITY_FAIL_AND_BAIL;
724
+ }
725
+ }
726
+
727
+ //-----------------------------------------------
728
+ void UnityAssertFloatSpecial(const _UF actual,
729
+ const char* msg,
730
+ const UNITY_LINE_TYPE lineNumber,
731
+ const UNITY_FLOAT_TRAIT_T style)
732
+ {
733
+ const char* trait_names[] = { UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet };
734
+ _U_SINT should_be_trait = ((_U_SINT)style & 1);
735
+ _U_SINT is_trait = !should_be_trait;
736
+ _U_SINT trait_index = style >> 1;
737
+
738
+ UNITY_SKIP_EXECUTION;
739
+
740
+ switch(style)
741
+ {
742
+ //To determine Inf / Neg Inf, we compare to an Inf / Neg Inf value we create on the fly
743
+ //We are using a variable to hold the zero value because some compilers complain about dividing by zero otherwise
744
+ case UNITY_FLOAT_IS_INF:
745
+ case UNITY_FLOAT_IS_NOT_INF:
746
+ is_trait = isinf(actual) & ispos(actual);
747
+ break;
748
+ case UNITY_FLOAT_IS_NEG_INF:
749
+ case UNITY_FLOAT_IS_NOT_NEG_INF:
750
+ is_trait = isinf(actual) & isneg(actual);
751
+ break;
752
+
753
+ //NaN is the only floating point value that does NOT equal itself. Therefore if Actual == Actual, then it is NOT NaN.
754
+ case UNITY_FLOAT_IS_NAN:
755
+ case UNITY_FLOAT_IS_NOT_NAN:
756
+ is_trait = isnan(actual);
757
+ break;
758
+
759
+ //A determinate number is non infinite and not NaN. (therefore the opposite of the two above)
760
+ case UNITY_FLOAT_IS_DET:
761
+ case UNITY_FLOAT_IS_NOT_DET:
762
+ if (isinf(actual) | isnan(actual))
763
+ is_trait = 0;
764
+ else
765
+ is_trait = 1;
766
+ break;
767
+
768
+ default:
769
+ break;
770
+ }
771
+
772
+ if (is_trait != should_be_trait)
773
+ {
774
+ UnityTestResultsFailBegin(lineNumber);
775
+ UnityPrint(UnityStrExpected);
776
+ if (!should_be_trait)
777
+ UnityPrint(UnityStrNot);
778
+ UnityPrint(trait_names[trait_index]);
779
+ UnityPrint(UnityStrWas);
780
+ #ifdef UNITY_FLOAT_VERBOSE
781
+ UnityPrintFloat(actual);
782
+ #else
783
+ if (should_be_trait)
784
+ UnityPrint(UnityStrNot);
785
+ UnityPrint(trait_names[trait_index]);
786
+ #endif
787
+ UnityAddMsgIfSpecified(msg);
788
+ UNITY_FAIL_AND_BAIL;
789
+ }
790
+ }
791
+
792
+ #endif //not UNITY_EXCLUDE_FLOAT
793
+
794
+ //-----------------------------------------------
795
+ #ifndef UNITY_EXCLUDE_DOUBLE
796
+ void UnityAssertEqualDoubleArray(UNITY_PTR_ATTRIBUTE const _UD* expected,
797
+ UNITY_PTR_ATTRIBUTE const _UD* actual,
798
+ const _UU32 num_elements,
799
+ const char* msg,
800
+ const UNITY_LINE_TYPE lineNumber)
801
+ {
802
+ _UU32 elements = num_elements;
803
+ UNITY_PTR_ATTRIBUTE const _UD* ptr_expected = expected;
804
+ UNITY_PTR_ATTRIBUTE const _UD* ptr_actual = actual;
805
+ _UD diff, tol;
806
+
807
+ UNITY_SKIP_EXECUTION;
808
+
809
+ if (elements == 0)
810
+ {
811
+ UnityTestResultsFailBegin(lineNumber);
812
+ UnityPrint(UnityStrPointless);
813
+ UnityAddMsgIfSpecified(msg);
814
+ UNITY_FAIL_AND_BAIL;
815
+ }
816
+
817
+ if (UnityCheckArraysForNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg) == 1)
818
+ return;
819
+
820
+ while (elements--)
821
+ {
822
+ diff = *ptr_expected - *ptr_actual;
823
+ if (diff < 0.0)
824
+ diff = 0.0 - diff;
825
+ tol = UNITY_DOUBLE_PRECISION * *ptr_expected;
826
+ if (tol < 0.0)
827
+ tol = 0.0 - tol;
828
+
829
+ //This first part of this condition will catch any NaN or Infinite values
830
+ if ((diff * 0.0 != 0.0) || (diff > tol))
831
+ {
832
+ UnityTestResultsFailBegin(lineNumber);
833
+ UnityPrint(UnityStrElement);
834
+ UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
835
+ #ifdef UNITY_DOUBLE_VERBOSE
836
+ UnityPrint(UnityStrExpected);
837
+ UnityPrintFloat((float)(*ptr_expected));
838
+ UnityPrint(UnityStrWas);
839
+ UnityPrintFloat((float)(*ptr_actual));
840
+ #else
841
+ UnityPrint(UnityStrDelta);
842
+ #endif
843
+ UnityAddMsgIfSpecified(msg);
844
+ UNITY_FAIL_AND_BAIL;
845
+ }
846
+ ptr_expected++;
847
+ ptr_actual++;
848
+ }
849
+ }
850
+
851
+ //-----------------------------------------------
852
+ void UnityAssertDoublesWithin(const _UD delta,
853
+ const _UD expected,
854
+ const _UD actual,
855
+ const char* msg,
856
+ const UNITY_LINE_TYPE lineNumber)
857
+ {
858
+ _UD diff = actual - expected;
859
+ _UD pos_delta = delta;
860
+
861
+ UNITY_SKIP_EXECUTION;
862
+
863
+ if (diff < 0.0)
864
+ {
865
+ diff = 0.0 - diff;
866
+ }
867
+ if (pos_delta < 0.0)
868
+ {
869
+ pos_delta = 0.0 - pos_delta;
870
+ }
871
+
872
+ //This first part of this condition will catch any NaN or Infinite values
873
+ if ((diff * 0.0 != 0.0) || (pos_delta < diff))
874
+ {
875
+ UnityTestResultsFailBegin(lineNumber);
876
+ #ifdef UNITY_DOUBLE_VERBOSE
877
+ UnityPrint(UnityStrExpected);
878
+ UnityPrintFloat((float)expected);
879
+ UnityPrint(UnityStrWas);
880
+ UnityPrintFloat((float)actual);
881
+ #else
882
+ UnityPrint(UnityStrDelta);
883
+ #endif
884
+ UnityAddMsgIfSpecified(msg);
885
+ UNITY_FAIL_AND_BAIL;
886
+ }
887
+ }
888
+
889
+ //-----------------------------------------------
890
+
891
+ void UnityAssertDoubleSpecial(const _UD actual,
892
+ const char* msg,
893
+ const UNITY_LINE_TYPE lineNumber,
894
+ const UNITY_FLOAT_TRAIT_T style)
895
+ {
896
+ const char* trait_names[] = { UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet };
897
+ _U_SINT should_be_trait = ((_U_SINT)style & 1);
898
+ _U_SINT is_trait = !should_be_trait;
899
+ _U_SINT trait_index = style >> 1;
900
+
901
+ UNITY_SKIP_EXECUTION;
902
+
903
+ switch(style)
904
+ {
905
+ //To determine Inf / Neg Inf, we compare to an Inf / Neg Inf value we create on the fly
906
+ //We are using a variable to hold the zero value because some compilers complain about dividing by zero otherwise
907
+ case UNITY_FLOAT_IS_INF:
908
+ case UNITY_FLOAT_IS_NOT_INF:
909
+ is_trait = isinf(actual) & ispos(actual);
910
+ break;
911
+ case UNITY_FLOAT_IS_NEG_INF:
912
+ case UNITY_FLOAT_IS_NOT_NEG_INF:
913
+ is_trait = isinf(actual) & isneg(actual);
914
+ break;
915
+
916
+ //NaN is the only floating point value that does NOT equal itself. Therefore if Actual == Actual, then it is NOT NaN.
917
+ case UNITY_FLOAT_IS_NAN:
918
+ case UNITY_FLOAT_IS_NOT_NAN:
919
+ is_trait = isnan(actual);
920
+ break;
921
+
922
+ //A determinate number is non infinite and not NaN. (therefore the opposite of the two above)
923
+ case UNITY_FLOAT_IS_DET:
924
+ case UNITY_FLOAT_IS_NOT_DET:
925
+ if (isinf(actual) | isnan(actual))
926
+ is_trait = 0;
927
+ else
928
+ is_trait = 1;
929
+ break;
930
+
931
+ default:
932
+ break;
933
+ }
934
+
935
+ if (is_trait != should_be_trait)
936
+ {
937
+ UnityTestResultsFailBegin(lineNumber);
938
+ UnityPrint(UnityStrExpected);
939
+ if (!should_be_trait)
940
+ UnityPrint(UnityStrNot);
941
+ UnityPrint(trait_names[trait_index]);
942
+ UnityPrint(UnityStrWas);
943
+ #ifdef UNITY_DOUBLE_VERBOSE
944
+ UnityPrintFloat(actual);
945
+ #else
946
+ if (should_be_trait)
947
+ UnityPrint(UnityStrNot);
948
+ UnityPrint(trait_names[trait_index]);
949
+ #endif
950
+ UnityAddMsgIfSpecified(msg);
951
+ UNITY_FAIL_AND_BAIL;
952
+ }
953
+ }
954
+
955
+
956
+ #endif // not UNITY_EXCLUDE_DOUBLE
957
+
958
+ //-----------------------------------------------
959
+ void UnityAssertNumbersWithin( const _U_UINT delta,
960
+ const _U_SINT expected,
961
+ const _U_SINT actual,
962
+ const char* msg,
963
+ const UNITY_LINE_TYPE lineNumber,
964
+ const UNITY_DISPLAY_STYLE_T style)
965
+ {
966
+ UNITY_SKIP_EXECUTION;
967
+
968
+ if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
969
+ {
970
+ if (actual > expected)
971
+ Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) > delta);
972
+ else
973
+ Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) > delta);
974
+ }
975
+ else
976
+ {
977
+ if ((_U_UINT)actual > (_U_UINT)expected)
978
+ Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) > delta);
979
+ else
980
+ Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) > delta);
981
+ }
982
+
983
+ if (Unity.CurrentTestFailed)
984
+ {
985
+ UnityTestResultsFailBegin(lineNumber);
986
+ UnityPrint(UnityStrDelta);
987
+ UnityPrintNumberByStyle((_U_SINT)delta, style);
988
+ UnityPrint(UnityStrExpected);
989
+ UnityPrintNumberByStyle(expected, style);
990
+ UnityPrint(UnityStrWas);
991
+ UnityPrintNumberByStyle(actual, style);
992
+ UnityAddMsgIfSpecified(msg);
993
+ UNITY_FAIL_AND_BAIL;
994
+ }
995
+ }
996
+
997
+ //-----------------------------------------------
998
+ void UnityAssertEqualString(const char* expected,
999
+ const char* actual,
1000
+ const char* msg,
1001
+ const UNITY_LINE_TYPE lineNumber)
1002
+ {
1003
+ _UU32 i;
1004
+
1005
+ UNITY_SKIP_EXECUTION;
1006
+
1007
+ // if both pointers not null compare the strings
1008
+ if (expected && actual)
1009
+ {
1010
+ for (i = 0; expected[i] || actual[i]; i++)
1011
+ {
1012
+ if (expected[i] != actual[i])
1013
+ {
1014
+ Unity.CurrentTestFailed = 1;
1015
+ break;
1016
+ }
1017
+ }
1018
+ }
1019
+ else
1020
+ { // handle case of one pointers being null (if both null, test should pass)
1021
+ if (expected != actual)
1022
+ {
1023
+ Unity.CurrentTestFailed = 1;
1024
+ }
1025
+ }
1026
+
1027
+ if (Unity.CurrentTestFailed)
1028
+ {
1029
+ UnityTestResultsFailBegin(lineNumber);
1030
+ UnityPrintExpectedAndActualStrings(expected, actual);
1031
+ UnityAddMsgIfSpecified(msg);
1032
+ UNITY_FAIL_AND_BAIL;
1033
+ }
1034
+ }
1035
+
1036
+ //-----------------------------------------------
1037
+ void UnityAssertEqualStringLen(const char* expected,
1038
+ const char* actual,
1039
+ const _UU32 length,
1040
+ const char* msg,
1041
+ const UNITY_LINE_TYPE lineNumber)
1042
+ {
1043
+ _UU32 i;
1044
+
1045
+ UNITY_SKIP_EXECUTION;
1046
+
1047
+ // if both pointers not null compare the strings
1048
+ if (expected && actual)
1049
+ {
1050
+ for (i = 0; (expected[i] || actual[i]) && i < length; i++)
1051
+ {
1052
+ if (expected[i] != actual[i])
1053
+ {
1054
+ Unity.CurrentTestFailed = 1;
1055
+ break;
1056
+ }
1057
+ }
1058
+ }
1059
+ else
1060
+ { // handle case of one pointers being null (if both null, test should pass)
1061
+ if (expected != actual)
1062
+ {
1063
+ Unity.CurrentTestFailed = 1;
1064
+ }
1065
+ }
1066
+
1067
+ if (Unity.CurrentTestFailed)
1068
+ {
1069
+ UnityTestResultsFailBegin(lineNumber);
1070
+ UnityPrintExpectedAndActualStringsLen(expected, actual, length);
1071
+ UnityAddMsgIfSpecified(msg);
1072
+ UNITY_FAIL_AND_BAIL;
1073
+ }
1074
+ }
1075
+
1076
+
1077
+ //-----------------------------------------------
1078
+ void UnityAssertEqualStringArray( const char** expected,
1079
+ const char** actual,
1080
+ const _UU32 num_elements,
1081
+ const char* msg,
1082
+ const UNITY_LINE_TYPE lineNumber)
1083
+ {
1084
+ _UU32 i, j = 0;
1085
+
1086
+ UNITY_SKIP_EXECUTION;
1087
+
1088
+ // if no elements, it's an error
1089
+ if (num_elements == 0)
1090
+ {
1091
+ UnityTestResultsFailBegin(lineNumber);
1092
+ UnityPrint(UnityStrPointless);
1093
+ UnityAddMsgIfSpecified(msg);
1094
+ UNITY_FAIL_AND_BAIL;
1095
+ }
1096
+
1097
+ if (UnityCheckArraysForNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg) == 1)
1098
+ return;
1099
+
1100
+ do
1101
+ {
1102
+ // if both pointers not null compare the strings
1103
+ if (expected[j] && actual[j])
1104
+ {
1105
+ for (i = 0; expected[j][i] || actual[j][i]; i++)
1106
+ {
1107
+ if (expected[j][i] != actual[j][i])
1108
+ {
1109
+ Unity.CurrentTestFailed = 1;
1110
+ break;
1111
+ }
1112
+ }
1113
+ }
1114
+ else
1115
+ { // handle case of one pointers being null (if both null, test should pass)
1116
+ if (expected[j] != actual[j])
1117
+ {
1118
+ Unity.CurrentTestFailed = 1;
1119
+ }
1120
+ }
1121
+
1122
+ if (Unity.CurrentTestFailed)
1123
+ {
1124
+ UnityTestResultsFailBegin(lineNumber);
1125
+ if (num_elements > 1)
1126
+ {
1127
+ UnityPrint(UnityStrElement);
1128
+ UnityPrintNumberByStyle((j), UNITY_DISPLAY_STYLE_UINT);
1129
+ }
1130
+ UnityPrintExpectedAndActualStrings((const char*)(expected[j]), (const char*)(actual[j]));
1131
+ UnityAddMsgIfSpecified(msg);
1132
+ UNITY_FAIL_AND_BAIL;
1133
+ }
1134
+ } while (++j < num_elements);
1135
+ }
1136
+
1137
+ //-----------------------------------------------
1138
+ void UnityAssertEqualMemory( UNITY_INTERNAL_PTR expected,
1139
+ UNITY_INTERNAL_PTR actual,
1140
+ const _UU32 length,
1141
+ const _UU32 num_elements,
1142
+ const char* msg,
1143
+ const UNITY_LINE_TYPE lineNumber)
1144
+ {
1145
+ UNITY_PTR_ATTRIBUTE const unsigned char* ptr_exp = (UNITY_PTR_ATTRIBUTE const unsigned char*)expected;
1146
+ UNITY_PTR_ATTRIBUTE const unsigned char* ptr_act = (UNITY_PTR_ATTRIBUTE const unsigned char*)actual;
1147
+ _UU32 elements = num_elements;
1148
+ _UU32 bytes;
1149
+
1150
+ UNITY_SKIP_EXECUTION;
1151
+
1152
+ if ((elements == 0) || (length == 0))
1153
+ {
1154
+ UnityTestResultsFailBegin(lineNumber);
1155
+ UnityPrint(UnityStrPointless);
1156
+ UnityAddMsgIfSpecified(msg);
1157
+ UNITY_FAIL_AND_BAIL;
1158
+ }
1159
+
1160
+ if (UnityCheckArraysForNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg) == 1)
1161
+ return;
1162
+
1163
+ while (elements--)
1164
+ {
1165
+ /////////////////////////////////////
1166
+ bytes = length;
1167
+ while (bytes--)
1168
+ {
1169
+ if (*ptr_exp != *ptr_act)
1170
+ {
1171
+ UnityTestResultsFailBegin(lineNumber);
1172
+ UnityPrint(UnityStrMemory);
1173
+ if (num_elements > 1)
1174
+ {
1175
+ UnityPrint(UnityStrElement);
1176
+ UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
1177
+ }
1178
+ UnityPrint(UnityStrByte);
1179
+ UnityPrintNumberByStyle((length - bytes - 1), UNITY_DISPLAY_STYLE_UINT);
1180
+ UnityPrint(UnityStrExpected);
1181
+ UnityPrintNumberByStyle(*ptr_exp, UNITY_DISPLAY_STYLE_HEX8);
1182
+ UnityPrint(UnityStrWas);
1183
+ UnityPrintNumberByStyle(*ptr_act, UNITY_DISPLAY_STYLE_HEX8);
1184
+ UnityAddMsgIfSpecified(msg);
1185
+ UNITY_FAIL_AND_BAIL;
1186
+ }
1187
+ ptr_exp = (UNITY_INTERNAL_PTR)((_UP)ptr_exp + 1);
1188
+ ptr_act = (UNITY_INTERNAL_PTR)((_UP)ptr_act + 1);
1189
+ }
1190
+ /////////////////////////////////////
1191
+
1192
+ }
1193
+ }
1194
+
1195
+ //-----------------------------------------------
1196
+ // Control Functions
1197
+ //-----------------------------------------------
1198
+
1199
+ void UnityFail(const char* msg, const UNITY_LINE_TYPE line)
1200
+ {
1201
+ UNITY_SKIP_EXECUTION;
1202
+
1203
+ UnityTestResultsBegin(Unity.TestFile, line);
1204
+ UnityPrintFail();
1205
+ if (msg != NULL)
1206
+ {
1207
+ UNITY_OUTPUT_CHAR(':');
1208
+
1209
+ #ifndef UNITY_EXCLUDE_DETAILS
1210
+ if (Unity.CurrentDetail1)
1211
+ {
1212
+ UnityPrint(UnityStrDetail1Name);
1213
+ UnityPrint(Unity.CurrentDetail1);
1214
+ if (Unity.CurrentDetail2)
1215
+ {
1216
+ UnityPrint(UnityStrDetail2Name);
1217
+ UnityPrint(Unity.CurrentDetail2);
1218
+ }
1219
+ UnityPrint(UnityStrSpacer);
1220
+ }
1221
+ #endif
1222
+ if (msg[0] != ' ')
1223
+ {
1224
+ UNITY_OUTPUT_CHAR(' ');
1225
+ }
1226
+ UnityPrint(msg);
1227
+ }
1228
+
1229
+ UNITY_FAIL_AND_BAIL;
1230
+ }
1231
+
1232
+ //-----------------------------------------------
1233
+ void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line)
1234
+ {
1235
+ UNITY_SKIP_EXECUTION;
1236
+
1237
+ UnityTestResultsBegin(Unity.TestFile, line);
1238
+ UnityPrint(UnityStrIgnore);
1239
+ if (msg != NULL)
1240
+ {
1241
+ UNITY_OUTPUT_CHAR(':');
1242
+ UNITY_OUTPUT_CHAR(' ');
1243
+ UnityPrint(msg);
1244
+ }
1245
+ UNITY_IGNORE_AND_BAIL;
1246
+ }
1247
+
1248
+ //-----------------------------------------------
1249
+ #if defined(UNITY_WEAK_ATTRIBUTE)
1250
+ void setUp(void);
1251
+ void tearDown(void);
1252
+ UNITY_WEAK_ATTRIBUTE void setUp(void) { }
1253
+ UNITY_WEAK_ATTRIBUTE void tearDown(void) { }
1254
+ #elif defined(UNITY_WEAK_PRAGMA)
1255
+ # pragma weak setUp
1256
+ void setUp(void) { }
1257
+ # pragma weak tearDown
1258
+ void tearDown(void) { }
1259
+ #else
1260
+ void setUp(void);
1261
+ void tearDown(void);
1262
+ #endif
1263
+ //-----------------------------------------------
1264
+ void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum)
1265
+ {
1266
+ Unity.CurrentTestName = FuncName;
1267
+ Unity.CurrentTestLineNumber = (UNITY_LINE_TYPE)FuncLineNum;
1268
+ Unity.NumberOfTests++;
1269
+ UNITY_CLR_DETAILS();
1270
+ if (TEST_PROTECT())
1271
+ {
1272
+ setUp();
1273
+ Func();
1274
+ }
1275
+ if (TEST_PROTECT() && !(Unity.CurrentTestIgnored))
1276
+ {
1277
+ tearDown();
1278
+ }
1279
+ UnityConcludeTest();
1280
+ }
1281
+
1282
+ //-----------------------------------------------
1283
+ void UnityBegin(const char* filename)
1284
+ {
1285
+ Unity.TestFile = filename;
1286
+ Unity.CurrentTestName = NULL;
1287
+ Unity.CurrentTestLineNumber = 0;
1288
+ Unity.NumberOfTests = 0;
1289
+ Unity.TestFailures = 0;
1290
+ Unity.TestIgnores = 0;
1291
+ Unity.CurrentTestFailed = 0;
1292
+ Unity.CurrentTestIgnored = 0;
1293
+
1294
+ UNITY_CLR_DETAILS();
1295
+ UNITY_OUTPUT_START();
1296
+ }
1297
+
1298
+ //-----------------------------------------------
1299
+ int UnityEnd(void)
1300
+ {
1301
+ UNITY_PRINT_EOL();
1302
+ UnityPrint(UnityStrBreaker);
1303
+ UNITY_PRINT_EOL();
1304
+ UnityPrintNumber((_U_SINT)(Unity.NumberOfTests));
1305
+ UnityPrint(UnityStrResultsTests);
1306
+ UnityPrintNumber((_U_SINT)(Unity.TestFailures));
1307
+ UnityPrint(UnityStrResultsFailures);
1308
+ UnityPrintNumber((_U_SINT)(Unity.TestIgnores));
1309
+ UnityPrint(UnityStrResultsIgnored);
1310
+ UNITY_PRINT_EOL();
1311
+ if (Unity.TestFailures == 0U)
1312
+ {
1313
+ UnityPrintOk();
1314
+ }
1315
+ else
1316
+ {
1317
+ UnityPrintFail();
1318
+ }
1319
+ UNITY_PRINT_EOL();
1320
+ UNITY_OUTPUT_COMPLETE();
1321
+ return (int)(Unity.TestFailures);
1322
+ }
1323
+
1324
+ //-----------------------------------------------