ceedling 0.15.1 → 0.15.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +9 -13
- data/README.md +21 -3
- data/{rakefile.rb → Rakefile} +0 -0
- data/lib/ceedling/version.rb +4 -4
- data/lib/ceedling/version.rb.erb +1 -1
- data/release/version.info +1 -1
- data/vendor/c_exception/Gemfile +1 -1
- data/vendor/c_exception/Gemfile.lock +12 -0
- data/vendor/c_exception/{docs/license.txt → LICENSE.txt} +9 -9
- data/vendor/c_exception/README.md +146 -0
- data/vendor/c_exception/{rakefile.rb → Rakefile} +6 -5
- data/vendor/c_exception/lib/CException.c +9 -6
- data/vendor/c_exception/release/build.info +1 -1
- data/vendor/c_exception/release/version.info +1 -1
- data/vendor/c_exception/test/CExceptionConfig.h +2 -0
- data/vendor/c_exception/test/TestException.c +4 -1
- data/vendor/cmock/README.md +24 -0
- data/vendor/cmock/{rakefile.rb → Rakefile} +12 -12
- data/vendor/cmock/docs/CMock Summary.odt +0 -0
- data/vendor/cmock/docs/CMock Summary.pdf +0 -0
- data/vendor/cmock/docs/CMock_Summary.md +130 -111
- data/vendor/cmock/docs/license.txt +1 -1
- data/vendor/cmock/lib/cmock.rb +36 -12
- data/vendor/cmock/lib/cmock_config.rb +39 -36
- data/vendor/cmock/lib/cmock_generator.rb +33 -25
- data/vendor/cmock/lib/cmock_generator_plugin_expect_any_args.rb +68 -0
- data/vendor/cmock/lib/cmock_generator_plugin_ignore.rb +18 -42
- data/vendor/cmock/lib/cmock_generator_plugin_return_thru_ptr.rb +2 -2
- data/vendor/cmock/lib/cmock_generator_utils.rb +39 -29
- data/vendor/cmock/lib/cmock_header_parser.rb +46 -39
- data/vendor/cmock/rakefile_helper.rb +38 -38
- data/vendor/cmock/src/cmock.c +20 -4
- data/vendor/cmock/src/cmock.h +6 -1
- data/vendor/cmock/src/cmock_internals.h +26 -3
- data/vendor/cmock/targets/clang_strict.yml +85 -0
- data/vendor/cmock/targets/gcc.yml +4 -2
- data/vendor/cmock/targets/gcc_64.yml +55 -0
- data/vendor/cmock/test/c/TestCMockC.c +3 -3
- data/vendor/cmock/test/c/TestCMockCDynamic.c +11 -11
- data/vendor/cmock/test/c/TestCMockCDynamic_Runner.c +4 -2
- data/vendor/cmock/test/c/TestCMockC_Runner.c +1 -1
- data/vendor/cmock/test/system/systest_generator.rb +38 -26
- data/vendor/cmock/test/system/test_compilation/const.h +8 -3
- data/vendor/cmock/test/system/test_interactions/all_plugins_but_other_limits.yml +92 -58
- data/vendor/cmock/test/system/test_interactions/all_plugins_coexist.yml +53 -48
- data/vendor/cmock/test/system/test_interactions/array_and_pointer_handling.yml +58 -56
- data/vendor/cmock/test/system/test_interactions/basic_expect_and_return.yml +19 -18
- data/vendor/cmock/test/system/test_interactions/expect_and_return_custom_types.yml +13 -13
- data/vendor/cmock/test/system/test_interactions/expect_and_return_treat_as.yml +20 -20
- data/vendor/cmock/test/system/test_interactions/expect_any_args.yml +238 -0
- data/vendor/cmock/test/system/test_interactions/fancy_pointer_handling.yml +36 -34
- data/vendor/cmock/test/system/test_interactions/ignore_and_return.yml +24 -15
- data/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_2.yml +11 -11
- data/vendor/cmock/test/system/test_interactions/return_thru_ptr_and_expect_any_args.yml +235 -0
- data/vendor/cmock/test/system/test_interactions/return_thru_ptr_ignore_arg.yml +22 -26
- data/vendor/cmock/test/system/test_interactions/stubs_with_callbacks.yml +31 -31
- data/vendor/cmock/test/unit/cmock_generator_main_test.rb +141 -109
- data/vendor/cmock/test/unit/cmock_generator_plugin_expect_any_args_test.rb +82 -0
- data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_test.rb +17 -81
- data/vendor/cmock/test/unit/cmock_generator_plugin_return_thru_ptr_test.rb +10 -10
- data/vendor/cmock/test/unit/cmock_generator_utils_test.rb +47 -41
- data/vendor/cmock/test/unit/cmock_header_parser_test.rb +290 -227
- data/vendor/unity/{rakefile.rb → Rakefile} +13 -6
- data/vendor/unity/auto/colour_prompt.rb +33 -12
- data/vendor/unity/auto/generate_test_runner.rb +67 -63
- data/vendor/unity/auto/parseOutput.rb +189 -0
- data/vendor/{cmock/vendor/unity/examples → unity/examples/example_1}/makefile +41 -40
- data/vendor/unity/examples/example_1/readme.txt +5 -0
- data/vendor/{cmock/vendor/unity/examples → unity/examples/example_1}/src/ProductionCode.c +24 -24
- data/vendor/{c_exception/vendor/unity/examples → unity/examples/example_1}/src/ProductionCode.h +3 -3
- data/vendor/{cmock/vendor/unity/examples → unity/examples/example_1}/src/ProductionCode2.c +9 -9
- data/vendor/{c_exception/vendor/unity/examples → unity/examples/example_1}/src/ProductionCode2.h +2 -2
- data/vendor/{cmock/vendor/unity/examples → unity/examples/example_1}/test/TestProductionCode.c +62 -62
- data/vendor/unity/examples/{test → example_1/test}/TestProductionCode2.c +31 -31
- data/vendor/unity/examples/{test/no_ruby → example_1/test/test_runners}/TestProductionCode2_Runner.c +46 -46
- data/vendor/unity/examples/{test/no_ruby → example_1/test/test_runners}/TestProductionCode_Runner.c +50 -50
- data/vendor/unity/examples/example_2/makefile +45 -0
- data/vendor/unity/examples/example_2/readme.txt +5 -0
- data/vendor/unity/examples/{src → example_2/src}/ProductionCode.c +24 -24
- data/vendor/unity/examples/{src → example_2/src}/ProductionCode.h +3 -3
- data/vendor/unity/examples/{src → example_2/src}/ProductionCode2.c +9 -9
- data/vendor/unity/examples/{src → example_2/src}/ProductionCode2.h +2 -2
- data/vendor/unity/examples/{test → example_2/test}/TestProductionCode.c +64 -62
- data/vendor/{cmock/vendor/unity/examples → unity/examples/example_2}/test/TestProductionCode2.c +33 -31
- data/vendor/unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c +9 -0
- data/vendor/unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c +11 -0
- data/vendor/unity/examples/example_2/test/test_runners/all_tests.c +12 -0
- data/vendor/unity/examples/{helper → example_3/helper}/UnityHelper.c +10 -10
- data/vendor/{cmock/vendor/unity/examples → unity/examples/example_3}/helper/UnityHelper.h +12 -12
- data/vendor/unity/examples/{makefile → example_3/makefile} +41 -40
- data/vendor/unity/examples/{rakefile.rb → example_3/rakefile.rb} +44 -43
- data/vendor/{cmock/vendor/unity/examples → unity/examples/example_3}/rakefile_helper.rb +256 -256
- data/vendor/{c_exception/vendor/unity/examples → unity/examples/example_3}/readme.txt +18 -17
- data/vendor/{c_exception/vendor/unity/examples → unity/examples/example_3}/src/ProductionCode.c +24 -24
- data/vendor/{cmock/vendor/unity/examples → unity/examples/example_3}/src/ProductionCode.h +3 -3
- data/vendor/{c_exception/vendor/unity/examples → unity/examples/example_3}/src/ProductionCode2.c +9 -9
- data/vendor/{cmock/vendor/unity/examples → unity/examples/example_3}/src/ProductionCode2.h +2 -2
- data/vendor/{c_exception/vendor/unity/targets/gcc_64.yml → unity/examples/example_3/target_gcc_32.yml} +46 -44
- data/vendor/{c_exception/vendor/unity/examples → unity/examples/example_3}/test/TestProductionCode.c +62 -62
- data/vendor/{c_exception/vendor/unity/examples → unity/examples/example_3}/test/TestProductionCode2.c +31 -31
- data/vendor/{c_exception/vendor/unity/examples → unity/examples/example_3}/test/no_ruby/TestProductionCode2_Runner.c +46 -46
- data/vendor/{cmock/vendor/unity/examples → unity/examples/example_3}/test/no_ruby/TestProductionCode_Runner.c +50 -50
- data/vendor/unity/extras/eclipse/error_parsers.txt +26 -0
- data/vendor/unity/extras/fixture/src/unity_fixture.c +4 -1
- data/vendor/unity/extras/fixture/src/unity_fixture.h +17 -16
- data/vendor/unity/extras/fixture/src/unity_fixture_internals.h +7 -7
- data/vendor/unity/extras/fixture/test/unity_fixture_Test.c +17 -0
- data/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +1 -0
- data/vendor/unity/makefile +6 -4
- data/vendor/unity/rakefile_helper.rb +36 -27
- data/vendor/unity/src/unity.c +180 -181
- data/vendor/unity/src/unity.h +64 -2
- data/vendor/unity/src/unity_internals.h +188 -102
- data/vendor/unity/targets/clang_strict.yml +83 -0
- data/vendor/unity/targets/gcc_32.yml +5 -0
- data/vendor/unity/targets/gcc_64.yml +5 -0
- data/vendor/{c_exception/vendor/unity/targets/gcc.yml → unity/targets/gcc_auto_limits.yml} +5 -2
- data/vendor/{cmock/vendor/unity/targets/gcc_64.yml → unity/targets/gcc_auto_sizeof.yml} +6 -3
- data/vendor/{cmock/vendor/unity/targets/gcc.yml → unity/targets/gcc_auto_stdint.yml} +4 -2
- data/vendor/unity/test/expectdata/testsample_cmd.c +57 -54
- data/vendor/unity/test/expectdata/testsample_def.c +53 -50
- data/vendor/unity/test/expectdata/testsample_mock_cmd.c +79 -76
- data/vendor/unity/test/expectdata/testsample_mock_def.c +75 -72
- data/vendor/unity/test/expectdata/testsample_mock_new1.c +88 -85
- data/vendor/unity/test/expectdata/testsample_mock_new2.c +88 -85
- data/vendor/unity/test/expectdata/testsample_mock_param.c +76 -73
- data/vendor/unity/test/expectdata/testsample_mock_run1.c +88 -85
- data/vendor/unity/test/expectdata/testsample_mock_run2.c +88 -85
- data/vendor/unity/test/expectdata/testsample_mock_yaml.c +89 -86
- data/vendor/unity/test/expectdata/testsample_new1.c +63 -60
- data/vendor/unity/test/expectdata/testsample_new2.c +66 -63
- data/vendor/unity/test/expectdata/testsample_param.c +54 -51
- data/vendor/unity/test/expectdata/testsample_run1.c +63 -60
- data/vendor/unity/test/expectdata/testsample_run2.c +66 -63
- data/vendor/unity/test/expectdata/testsample_yaml.c +67 -64
- data/vendor/unity/test/test_generate_test_runner.rb +66 -72
- data/vendor/unity/test/testunity.c +591 -111
- metadata +58 -195
- data/vendor/c_exception/vendor/unity/auto/colour_prompt.rb +0 -94
- data/vendor/c_exception/vendor/unity/auto/colour_reporter.rb +0 -39
- data/vendor/c_exception/vendor/unity/auto/generate_config.yml +0 -36
- data/vendor/c_exception/vendor/unity/auto/generate_module.rb +0 -202
- data/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +0 -313
- data/vendor/c_exception/vendor/unity/auto/test_file_filter.rb +0 -23
- data/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb +0 -139
- 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 -217
- data/vendor/c_exception/vendor/unity/docs/license.txt +0 -31
- data/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.c +0 -10
- data/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.h +0 -12
- data/vendor/c_exception/vendor/unity/examples/makefile +0 -40
- data/vendor/c_exception/vendor/unity/examples/rakefile.rb +0 -32
- data/vendor/c_exception/vendor/unity/examples/rakefile_helper.rb +0 -256
- data/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c +0 -50
- data/vendor/c_exception/vendor/unity/extras/fixture/build/MakefileWorker.mk +0 -331
- data/vendor/c_exception/vendor/unity/extras/fixture/build/filterGcov.sh +0 -61
- data/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb +0 -37
- data/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb +0 -178
- data/vendor/c_exception/vendor/unity/extras/fixture/readme.txt +0 -9
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +0 -381
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h +0 -81
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +0 -44
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +0 -16
- data/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c +0 -21
- data/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c +0 -39
- data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +0 -321
- data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +0 -40
- data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c +0 -56
- data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h +0 -17
- data/vendor/c_exception/vendor/unity/makefile +0 -35
- data/vendor/c_exception/vendor/unity/rakefile.rb +0 -59
- data/vendor/c_exception/vendor/unity/rakefile_helper.rb +0 -240
- data/vendor/c_exception/vendor/unity/release/build.info +0 -2
- data/vendor/c_exception/vendor/unity/release/version.info +0 -2
- data/vendor/c_exception/vendor/unity/src/unity.c +0 -979
- data/vendor/c_exception/vendor/unity/src/unity.h +0 -232
- data/vendor/c_exception/vendor/unity/src/unity_internals.h +0 -424
- data/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml +0 -101
- data/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml +0 -89
- data/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml +0 -79
- data/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml +0 -79
- data/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml +0 -93
- data/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml +0 -83
- data/vendor/c_exception/vendor/unity/targets/iar_msp430.yml +0 -94
- data/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml +0 -85
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c +0 -54
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c +0 -50
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c +0 -76
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c +0 -72
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c +0 -85
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c +0 -85
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c +0 -73
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c +0 -85
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c +0 -85
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c +0 -86
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c +0 -60
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c +0 -63
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c +0 -51
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c +0 -60
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c +0 -63
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c +0 -64
- data/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb +0 -94
- 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 -51
- data/vendor/c_exception/vendor/unity/test/testparameterized.c +0 -101
- data/vendor/c_exception/vendor/unity/test/testunity.c +0 -2024
- data/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.odt +0 -0
- data/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.pdf +0 -0
- data/vendor/cmock/vendor/c_exception/docs/license.txt +0 -30
- data/vendor/cmock/vendor/c_exception/docs/readme.txt +0 -236
- data/vendor/cmock/vendor/c_exception/lib/CException.c +0 -39
- data/vendor/cmock/vendor/c_exception/lib/CException.h +0 -70
- data/vendor/cmock/vendor/c_exception/makefile +0 -24
- data/vendor/cmock/vendor/c_exception/rakefile.rb +0 -41
- data/vendor/cmock/vendor/c_exception/release/build.info +0 -2
- data/vendor/cmock/vendor/c_exception/release/version.info +0 -2
- data/vendor/cmock/vendor/c_exception/test/CExceptionConfig.h +0 -27
- data/vendor/cmock/vendor/c_exception/test/TestException.c +0 -291
- data/vendor/cmock/vendor/c_exception/test/TestException_Runner.c +0 -62
- data/vendor/cmock/vendor/unity/auto/colour_prompt.rb +0 -94
- data/vendor/cmock/vendor/unity/auto/colour_reporter.rb +0 -39
- data/vendor/cmock/vendor/unity/auto/generate_config.yml +0 -36
- data/vendor/cmock/vendor/unity/auto/generate_module.rb +0 -202
- data/vendor/cmock/vendor/unity/auto/generate_test_runner.rb +0 -313
- data/vendor/cmock/vendor/unity/auto/test_file_filter.rb +0 -23
- data/vendor/cmock/vendor/unity/auto/unity_test_summary.rb +0 -139
- 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 -217
- data/vendor/cmock/vendor/unity/docs/license.txt +0 -31
- data/vendor/cmock/vendor/unity/examples/helper/UnityHelper.c +0 -10
- data/vendor/cmock/vendor/unity/examples/rakefile.rb +0 -32
- data/vendor/cmock/vendor/unity/examples/readme.txt +0 -18
- data/vendor/cmock/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c +0 -46
- data/vendor/cmock/vendor/unity/extras/fixture/build/MakefileWorker.mk +0 -331
- data/vendor/cmock/vendor/unity/extras/fixture/build/filterGcov.sh +0 -61
- data/vendor/cmock/vendor/unity/extras/fixture/rakefile.rb +0 -37
- data/vendor/cmock/vendor/unity/extras/fixture/rakefile_helper.rb +0 -178
- data/vendor/cmock/vendor/unity/extras/fixture/readme.txt +0 -9
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c +0 -381
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h +0 -81
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h +0 -44
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +0 -16
- data/vendor/cmock/vendor/unity/extras/fixture/test/main/AllTests.c +0 -21
- data/vendor/cmock/vendor/unity/extras/fixture/test/testunity_fixture.c +0 -39
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c +0 -321
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +0 -40
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.c +0 -56
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.h +0 -17
- data/vendor/cmock/vendor/unity/makefile +0 -35
- data/vendor/cmock/vendor/unity/rakefile.rb +0 -48
- data/vendor/cmock/vendor/unity/rakefile_helper.rb +0 -240
- data/vendor/cmock/vendor/unity/release/build.info +0 -2
- data/vendor/cmock/vendor/unity/release/version.info +0 -2
- data/vendor/cmock/vendor/unity/src/unity.c +0 -979
- data/vendor/cmock/vendor/unity/src/unity.h +0 -232
- data/vendor/cmock/vendor/unity/src/unity_internals.h +0 -424
- data/vendor/cmock/vendor/unity/targets/hitech_picc18.yml +0 -101
- data/vendor/cmock/vendor/unity/targets/iar_arm_v4.yml +0 -89
- data/vendor/cmock/vendor/unity/targets/iar_arm_v5.yml +0 -79
- data/vendor/cmock/vendor/unity/targets/iar_arm_v5_3.yml +0 -79
- data/vendor/cmock/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml +0 -93
- data/vendor/cmock/vendor/unity/targets/iar_cortexm3_v5.yml +0 -83
- data/vendor/cmock/vendor/unity/targets/iar_msp430.yml +0 -94
- data/vendor/cmock/vendor/unity/targets/iar_sh2a_v6.yml +0 -85
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_cmd.c +0 -54
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_def.c +0 -50
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_cmd.c +0 -76
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_def.c +0 -72
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new1.c +0 -85
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new2.c +0 -85
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_param.c +0 -73
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run1.c +0 -85
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run2.c +0 -85
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_yaml.c +0 -86
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_new1.c +0 -60
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_new2.c +0 -63
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_param.c +0 -51
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_run1.c +0 -60
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_run2.c +0 -63
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_yaml.c +0 -64
- data/vendor/cmock/vendor/unity/test/test_generate_test_runner.rb +0 -94
- 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 -51
- data/vendor/cmock/vendor/unity/test/testparameterized.c +0 -101
- data/vendor/cmock/vendor/unity/test/testunity.c +0 -2024
- data/vendor/unity/Gemfile +0 -4
- data/vendor/unity/examples/helper/UnityHelper.h +0 -12
- data/vendor/unity/examples/rakefile_helper.rb +0 -256
- data/vendor/unity/examples/readme.txt +0 -18
data/vendor/cmock/lib/cmock.rb
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# CMock Project - Automatic Mock Generation for C
|
|
3
3
|
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
|
|
4
4
|
# [Released under MIT License. Please refer to license.txt for details]
|
|
5
|
-
# ==========================================
|
|
5
|
+
# ==========================================
|
|
6
6
|
|
|
7
7
|
[ "../config/production_environment",
|
|
8
8
|
"cmock_header_parser",
|
|
@@ -13,10 +13,13 @@
|
|
|
13
13
|
"cmock_generator_utils",
|
|
14
14
|
"cmock_unityhelper_parser"].each {|req| require "#{File.expand_path(File.dirname(__FILE__))}/#{req}"}
|
|
15
15
|
|
|
16
|
+
|
|
17
|
+
$QUICK_RUBY_VERSION = RUBY_VERSION.split('.').inject(0){|vv,v| vv * 100 + v.to_i }
|
|
18
|
+
|
|
16
19
|
class CMock
|
|
17
|
-
|
|
20
|
+
|
|
18
21
|
def initialize(options=nil)
|
|
19
|
-
cm_config = CMockConfig.new(options)
|
|
22
|
+
cm_config = CMockConfig.new(options)
|
|
20
23
|
cm_unityhelper = CMockUnityHelperParser.new(cm_config)
|
|
21
24
|
cm_writer = CMockFileWriter.new(cm_config)
|
|
22
25
|
cm_gen_utils = CMockGeneratorUtils.new(cm_config, {:unity_helper => cm_unityhelper})
|
|
@@ -25,7 +28,7 @@ class CMock
|
|
|
25
28
|
@cm_generator = CMockGenerator.new(cm_config, cm_writer, cm_gen_utils, cm_gen_plugins)
|
|
26
29
|
@silent = (cm_config.verbosity < 2)
|
|
27
30
|
end
|
|
28
|
-
|
|
31
|
+
|
|
29
32
|
def setup_mocks(files)
|
|
30
33
|
[files].flatten.each do |src|
|
|
31
34
|
generate_mock src
|
|
@@ -41,25 +44,46 @@ class CMock
|
|
|
41
44
|
end
|
|
42
45
|
end
|
|
43
46
|
|
|
47
|
+
def option_maker(options, key, val)
|
|
48
|
+
options = options || {}
|
|
49
|
+
options[key.to_sym] =
|
|
50
|
+
if val.chr == ":"
|
|
51
|
+
val[1..-1].to_sym
|
|
52
|
+
elsif val.include? ";"
|
|
53
|
+
val.split(';')
|
|
54
|
+
elsif val == 'true'
|
|
55
|
+
true
|
|
56
|
+
elsif val == 'false'
|
|
57
|
+
false
|
|
58
|
+
elsif val =~ /^\d+$/
|
|
59
|
+
val.to_i
|
|
60
|
+
else
|
|
61
|
+
val
|
|
62
|
+
end
|
|
63
|
+
options
|
|
64
|
+
end
|
|
65
|
+
|
|
44
66
|
# Command Line Support ###############################
|
|
45
|
-
|
|
67
|
+
|
|
46
68
|
if ($0 == __FILE__)
|
|
47
69
|
usage = "usage: ruby #{__FILE__} (-oOptionsFile) File(s)ToMock"
|
|
48
|
-
|
|
70
|
+
|
|
49
71
|
if (!ARGV[0])
|
|
50
72
|
puts usage
|
|
51
73
|
exit 1
|
|
52
74
|
end
|
|
53
|
-
|
|
54
|
-
options =
|
|
75
|
+
|
|
76
|
+
options = {}
|
|
55
77
|
filelist = []
|
|
56
78
|
ARGV.each do |arg|
|
|
57
|
-
if (arg =~ /^-o(\
|
|
58
|
-
options
|
|
79
|
+
if (arg =~ /^-o\"?([a-zA-Z0-9._\\\/:\s]+)\"?/)
|
|
80
|
+
options.merge! CMockConfig.load_config_file_from_yaml( arg.gsub(/^-o/,'') )
|
|
81
|
+
elsif (arg =~ /^--([a-zA-Z0-9._\\\/:\s]+)=\"?([a-zA-Z0-9._\\\/:\s\;]+)\"?/)
|
|
82
|
+
options = option_maker(options, $1, $2)
|
|
59
83
|
else
|
|
60
84
|
filelist << arg
|
|
61
85
|
end
|
|
62
86
|
end
|
|
63
|
-
|
|
87
|
+
|
|
64
88
|
CMock.new(options).setup_mocks(filelist)
|
|
65
|
-
end
|
|
89
|
+
end
|
|
@@ -2,46 +2,45 @@
|
|
|
2
2
|
# CMock Project - Automatic Mock Generation for C
|
|
3
3
|
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
|
|
4
4
|
# [Released under MIT License. Please refer to license.txt for details]
|
|
5
|
-
# ==========================================
|
|
5
|
+
# ==========================================
|
|
6
6
|
|
|
7
7
|
class CMockConfig
|
|
8
|
-
|
|
9
|
-
CMockDefaultOptions =
|
|
8
|
+
|
|
9
|
+
CMockDefaultOptions =
|
|
10
10
|
{
|
|
11
|
-
:framework
|
|
12
|
-
:mock_path
|
|
13
|
-
:mock_prefix
|
|
14
|
-
:plugins
|
|
15
|
-
:strippables
|
|
16
|
-
:attributes
|
|
17
|
-
:c_calling_conventions
|
|
18
|
-
:enforce_strict_ordering
|
|
19
|
-
:unity_helper_path
|
|
20
|
-
:treat_as
|
|
21
|
-
:treat_as_void
|
|
22
|
-
:memcmp_if_unknown
|
|
23
|
-
:when_no_prototypes
|
|
24
|
-
:when_ptr
|
|
25
|
-
:verbosity
|
|
26
|
-
:treat_externs
|
|
27
|
-
:
|
|
28
|
-
:
|
|
29
|
-
:
|
|
30
|
-
:
|
|
31
|
-
:
|
|
32
|
-
:
|
|
33
|
-
:
|
|
34
|
-
:includes_c_post_header => nil
|
|
11
|
+
:framework => :unity,
|
|
12
|
+
:mock_path => 'mocks',
|
|
13
|
+
:mock_prefix => 'Mock',
|
|
14
|
+
:plugins => [],
|
|
15
|
+
:strippables => ['(?:__attribute__\s*\(+.*?\)+)'],
|
|
16
|
+
:attributes => ['__ramfunc', '__irq', '__fiq', 'register', 'extern'],
|
|
17
|
+
:c_calling_conventions => ['__stdcall', '__cdecl', '__fastcall'],
|
|
18
|
+
:enforce_strict_ordering => false,
|
|
19
|
+
:unity_helper_path => false,
|
|
20
|
+
:treat_as => {},
|
|
21
|
+
:treat_as_void => [],
|
|
22
|
+
:memcmp_if_unknown => true,
|
|
23
|
+
:when_no_prototypes => :warn, #the options being :ignore, :warn, or :error
|
|
24
|
+
:when_ptr => :compare_data, #the options being :compare_ptr, :compare_data, or :smart
|
|
25
|
+
:verbosity => 2, #the options being 0 errors only, 1 warnings and errors, 2 normal info, 3 verbose
|
|
26
|
+
:treat_externs => :exclude, #the options being :include or :exclude
|
|
27
|
+
:callback_include_count => true,
|
|
28
|
+
:callback_after_arg_check => false,
|
|
29
|
+
:includes => nil,
|
|
30
|
+
:includes_h_pre_orig_header => nil,
|
|
31
|
+
:includes_h_post_orig_header => nil,
|
|
32
|
+
:includes_c_pre_header => nil,
|
|
33
|
+
:includes_c_post_header => nil,
|
|
35
34
|
}
|
|
36
|
-
|
|
35
|
+
|
|
37
36
|
def initialize(options=nil)
|
|
38
37
|
case(options)
|
|
39
|
-
when NilClass then options = CMockDefaultOptions.clone
|
|
38
|
+
when NilClass then options = CMockDefaultOptions.clone
|
|
40
39
|
when String then options = CMockDefaultOptions.clone.merge(load_config_file_from_yaml(options))
|
|
41
40
|
when Hash then options = CMockDefaultOptions.clone.merge(options)
|
|
42
41
|
else raise "If you specify arguments, it should be a filename or a hash of options"
|
|
43
42
|
end
|
|
44
|
-
|
|
43
|
+
|
|
45
44
|
#do some quick type verification
|
|
46
45
|
[:plugins, :attributes, :treat_as_void].each do |opt|
|
|
47
46
|
unless (options[opt].class == Array)
|
|
@@ -59,30 +58,34 @@ class CMockConfig
|
|
|
59
58
|
options[:plugins].compact!
|
|
60
59
|
options[:plugins].map! {|p| p.to_sym}
|
|
61
60
|
@options = options
|
|
62
|
-
|
|
61
|
+
|
|
63
62
|
treat_as_map = standard_treat_as_map()#.clone
|
|
64
63
|
treat_as_map.merge!(@options[:treat_as])
|
|
65
64
|
@options[:treat_as] = treat_as_map
|
|
66
|
-
|
|
65
|
+
|
|
67
66
|
@options.each_key { |key| eval("def #{key.to_s}() return @options[:#{key.to_s}] end") }
|
|
68
67
|
end
|
|
69
|
-
|
|
68
|
+
|
|
70
69
|
def load_config_file_from_yaml yaml_filename
|
|
70
|
+
self.class.load_config_file_from_yaml yaml_filename
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
def self.load_config_file_from_yaml yaml_filename
|
|
71
74
|
require 'yaml'
|
|
72
75
|
require 'fileutils'
|
|
73
76
|
YAML.load_file(yaml_filename)[:cmock]
|
|
74
77
|
end
|
|
75
|
-
|
|
78
|
+
|
|
76
79
|
def set_path(path)
|
|
77
80
|
@src_path = path
|
|
78
81
|
end
|
|
79
|
-
|
|
82
|
+
|
|
80
83
|
def load_unity_helper
|
|
81
84
|
return File.new(@options[:unity_helper_path]).read if (@options[:unity_helper_path])
|
|
82
85
|
return nil
|
|
83
86
|
end
|
|
84
87
|
|
|
85
|
-
def standard_treat_as_map
|
|
88
|
+
def standard_treat_as_map
|
|
86
89
|
{
|
|
87
90
|
'int' => 'INT',
|
|
88
91
|
'char' => 'INT8',
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
# CMock Project - Automatic Mock Generation for C
|
|
3
3
|
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
|
|
4
4
|
# [Released under MIT License. Please refer to license.txt for details]
|
|
5
|
-
# ==========================================
|
|
5
|
+
# ==========================================
|
|
6
6
|
|
|
7
7
|
$here = File.dirname __FILE__
|
|
8
8
|
|
|
9
9
|
class CMockGenerator
|
|
10
10
|
|
|
11
11
|
attr_accessor :config, :file_writer, :module_name, :clean_mock_name, :mock_name, :utils, :plugins, :ordered
|
|
12
|
-
|
|
12
|
+
|
|
13
13
|
def initialize(config, file_writer, utils, plugins)
|
|
14
14
|
@file_writer = file_writer
|
|
15
15
|
@utils = utils
|
|
@@ -18,7 +18,7 @@ class CMockGenerator
|
|
|
18
18
|
@prefix = @config.mock_prefix
|
|
19
19
|
@ordered = @config.enforce_strict_ordering
|
|
20
20
|
@framework = @config.framework.to_s
|
|
21
|
-
|
|
21
|
+
|
|
22
22
|
@includes_h_pre_orig_header = (@config.includes || @config.includes_h_pre_orig_header || []).map{|h| h =~ /</ ? h : "\"#{h}\""}
|
|
23
23
|
@includes_h_post_orig_header = (@config.includes_h_post_orig_header || []).map{|h| h =~ /</ ? h : "\"#{h}\""}
|
|
24
24
|
@includes_c_pre_header = (@config.includes_c_pre_header || []).map{|h| h =~ /</ ? h : "\"#{h}\""}
|
|
@@ -32,9 +32,9 @@ class CMockGenerator
|
|
|
32
32
|
create_mock_header_file(parsed_stuff)
|
|
33
33
|
create_mock_source_file(parsed_stuff)
|
|
34
34
|
end
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
private if $ThisIsOnlyATest.nil? ##############################
|
|
37
|
-
|
|
37
|
+
|
|
38
38
|
def create_mock_header_file(parsed_stuff)
|
|
39
39
|
@file_writer.create_file(@mock_name + ".h") do |file, filename|
|
|
40
40
|
create_mock_header_header(file, filename)
|
|
@@ -61,28 +61,35 @@ class CMockGenerator
|
|
|
61
61
|
end
|
|
62
62
|
end
|
|
63
63
|
end
|
|
64
|
-
|
|
65
|
-
def create_mock_header_header(file, filename)
|
|
66
|
-
define_name = @clean_mock_name.gsub(
|
|
67
|
-
orig_filename = filename
|
|
64
|
+
|
|
65
|
+
def create_mock_header_header(file, filename)
|
|
66
|
+
define_name = @clean_mock_name.gsub(/[-\/\\\.\,\s]+/,'_').upcase
|
|
67
|
+
orig_filename = filename[@config.mock_prefix.size..-1]
|
|
68
68
|
file << "/* AUTOGENERATED FILE. DO NOT EDIT. */\n"
|
|
69
69
|
file << "#ifndef _#{define_name}_H\n"
|
|
70
70
|
file << "#define _#{define_name}_H\n\n"
|
|
71
|
-
@includes_h_pre_orig_header.each {|inc| file << "#include #{inc}\n"}
|
|
71
|
+
@includes_h_pre_orig_header.each {|inc| file << "#include #{inc}\n"}
|
|
72
72
|
file << "#include \"#{orig_filename}\"\n"
|
|
73
73
|
@includes_h_post_orig_header.each {|inc| file << "#include #{inc}\n"}
|
|
74
74
|
plugin_includes = @plugins.run(:include_files)
|
|
75
75
|
file << plugin_includes if (!plugin_includes.empty?)
|
|
76
76
|
file << "\n"
|
|
77
|
+
file << "/* Ignore the following warnings, since we are copying code */\n"
|
|
78
|
+
file << "#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)\n"
|
|
79
|
+
file << "#pragma GCC diagnostic ignored \"-Wpragmas\"\n"
|
|
80
|
+
file << "#endif\n"
|
|
81
|
+
file << "#pragma GCC diagnostic ignored \"-Wunknown-pragmas\"\n"
|
|
82
|
+
file << "#pragma GCC diagnostic ignored \"-Wduplicate-decl-specifier\"\n"
|
|
83
|
+
file << "\n"
|
|
77
84
|
end
|
|
78
|
-
|
|
85
|
+
|
|
79
86
|
def create_typedefs(file, typedefs)
|
|
80
87
|
file << "\n"
|
|
81
88
|
typedefs.each {|typedef| file << "#{typedef}\n" }
|
|
82
89
|
file << "\n\n"
|
|
83
90
|
end
|
|
84
91
|
|
|
85
|
-
def create_mock_header_service_call_declarations(file)
|
|
92
|
+
def create_mock_header_service_call_declarations(file)
|
|
86
93
|
file << "void #{@clean_mock_name}_Init(void);\n"
|
|
87
94
|
file << "void #{@clean_mock_name}_Destroy(void);\n"
|
|
88
95
|
file << "void #{@clean_mock_name}_Verify(void);\n\n"
|
|
@@ -91,7 +98,7 @@ class CMockGenerator
|
|
|
91
98
|
def create_mock_header_footer(header)
|
|
92
99
|
header << "\n#endif\n"
|
|
93
100
|
end
|
|
94
|
-
|
|
101
|
+
|
|
95
102
|
def create_source_header_section(file, filename)
|
|
96
103
|
header_file = filename.gsub(".c",".h")
|
|
97
104
|
file << "/* AUTOGENERATED FILE. DO NOT EDIT. */\n"
|
|
@@ -105,9 +112,9 @@ class CMockGenerator
|
|
|
105
112
|
@includes_c_post_header.each {|inc| file << "#include #{inc}\n"}
|
|
106
113
|
file << "\n"
|
|
107
114
|
end
|
|
108
|
-
|
|
115
|
+
|
|
109
116
|
def create_instance_structure(file, functions)
|
|
110
|
-
functions.each do |function|
|
|
117
|
+
functions.each do |function|
|
|
111
118
|
file << "typedef struct _CMOCK_#{function[:name]}_CALL_INSTANCE\n{\n"
|
|
112
119
|
file << " UNITY_LINE_TYPE LineNumber;\n"
|
|
113
120
|
file << @plugins.run(:instance_typedefs, function)
|
|
@@ -123,7 +130,7 @@ class CMockGenerator
|
|
|
123
130
|
end
|
|
124
131
|
file << "} Mock;\n\n"
|
|
125
132
|
end
|
|
126
|
-
|
|
133
|
+
|
|
127
134
|
def create_extern_declarations(file)
|
|
128
135
|
file << "extern jmp_buf AbortFrame;\n"
|
|
129
136
|
if (@ordered)
|
|
@@ -132,7 +139,7 @@ class CMockGenerator
|
|
|
132
139
|
end
|
|
133
140
|
file << "\n"
|
|
134
141
|
end
|
|
135
|
-
|
|
142
|
+
|
|
136
143
|
def create_mock_verify_function(file, functions)
|
|
137
144
|
file << "void #{@clean_mock_name}_Verify(void)\n{\n"
|
|
138
145
|
verifications = functions.collect {|function| @plugins.run(:mock_verify, function)}.join
|
|
@@ -140,13 +147,13 @@ class CMockGenerator
|
|
|
140
147
|
file << verifications
|
|
141
148
|
file << "}\n\n"
|
|
142
149
|
end
|
|
143
|
-
|
|
150
|
+
|
|
144
151
|
def create_mock_init_function(file)
|
|
145
152
|
file << "void #{@clean_mock_name}_Init(void)\n{\n"
|
|
146
153
|
file << " #{@clean_mock_name}_Destroy();\n"
|
|
147
154
|
file << "}\n\n"
|
|
148
155
|
end
|
|
149
|
-
|
|
156
|
+
|
|
150
157
|
def create_mock_destroy_function(file, functions)
|
|
151
158
|
file << "void #{@clean_mock_name}_Destroy(void)\n{\n"
|
|
152
159
|
file << " CMock_Guts_MemFreeAll();\n"
|
|
@@ -158,15 +165,15 @@ class CMockGenerator
|
|
|
158
165
|
end
|
|
159
166
|
file << "}\n\n"
|
|
160
167
|
end
|
|
161
|
-
|
|
162
|
-
def create_mock_implementation(file, function)
|
|
163
|
-
# prepare return value and arguments
|
|
168
|
+
|
|
169
|
+
def create_mock_implementation(file, function)
|
|
170
|
+
# prepare return value and arguments
|
|
164
171
|
function_mod_and_rettype = (function[:modifier].empty? ? '' : "#{function[:modifier]} ") +
|
|
165
172
|
(function[:return][:type]) +
|
|
166
173
|
(function[:c_calling_convention] ? " #{function[:c_calling_convention]}" : '')
|
|
167
174
|
args_string = function[:args_string]
|
|
168
175
|
args_string += (", " + function[:var_arg]) unless (function[:var_arg].nil?)
|
|
169
|
-
|
|
176
|
+
|
|
170
177
|
# Create mock function
|
|
171
178
|
file << "#{function_mod_and_rettype} #{function[:name]}(#{args_string})\n"
|
|
172
179
|
file << "{\n"
|
|
@@ -183,11 +190,12 @@ class CMockGenerator
|
|
|
183
190
|
file << " UNITY_TEST_FAIL(cmock_line, \"Function '#{function[:name]}' called later than expected.\");\n"
|
|
184
191
|
# file << " UNITY_TEST_ASSERT((cmock_call_instance->CallOrder == ++GlobalVerifyOrder), cmock_line, \"Out of order function calls. Function '#{function[:name]}'\");\n"
|
|
185
192
|
end
|
|
193
|
+
return_type_cast = function[:return][:const?] ? "(const #{function[:return][:type]})" : ''
|
|
186
194
|
file << @plugins.run(:mock_implementation, function)
|
|
187
|
-
file << " return cmock_call_instance->ReturnVal;\n" unless (function[:return][:void?])
|
|
195
|
+
file << " return #{return_type_cast}cmock_call_instance->ReturnVal;\n" unless (function[:return][:void?])
|
|
188
196
|
file << "}\n\n"
|
|
189
197
|
end
|
|
190
|
-
|
|
198
|
+
|
|
191
199
|
def create_mock_interfaces(file, function)
|
|
192
200
|
file << @utils.code_add_argument_loader(function)
|
|
193
201
|
file << @plugins.run(:mock_interfaces, function)
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# ==========================================
|
|
2
|
+
# CMock Project - Automatic Mock Generation for C
|
|
3
|
+
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
|
|
4
|
+
# [Released under MIT License. Please refer to license.txt for details]
|
|
5
|
+
# ==========================================
|
|
6
|
+
|
|
7
|
+
class CMockGeneratorPluginExpectAnyArgs
|
|
8
|
+
|
|
9
|
+
attr_reader :priority
|
|
10
|
+
attr_reader :config, :utils
|
|
11
|
+
|
|
12
|
+
def initialize(config, utils)
|
|
13
|
+
@config = config
|
|
14
|
+
@utils = utils
|
|
15
|
+
@priority = 3
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def instance_structure(function)
|
|
19
|
+
if (function[:return][:void?]) || (@config.plugins.include? :ignore)
|
|
20
|
+
""
|
|
21
|
+
else
|
|
22
|
+
" #{function[:return][:type]} #{function[:name]}_FinalReturn;\n"
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def instance_typedefs(function)
|
|
27
|
+
" CMOCK_ARG_MODE IgnoreMode;\n"
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def mock_function_declarations(function)
|
|
31
|
+
|
|
32
|
+
if (function[:return][:void?])
|
|
33
|
+
return "#define #{function[:name]}_ExpectAnyArgs() #{function[:name]}_CMockExpectAnyArgs(__LINE__)\n" +
|
|
34
|
+
"void #{function[:name]}_CMockExpectAnyArgs(UNITY_LINE_TYPE cmock_line);\n"
|
|
35
|
+
else
|
|
36
|
+
return "#define #{function[:name]}_ExpectAnyArgsAndReturn(cmock_retval) #{function[:name]}_CMockExpectAnyArgsAndReturn(__LINE__, cmock_retval)\n" +
|
|
37
|
+
"void #{function[:name]}_CMockExpectAnyArgsAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]});\n"
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def mock_implementation(function)
|
|
42
|
+
lines = " if (cmock_call_instance->IgnoreMode == CMOCK_ARG_NONE)\n {\n"
|
|
43
|
+
if (function[:return][:void?])
|
|
44
|
+
lines << " return;\n }\n"
|
|
45
|
+
else
|
|
46
|
+
retval = function[:return].merge( { :name => "cmock_call_instance->ReturnVal"} )
|
|
47
|
+
lines << " " + @utils.code_assign_argument_quickly("Mock.#{function[:name]}_FinalReturn", retval) unless (retval[:void?])
|
|
48
|
+
return_type_cast = function[:return][:const?] ? "(const #{function[:return][:type]})" : ''
|
|
49
|
+
lines << " return #{return_type_cast}cmock_call_instance->ReturnVal;\n }\n"
|
|
50
|
+
end
|
|
51
|
+
lines
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def mock_interfaces(function)
|
|
55
|
+
lines = ""
|
|
56
|
+
if (function[:return][:void?])
|
|
57
|
+
lines << "void #{function[:name]}_CMockExpectAnyArgs(UNITY_LINE_TYPE cmock_line)\n{\n"
|
|
58
|
+
else
|
|
59
|
+
lines << "void #{function[:name]}_CMockExpectAnyArgsAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]})\n{\n"
|
|
60
|
+
end
|
|
61
|
+
lines << @utils.code_add_base_expectation(function[:name], true)
|
|
62
|
+
unless (function[:return][:void?])
|
|
63
|
+
lines << " cmock_call_instance->ReturnVal = cmock_to_return;\n"
|
|
64
|
+
end
|
|
65
|
+
lines << " cmock_call_instance->IgnoreMode = CMOCK_ARG_NONE;\n"
|
|
66
|
+
lines << "}\n\n"
|
|
67
|
+
end
|
|
68
|
+
end
|
|
@@ -2,28 +2,19 @@
|
|
|
2
2
|
# CMock Project - Automatic Mock Generation for C
|
|
3
3
|
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
|
|
4
4
|
# [Released under MIT License. Please refer to license.txt for details]
|
|
5
|
-
# ==========================================
|
|
5
|
+
# ==========================================
|
|
6
6
|
|
|
7
7
|
class CMockGeneratorPluginIgnore
|
|
8
8
|
|
|
9
9
|
attr_reader :priority
|
|
10
10
|
attr_reader :config, :utils
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
def initialize(config, utils)
|
|
13
13
|
@config = config
|
|
14
|
-
if (@config.ignore == :args_and_calls)
|
|
15
|
-
alias :mock_implementation_precheck :mock_implementation_for_ignores
|
|
16
|
-
alias :mock_implementation :nothing
|
|
17
|
-
alias :mock_verify :mock_conditionally_verify_counts
|
|
18
|
-
else
|
|
19
|
-
alias :mock_implementation :mock_implementation_for_ignores
|
|
20
|
-
alias :mock_implementation_precheck :nothing
|
|
21
|
-
alias :mock_verify :nothing
|
|
22
|
-
end
|
|
23
14
|
@utils = utils
|
|
24
15
|
@priority = 2
|
|
25
16
|
end
|
|
26
|
-
|
|
17
|
+
|
|
27
18
|
def instance_structure(function)
|
|
28
19
|
if (function[:return][:void?])
|
|
29
20
|
" int #{function[:name]}_IgnoreBool;\n"
|
|
@@ -31,50 +22,39 @@ class CMockGeneratorPluginIgnore
|
|
|
31
22
|
" int #{function[:name]}_IgnoreBool;\n #{function[:return][:type]} #{function[:name]}_FinalReturn;\n"
|
|
32
23
|
end
|
|
33
24
|
end
|
|
34
|
-
|
|
25
|
+
|
|
35
26
|
def mock_function_declarations(function)
|
|
36
27
|
if (function[:return][:void?])
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
else
|
|
41
|
-
return "#define #{function[:name]}_Ignore() #{function[:name]}_CMockIgnore()\n" +
|
|
42
|
-
"void #{function[:name]}_CMockIgnore(void);\n"
|
|
43
|
-
end
|
|
44
|
-
else
|
|
28
|
+
return "#define #{function[:name]}_Ignore() #{function[:name]}_CMockIgnore()\n" +
|
|
29
|
+
"void #{function[:name]}_CMockIgnore(void);\n"
|
|
30
|
+
else
|
|
45
31
|
return "#define #{function[:name]}_IgnoreAndReturn(cmock_retval) #{function[:name]}_CMockIgnoreAndReturn(__LINE__, cmock_retval)\n" +
|
|
46
32
|
"void #{function[:name]}_CMockIgnoreAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]});\n"
|
|
47
|
-
end
|
|
33
|
+
end
|
|
48
34
|
end
|
|
49
|
-
|
|
50
|
-
def
|
|
51
|
-
lines = " if (Mock.#{function[:name]}_IgnoreBool)\n {\n"
|
|
35
|
+
|
|
36
|
+
def mock_implementation_precheck(function)
|
|
37
|
+
lines = " if (Mock.#{function[:name]}_IgnoreBool)\n {\n"
|
|
52
38
|
if (function[:return][:void?])
|
|
53
39
|
lines << " return;\n }\n"
|
|
54
40
|
else
|
|
55
41
|
retval = function[:return].merge( { :name => "cmock_call_instance->ReturnVal"} )
|
|
56
|
-
|
|
42
|
+
return_type = function[:return][:const?] ? "const #{function[:return][:type]}" : function[:return][:type]
|
|
43
|
+
lines << " if (cmock_call_instance == NULL)\n return (#{return_type})Mock.#{function[:name]}_FinalReturn;\n"
|
|
57
44
|
lines << " " + @utils.code_assign_argument_quickly("Mock.#{function[:name]}_FinalReturn", retval) unless (retval[:void?])
|
|
58
|
-
lines << " return cmock_call_instance->ReturnVal;\n }\n"
|
|
45
|
+
lines << " return (#{return_type})cmock_call_instance->ReturnVal;\n }\n"
|
|
59
46
|
end
|
|
60
47
|
lines
|
|
61
48
|
end
|
|
62
|
-
|
|
49
|
+
|
|
63
50
|
def mock_interfaces(function)
|
|
64
51
|
lines = ""
|
|
65
|
-
args_only = (@config.ignore == :args_only)
|
|
66
52
|
if (function[:return][:void?])
|
|
67
|
-
|
|
68
|
-
lines << "void #{function[:name]}_CMockIgnore(UNITY_LINE_TYPE cmock_line)\n{\n"
|
|
69
|
-
else
|
|
70
|
-
lines << "void #{function[:name]}_CMockIgnore(void)\n{\n"
|
|
71
|
-
end
|
|
53
|
+
lines << "void #{function[:name]}_CMockIgnore(void)\n{\n"
|
|
72
54
|
else
|
|
73
55
|
lines << "void #{function[:name]}_CMockIgnoreAndReturn(UNITY_LINE_TYPE cmock_line, #{function[:return][:str]})\n{\n"
|
|
74
56
|
end
|
|
75
|
-
if (
|
|
76
|
-
lines << @utils.code_add_base_expectation(function[:name], true)
|
|
77
|
-
elsif (!function[:return][:void?])
|
|
57
|
+
if (!function[:return][:void?])
|
|
78
58
|
lines << @utils.code_add_base_expectation(function[:name], false)
|
|
79
59
|
end
|
|
80
60
|
unless (function[:return][:void?])
|
|
@@ -84,12 +64,8 @@ class CMockGeneratorPluginIgnore
|
|
|
84
64
|
lines << "}\n\n"
|
|
85
65
|
end
|
|
86
66
|
|
|
87
|
-
def
|
|
67
|
+
def mock_verify(function)
|
|
88
68
|
func_name = function[:name]
|
|
89
69
|
" if (Mock.#{func_name}_IgnoreBool)\n Mock.#{func_name}_CallInstance = CMOCK_GUTS_NONE;\n"
|
|
90
70
|
end
|
|
91
|
-
|
|
92
|
-
def nothing(function)
|
|
93
|
-
return ""
|
|
94
|
-
end
|
|
95
71
|
end
|