ceedling 0.20.3 → 0.21.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (407) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -0
  3. data/Gemfile.lock +1 -0
  4. data/Rakefile +1 -0
  5. data/bin/ceedling +79 -26
  6. data/lib/ceedling/configurator_plugins.rb +0 -18
  7. data/lib/ceedling/rules_cmock.rake +1 -1
  8. data/lib/ceedling/tasks_base.rake +5 -1
  9. data/lib/ceedling/tasks_tests.rake +12 -9
  10. data/lib/ceedling/version.rb +1 -1
  11. data/lib/ceedling/version.rb.erb +1 -1
  12. data/plugins/fake_function_framework/README.md +250 -0
  13. data/plugins/fake_function_framework/Rakefile +19 -0
  14. data/plugins/fake_function_framework/examples/fff_example/project.yml +71 -0
  15. data/plugins/fake_function_framework/examples/fff_example/rakefile.rb +7 -0
  16. data/plugins/fake_function_framework/examples/fff_example/src/bar.c +1 -0
  17. data/plugins/fake_function_framework/examples/fff_example/src/bar.h +13 -0
  18. data/plugins/fake_function_framework/examples/fff_example/src/custom_types.h +6 -0
  19. data/plugins/fake_function_framework/examples/fff_example/src/display.c +7 -0
  20. data/plugins/fake_function_framework/examples/fff_example/src/display.h +16 -0
  21. data/plugins/fake_function_framework/examples/fff_example/src/event_processor.c +92 -0
  22. data/plugins/fake_function_framework/examples/fff_example/src/event_processor.h +11 -0
  23. data/plugins/fake_function_framework/examples/fff_example/src/foo.c +16 -0
  24. data/plugins/fake_function_framework/examples/fff_example/src/foo.h +8 -0
  25. data/plugins/fake_function_framework/examples/fff_example/src/subfolder/zzz.c +1 -0
  26. data/plugins/fake_function_framework/examples/fff_example/src/subfolder/zzz.h +6 -0
  27. data/plugins/fake_function_framework/examples/fff_example/test/test_event_processor.c +155 -0
  28. data/plugins/fake_function_framework/examples/fff_example/test/test_foo.c +47 -0
  29. data/plugins/fake_function_framework/lib/fake_function_framework.rb +87 -0
  30. data/plugins/fake_function_framework/lib/fff_mock_generator.rb +159 -0
  31. data/plugins/fake_function_framework/spec/fff_mock_generator_spec.rb +464 -0
  32. data/plugins/fake_function_framework/spec/spec_helper.rb +96 -0
  33. data/plugins/fake_function_framework/src/fff_unity_helper.h +33 -0
  34. data/plugins/fake_function_framework/vendor/fff/LICENSE +25 -0
  35. data/plugins/fake_function_framework/vendor/fff/Makefile +10 -0
  36. data/plugins/fake_function_framework/vendor/fff/README.md +454 -0
  37. data/plugins/fake_function_framework/vendor/fff/buildandtest +15 -0
  38. data/plugins/fake_function_framework/vendor/fff/examples/Makefile +7 -0
  39. data/plugins/fake_function_framework/vendor/fff/examples/driver_testing/Makefile +64 -0
  40. data/plugins/fake_function_framework/vendor/fff/examples/driver_testing/driver.c +24 -0
  41. data/plugins/fake_function_framework/vendor/fff/examples/driver_testing/driver.h +11 -0
  42. data/plugins/fake_function_framework/vendor/fff/examples/driver_testing/driver.test.cpp +50 -0
  43. data/plugins/fake_function_framework/vendor/fff/examples/driver_testing/driver.test.fff.cpp +62 -0
  44. data/plugins/fake_function_framework/vendor/fff/examples/driver_testing/hardware_abstraction.h +15 -0
  45. data/plugins/fake_function_framework/vendor/fff/examples/driver_testing/registers.h +13 -0
  46. data/plugins/fake_function_framework/vendor/fff/examples/embedded_ui/DISPLAY.h +17 -0
  47. data/plugins/fake_function_framework/vendor/fff/examples/embedded_ui/Kata.txt +25 -0
  48. data/plugins/fake_function_framework/vendor/fff/examples/embedded_ui/Makefile +67 -0
  49. data/plugins/fake_function_framework/vendor/fff/examples/embedded_ui/SYSTEM.h +21 -0
  50. data/plugins/fake_function_framework/vendor/fff/examples/embedded_ui/UI.c +48 -0
  51. data/plugins/fake_function_framework/vendor/fff/examples/embedded_ui/UI.h +12 -0
  52. data/plugins/fake_function_framework/vendor/fff/examples/embedded_ui/UI_test_ansic.c +183 -0
  53. data/plugins/fake_function_framework/vendor/fff/examples/embedded_ui/UI_test_cpp.cpp +136 -0
  54. data/plugins/fake_function_framework/vendor/fff/examples/embedded_ui/test_suite_template.c +34 -0
  55. data/plugins/fake_function_framework/vendor/fff/fakegen.rb +420 -0
  56. data/plugins/fake_function_framework/vendor/fff/fff.h +5112 -0
  57. data/plugins/fake_function_framework/vendor/fff/gtest/Makefile +22 -0
  58. data/plugins/fake_function_framework/vendor/fff/gtest/gtest-all.cc +9118 -0
  59. data/plugins/fake_function_framework/vendor/fff/gtest/gtest-main.cc +6 -0
  60. data/plugins/fake_function_framework/vendor/fff/gtest/gtest.h +19537 -0
  61. data/plugins/fake_function_framework/vendor/fff/test/Makefile +81 -0
  62. data/plugins/fake_function_framework/vendor/fff/test/c_test_framework.h +15 -0
  63. data/plugins/fake_function_framework/vendor/fff/test/fff_test_c.c +108 -0
  64. data/plugins/fake_function_framework/vendor/fff/test/fff_test_cpp.cpp +45 -0
  65. data/plugins/fake_function_framework/vendor/fff/test/fff_test_global_c.c +76 -0
  66. data/plugins/fake_function_framework/vendor/fff/test/fff_test_global_cpp.cpp +23 -0
  67. data/plugins/fake_function_framework/vendor/fff/test/global_fakes.c +13 -0
  68. data/plugins/fake_function_framework/vendor/fff/test/global_fakes.h +37 -0
  69. data/plugins/fake_function_framework/vendor/fff/test/test_cases.include +276 -0
  70. data/plugins/gcov/README.md +9 -0
  71. data/plugins/gcov/{template.erb → assets/template.erb} +1 -1
  72. data/plugins/gcov/{defaults.yml → config/defaults.yml} +10 -1
  73. data/plugins/gcov/gcov.rake +20 -8
  74. data/plugins/gcov/{gcov.rb → lib/gcov.rb} +13 -24
  75. data/plugins/module_generator/module_generator.rake +3 -3
  76. data/plugins/warnings_report/lib/warnings_report.rb +69 -0
  77. data/plugins/xml_tests_report/lib/xml_tests_report.rb +108 -0
  78. data/spec/spec_system_helper.rb +1 -1
  79. data/vendor/c_exception/lib/CException.h +1 -1
  80. data/vendor/c_exception/vendor/unity/auto/generate_module.rb +16 -16
  81. data/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +61 -21
  82. data/vendor/c_exception/vendor/unity/auto/stylize_as_junit.rb +5 -1
  83. data/vendor/c_exception/vendor/unity/auto/unity_to_junit.py +146 -0
  84. data/vendor/c_exception/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
  85. data/vendor/c_exception/vendor/unity/docs/UnityAssertionsReference.pdf +0 -0
  86. data/vendor/c_exception/vendor/unity/docs/UnityConfigurationGuide.pdf +0 -0
  87. data/vendor/c_exception/vendor/unity/docs/UnityGettingStartedGuide.pdf +0 -0
  88. data/vendor/c_exception/vendor/unity/docs/UnityHelperScriptsGuide.pdf +0 -0
  89. data/vendor/c_exception/vendor/unity/examples/example_1/makefile +1 -1
  90. data/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode.c +7 -7
  91. data/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode2.c +2 -2
  92. data/vendor/c_exception/vendor/unity/examples/example_1/test/TestProductionCode.c +14 -14
  93. data/vendor/c_exception/vendor/unity/examples/example_1/test/TestProductionCode2.c +2 -2
  94. data/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +5 -5
  95. data/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +5 -5
  96. data/vendor/c_exception/vendor/unity/examples/unity_config.h +257 -0
  97. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +9 -8
  98. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +1 -0
  99. data/vendor/c_exception/vendor/unity/extras/fixture/test/Makefile +28 -8
  100. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +57 -17
  101. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +3 -0
  102. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c +2 -3
  103. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h +1 -1
  104. data/vendor/c_exception/vendor/unity/release/version.info +1 -1
  105. data/vendor/c_exception/vendor/unity/src/unity.c +336 -191
  106. data/vendor/c_exception/vendor/unity/src/unity.h +73 -69
  107. data/vendor/c_exception/vendor/unity/src/unity_internals.h +119 -90
  108. data/vendor/c_exception/vendor/unity/test/Makefile +51 -0
  109. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c +5 -5
  110. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c +5 -5
  111. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_head1.c +5 -5
  112. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c +6 -6
  113. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c +6 -6
  114. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_head1.c +6 -6
  115. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c +6 -6
  116. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c +8 -8
  117. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c +6 -6
  118. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c +6 -6
  119. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c +8 -8
  120. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c +7 -7
  121. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c +5 -5
  122. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c +7 -7
  123. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c +5 -5
  124. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c +5 -5
  125. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c +7 -7
  126. data/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c +6 -6
  127. data/vendor/c_exception/vendor/unity/test/rakefile +5 -0
  128. data/vendor/c_exception/vendor/unity/test/rakefile_helper.rb +9 -7
  129. data/vendor/c_exception/vendor/unity/test/targets/clang_file.yml +1 -0
  130. data/vendor/c_exception/vendor/unity/test/targets/clang_strict.yml +3 -0
  131. data/vendor/c_exception/vendor/unity/test/targets/gcc_32.yml +1 -0
  132. data/vendor/c_exception/vendor/unity/test/targets/gcc_64.yml +1 -0
  133. data/vendor/c_exception/vendor/unity/test/targets/gcc_auto_limits.yml +1 -0
  134. data/vendor/c_exception/vendor/unity/test/targets/gcc_auto_sizeof.yml +1 -0
  135. data/vendor/c_exception/vendor/unity/test/targets/gcc_auto_stdint.yml +1 -0
  136. data/vendor/c_exception/vendor/unity/test/targets/gcc_manual_math.yml +1 -0
  137. data/vendor/c_exception/vendor/unity/test/targets/iar_arm_v4.yml +1 -0
  138. data/vendor/c_exception/vendor/unity/test/targets/iar_arm_v5.yml +1 -0
  139. data/vendor/c_exception/vendor/unity/test/targets/iar_arm_v5_3.yml +1 -0
  140. data/vendor/c_exception/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +1 -0
  141. data/vendor/c_exception/vendor/unity/test/targets/iar_cortexm3_v5.yml +1 -0
  142. data/vendor/c_exception/vendor/unity/test/targets/iar_msp430.yml +1 -0
  143. data/vendor/c_exception/vendor/unity/test/targets/iar_sh2a_v6.yml +1 -0
  144. data/vendor/c_exception/vendor/unity/test/testdata/CException.h +11 -0
  145. data/vendor/c_exception/vendor/unity/test/testdata/Defs.h +8 -0
  146. data/vendor/c_exception/vendor/unity/test/testdata/cmock.h +14 -0
  147. data/vendor/c_exception/vendor/unity/test/testdata/mockMock.h +13 -0
  148. data/vendor/c_exception/vendor/unity/test/testdata/testRunnerGenerator.c +183 -0
  149. data/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +65 -0
  150. data/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +192 -0
  151. data/vendor/c_exception/vendor/unity/test/tests/test_generate_test_runner.rb +1221 -71
  152. data/vendor/c_exception/vendor/unity/test/tests/testparameterized.c +1 -1
  153. data/vendor/c_exception/vendor/unity/test/tests/testunity.c +127 -5
  154. data/vendor/cmock/docs/CMock_Summary.md +1 -1
  155. data/vendor/cmock/lib/cmock_generator.rb +7 -2
  156. data/vendor/cmock/lib/cmock_header_parser.rb +29 -9
  157. data/vendor/cmock/scripts/create_mock.rb +1 -1
  158. data/vendor/cmock/test/system/test_compilation/const.h +15 -0
  159. data/vendor/cmock/test/unit/cmock_generator_main_test.rb +4 -4
  160. data/vendor/cmock/test/unit/cmock_header_parser_test.rb +136 -73
  161. data/vendor/cmock/vendor/c_exception/lib/CException.h +1 -1
  162. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_module.rb +16 -16
  163. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +61 -21
  164. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/stylize_as_junit.rb +5 -1
  165. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_to_junit.py +146 -0
  166. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
  167. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityAssertionsReference.pdf +0 -0
  168. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityConfigurationGuide.pdf +0 -0
  169. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityGettingStartedGuide.pdf +0 -0
  170. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityHelperScriptsGuide.pdf +0 -0
  171. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/makefile +1 -1
  172. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode.c +7 -7
  173. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode2.c +2 -2
  174. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/TestProductionCode.c +14 -14
  175. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/TestProductionCode2.c +2 -2
  176. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +5 -5
  177. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +5 -5
  178. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/unity_config.h +257 -0
  179. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +9 -8
  180. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +1 -0
  181. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/Makefile +28 -8
  182. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +57 -17
  183. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +3 -0
  184. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c +2 -3
  185. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h +1 -1
  186. data/vendor/cmock/vendor/c_exception/vendor/unity/release/version.info +1 -1
  187. data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.c +336 -191
  188. data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.h +73 -69
  189. data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity_internals.h +119 -90
  190. data/vendor/cmock/vendor/c_exception/vendor/unity/test/Makefile +51 -0
  191. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c +5 -5
  192. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c +5 -5
  193. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_head1.c +5 -5
  194. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c +6 -6
  195. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c +6 -6
  196. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_head1.c +6 -6
  197. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c +6 -6
  198. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c +8 -8
  199. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c +6 -6
  200. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c +6 -6
  201. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c +8 -8
  202. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c +7 -7
  203. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c +5 -5
  204. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c +7 -7
  205. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c +5 -5
  206. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c +5 -5
  207. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c +7 -7
  208. data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c +6 -6
  209. data/vendor/cmock/vendor/c_exception/vendor/unity/test/rakefile +5 -0
  210. data/vendor/cmock/vendor/c_exception/vendor/unity/test/rakefile_helper.rb +9 -7
  211. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/clang_file.yml +1 -0
  212. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/clang_strict.yml +3 -0
  213. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_32.yml +1 -0
  214. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_64.yml +1 -0
  215. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_auto_limits.yml +1 -0
  216. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_auto_sizeof.yml +1 -0
  217. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_auto_stdint.yml +1 -0
  218. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_manual_math.yml +1 -0
  219. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_arm_v4.yml +1 -0
  220. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_arm_v5.yml +1 -0
  221. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_arm_v5_3.yml +1 -0
  222. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +1 -0
  223. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_cortexm3_v5.yml +1 -0
  224. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_msp430.yml +1 -0
  225. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_sh2a_v6.yml +1 -0
  226. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/CException.h +11 -0
  227. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/Defs.h +8 -0
  228. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/cmock.h +14 -0
  229. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/mockMock.h +13 -0
  230. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testRunnerGenerator.c +183 -0
  231. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +65 -0
  232. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +192 -0
  233. data/vendor/cmock/vendor/c_exception/vendor/unity/test/tests/test_generate_test_runner.rb +1221 -71
  234. data/vendor/cmock/vendor/c_exception/vendor/unity/test/tests/testparameterized.c +1 -1
  235. data/vendor/cmock/vendor/c_exception/vendor/unity/test/tests/testunity.c +127 -5
  236. data/vendor/cmock/vendor/unity/auto/generate_module.rb +16 -16
  237. data/vendor/cmock/vendor/unity/auto/generate_test_runner.rb +61 -21
  238. data/vendor/cmock/vendor/unity/auto/stylize_as_junit.rb +5 -1
  239. data/vendor/cmock/vendor/unity/auto/unity_to_junit.py +146 -0
  240. data/vendor/cmock/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
  241. data/vendor/cmock/vendor/unity/docs/UnityAssertionsReference.pdf +0 -0
  242. data/vendor/cmock/vendor/unity/docs/UnityConfigurationGuide.pdf +0 -0
  243. data/vendor/cmock/vendor/unity/docs/UnityGettingStartedGuide.pdf +0 -0
  244. data/vendor/cmock/vendor/unity/docs/UnityHelperScriptsGuide.pdf +0 -0
  245. data/vendor/cmock/vendor/unity/examples/example_1/makefile +1 -1
  246. data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode.c +7 -7
  247. data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode2.c +2 -2
  248. data/vendor/cmock/vendor/unity/examples/example_1/test/TestProductionCode.c +14 -14
  249. data/vendor/cmock/vendor/unity/examples/example_1/test/TestProductionCode2.c +2 -2
  250. data/vendor/cmock/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +5 -5
  251. data/vendor/cmock/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +5 -5
  252. data/vendor/cmock/vendor/unity/examples/unity_config.h +257 -0
  253. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c +3 -0
  254. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c +5 -2
  255. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.c +1 -2
  256. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.h +1 -1
  257. data/vendor/cmock/vendor/unity/src/unity.c +329 -186
  258. data/vendor/cmock/vendor/unity/src/unity.h +73 -69
  259. data/vendor/cmock/vendor/unity/src/unity_internals.h +119 -94
  260. data/vendor/cmock/vendor/unity/test/Makefile +4 -5
  261. data/vendor/cmock/vendor/unity/test/expectdata/testsample_cmd.c +5 -5
  262. data/vendor/cmock/vendor/unity/test/expectdata/testsample_def.c +5 -5
  263. data/vendor/cmock/vendor/unity/test/expectdata/testsample_head1.c +5 -5
  264. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_cmd.c +6 -6
  265. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_def.c +6 -6
  266. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_head1.c +6 -6
  267. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new1.c +6 -6
  268. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new2.c +8 -8
  269. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_param.c +6 -6
  270. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run1.c +6 -6
  271. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run2.c +8 -8
  272. data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_yaml.c +7 -7
  273. data/vendor/cmock/vendor/unity/test/expectdata/testsample_new1.c +5 -5
  274. data/vendor/cmock/vendor/unity/test/expectdata/testsample_new2.c +7 -7
  275. data/vendor/cmock/vendor/unity/test/expectdata/testsample_param.c +5 -5
  276. data/vendor/cmock/vendor/unity/test/expectdata/testsample_run1.c +5 -5
  277. data/vendor/cmock/vendor/unity/test/expectdata/testsample_run2.c +7 -7
  278. data/vendor/cmock/vendor/unity/test/expectdata/testsample_yaml.c +6 -6
  279. data/vendor/cmock/vendor/unity/test/rakefile +5 -0
  280. data/vendor/cmock/vendor/unity/test/rakefile_helper.rb +9 -7
  281. data/vendor/cmock/vendor/unity/test/targets/clang_file.yml +1 -0
  282. data/vendor/cmock/vendor/unity/test/targets/clang_strict.yml +3 -0
  283. data/vendor/cmock/vendor/unity/test/targets/gcc_32.yml +1 -0
  284. data/vendor/cmock/vendor/unity/test/targets/gcc_64.yml +1 -0
  285. data/vendor/cmock/vendor/unity/test/targets/gcc_auto_limits.yml +1 -0
  286. data/vendor/cmock/vendor/unity/test/targets/gcc_auto_sizeof.yml +1 -0
  287. data/vendor/cmock/vendor/unity/test/targets/gcc_auto_stdint.yml +1 -0
  288. data/vendor/cmock/vendor/unity/test/targets/gcc_manual_math.yml +1 -0
  289. data/vendor/cmock/vendor/unity/test/targets/iar_arm_v4.yml +1 -0
  290. data/vendor/cmock/vendor/unity/test/targets/iar_arm_v5.yml +1 -0
  291. data/vendor/cmock/vendor/unity/test/targets/iar_arm_v5_3.yml +1 -0
  292. data/vendor/cmock/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +1 -0
  293. data/vendor/cmock/vendor/unity/test/targets/iar_cortexm3_v5.yml +1 -0
  294. data/vendor/cmock/vendor/unity/test/targets/iar_msp430.yml +1 -0
  295. data/vendor/cmock/vendor/unity/test/targets/iar_sh2a_v6.yml +1 -0
  296. data/vendor/cmock/vendor/unity/test/testdata/CException.h +11 -0
  297. data/vendor/cmock/vendor/unity/test/testdata/Defs.h +8 -0
  298. data/vendor/cmock/vendor/unity/test/testdata/cmock.h +14 -0
  299. data/vendor/cmock/vendor/unity/test/testdata/mockMock.h +13 -0
  300. data/vendor/cmock/vendor/unity/test/testdata/testRunnerGenerator.c +183 -0
  301. data/vendor/cmock/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +65 -0
  302. data/vendor/cmock/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +192 -0
  303. data/vendor/cmock/vendor/unity/test/tests/test_generate_test_runner.rb +1221 -71
  304. data/vendor/cmock/vendor/unity/test/tests/testparameterized.c +1 -1
  305. data/vendor/cmock/vendor/unity/test/tests/testunity.c +104 -7
  306. data/vendor/deep_merge/README +94 -94
  307. data/vendor/deep_merge/Rakefile +28 -28
  308. data/vendor/deep_merge/lib/deep_merge.rb +211 -211
  309. data/vendor/deep_merge/test/test_deep_merge.rb +553 -553
  310. data/vendor/unity/auto/generate_module.rb +16 -16
  311. data/vendor/unity/auto/generate_test_runner.rb +61 -21
  312. data/vendor/unity/auto/stylize_as_junit.rb +5 -1
  313. data/vendor/unity/auto/unity_to_junit.py +146 -0
  314. data/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
  315. data/vendor/unity/docs/UnityAssertionsReference.pdf +0 -0
  316. data/vendor/unity/docs/UnityConfigurationGuide.pdf +0 -0
  317. data/vendor/unity/docs/UnityGettingStartedGuide.pdf +0 -0
  318. data/vendor/unity/docs/UnityHelperScriptsGuide.pdf +0 -0
  319. data/vendor/unity/examples/example_1/makefile +1 -1
  320. data/vendor/unity/examples/example_1/src/ProductionCode.c +7 -7
  321. data/vendor/unity/examples/example_1/src/ProductionCode2.c +2 -2
  322. data/vendor/unity/examples/example_1/test/TestProductionCode.c +14 -14
  323. data/vendor/unity/examples/example_1/test/TestProductionCode2.c +2 -2
  324. data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +5 -5
  325. data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +5 -5
  326. data/vendor/unity/examples/unity_config.h +257 -0
  327. data/vendor/unity/extras/fixture/src/unity_fixture.c +3 -0
  328. data/vendor/unity/extras/fixture/test/unity_fixture_Test.c +5 -2
  329. data/vendor/unity/extras/fixture/test/unity_output_Spy.c +1 -2
  330. data/vendor/unity/extras/fixture/test/unity_output_Spy.h +1 -1
  331. data/vendor/unity/src/unity.c +329 -186
  332. data/vendor/unity/src/unity.h +73 -69
  333. data/vendor/unity/src/unity_internals.h +119 -94
  334. data/vendor/unity/test/Makefile +4 -5
  335. data/vendor/unity/test/expectdata/testsample_cmd.c +5 -5
  336. data/vendor/unity/test/expectdata/testsample_def.c +5 -5
  337. data/vendor/unity/test/expectdata/testsample_head1.c +5 -5
  338. data/vendor/unity/test/expectdata/testsample_mock_cmd.c +6 -6
  339. data/vendor/unity/test/expectdata/testsample_mock_def.c +6 -6
  340. data/vendor/unity/test/expectdata/testsample_mock_head1.c +6 -6
  341. data/vendor/unity/test/expectdata/testsample_mock_new1.c +6 -6
  342. data/vendor/unity/test/expectdata/testsample_mock_new2.c +8 -8
  343. data/vendor/unity/test/expectdata/testsample_mock_param.c +6 -6
  344. data/vendor/unity/test/expectdata/testsample_mock_run1.c +6 -6
  345. data/vendor/unity/test/expectdata/testsample_mock_run2.c +8 -8
  346. data/vendor/unity/test/expectdata/testsample_mock_yaml.c +7 -7
  347. data/vendor/unity/test/expectdata/testsample_new1.c +5 -5
  348. data/vendor/unity/test/expectdata/testsample_new2.c +7 -7
  349. data/vendor/unity/test/expectdata/testsample_param.c +5 -5
  350. data/vendor/unity/test/expectdata/testsample_run1.c +5 -5
  351. data/vendor/unity/test/expectdata/testsample_run2.c +7 -7
  352. data/vendor/unity/test/expectdata/testsample_yaml.c +6 -6
  353. data/vendor/unity/test/rakefile +5 -0
  354. data/vendor/unity/test/rakefile_helper.rb +9 -7
  355. data/vendor/unity/test/targets/clang_file.yml +1 -0
  356. data/vendor/unity/test/targets/clang_strict.yml +3 -0
  357. data/vendor/unity/test/targets/gcc_32.yml +1 -0
  358. data/vendor/unity/test/targets/gcc_64.yml +1 -0
  359. data/vendor/unity/test/targets/gcc_auto_limits.yml +1 -0
  360. data/vendor/unity/test/targets/gcc_auto_sizeof.yml +1 -0
  361. data/vendor/unity/test/targets/gcc_auto_stdint.yml +1 -0
  362. data/vendor/unity/test/targets/gcc_manual_math.yml +1 -0
  363. data/vendor/unity/test/targets/iar_arm_v4.yml +1 -0
  364. data/vendor/unity/test/targets/iar_arm_v5.yml +1 -0
  365. data/vendor/unity/test/targets/iar_arm_v5_3.yml +1 -0
  366. data/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +1 -0
  367. data/vendor/unity/test/targets/iar_cortexm3_v5.yml +1 -0
  368. data/vendor/unity/test/targets/iar_msp430.yml +1 -0
  369. data/vendor/unity/test/targets/iar_sh2a_v6.yml +1 -0
  370. data/vendor/unity/test/testdata/CException.h +11 -0
  371. data/vendor/unity/test/testdata/Defs.h +8 -0
  372. data/vendor/unity/test/testdata/cmock.h +14 -0
  373. data/vendor/unity/test/testdata/mockMock.h +13 -0
  374. data/vendor/unity/test/testdata/testRunnerGenerator.c +183 -0
  375. data/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +65 -0
  376. data/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +192 -0
  377. data/vendor/unity/test/tests/test_generate_test_runner.rb +1221 -71
  378. data/vendor/unity/test/tests/testparameterized.c +1 -1
  379. data/vendor/unity/test/tests/testunity.c +104 -7
  380. metadata +124 -32
  381. data/plugins/gcov/readme.txt +0 -0
  382. data/plugins/warnings_report/warnings_report.rb +0 -71
  383. data/plugins/xml_tests_report/xml_tests_report.rb +0 -110
  384. data/vendor/c_exception/vendor/unity/docs/Unity Summary.odt +0 -0
  385. data/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf +0 -0
  386. data/vendor/c_exception/vendor/unity/docs/Unity Summary.txt +0 -224
  387. data/vendor/c_exception/vendor/unity/test/testdata/mocksample.c +0 -51
  388. data/vendor/c_exception/vendor/unity/test/testdata/sample.yml +0 -9
  389. data/vendor/c_exception/vendor/unity/test/testdata/testsample.c +0 -68
  390. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.odt +0 -0
  391. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf +0 -0
  392. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.txt +0 -224
  393. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/mocksample.c +0 -51
  394. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/sample.yml +0 -9
  395. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testsample.c +0 -68
  396. data/vendor/cmock/vendor/unity/docs/Unity Summary.odt +0 -0
  397. data/vendor/cmock/vendor/unity/docs/Unity Summary.pdf +0 -0
  398. data/vendor/cmock/vendor/unity/docs/Unity Summary.txt +0 -224
  399. data/vendor/cmock/vendor/unity/test/testdata/mocksample.c +0 -51
  400. data/vendor/cmock/vendor/unity/test/testdata/sample.yml +0 -9
  401. data/vendor/cmock/vendor/unity/test/testdata/testsample.c +0 -68
  402. data/vendor/unity/docs/Unity Summary.odt +0 -0
  403. data/vendor/unity/docs/Unity Summary.pdf +0 -0
  404. data/vendor/unity/docs/Unity Summary.txt +0 -224
  405. data/vendor/unity/test/testdata/mocksample.c +0 -51
  406. data/vendor/unity/test/testdata/sample.yml +0 -9
  407. data/vendor/unity/test/testdata/testsample.c +0 -68
@@ -0,0 +1,19 @@
1
+ require 'rake'
2
+ require 'rspec/core/rake_task'
3
+
4
+ desc "Run all rspecs"
5
+ RSpec::Core::RakeTask.new(:spec) do |t|
6
+ t.pattern = Dir.glob('spec/**/*_spec.rb')
7
+ t.rspec_opts = '--format documentation'
8
+ # t.rspec_opts << ' more options'
9
+ end
10
+
11
+ desc "Run integration test on example"
12
+ task :integration_test do
13
+ chdir("./examples/fff_example") do
14
+ sh "rake clobber"
15
+ sh "rake test:all"
16
+ end
17
+ end
18
+
19
+ task :default => [:spec, :integration_test]
@@ -0,0 +1,71 @@
1
+ ---
2
+
3
+ # Notes:
4
+ # Sample project C code is not presently written to produce a release artifact.
5
+ # As such, release build options are disabled.
6
+ # This sample, therefore, only demonstrates running a collection of unit tests.
7
+
8
+ :project:
9
+ :use_exceptions: FALSE
10
+ :use_test_preprocessor: TRUE
11
+ :use_auxiliary_dependencies: TRUE
12
+ :build_root: build
13
+ # :release_build: TRUE
14
+ :test_file_prefix: test_
15
+
16
+ #:release_build:
17
+ # :output: MyApp.out
18
+ # :use_assembly: FALSE
19
+
20
+ :environment:
21
+
22
+ :extension:
23
+ :executable: .out
24
+
25
+ :paths:
26
+ :test:
27
+ - +:test/**
28
+ :source:
29
+ - src/**
30
+ :support:
31
+
32
+ :defines:
33
+ # in order to add common defines:
34
+ # 1) remove the trailing [] from the :common: section
35
+ # 2) add entries to the :common: section (e.g. :test: has TEST defined)
36
+ :commmon: &common_defines []
37
+ :test:
38
+ - *common_defines
39
+ - TEST
40
+ :test_preprocess:
41
+ - *common_defines
42
+ - TEST
43
+
44
+ :cmock:
45
+ :mock_prefix: mock_
46
+ :when_no_prototypes: :warn
47
+ :enforce_strict_ordering: TRUE
48
+ :plugins:
49
+ - :ignore
50
+ - :callback
51
+ :treat_as:
52
+ uint8: HEX8
53
+ uint16: HEX16
54
+ uint32: UINT32
55
+ int8: INT8
56
+ bool: UINT8
57
+
58
+ #:tools:
59
+ # Ceedling defaults to using gcc for compiling, linking, etc.
60
+ # As [:tools] is blank, gcc will be used (so long as it's in your system path)
61
+ # See documentation to configure a given toolchain for use
62
+
63
+ :plugins:
64
+ :load_paths:
65
+ # This change from the default is for running Ceedling out of another folder.
66
+ - ../../../../plugins
67
+ :enabled:
68
+ - stdout_pretty_tests_report
69
+ - module_generator
70
+ - fake_function_framework
71
+ ...
@@ -0,0 +1,7 @@
1
+ # This change from the default is for running Ceedling out of another folder.
2
+ PROJECT_CEEDLING_ROOT = "../../../.."
3
+ load "#{PROJECT_CEEDLING_ROOT}/lib/ceedling.rb"
4
+
5
+ Ceedling.load_project
6
+
7
+ task :default => %w[ test:all release ]
@@ -0,0 +1 @@
1
+ #include "bar.h"
@@ -0,0 +1,13 @@
1
+ #ifndef bar_H
2
+ #define bar_H
3
+
4
+ #include "custom_types.h"
5
+
6
+ void bar_turn_on(void);
7
+ void bar_print_message(const char * message);
8
+ void bar_print_message_formatted(const char * format, ...);
9
+ void bar_numbers(int one, int two, char three);
10
+ void bar_const_test(const char * a, char * const b, const int c);
11
+ custom_t bar_needs_custom_type(void);
12
+
13
+ #endif // bar_H
@@ -0,0 +1,6 @@
1
+ #ifndef custom_types_H
2
+ #define custom_types_H
3
+
4
+ typedef int custom_t;
5
+
6
+ #endif
@@ -0,0 +1,7 @@
1
+ #include <stdio.h>
2
+ #include "display.h"
3
+
4
+ void display_turnOffStatusLed(void)
5
+ {
6
+ printf("Display: Status LED off");
7
+ }
@@ -0,0 +1,16 @@
1
+ #include <stdbool.h>
2
+
3
+ void display_turnOffStatusLed(void);
4
+ void display_turnOnStatusLed(void);
5
+ void display_setVolume(int level);
6
+ void display_setModeToMinimum(void);
7
+ void display_setModeToMaximum(void);
8
+ void display_setModeToAverage(void);
9
+ bool display_isError(void);
10
+ void display_powerDown(void);
11
+ void display_updateData(int data, void(*updateCompleteCallback)(void));
12
+
13
+ /*
14
+ The entry is returned (up to `length` bytes) in the provided `entry` buffer.
15
+ */
16
+ void display_getKeyboardEntry(char * entry, int length);
@@ -0,0 +1,92 @@
1
+ /*
2
+ This module implements some business logic to test.
3
+
4
+ Signal events by calling the functions on the module.
5
+ */
6
+
7
+ #include <stdio.h>
8
+ #include "event_processor.h"
9
+ #include "display.h"
10
+
11
+ void event_deviceReset(void)
12
+ {
13
+ //printf ("Device reset\n");
14
+ display_turnOffStatusLed();
15
+ }
16
+
17
+ void event_volumeKnobMaxed(void)
18
+ {
19
+ display_setVolume(11);
20
+ }
21
+
22
+ void event_powerReadingUpdate(int powerReading)
23
+ {
24
+ if (powerReading >= 5)
25
+ {
26
+ display_turnOnStatusLed();
27
+ }
28
+ }
29
+
30
+ void event_modeSelectButtonPressed(void)
31
+ {
32
+ static int mode = 0;
33
+
34
+ if (mode == 0)
35
+ {
36
+ display_setModeToMinimum();
37
+ mode++;
38
+ }
39
+ else if (mode == 1)
40
+ {
41
+ display_setModeToMaximum();
42
+ mode++;
43
+ }
44
+ else if (mode == 2)
45
+ {
46
+ display_setModeToAverage();
47
+ mode++;
48
+ }
49
+ else
50
+ {
51
+ mode = 0;
52
+ }
53
+ }
54
+
55
+ void event_devicePoweredOn(void)
56
+ {
57
+ if (display_isError())
58
+ {
59
+ display_powerDown();
60
+ }
61
+ }
62
+
63
+ void event_keyboardCheckTimerExpired(void)
64
+ {
65
+ char userEntry[100];
66
+
67
+ display_getKeyboardEntry(userEntry, 100);
68
+
69
+ if (strcmp(userEntry, "sleep") == 0)
70
+ {
71
+ display_powerDown();
72
+ }
73
+ }
74
+
75
+ static bool event_lastComplete = false;
76
+
77
+ /* Function called when the display update is complete. */
78
+ static void displayUpdateComplete(void)
79
+ {
80
+ event_lastComplete = true;
81
+ }
82
+
83
+ void event_newDataAvailable(int data)
84
+ {
85
+ event_lastComplete = false;
86
+ display_updateData(data, displayUpdateComplete);
87
+ }
88
+
89
+ bool eventProcessor_isLastEventComplete(void)
90
+ {
91
+ return event_lastComplete;
92
+ }
@@ -0,0 +1,11 @@
1
+ #include <stdbool.h>
2
+
3
+ void event_deviceReset(void);
4
+ void event_volumeKnobMaxed(void);
5
+ void event_powerReadingUpdate(int powerReading);
6
+ void event_modeSelectButtonPressed(void);
7
+ void event_devicePoweredOn(void);
8
+ void event_keyboardCheckTimerExpired(void);
9
+ void event_newDataAvailable(int data);
10
+
11
+ bool eventProcessor_isLastEventComplete(void);
@@ -0,0 +1,16 @@
1
+ #include "foo.h"
2
+ #include "bar.h"
3
+ #include "subfolder/zzz.h"
4
+
5
+ void foo_turn_on(void) {
6
+ bar_turn_on();
7
+ zzz_sleep(1, "sleepy");
8
+ }
9
+
10
+ void foo_print_message(const char * message) {
11
+ bar_print_message(message);
12
+ }
13
+
14
+ void foo_print_special_message(void) {
15
+ bar_print_message_formatted("The numbers are %d, %d and %d", 1, 2, 3);
16
+ }
@@ -0,0 +1,8 @@
1
+ #ifndef foo_H
2
+ #define foo_H
3
+
4
+ void foo_turn_on(void);
5
+ void foo_print_message(const char * message);
6
+ void foo_print_special_message(void);
7
+
8
+ #endif // foo_H
@@ -0,0 +1,6 @@
1
+ #ifndef zzz_H
2
+ #define zzz_H
3
+
4
+ int zzz_sleep(int time, char * name);
5
+
6
+ #endif // zzz_H
@@ -0,0 +1,155 @@
1
+ #include "unity.h"
2
+ #include "event_processor.h"
3
+ #include "mock_display.h"
4
+ #include <string.h>
5
+
6
+ void setUp (void)
7
+ {
8
+ }
9
+
10
+ void tearDown (void)
11
+ {
12
+ }
13
+ /*
14
+ Test that a single function was called.
15
+ */
16
+ void
17
+ test_whenTheDeviceIsReset_thenTheStatusLedIsTurnedOff()
18
+ {
19
+ // When
20
+ event_deviceReset();
21
+
22
+ // Then
23
+ TEST_ASSERT_EQUAL(1, display_turnOffStatusLed_fake.call_count);
24
+ // or use the helper macro...
25
+ TEST_ASSERT_CALLED(display_turnOffStatusLed);
26
+ }
27
+
28
+ /*
29
+ Test that a single function is NOT called.
30
+ */
31
+ void
32
+ test_whenThePowerReadingIsLessThan5_thenTheStatusLedIsNotTurnedOn(void)
33
+ {
34
+ // When
35
+ event_powerReadingUpdate(4);
36
+
37
+ // Then
38
+ TEST_ASSERT_EQUAL(0, display_turnOnStatusLed_fake.call_count);
39
+ // or use the helper macro...
40
+ TEST_ASSERT_NOT_CALLED(display_turnOffStatusLed);
41
+ }
42
+
43
+ /*
44
+ Test that a single function was called with the correct arugment.
45
+ */
46
+ void
47
+ test_whenTheVolumeKnobIsMaxed_thenVolumeDisplayIsSetTo11(void)
48
+ {
49
+ // When
50
+ event_volumeKnobMaxed();
51
+
52
+ // Then
53
+ TEST_ASSERT_EQUAL(1, display_setVolume_fake.call_count);
54
+ // or use the helper macro...
55
+ TEST_ASSERT_CALLED(display_setVolume);
56
+ TEST_ASSERT_EQUAL(11, display_setVolume_fake.arg0_val);
57
+ }
58
+
59
+ /*
60
+ Test a sequence of calls.
61
+ */
62
+
63
+ void
64
+ test_whenTheModeSelectButtonIsPressed_thenTheDisplayModeIsCycled(void)
65
+ {
66
+ // When
67
+ event_modeSelectButtonPressed();
68
+ event_modeSelectButtonPressed();
69
+ event_modeSelectButtonPressed();
70
+
71
+ // Then
72
+ TEST_ASSERT_EQUAL_PTR((void *)display_setModeToMinimum, fff.call_history[0]);
73
+ TEST_ASSERT_EQUAL_PTR((void *)display_setModeToMaximum, fff.call_history[1]);
74
+ TEST_ASSERT_EQUAL_PTR((void *)display_setModeToAverage, fff.call_history[2]);
75
+ // or use the helper macros...
76
+ TEST_ASSERT_CALLED_IN_ORDER(0, display_setModeToMinimum);
77
+ TEST_ASSERT_CALLED_IN_ORDER(1, display_setModeToMaximum);
78
+ TEST_ASSERT_CALLED_IN_ORDER(2, display_setModeToAverage);
79
+ }
80
+
81
+ /*
82
+ Mock a return value from a function.
83
+ */
84
+ void
85
+ test_givenTheDisplayHasAnError_whenTheDeviceIsPoweredOn_thenTheDisplayIsPoweredDown(void)
86
+ {
87
+ // Given
88
+ display_isError_fake.return_val = true;
89
+
90
+ // When
91
+ event_devicePoweredOn();
92
+
93
+ // Then
94
+ TEST_ASSERT_EQUAL(1, display_powerDown_fake.call_count);
95
+ // or use the helper macro...
96
+ TEST_ASSERT_CALLED(display_powerDown);
97
+ }
98
+
99
+ /*
100
+ Mock a sequence of calls with return values.
101
+ */
102
+
103
+ /*
104
+ Mocking a function with a value returned by reference.
105
+ */
106
+ void
107
+ test_givenTheUserHasTypedSleep_whenItIsTimeToCheckTheKeyboard_theDisplayIsPoweredDown(void)
108
+ {
109
+ // Given
110
+ char mockedEntry[] = "sleep";
111
+ void return_mock_value(char * entry, int length)
112
+ {
113
+ if (length > strlen(mockedEntry))
114
+ {
115
+ strncpy(entry, mockedEntry, length);
116
+ }
117
+ }
118
+ display_getKeyboardEntry_fake.custom_fake = return_mock_value;
119
+
120
+ // When
121
+ event_keyboardCheckTimerExpired();
122
+
123
+ // Then
124
+ TEST_ASSERT_EQUAL(1, display_powerDown_fake.call_count);
125
+ // or use the helper macro...
126
+ TEST_ASSERT_CALLED(display_powerDown);
127
+ }
128
+
129
+ /*
130
+ Mock a function with a function pointer parameter.
131
+ */
132
+ void
133
+ test_givenNewDataIsAvailable_whenTheDisplayHasUpdated_thenTheEventIsComplete(void)
134
+ {
135
+ // A mock function for capturing the callback handler function pointer.
136
+ void(*registeredCallback)(void) = 0;
137
+ void mock_display_updateData(int data, void(*callback)(void))
138
+ {
139
+ //Save the callback function.
140
+ registeredCallback = callback;
141
+ }
142
+ display_updateData_fake.custom_fake = mock_display_updateData;
143
+
144
+ // Given
145
+ event_newDataAvailable(10);
146
+
147
+ // When
148
+ if (registeredCallback != 0)
149
+ {
150
+ registeredCallback();
151
+ }
152
+
153
+ // Then
154
+ TEST_ASSERT_EQUAL(true, eventProcessor_isLastEventComplete());
155
+ }