ceedling 0.13.0.rc1 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (426) hide show
  1. data/Gemfile.lock +32 -0
  2. data/README.md +8 -8
  3. data/assets/example_file.c +5 -0
  4. data/assets/example_file.h +6 -0
  5. data/assets/project_as_gem.yml +71 -0
  6. data/assets/{project.yml → project_with_guts.yml} +2 -0
  7. data/assets/rakefile_as_gem.rb +1 -0
  8. data/assets/{rakefile.rb → rakefile_with_guts.rb} +0 -0
  9. data/assets/test_example_file.c +13 -0
  10. data/bin/ceedling +55 -31
  11. data/ceedling-0.13.0.rc4.gem +0 -0
  12. data/ceedling.gemspec +13 -12
  13. data/ceedling.sublime-project +8 -0
  14. data/ceedling.sublime-workspace +365 -0
  15. data/examples/temp_sensor/project.yml +3 -4
  16. data/lib/ceedling.rb +13 -4
  17. data/lib/ceedling/version.rb +3 -3
  18. data/lib/project_file_loader.rb +1 -1
  19. data/lib/rakefile.rb +14 -1
  20. data/lib/target_loader.rb +38 -0
  21. data/plugins/bullseye/{template.erb → assets/template.erb} +0 -0
  22. data/plugins/bullseye/{defaults.yml → config/defaults.yml} +0 -0
  23. data/plugins/bullseye/{bullseye.rb → lib/bullseye.rb} +9 -10
  24. data/spec/spec_system_helper.rb +192 -0
  25. data/spec/system/deployment_spec.rb +116 -0
  26. data/tags +977 -0
  27. data/vendor/c_exception/docs/CExceptionSummary.odt +0 -0
  28. data/vendor/c_exception/docs/CExceptionSummary.pdf +0 -0
  29. data/vendor/c_exception/docs/license.txt +30 -0
  30. data/vendor/c_exception/docs/readme.txt +242 -0
  31. data/vendor/c_exception/makefile +24 -0
  32. data/vendor/c_exception/rakefile.rb +41 -0
  33. data/vendor/c_exception/test/CExceptionConfig.h +44 -0
  34. data/vendor/c_exception/test/TestException.c +328 -0
  35. data/vendor/c_exception/test/TestException_Runner.c +57 -0
  36. data/vendor/c_exception/vendor/unity/auto/colour_prompt.rb +94 -0
  37. data/vendor/c_exception/vendor/unity/auto/colour_reporter.rb +39 -0
  38. data/vendor/c_exception/vendor/unity/auto/generate_config.yml +36 -0
  39. data/vendor/c_exception/vendor/unity/auto/generate_module.rb +202 -0
  40. data/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +313 -0
  41. data/vendor/c_exception/vendor/unity/auto/test_file_filter.rb +23 -0
  42. data/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb +139 -0
  43. data/vendor/c_exception/vendor/unity/docs/Unity Summary.odt +0 -0
  44. data/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf +0 -0
  45. data/vendor/c_exception/vendor/unity/docs/Unity Summary.txt +217 -0
  46. data/vendor/c_exception/vendor/unity/docs/license.txt +31 -0
  47. data/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.c +10 -0
  48. data/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.h +12 -0
  49. data/vendor/c_exception/vendor/unity/examples/makefile +40 -0
  50. data/vendor/c_exception/vendor/unity/examples/rakefile.rb +32 -0
  51. data/vendor/c_exception/vendor/unity/examples/rakefile_helper.rb +256 -0
  52. data/vendor/c_exception/vendor/unity/examples/readme.txt +18 -0
  53. data/vendor/c_exception/vendor/unity/examples/src/ProductionCode.c +24 -0
  54. data/vendor/c_exception/vendor/unity/examples/src/ProductionCode.h +3 -0
  55. data/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.c +9 -0
  56. data/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.h +2 -0
  57. data/vendor/c_exception/vendor/unity/examples/test/TestProductionCode.c +62 -0
  58. data/vendor/c_exception/vendor/unity/examples/test/TestProductionCode2.c +31 -0
  59. data/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c +46 -0
  60. data/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c +50 -0
  61. data/vendor/c_exception/vendor/unity/extras/fixture/build/MakefileWorker.mk +331 -0
  62. data/vendor/c_exception/vendor/unity/extras/fixture/build/filterGcov.sh +61 -0
  63. data/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb +37 -0
  64. data/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb +178 -0
  65. data/vendor/c_exception/vendor/unity/extras/fixture/readme.txt +9 -0
  66. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +381 -0
  67. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h +81 -0
  68. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +44 -0
  69. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +16 -0
  70. data/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c +21 -0
  71. data/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c +39 -0
  72. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +321 -0
  73. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +40 -0
  74. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c +56 -0
  75. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h +17 -0
  76. data/vendor/c_exception/vendor/unity/makefile +35 -0
  77. data/vendor/c_exception/vendor/unity/rakefile.rb +59 -0
  78. data/vendor/c_exception/vendor/unity/rakefile_helper.rb +240 -0
  79. data/vendor/c_exception/vendor/unity/release/build.info +2 -0
  80. data/vendor/c_exception/vendor/unity/release/version.info +2 -0
  81. data/vendor/c_exception/vendor/unity/src/unity.c +979 -0
  82. data/vendor/c_exception/vendor/unity/src/unity.h +232 -0
  83. data/vendor/c_exception/vendor/unity/src/unity_internals.h +424 -0
  84. data/vendor/c_exception/vendor/unity/targets/gcc.yml +43 -0
  85. data/vendor/c_exception/vendor/unity/targets/gcc_64.yml +44 -0
  86. data/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml +101 -0
  87. data/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml +89 -0
  88. data/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml +79 -0
  89. data/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml +79 -0
  90. data/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml +93 -0
  91. data/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml +83 -0
  92. data/vendor/c_exception/vendor/unity/targets/iar_msp430.yml +94 -0
  93. data/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml +85 -0
  94. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c +54 -0
  95. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c +50 -0
  96. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c +76 -0
  97. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c +72 -0
  98. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c +85 -0
  99. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c +85 -0
  100. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c +73 -0
  101. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c +85 -0
  102. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c +85 -0
  103. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c +86 -0
  104. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c +60 -0
  105. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c +63 -0
  106. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c +51 -0
  107. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c +60 -0
  108. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c +63 -0
  109. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c +64 -0
  110. data/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb +94 -0
  111. data/vendor/c_exception/vendor/unity/test/testdata/mocksample.c +51 -0
  112. data/vendor/c_exception/vendor/unity/test/testdata/sample.yml +9 -0
  113. data/vendor/c_exception/vendor/unity/test/testdata/testsample.c +51 -0
  114. data/vendor/c_exception/vendor/unity/test/testparameterized.c +101 -0
  115. data/vendor/c_exception/vendor/unity/test/testunity.c +2024 -0
  116. data/vendor/cmock/docs/CMock Summary.odt +0 -0
  117. data/vendor/cmock/docs/CMock Summary.pdf +0 -0
  118. data/vendor/cmock/docs/CMock_Summary.md +356 -0
  119. data/vendor/cmock/docs/license.txt +31 -0
  120. data/vendor/cmock/examples/gcc.yml +43 -0
  121. data/vendor/cmock/examples/iar_v4.yml +91 -0
  122. data/vendor/cmock/examples/iar_v5.yml +80 -0
  123. data/vendor/cmock/examples/rakefile.rb +32 -0
  124. data/vendor/cmock/examples/rakefile_helper.rb +270 -0
  125. data/vendor/cmock/examples/src/AT91SAM7X256.h +2556 -0
  126. data/vendor/cmock/examples/src/AdcConductor.c +42 -0
  127. data/vendor/cmock/examples/src/AdcConductor.h +11 -0
  128. data/vendor/cmock/examples/src/AdcHardware.c +27 -0
  129. data/vendor/cmock/examples/src/AdcHardware.h +9 -0
  130. data/vendor/cmock/examples/src/AdcHardwareConfigurator.c +18 -0
  131. data/vendor/cmock/examples/src/AdcHardwareConfigurator.h +10 -0
  132. data/vendor/cmock/examples/src/AdcModel.c +33 -0
  133. data/vendor/cmock/examples/src/AdcModel.h +13 -0
  134. data/vendor/cmock/examples/src/AdcTemperatureSensor.c +51 -0
  135. data/vendor/cmock/examples/src/AdcTemperatureSensor.h +10 -0
  136. data/vendor/cmock/examples/src/Executor.c +25 -0
  137. data/vendor/cmock/examples/src/Executor.h +9 -0
  138. data/vendor/cmock/examples/src/IntrinsicsWrapper.c +18 -0
  139. data/vendor/cmock/examples/src/IntrinsicsWrapper.h +7 -0
  140. data/vendor/cmock/examples/src/Main.c +46 -0
  141. data/vendor/cmock/examples/src/Main.h +7 -0
  142. data/vendor/cmock/examples/src/Model.c +10 -0
  143. data/vendor/cmock/examples/src/Model.h +8 -0
  144. data/vendor/cmock/examples/src/ModelConfig.h +7 -0
  145. data/vendor/cmock/examples/src/TaskScheduler.c +72 -0
  146. data/vendor/cmock/examples/src/TaskScheduler.h +11 -0
  147. data/vendor/cmock/examples/src/TemperatureCalculator.c +27 -0
  148. data/vendor/cmock/examples/src/TemperatureCalculator.h +6 -0
  149. data/vendor/cmock/examples/src/TemperatureFilter.c +39 -0
  150. data/vendor/cmock/examples/src/TemperatureFilter.h +10 -0
  151. data/vendor/cmock/examples/src/TimerConductor.c +15 -0
  152. data/vendor/cmock/examples/src/TimerConductor.h +9 -0
  153. data/vendor/cmock/examples/src/TimerConfigurator.c +51 -0
  154. data/vendor/cmock/examples/src/TimerConfigurator.h +15 -0
  155. data/vendor/cmock/examples/src/TimerHardware.c +15 -0
  156. data/vendor/cmock/examples/src/TimerHardware.h +8 -0
  157. data/vendor/cmock/examples/src/TimerInterruptConfigurator.c +55 -0
  158. data/vendor/cmock/examples/src/TimerInterruptConfigurator.h +13 -0
  159. data/vendor/cmock/examples/src/TimerInterruptHandler.c +25 -0
  160. data/vendor/cmock/examples/src/TimerInterruptHandler.h +10 -0
  161. data/vendor/cmock/examples/src/TimerModel.c +9 -0
  162. data/vendor/cmock/examples/src/TimerModel.h +8 -0
  163. data/vendor/cmock/examples/src/Types.h +103 -0
  164. data/vendor/cmock/examples/src/UsartBaudRateRegisterCalculator.c +18 -0
  165. data/vendor/cmock/examples/src/UsartBaudRateRegisterCalculator.h +6 -0
  166. data/vendor/cmock/examples/src/UsartConductor.c +21 -0
  167. data/vendor/cmock/examples/src/UsartConductor.h +7 -0
  168. data/vendor/cmock/examples/src/UsartConfigurator.c +39 -0
  169. data/vendor/cmock/examples/src/UsartConfigurator.h +13 -0
  170. data/vendor/cmock/examples/src/UsartHardware.c +22 -0
  171. data/vendor/cmock/examples/src/UsartHardware.h +9 -0
  172. data/vendor/cmock/examples/src/UsartModel.c +34 -0
  173. data/vendor/cmock/examples/src/UsartModel.h +10 -0
  174. data/vendor/cmock/examples/src/UsartPutChar.c +16 -0
  175. data/vendor/cmock/examples/src/UsartPutChar.h +8 -0
  176. data/vendor/cmock/examples/src/UsartTransmitBufferStatus.c +7 -0
  177. data/vendor/cmock/examples/src/UsartTransmitBufferStatus.h +8 -0
  178. data/vendor/cmock/examples/test/TestAdcConductor.c +121 -0
  179. data/vendor/cmock/examples/test/TestAdcHardware.c +44 -0
  180. data/vendor/cmock/examples/test/TestAdcHardwareConfigurator.c +43 -0
  181. data/vendor/cmock/examples/test/TestAdcModel.c +33 -0
  182. data/vendor/cmock/examples/test/TestAdcTemperatureSensor.c +47 -0
  183. data/vendor/cmock/examples/test/TestExecutor.c +36 -0
  184. data/vendor/cmock/examples/test/TestMain.c +24 -0
  185. data/vendor/cmock/examples/test/TestModel.c +20 -0
  186. data/vendor/cmock/examples/test/TestTaskScheduler.c +104 -0
  187. data/vendor/cmock/examples/test/TestTemperatureCalculator.c +33 -0
  188. data/vendor/cmock/examples/test/TestTemperatureFilter.c +69 -0
  189. data/vendor/cmock/examples/test/TestTimerConductor.c +32 -0
  190. data/vendor/cmock/examples/test/TestTimerConfigurator.c +112 -0
  191. data/vendor/cmock/examples/test/TestTimerHardware.c +26 -0
  192. data/vendor/cmock/examples/test/TestTimerInterruptConfigurator.c +78 -0
  193. data/vendor/cmock/examples/test/TestTimerInterruptHandler.c +66 -0
  194. data/vendor/cmock/examples/test/TestTimerModel.c +18 -0
  195. data/vendor/cmock/examples/test/TestUsartBaudRateRegisterCalculator.c +21 -0
  196. data/vendor/cmock/examples/test/TestUsartConductor.c +40 -0
  197. data/vendor/cmock/examples/test/TestUsartConfigurator.c +77 -0
  198. data/vendor/cmock/examples/test/TestUsartHardware.c +37 -0
  199. data/vendor/cmock/examples/test/TestUsartModel.c +40 -0
  200. data/vendor/cmock/examples/test/TestUsartPutChar.c +43 -0
  201. data/vendor/cmock/examples/test/TestUsartTransmitBufferStatus.c +22 -0
  202. data/vendor/cmock/iar/iar_v4/Resource/SAM7_FLASH.mac +71 -0
  203. data/vendor/cmock/iar/iar_v4/Resource/SAM7_RAM.mac +94 -0
  204. data/vendor/cmock/iar/iar_v4/Resource/SAM7_SIM.mac +67 -0
  205. data/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_FLASH.xcl +185 -0
  206. data/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_RAM.xcl +185 -0
  207. data/vendor/cmock/iar/iar_v4/Resource/ioat91sam7x256.ddf +2259 -0
  208. data/vendor/cmock/iar/iar_v4/cmock_demo.dep +3691 -0
  209. data/vendor/cmock/iar/iar_v4/cmock_demo.ewd +1696 -0
  210. data/vendor/cmock/iar/iar_v4/cmock_demo.ewp +2581 -0
  211. data/vendor/cmock/iar/iar_v4/cmock_demo.eww +10 -0
  212. data/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X-EK.h +61 -0
  213. data/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.inc +2314 -0
  214. data/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.rdf +4704 -0
  215. data/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.tcl +3407 -0
  216. data/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256_inc.h +2268 -0
  217. data/vendor/cmock/iar/iar_v4/incIAR/ioat91sam7x256.h +4380 -0
  218. data/vendor/cmock/iar/iar_v4/incIAR/lib_AT91SAM7X256.h +4211 -0
  219. data/vendor/cmock/iar/iar_v4/settings/cmock_demo.cspy.bat +32 -0
  220. data/vendor/cmock/iar/iar_v4/settings/cmock_demo.dbgdt +86 -0
  221. data/vendor/cmock/iar/iar_v4/settings/cmock_demo.dni +42 -0
  222. data/vendor/cmock/iar/iar_v4/settings/cmock_demo.wsdt +76 -0
  223. data/vendor/cmock/iar/iar_v4/srcIAR/Cstartup.s79 +266 -0
  224. data/vendor/cmock/iar/iar_v4/srcIAR/Cstartup_SAM7.c +98 -0
  225. data/vendor/cmock/iar/iar_v5/Resource/SAM7_FLASH.mac +71 -0
  226. data/vendor/cmock/iar/iar_v5/Resource/SAM7_RAM.mac +94 -0
  227. data/vendor/cmock/iar/iar_v5/Resource/SAM7_SIM.mac +67 -0
  228. data/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_FLASH.icf +43 -0
  229. data/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_RAM.icf +42 -0
  230. data/vendor/cmock/iar/iar_v5/cmock_demo.dep +4204 -0
  231. data/vendor/cmock/iar/iar_v5/cmock_demo.ewd +1906 -0
  232. data/vendor/cmock/iar/iar_v5/cmock_demo.ewp +2426 -0
  233. data/vendor/cmock/iar/iar_v5/cmock_demo.eww +26 -0
  234. data/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X-EK.h +61 -0
  235. data/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X256_inc.h +2268 -0
  236. data/vendor/cmock/iar/iar_v5/incIAR/lib_AT91SAM7X256.h +4211 -0
  237. data/vendor/cmock/iar/iar_v5/incIAR/project.h +30 -0
  238. data/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.cspy.bat +33 -0
  239. data/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dbgdt +5 -0
  240. data/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dni +18 -0
  241. data/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.wsdt +74 -0
  242. data/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X_FLASH_Debug.jlink +12 -0
  243. data/vendor/cmock/iar/iar_v5/settings/cmock_demo.cspy.bat +33 -0
  244. data/vendor/cmock/iar/iar_v5/settings/cmock_demo.dbgdt +85 -0
  245. data/vendor/cmock/iar/iar_v5/settings/cmock_demo.dni +44 -0
  246. data/vendor/cmock/iar/iar_v5/settings/cmock_demo.wsdt +73 -0
  247. data/vendor/cmock/iar/iar_v5/settings/cmock_demo_Binary.jlink +12 -0
  248. data/vendor/cmock/iar/iar_v5/settings/cmock_demo_FLASH_Debug.jlink +12 -0
  249. data/vendor/cmock/iar/iar_v5/settings/cmock_demo_RAM_Debug.jlink +12 -0
  250. data/vendor/cmock/iar/iar_v5/srcIAR/Cstartup.s +299 -0
  251. data/vendor/cmock/iar/iar_v5/srcIAR/Cstartup_SAM7.c +98 -0
  252. data/vendor/cmock/rakefile.rb +111 -0
  253. data/vendor/cmock/rakefile_helper.rb +381 -0
  254. data/vendor/cmock/targets/gcc.yml +53 -0
  255. data/vendor/cmock/targets/iar_arm_v4.yml +108 -0
  256. data/vendor/cmock/targets/iar_arm_v5.yml +93 -0
  257. data/vendor/cmock/test/c/TestCMockC.c +280 -0
  258. data/vendor/cmock/test/c/TestCMockC.yml +12 -0
  259. data/vendor/cmock/test/c/TestCMockCDynamic.c +186 -0
  260. data/vendor/cmock/test/c/TestCMockCDynamic.yml +12 -0
  261. data/vendor/cmock/test/c/TestCMockCDynamic_Runner.c +35 -0
  262. data/vendor/cmock/test/c/TestCMockC_Runner.c +37 -0
  263. data/vendor/cmock/test/spec/cmock_file_writer_spec.rb +25 -0
  264. data/vendor/cmock/test/spec/spec_helper.rb +12 -0
  265. data/vendor/cmock/test/system/systest_generator.rb +178 -0
  266. data/vendor/cmock/test/system/test_compilation/callingconv.h +11 -0
  267. data/vendor/cmock/test/system/test_compilation/config.yml +9 -0
  268. data/vendor/cmock/test/system/test_compilation/const.h +15 -0
  269. data/vendor/cmock/test/system/test_compilation/osek.h +275 -0
  270. data/vendor/cmock/test/system/test_compilation/parsing.h +47 -0
  271. data/vendor/cmock/test/system/test_interactions/all_plugins_but_other_limits.yml +341 -0
  272. data/vendor/cmock/test/system/test_interactions/all_plugins_coexist.yml +382 -0
  273. data/vendor/cmock/test/system/test_interactions/array_and_pointer_handling.yml +382 -0
  274. data/vendor/cmock/test/system/test_interactions/basic_expect_and_return.yml +123 -0
  275. data/vendor/cmock/test/system/test_interactions/const_primitives_handling.yml +87 -0
  276. data/vendor/cmock/test/system/test_interactions/enforce_strict_ordering.yml +247 -0
  277. data/vendor/cmock/test/system/test_interactions/expect_and_return_custom_types.yml +108 -0
  278. data/vendor/cmock/test/system/test_interactions/expect_and_return_treat_as.yml +173 -0
  279. data/vendor/cmock/test/system/test_interactions/expect_and_throw.yml +170 -0
  280. data/vendor/cmock/test/system/test_interactions/fancy_pointer_handling.yml +208 -0
  281. data/vendor/cmock/test/system/test_interactions/function_pointer_handling.yml +82 -0
  282. data/vendor/cmock/test/system/test_interactions/ignore_and_return.yml +153 -0
  283. data/vendor/cmock/test/system/test_interactions/newer_standards_stuff1.yml +52 -0
  284. data/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_1.yml +91 -0
  285. data/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_2.yml +59 -0
  286. data/vendor/cmock/test/system/test_interactions/parsing_challenges.yml +222 -0
  287. data/vendor/cmock/test/system/test_interactions/struct_union_enum_expect_and_return.yml +277 -0
  288. data/vendor/cmock/test/system/test_interactions/stubs_with_callbacks.yml +221 -0
  289. data/vendor/cmock/test/system/test_interactions/unity_64bit_support.yml +77 -0
  290. data/vendor/cmock/test/system/test_interactions/unity_ignores.yml +139 -0
  291. data/vendor/cmock/test/test_helper.rb +44 -0
  292. data/vendor/cmock/test/unit/cmock_config_test.rb +121 -0
  293. data/vendor/cmock/test/unit/cmock_config_test.yml +5 -0
  294. data/vendor/cmock/test/unit/cmock_file_writer_test.rb +30 -0
  295. data/vendor/cmock/test/unit/cmock_generator_main_test.rb +413 -0
  296. data/vendor/cmock/test/unit/cmock_generator_plugin_array_test.rb +114 -0
  297. data/vendor/cmock/test/unit/cmock_generator_plugin_callback_test.rb +190 -0
  298. data/vendor/cmock/test/unit/cmock_generator_plugin_cexception_test.rb +94 -0
  299. data/vendor/cmock/test/unit/cmock_generator_plugin_expect_test.rb +206 -0
  300. data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_test.rb +168 -0
  301. data/vendor/cmock/test/unit/cmock_generator_utils_test.rb +291 -0
  302. data/vendor/cmock/test/unit/cmock_header_parser_test.rb +1247 -0
  303. data/vendor/cmock/test/unit/cmock_plugin_manager_test.rb +85 -0
  304. data/vendor/cmock/test/unit/cmock_unityhelper_parser_test.rb +223 -0
  305. data/vendor/cmock/vendor/behaviors/Manifest.txt +9 -0
  306. data/vendor/cmock/vendor/behaviors/Rakefile +19 -0
  307. data/vendor/cmock/vendor/behaviors/lib/behaviors.rb +76 -0
  308. data/vendor/cmock/vendor/behaviors/lib/behaviors/reporttask.rb +158 -0
  309. data/vendor/cmock/vendor/behaviors/test/behaviors_tasks_test.rb +73 -0
  310. data/vendor/cmock/vendor/behaviors/test/behaviors_test.rb +50 -0
  311. data/vendor/cmock/vendor/behaviors/test/tasks_test/Rakefile +19 -0
  312. data/vendor/cmock/vendor/behaviors/test/tasks_test/lib/user.rb +2 -0
  313. data/vendor/cmock/vendor/behaviors/test/tasks_test/test/user_test.rb +17 -0
  314. data/vendor/cmock/vendor/hardmock/CHANGES +78 -0
  315. data/vendor/cmock/vendor/hardmock/LICENSE +7 -0
  316. data/vendor/cmock/vendor/hardmock/README +70 -0
  317. data/vendor/cmock/vendor/hardmock/Rakefile +8 -0
  318. data/vendor/cmock/vendor/hardmock/config/environment.rb +12 -0
  319. data/vendor/cmock/vendor/hardmock/lib/assert_error.rb +23 -0
  320. data/vendor/cmock/vendor/hardmock/lib/extend_test_unit.rb +14 -0
  321. data/vendor/cmock/vendor/hardmock/lib/hardmock.rb +86 -0
  322. data/vendor/cmock/vendor/hardmock/lib/hardmock/errors.rb +22 -0
  323. data/vendor/cmock/vendor/hardmock/lib/hardmock/expectation.rb +229 -0
  324. data/vendor/cmock/vendor/hardmock/lib/hardmock/expectation_builder.rb +9 -0
  325. data/vendor/cmock/vendor/hardmock/lib/hardmock/expector.rb +26 -0
  326. data/vendor/cmock/vendor/hardmock/lib/hardmock/method_cleanout.rb +33 -0
  327. data/vendor/cmock/vendor/hardmock/lib/hardmock/mock.rb +180 -0
  328. data/vendor/cmock/vendor/hardmock/lib/hardmock/mock_control.rb +53 -0
  329. data/vendor/cmock/vendor/hardmock/lib/hardmock/stubbing.rb +210 -0
  330. data/vendor/cmock/vendor/hardmock/lib/hardmock/trapper.rb +31 -0
  331. data/vendor/cmock/vendor/hardmock/lib/hardmock/utils.rb +9 -0
  332. data/vendor/cmock/vendor/hardmock/lib/test_unit_before_after.rb +169 -0
  333. data/vendor/cmock/vendor/hardmock/rake_tasks/rdoc.rake +19 -0
  334. data/vendor/cmock/vendor/hardmock/rake_tasks/rdoc_options.rb +4 -0
  335. data/vendor/cmock/vendor/hardmock/rake_tasks/test.rake +22 -0
  336. data/vendor/cmock/vendor/hardmock/test/functional/assert_error_test.rb +52 -0
  337. data/vendor/cmock/vendor/hardmock/test/functional/auto_verify_test.rb +178 -0
  338. data/vendor/cmock/vendor/hardmock/test/functional/direct_mock_usage_test.rb +396 -0
  339. data/vendor/cmock/vendor/hardmock/test/functional/hardmock_test.rb +434 -0
  340. data/vendor/cmock/vendor/hardmock/test/functional/stubbing_test.rb +479 -0
  341. data/vendor/cmock/vendor/hardmock/test/test_helper.rb +43 -0
  342. data/vendor/cmock/vendor/hardmock/test/unit/expectation_builder_test.rb +19 -0
  343. data/vendor/cmock/vendor/hardmock/test/unit/expectation_test.rb +372 -0
  344. data/vendor/cmock/vendor/hardmock/test/unit/expector_test.rb +57 -0
  345. data/vendor/cmock/vendor/hardmock/test/unit/method_cleanout_test.rb +36 -0
  346. data/vendor/cmock/vendor/hardmock/test/unit/mock_control_test.rb +175 -0
  347. data/vendor/cmock/vendor/hardmock/test/unit/mock_test.rb +279 -0
  348. data/vendor/cmock/vendor/hardmock/test/unit/test_unit_before_after_test.rb +452 -0
  349. data/vendor/cmock/vendor/hardmock/test/unit/trapper_test.rb +62 -0
  350. data/vendor/cmock/vendor/hardmock/test/unit/verify_error_test.rb +40 -0
  351. data/vendor/unity/auto/generate_config.yml +36 -0
  352. data/vendor/unity/auto/unity_test_summary.rb +2 -2
  353. data/vendor/unity/docs/Unity Summary.odt +0 -0
  354. data/vendor/unity/docs/Unity Summary.pdf +0 -0
  355. data/vendor/unity/docs/Unity Summary.txt +216 -0
  356. data/vendor/unity/docs/license.txt +31 -0
  357. data/vendor/unity/examples/helper/UnityHelper.c +10 -0
  358. data/vendor/unity/examples/helper/UnityHelper.h +12 -0
  359. data/vendor/unity/examples/makefile +40 -0
  360. data/vendor/unity/examples/rakefile.rb +32 -0
  361. data/vendor/unity/examples/rakefile_helper.rb +256 -0
  362. data/vendor/unity/examples/readme.txt +18 -0
  363. data/vendor/unity/examples/src/ProductionCode.c +24 -0
  364. data/vendor/unity/examples/src/ProductionCode.h +3 -0
  365. data/vendor/unity/examples/src/ProductionCode2.c +9 -0
  366. data/vendor/unity/examples/src/ProductionCode2.h +2 -0
  367. data/vendor/unity/examples/test/TestProductionCode.c +62 -0
  368. data/vendor/unity/examples/test/TestProductionCode2.c +31 -0
  369. data/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c +46 -0
  370. data/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c +50 -0
  371. data/vendor/unity/extras/fixture/build/MakefileWorker.mk +331 -0
  372. data/vendor/unity/extras/fixture/build/filterGcov.sh +61 -0
  373. data/vendor/unity/extras/fixture/rakefile.rb +37 -0
  374. data/vendor/unity/extras/fixture/rakefile_helper.rb +178 -0
  375. data/vendor/unity/extras/fixture/readme.txt +9 -0
  376. data/vendor/unity/extras/fixture/src/unity_fixture.c +381 -0
  377. data/vendor/unity/extras/fixture/src/unity_fixture.h +81 -0
  378. data/vendor/unity/extras/fixture/src/unity_fixture_internals.h +44 -0
  379. data/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +16 -0
  380. data/vendor/unity/extras/fixture/test/main/AllTests.c +21 -0
  381. data/vendor/unity/extras/fixture/test/testunity_fixture.c +39 -0
  382. data/vendor/unity/extras/fixture/test/unity_fixture_Test.c +321 -0
  383. data/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +40 -0
  384. data/vendor/unity/extras/fixture/test/unity_output_Spy.c +56 -0
  385. data/vendor/unity/extras/fixture/test/unity_output_Spy.h +17 -0
  386. data/vendor/unity/makefile +35 -0
  387. data/vendor/unity/rakefile.rb +59 -0
  388. data/vendor/unity/rakefile_helper.rb +240 -0
  389. data/vendor/unity/release/version.info +1 -1
  390. data/vendor/unity/src/unity.c +1 -1
  391. data/vendor/unity/src/unity_internals.h +5 -5
  392. data/vendor/unity/targets/gcc_32.yml +44 -0
  393. data/vendor/unity/targets/hitech_picc18.yml +101 -0
  394. data/vendor/unity/targets/iar_arm_v4.yml +89 -0
  395. data/vendor/unity/targets/iar_arm_v5.yml +79 -0
  396. data/vendor/unity/targets/iar_arm_v5_3.yml +79 -0
  397. data/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml +93 -0
  398. data/vendor/unity/targets/iar_cortexm3_v5.yml +83 -0
  399. data/vendor/unity/targets/iar_msp430.yml +94 -0
  400. data/vendor/unity/targets/iar_sh2a_v6.yml +85 -0
  401. data/vendor/unity/test/expectdata/testsample_cmd.c +54 -0
  402. data/vendor/unity/test/expectdata/testsample_def.c +50 -0
  403. data/vendor/unity/test/expectdata/testsample_mock_cmd.c +76 -0
  404. data/vendor/unity/test/expectdata/testsample_mock_def.c +72 -0
  405. data/vendor/unity/test/expectdata/testsample_mock_new1.c +85 -0
  406. data/vendor/unity/test/expectdata/testsample_mock_new2.c +85 -0
  407. data/vendor/unity/test/expectdata/testsample_mock_param.c +73 -0
  408. data/vendor/unity/test/expectdata/testsample_mock_run1.c +85 -0
  409. data/vendor/unity/test/expectdata/testsample_mock_run2.c +85 -0
  410. data/vendor/unity/test/expectdata/testsample_mock_yaml.c +86 -0
  411. data/vendor/unity/test/expectdata/testsample_new1.c +60 -0
  412. data/vendor/unity/test/expectdata/testsample_new2.c +63 -0
  413. data/vendor/unity/test/expectdata/testsample_param.c +51 -0
  414. data/vendor/unity/test/expectdata/testsample_run1.c +60 -0
  415. data/vendor/unity/test/expectdata/testsample_run2.c +63 -0
  416. data/vendor/unity/test/expectdata/testsample_yaml.c +64 -0
  417. data/vendor/unity/test/test_generate_test_runner.rb +94 -0
  418. data/vendor/unity/test/testdata/mocksample.c +51 -0
  419. data/vendor/unity/test/testdata/sample.yml +9 -0
  420. data/vendor/unity/test/testdata/testsample.c +51 -0
  421. data/vendor/unity/test/testparameterized.c +101 -0
  422. data/vendor/unity/test/testunity.c +2559 -0
  423. metadata +464 -53
  424. data/.gitignore +0 -6
  425. data/.gitmodules +0 -9
  426. data/.rspec +0 -1
@@ -0,0 +1,94 @@
1
+ # ==========================================
2
+ # CMock Project - Automatic Mock Generation for C
3
+ # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4
+ # [Released under MIT License. Please refer to license.txt for details]
5
+ # ==========================================
6
+
7
+ ruby_version = RUBY_VERSION.split('.')
8
+ if (ruby_version[1].to_i == 9) and (ruby_version[2].to_i > 1)
9
+ require 'rubygems'
10
+ gem 'test-unit'
11
+ end
12
+ require 'test/unit'
13
+ require './auto/generate_test_runner.rb'
14
+
15
+ TEST_FILE = 'test/testdata/testsample.c'
16
+ TEST_MOCK = 'test/testdata/mocksample.c'
17
+ OUT_FILE = 'build/testsample_'
18
+ EXP_FILE = 'test/expectdata/testsample_'
19
+
20
+ class TestGenerateTestRunner < Test::Unit::TestCase
21
+ def setup
22
+ end
23
+
24
+ def teardown
25
+ end
26
+
27
+ def verify_output_equal(subtest)
28
+ expected = File.read(EXP_FILE + subtest + '.c').gsub(/\r\n/,"\n")
29
+ actual = File.read(OUT_FILE + subtest + '.c').gsub(/\r\n/,"\n")
30
+ assert_equal(expected, actual, "Generated File Sub-Test '#{subtest}' Failed")
31
+ end
32
+
33
+ def test_ShouldGenerateARunnerByCreatingRunnerWithOptions
34
+ sets = { 'def' => nil,
35
+ 'new1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true },
36
+ 'new2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" }
37
+ }
38
+
39
+ sets.each_pair do |subtest, options|
40
+ UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c')
41
+ verify_output_equal(subtest)
42
+ UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c')
43
+ verify_output_equal('mock_' + subtest)
44
+ end
45
+ end
46
+
47
+ def test_ShouldGenerateARunnerByRunningRunnerWithOptions
48
+ sets = { 'run1' => { :plugins => [:cexception], :includes => ['one.h', 'two.h'], :enforce_strict_ordering => true },
49
+ 'run2' => { :plugins => [:ignore], :suite_setup => "a_custom_setup();", :suite_teardown => "a_custom_teardown();" }
50
+ }
51
+
52
+ sets.each_pair do |subtest, options|
53
+ UnityTestRunnerGenerator.new.run(TEST_FILE, OUT_FILE + subtest + '.c', options)
54
+ verify_output_equal(subtest)
55
+ UnityTestRunnerGenerator.new.run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c', options)
56
+ verify_output_equal('mock_' + subtest)
57
+ end
58
+ end
59
+
60
+ def test_ShouldGenerateARunnerByPullingYamlOptions
61
+ subtest = 'yaml'
62
+ cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\""
63
+ `#{cmdstr}`
64
+ verify_output_equal(subtest)
65
+
66
+ cmdstr = "ruby auto/generate_test_runner.rb test/testdata/sample.yml \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\""
67
+ `#{cmdstr}`
68
+ verify_output_equal('mock_' + subtest)
69
+ end
70
+
71
+ def test_ShouldGenerateARunnerByPullingCommandlineOptions
72
+ subtest = 'cmd'
73
+ cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_FILE}\" \"#{OUT_FILE + subtest + '.c'}\""
74
+ `#{cmdstr}`
75
+ verify_output_equal(subtest)
76
+
77
+ cmdstr = "ruby auto/generate_test_runner.rb -cexception \"#{TEST_MOCK}\" \"#{OUT_FILE + 'mock_' + subtest + '.c'}\""
78
+ `#{cmdstr}`
79
+ verify_output_equal('mock_' + subtest)
80
+ end
81
+
82
+ def test_ShouldGenerateARunnerThatUsesParameterizedTests
83
+ sets = { 'param' => { :plugins => [:ignore], :use_param_tests => true }
84
+ }
85
+
86
+ sets.each_pair do |subtest, options|
87
+ UnityTestRunnerGenerator.new(options).run(TEST_FILE, OUT_FILE + subtest + '.c')
88
+ verify_output_equal(subtest)
89
+ UnityTestRunnerGenerator.new(options).run(TEST_MOCK, OUT_FILE + 'mock_' + subtest + '.c')
90
+ verify_output_equal('mock_' + subtest)
91
+ end
92
+ end
93
+
94
+ end
@@ -0,0 +1,51 @@
1
+ // This is just a sample test file to be used to test the generator script
2
+ #ifndef TEST_SAMPLE_H
3
+ #define TEST_SAMPLE_H
4
+
5
+ #include <setjmp.h>
6
+ #include "unity.h"
7
+ #include "funky.h"
8
+ #include "Mockstanky.h"
9
+
10
+ void setUp(void)
11
+ {
12
+ CustomSetupStuff();
13
+ }
14
+
15
+ void tearDown(void)
16
+ {
17
+ CustomTeardownStuff
18
+ }
19
+
20
+ //Yup, nice comment
21
+ void test_TheFirstThingToTest(void)
22
+ {
23
+ TEST_ASSERT(1);
24
+
25
+ TEST_ASSERT_TRUE(1);
26
+ }
27
+
28
+ /*
29
+ void test_ShouldBeIgnored(void)
30
+ {
31
+ DoesStuff();
32
+ }
33
+ */
34
+
35
+ //void test_ShouldAlsoNotBeTested(void)
36
+ //{
37
+ // Call_An_Expect();
38
+ //
39
+ // CallAFunction();
40
+ // test_CallAFunctionThatLooksLikeATest();
41
+ //}
42
+
43
+ void test_TheSecondThingToTest(void)
44
+ {
45
+ Call_An_Expect();
46
+
47
+ CallAFunction();
48
+ test_CallAFunctionThatLooksLikeATest();
49
+ }
50
+
51
+ #endif //TEST_SAMPLE_H
@@ -0,0 +1,9 @@
1
+ :unity:
2
+ :includes:
3
+ - two.h
4
+ - three.h
5
+ - <four.h>
6
+ :plugins:
7
+ - :cexception
8
+ :suite_setup: |
9
+ a_yaml_setup();
@@ -0,0 +1,51 @@
1
+ // This is just a sample test file to be used to test the generator script
2
+ #ifndef TEST_SAMPLE_H
3
+ #define TEST_SAMPLE_H
4
+
5
+ #include <setjmp.h>
6
+ #include "unity.h"
7
+ #include "funky.h"
8
+ #include "stanky.h"
9
+
10
+ void setUp(void)
11
+ {
12
+ CustomSetupStuff();
13
+ }
14
+
15
+ void tearDown(void)
16
+ {
17
+ CustomTeardownStuff
18
+ }
19
+
20
+ //Yup, nice comment
21
+ void test_TheFirstThingToTest(void)
22
+ {
23
+ TEST_ASSERT(1);
24
+
25
+ TEST_ASSERT_TRUE(1);
26
+ }
27
+
28
+ /*
29
+ void test_ShouldBeIgnored(void)
30
+ {
31
+ DoesStuff();
32
+ }
33
+ */
34
+
35
+ //void test_ShouldAlsoNotBeTested(void)
36
+ //{
37
+ // Call_An_Expect();
38
+ //
39
+ // CallAFunction();
40
+ // test_CallAFunctionThatLooksLikeATest();
41
+ //}
42
+
43
+ void test_TheSecondThingToTest(void)
44
+ {
45
+ Call_An_Expect();
46
+
47
+ CallAFunction();
48
+ test_CallAFunctionThatLooksLikeATest();
49
+ }
50
+
51
+ #endif //TEST_SAMPLE_H
@@ -0,0 +1,101 @@
1
+ /* ==========================================
2
+ Unity Project - A Test Framework for C
3
+ Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4
+ [Released under MIT License. Please refer to license.txt for details]
5
+ ========================================== */
6
+
7
+ #include <setjmp.h>
8
+ #include "unity.h"
9
+
10
+ #define TEST_CASE(...)
11
+
12
+ #define EXPECT_ABORT_BEGIN \
13
+ if (TEST_PROTECT()) \
14
+ {
15
+
16
+ #define VERIFY_FAILS_END \
17
+ } \
18
+ Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \
19
+ if (Unity.CurrentTestFailed == 1) { \
20
+ SetToOneMeanWeAlreadyCheckedThisGuy = 1; \
21
+ UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \
22
+ UNITY_OUTPUT_CHAR('\n'); \
23
+ }
24
+
25
+ #define VERIFY_IGNORES_END \
26
+ } \
27
+ Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \
28
+ Unity.CurrentTestIgnored = 0; \
29
+ if (Unity.CurrentTestFailed == 1) { \
30
+ SetToOneMeanWeAlreadyCheckedThisGuy = 1; \
31
+ UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \
32
+ UNITY_OUTPUT_CHAR('\n'); \
33
+ }
34
+
35
+ int SetToOneToFailInTearDown;
36
+ int SetToOneMeanWeAlreadyCheckedThisGuy;
37
+
38
+ void setUp(void)
39
+ {
40
+ SetToOneToFailInTearDown = 0;
41
+ SetToOneMeanWeAlreadyCheckedThisGuy = 0;
42
+ }
43
+
44
+ void tearDown(void)
45
+ {
46
+ if (SetToOneToFailInTearDown == 1)
47
+ TEST_FAIL_MESSAGE("<= Failed in tearDown");
48
+ if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0))
49
+ {
50
+ UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]");
51
+ UNITY_OUTPUT_CHAR('\n');
52
+ }
53
+ }
54
+
55
+ TEST_CASE(0)
56
+ TEST_CASE(44)
57
+ TEST_CASE((90)+9)
58
+ void test_TheseShouldAllPass(int Num)
59
+ {
60
+ TEST_ASSERT_TRUE(Num < 100);
61
+ }
62
+
63
+ TEST_CASE(3)
64
+ TEST_CASE(77)
65
+ TEST_CASE( (99) + 1 - (1))
66
+ void test_TheseShouldAllFail(int Num)
67
+ {
68
+ EXPECT_ABORT_BEGIN
69
+ TEST_ASSERT_TRUE(Num > 100);
70
+ VERIFY_FAILS_END
71
+ }
72
+
73
+ TEST_CASE(1)
74
+ TEST_CASE(44)
75
+ TEST_CASE(99)
76
+ TEST_CASE(98)
77
+ void test_TheseAreEveryOther(int Num)
78
+ {
79
+ if (Num & 1)
80
+ {
81
+ EXPECT_ABORT_BEGIN
82
+ TEST_ASSERT_TRUE(Num > 100);
83
+ VERIFY_FAILS_END
84
+ }
85
+ else
86
+ {
87
+ TEST_ASSERT_TRUE(Num < 100);
88
+ }
89
+ }
90
+
91
+ void test_NormalPassesStillWork(void)
92
+ {
93
+ TEST_ASSERT_TRUE(1);
94
+ }
95
+
96
+ void test_NormalFailsStillWork(void)
97
+ {
98
+ EXPECT_ABORT_BEGIN
99
+ TEST_ASSERT_TRUE(0);
100
+ VERIFY_FAILS_END
101
+ }
@@ -0,0 +1,2024 @@
1
+ /* ==========================================
2
+ Unity Project - A Test Framework for C
3
+ Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4
+ [Released under MIT License. Please refer to license.txt for details]
5
+ ========================================== */
6
+
7
+ #include <setjmp.h>
8
+ #include "unity.h"
9
+
10
+ #define EXPECT_ABORT_BEGIN \
11
+ if (TEST_PROTECT()) \
12
+ {
13
+
14
+ #define VERIFY_FAILS_END \
15
+ } \
16
+ Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \
17
+ if (Unity.CurrentTestFailed == 1) { \
18
+ SetToOneMeanWeAlreadyCheckedThisGuy = 1; \
19
+ UnityPrint("[[[[ Previous Test Should Have Failed But Did Not ]]]]"); \
20
+ UNITY_OUTPUT_CHAR('\n'); \
21
+ }
22
+
23
+ #define VERIFY_IGNORES_END \
24
+ } \
25
+ Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \
26
+ Unity.CurrentTestIgnored = 0; \
27
+ if (Unity.CurrentTestFailed == 1) { \
28
+ SetToOneMeanWeAlreadyCheckedThisGuy = 1; \
29
+ UnityPrint("[[[[ Previous Test Should Have Ignored But Did Not ]]]]"); \
30
+ UNITY_OUTPUT_CHAR('\n'); \
31
+ }
32
+
33
+ int SetToOneToFailInTearDown;
34
+ int SetToOneMeanWeAlreadyCheckedThisGuy;
35
+
36
+ void setUp(void)
37
+ {
38
+ SetToOneToFailInTearDown = 0;
39
+ SetToOneMeanWeAlreadyCheckedThisGuy = 0;
40
+ }
41
+
42
+ void tearDown(void)
43
+ {
44
+ if (SetToOneToFailInTearDown == 1)
45
+ TEST_FAIL_MESSAGE("<= Failed in tearDown");
46
+ if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0))
47
+ {
48
+ UnityPrint("[[[[ Previous Test Should Have Passed But Did Not ]]]]");
49
+ UNITY_OUTPUT_CHAR('\n');
50
+ }
51
+ }
52
+
53
+ void testTrue(void)
54
+ {
55
+ TEST_ASSERT(1);
56
+
57
+ TEST_ASSERT_TRUE(1);
58
+ }
59
+
60
+ void testFalse(void)
61
+ {
62
+ TEST_ASSERT_FALSE(0);
63
+
64
+ TEST_ASSERT_UNLESS(0);
65
+ }
66
+
67
+ void testPreviousPass(void)
68
+ {
69
+ TEST_ASSERT_EQUAL_INT(0U, Unity.TestFailures);
70
+ }
71
+
72
+ void testNotVanilla(void)
73
+ {
74
+ EXPECT_ABORT_BEGIN
75
+ TEST_ASSERT(0);
76
+ VERIFY_FAILS_END
77
+ }
78
+
79
+ void testNotTrue(void)
80
+ {
81
+ EXPECT_ABORT_BEGIN
82
+ TEST_ASSERT_TRUE(0);
83
+ VERIFY_FAILS_END
84
+ }
85
+
86
+ void testNotFalse(void)
87
+ {
88
+ EXPECT_ABORT_BEGIN
89
+ TEST_ASSERT_FALSE(1);
90
+ VERIFY_FAILS_END
91
+ }
92
+
93
+ void testNotUnless(void)
94
+ {
95
+ EXPECT_ABORT_BEGIN
96
+ TEST_ASSERT_UNLESS(1);
97
+ VERIFY_FAILS_END
98
+ }
99
+
100
+ void testNotNotEqual(void)
101
+ {
102
+ EXPECT_ABORT_BEGIN
103
+ TEST_ASSERT_NOT_EQUAL(10, 10);
104
+ VERIFY_FAILS_END
105
+ }
106
+
107
+ void testFail(void)
108
+ {
109
+ EXPECT_ABORT_BEGIN
110
+ TEST_FAIL_MESSAGE("Expected for testing");
111
+ VERIFY_FAILS_END
112
+ }
113
+
114
+ void testIsNull(void)
115
+ {
116
+ char* ptr1 = NULL;
117
+ char* ptr2 = "hello";
118
+
119
+ TEST_ASSERT_NULL(ptr1);
120
+ TEST_ASSERT_NOT_NULL(ptr2);
121
+ }
122
+
123
+ void testIsNullShouldFailIfNot(void)
124
+ {
125
+ char* ptr1 = "hello";
126
+
127
+ EXPECT_ABORT_BEGIN
128
+ TEST_ASSERT_NULL(ptr1);
129
+ VERIFY_FAILS_END
130
+ }
131
+
132
+ void testNotNullShouldFailIfNULL(void)
133
+ {
134
+ char* ptr1 = NULL;
135
+
136
+ EXPECT_ABORT_BEGIN
137
+ TEST_ASSERT_NOT_NULL(ptr1);
138
+ VERIFY_FAILS_END
139
+ }
140
+
141
+ void testIgnore(void)
142
+ {
143
+ EXPECT_ABORT_BEGIN
144
+ TEST_IGNORE();
145
+ TEST_FAIL_MESSAGE("This should not be reached");
146
+ VERIFY_IGNORES_END
147
+ }
148
+
149
+ void testIgnoreMessage(void)
150
+ {
151
+ EXPECT_ABORT_BEGIN
152
+ TEST_IGNORE_MESSAGE("This is an expected TEST_IGNORE_MESSAGE string!");
153
+ TEST_FAIL_MESSAGE("This should not be reached");
154
+ VERIFY_IGNORES_END
155
+ }
156
+
157
+ void testNotEqualInts(void)
158
+ {
159
+ EXPECT_ABORT_BEGIN
160
+ TEST_ASSERT_EQUAL_INT(3982, 3983);
161
+ VERIFY_FAILS_END
162
+ }
163
+
164
+ void testNotEqualInt8s(void)
165
+ {
166
+ EXPECT_ABORT_BEGIN
167
+ TEST_ASSERT_EQUAL_INT8(-127, -126);
168
+ VERIFY_FAILS_END
169
+ }
170
+
171
+ void testNotEqualInt16s(void)
172
+ {
173
+ EXPECT_ABORT_BEGIN
174
+ TEST_ASSERT_EQUAL_INT16(-16383, -16382);
175
+ VERIFY_FAILS_END
176
+ }
177
+
178
+ void testNotEqualInt32s(void)
179
+ {
180
+ EXPECT_ABORT_BEGIN
181
+ TEST_ASSERT_EQUAL_INT32(-2147483647, -2147483646);
182
+ VERIFY_FAILS_END
183
+ }
184
+
185
+ void testNotEqualBits(void)
186
+ {
187
+ EXPECT_ABORT_BEGIN
188
+ TEST_ASSERT_BITS(0xFF00, 0x5555, 0x5A55);
189
+ VERIFY_FAILS_END
190
+ }
191
+
192
+ void testNotEqualUInts(void)
193
+ {
194
+ _UU16 v0, v1;
195
+
196
+ v0 = 9000;
197
+ v1 = 9001;
198
+
199
+ EXPECT_ABORT_BEGIN
200
+ TEST_ASSERT_EQUAL_UINT(v0, v1);
201
+ VERIFY_FAILS_END
202
+ }
203
+
204
+ void testNotEqualUInt8s(void)
205
+ {
206
+ _UU8 v0, v1;
207
+
208
+ v0 = 254;
209
+ v1 = 255;
210
+
211
+ EXPECT_ABORT_BEGIN
212
+ TEST_ASSERT_EQUAL_UINT8(v0, v1);
213
+ VERIFY_FAILS_END
214
+ }
215
+
216
+ void testNotEqualUInt16s(void)
217
+ {
218
+ _UU16 v0, v1;
219
+
220
+ v0 = 65535;
221
+ v1 = 65534;
222
+
223
+ EXPECT_ABORT_BEGIN
224
+ TEST_ASSERT_EQUAL_UINT16(v0, v1);
225
+ VERIFY_FAILS_END
226
+ }
227
+
228
+ void testNotEqualUInt32s(void)
229
+ {
230
+ _UU32 v0, v1;
231
+
232
+ v0 = 4294967295;
233
+ v1 = 4294967294;
234
+
235
+ EXPECT_ABORT_BEGIN
236
+ TEST_ASSERT_EQUAL_UINT32(v0, v1);
237
+ VERIFY_FAILS_END
238
+ }
239
+
240
+ void testNotEqualHex8s(void)
241
+ {
242
+ _UU8 v0, v1;
243
+
244
+ v0 = 0x23;
245
+ v1 = 0x22;
246
+
247
+ EXPECT_ABORT_BEGIN
248
+ TEST_ASSERT_EQUAL_HEX8(v0, v1);
249
+ VERIFY_FAILS_END
250
+ }
251
+
252
+ void testNotEqualHex8sIfSigned(void)
253
+ {
254
+ _US8 v0, v1;
255
+
256
+ v0 = -2;
257
+ v1 = 2;
258
+
259
+ EXPECT_ABORT_BEGIN
260
+ TEST_ASSERT_EQUAL_HEX8(v0, v1);
261
+ VERIFY_FAILS_END
262
+ }
263
+
264
+ void testNotEqualHex16s(void)
265
+ {
266
+ _UU16 v0, v1;
267
+
268
+ v0 = 0x1234;
269
+ v1 = 0x1235;
270
+
271
+ EXPECT_ABORT_BEGIN
272
+ TEST_ASSERT_EQUAL_HEX16(v0, v1);
273
+ VERIFY_FAILS_END
274
+ }
275
+
276
+ void testNotEqualHex16sIfSigned(void)
277
+ {
278
+ _US16 v0, v1;
279
+
280
+ v0 = -1024;
281
+ v1 = -1028;
282
+
283
+ EXPECT_ABORT_BEGIN
284
+ TEST_ASSERT_EQUAL_HEX16(v0, v1);
285
+ VERIFY_FAILS_END
286
+ }
287
+
288
+ void testNotEqualHex32s(void)
289
+ {
290
+ _UU32 v0, v1;
291
+
292
+ v0 = 900000;
293
+ v1 = 900001;
294
+
295
+ EXPECT_ABORT_BEGIN
296
+ TEST_ASSERT_EQUAL_HEX32(v0, v1);
297
+ VERIFY_FAILS_END
298
+ }
299
+
300
+ void testNotEqualHex32sIfSigned(void)
301
+ {
302
+ _US32 v0, v1;
303
+
304
+ v0 = -900000;
305
+ v1 = 900001;
306
+
307
+ EXPECT_ABORT_BEGIN
308
+ TEST_ASSERT_EQUAL_HEX32(v0, v1);
309
+ VERIFY_FAILS_END
310
+ }
311
+
312
+ void testEqualInts(void)
313
+ {
314
+ int v0, v1;
315
+ int *p0, *p1;
316
+
317
+ v0 = 19467;
318
+ v1 = 19467;
319
+ p0 = &v0;
320
+ p1 = &v1;
321
+
322
+ TEST_ASSERT_EQUAL_INT(1837, 1837);
323
+ TEST_ASSERT_EQUAL_INT(-27365, -27365);
324
+ TEST_ASSERT_EQUAL_INT(v0, v1);
325
+ TEST_ASSERT_EQUAL_INT(19467, v1);
326
+ TEST_ASSERT_EQUAL_INT(v0, 19467);
327
+ TEST_ASSERT_EQUAL_INT(*p0, v1);
328
+ TEST_ASSERT_EQUAL_INT(*p0, *p1);
329
+ TEST_ASSERT_EQUAL_INT(*p0, 19467);
330
+ }
331
+
332
+ void testEqualInt8s(void)
333
+ {
334
+ _US8 v0, v1;
335
+ _US8 *p0, *p1;
336
+
337
+ v0 = 0x22;
338
+ v1 = 0x22;
339
+ p0 = &v0;
340
+ p1 = &v1;
341
+
342
+ TEST_ASSERT_EQUAL_INT8(0x22, 0x22);
343
+ TEST_ASSERT_EQUAL_INT8(v0, v1);
344
+ TEST_ASSERT_EQUAL_INT8(0x22, v1);
345
+ TEST_ASSERT_EQUAL_INT8(v0, 0x22);
346
+ TEST_ASSERT_EQUAL_INT8(*p0, v1);
347
+ TEST_ASSERT_EQUAL_INT8(*p0, *p1);
348
+ TEST_ASSERT_EQUAL_INT8(*p0, 0x22);
349
+ }
350
+
351
+ void testEqualInt8sWhenThereAreDifferencesOutside8Bits(void)
352
+ {
353
+ TEST_ASSERT_EQUAL_INT8(0x321,0x421);
354
+ TEST_ASSERT_EQUAL_INT8(0xFF21,0x0021);
355
+ }
356
+
357
+ void testEqualInt16s(void)
358
+ {
359
+ _US16 v0, v1;
360
+ _US16 *p0, *p1;
361
+
362
+ v0 = 0x7876;
363
+ v1 = 0x7876;
364
+ p0 = &v0;
365
+ p1 = &v1;
366
+
367
+ TEST_ASSERT_EQUAL_INT16(0x7876, 0x7876);
368
+ TEST_ASSERT_EQUAL_INT16(v0, v1);
369
+ TEST_ASSERT_EQUAL_INT16(0x7876, v1);
370
+ TEST_ASSERT_EQUAL_INT16(v0, 0x7876);
371
+ TEST_ASSERT_EQUAL_INT16(*p0, v1);
372
+ TEST_ASSERT_EQUAL_INT16(*p0, *p1);
373
+ TEST_ASSERT_EQUAL_INT16(*p0, 0x7876);
374
+ }
375
+
376
+ void testEqualInt16sNegatives(void)
377
+ {
378
+ _US16 v0, v1;
379
+ _US16 *p0, *p1;
380
+
381
+ v0 = -7876;
382
+ v1 = -7876;
383
+ p0 = &v0;
384
+ p1 = &v1;
385
+
386
+ TEST_ASSERT_EQUAL_INT16(-7876, -7876);
387
+ TEST_ASSERT_EQUAL_INT16(v0, v1);
388
+ TEST_ASSERT_EQUAL_INT16(-7876, v1);
389
+ TEST_ASSERT_EQUAL_INT16(v0, -7876);
390
+ TEST_ASSERT_EQUAL_INT16(*p0, v1);
391
+ TEST_ASSERT_EQUAL_INT16(*p0, *p1);
392
+ TEST_ASSERT_EQUAL_INT16(*p0, -7876);
393
+ }
394
+
395
+ void testEqualInt16sWhenThereAreDifferencesOutside16Bits(void)
396
+ {
397
+ TEST_ASSERT_EQUAL_INT16(0x54321,0x64321);
398
+ TEST_ASSERT_EQUAL_INT16(0xFFFF4321,0x00004321);
399
+ }
400
+
401
+ void testEqualUints(void)
402
+ {
403
+ unsigned int v0, v1;
404
+ unsigned int *p0, *p1;
405
+
406
+ v0 = 19467;
407
+ v1 = 19467;
408
+ p0 = &v0;
409
+ p1 = &v1;
410
+
411
+ TEST_ASSERT_EQUAL_UINT(1837, 1837);
412
+ TEST_ASSERT_EQUAL_UINT(v0, v1);
413
+ TEST_ASSERT_EQUAL_UINT(19467, v1);
414
+ TEST_ASSERT_EQUAL_UINT(v0, 19467);
415
+ TEST_ASSERT_EQUAL_UINT(*p0, v1);
416
+ TEST_ASSERT_EQUAL_UINT(*p0, *p1);
417
+ TEST_ASSERT_EQUAL_UINT(*p0, 19467);
418
+ TEST_ASSERT_EQUAL_UINT(60872u, 60872u);
419
+ }
420
+
421
+
422
+ void testEqualUint8s(void)
423
+ {
424
+ _UU8 v0, v1;
425
+ _UU8 *p0, *p1;
426
+
427
+ v0 = 0x22;
428
+ v1 = 0x22;
429
+ p0 = &v0;
430
+ p1 = &v1;
431
+
432
+ TEST_ASSERT_EQUAL_UINT8(0x22, 0x22);
433
+ TEST_ASSERT_EQUAL_UINT8(v0, v1);
434
+ TEST_ASSERT_EQUAL_UINT8(0x22, v1);
435
+ TEST_ASSERT_EQUAL_UINT8(v0, 0x22);
436
+ TEST_ASSERT_EQUAL_UINT8(*p0, v1);
437
+ TEST_ASSERT_EQUAL_UINT8(*p0, *p1);
438
+ TEST_ASSERT_EQUAL_UINT8(*p0, 0x22);
439
+ }
440
+
441
+ void testEqualUint8sWhenThereAreDifferencesOutside8Bits(void)
442
+ {
443
+ TEST_ASSERT_EQUAL_UINT8(0x321,0x421);
444
+ TEST_ASSERT_EQUAL_UINT8(0xFF21,0x0021);
445
+ }
446
+
447
+ void testEqualUint16s(void)
448
+ {
449
+ _UU16 v0, v1;
450
+ _UU16 *p0, *p1;
451
+
452
+ v0 = 0x9876;
453
+ v1 = 0x9876;
454
+ p0 = &v0;
455
+ p1 = &v1;
456
+
457
+ TEST_ASSERT_EQUAL_UINT16(0x9876, 0x9876);
458
+ TEST_ASSERT_EQUAL_UINT16(v0, v1);
459
+ TEST_ASSERT_EQUAL_UINT16(0x9876, v1);
460
+ TEST_ASSERT_EQUAL_UINT16(v0, 0x9876);
461
+ TEST_ASSERT_EQUAL_UINT16(*p0, v1);
462
+ TEST_ASSERT_EQUAL_UINT16(*p0, *p1);
463
+ TEST_ASSERT_EQUAL_UINT16(*p0, 0x9876);
464
+ }
465
+
466
+ void testEqualUint16sWhenThereAreDifferencesOutside16Bits(void)
467
+ {
468
+ TEST_ASSERT_EQUAL_UINT16(0x54321,0x64321);
469
+ TEST_ASSERT_EQUAL_UINT16(0xFFFF4321,0x00004321);
470
+ }
471
+
472
+ void testNotEqual(void)
473
+ {
474
+ TEST_ASSERT_NOT_EQUAL(0, 1);
475
+ TEST_ASSERT_NOT_EQUAL(1, 0);
476
+ TEST_ASSERT_NOT_EQUAL(100, 101);
477
+ TEST_ASSERT_NOT_EQUAL(0, -1);
478
+ TEST_ASSERT_NOT_EQUAL(65535, -65535);
479
+ TEST_ASSERT_NOT_EQUAL(75, 900);
480
+ TEST_ASSERT_NOT_EQUAL(-100, -101);
481
+ }
482
+
483
+ void testEqualHex8s(void)
484
+ {
485
+ _UU8 v0, v1;
486
+ _UU8 *p0, *p1;
487
+
488
+ v0 = 0x22;
489
+ v1 = 0x22;
490
+ p0 = &v0;
491
+ p1 = &v1;
492
+
493
+ TEST_ASSERT_EQUAL_HEX8(0x22, 0x22);
494
+ TEST_ASSERT_EQUAL_HEX8(v0, v1);
495
+ TEST_ASSERT_EQUAL_HEX8(0x22, v1);
496
+ TEST_ASSERT_EQUAL_HEX8(v0, 0x22);
497
+ TEST_ASSERT_EQUAL_HEX8(*p0, v1);
498
+ TEST_ASSERT_EQUAL_HEX8(*p0, *p1);
499
+ TEST_ASSERT_EQUAL_HEX8(*p0, 0x22);
500
+ }
501
+
502
+ void testEqualHex8sWhenThereAreDifferencesOutside8Bits(void)
503
+ {
504
+ TEST_ASSERT_EQUAL_HEX8(0x321,0x421);
505
+ TEST_ASSERT_EQUAL_HEX8(0xFF21,0x0021);
506
+ }
507
+
508
+ void testEqualHex8sNegatives(void)
509
+ {
510
+ _UU8 v0, v1;
511
+ _UU8 *p0, *p1;
512
+
513
+ v0 = 0xDD;
514
+ v1 = 0xDD;
515
+ p0 = &v0;
516
+ p1 = &v1;
517
+
518
+ TEST_ASSERT_EQUAL_HEX8(0xDD, 0xDD);
519
+ TEST_ASSERT_EQUAL_HEX8(v0, v1);
520
+ TEST_ASSERT_EQUAL_HEX8(0xDD, v1);
521
+ TEST_ASSERT_EQUAL_HEX8(v0, 0xDD);
522
+ TEST_ASSERT_EQUAL_HEX8(*p0, v1);
523
+ TEST_ASSERT_EQUAL_HEX8(*p0, *p1);
524
+ TEST_ASSERT_EQUAL_HEX8(*p0, 0xDD);
525
+ }
526
+
527
+ void testEqualHex16s(void)
528
+ {
529
+ _UU16 v0, v1;
530
+ _UU16 *p0, *p1;
531
+
532
+ v0 = 0x9876;
533
+ v1 = 0x9876;
534
+ p0 = &v0;
535
+ p1 = &v1;
536
+
537
+ TEST_ASSERT_EQUAL_HEX16(0x9876, 0x9876);
538
+ TEST_ASSERT_EQUAL_HEX16(v0, v1);
539
+ TEST_ASSERT_EQUAL_HEX16(0x9876, v1);
540
+ TEST_ASSERT_EQUAL_HEX16(v0, 0x9876);
541
+ TEST_ASSERT_EQUAL_HEX16(*p0, v1);
542
+ TEST_ASSERT_EQUAL_HEX16(*p0, *p1);
543
+ TEST_ASSERT_EQUAL_HEX16(*p0, 0x9876);
544
+ }
545
+
546
+ void testEqualHex16sWhenThereAreDifferencesOutside16Bits(void)
547
+ {
548
+ TEST_ASSERT_EQUAL_HEX16(0x54321,0x64321);
549
+ TEST_ASSERT_EQUAL_HEX16(0xFFFF4321,0x00004321);
550
+ }
551
+
552
+ void testEqualHex32s(void)
553
+ {
554
+ _UU32 v0, v1;
555
+ _UU32 *p0, *p1;
556
+
557
+ v0 = 0x98765432ul;
558
+ v1 = 0x98765432ul;
559
+ p0 = &v0;
560
+ p1 = &v1;
561
+
562
+ TEST_ASSERT_EQUAL_HEX32(0x98765432ul, 0x98765432ul);
563
+ TEST_ASSERT_EQUAL_HEX32(v0, v1);
564
+ TEST_ASSERT_EQUAL_HEX32(0x98765432ul, v1);
565
+ TEST_ASSERT_EQUAL_HEX32(v0, 0x98765432ul);
566
+ TEST_ASSERT_EQUAL_HEX32(*p0, v1);
567
+ TEST_ASSERT_EQUAL_HEX32(*p0, *p1);
568
+ TEST_ASSERT_EQUAL_HEX32(*p0, 0x98765432ul);
569
+ }
570
+
571
+ void testEqualBits(void)
572
+ {
573
+ _UU32 v0 = 0xFF55AA00;
574
+ _UU32 v1 = 0x55550000;
575
+
576
+ TEST_ASSERT_BITS(v1, v0, 0x55550000);
577
+ TEST_ASSERT_BITS(v1, v0, 0xFF55CC00);
578
+ TEST_ASSERT_BITS(0xFFFFFFFF, v0, 0xFF55AA00);
579
+ TEST_ASSERT_BITS(0xFFFFFFFF, v0, v0);
580
+ TEST_ASSERT_BITS(0xF0F0F0F0, v0, 0xFC5DAE0F);
581
+ TEST_ASSERT_BITS_HIGH(v1, v0);
582
+ TEST_ASSERT_BITS_LOW(0x000055FF, v0);
583
+ TEST_ASSERT_BIT_HIGH(30, v0);
584
+ TEST_ASSERT_BIT_LOW(5, v0);
585
+ }
586
+
587
+ void testEqualShorts(void)
588
+ {
589
+ short v0, v1;
590
+ short *p0, *p1;
591
+
592
+ v0 = 19467;
593
+ v1 = 19467;
594
+ p0 = &v0;
595
+ p1 = &v1;
596
+
597
+ TEST_ASSERT_EQUAL_INT(1837, 1837);
598
+ TEST_ASSERT_EQUAL_INT(-2987, -2987);
599
+ TEST_ASSERT_EQUAL_INT(v0, v1);
600
+ TEST_ASSERT_EQUAL_INT(19467, v1);
601
+ TEST_ASSERT_EQUAL_INT(v0, 19467);
602
+ TEST_ASSERT_EQUAL_INT(*p0, v1);
603
+ TEST_ASSERT_EQUAL_INT(*p0, *p1);
604
+ TEST_ASSERT_EQUAL_INT(*p0, 19467);
605
+ }
606
+
607
+ void testEqualUShorts(void)
608
+ {
609
+ unsigned short v0, v1;
610
+ unsigned short *p0, *p1;
611
+
612
+ v0 = 19467;
613
+ v1 = 19467;
614
+ p0 = &v0;
615
+ p1 = &v1;
616
+
617
+ TEST_ASSERT_EQUAL_UINT(1837, 1837);
618
+ TEST_ASSERT_EQUAL_UINT(2987, 2987);
619
+ TEST_ASSERT_EQUAL_UINT(v0, v1);
620
+ TEST_ASSERT_EQUAL_UINT(19467, v1);
621
+ TEST_ASSERT_EQUAL_UINT(v0, 19467);
622
+ TEST_ASSERT_EQUAL_UINT(*p0, v1);
623
+ TEST_ASSERT_EQUAL_UINT(*p0, *p1);
624
+ TEST_ASSERT_EQUAL_UINT(*p0, 19467);
625
+ }
626
+
627
+ void testEqualChars(void)
628
+ {
629
+ signed char v0, v1;
630
+ signed char *p0, *p1;
631
+
632
+ v0 = 109;
633
+ v1 = 109;
634
+ p0 = &v0;
635
+ p1 = &v1;
636
+
637
+ TEST_ASSERT_EQUAL_INT(42, 42);
638
+ TEST_ASSERT_EQUAL_INT(-116, -116);
639
+ TEST_ASSERT_EQUAL_INT(v0, v1);
640
+ TEST_ASSERT_EQUAL_INT(109, v1);
641
+ TEST_ASSERT_EQUAL_INT(v0, 109);
642
+ TEST_ASSERT_EQUAL_INT(*p0, v1);
643
+ TEST_ASSERT_EQUAL_INT(*p0, *p1);
644
+ TEST_ASSERT_EQUAL_INT(*p0, 109);
645
+ }
646
+
647
+ void testEqualUChars(void)
648
+ {
649
+ unsigned char v0, v1;
650
+ unsigned char *p0, *p1;
651
+
652
+ v0 = 251;
653
+ v1 = 251;
654
+ p0 = &v0;
655
+ p1 = &v1;
656
+
657
+ TEST_ASSERT_EQUAL_INT(42, 42);
658
+ TEST_ASSERT_EQUAL_INT(v0, v1);
659
+ TEST_ASSERT_EQUAL_INT(251, v1);
660
+ TEST_ASSERT_EQUAL_INT(v0, 251);
661
+ TEST_ASSERT_EQUAL_INT(*p0, v1);
662
+ TEST_ASSERT_EQUAL_INT(*p0, *p1);
663
+ TEST_ASSERT_EQUAL_INT(*p0, 251);
664
+ }
665
+
666
+ void testEqualPointers(void)
667
+ {
668
+ int v0, v1;
669
+ int *p0, *p1, *p2;
670
+
671
+ v0 = 19467;
672
+ v1 = 18271;
673
+ p0 = &v0;
674
+ p1 = &v1;
675
+ p2 = &v1;
676
+
677
+ TEST_ASSERT_EQUAL_PTR(p0, &v0);
678
+ TEST_ASSERT_EQUAL_PTR(&v1, p1);
679
+ TEST_ASSERT_EQUAL_PTR(p2, p1);
680
+ TEST_ASSERT_EQUAL_PTR(&v0, &v0);
681
+ }
682
+
683
+ void testNotEqualPointers(void)
684
+ {
685
+ EXPECT_ABORT_BEGIN
686
+ TEST_ASSERT_EQUAL_PTR(0x12345678, 0x12345677);
687
+ VERIFY_FAILS_END
688
+ }
689
+
690
+ void testIntsWithinDelta(void)
691
+ {
692
+ TEST_ASSERT_INT_WITHIN(1, 5000, 5001);
693
+ TEST_ASSERT_INT_WITHIN(5, 5000, 4996);
694
+ TEST_ASSERT_INT_WITHIN(5, 5000, 5005);
695
+ TEST_ASSERT_INT_WITHIN(500, 50, -440);
696
+
697
+ TEST_ASSERT_INT_WITHIN(2, -1, -1);
698
+ TEST_ASSERT_INT_WITHIN(5, 1, -1);
699
+ TEST_ASSERT_INT_WITHIN(5, -1, 1);
700
+ }
701
+
702
+ void testIntsNotWithinDelta(void)
703
+ {
704
+ EXPECT_ABORT_BEGIN
705
+ TEST_ASSERT_INT_WITHIN(5, 5000, 5006);
706
+ VERIFY_FAILS_END
707
+ }
708
+
709
+ void testUIntsWithinDelta(void)
710
+ {
711
+ TEST_ASSERT_UINT_WITHIN(1, 5000, 5001);
712
+ TEST_ASSERT_UINT_WITHIN(5, 5000, 4996);
713
+ TEST_ASSERT_UINT_WITHIN(5, 5000, 5005);
714
+ }
715
+
716
+ void testUIntsNotWithinDelta(void)
717
+ {
718
+ EXPECT_ABORT_BEGIN
719
+ TEST_ASSERT_UINT_WITHIN(1, 2147483647u, 2147483649u);
720
+ VERIFY_FAILS_END
721
+ }
722
+
723
+ void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassSmallFirst(void)
724
+ {
725
+ EXPECT_ABORT_BEGIN
726
+ TEST_ASSERT_UINT_WITHIN(5, 1, -1);
727
+ VERIFY_FAILS_END
728
+ }
729
+
730
+ void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassBigFirst(void)
731
+ {
732
+ EXPECT_ABORT_BEGIN
733
+ TEST_ASSERT_UINT_WITHIN(5, -1, 1);
734
+ VERIFY_FAILS_END
735
+ }
736
+
737
+ void testHEX32sWithinDelta(void)
738
+ {
739
+ TEST_ASSERT_HEX32_WITHIN(1, 5000, 5001);
740
+ TEST_ASSERT_HEX32_WITHIN(5, 5000, 4996);
741
+ TEST_ASSERT_HEX32_WITHIN(5, 5000, 5005);
742
+ }
743
+
744
+ void testHEX32sNotWithinDelta(void)
745
+ {
746
+ EXPECT_ABORT_BEGIN
747
+ TEST_ASSERT_HEX32_WITHIN(1, 2147483647u, 2147483649u);
748
+ VERIFY_FAILS_END
749
+ }
750
+
751
+ void testHEX32sNotWithinDeltaEvenThoughASignedIntWouldPass(void)
752
+ {
753
+ EXPECT_ABORT_BEGIN
754
+ TEST_ASSERT_HEX32_WITHIN(5, 1, -1);
755
+ VERIFY_FAILS_END
756
+ }
757
+
758
+ void testHEX16sWithinDelta(void)
759
+ {
760
+ TEST_ASSERT_HEX16_WITHIN(1, 5000, 5001);
761
+ TEST_ASSERT_HEX16_WITHIN(5, 5000, 4996);
762
+ TEST_ASSERT_HEX16_WITHIN(5, 5000, 5005);
763
+ }
764
+
765
+ void testHEX16sWithinDeltaWhenThereAreDifferenceOutsideOf16Bits(void)
766
+ {
767
+ TEST_ASSERT_HEX16_WITHIN(5, 0x54321, 0x44321);
768
+ }
769
+
770
+ void testHEX16sNotWithinDelta(void)
771
+ {
772
+ EXPECT_ABORT_BEGIN
773
+ TEST_ASSERT_HEX16_WITHIN(2, 65535, 0);
774
+ VERIFY_FAILS_END
775
+ }
776
+
777
+ void testHEX8sWithinDelta(void)
778
+ {
779
+ TEST_ASSERT_HEX8_WITHIN(1, 254, 255);
780
+ TEST_ASSERT_HEX8_WITHIN(5, 251, 255);
781
+ TEST_ASSERT_HEX8_WITHIN(5, 1, 4);
782
+ }
783
+
784
+ void testHEX8sWithinDeltaWhenThereAreDifferenceOutsideOf8Bits(void)
785
+ {
786
+ TEST_ASSERT_HEX8_WITHIN(5, 0x123, 0xF23);
787
+ }
788
+
789
+ void testHEX8sNotWithinDelta(void)
790
+ {
791
+ EXPECT_ABORT_BEGIN
792
+ TEST_ASSERT_HEX8_WITHIN(2, 255, 0);
793
+ VERIFY_FAILS_END
794
+ }
795
+
796
+ void testEqualStrings(void)
797
+ {
798
+ const char *testString = "foo";
799
+
800
+ TEST_ASSERT_EQUAL_STRING(testString, testString);
801
+ TEST_ASSERT_EQUAL_STRING("foo", "foo");
802
+ TEST_ASSERT_EQUAL_STRING("foo", testString);
803
+ TEST_ASSERT_EQUAL_STRING(testString, "foo");
804
+ TEST_ASSERT_EQUAL_STRING("", "");
805
+ }
806
+
807
+ void testEqualStringsWithCarriageReturnsAndLineFeeds(void)
808
+ {
809
+ const char *testString = "foo\r\nbar";
810
+
811
+ TEST_ASSERT_EQUAL_STRING(testString, testString);
812
+ TEST_ASSERT_EQUAL_STRING("foo\r\nbar", "foo\r\nbar");
813
+ TEST_ASSERT_EQUAL_STRING("foo\r\nbar", testString);
814
+ TEST_ASSERT_EQUAL_STRING(testString, "foo\r\nbar");
815
+ TEST_ASSERT_EQUAL_STRING("", "");
816
+ }
817
+
818
+ void testNotEqualString1(void)
819
+ {
820
+ EXPECT_ABORT_BEGIN
821
+ TEST_ASSERT_EQUAL_STRING("foo", "bar");
822
+ VERIFY_FAILS_END
823
+ }
824
+
825
+ void testNotEqualString2(void)
826
+ {
827
+ EXPECT_ABORT_BEGIN
828
+ TEST_ASSERT_EQUAL_STRING("foo", "");
829
+ VERIFY_FAILS_END
830
+ }
831
+
832
+ void testNotEqualString3(void)
833
+ {
834
+ EXPECT_ABORT_BEGIN
835
+ TEST_ASSERT_EQUAL_STRING("", "bar");
836
+ VERIFY_FAILS_END
837
+ }
838
+
839
+ void testNotEqualString4(void)
840
+ {
841
+ EXPECT_ABORT_BEGIN
842
+ TEST_ASSERT_EQUAL_STRING("bar\r", "bar\n");
843
+ VERIFY_FAILS_END
844
+ }
845
+
846
+ void testNotEqualString5(void)
847
+ {
848
+ const char str1[] = { 0x41, 0x42, 0x03, 0x00 };
849
+ const char str2[] = { 0x41, 0x42, 0x04, 0x00 };
850
+ EXPECT_ABORT_BEGIN
851
+ TEST_ASSERT_EQUAL_STRING(str1, str2);
852
+ VERIFY_FAILS_END
853
+ }
854
+
855
+ void testNotEqualString_ExpectedStringIsNull(void)
856
+ {
857
+ EXPECT_ABORT_BEGIN
858
+ TEST_ASSERT_EQUAL_STRING(NULL, "bar");
859
+ VERIFY_FAILS_END
860
+ }
861
+
862
+ void testNotEqualString_ActualStringIsNull(void)
863
+ {
864
+ EXPECT_ABORT_BEGIN
865
+ TEST_ASSERT_EQUAL_STRING("foo", NULL);
866
+ VERIFY_FAILS_END
867
+ }
868
+
869
+ void testEqualStringArrays(void)
870
+ {
871
+ const char *testStrings[] = { "foo", "boo", "woo", "moo" };
872
+ const char *expStrings[] = { "foo", "boo", "woo", "zoo" };
873
+
874
+ TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, expStrings, 3);
875
+ TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 3);
876
+ TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 2);
877
+ TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 1);
878
+ }
879
+
880
+ void testNotEqualStringArray1(void)
881
+ {
882
+ const char *testStrings[] = { "foo", "boo", "woo", "moo" };
883
+ const char *expStrings[] = { "foo", "boo", "woo", "zoo" };
884
+
885
+ EXPECT_ABORT_BEGIN
886
+ TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4);
887
+ VERIFY_FAILS_END
888
+ }
889
+
890
+ void testNotEqualStringArray2(void)
891
+ {
892
+ const char *testStrings[] = { "zoo", "boo", "woo", "moo" };
893
+ const char *expStrings[] = { "foo", "boo", "woo", "moo" };
894
+
895
+ EXPECT_ABORT_BEGIN
896
+ TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4);
897
+ VERIFY_FAILS_END
898
+ }
899
+
900
+ void testNotEqualStringArray3(void)
901
+ {
902
+ const char *testStrings[] = { "foo", "boo", "woo", NULL };
903
+ const char *expStrings[] = { "foo", "boo", "woo", "zoo" };
904
+
905
+ EXPECT_ABORT_BEGIN
906
+ TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4);
907
+ VERIFY_FAILS_END
908
+ }
909
+
910
+ void testNotEqualStringArray4(void)
911
+ {
912
+ const char *testStrings[] = { "foo", "boo", "woo", "moo" };
913
+ const char *expStrings[] = { "foo", NULL, "woo", "moo" };
914
+
915
+ EXPECT_ABORT_BEGIN
916
+ TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4);
917
+ VERIFY_FAILS_END
918
+ }
919
+
920
+ void testNotEqualStringArray5(void)
921
+ {
922
+ const char **testStrings = NULL;
923
+ const char *expStrings[] = { "foo", "boo", "woo", "zoo" };
924
+
925
+ EXPECT_ABORT_BEGIN
926
+ TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4);
927
+ VERIFY_FAILS_END
928
+ }
929
+
930
+ void testNotEqualStringArray6(void)
931
+ {
932
+ const char *testStrings[] = { "foo", "boo", "woo", "zoo" };
933
+ const char **expStrings = NULL;
934
+
935
+ EXPECT_ABORT_BEGIN
936
+ TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4);
937
+ VERIFY_FAILS_END
938
+ }
939
+
940
+ void testEqualStringArrayIfBothNulls(void)
941
+ {
942
+ const char **testStrings = NULL;
943
+ const char **expStrings = NULL;
944
+
945
+ TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4);
946
+ }
947
+
948
+ void testEqualMemory(void)
949
+ {
950
+ const char *testString = "whatever";
951
+
952
+ TEST_ASSERT_EQUAL_MEMORY(testString, testString, 8);
953
+ TEST_ASSERT_EQUAL_MEMORY("whatever", "whatever", 8);
954
+ TEST_ASSERT_EQUAL_MEMORY("whatever", testString, 8);
955
+ TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 8);
956
+ TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 2);
957
+ TEST_ASSERT_EQUAL_MEMORY(NULL, NULL, 1);
958
+ }
959
+
960
+ void testNotEqualMemory1(void)
961
+ {
962
+ EXPECT_ABORT_BEGIN
963
+ TEST_ASSERT_EQUAL_MEMORY("foo", "bar", 3);
964
+ VERIFY_FAILS_END
965
+ }
966
+
967
+ void testNotEqualMemory2(void)
968
+ {
969
+ EXPECT_ABORT_BEGIN
970
+ TEST_ASSERT_EQUAL_MEMORY("fool", "food", 4);
971
+ VERIFY_FAILS_END
972
+ }
973
+
974
+ void testNotEqualMemory3(void)
975
+ {
976
+ EXPECT_ABORT_BEGIN
977
+ TEST_ASSERT_EQUAL_MEMORY(NULL, "food", 4);
978
+ VERIFY_FAILS_END
979
+ }
980
+
981
+ void testNotEqualMemory4(void)
982
+ {
983
+ EXPECT_ABORT_BEGIN
984
+ TEST_ASSERT_EQUAL_MEMORY("fool", NULL, 4);
985
+ VERIFY_FAILS_END
986
+ }
987
+
988
+ void testEqualIntArrays(void)
989
+ {
990
+ int p0[] = {1, 8, 987, -2};
991
+ int p1[] = {1, 8, 987, -2};
992
+ int p2[] = {1, 8, 987, 2};
993
+ int p3[] = {1, 500, 600, 700};
994
+
995
+ TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 1);
996
+ TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 4);
997
+ TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4);
998
+ TEST_ASSERT_EQUAL_INT_ARRAY(p0, p2, 3);
999
+ TEST_ASSERT_EQUAL_INT_ARRAY(p0, p3, 1);
1000
+ }
1001
+
1002
+ void testNotEqualIntArraysNullExpected(void)
1003
+ {
1004
+ int* p0 = NULL;
1005
+ int p1[] = {1, 8, 987, 2};
1006
+
1007
+ EXPECT_ABORT_BEGIN
1008
+ TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4);
1009
+ VERIFY_FAILS_END
1010
+ }
1011
+
1012
+ void testNotEqualIntArraysNullActual(void)
1013
+ {
1014
+ int* p1 = NULL;
1015
+ int p0[] = {1, 8, 987, 2};
1016
+
1017
+ EXPECT_ABORT_BEGIN
1018
+ TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4);
1019
+ VERIFY_FAILS_END
1020
+ }
1021
+
1022
+ void testNotEqualIntArrays1(void)
1023
+ {
1024
+ int p0[] = {1, 8, 987, -2};
1025
+ int p1[] = {1, 8, 987, 2};
1026
+
1027
+ EXPECT_ABORT_BEGIN
1028
+ TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4);
1029
+ VERIFY_FAILS_END
1030
+ }
1031
+
1032
+ void testNotEqualIntArrays2(void)
1033
+ {
1034
+ int p0[] = {1, 8, 987, -2};
1035
+ int p1[] = {2, 8, 987, -2};
1036
+
1037
+ EXPECT_ABORT_BEGIN
1038
+ TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4);
1039
+ VERIFY_FAILS_END
1040
+ }
1041
+
1042
+ void testNotEqualIntArrays3(void)
1043
+ {
1044
+ int p0[] = {1, 8, 987, -2};
1045
+ int p1[] = {1, 8, 986, -2};
1046
+
1047
+ EXPECT_ABORT_BEGIN
1048
+ TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4);
1049
+ VERIFY_FAILS_END
1050
+ }
1051
+
1052
+ void testEqualPtrArrays(void)
1053
+ {
1054
+ char A = 1;
1055
+ char B = 2;
1056
+ char C = 3;
1057
+ char* p0[] = {&A, &B, &C};
1058
+ char* p1[] = {&A, &B, &C, &A};
1059
+ char* p2[] = {&A, &B};
1060
+ char* p3[] = {&A};
1061
+
1062
+ TEST_ASSERT_EQUAL_PTR_ARRAY(p0, p0, 1);
1063
+ TEST_ASSERT_EQUAL_PTR_ARRAY(p0, p0, 3);
1064
+ TEST_ASSERT_EQUAL_PTR_ARRAY(p0, p1, 3);
1065
+ TEST_ASSERT_EQUAL_PTR_ARRAY(p1, p2, 2);
1066
+ TEST_ASSERT_EQUAL_PTR_ARRAY(p3, p0, 1);
1067
+ }
1068
+
1069
+ void testNotEqualPtrArraysNullExpected(void)
1070
+ {
1071
+ char A = 1;
1072
+ char B = 2;
1073
+ char** p0 = NULL;
1074
+ char* p1[] = {&A, &B};
1075
+
1076
+ EXPECT_ABORT_BEGIN
1077
+ TEST_ASSERT_EQUAL_PTR_ARRAY(p0, p1, 2);
1078
+ VERIFY_FAILS_END
1079
+ }
1080
+
1081
+ void testNotEqualPtrArraysNullActual(void)
1082
+ {
1083
+ char A = 1;
1084
+ char B = 2;
1085
+ char** p0 = NULL;
1086
+ char* p1[] = {&A, &B};
1087
+
1088
+ EXPECT_ABORT_BEGIN
1089
+ TEST_ASSERT_EQUAL_PTR_ARRAY(p1, p0, 2);
1090
+ VERIFY_FAILS_END
1091
+ }
1092
+
1093
+ void testNotEqualPtrArrays1(void)
1094
+ {
1095
+ char A = 1;
1096
+ char B = 2;
1097
+ char C = 3;
1098
+ char* p0[] = {&A, &B, &C, &B};
1099
+ char* p1[] = {&A, &B, &C, &A};
1100
+
1101
+ EXPECT_ABORT_BEGIN
1102
+ TEST_ASSERT_EQUAL_PTR_ARRAY(p0, p1, 4);
1103
+ VERIFY_FAILS_END
1104
+ }
1105
+
1106
+ void testNotEqualPtrArrays2(void)
1107
+ {
1108
+ char A = 1;
1109
+ char B = 2;
1110
+ char C = 3;
1111
+ char* p0[] = {&B, &B, &C, &A};
1112
+ char* p1[] = {&A, &B, &C, &A};
1113
+
1114
+ EXPECT_ABORT_BEGIN
1115
+ TEST_ASSERT_EQUAL_PTR_ARRAY(p0, p1, 4);
1116
+ VERIFY_FAILS_END
1117
+ }
1118
+
1119
+ void testNotEqualPtrArrays3(void)
1120
+ {
1121
+ char A = 1;
1122
+ char B = 2;
1123
+ char C = 3;
1124
+ char* p0[] = {&A, &B, &B, &A};
1125
+ char* p1[] = {&A, &B, &C, &A};
1126
+
1127
+ EXPECT_ABORT_BEGIN
1128
+ TEST_ASSERT_EQUAL_PTR_ARRAY(p0, p1, 4);
1129
+ VERIFY_FAILS_END
1130
+ }
1131
+
1132
+ void testEqualInt8Arrays(void)
1133
+ {
1134
+ _US8 p0[] = {1, 8, 117, -2};
1135
+ _US8 p1[] = {1, 8, 117, -2};
1136
+ _US8 p2[] = {1, 8, 117, 2};
1137
+ _US8 p3[] = {1, 50, 60, 70};
1138
+
1139
+ TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 1);
1140
+ TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 4);
1141
+ TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4);
1142
+ TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p2, 3);
1143
+ TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p3, 1);
1144
+ }
1145
+
1146
+ void testNotEqualInt8Arrays(void)
1147
+ {
1148
+ _US8 p0[] = {1, 8, 127, -2};
1149
+ _US8 p1[] = {1, 8, 127, 2};
1150
+
1151
+ EXPECT_ABORT_BEGIN
1152
+ TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4);
1153
+ VERIFY_FAILS_END
1154
+ }
1155
+
1156
+ void testEqualUIntArrays(void)
1157
+ {
1158
+ unsigned int p0[] = {1, 8, 987, 65132u};
1159
+ unsigned int p1[] = {1, 8, 987, 65132u};
1160
+ unsigned int p2[] = {1, 8, 987, 2};
1161
+ unsigned int p3[] = {1, 500, 600, 700};
1162
+
1163
+ TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 1);
1164
+ TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 4);
1165
+ TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4);
1166
+ TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p2, 3);
1167
+ TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p3, 1);
1168
+ }
1169
+
1170
+ void testNotEqualUIntArrays1(void)
1171
+ {
1172
+ unsigned int p0[] = {1, 8, 987, 65132u};
1173
+ unsigned int p1[] = {1, 8, 987, 65131u};
1174
+
1175
+ EXPECT_ABORT_BEGIN
1176
+ TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4);
1177
+ VERIFY_FAILS_END
1178
+ }
1179
+
1180
+ void testNotEqualUIntArrays2(void)
1181
+ {
1182
+ unsigned int p0[] = {1, 8, 987, 65132u};
1183
+ unsigned int p1[] = {2, 8, 987, 65132u};
1184
+
1185
+ EXPECT_ABORT_BEGIN
1186
+ TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4);
1187
+ VERIFY_FAILS_END
1188
+ }
1189
+
1190
+ void testNotEqualUIntArrays3(void)
1191
+ {
1192
+ unsigned int p0[] = {1, 8, 987, 65132u};
1193
+ unsigned int p1[] = {1, 8, 986, 65132u};
1194
+
1195
+ EXPECT_ABORT_BEGIN
1196
+ TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4);
1197
+ VERIFY_FAILS_END
1198
+ }
1199
+
1200
+ void testEqualInt16Arrays(void)
1201
+ {
1202
+ _UU16 p0[] = {1, 8, 117, 3};
1203
+ _UU16 p1[] = {1, 8, 117, 3};
1204
+ _UU16 p2[] = {1, 8, 117, 2};
1205
+ _UU16 p3[] = {1, 50, 60, 70};
1206
+
1207
+ TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 1);
1208
+ TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 4);
1209
+ TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4);
1210
+ TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p2, 3);
1211
+ TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p3, 1);
1212
+ }
1213
+
1214
+ void testNotEqualInt16Arrays(void)
1215
+ {
1216
+ _UU16 p0[] = {1, 8, 127, 3};
1217
+ _UU16 p1[] = {1, 8, 127, 2};
1218
+
1219
+ EXPECT_ABORT_BEGIN
1220
+ TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4);
1221
+ VERIFY_FAILS_END
1222
+ }
1223
+
1224
+ void testEqualUINT16Arrays(void)
1225
+ {
1226
+ unsigned short p0[] = {1, 8, 987, 65132u};
1227
+ unsigned short p1[] = {1, 8, 987, 65132u};
1228
+ unsigned short p2[] = {1, 8, 987, 2};
1229
+ unsigned short p3[] = {1, 500, 600, 700};
1230
+
1231
+ TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 1);
1232
+ TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 4);
1233
+ TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4);
1234
+ TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p2, 3);
1235
+ TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p3, 1);
1236
+ }
1237
+
1238
+ void testNotEqualUINT16Arrays1(void)
1239
+ {
1240
+ unsigned short p0[] = {1, 8, 987, 65132u};
1241
+ unsigned short p1[] = {1, 8, 987, 65131u};
1242
+
1243
+ EXPECT_ABORT_BEGIN
1244
+ TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4);
1245
+ VERIFY_FAILS_END
1246
+ }
1247
+
1248
+ void testNotEqualUINT16Arrays2(void)
1249
+ {
1250
+ unsigned short p0[] = {1, 8, 987, 65132u};
1251
+ unsigned short p1[] = {2, 8, 987, 65132u};
1252
+
1253
+ EXPECT_ABORT_BEGIN
1254
+ TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4);
1255
+ VERIFY_FAILS_END
1256
+ }
1257
+
1258
+ void testNotEqualUINT16Arrays3(void)
1259
+ {
1260
+ unsigned short p0[] = {1, 8, 987, 65132u};
1261
+ unsigned short p1[] = {1, 8, 986, 65132u};
1262
+
1263
+ EXPECT_ABORT_BEGIN
1264
+ TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4);
1265
+ VERIFY_FAILS_END
1266
+ }
1267
+
1268
+ void testEqualHEXArrays(void)
1269
+ {
1270
+ unsigned int p0[] = {1, 8, 987, 65132u};
1271
+ unsigned int p1[] = {1, 8, 987, 65132u};
1272
+ unsigned int p2[] = {1, 8, 987, 2};
1273
+ unsigned int p3[] = {1, 500, 600, 700};
1274
+
1275
+ TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 1);
1276
+ TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 4);
1277
+ TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4);
1278
+ TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p2, 3);
1279
+ TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p3, 1);
1280
+ }
1281
+
1282
+ void testNotEqualHEXArrays1(void)
1283
+ {
1284
+ unsigned int p0[] = {1, 8, 987, 65132u};
1285
+ unsigned int p1[] = {1, 8, 987, 65131u};
1286
+
1287
+ EXPECT_ABORT_BEGIN
1288
+ TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4);
1289
+ VERIFY_FAILS_END
1290
+ }
1291
+
1292
+ void testNotEqualHEXArrays2(void)
1293
+ {
1294
+ unsigned int p0[] = {1, 8, 987, 65132u};
1295
+ unsigned int p1[] = {2, 8, 987, 65132u};
1296
+
1297
+ EXPECT_ABORT_BEGIN
1298
+ TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4);
1299
+ VERIFY_FAILS_END
1300
+ }
1301
+
1302
+ void testNotEqualHEXArrays3(void)
1303
+ {
1304
+ unsigned int p0[] = {1, 8, 987, 65132u};
1305
+ unsigned int p1[] = {1, 8, 986, 65132u};
1306
+
1307
+ EXPECT_ABORT_BEGIN
1308
+ TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4);
1309
+ VERIFY_FAILS_END
1310
+ }
1311
+
1312
+ void testEqualHEX16Arrays(void)
1313
+ {
1314
+ unsigned short p0[] = {1, 8, 987, 65132u};
1315
+ unsigned short p1[] = {1, 8, 987, 65132u};
1316
+ unsigned short p2[] = {1, 8, 987, 2};
1317
+ unsigned short p3[] = {1, 500, 600, 700};
1318
+
1319
+ TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 1);
1320
+ TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 4);
1321
+ TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4);
1322
+ TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p2, 3);
1323
+ TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p3, 1);
1324
+ }
1325
+
1326
+ void testNotEqualHEX16Arrays1(void)
1327
+ {
1328
+ unsigned short p0[] = {1, 8, 987, 65132u};
1329
+ unsigned short p1[] = {1, 8, 987, 65131u};
1330
+
1331
+ EXPECT_ABORT_BEGIN
1332
+ TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4);
1333
+ VERIFY_FAILS_END
1334
+ }
1335
+
1336
+ void testNotEqualHEX16Arrays2(void)
1337
+ {
1338
+ unsigned short p0[] = {1, 8, 987, 65132u};
1339
+ unsigned short p1[] = {2, 8, 987, 65132u};
1340
+
1341
+ EXPECT_ABORT_BEGIN
1342
+ TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4);
1343
+ VERIFY_FAILS_END
1344
+ }
1345
+
1346
+ void testNotEqualHEX16Arrays3(void)
1347
+ {
1348
+ unsigned short p0[] = {1, 8, 987, 65132u};
1349
+ unsigned short p1[] = {1, 8, 986, 65132u};
1350
+
1351
+ EXPECT_ABORT_BEGIN
1352
+ TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4);
1353
+ VERIFY_FAILS_END
1354
+ }
1355
+
1356
+ void testEqualHEX8Arrays(void)
1357
+ {
1358
+ unsigned short p0[] = {1, 8, 254u, 123};
1359
+ unsigned short p1[] = {1, 8, 254u, 123};
1360
+ unsigned short p2[] = {1, 8, 254u, 2};
1361
+ unsigned short p3[] = {1, 23, 25, 26};
1362
+
1363
+ TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 1);
1364
+ TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 4);
1365
+ TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4);
1366
+ TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p2, 3);
1367
+ TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p3, 1);
1368
+ }
1369
+
1370
+ void testNotEqualHEX8Arrays1(void)
1371
+ {
1372
+ unsigned char p0[] = {1, 8, 254u, 253u};
1373
+ unsigned char p1[] = {1, 8, 254u, 252u};
1374
+
1375
+ EXPECT_ABORT_BEGIN
1376
+ TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4);
1377
+ VERIFY_FAILS_END
1378
+ }
1379
+
1380
+ void testNotEqualHEX8Arrays2(void)
1381
+ {
1382
+ unsigned char p0[] = {1, 8, 254u, 253u};
1383
+ unsigned char p1[] = {2, 8, 254u, 253u};
1384
+
1385
+ EXPECT_ABORT_BEGIN
1386
+ TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4);
1387
+ VERIFY_FAILS_END
1388
+ }
1389
+
1390
+ void testNotEqualHEX8Arrays3(void)
1391
+ {
1392
+ unsigned char p0[] = {1, 8, 254u, 253u};
1393
+ unsigned char p1[] = {1, 8, 255u, 253u};
1394
+
1395
+ EXPECT_ABORT_BEGIN
1396
+ TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4);
1397
+ VERIFY_FAILS_END
1398
+ }
1399
+
1400
+ void testEqualMemoryArrays(void)
1401
+ {
1402
+ int p0[] = {1, 8, 987, -2};
1403
+ int p1[] = {1, 8, 987, -2};
1404
+ int p2[] = {1, 8, 987, 2};
1405
+ int p3[] = {1, 500, 600, 700};
1406
+
1407
+ TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 1);
1408
+ TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, 4, 4);
1409
+ TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4);
1410
+ TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p2, 4, 3);
1411
+ TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p3, 4, 1);
1412
+ }
1413
+
1414
+ void testNotEqualMemoryArraysExpectedNull(void)
1415
+ {
1416
+ int* p0 = NULL;
1417
+ int p1[] = {1, 8, 987, 2};
1418
+
1419
+ EXPECT_ABORT_BEGIN
1420
+ TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4);
1421
+ VERIFY_FAILS_END
1422
+ }
1423
+
1424
+ void testNotEqualMemoryArraysActualNull(void)
1425
+ {
1426
+ int p0[] = {1, 8, 987, -2};
1427
+ int* p1 = NULL;
1428
+
1429
+ EXPECT_ABORT_BEGIN
1430
+ TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4);
1431
+ VERIFY_FAILS_END
1432
+ }
1433
+
1434
+ void testNotEqualMemoryArrays1(void)
1435
+ {
1436
+ int p0[] = {1, 8, 987, -2};
1437
+ int p1[] = {1, 8, 987, 2};
1438
+
1439
+ EXPECT_ABORT_BEGIN
1440
+ TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4);
1441
+ VERIFY_FAILS_END
1442
+ }
1443
+
1444
+ void testNotEqualMemoryArrays2(void)
1445
+ {
1446
+ int p0[] = {1, 8, 987, -2};
1447
+ int p1[] = {2, 8, 987, -2};
1448
+
1449
+ EXPECT_ABORT_BEGIN
1450
+ TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4);
1451
+ VERIFY_FAILS_END
1452
+ }
1453
+
1454
+ void testNotEqualMemoryArrays3(void)
1455
+ {
1456
+ int p0[] = {1, 8, 987, -2};
1457
+ int p1[] = {1, 8, 986, -2};
1458
+
1459
+ EXPECT_ABORT_BEGIN
1460
+ TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, 4, 4);
1461
+ VERIFY_FAILS_END
1462
+ }
1463
+
1464
+ void testProtection(void)
1465
+ {
1466
+ volatile int mask = 0;
1467
+
1468
+ if (TEST_PROTECT())
1469
+ {
1470
+ mask |= 1;
1471
+ TEST_ABORT();
1472
+ }
1473
+ else
1474
+ {
1475
+ Unity.CurrentTestFailed = 0;
1476
+ mask |= 2;
1477
+ }
1478
+
1479
+ TEST_ASSERT_EQUAL(3, mask);
1480
+ }
1481
+
1482
+ void testIgnoredAndThenFailInTearDown(void)
1483
+ {
1484
+ SetToOneToFailInTearDown = 1;
1485
+ TEST_IGNORE();
1486
+ }
1487
+
1488
+ // ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES 64 BIT SUPPORT ==================
1489
+
1490
+ void testEqualHex64s(void)
1491
+ {
1492
+ #ifndef UNITY_SUPPORT_64
1493
+ TEST_IGNORE();
1494
+ #else
1495
+ _UU64 v0, v1;
1496
+ _UU64 *p0, *p1;
1497
+
1498
+ v0 = 0x9876543201234567;
1499
+ v1 = 0x9876543201234567;
1500
+ p0 = &v0;
1501
+ p1 = &v1;
1502
+
1503
+ TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, 0x9876543201234567);
1504
+ TEST_ASSERT_EQUAL_HEX64(v0, v1);
1505
+ TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, v1);
1506
+ TEST_ASSERT_EQUAL_HEX64(v0, 0x9876543201234567);
1507
+ TEST_ASSERT_EQUAL_HEX64(*p0, v1);
1508
+ TEST_ASSERT_EQUAL_HEX64(*p0, *p1);
1509
+ TEST_ASSERT_EQUAL_HEX64(*p0, 0x9876543201234567);
1510
+ #endif
1511
+ }
1512
+
1513
+ void testNotEqualHex64s(void)
1514
+ {
1515
+ #ifndef UNITY_SUPPORT_64
1516
+ TEST_IGNORE();
1517
+ #else
1518
+ _UU64 v0, v1;
1519
+
1520
+ v0 = 9000000000;
1521
+ v1 = 9100000000;
1522
+
1523
+ EXPECT_ABORT_BEGIN
1524
+ TEST_ASSERT_EQUAL_HEX64(v0, v1);
1525
+ VERIFY_FAILS_END
1526
+ #endif
1527
+ }
1528
+
1529
+ void testNotEqualHex64sIfSigned(void)
1530
+ {
1531
+ #ifndef UNITY_SUPPORT_64
1532
+ TEST_IGNORE();
1533
+ #else
1534
+ _US64 v0, v1;
1535
+
1536
+ v0 = -9000000000;
1537
+ v1 = 9000000000;
1538
+
1539
+ EXPECT_ABORT_BEGIN
1540
+ TEST_ASSERT_EQUAL_HEX64(v0, v1);
1541
+ VERIFY_FAILS_END
1542
+ #endif
1543
+ }
1544
+
1545
+ void testHEX64sWithinDelta(void)
1546
+ {
1547
+ #ifndef UNITY_SUPPORT_64
1548
+ TEST_IGNORE();
1549
+ #else
1550
+ TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF,0x7FFFFFFFFFFFFFFE);
1551
+ TEST_ASSERT_HEX64_WITHIN(5, 5000, 4996);
1552
+ TEST_ASSERT_HEX64_WITHIN(5, 5000, 5005);
1553
+ #endif
1554
+ }
1555
+
1556
+ void testHEX64sNotWithinDelta(void)
1557
+ {
1558
+ #ifndef UNITY_SUPPORT_64
1559
+ TEST_IGNORE();
1560
+ #else
1561
+ EXPECT_ABORT_BEGIN
1562
+ TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFC);
1563
+ VERIFY_FAILS_END
1564
+ #endif
1565
+ }
1566
+
1567
+ void testHEX64sNotWithinDeltaEvenThoughASignedIntWouldPass(void)
1568
+ {
1569
+ #ifndef UNITY_SUPPORT_64
1570
+ TEST_IGNORE();
1571
+ #else
1572
+ EXPECT_ABORT_BEGIN
1573
+ TEST_ASSERT_HEX64_WITHIN(5, 1, -1);
1574
+ VERIFY_FAILS_END
1575
+ #endif
1576
+ }
1577
+
1578
+ void testEqualHEX64Arrays(void)
1579
+ {
1580
+ #ifndef UNITY_SUPPORT_64
1581
+ TEST_IGNORE();
1582
+ #else
1583
+ _UU64 p0[] = {1, 8, 987, 65132u};
1584
+ _UU64 p1[] = {1, 8, 987, 65132u};
1585
+ _UU64 p2[] = {1, 8, 987, 2};
1586
+ _UU64 p3[] = {1, 500, 600, 700};
1587
+
1588
+ TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 1);
1589
+ TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 4);
1590
+ TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4);
1591
+ TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p2, 3);
1592
+ TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p3, 1);
1593
+ #endif
1594
+ }
1595
+
1596
+ void testNotEqualHEX64Arrays1(void)
1597
+ {
1598
+ #ifndef UNITY_SUPPORT_64
1599
+ TEST_IGNORE();
1600
+ #else
1601
+ _UU64 p0[] = {1, 8, 987, 65132u};
1602
+ _UU64 p1[] = {1, 8, 987, 65131u};
1603
+
1604
+ EXPECT_ABORT_BEGIN
1605
+ TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4);
1606
+ VERIFY_FAILS_END
1607
+ #endif
1608
+ }
1609
+
1610
+ void testNotEqualHEX64Arrays2(void)
1611
+ {
1612
+ #ifndef UNITY_SUPPORT_64
1613
+ TEST_IGNORE();
1614
+ #else
1615
+ _UU64 p0[] = {1, 8, 987, 65132u};
1616
+ _UU64 p1[] = {2, 8, 987, 65132u};
1617
+
1618
+ EXPECT_ABORT_BEGIN
1619
+ TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4);
1620
+ VERIFY_FAILS_END
1621
+ #endif
1622
+ }
1623
+
1624
+ // ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES FLOAT SUPPORT ==================
1625
+
1626
+ void testFloatsWithinDelta(void)
1627
+ {
1628
+ #ifdef UNITY_EXCLUDE_FLOAT
1629
+ TEST_IGNORE();
1630
+ #else
1631
+ TEST_ASSERT_FLOAT_WITHIN(0.00003f, 187245.03485f, 187245.03488f);
1632
+ TEST_ASSERT_FLOAT_WITHIN(1.0f, 187245.0f, 187246.0f);
1633
+ TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2549f, 9273.2049f);
1634
+ TEST_ASSERT_FLOAT_WITHIN(0.007f, -726.93724f, -726.94424f);
1635
+ #endif
1636
+ }
1637
+
1638
+ void testFloatsNotWithinDelta(void)
1639
+ {
1640
+ #ifdef UNITY_EXCLUDE_FLOAT
1641
+ TEST_IGNORE();
1642
+ #else
1643
+ EXPECT_ABORT_BEGIN
1644
+ TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2649f, 9273.2049f);
1645
+ VERIFY_FAILS_END
1646
+ #endif
1647
+ }
1648
+
1649
+ void testFloatsEqual(void)
1650
+ {
1651
+ #ifdef UNITY_EXCLUDE_FLOAT
1652
+ TEST_IGNORE();
1653
+ #else
1654
+ TEST_ASSERT_EQUAL_FLOAT(187245.0f, 187246.0f);
1655
+ TEST_ASSERT_EQUAL_FLOAT(18724.5f, 18724.6f);
1656
+ TEST_ASSERT_EQUAL_FLOAT(9273.2549f, 9273.2599f);
1657
+ TEST_ASSERT_EQUAL_FLOAT(-726.93724f, -726.9374f);
1658
+ #endif
1659
+ }
1660
+
1661
+ void testFloatsNotEqual(void)
1662
+ {
1663
+ #ifdef UNITY_EXCLUDE_FLOAT
1664
+ TEST_IGNORE();
1665
+ #else
1666
+ EXPECT_ABORT_BEGIN
1667
+ TEST_ASSERT_EQUAL_FLOAT(9273.9649f, 9273.0049f);
1668
+ VERIFY_FAILS_END
1669
+ #endif
1670
+ }
1671
+
1672
+ void testFloatsNotEqualNegative1(void)
1673
+ {
1674
+ #ifdef UNITY_EXCLUDE_FLOAT
1675
+ TEST_IGNORE();
1676
+ #else
1677
+ EXPECT_ABORT_BEGIN
1678
+ TEST_ASSERT_EQUAL_FLOAT(-9273.9649f, -9273.0049f);
1679
+ VERIFY_FAILS_END
1680
+ #endif
1681
+ }
1682
+
1683
+ void testFloatsNotEqualNegative2(void)
1684
+ {
1685
+ #ifdef UNITY_EXCLUDE_FLOAT
1686
+ TEST_IGNORE();
1687
+ #else
1688
+ EXPECT_ABORT_BEGIN
1689
+ TEST_ASSERT_EQUAL_FLOAT(-9273.0049f, -9273.9649f);
1690
+ VERIFY_FAILS_END
1691
+ #endif
1692
+ }
1693
+
1694
+ void testEqualFloatArrays(void)
1695
+ {
1696
+ #ifdef UNITY_EXCLUDE_FLOAT
1697
+ TEST_IGNORE();
1698
+ #else
1699
+ float p0[] = {1.0, -8.0, 25.4, -0.123};
1700
+ float p1[] = {1.0, -8.0, 25.4, -0.123};
1701
+ float p2[] = {1.0, -8.0, 25.4, -0.2};
1702
+ float p3[] = {1.0, -23.0, 25.0, -0.26};
1703
+
1704
+ TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 1);
1705
+ TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 4);
1706
+ TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4);
1707
+ TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p2, 3);
1708
+ TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p3, 1);
1709
+ #endif
1710
+ }
1711
+
1712
+ void testNotEqualFloatArraysExpectedNull(void)
1713
+ {
1714
+ #ifdef UNITY_EXCLUDE_FLOAT
1715
+ TEST_IGNORE();
1716
+ #else
1717
+ float* p0 = NULL;
1718
+ float p1[] = {1.0, 8.0, 25.4, 0.252};
1719
+
1720
+ EXPECT_ABORT_BEGIN
1721
+ TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4);
1722
+ VERIFY_FAILS_END
1723
+ #endif
1724
+ }
1725
+
1726
+ void testNotEqualFloatArraysActualNull(void)
1727
+ {
1728
+ #ifdef UNITY_EXCLUDE_FLOAT
1729
+ TEST_IGNORE();
1730
+ #else
1731
+ float p0[] = {1.0, 8.0, 25.4, 0.253};
1732
+ float* p1 = NULL;
1733
+
1734
+ EXPECT_ABORT_BEGIN
1735
+ TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4);
1736
+ VERIFY_FAILS_END
1737
+ #endif
1738
+ }
1739
+
1740
+ void testNotEqualFloatArrays1(void)
1741
+ {
1742
+ #ifdef UNITY_EXCLUDE_FLOAT
1743
+ TEST_IGNORE();
1744
+ #else
1745
+ float p0[] = {1.0, 8.0, 25.4, 0.253};
1746
+ float p1[] = {1.0, 8.0, 25.4, 0.252};
1747
+
1748
+ EXPECT_ABORT_BEGIN
1749
+ TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4);
1750
+ VERIFY_FAILS_END
1751
+ #endif
1752
+ }
1753
+
1754
+ void testNotEqualFloatArrays2(void)
1755
+ {
1756
+ #ifdef UNITY_EXCLUDE_FLOAT
1757
+ TEST_IGNORE();
1758
+ #else
1759
+ float p0[] = {1.0, 8.0, 25.4, 0.253};
1760
+ float p1[] = {2.0, 8.0, 25.4, 0.253};
1761
+
1762
+ EXPECT_ABORT_BEGIN
1763
+ TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4);
1764
+ VERIFY_FAILS_END
1765
+ #endif
1766
+ }
1767
+
1768
+ void testNotEqualFloatArrays3(void)
1769
+ {
1770
+ #ifdef UNITY_EXCLUDE_FLOAT
1771
+ TEST_IGNORE();
1772
+ #else
1773
+ float p0[] = {1.0, 8.0, 25.4, 0.253};
1774
+ float p1[] = {1.0, 8.0, 25.5, 0.253};
1775
+
1776
+ EXPECT_ABORT_BEGIN
1777
+ TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4);
1778
+ VERIFY_FAILS_END
1779
+ #endif
1780
+ }
1781
+
1782
+ void testNotEqualFloatArraysNegative1(void)
1783
+ {
1784
+ #ifdef UNITY_EXCLUDE_FLOAT
1785
+ TEST_IGNORE();
1786
+ #else
1787
+ float p0[] = {-1.0, -8.0, -25.4, -0.253};
1788
+ float p1[] = {-1.0, -8.0, -25.4, -0.252};
1789
+
1790
+ EXPECT_ABORT_BEGIN
1791
+ TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4);
1792
+ VERIFY_FAILS_END
1793
+ #endif
1794
+ }
1795
+
1796
+ void testNotEqualFloatArraysNegative2(void)
1797
+ {
1798
+ #ifdef UNITY_EXCLUDE_FLOAT
1799
+ TEST_IGNORE();
1800
+ #else
1801
+ float p0[] = {-1.0, -8.0, -25.4, -0.253};
1802
+ float p1[] = {-2.0, -8.0, -25.4, -0.253};
1803
+
1804
+ EXPECT_ABORT_BEGIN
1805
+ TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4);
1806
+ VERIFY_FAILS_END
1807
+ #endif
1808
+ }
1809
+
1810
+ void testNotEqualFloatArraysNegative3(void)
1811
+ {
1812
+ #ifdef UNITY_EXCLUDE_FLOAT
1813
+ TEST_IGNORE();
1814
+ #else
1815
+ float p0[] = {-1.0, -8.0, -25.4, -0.253};
1816
+ float p1[] = {-1.0, -8.0, -25.5, -0.253};
1817
+
1818
+ EXPECT_ABORT_BEGIN
1819
+ TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4);
1820
+ VERIFY_FAILS_END
1821
+ #endif
1822
+ }
1823
+
1824
+ // ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES DOUBLE SUPPORT ==================
1825
+
1826
+ void testDoublesWithinDelta(void)
1827
+ {
1828
+ #ifdef UNITY_EXCLUDE_DOUBLE
1829
+ TEST_IGNORE();
1830
+ #else
1831
+ TEST_ASSERT_DOUBLE_WITHIN(0.00003, 187245.03485, 187245.03488);
1832
+ TEST_ASSERT_DOUBLE_WITHIN(1.0, 187245.0, 187246.0);
1833
+ TEST_ASSERT_DOUBLE_WITHIN(0.05, 9273.2549, 9273.2049);
1834
+ TEST_ASSERT_DOUBLE_WITHIN(0.007, -726.93725, -726.94424);
1835
+ #endif
1836
+ }
1837
+
1838
+ void testDoublesNotWithinDelta(void)
1839
+ {
1840
+ #ifdef UNITY_EXCLUDE_DOUBLE
1841
+ TEST_IGNORE();
1842
+ #else
1843
+ EXPECT_ABORT_BEGIN
1844
+ TEST_ASSERT_DOUBLE_WITHIN(0.05, 9273.2649, 9273.2049);
1845
+ VERIFY_FAILS_END
1846
+ #endif
1847
+ }
1848
+
1849
+
1850
+ void testDoublesEqual(void)
1851
+ {
1852
+ #ifdef UNITY_EXCLUDE_DOUBLE
1853
+ TEST_IGNORE();
1854
+ #else
1855
+ TEST_ASSERT_EQUAL_DOUBLE(187245123456.0, 187245123456.0);
1856
+ TEST_ASSERT_EQUAL_DOUBLE(187241234567.5, 187241234567.6);
1857
+ TEST_ASSERT_EQUAL_DOUBLE(9273.2512345649, 9273.25123455699);
1858
+ TEST_ASSERT_EQUAL_DOUBLE(-726.12345693724, -726.1234569374);
1859
+ #endif
1860
+ }
1861
+
1862
+ void testDoublesNotEqual(void)
1863
+ {
1864
+ #ifdef UNITY_EXCLUDE_DOUBLE
1865
+ TEST_IGNORE();
1866
+ #else
1867
+ EXPECT_ABORT_BEGIN
1868
+ TEST_ASSERT_EQUAL_DOUBLE(9273.9649, 9273.0049);
1869
+ VERIFY_FAILS_END
1870
+ #endif
1871
+ }
1872
+
1873
+ void testDoublesNotEqualNegative1(void)
1874
+ {
1875
+ #ifdef UNITY_EXCLUDE_DOUBLE
1876
+ TEST_IGNORE();
1877
+ #else
1878
+ EXPECT_ABORT_BEGIN
1879
+ TEST_ASSERT_EQUAL_DOUBLE(-9273.9649, -9273.0049);
1880
+ VERIFY_FAILS_END
1881
+ #endif
1882
+ }
1883
+
1884
+ void testDoublesNotEqualNegative2(void)
1885
+ {
1886
+ #ifdef UNITY_EXCLUDE_DOUBLE
1887
+ TEST_IGNORE();
1888
+ #else
1889
+ EXPECT_ABORT_BEGIN
1890
+ TEST_ASSERT_EQUAL_DOUBLE(-9273.0049, -9273.9649);
1891
+ VERIFY_FAILS_END
1892
+ #endif
1893
+ }
1894
+
1895
+ void testEqualDoubleArrays(void)
1896
+ {
1897
+ #ifdef UNITY_EXCLUDE_DOUBLE
1898
+ TEST_IGNORE();
1899
+ #else
1900
+ double p0[] = {1.0, -8.0, 25.4, -0.123};
1901
+ double p1[] = {1.0, -8.0, 25.4, -0.123};
1902
+ double p2[] = {1.0, -8.0, 25.4, -0.2};
1903
+ double p3[] = {1.0, -23.0, 25.0, -0.26};
1904
+
1905
+ TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p0, 1);
1906
+ TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p0, 4);
1907
+ TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4);
1908
+ TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p2, 3);
1909
+ TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p3, 1);
1910
+ #endif
1911
+ }
1912
+
1913
+ void testNotEqualDoubleArraysExpectedNull(void)
1914
+ {
1915
+ #ifdef UNITY_EXCLUDE_DOUBLE
1916
+ TEST_IGNORE();
1917
+ #else
1918
+ double* p0 = NULL;
1919
+ double p1[] = {1.0, 8.0, 25.4, 0.252};
1920
+
1921
+ EXPECT_ABORT_BEGIN
1922
+ TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4);
1923
+ VERIFY_FAILS_END
1924
+ #endif
1925
+ }
1926
+
1927
+ void testNotEqualDoubleArraysActualNull(void)
1928
+ {
1929
+ #ifdef UNITY_EXCLUDE_DOUBLE
1930
+ TEST_IGNORE();
1931
+ #else
1932
+ double p0[] = {1.0, 8.0, 25.4, 0.253};
1933
+ double* p1 = NULL;
1934
+
1935
+ EXPECT_ABORT_BEGIN
1936
+ TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4);
1937
+ VERIFY_FAILS_END
1938
+ #endif
1939
+ }
1940
+
1941
+ void testNotEqualDoubleArrays1(void)
1942
+ {
1943
+ #ifdef UNITY_EXCLUDE_DOUBLE
1944
+ TEST_IGNORE();
1945
+ #else
1946
+ double p0[] = {1.0, 8.0, 25.4, 0.25666666667};
1947
+ double p1[] = {1.0, 8.0, 25.4, 0.25666666666};
1948
+
1949
+ EXPECT_ABORT_BEGIN
1950
+ TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4);
1951
+ VERIFY_FAILS_END
1952
+ #endif
1953
+ }
1954
+
1955
+ void testNotEqualDoubleArrays2(void)
1956
+ {
1957
+ #ifdef UNITY_EXCLUDE_DOUBLE
1958
+ TEST_IGNORE();
1959
+ #else
1960
+ double p0[] = {1.0, 8.0, 25.4, 0.253};
1961
+ double p1[] = {2.0, 8.0, 25.4, 0.253};
1962
+
1963
+ EXPECT_ABORT_BEGIN
1964
+ TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4);
1965
+ VERIFY_FAILS_END
1966
+ #endif
1967
+ }
1968
+
1969
+ void testNotEqualDoubleArrays3(void)
1970
+ {
1971
+ #ifdef UNITY_EXCLUDE_DOUBLE
1972
+ TEST_IGNORE();
1973
+ #else
1974
+ double p0[] = {1.0, 8.0, 25.4, 0.253};
1975
+ double p1[] = {1.0, 8.0, 25.5, 0.253};
1976
+
1977
+ EXPECT_ABORT_BEGIN
1978
+ TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4);
1979
+ VERIFY_FAILS_END
1980
+ #endif
1981
+ }
1982
+
1983
+ void testNotEqualDoubleArraysNegative1(void)
1984
+ {
1985
+ #ifdef UNITY_EXCLUDE_DOUBLE
1986
+ TEST_IGNORE();
1987
+ #else
1988
+ double p0[] = {-1.0, -8.0, -25.4, -0.2566666667};
1989
+ double p1[] = {-1.0, -8.0, -25.4, -0.2566666666};
1990
+
1991
+ EXPECT_ABORT_BEGIN
1992
+ TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4);
1993
+ VERIFY_FAILS_END
1994
+ #endif
1995
+ }
1996
+
1997
+ void testNotEqualDoubleArraysNegative2(void)
1998
+ {
1999
+ #ifdef UNITY_EXCLUDE_DOUBLE
2000
+ TEST_IGNORE();
2001
+ #else
2002
+ double p0[] = {-1.0, -8.0, -25.4, -0.253};
2003
+ double p1[] = {-2.0, -8.0, -25.4, -0.253};
2004
+
2005
+ EXPECT_ABORT_BEGIN
2006
+ TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4);
2007
+ VERIFY_FAILS_END
2008
+ #endif
2009
+ }
2010
+
2011
+ void testNotEqualDoubleArraysNegative3(void)
2012
+ {
2013
+ #ifdef UNITY_EXCLUDE_DOUBLE
2014
+ TEST_IGNORE();
2015
+ #else
2016
+ double p0[] = {-1.0, -8.0, -25.4, -0.253};
2017
+ double p1[] = {-1.0, -8.0, -25.5, -0.253};
2018
+
2019
+ EXPECT_ABORT_BEGIN
2020
+ TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4);
2021
+ VERIFY_FAILS_END
2022
+ #endif
2023
+ }
2024
+