ceedling 0.20.3 → 0.21.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +3 -0
- data/Gemfile.lock +1 -0
- data/Rakefile +1 -0
- data/bin/ceedling +79 -26
- data/lib/ceedling/configurator_plugins.rb +0 -18
- data/lib/ceedling/rules_cmock.rake +1 -1
- data/lib/ceedling/tasks_base.rake +5 -1
- data/lib/ceedling/tasks_tests.rake +12 -9
- data/lib/ceedling/version.rb +1 -1
- data/lib/ceedling/version.rb.erb +1 -1
- data/plugins/fake_function_framework/README.md +250 -0
- data/plugins/fake_function_framework/Rakefile +19 -0
- data/plugins/fake_function_framework/examples/fff_example/project.yml +71 -0
- data/plugins/fake_function_framework/examples/fff_example/rakefile.rb +7 -0
- data/plugins/fake_function_framework/examples/fff_example/src/bar.c +1 -0
- data/plugins/fake_function_framework/examples/fff_example/src/bar.h +13 -0
- data/plugins/fake_function_framework/examples/fff_example/src/custom_types.h +6 -0
- data/plugins/fake_function_framework/examples/fff_example/src/display.c +7 -0
- data/plugins/fake_function_framework/examples/fff_example/src/display.h +16 -0
- data/plugins/fake_function_framework/examples/fff_example/src/event_processor.c +92 -0
- data/plugins/fake_function_framework/examples/fff_example/src/event_processor.h +11 -0
- data/plugins/fake_function_framework/examples/fff_example/src/foo.c +16 -0
- data/plugins/fake_function_framework/examples/fff_example/src/foo.h +8 -0
- data/plugins/fake_function_framework/examples/fff_example/src/subfolder/zzz.c +1 -0
- data/plugins/fake_function_framework/examples/fff_example/src/subfolder/zzz.h +6 -0
- data/plugins/fake_function_framework/examples/fff_example/test/test_event_processor.c +155 -0
- data/plugins/fake_function_framework/examples/fff_example/test/test_foo.c +47 -0
- data/plugins/fake_function_framework/lib/fake_function_framework.rb +87 -0
- data/plugins/fake_function_framework/lib/fff_mock_generator.rb +159 -0
- data/plugins/fake_function_framework/spec/fff_mock_generator_spec.rb +464 -0
- data/plugins/fake_function_framework/spec/spec_helper.rb +96 -0
- data/plugins/fake_function_framework/src/fff_unity_helper.h +33 -0
- data/plugins/fake_function_framework/vendor/fff/LICENSE +25 -0
- data/plugins/fake_function_framework/vendor/fff/Makefile +10 -0
- data/plugins/fake_function_framework/vendor/fff/README.md +454 -0
- data/plugins/fake_function_framework/vendor/fff/buildandtest +15 -0
- data/plugins/fake_function_framework/vendor/fff/examples/Makefile +7 -0
- data/plugins/fake_function_framework/vendor/fff/examples/driver_testing/Makefile +64 -0
- data/plugins/fake_function_framework/vendor/fff/examples/driver_testing/driver.c +24 -0
- data/plugins/fake_function_framework/vendor/fff/examples/driver_testing/driver.h +11 -0
- data/plugins/fake_function_framework/vendor/fff/examples/driver_testing/driver.test.cpp +50 -0
- data/plugins/fake_function_framework/vendor/fff/examples/driver_testing/driver.test.fff.cpp +62 -0
- data/plugins/fake_function_framework/vendor/fff/examples/driver_testing/hardware_abstraction.h +15 -0
- data/plugins/fake_function_framework/vendor/fff/examples/driver_testing/registers.h +13 -0
- data/plugins/fake_function_framework/vendor/fff/examples/embedded_ui/DISPLAY.h +17 -0
- data/plugins/fake_function_framework/vendor/fff/examples/embedded_ui/Kata.txt +25 -0
- data/plugins/fake_function_framework/vendor/fff/examples/embedded_ui/Makefile +67 -0
- data/plugins/fake_function_framework/vendor/fff/examples/embedded_ui/SYSTEM.h +21 -0
- data/plugins/fake_function_framework/vendor/fff/examples/embedded_ui/UI.c +48 -0
- data/plugins/fake_function_framework/vendor/fff/examples/embedded_ui/UI.h +12 -0
- data/plugins/fake_function_framework/vendor/fff/examples/embedded_ui/UI_test_ansic.c +183 -0
- data/plugins/fake_function_framework/vendor/fff/examples/embedded_ui/UI_test_cpp.cpp +136 -0
- data/plugins/fake_function_framework/vendor/fff/examples/embedded_ui/test_suite_template.c +34 -0
- data/plugins/fake_function_framework/vendor/fff/fakegen.rb +420 -0
- data/plugins/fake_function_framework/vendor/fff/fff.h +5112 -0
- data/plugins/fake_function_framework/vendor/fff/gtest/Makefile +22 -0
- data/plugins/fake_function_framework/vendor/fff/gtest/gtest-all.cc +9118 -0
- data/plugins/fake_function_framework/vendor/fff/gtest/gtest-main.cc +6 -0
- data/plugins/fake_function_framework/vendor/fff/gtest/gtest.h +19537 -0
- data/plugins/fake_function_framework/vendor/fff/test/Makefile +81 -0
- data/plugins/fake_function_framework/vendor/fff/test/c_test_framework.h +15 -0
- data/plugins/fake_function_framework/vendor/fff/test/fff_test_c.c +108 -0
- data/plugins/fake_function_framework/vendor/fff/test/fff_test_cpp.cpp +45 -0
- data/plugins/fake_function_framework/vendor/fff/test/fff_test_global_c.c +76 -0
- data/plugins/fake_function_framework/vendor/fff/test/fff_test_global_cpp.cpp +23 -0
- data/plugins/fake_function_framework/vendor/fff/test/global_fakes.c +13 -0
- data/plugins/fake_function_framework/vendor/fff/test/global_fakes.h +37 -0
- data/plugins/fake_function_framework/vendor/fff/test/test_cases.include +276 -0
- data/plugins/gcov/README.md +9 -0
- data/plugins/gcov/{template.erb → assets/template.erb} +1 -1
- data/plugins/gcov/{defaults.yml → config/defaults.yml} +10 -1
- data/plugins/gcov/gcov.rake +20 -8
- data/plugins/gcov/{gcov.rb → lib/gcov.rb} +13 -24
- data/plugins/module_generator/module_generator.rake +3 -3
- data/plugins/warnings_report/lib/warnings_report.rb +69 -0
- data/plugins/xml_tests_report/lib/xml_tests_report.rb +108 -0
- data/spec/spec_system_helper.rb +1 -1
- data/vendor/c_exception/lib/CException.h +1 -1
- data/vendor/c_exception/vendor/unity/auto/generate_module.rb +16 -16
- data/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +61 -21
- data/vendor/c_exception/vendor/unity/auto/stylize_as_junit.rb +5 -1
- data/vendor/c_exception/vendor/unity/auto/unity_to_junit.py +146 -0
- data/vendor/c_exception/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
- data/vendor/c_exception/vendor/unity/docs/UnityAssertionsReference.pdf +0 -0
- data/vendor/c_exception/vendor/unity/docs/UnityConfigurationGuide.pdf +0 -0
- data/vendor/c_exception/vendor/unity/docs/UnityGettingStartedGuide.pdf +0 -0
- data/vendor/c_exception/vendor/unity/docs/UnityHelperScriptsGuide.pdf +0 -0
- data/vendor/c_exception/vendor/unity/examples/example_1/makefile +1 -1
- data/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode.c +7 -7
- data/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode2.c +2 -2
- data/vendor/c_exception/vendor/unity/examples/example_1/test/TestProductionCode.c +14 -14
- data/vendor/c_exception/vendor/unity/examples/example_1/test/TestProductionCode2.c +2 -2
- data/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +5 -5
- data/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +5 -5
- data/vendor/c_exception/vendor/unity/examples/unity_config.h +257 -0
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +9 -8
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +1 -0
- data/vendor/c_exception/vendor/unity/extras/fixture/test/Makefile +28 -8
- data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +57 -17
- data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +3 -0
- data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c +2 -3
- data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h +1 -1
- data/vendor/c_exception/vendor/unity/release/version.info +1 -1
- data/vendor/c_exception/vendor/unity/src/unity.c +336 -191
- data/vendor/c_exception/vendor/unity/src/unity.h +73 -69
- data/vendor/c_exception/vendor/unity/src/unity_internals.h +119 -90
- data/vendor/c_exception/vendor/unity/test/Makefile +51 -0
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c +5 -5
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c +5 -5
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_head1.c +5 -5
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c +6 -6
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c +6 -6
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_head1.c +6 -6
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c +6 -6
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c +8 -8
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c +6 -6
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c +6 -6
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c +8 -8
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c +7 -7
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c +5 -5
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c +7 -7
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c +5 -5
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c +5 -5
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c +7 -7
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c +6 -6
- data/vendor/c_exception/vendor/unity/test/rakefile +5 -0
- data/vendor/c_exception/vendor/unity/test/rakefile_helper.rb +9 -7
- data/vendor/c_exception/vendor/unity/test/targets/clang_file.yml +1 -0
- data/vendor/c_exception/vendor/unity/test/targets/clang_strict.yml +3 -0
- data/vendor/c_exception/vendor/unity/test/targets/gcc_32.yml +1 -0
- data/vendor/c_exception/vendor/unity/test/targets/gcc_64.yml +1 -0
- data/vendor/c_exception/vendor/unity/test/targets/gcc_auto_limits.yml +1 -0
- data/vendor/c_exception/vendor/unity/test/targets/gcc_auto_sizeof.yml +1 -0
- data/vendor/c_exception/vendor/unity/test/targets/gcc_auto_stdint.yml +1 -0
- data/vendor/c_exception/vendor/unity/test/targets/gcc_manual_math.yml +1 -0
- data/vendor/c_exception/vendor/unity/test/targets/iar_arm_v4.yml +1 -0
- data/vendor/c_exception/vendor/unity/test/targets/iar_arm_v5.yml +1 -0
- data/vendor/c_exception/vendor/unity/test/targets/iar_arm_v5_3.yml +1 -0
- data/vendor/c_exception/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +1 -0
- data/vendor/c_exception/vendor/unity/test/targets/iar_cortexm3_v5.yml +1 -0
- data/vendor/c_exception/vendor/unity/test/targets/iar_msp430.yml +1 -0
- data/vendor/c_exception/vendor/unity/test/targets/iar_sh2a_v6.yml +1 -0
- data/vendor/c_exception/vendor/unity/test/testdata/CException.h +11 -0
- data/vendor/c_exception/vendor/unity/test/testdata/Defs.h +8 -0
- data/vendor/c_exception/vendor/unity/test/testdata/cmock.h +14 -0
- data/vendor/c_exception/vendor/unity/test/testdata/mockMock.h +13 -0
- data/vendor/c_exception/vendor/unity/test/testdata/testRunnerGenerator.c +183 -0
- data/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +65 -0
- data/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +192 -0
- data/vendor/c_exception/vendor/unity/test/tests/test_generate_test_runner.rb +1221 -71
- data/vendor/c_exception/vendor/unity/test/tests/testparameterized.c +1 -1
- data/vendor/c_exception/vendor/unity/test/tests/testunity.c +127 -5
- data/vendor/cmock/docs/CMock_Summary.md +1 -1
- data/vendor/cmock/lib/cmock_generator.rb +7 -2
- data/vendor/cmock/lib/cmock_header_parser.rb +29 -9
- data/vendor/cmock/scripts/create_mock.rb +1 -1
- data/vendor/cmock/test/system/test_compilation/const.h +15 -0
- data/vendor/cmock/test/unit/cmock_generator_main_test.rb +4 -4
- data/vendor/cmock/test/unit/cmock_header_parser_test.rb +136 -73
- data/vendor/cmock/vendor/c_exception/lib/CException.h +1 -1
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_module.rb +16 -16
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +61 -21
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/stylize_as_junit.rb +5 -1
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_to_junit.py +146 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityAssertionsReference.pdf +0 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityConfigurationGuide.pdf +0 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityGettingStartedGuide.pdf +0 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityHelperScriptsGuide.pdf +0 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/makefile +1 -1
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode.c +7 -7
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode2.c +2 -2
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/TestProductionCode.c +14 -14
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/TestProductionCode2.c +2 -2
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +5 -5
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +5 -5
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/unity_config.h +257 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +9 -8
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +1 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/Makefile +28 -8
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +57 -17
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +3 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c +2 -3
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h +1 -1
- data/vendor/cmock/vendor/c_exception/vendor/unity/release/version.info +1 -1
- data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.c +336 -191
- data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.h +73 -69
- data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity_internals.h +119 -90
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/Makefile +51 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c +5 -5
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c +5 -5
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_head1.c +5 -5
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c +6 -6
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c +6 -6
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_head1.c +6 -6
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c +6 -6
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c +8 -8
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c +6 -6
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c +6 -6
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c +8 -8
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c +7 -7
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c +5 -5
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c +7 -7
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c +5 -5
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c +5 -5
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c +7 -7
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c +6 -6
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/rakefile +5 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/rakefile_helper.rb +9 -7
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/clang_file.yml +1 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/clang_strict.yml +3 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_32.yml +1 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_64.yml +1 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_auto_limits.yml +1 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_auto_sizeof.yml +1 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_auto_stdint.yml +1 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_manual_math.yml +1 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_arm_v4.yml +1 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_arm_v5.yml +1 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_arm_v5_3.yml +1 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +1 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_cortexm3_v5.yml +1 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_msp430.yml +1 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_sh2a_v6.yml +1 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/CException.h +11 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/Defs.h +8 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/cmock.h +14 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/mockMock.h +13 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testRunnerGenerator.c +183 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +65 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +192 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/tests/test_generate_test_runner.rb +1221 -71
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/tests/testparameterized.c +1 -1
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/tests/testunity.c +127 -5
- data/vendor/cmock/vendor/unity/auto/generate_module.rb +16 -16
- data/vendor/cmock/vendor/unity/auto/generate_test_runner.rb +61 -21
- data/vendor/cmock/vendor/unity/auto/stylize_as_junit.rb +5 -1
- data/vendor/cmock/vendor/unity/auto/unity_to_junit.py +146 -0
- data/vendor/cmock/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
- data/vendor/cmock/vendor/unity/docs/UnityAssertionsReference.pdf +0 -0
- data/vendor/cmock/vendor/unity/docs/UnityConfigurationGuide.pdf +0 -0
- data/vendor/cmock/vendor/unity/docs/UnityGettingStartedGuide.pdf +0 -0
- data/vendor/cmock/vendor/unity/docs/UnityHelperScriptsGuide.pdf +0 -0
- data/vendor/cmock/vendor/unity/examples/example_1/makefile +1 -1
- data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode.c +7 -7
- data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode2.c +2 -2
- data/vendor/cmock/vendor/unity/examples/example_1/test/TestProductionCode.c +14 -14
- data/vendor/cmock/vendor/unity/examples/example_1/test/TestProductionCode2.c +2 -2
- data/vendor/cmock/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +5 -5
- data/vendor/cmock/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +5 -5
- data/vendor/cmock/vendor/unity/examples/unity_config.h +257 -0
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c +3 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c +5 -2
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.c +1 -2
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.h +1 -1
- data/vendor/cmock/vendor/unity/src/unity.c +329 -186
- data/vendor/cmock/vendor/unity/src/unity.h +73 -69
- data/vendor/cmock/vendor/unity/src/unity_internals.h +119 -94
- data/vendor/cmock/vendor/unity/test/Makefile +4 -5
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_cmd.c +5 -5
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_def.c +5 -5
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_head1.c +5 -5
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_cmd.c +6 -6
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_def.c +6 -6
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_head1.c +6 -6
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new1.c +6 -6
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new2.c +8 -8
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_param.c +6 -6
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run1.c +6 -6
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run2.c +8 -8
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_yaml.c +7 -7
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_new1.c +5 -5
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_new2.c +7 -7
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_param.c +5 -5
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_run1.c +5 -5
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_run2.c +7 -7
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_yaml.c +6 -6
- data/vendor/cmock/vendor/unity/test/rakefile +5 -0
- data/vendor/cmock/vendor/unity/test/rakefile_helper.rb +9 -7
- data/vendor/cmock/vendor/unity/test/targets/clang_file.yml +1 -0
- data/vendor/cmock/vendor/unity/test/targets/clang_strict.yml +3 -0
- data/vendor/cmock/vendor/unity/test/targets/gcc_32.yml +1 -0
- data/vendor/cmock/vendor/unity/test/targets/gcc_64.yml +1 -0
- data/vendor/cmock/vendor/unity/test/targets/gcc_auto_limits.yml +1 -0
- data/vendor/cmock/vendor/unity/test/targets/gcc_auto_sizeof.yml +1 -0
- data/vendor/cmock/vendor/unity/test/targets/gcc_auto_stdint.yml +1 -0
- data/vendor/cmock/vendor/unity/test/targets/gcc_manual_math.yml +1 -0
- data/vendor/cmock/vendor/unity/test/targets/iar_arm_v4.yml +1 -0
- data/vendor/cmock/vendor/unity/test/targets/iar_arm_v5.yml +1 -0
- data/vendor/cmock/vendor/unity/test/targets/iar_arm_v5_3.yml +1 -0
- data/vendor/cmock/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +1 -0
- data/vendor/cmock/vendor/unity/test/targets/iar_cortexm3_v5.yml +1 -0
- data/vendor/cmock/vendor/unity/test/targets/iar_msp430.yml +1 -0
- data/vendor/cmock/vendor/unity/test/targets/iar_sh2a_v6.yml +1 -0
- data/vendor/cmock/vendor/unity/test/testdata/CException.h +11 -0
- data/vendor/cmock/vendor/unity/test/testdata/Defs.h +8 -0
- data/vendor/cmock/vendor/unity/test/testdata/cmock.h +14 -0
- data/vendor/cmock/vendor/unity/test/testdata/mockMock.h +13 -0
- data/vendor/cmock/vendor/unity/test/testdata/testRunnerGenerator.c +183 -0
- data/vendor/cmock/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +65 -0
- data/vendor/cmock/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +192 -0
- data/vendor/cmock/vendor/unity/test/tests/test_generate_test_runner.rb +1221 -71
- data/vendor/cmock/vendor/unity/test/tests/testparameterized.c +1 -1
- data/vendor/cmock/vendor/unity/test/tests/testunity.c +104 -7
- data/vendor/deep_merge/README +94 -94
- data/vendor/deep_merge/Rakefile +28 -28
- data/vendor/deep_merge/lib/deep_merge.rb +211 -211
- data/vendor/deep_merge/test/test_deep_merge.rb +553 -553
- data/vendor/unity/auto/generate_module.rb +16 -16
- data/vendor/unity/auto/generate_test_runner.rb +61 -21
- data/vendor/unity/auto/stylize_as_junit.rb +5 -1
- data/vendor/unity/auto/unity_to_junit.py +146 -0
- data/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
- data/vendor/unity/docs/UnityAssertionsReference.pdf +0 -0
- data/vendor/unity/docs/UnityConfigurationGuide.pdf +0 -0
- data/vendor/unity/docs/UnityGettingStartedGuide.pdf +0 -0
- data/vendor/unity/docs/UnityHelperScriptsGuide.pdf +0 -0
- data/vendor/unity/examples/example_1/makefile +1 -1
- data/vendor/unity/examples/example_1/src/ProductionCode.c +7 -7
- data/vendor/unity/examples/example_1/src/ProductionCode2.c +2 -2
- data/vendor/unity/examples/example_1/test/TestProductionCode.c +14 -14
- data/vendor/unity/examples/example_1/test/TestProductionCode2.c +2 -2
- data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +5 -5
- data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +5 -5
- data/vendor/unity/examples/unity_config.h +257 -0
- data/vendor/unity/extras/fixture/src/unity_fixture.c +3 -0
- data/vendor/unity/extras/fixture/test/unity_fixture_Test.c +5 -2
- data/vendor/unity/extras/fixture/test/unity_output_Spy.c +1 -2
- data/vendor/unity/extras/fixture/test/unity_output_Spy.h +1 -1
- data/vendor/unity/src/unity.c +329 -186
- data/vendor/unity/src/unity.h +73 -69
- data/vendor/unity/src/unity_internals.h +119 -94
- data/vendor/unity/test/Makefile +4 -5
- data/vendor/unity/test/expectdata/testsample_cmd.c +5 -5
- data/vendor/unity/test/expectdata/testsample_def.c +5 -5
- data/vendor/unity/test/expectdata/testsample_head1.c +5 -5
- data/vendor/unity/test/expectdata/testsample_mock_cmd.c +6 -6
- data/vendor/unity/test/expectdata/testsample_mock_def.c +6 -6
- data/vendor/unity/test/expectdata/testsample_mock_head1.c +6 -6
- data/vendor/unity/test/expectdata/testsample_mock_new1.c +6 -6
- data/vendor/unity/test/expectdata/testsample_mock_new2.c +8 -8
- data/vendor/unity/test/expectdata/testsample_mock_param.c +6 -6
- data/vendor/unity/test/expectdata/testsample_mock_run1.c +6 -6
- data/vendor/unity/test/expectdata/testsample_mock_run2.c +8 -8
- data/vendor/unity/test/expectdata/testsample_mock_yaml.c +7 -7
- data/vendor/unity/test/expectdata/testsample_new1.c +5 -5
- data/vendor/unity/test/expectdata/testsample_new2.c +7 -7
- data/vendor/unity/test/expectdata/testsample_param.c +5 -5
- data/vendor/unity/test/expectdata/testsample_run1.c +5 -5
- data/vendor/unity/test/expectdata/testsample_run2.c +7 -7
- data/vendor/unity/test/expectdata/testsample_yaml.c +6 -6
- data/vendor/unity/test/rakefile +5 -0
- data/vendor/unity/test/rakefile_helper.rb +9 -7
- data/vendor/unity/test/targets/clang_file.yml +1 -0
- data/vendor/unity/test/targets/clang_strict.yml +3 -0
- data/vendor/unity/test/targets/gcc_32.yml +1 -0
- data/vendor/unity/test/targets/gcc_64.yml +1 -0
- data/vendor/unity/test/targets/gcc_auto_limits.yml +1 -0
- data/vendor/unity/test/targets/gcc_auto_sizeof.yml +1 -0
- data/vendor/unity/test/targets/gcc_auto_stdint.yml +1 -0
- data/vendor/unity/test/targets/gcc_manual_math.yml +1 -0
- data/vendor/unity/test/targets/iar_arm_v4.yml +1 -0
- data/vendor/unity/test/targets/iar_arm_v5.yml +1 -0
- data/vendor/unity/test/targets/iar_arm_v5_3.yml +1 -0
- data/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +1 -0
- data/vendor/unity/test/targets/iar_cortexm3_v5.yml +1 -0
- data/vendor/unity/test/targets/iar_msp430.yml +1 -0
- data/vendor/unity/test/targets/iar_sh2a_v6.yml +1 -0
- data/vendor/unity/test/testdata/CException.h +11 -0
- data/vendor/unity/test/testdata/Defs.h +8 -0
- data/vendor/unity/test/testdata/cmock.h +14 -0
- data/vendor/unity/test/testdata/mockMock.h +13 -0
- data/vendor/unity/test/testdata/testRunnerGenerator.c +183 -0
- data/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +65 -0
- data/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +192 -0
- data/vendor/unity/test/tests/test_generate_test_runner.rb +1221 -71
- data/vendor/unity/test/tests/testparameterized.c +1 -1
- data/vendor/unity/test/tests/testunity.c +104 -7
- metadata +124 -32
- data/plugins/gcov/readme.txt +0 -0
- data/plugins/warnings_report/warnings_report.rb +0 -71
- data/plugins/xml_tests_report/xml_tests_report.rb +0 -110
- data/vendor/c_exception/vendor/unity/docs/Unity Summary.odt +0 -0
- data/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf +0 -0
- data/vendor/c_exception/vendor/unity/docs/Unity Summary.txt +0 -224
- data/vendor/c_exception/vendor/unity/test/testdata/mocksample.c +0 -51
- data/vendor/c_exception/vendor/unity/test/testdata/sample.yml +0 -9
- data/vendor/c_exception/vendor/unity/test/testdata/testsample.c +0 -68
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.odt +0 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf +0 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.txt +0 -224
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/mocksample.c +0 -51
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/sample.yml +0 -9
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testsample.c +0 -68
- data/vendor/cmock/vendor/unity/docs/Unity Summary.odt +0 -0
- data/vendor/cmock/vendor/unity/docs/Unity Summary.pdf +0 -0
- data/vendor/cmock/vendor/unity/docs/Unity Summary.txt +0 -224
- data/vendor/cmock/vendor/unity/test/testdata/mocksample.c +0 -51
- data/vendor/cmock/vendor/unity/test/testdata/sample.yml +0 -9
- data/vendor/cmock/vendor/unity/test/testdata/testsample.c +0 -68
- data/vendor/unity/docs/Unity Summary.odt +0 -0
- data/vendor/unity/docs/Unity Summary.pdf +0 -0
- data/vendor/unity/docs/Unity Summary.txt +0 -224
- data/vendor/unity/test/testdata/mocksample.c +0 -51
- data/vendor/unity/test/testdata/sample.yml +0 -9
- data/vendor/unity/test/testdata/testsample.c +0 -68
@@ -0,0 +1,96 @@
|
|
1
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
2
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
3
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
4
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
5
|
+
# files.
|
6
|
+
#
|
7
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
8
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
9
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
10
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
11
|
+
# a separate helper file that requires the additional dependencies and performs
|
12
|
+
# the additional setup, and require it from the spec files that actually need
|
13
|
+
# it.
|
14
|
+
#
|
15
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
16
|
+
# users commonly want.
|
17
|
+
#
|
18
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
19
|
+
RSpec.configure do |config|
|
20
|
+
# rspec-expectations config goes here. You can use an alternate
|
21
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
22
|
+
# assertions if you prefer.
|
23
|
+
config.expect_with :rspec do |expectations|
|
24
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
25
|
+
# and `failure_message` of custom matchers include text for helper methods
|
26
|
+
# defined using `chain`, e.g.:
|
27
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
28
|
+
# # => "be bigger than 2 and smaller than 4"
|
29
|
+
# ...rather than:
|
30
|
+
# # => "be bigger than 2"
|
31
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
32
|
+
end
|
33
|
+
|
34
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
35
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
36
|
+
config.mock_with :rspec do |mocks|
|
37
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
38
|
+
# a real object. This is generally recommended, and will default to
|
39
|
+
# `true` in RSpec 4.
|
40
|
+
mocks.verify_partial_doubles = true
|
41
|
+
end
|
42
|
+
|
43
|
+
# The settings below are suggested to provide a good initial experience
|
44
|
+
# with RSpec, but feel free to customize to your heart's content.
|
45
|
+
=begin
|
46
|
+
# These two settings work together to allow you to limit a spec run
|
47
|
+
# to individual examples or groups you care about by tagging them with
|
48
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
49
|
+
# get run.
|
50
|
+
config.filter_run :focus
|
51
|
+
config.run_all_when_everything_filtered = true
|
52
|
+
|
53
|
+
# Allows RSpec to persist some state between runs in order to support
|
54
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
55
|
+
# you configure your source control system to ignore this file.
|
56
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
57
|
+
|
58
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
59
|
+
# recommended. For more details, see:
|
60
|
+
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
61
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
62
|
+
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
63
|
+
config.disable_monkey_patching!
|
64
|
+
|
65
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
66
|
+
# be too noisy due to issues in dependencies.
|
67
|
+
config.warnings = true
|
68
|
+
|
69
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
70
|
+
# file, and it's useful to allow more verbose output when running an
|
71
|
+
# individual spec file.
|
72
|
+
if config.files_to_run.one?
|
73
|
+
# Use the documentation formatter for detailed output,
|
74
|
+
# unless a formatter has already been configured
|
75
|
+
# (e.g. via a command-line flag).
|
76
|
+
config.default_formatter = 'doc'
|
77
|
+
end
|
78
|
+
|
79
|
+
# Print the 10 slowest examples and example groups at the
|
80
|
+
# end of the spec run, to help surface which specs are running
|
81
|
+
# particularly slow.
|
82
|
+
config.profile_examples = 10
|
83
|
+
|
84
|
+
# Run specs in random order to surface order dependencies. If you find an
|
85
|
+
# order dependency and want to debug it, you can fix the order by providing
|
86
|
+
# the seed, which is printed after each run.
|
87
|
+
# --seed 1234
|
88
|
+
config.order = :random
|
89
|
+
|
90
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
91
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
92
|
+
# test failures related to randomization by passing the same `--seed` value
|
93
|
+
# as the one that triggered the failure.
|
94
|
+
Kernel.srand config.seed
|
95
|
+
=end
|
96
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#ifndef fff_unity_helper_H
|
2
|
+
#define fff_unity_helper_H
|
3
|
+
|
4
|
+
/*
|
5
|
+
FFF helper macros for Unity.
|
6
|
+
*/
|
7
|
+
|
8
|
+
/*
|
9
|
+
Fail if the function was not called the expected number of times.
|
10
|
+
*/
|
11
|
+
#define TEST_ASSERT_CALLED_TIMES(times_, function_) \
|
12
|
+
TEST_ASSERT_EQUAL_MESSAGE(times_, \
|
13
|
+
function_ ## _fake.call_count, \
|
14
|
+
"Function " #function_ " called the incorrect number of times.")
|
15
|
+
/*
|
16
|
+
Fail if the function was not called exactly once.
|
17
|
+
*/
|
18
|
+
#define TEST_ASSERT_CALLED(function_) TEST_ASSERT_CALLED_TIMES(1, function_)
|
19
|
+
|
20
|
+
/*
|
21
|
+
Fail if the function was called 1 or more times.
|
22
|
+
*/
|
23
|
+
#define TEST_ASSERT_NOT_CALLED(function_) TEST_ASSERT_CALLED_TIMES(0, function_)
|
24
|
+
|
25
|
+
/*
|
26
|
+
Fail if the function was not called in this particular order.
|
27
|
+
*/
|
28
|
+
#define TEST_ASSERT_CALLED_IN_ORDER(order_, function_) \
|
29
|
+
TEST_ASSERT_EQUAL_PTR_MESSAGE((void *) function_, \
|
30
|
+
fff.call_history[order_], \
|
31
|
+
"Function " #function_ " not called in order " #order_ )
|
32
|
+
|
33
|
+
#endif
|
@@ -0,0 +1,25 @@
|
|
1
|
+
/*
|
2
|
+
LICENSE
|
3
|
+
|
4
|
+
The MIT License (MIT)
|
5
|
+
|
6
|
+
Copyright (c) 2010 Michael Long
|
7
|
+
|
8
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
9
|
+
of this software and associated documentation files (the "Software"), to deal
|
10
|
+
in the Software without restriction, including without limitation the rights
|
11
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12
|
+
copies of the Software, and to permit persons to whom the Software is
|
13
|
+
furnished to do so, subject to the following conditions:
|
14
|
+
|
15
|
+
The above copyright notice and this permission notice shall be included in all
|
16
|
+
copies or substantial portions of the Software.
|
17
|
+
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
21
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
24
|
+
SOFTWARE.
|
25
|
+
*/
|
@@ -0,0 +1,454 @@
|
|
1
|
+
# Fake Function Framework (fff)
|
2
|
+
-----------------------------
|
3
|
+
> How long can we _maintain_? I wonder. How long before one of us starts raving
|
4
|
+
> and jabbering at this boy? What will he think then? This same lonely desert
|
5
|
+
> was the last known home of the Manson family. Will he make that grim
|
6
|
+
> connection...
|
7
|
+
|
8
|
+
## A Fake Function Framework for C
|
9
|
+
fff is a micro-framework for creating fake C functions for tests. Because life
|
10
|
+
is too short to spend time hand-writing fake functions for testing.
|
11
|
+
|
12
|
+
|
13
|
+
## Hello fake world!
|
14
|
+
|
15
|
+
Say you are testing an embedded user interface and you have a function that
|
16
|
+
you want to create a fake for:
|
17
|
+
|
18
|
+
// UI.c
|
19
|
+
...
|
20
|
+
void DISPLAY_init();
|
21
|
+
...
|
22
|
+
|
23
|
+
Here's how you would define a fake function for this in your test suite:
|
24
|
+
|
25
|
+
// test.c(pp)
|
26
|
+
#include "fff.h"
|
27
|
+
DEFINE_FFF_GLOBALS;
|
28
|
+
FAKE_VOID_FUNC(DISPLAY_init);
|
29
|
+
|
30
|
+
And the unit test might look something like this:
|
31
|
+
|
32
|
+
TEST_F(GreeterTests, init_initialises_display)
|
33
|
+
{
|
34
|
+
UI_init();
|
35
|
+
ASSERT_EQ(DISPLAY_init_fake.call_count, 1);
|
36
|
+
}
|
37
|
+
|
38
|
+
So what has happened here? The first thing to note is that the framework is
|
39
|
+
header only, all you need to do to use it is download <tt>fff.h</tt> and include
|
40
|
+
it in your test suite.
|
41
|
+
|
42
|
+
The magic is in the <tt>FAKE_VOID_FUNC</tt>. This
|
43
|
+
expands a macro that defines a function returning <tt>void</tt>
|
44
|
+
which has zero arguments. It also defines a struct
|
45
|
+
<tt>"function_name"_fake</tt> which contains all the information about the fake.
|
46
|
+
For instance, <tt>DISPLAY_init_fake.call_count</tt>is incremented every time the faked
|
47
|
+
function is called.
|
48
|
+
|
49
|
+
Under the hood it generates a struct that looks like this:
|
50
|
+
|
51
|
+
typedef struct DISPLAY_init_Fake {
|
52
|
+
unsigned int call_count;
|
53
|
+
unsigned int arg_history_len;
|
54
|
+
unsigned int arg_histories_dropped;
|
55
|
+
void(*custom_fake)();
|
56
|
+
} DISPLAY_init_Fake;
|
57
|
+
DISPLAY_init_Fake DISPLAY_init_fake;
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
## Capturing arguments
|
64
|
+
|
65
|
+
Ok, enough with the toy examples. What about faking functions with arguments?
|
66
|
+
|
67
|
+
// UI.c
|
68
|
+
...
|
69
|
+
void DISPLAY_output(char * message);
|
70
|
+
...
|
71
|
+
|
72
|
+
Here's how you would define a fake function for this in your test suite:
|
73
|
+
|
74
|
+
FAKE_VOID_FUNC(DISPLAY_output, char *);
|
75
|
+
|
76
|
+
And the unit test might look something like this:
|
77
|
+
|
78
|
+
TEST_F(UITests, write_line_outputs_lines_to_display)
|
79
|
+
{
|
80
|
+
char msg[] = "helloworld";
|
81
|
+
UI_write_line(msg);
|
82
|
+
ASSERT_EQ(DISPLAY_output_fake.call_count, 1);
|
83
|
+
ASSERT_EQ(strncmp(DISPLAY_output_fake.arg0_val, msg, 26), 0);
|
84
|
+
}
|
85
|
+
|
86
|
+
|
87
|
+
There is no more magic here, the <tt>FAKE_VOID_FUNC</tt> works as in the
|
88
|
+
previous example. The number of arguments that the function takes is calculated,
|
89
|
+
and the macro arguments following the function name defines the argument
|
90
|
+
type (a char pointer in this example).
|
91
|
+
|
92
|
+
A variable is created for every argument in the form
|
93
|
+
<tt>"function_name"fake.argN_val</tt>
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
## Return values
|
98
|
+
|
99
|
+
When you want to define a fake function that returns a value, you should use the
|
100
|
+
<tt>FAKE_VALUE_FUNC</tt> macro. For instance:
|
101
|
+
|
102
|
+
// UI.c
|
103
|
+
...
|
104
|
+
unsigned int DISPLAY_get_line_capacity();
|
105
|
+
unsigned int DISPLAY_get_line_insert_index();
|
106
|
+
...
|
107
|
+
|
108
|
+
Here's how you would define fake functions for these in your test suite:
|
109
|
+
|
110
|
+
FAKE_VALUE_FUNC(unsigned int, DISPLAY_get_line_capacity);
|
111
|
+
FAKE_VALUE_FUNC(unsigned int, DISPLAY_get_line_insert_index);
|
112
|
+
|
113
|
+
And the unit test might look something like this:
|
114
|
+
|
115
|
+
TEST_F(UITests, when_empty_lines_write_line_doesnt_clear_screen)
|
116
|
+
{
|
117
|
+
// given
|
118
|
+
DISPLAY_get_line_insert_index_fake.return_val = 1;
|
119
|
+
char msg[] = "helloworld";
|
120
|
+
// when
|
121
|
+
UI_write_line(msg);
|
122
|
+
// then
|
123
|
+
ASSERT_EQ(DISPLAY_clear_fake.call_count, 0);
|
124
|
+
}
|
125
|
+
|
126
|
+
Of course you can mix and match these macros to define a value function with
|
127
|
+
arguments, for instance to fake:
|
128
|
+
|
129
|
+
double pow(double base, double exponent);
|
130
|
+
|
131
|
+
you would use a syntax like this:
|
132
|
+
|
133
|
+
FAKE_VALUE_FUNC(double, pow, double, double);
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
## Resetting a fake
|
138
|
+
|
139
|
+
Good tests are isolated tests, so it is important to reset the fakes for each
|
140
|
+
unit test. All the fakes have a reset function to reset their arguments and
|
141
|
+
call counts. It is good prectice is to call the reset function for all the
|
142
|
+
fakes in the setup function of your test suite.
|
143
|
+
|
144
|
+
void setup()
|
145
|
+
{
|
146
|
+
// Register resets
|
147
|
+
RESET_FAKE(DISPLAY_init);
|
148
|
+
RESET_FAKE(DISPLAY_clear);
|
149
|
+
RESET_FAKE(DISPLAY_output_message);
|
150
|
+
RESET_FAKE(DISPLAY_get_line_capacity);
|
151
|
+
RESET_FAKE(DISPLAY_get_line_insert_index);
|
152
|
+
}
|
153
|
+
|
154
|
+
You might want to define a macro to do this:
|
155
|
+
|
156
|
+
```
|
157
|
+
/* List of fakes used by this unit tester */
|
158
|
+
#define FFF_FAKES_LIST(FAKE) \
|
159
|
+
FAKE(DISPLAY_init) \
|
160
|
+
FAKE(DISPLAY_clear) \
|
161
|
+
FAKE(DISPLAY_output_message) \
|
162
|
+
FAKE(DISPLAY_get_line_capacity) \
|
163
|
+
FAKE(DISPLAY_get_line_insert_index)
|
164
|
+
|
165
|
+
void setup()
|
166
|
+
{
|
167
|
+
/* Register resets */
|
168
|
+
FFF_FAKES_LIST(RESET_FAKE);
|
169
|
+
|
170
|
+
/* reset common FFF internal structures */
|
171
|
+
FFF_RESET_HISTORY();
|
172
|
+
}
|
173
|
+
```
|
174
|
+
|
175
|
+
## Call history
|
176
|
+
Say you want to test that a function calls functionA, then functionB, then
|
177
|
+
functionA again, how would you do that? Well <tt>fff</tt> maintains a call
|
178
|
+
history so that it is easy to assert these expectations.
|
179
|
+
|
180
|
+
Here's how it works:
|
181
|
+
|
182
|
+
FAKE_VOID_FUNC(voidfunc2, char, char);
|
183
|
+
FAKE_VALUE_FUNC(long, longfunc0);
|
184
|
+
|
185
|
+
TEST_F(FFFTestSuite, calls_in_correct_order)
|
186
|
+
{
|
187
|
+
longfunc0();
|
188
|
+
voidfunc2();
|
189
|
+
longfunc0();
|
190
|
+
|
191
|
+
ASSERT_EQ(fff.call_history[0], (void *)longfunc0);
|
192
|
+
ASSERT_EQ(fff.call_history[1], (void *)voidfunc2);
|
193
|
+
ASSERT_EQ(fff.call_history[2], (void *)longfunc0);
|
194
|
+
}
|
195
|
+
|
196
|
+
They are reset by calling <tt>FFF_RESET_HISTORY();</tt>
|
197
|
+
|
198
|
+
|
199
|
+
## Default Argument History
|
200
|
+
|
201
|
+
The framework will by default store the arguments for the last ten calls made
|
202
|
+
to a fake function.
|
203
|
+
|
204
|
+
TEST_F(FFFTestSuite, when_fake_func_called_then_arguments_captured_in_history)
|
205
|
+
{
|
206
|
+
voidfunc2('g', 'h');
|
207
|
+
voidfunc2('i', 'j');
|
208
|
+
ASSERT_EQ('g', voidfunc2_fake.arg0_history[0]);
|
209
|
+
ASSERT_EQ('h', voidfunc2_fake.arg1_history[0]);
|
210
|
+
ASSERT_EQ('i', voidfunc2_fake.arg0_history[1]);
|
211
|
+
ASSERT_EQ('j', voidfunc2_fake.arg1_history[1]);
|
212
|
+
}
|
213
|
+
|
214
|
+
There are two ways to find out if calls have been dropped. The first is to
|
215
|
+
check the dropped histories counter:
|
216
|
+
|
217
|
+
TEST_F(FFFTestSuite, when_fake_func_called_max_times_plus_one_then_one_argument_history_dropped)
|
218
|
+
{
|
219
|
+
int i;
|
220
|
+
for(i = 0; i < 10; i++)
|
221
|
+
{
|
222
|
+
voidfunc2('1'+i, '2'+i);
|
223
|
+
}
|
224
|
+
voidfunc2('1', '2');
|
225
|
+
ASSERT_EQ(1u, voidfunc2_fake.arg_histories_dropped);
|
226
|
+
}
|
227
|
+
|
228
|
+
The other is to check if the call count is greater than the history size:
|
229
|
+
|
230
|
+
ASSERT(voidfunc2_fake.arg_history_len < voidfunc2_fake.call_count);
|
231
|
+
|
232
|
+
The argument histories for a fake function are reset when the RESET_FAKE
|
233
|
+
function is called
|
234
|
+
|
235
|
+
## User Defined Argument History
|
236
|
+
|
237
|
+
If you wish to control how many calls to capture for argument history you can
|
238
|
+
override the default by defining it before include the <tt>fff.h</tt> like this:
|
239
|
+
|
240
|
+
// Want to keep the argument history for 13 calls
|
241
|
+
#define FFF_ARG_HISTORY_LEN 13
|
242
|
+
// Want to keep the call sequence history for 17 function calls
|
243
|
+
#define FFF_CALL_HISTORY_LEN 17
|
244
|
+
|
245
|
+
#include "../fff.h"
|
246
|
+
|
247
|
+
|
248
|
+
## Function Return Value Sequences
|
249
|
+
|
250
|
+
Often in testing we would like to test the behaviour of sequence of function call
|
251
|
+
events. One way to do this with fff is to specify a sequence of return values
|
252
|
+
with for the fake function. It is probably easier to describe with an example:
|
253
|
+
|
254
|
+
// faking "long longfunc();"
|
255
|
+
FAKE_VALUE_FUNC(long, longfunc0);
|
256
|
+
|
257
|
+
TEST_F(FFFTestSuite, return_value_sequences_exhausted)
|
258
|
+
{
|
259
|
+
long myReturnVals[3] = { 3, 7, 9 };
|
260
|
+
SET_RETURN_SEQ(longfunc0, myReturnVals, 3);
|
261
|
+
ASSERT_EQ(myReturnVals[0], longfunc0());
|
262
|
+
ASSERT_EQ(myReturnVals[1], longfunc0());
|
263
|
+
ASSERT_EQ(myReturnVals[2], longfunc0());
|
264
|
+
ASSERT_EQ(myReturnVals[2], longfunc0());
|
265
|
+
ASSERT_EQ(myReturnVals[2], longfunc0());
|
266
|
+
}
|
267
|
+
|
268
|
+
By specifying a return value sequence using the <tt>SET_RETURN_SEQ</tt> macro,
|
269
|
+
the fake will return the values given in the parameter array in sequence. When
|
270
|
+
the end of the sequence is reached the fake will continue to return the last
|
271
|
+
value in the sequence indefinitely.
|
272
|
+
|
273
|
+
## Custom Return Value Delegate
|
274
|
+
|
275
|
+
You can specify your own function to provide the return value for the fake. This
|
276
|
+
is done by setting the custom_fake member of the fake. Here's an example:
|
277
|
+
|
278
|
+
#define MEANING_OF_LIFE 42
|
279
|
+
long my_custom_value_fake(void)
|
280
|
+
{
|
281
|
+
return MEANING_OF_LIFE;
|
282
|
+
}
|
283
|
+
TEST_F(FFFTestSuite, when_value_custom_fake_called_THEN_it_returns_custom_return_value)
|
284
|
+
{
|
285
|
+
longfunc0_fake.custom_fake = my_custom_value_fake;
|
286
|
+
long retval = longfunc0();
|
287
|
+
ASSERT_EQ(MEANING_OF_LIFE, retval);
|
288
|
+
}
|
289
|
+
|
290
|
+
## How do I fake a function that returns a value by reference?
|
291
|
+
The basic mechanism that FFF provides you in this case is the custom_fake field described in the *Custom Return Value Delegate* example above.
|
292
|
+
|
293
|
+
You need to create a custom function (e.g. getTime_custom_fake) to produce the output optionally by use of a helper variable (e.g. getTime_custom_now) to retrieve that output from. Then some creativity to tie it all together. The most important part (IMHO) is to keep your test case readable and maintainable.
|
294
|
+
|
295
|
+
In case your project uses a C99 compliant C compiler you can even combine all this in a single unit test function so you can easily oversee all details of the test. See the example below.
|
296
|
+
|
297
|
+
/* The time structure */
|
298
|
+
typedef struct {
|
299
|
+
int hour, min;
|
300
|
+
} Time;
|
301
|
+
|
302
|
+
/* Our fake function */
|
303
|
+
FAKE_VOID_FUNC(getTime, Time*);
|
304
|
+
|
305
|
+
/* A test using the getTime fake function */
|
306
|
+
TEST_F(FFFTestSuite, when_value_custom_fake_called_THEN_it_returns_custom_output)
|
307
|
+
{
|
308
|
+
Time t;
|
309
|
+
Time getTime_custom_now;
|
310
|
+
void getTime_custom_fake(Time *now) {
|
311
|
+
*now = getTime_custom_now;
|
312
|
+
}
|
313
|
+
getTime_fake.custom_fake = getTime_custom_fake;
|
314
|
+
|
315
|
+
/* given a specific time */
|
316
|
+
getTime_custom_now.hour = 13;
|
317
|
+
getTime_custom_now.min = 05;
|
318
|
+
|
319
|
+
/* when getTime is called */
|
320
|
+
getTime(&t);
|
321
|
+
|
322
|
+
/* then the specific time must be produced */
|
323
|
+
ASSERT_EQ(t.hour, 13);
|
324
|
+
ASSERT_EQ(t.min, 05);
|
325
|
+
}
|
326
|
+
|
327
|
+
## How do I fake a function with a function pointer parameter?
|
328
|
+
Using FFF to stub functions that have function pointer parameter can cause problems when trying to stub them. Presented here is an example how to deal with this situation.
|
329
|
+
|
330
|
+
If you need to stub a function that has a function pointer parameter, e.g. something like:
|
331
|
+
|
332
|
+
```
|
333
|
+
/* timer.h */
|
334
|
+
typedef int timer_handle;
|
335
|
+
extern int timer_start(timer_handle handle, long delay, void (*cb_function) (int arg), int arg);
|
336
|
+
```
|
337
|
+
|
338
|
+
Then creating a fake like below will horribly fail when trying to compile because the FFF macro will internally expand into an illegal variable ```int (*)(int) arg2_val```.
|
339
|
+
|
340
|
+
```
|
341
|
+
/* The fake, attempt one */
|
342
|
+
FAKE_VALUE_FUNC(int,
|
343
|
+
timer_start,
|
344
|
+
timer_handle,
|
345
|
+
long,
|
346
|
+
void (*) (int argument),
|
347
|
+
int);
|
348
|
+
```
|
349
|
+
|
350
|
+
The solution to this problem is to create a bridging type that needs only to be visible in the unit tester. The fake will use that intermediate type. This way the compiler will not complain because the types match.
|
351
|
+
|
352
|
+
```
|
353
|
+
/* Additional type needed to be able to use callback in FFF */
|
354
|
+
typedef void (*timer_cb) (int argument);
|
355
|
+
|
356
|
+
/* The fake, attempt two */
|
357
|
+
FAKE_VALUE_FUNC(int,
|
358
|
+
timer_start,
|
359
|
+
timer_handle,
|
360
|
+
long,
|
361
|
+
timer_cb,
|
362
|
+
int);
|
363
|
+
```
|
364
|
+
|
365
|
+
Here are some ideas how to create a test case with callbacks.
|
366
|
+
|
367
|
+
```
|
368
|
+
/* Unit test */
|
369
|
+
TEST_F(FFFTestSuite, test_fake_with_function_pointer)
|
370
|
+
{
|
371
|
+
int cb_timeout_called = 0;
|
372
|
+
int result = 0;
|
373
|
+
|
374
|
+
void cb_timeout(int argument)
|
375
|
+
{
|
376
|
+
cb_timeout_called++;
|
377
|
+
}
|
378
|
+
|
379
|
+
int timer_start_custom_fake(timer_handle handle,
|
380
|
+
long delay,
|
381
|
+
void (*cb_function) (int arg),
|
382
|
+
int arg)
|
383
|
+
{
|
384
|
+
if (cb_function) cb_function(arg);
|
385
|
+
return timer_start_fake.return_val;
|
386
|
+
}
|
387
|
+
|
388
|
+
/* given the custom fake for timer_start */
|
389
|
+
timer_start_fake.return_val = 33;
|
390
|
+
timer_start_fake.custom_fake = timer_start_custom_fake;
|
391
|
+
|
392
|
+
/* when timer_start is called
|
393
|
+
* (actually you would call your own function-under-test
|
394
|
+
* that would then call the fake function)
|
395
|
+
*/
|
396
|
+
result = timer_start(10, 100, cb_timeout, 55);
|
397
|
+
|
398
|
+
/* then the timer_start fake must have been called correctly */
|
399
|
+
ASSERT_EQ(result, 33);
|
400
|
+
ASSERT_EQ(timer_start_fake.call_count, 1);
|
401
|
+
ASSERT_EQ(timer_start_fake.arg0_val, 10);
|
402
|
+
ASSERT_EQ(timer_start_fake.arg1_val, 100);
|
403
|
+
ASSERT_EQ(timer_start_fake.arg2_val, cb_timeout); /* callback provided by unit tester */
|
404
|
+
ASSERT_EQ(timer_start_fake.arg3_val, 55);
|
405
|
+
|
406
|
+
/* and ofcourse our custom fake correctly calls the registered callback */
|
407
|
+
ASSERT_EQ(cb_timeout_called, 1);
|
408
|
+
}
|
409
|
+
```
|
410
|
+
|
411
|
+
## Find out more...
|
412
|
+
|
413
|
+
Look under the examlples directory for full length examples in both C and C++.
|
414
|
+
There is also a test suite for the framework under the test directory.
|
415
|
+
|
416
|
+
-------------------------
|
417
|
+
|
418
|
+
## Benefits
|
419
|
+
So whats the point?
|
420
|
+
|
421
|
+
* To make it easy to create fake functions for testing C code.
|
422
|
+
* It is simple - just include a header file and you are good to go.
|
423
|
+
* To work in both C and C++ test environments
|
424
|
+
|
425
|
+
|
426
|
+
## Under the hood:
|
427
|
+
* The fff.h header file is generated by a ruby script
|
428
|
+
* There are tests under src/test
|
429
|
+
* There is an example for testing an embedded UI and a hardware driver under src/examples
|
430
|
+
|
431
|
+
|
432
|
+
## Cheat Sheet
|
433
|
+
<table>
|
434
|
+
<tr>
|
435
|
+
<th>Macro</th>
|
436
|
+
<th>Description</th>
|
437
|
+
<th>Example</th>
|
438
|
+
</tr>
|
439
|
+
<tr>
|
440
|
+
<td>FAKE_VOID_FUNC(fn [,arg_types*]);</td>
|
441
|
+
<td>Define a fake function named fn returning void with n arguments</td>
|
442
|
+
<td>FAKE_VOID_FUNC(DISPLAY_output_message, const char*);</td>
|
443
|
+
</tr>
|
444
|
+
<tr>
|
445
|
+
<td>FAKE_VALUE_FUNC(return_type, fn [,arg_types*]);</td>
|
446
|
+
<td>Define a fake function returning a value with type return_type taking n arguments</td>
|
447
|
+
<td>FAKE_VALUE_FUNC(int, DISPLAY_get_line_insert_index);</td>
|
448
|
+
</tr>
|
449
|
+
<tr>
|
450
|
+
<td>RESET_FAKE(fn);</td>
|
451
|
+
<td>Reset the state of fake function called fn</td>
|
452
|
+
<td>RESET_FAKE(DISPLAY_init);</td>
|
453
|
+
</tr>
|
454
|
+
</table>
|