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
|
@@ -2,9 +2,10 @@
|
|
|
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
|
$ThisIsOnlyATest = true
|
|
8
|
+
$QUICK_RUBY_VERSION = RUBY_VERSION.split('.').inject(0){|vv,v| vv * 100 + v.to_i }
|
|
8
9
|
|
|
9
10
|
require File.expand_path(File.dirname(__FILE__)) + "/../test_helper"
|
|
10
11
|
require 'cmock_header_parser'
|
|
@@ -14,7 +15,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
14
15
|
def setup
|
|
15
16
|
create_mocks :config
|
|
16
17
|
@test_name = 'test_file.h'
|
|
17
|
-
@config.expect.strippables.returns([
|
|
18
|
+
@config.expect.strippables.returns(["STRIPPABLE"])
|
|
18
19
|
@config.expect.attributes.returns(['__ramfunc', 'funky_attrib', 'SQLITE_API'])
|
|
19
20
|
@config.expect.c_calling_conventions.returns(['__stdcall'])
|
|
20
21
|
@config.expect.treat_as_void.returns(['MY_FUNKY_VOID'])
|
|
@@ -22,37 +23,36 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
22
23
|
@config.expect.when_no_prototypes.returns(:error)
|
|
23
24
|
@config.expect.verbosity.returns(1)
|
|
24
25
|
@config.expect.treat_externs.returns(:exclude)
|
|
25
|
-
|
|
26
|
+
|
|
26
27
|
@parser = CMockHeaderParser.new(@config)
|
|
27
28
|
end
|
|
28
29
|
|
|
29
30
|
def teardown
|
|
30
31
|
end
|
|
31
|
-
|
|
32
|
+
|
|
32
33
|
should "create and initialize variables to defaults appropriately" do
|
|
33
34
|
assert_equal([], @parser.funcs)
|
|
34
35
|
assert_equal(['const', '__ramfunc', 'funky_attrib', 'SQLITE_API'], @parser.c_attributes)
|
|
35
36
|
assert_equal(['void','MY_FUNKY_VOID'], @parser.treat_as_void)
|
|
36
37
|
end
|
|
37
|
-
|
|
38
|
+
|
|
38
39
|
should "strip out line comments" do
|
|
39
|
-
source =
|
|
40
|
+
source =
|
|
40
41
|
" abcd;\n" +
|
|
41
42
|
"// hello;\n" +
|
|
42
43
|
"who // is you\n"
|
|
43
|
-
|
|
44
|
+
|
|
44
45
|
expected =
|
|
45
46
|
[
|
|
46
47
|
"abcd",
|
|
47
48
|
"who"
|
|
48
49
|
]
|
|
49
|
-
|
|
50
|
+
|
|
50
51
|
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
|
|
51
52
|
end
|
|
52
|
-
|
|
53
|
-
|
|
53
|
+
|
|
54
54
|
should "remove block comments" do
|
|
55
|
-
source =
|
|
55
|
+
source =
|
|
56
56
|
" no_comments;\n" +
|
|
57
57
|
"// basic_line_comment;\n" +
|
|
58
58
|
"/* basic_block_comment;*/\n" +
|
|
@@ -71,7 +71,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
71
71
|
"/*/\n" +
|
|
72
72
|
"shown_because_line_above_ended_comment_this_time;\n" +
|
|
73
73
|
"//*/\n"
|
|
74
|
-
|
|
74
|
+
|
|
75
75
|
expected =
|
|
76
76
|
[
|
|
77
77
|
"no_comments",
|
|
@@ -80,13 +80,32 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
80
80
|
"shown_because_block_comment_invalid_from_shorter_line_comment",
|
|
81
81
|
"shown_because_line_above_ended_comment_this_time"
|
|
82
82
|
]
|
|
83
|
-
|
|
83
|
+
|
|
84
84
|
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
|
|
85
85
|
end
|
|
86
|
-
|
|
87
|
-
|
|
86
|
+
|
|
87
|
+
should "remove strippables from the beginning or end of function declarations" do
|
|
88
|
+
source =
|
|
89
|
+
"void* my_calloc(size_t, size_t) STRIPPABLE;\n" +
|
|
90
|
+
"void\n" +
|
|
91
|
+
" my_realloc(void*, size_t) STRIPPABLE;\n" +
|
|
92
|
+
"extern int\n" +
|
|
93
|
+
" my_printf (void *my_object, const char *my_format, ...)\n" +
|
|
94
|
+
" STRIPPABLE;\n" +
|
|
95
|
+
" void STRIPPABLE universal_handler ();\n"
|
|
96
|
+
|
|
97
|
+
expected =
|
|
98
|
+
[
|
|
99
|
+
"void* my_calloc(size_t, size_t)",
|
|
100
|
+
"void my_realloc(void*, size_t)",
|
|
101
|
+
"void universal_handler()"
|
|
102
|
+
]
|
|
103
|
+
|
|
104
|
+
assert_equal(expected, @parser.import_source(source))
|
|
105
|
+
end
|
|
106
|
+
|
|
88
107
|
should "remove gcc's function __attribute__'s" do
|
|
89
|
-
source =
|
|
108
|
+
source =
|
|
90
109
|
"void* my_calloc(size_t, size_t) __attribute__((alloc_size(1,2)));\n" +
|
|
91
110
|
"void\n" +
|
|
92
111
|
" my_realloc(void*, size_t) __attribute__((alloc_size(2)));\n" +
|
|
@@ -94,25 +113,25 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
94
113
|
" my_printf (void *my_object, const char *my_format, ...)\n" +
|
|
95
114
|
" __attribute__ ((format (printf, 2, 3)));\n" +
|
|
96
115
|
" void __attribute__ ((interrupt)) universal_handler ();\n"
|
|
97
|
-
|
|
98
|
-
expected =
|
|
116
|
+
|
|
117
|
+
expected =
|
|
99
118
|
[
|
|
100
119
|
"void* my_calloc(size_t, size_t)",
|
|
101
120
|
"void my_realloc(void*, size_t)",
|
|
102
121
|
"void universal_handler()"
|
|
103
122
|
]
|
|
104
|
-
|
|
123
|
+
|
|
105
124
|
assert_equal(expected, @parser.import_source(source))
|
|
106
125
|
end
|
|
107
|
-
|
|
126
|
+
|
|
108
127
|
should "remove preprocessor directives" do
|
|
109
|
-
source =
|
|
128
|
+
source =
|
|
110
129
|
"#when stuff_happens\n" +
|
|
111
130
|
"#ifdef _TEST\n" +
|
|
112
131
|
"#pragma stack_switch"
|
|
113
|
-
|
|
132
|
+
|
|
114
133
|
expected = []
|
|
115
|
-
|
|
134
|
+
|
|
116
135
|
assert_equal(expected, @parser.import_source(source))
|
|
117
136
|
end
|
|
118
137
|
|
|
@@ -125,47 +144,47 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
125
144
|
" nop\n" +
|
|
126
145
|
"# pragma endasm \n" +
|
|
127
146
|
"foo"
|
|
128
|
-
|
|
147
|
+
|
|
129
148
|
expected = ["foo"]
|
|
130
|
-
|
|
149
|
+
|
|
131
150
|
assert_equal(expected, @parser.import_source(source))
|
|
132
151
|
end
|
|
133
|
-
|
|
134
|
-
|
|
152
|
+
|
|
153
|
+
|
|
135
154
|
should "smush lines together that contain continuation characters" do
|
|
136
|
-
source =
|
|
155
|
+
source =
|
|
137
156
|
"hoo hah \\\n" +
|
|
138
157
|
"when \\ \n"
|
|
139
|
-
|
|
158
|
+
|
|
140
159
|
expected =
|
|
141
160
|
[
|
|
142
161
|
"hoo hah when"
|
|
143
162
|
]
|
|
144
|
-
|
|
163
|
+
|
|
145
164
|
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
|
|
146
165
|
end
|
|
147
|
-
|
|
148
|
-
|
|
166
|
+
|
|
167
|
+
|
|
149
168
|
should "remove C macro definitions" do
|
|
150
|
-
source =
|
|
169
|
+
source =
|
|
151
170
|
"#define this is the first line\\\n" +
|
|
152
171
|
"and the second\\\n" +
|
|
153
172
|
"and the third that should be removed\n" +
|
|
154
173
|
"but I'm here\n"
|
|
155
|
-
|
|
174
|
+
|
|
156
175
|
expected = ["but I'm here"]
|
|
157
|
-
|
|
176
|
+
|
|
158
177
|
assert_equal(expected, @parser.import_source(source))
|
|
159
178
|
end
|
|
160
|
-
|
|
161
|
-
|
|
179
|
+
|
|
180
|
+
|
|
162
181
|
should "remove typedef statements" do
|
|
163
|
-
source =
|
|
182
|
+
source =
|
|
164
183
|
"typedef uint32 (unsigned int);\n" +
|
|
165
184
|
"const typedef int INT;\n" +
|
|
166
185
|
"int notatypedef;\n" +
|
|
167
186
|
"int typedef_isnt_me;\n" +
|
|
168
|
-
" typedef who cares what really comes here
|
|
187
|
+
" typedef who cares what really comes here \n" + # exercise multiline typedef
|
|
169
188
|
" continuation;\n" +
|
|
170
189
|
"this should remain!;\n" +
|
|
171
190
|
"typedef blah bleh;\n" +
|
|
@@ -181,20 +200,20 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
181
200
|
" char_ptr COMMAND;\n" +
|
|
182
201
|
" int_32 (*SHELL_FUNC)(int_32 argc);\n" +
|
|
183
202
|
"};\n"
|
|
184
|
-
|
|
203
|
+
|
|
185
204
|
expected =
|
|
186
205
|
[
|
|
187
206
|
"int notatypedef",
|
|
188
207
|
"int typedef_isnt_me",
|
|
189
208
|
"this should remain!"
|
|
190
209
|
]
|
|
191
|
-
|
|
210
|
+
|
|
192
211
|
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
|
|
193
212
|
end
|
|
194
213
|
|
|
195
214
|
|
|
196
215
|
should "remove enum statements" do
|
|
197
|
-
source =
|
|
216
|
+
source =
|
|
198
217
|
"enum _NamedEnum {\n" +
|
|
199
218
|
" THING1 = (0x0001),\n" +
|
|
200
219
|
" THING2 = (0x0001 << 5),\n" +
|
|
@@ -206,13 +225,13 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
206
225
|
" THING2,\n" +
|
|
207
226
|
"} Thinger;\n" +
|
|
208
227
|
"or me!!\n"
|
|
209
|
-
|
|
228
|
+
|
|
210
229
|
assert_equal(["don't delete me!! or me!!"], @parser.import_source(source).map!{|s|s.strip})
|
|
211
230
|
end
|
|
212
231
|
|
|
213
232
|
|
|
214
233
|
should "remove union statements" do
|
|
215
|
-
source =
|
|
234
|
+
source =
|
|
216
235
|
"union _NamedDoohicky {\n" +
|
|
217
236
|
" unsigned int a;\n" +
|
|
218
237
|
" char b;\n" +
|
|
@@ -224,13 +243,13 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
224
243
|
" char b;\n" +
|
|
225
244
|
"} Whatever;\n" +
|
|
226
245
|
"me too!!\n"
|
|
227
|
-
|
|
246
|
+
|
|
228
247
|
assert_equal(["I want to live!! me too!!"], @parser.import_source(source).map!{|s|s.strip})
|
|
229
248
|
end
|
|
230
249
|
|
|
231
250
|
|
|
232
251
|
should "remove struct statements" do
|
|
233
|
-
source =
|
|
252
|
+
source =
|
|
234
253
|
"struct _NamedStruct1 {\n" +
|
|
235
254
|
" unsigned int a;\n" +
|
|
236
255
|
" signed long int b;\n" +
|
|
@@ -247,12 +266,12 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
247
266
|
"}Thinger;\n" +
|
|
248
267
|
"I want to live!!\n"
|
|
249
268
|
|
|
250
|
-
assert_equal(["void foo(void)", "struct THINGER foo(void)", "I want to live!!"],
|
|
269
|
+
assert_equal(["void foo(void)", "struct THINGER foo(void)", "I want to live!!"],
|
|
251
270
|
@parser.import_source(source).map!{|s|s.strip})
|
|
252
271
|
end
|
|
253
|
-
|
|
272
|
+
|
|
254
273
|
should "remove externed and inline functions" do
|
|
255
|
-
source =
|
|
274
|
+
source =
|
|
256
275
|
" extern uint32 foobar(unsigned int);\n" +
|
|
257
276
|
"uint32 extern_name_func(unsigned int);\n" +
|
|
258
277
|
"uint32 funcinline(unsigned int);\n" +
|
|
@@ -260,42 +279,61 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
260
279
|
"inline void bar(unsigned int);\n" +
|
|
261
280
|
"extern\n" +
|
|
262
281
|
"void kinda_ugly_on_the_next_line(unsigned int);\n"
|
|
263
|
-
|
|
282
|
+
|
|
264
283
|
expected =
|
|
265
284
|
[
|
|
266
285
|
"uint32 extern_name_func(unsigned int)",
|
|
267
286
|
"uint32 funcinline(unsigned int)"
|
|
268
287
|
]
|
|
269
|
-
|
|
288
|
+
|
|
289
|
+
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
should "remove function definitions but keep function declarations" do
|
|
293
|
+
source =
|
|
294
|
+
"uint32 func_with_decl_a(unsigned int);\n" +
|
|
295
|
+
"uint32 func_with_decl_a(unsigned int a) { return a; }\n" +
|
|
296
|
+
"uint32 func_with_decl_b(unsigned int);\n" +
|
|
297
|
+
"uint32 func_with_decl_b(unsigned int)\n" +
|
|
298
|
+
"{\n" +
|
|
299
|
+
" bar(unsigned int);\n" +
|
|
300
|
+
"}\n"
|
|
301
|
+
|
|
302
|
+
expected =
|
|
303
|
+
[
|
|
304
|
+
"uint32 func_with_decl_a(unsigned int)",
|
|
305
|
+
"uint32 func_with_decl_b(unsigned int)"
|
|
306
|
+
]
|
|
307
|
+
|
|
270
308
|
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
|
|
271
309
|
end
|
|
272
|
-
|
|
310
|
+
|
|
273
311
|
should "remove a fully defined inline function" do
|
|
274
|
-
source =
|
|
312
|
+
source =
|
|
275
313
|
"inline void foo(unsigned int a) { oranges = a; }\n" +
|
|
276
314
|
"inline void bar(unsigned int a) { apples = a; };\n" +
|
|
277
315
|
"inline void bar(unsigned int a)\n" +
|
|
278
316
|
"{" +
|
|
279
317
|
" bananas = a;\n" +
|
|
280
318
|
"}"
|
|
281
|
-
|
|
319
|
+
|
|
282
320
|
# ensure it's expected type of exception
|
|
283
321
|
assert_raise RuntimeError do
|
|
284
322
|
@parser.parse("module", source)
|
|
285
323
|
end
|
|
286
324
|
|
|
287
325
|
assert_equal([], @parser.funcs)
|
|
288
|
-
|
|
326
|
+
|
|
289
327
|
# verify exception message
|
|
290
328
|
begin
|
|
291
329
|
@parser.parse("module", source)
|
|
292
330
|
rescue RuntimeError => e
|
|
293
331
|
assert_equal("ERROR: No function prototypes found!", e.message)
|
|
294
|
-
end
|
|
332
|
+
end
|
|
295
333
|
end
|
|
296
|
-
|
|
334
|
+
|
|
297
335
|
should "remove just inline functions if externs to be included" do
|
|
298
|
-
source =
|
|
336
|
+
source =
|
|
299
337
|
" extern uint32 foobar(unsigned int);\n" +
|
|
300
338
|
"uint32 extern_name_func(unsigned int);\n" +
|
|
301
339
|
"uint32 funcinline(unsigned int);\n" +
|
|
@@ -303,7 +341,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
303
341
|
"inline void bar(unsigned int);\n" +
|
|
304
342
|
"extern\n" +
|
|
305
343
|
"void kinda_ugly_on_the_next_line(unsigned int);\n"
|
|
306
|
-
|
|
344
|
+
|
|
307
345
|
expected =
|
|
308
346
|
[ "extern uint32 foobar(unsigned int)",
|
|
309
347
|
"uint32 extern_name_func(unsigned int)",
|
|
@@ -311,12 +349,12 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
311
349
|
"extern void bar(unsigned int)",
|
|
312
350
|
"extern void kinda_ugly_on_the_next_line(unsigned int)"
|
|
313
351
|
]
|
|
314
|
-
|
|
352
|
+
|
|
315
353
|
@parser.treat_externs = :include
|
|
316
354
|
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
|
|
317
355
|
end
|
|
318
|
-
|
|
319
|
-
|
|
356
|
+
|
|
357
|
+
|
|
320
358
|
should "remove defines" do
|
|
321
359
|
source =
|
|
322
360
|
"#define whatever you feel like defining\n" +
|
|
@@ -324,37 +362,37 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
324
362
|
"#DEFINE I JUST DON'T CARE\n" +
|
|
325
363
|
"#deFINE\n" +
|
|
326
364
|
"#define get_foo() \\\n ((Thing)foo.bar)" # exercise multiline define
|
|
327
|
-
|
|
365
|
+
|
|
328
366
|
expected =
|
|
329
367
|
[
|
|
330
368
|
"void hello(void)",
|
|
331
369
|
]
|
|
332
|
-
|
|
370
|
+
|
|
333
371
|
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
|
|
334
372
|
end
|
|
335
|
-
|
|
336
|
-
|
|
373
|
+
|
|
374
|
+
|
|
337
375
|
should "remove keywords that would keep things from going smoothly in the future" do
|
|
338
376
|
source =
|
|
339
377
|
"const int TheMatrix(register int Trinity, unsigned int *restrict Neo)"
|
|
340
|
-
|
|
378
|
+
|
|
341
379
|
expected =
|
|
342
380
|
[
|
|
343
381
|
"const int TheMatrix(int Trinity, unsigned int * Neo)",
|
|
344
382
|
]
|
|
345
|
-
|
|
383
|
+
|
|
346
384
|
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
|
|
347
385
|
end
|
|
348
386
|
|
|
349
387
|
|
|
350
388
|
# some code actually typedef's void even though it's not ANSI C and is, frankly, weird
|
|
351
389
|
# since cmock treats void specially, we can't let void be obfuscated
|
|
352
|
-
should "handle odd case of typedef'd void returned" do
|
|
390
|
+
should "handle odd case of typedef'd void returned" do
|
|
353
391
|
source = "MY_FUNKY_VOID FunkyVoidReturned(int a)"
|
|
354
392
|
expected = { :var_arg=>nil,
|
|
355
393
|
:name=>"FunkyVoidReturned",
|
|
356
|
-
:return=>{ :type => "void",
|
|
357
|
-
:name => 'cmock_to_return',
|
|
394
|
+
:return=>{ :type => "void",
|
|
395
|
+
:name => 'cmock_to_return',
|
|
358
396
|
:ptr? => false,
|
|
359
397
|
:const? => false,
|
|
360
398
|
:str => "void cmock_to_return",
|
|
@@ -367,13 +405,13 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
367
405
|
:args_call=>"a"}
|
|
368
406
|
assert_equal(expected, @parser.parse_declaration(source))
|
|
369
407
|
end
|
|
370
|
-
|
|
371
|
-
should "handle odd case of typedef'd void as arg" do
|
|
408
|
+
|
|
409
|
+
should "handle odd case of typedef'd void as arg" do
|
|
372
410
|
source = "int FunkyVoidAsArg(MY_FUNKY_VOID)"
|
|
373
411
|
expected = { :var_arg=>nil,
|
|
374
412
|
:name=>"FunkyVoidAsArg",
|
|
375
|
-
:return=>{ :type => "int",
|
|
376
|
-
:name => 'cmock_to_return',
|
|
413
|
+
:return=>{ :type => "int",
|
|
414
|
+
:name => 'cmock_to_return',
|
|
377
415
|
:ptr? => false,
|
|
378
416
|
:const? => false,
|
|
379
417
|
:str => "int cmock_to_return",
|
|
@@ -386,13 +424,13 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
386
424
|
:args_call=>"" }
|
|
387
425
|
assert_equal(expected, @parser.parse_declaration(source))
|
|
388
426
|
end
|
|
389
|
-
|
|
390
|
-
should "handle odd case of typedef'd void as arg pointer" do
|
|
427
|
+
|
|
428
|
+
should "handle odd case of typedef'd void as arg pointer" do
|
|
391
429
|
source = "char FunkyVoidPointer(MY_FUNKY_VOID* bluh)"
|
|
392
430
|
expected = { :var_arg=>nil,
|
|
393
431
|
:name=>"FunkyVoidPointer",
|
|
394
|
-
:return=>{ :type => "char",
|
|
395
|
-
:name => 'cmock_to_return',
|
|
432
|
+
:return=>{ :type => "char",
|
|
433
|
+
:name => 'cmock_to_return',
|
|
396
434
|
:ptr? => false,
|
|
397
435
|
:const? => false,
|
|
398
436
|
:str => "char cmock_to_return",
|
|
@@ -403,11 +441,11 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
403
441
|
:args=>[{:type=>"MY_FUNKY_VOID*", :name=>"bluh", :ptr? => true, :const? => false}],
|
|
404
442
|
:args_string=>"MY_FUNKY_VOID* bluh",
|
|
405
443
|
:args_call=>"bluh" }
|
|
406
|
-
assert_equal(expected, @parser.parse_declaration(source))
|
|
444
|
+
assert_equal(expected, @parser.parse_declaration(source))
|
|
407
445
|
end
|
|
408
446
|
|
|
409
447
|
|
|
410
|
-
should "strip default values from function parameter lists" do
|
|
448
|
+
should "strip default values from function parameter lists" do
|
|
411
449
|
source =
|
|
412
450
|
"void Foo(int a = 57, float b=37.52, char c= 'd', char* e=\"junk\");\n"
|
|
413
451
|
|
|
@@ -415,41 +453,41 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
415
453
|
[
|
|
416
454
|
"void Foo(int a, float b, char c, char* e)"
|
|
417
455
|
]
|
|
418
|
-
|
|
456
|
+
|
|
419
457
|
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
|
|
420
458
|
end
|
|
421
459
|
|
|
422
460
|
|
|
423
|
-
should "raise upon empty file" do
|
|
461
|
+
should "raise upon empty file" do
|
|
424
462
|
source = ''
|
|
425
|
-
|
|
463
|
+
|
|
426
464
|
# ensure it's expected type of exception
|
|
427
465
|
assert_raise RuntimeError do
|
|
428
466
|
@parser.parse("module", source)
|
|
429
467
|
end
|
|
430
468
|
|
|
431
469
|
assert_equal([], @parser.funcs)
|
|
432
|
-
|
|
470
|
+
|
|
433
471
|
# verify exception message
|
|
434
472
|
begin
|
|
435
473
|
@parser.parse("module", source)
|
|
436
474
|
rescue RuntimeError => e
|
|
437
475
|
assert_equal("ERROR: No function prototypes found!", e.message)
|
|
438
|
-
end
|
|
476
|
+
end
|
|
439
477
|
end
|
|
440
|
-
|
|
441
|
-
should "clean up module names that contain spaces, dashes, and such" do
|
|
478
|
+
|
|
479
|
+
should "clean up module names that contain spaces, dashes, and such" do
|
|
442
480
|
source = 'void meh(int (*func)(int));'
|
|
443
|
-
|
|
481
|
+
|
|
444
482
|
retval = @parser.parse("C:\Ugly Module-Name", source)
|
|
445
483
|
assert (retval[:typedefs][0] =~ /CUglyModuleName/)
|
|
446
484
|
end
|
|
447
485
|
|
|
448
|
-
should "raise upon no function prototypes found in file" do
|
|
449
|
-
source =
|
|
486
|
+
should "raise upon no function prototypes found in file" do
|
|
487
|
+
source =
|
|
450
488
|
"typedef void SILLY_VOID_TYPE1;\n" +
|
|
451
489
|
"typedef (void) SILLY_VOID_TYPE2 ;\n" +
|
|
452
|
-
"typedef ( void ) (*FUNCPTR)(void);\n\n" +
|
|
490
|
+
"typedef ( void ) (*FUNCPTR)(void);\n\n" +
|
|
453
491
|
"#define get_foo() \\\n ((Thing)foo.bar)"
|
|
454
492
|
|
|
455
493
|
# ensure it's expected type of exception
|
|
@@ -457,19 +495,19 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
457
495
|
@parser.parse("module", source)
|
|
458
496
|
end
|
|
459
497
|
|
|
460
|
-
assert_equal([], @parser.funcs)
|
|
498
|
+
assert_equal([], @parser.funcs)
|
|
461
499
|
|
|
462
500
|
# verify exception message
|
|
463
501
|
begin
|
|
464
|
-
@parser.parse("module", source)
|
|
502
|
+
@parser.parse("module", source)
|
|
465
503
|
rescue RuntimeError => e
|
|
466
504
|
assert_equal("ERROR: No function prototypes found!", e.message)
|
|
467
|
-
end
|
|
505
|
+
end
|
|
468
506
|
end
|
|
469
507
|
|
|
470
508
|
|
|
471
509
|
should "raise upon prototype parsing failure" do
|
|
472
|
-
source = "void (int, )"
|
|
510
|
+
source = "void (int, )"
|
|
473
511
|
|
|
474
512
|
# ensure it's expected type of exception
|
|
475
513
|
assert_raise(RuntimeError) do
|
|
@@ -478,19 +516,19 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
478
516
|
|
|
479
517
|
# verify exception message
|
|
480
518
|
begin
|
|
481
|
-
@parser.parse("module", source)
|
|
519
|
+
@parser.parse("module", source)
|
|
482
520
|
rescue RuntimeError => e
|
|
483
521
|
assert(e.message.include?("Failed Parsing Declaration Prototype!"))
|
|
484
|
-
end
|
|
522
|
+
end
|
|
485
523
|
end
|
|
486
524
|
|
|
487
525
|
should "extract and return function declarations with retval and args" do
|
|
488
|
-
|
|
526
|
+
|
|
489
527
|
source = "int Foo(int a, unsigned int b)"
|
|
490
528
|
expected = { :var_arg=>nil,
|
|
491
529
|
:name=>"Foo",
|
|
492
|
-
:return=>{ :type => "int",
|
|
493
|
-
:name => 'cmock_to_return',
|
|
530
|
+
:return=>{ :type => "int",
|
|
531
|
+
:name => 'cmock_to_return',
|
|
494
532
|
:ptr? => false,
|
|
495
533
|
:const? => false,
|
|
496
534
|
:str => "int cmock_to_return",
|
|
@@ -498,7 +536,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
498
536
|
},
|
|
499
537
|
:modifier=>"",
|
|
500
538
|
:contains_ptr? => false,
|
|
501
|
-
:args=>[ {:type=>"int", :name=>"a", :ptr? => false, :const? => false},
|
|
539
|
+
:args=>[ {:type=>"int", :name=>"a", :ptr? => false, :const? => false},
|
|
502
540
|
{:type=>"unsigned int", :name=>"b", :ptr? => false, :const? => false}
|
|
503
541
|
],
|
|
504
542
|
:args_string=>"int a, unsigned int b",
|
|
@@ -507,11 +545,11 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
507
545
|
end
|
|
508
546
|
|
|
509
547
|
should "extract and return function declarations with no retval" do
|
|
510
|
-
|
|
548
|
+
|
|
511
549
|
source = "void FunkyChicken( uint la, int de, bool da)"
|
|
512
550
|
expected = { :var_arg=>nil,
|
|
513
|
-
:return=>{ :type => "void",
|
|
514
|
-
:name => 'cmock_to_return',
|
|
551
|
+
:return=>{ :type => "void",
|
|
552
|
+
:name => 'cmock_to_return',
|
|
515
553
|
:ptr? => false,
|
|
516
554
|
:const? => false,
|
|
517
555
|
:str => "void cmock_to_return",
|
|
@@ -520,7 +558,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
520
558
|
:name=>"FunkyChicken",
|
|
521
559
|
:modifier=>"",
|
|
522
560
|
:contains_ptr? => false,
|
|
523
|
-
:args=>[ {:type=>"uint", :name=>"la", :ptr? => false, :const? => false},
|
|
561
|
+
:args=>[ {:type=>"uint", :name=>"la", :ptr? => false, :const? => false},
|
|
524
562
|
{:type=>"int", :name=>"de", :ptr? => false, :const? => false},
|
|
525
563
|
{:type=>"bool", :name=>"da", :ptr? => false, :const? => false}
|
|
526
564
|
],
|
|
@@ -530,11 +568,11 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
530
568
|
end
|
|
531
569
|
|
|
532
570
|
should "extract and return function declarations with implied voids" do
|
|
533
|
-
|
|
571
|
+
|
|
534
572
|
source = "void tat()"
|
|
535
573
|
expected = { :var_arg=>nil,
|
|
536
|
-
:return=>{ :type => "void",
|
|
537
|
-
:name => 'cmock_to_return',
|
|
574
|
+
:return=>{ :type => "void",
|
|
575
|
+
:name => 'cmock_to_return',
|
|
538
576
|
:ptr? => false,
|
|
539
577
|
:const? => false,
|
|
540
578
|
:str => "void cmock_to_return",
|
|
@@ -548,37 +586,37 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
548
586
|
:args_call=>"" }
|
|
549
587
|
assert_equal(expected, @parser.parse_declaration(source))
|
|
550
588
|
end
|
|
551
|
-
|
|
589
|
+
|
|
552
590
|
should "extract modifiers properly" do
|
|
553
|
-
|
|
591
|
+
|
|
554
592
|
source = "const int TheMatrix(int Trinity, unsigned int * Neo)"
|
|
555
593
|
expected = { :var_arg=>nil,
|
|
556
|
-
:return=>{ :type => "int",
|
|
557
|
-
:name => 'cmock_to_return',
|
|
594
|
+
:return=>{ :type => "int",
|
|
595
|
+
:name => 'cmock_to_return',
|
|
558
596
|
:ptr? => false,
|
|
559
|
-
:const? =>
|
|
597
|
+
:const? => true,
|
|
560
598
|
:str => "int cmock_to_return",
|
|
561
599
|
:void? => false
|
|
562
600
|
},
|
|
563
601
|
:name=>"TheMatrix",
|
|
564
602
|
:modifier=>"const",
|
|
565
603
|
:contains_ptr? => true,
|
|
566
|
-
:args=>[ {:type=>"int", :name=>"Trinity", :ptr? => false, :const? => false},
|
|
604
|
+
:args=>[ {:type=>"int", :name=>"Trinity", :ptr? => false, :const? => false},
|
|
567
605
|
{:type=>"unsigned int*", :name=>"Neo", :ptr? => true, :const? => false}
|
|
568
606
|
],
|
|
569
607
|
:args_string=>"int Trinity, unsigned int* Neo",
|
|
570
608
|
:args_call=>"Trinity, Neo" }
|
|
571
609
|
assert_equal(expected, @parser.parse_declaration(source))
|
|
572
610
|
end
|
|
573
|
-
|
|
611
|
+
|
|
574
612
|
should "extract c calling conventions properly" do
|
|
575
|
-
|
|
613
|
+
|
|
576
614
|
source = "const int __stdcall TheMatrix(int Trinity, unsigned int * Neo)"
|
|
577
615
|
expected = { :var_arg=>nil,
|
|
578
|
-
:return=>{ :type => "int",
|
|
579
|
-
:name => 'cmock_to_return',
|
|
616
|
+
:return=>{ :type => "int",
|
|
617
|
+
:name => 'cmock_to_return',
|
|
580
618
|
:ptr? => false,
|
|
581
|
-
:const? =>
|
|
619
|
+
:const? => true,
|
|
582
620
|
:str => "int cmock_to_return",
|
|
583
621
|
:void? => false
|
|
584
622
|
},
|
|
@@ -586,38 +624,38 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
586
624
|
:modifier=>"const",
|
|
587
625
|
:c_calling_convention=>"__stdcall",
|
|
588
626
|
:contains_ptr? => true,
|
|
589
|
-
:args=>[ {:type=>"int", :name=>"Trinity", :ptr? => false, :const? => false},
|
|
627
|
+
:args=>[ {:type=>"int", :name=>"Trinity", :ptr? => false, :const? => false},
|
|
590
628
|
{:type=>"unsigned int*", :name=>"Neo", :ptr? => true, :const? => false}
|
|
591
629
|
],
|
|
592
630
|
:args_string=>"int Trinity, unsigned int* Neo",
|
|
593
631
|
:args_call=>"Trinity, Neo" }
|
|
594
632
|
assert_equal(expected, @parser.parse_declaration(source))
|
|
595
633
|
end
|
|
596
|
-
|
|
634
|
+
|
|
597
635
|
should "fully parse multiple prototypes" do
|
|
598
|
-
|
|
599
|
-
source = "const int TheMatrix(int Trinity, unsigned int * Neo);\n" +
|
|
636
|
+
|
|
637
|
+
source = "const int TheMatrix(int Trinity, unsigned int * Neo);\n" +
|
|
600
638
|
"int Morpheus(int, unsigned int*);\n"
|
|
601
|
-
|
|
639
|
+
|
|
602
640
|
expected = [{ :var_arg=>nil,
|
|
603
|
-
:return=> { :type => "int",
|
|
604
|
-
:name => 'cmock_to_return',
|
|
641
|
+
:return=> { :type => "int",
|
|
642
|
+
:name => 'cmock_to_return',
|
|
605
643
|
:ptr? => false,
|
|
606
|
-
:const? =>
|
|
644
|
+
:const? => true,
|
|
607
645
|
:str => "int cmock_to_return",
|
|
608
646
|
:void? => false
|
|
609
647
|
},
|
|
610
648
|
:name=>"TheMatrix",
|
|
611
649
|
:modifier=>"const",
|
|
612
650
|
:contains_ptr? => true,
|
|
613
|
-
:args=>[ {:type=>"int", :name=>"Trinity", :ptr? => false, :const? => false},
|
|
651
|
+
:args=>[ {:type=>"int", :name=>"Trinity", :ptr? => false, :const? => false},
|
|
614
652
|
{:type=>"unsigned int*", :name=>"Neo", :ptr? => true, :const? => false}
|
|
615
653
|
],
|
|
616
654
|
:args_string=>"int Trinity, unsigned int* Neo",
|
|
617
655
|
:args_call=>"Trinity, Neo" },
|
|
618
656
|
{ :var_arg=>nil,
|
|
619
|
-
:return=> { :type => "int",
|
|
620
|
-
:name => 'cmock_to_return',
|
|
657
|
+
:return=> { :type => "int",
|
|
658
|
+
:name => 'cmock_to_return',
|
|
621
659
|
:ptr? => false,
|
|
622
660
|
:const? => false,
|
|
623
661
|
:str => "int cmock_to_return",
|
|
@@ -626,32 +664,32 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
626
664
|
:name=>"Morpheus",
|
|
627
665
|
:modifier=>"",
|
|
628
666
|
:contains_ptr? => true,
|
|
629
|
-
:args=>[ {:type=>"int", :name=>"cmock_arg1", :ptr? => false, :const? => false},
|
|
667
|
+
:args=>[ {:type=>"int", :name=>"cmock_arg1", :ptr? => false, :const? => false},
|
|
630
668
|
{:type=>"unsigned int*", :name=>"cmock_arg2", :ptr? => true, :const? => false}
|
|
631
669
|
],
|
|
632
670
|
:args_string=>"int cmock_arg1, unsigned int* cmock_arg2",
|
|
633
|
-
:args_call=>"cmock_arg1, cmock_arg2"
|
|
671
|
+
:args_call=>"cmock_arg1, cmock_arg2"
|
|
634
672
|
}]
|
|
635
673
|
assert_equal(expected, @parser.parse("module", source)[:functions])
|
|
636
674
|
end
|
|
637
|
-
|
|
675
|
+
|
|
638
676
|
should "not extract for mocking multiply defined prototypes" do
|
|
639
|
-
|
|
640
|
-
source = "const int TheMatrix(int Trinity, unsigned int * Neo);\n" +
|
|
677
|
+
|
|
678
|
+
source = "const int TheMatrix(int Trinity, unsigned int * Neo);\n" +
|
|
641
679
|
"const int TheMatrix(int, unsigned int*);\n"
|
|
642
|
-
|
|
680
|
+
|
|
643
681
|
expected = [{ :var_arg=>nil,
|
|
644
682
|
:name=>"TheMatrix",
|
|
645
|
-
:return=> { :type => "int",
|
|
646
|
-
:name => 'cmock_to_return',
|
|
683
|
+
:return=> { :type => "int",
|
|
684
|
+
:name => 'cmock_to_return',
|
|
647
685
|
:ptr? => false,
|
|
648
|
-
:const? =>
|
|
686
|
+
:const? => true,
|
|
649
687
|
:str => "int cmock_to_return",
|
|
650
688
|
:void? => false
|
|
651
689
|
},
|
|
652
690
|
:modifier=>"const",
|
|
653
691
|
:contains_ptr? => true,
|
|
654
|
-
:args=>[ {:type=>"int", :name=>"Trinity", :ptr? => false, :const? => false},
|
|
692
|
+
:args=>[ {:type=>"int", :name=>"Trinity", :ptr? => false, :const? => false},
|
|
655
693
|
{:type=>"unsigned int*", :name=>"Neo", :ptr? => true, :const? => false}
|
|
656
694
|
],
|
|
657
695
|
:args_string=>"int Trinity, unsigned int* Neo",
|
|
@@ -659,18 +697,18 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
659
697
|
}]
|
|
660
698
|
assert_equal(expected, @parser.parse("module", source)[:functions])
|
|
661
699
|
end
|
|
662
|
-
|
|
700
|
+
|
|
663
701
|
should "properly detect typedef'd variants of void and use those" do
|
|
664
|
-
|
|
665
|
-
source = "typedef (void) FUNKY_VOID_T;\n" +
|
|
702
|
+
|
|
703
|
+
source = "typedef (void) FUNKY_VOID_T;\n" +
|
|
666
704
|
"typedef void CHUNKY_VOID_T;\n" +
|
|
667
705
|
"FUNKY_VOID_T DrHorrible(int SingAlong);\n" +
|
|
668
706
|
"int CaptainHammer(CHUNKY_VOID_T);\n"
|
|
669
|
-
|
|
707
|
+
|
|
670
708
|
expected = [{ :var_arg=>nil,
|
|
671
709
|
:name=>"DrHorrible",
|
|
672
|
-
:return => { :type => "void",
|
|
673
|
-
:name => 'cmock_to_return',
|
|
710
|
+
:return => { :type => "void",
|
|
711
|
+
:name => 'cmock_to_return',
|
|
674
712
|
:ptr? => false,
|
|
675
713
|
:const? => false,
|
|
676
714
|
:str => "void cmock_to_return",
|
|
@@ -683,8 +721,8 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
683
721
|
:args_call=>"SingAlong"
|
|
684
722
|
},
|
|
685
723
|
{ :var_arg=>nil,
|
|
686
|
-
:return=> { :type => "int",
|
|
687
|
-
:name => 'cmock_to_return',
|
|
724
|
+
:return=> { :type => "int",
|
|
725
|
+
:name => 'cmock_to_return',
|
|
688
726
|
:ptr? => false,
|
|
689
727
|
:const? => false,
|
|
690
728
|
:str => "int cmock_to_return",
|
|
@@ -699,16 +737,16 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
699
737
|
}]
|
|
700
738
|
assert_equal(expected, @parser.parse("module", source)[:functions])
|
|
701
739
|
end
|
|
702
|
-
|
|
740
|
+
|
|
703
741
|
should "be ok with structs inside of function declarations" do
|
|
704
|
-
|
|
742
|
+
|
|
705
743
|
source = "int DrHorrible(struct SingAlong Blog);\n" +
|
|
706
744
|
"void Penny(struct const _KeepYourHeadUp_ * const BillyBuddy);\n" +
|
|
707
745
|
"struct TheseArentTheHammer CaptainHammer(void);\n"
|
|
708
|
-
|
|
746
|
+
|
|
709
747
|
expected = [{ :var_arg=>nil,
|
|
710
|
-
:return =>{ :type => "int",
|
|
711
|
-
:name => 'cmock_to_return',
|
|
748
|
+
:return =>{ :type => "int",
|
|
749
|
+
:name => 'cmock_to_return',
|
|
712
750
|
:ptr? => false,
|
|
713
751
|
:const? => false,
|
|
714
752
|
:str => "int cmock_to_return",
|
|
@@ -719,11 +757,11 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
719
757
|
:contains_ptr? => false,
|
|
720
758
|
:args=>[ {:type=>"struct SingAlong", :name=>"Blog", :ptr? => false, :const? => false} ],
|
|
721
759
|
:args_string=>"struct SingAlong Blog",
|
|
722
|
-
:args_call=>"Blog"
|
|
760
|
+
:args_call=>"Blog"
|
|
723
761
|
},
|
|
724
762
|
{ :var_arg=>nil,
|
|
725
|
-
:return=> { :type => "void",
|
|
726
|
-
:name => 'cmock_to_return',
|
|
763
|
+
:return=> { :type => "void",
|
|
764
|
+
:name => 'cmock_to_return',
|
|
727
765
|
:ptr? => false,
|
|
728
766
|
:const? => false,
|
|
729
767
|
:str => "void cmock_to_return",
|
|
@@ -734,11 +772,11 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
734
772
|
:contains_ptr? => true,
|
|
735
773
|
:args=>[ {:type=>"struct _KeepYourHeadUp_*", :name=>"BillyBuddy", :ptr? => true, :const? => true} ],
|
|
736
774
|
:args_string=>"struct const _KeepYourHeadUp_* const BillyBuddy",
|
|
737
|
-
:args_call=>"BillyBuddy"
|
|
775
|
+
:args_call=>"BillyBuddy"
|
|
738
776
|
},
|
|
739
777
|
{ :var_arg=>nil,
|
|
740
|
-
:return=> { :type => "struct TheseArentTheHammer",
|
|
741
|
-
:name => 'cmock_to_return',
|
|
778
|
+
:return=> { :type => "struct TheseArentTheHammer",
|
|
779
|
+
:name => 'cmock_to_return',
|
|
742
780
|
:ptr? => false,
|
|
743
781
|
:const? => false,
|
|
744
782
|
:str => "struct TheseArentTheHammer cmock_to_return",
|
|
@@ -753,12 +791,12 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
753
791
|
}]
|
|
754
792
|
assert_equal(expected, @parser.parse("module", source)[:functions])
|
|
755
793
|
end
|
|
756
|
-
|
|
794
|
+
|
|
757
795
|
should "extract functions containing unions with union specifier" do
|
|
758
796
|
source = "void OrangePeel(union STARS_AND_STRIPES * a, union AFL_CIO b)"
|
|
759
797
|
expected = [{ :var_arg=>nil,
|
|
760
|
-
:return=>{ :type => "void",
|
|
761
|
-
:name => 'cmock_to_return',
|
|
798
|
+
:return=>{ :type => "void",
|
|
799
|
+
:name => 'cmock_to_return',
|
|
762
800
|
:ptr? => false,
|
|
763
801
|
:const? => false,
|
|
764
802
|
:str => "void cmock_to_return",
|
|
@@ -775,12 +813,12 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
775
813
|
result = @parser.parse("module", source)
|
|
776
814
|
assert_equal(expected, result[:functions])
|
|
777
815
|
end
|
|
778
|
-
|
|
816
|
+
|
|
779
817
|
should "not be thwarted by variables named with primitive types as part of the name" do
|
|
780
818
|
source = "void ApplePeel(const unsigned int const_param, int int_param, int integer, char character, int* const constant)"
|
|
781
819
|
expected = [{ :var_arg=>nil,
|
|
782
|
-
:return=>{ :type => "void",
|
|
783
|
-
:name => 'cmock_to_return',
|
|
820
|
+
:return=>{ :type => "void",
|
|
821
|
+
:name => 'cmock_to_return',
|
|
784
822
|
:ptr? => false,
|
|
785
823
|
:const? => false,
|
|
786
824
|
:str => "void cmock_to_return",
|
|
@@ -800,12 +838,12 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
800
838
|
result = @parser.parse("module", source)
|
|
801
839
|
assert_equal(expected, result[:functions])
|
|
802
840
|
end
|
|
803
|
-
|
|
804
|
-
should "not be thwarted by custom types named similarly to primitive types" do
|
|
841
|
+
|
|
842
|
+
should "not be thwarted by custom types named similarly to primitive types" do
|
|
805
843
|
source = "void LemonPeel(integer param, character thing, longint * junk, constant value, int32_t const number)"
|
|
806
844
|
expected = [{:var_arg=>nil,
|
|
807
|
-
:return=>{ :type => "void",
|
|
808
|
-
:name => 'cmock_to_return',
|
|
845
|
+
:return=>{ :type => "void",
|
|
846
|
+
:name => 'cmock_to_return',
|
|
809
847
|
:ptr? => false,
|
|
810
848
|
:const? => false,
|
|
811
849
|
:str => "void cmock_to_return",
|
|
@@ -825,12 +863,12 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
825
863
|
result = @parser.parse("module", source)
|
|
826
864
|
assert_equal(expected, result[:functions])
|
|
827
865
|
end
|
|
828
|
-
|
|
866
|
+
|
|
829
867
|
should "handle some of those chains of C name specifiers naturally" do
|
|
830
868
|
source = "void CoinOperated(signed char abc, const unsigned long int xyz_123, unsigned int const abc_123, long long arm_of_the_law)"
|
|
831
869
|
expected = [{:var_arg=>nil,
|
|
832
|
-
:return=>{ :type => "void",
|
|
833
|
-
:name => 'cmock_to_return',
|
|
870
|
+
:return=>{ :type => "void",
|
|
871
|
+
:name => 'cmock_to_return',
|
|
834
872
|
:ptr? => false,
|
|
835
873
|
:const? => false,
|
|
836
874
|
:str => "void cmock_to_return",
|
|
@@ -849,12 +887,12 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
849
887
|
result = @parser.parse("module", source)
|
|
850
888
|
assert_equal(expected, result[:functions])
|
|
851
889
|
end
|
|
852
|
-
|
|
853
|
-
should "handle custom types of various formats" do
|
|
890
|
+
|
|
891
|
+
should "handle custom types of various formats" do
|
|
854
892
|
source = "void CardOperated(CUSTOM_TYPE abc, CUSTOM_TYPE* xyz_123, CUSTOM_TYPE const abcxyz, struct CUSTOM_TYPE const * const abc123)"
|
|
855
893
|
expected = [{:var_arg=>nil,
|
|
856
|
-
:return=>{ :type => "void",
|
|
857
|
-
:name => 'cmock_to_return',
|
|
894
|
+
:return=>{ :type => "void",
|
|
895
|
+
:name => 'cmock_to_return',
|
|
858
896
|
:ptr? => false,
|
|
859
897
|
:const? => false,
|
|
860
898
|
:str => "void cmock_to_return",
|
|
@@ -873,12 +911,12 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
873
911
|
result = @parser.parse("module", source)
|
|
874
912
|
assert_equal(expected, result[:functions])
|
|
875
913
|
end
|
|
876
|
-
|
|
914
|
+
|
|
877
915
|
should "handle arrays and treat them as pointers" do
|
|
878
916
|
source = "void KeyOperated(CUSTOM_TYPE thing1[], int thing2 [ ], char thing3 [][2 ][ 3], int* thing4[4])"
|
|
879
917
|
expected = [{:var_arg=>nil,
|
|
880
|
-
:return=>{ :type => "void",
|
|
881
|
-
:name => 'cmock_to_return',
|
|
918
|
+
:return=>{ :type => "void",
|
|
919
|
+
:name => 'cmock_to_return',
|
|
882
920
|
:ptr? => false,
|
|
883
921
|
:const? => false,
|
|
884
922
|
:str => "void cmock_to_return",
|
|
@@ -897,12 +935,12 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
897
935
|
result = @parser.parse("module", source)
|
|
898
936
|
assert_equal(expected, result[:functions])
|
|
899
937
|
end
|
|
900
|
-
|
|
901
|
-
should "give a reasonable guess when dealing with weird combinations of custom types and modifiers" do
|
|
938
|
+
|
|
939
|
+
should "give a reasonable guess when dealing with weird combinations of custom types and modifiers" do
|
|
902
940
|
source = "void Cheese(unsigned CUSTOM_TYPE abc, unsigned xyz, CUSTOM_TYPE1 CUSTOM_TYPE2 pdq)"
|
|
903
941
|
expected = [{:var_arg=>nil,
|
|
904
|
-
:return=>{ :type => "void",
|
|
905
|
-
:name => 'cmock_to_return',
|
|
942
|
+
:return=>{ :type => "void",
|
|
943
|
+
:name => 'cmock_to_return',
|
|
906
944
|
:ptr? => false,
|
|
907
945
|
:const? => false,
|
|
908
946
|
:str => "void cmock_to_return",
|
|
@@ -920,12 +958,12 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
920
958
|
result = @parser.parse("module", source)
|
|
921
959
|
assert_equal(expected, result[:functions])
|
|
922
960
|
end
|
|
923
|
-
|
|
961
|
+
|
|
924
962
|
should "extract functions containing a function pointer" do
|
|
925
963
|
source = "void FunkyTurkey(unsigned int (*func_ptr)(int, char))"
|
|
926
964
|
expected = [{ :var_arg=>nil,
|
|
927
|
-
:return=>{ :type => "void",
|
|
928
|
-
:name => 'cmock_to_return',
|
|
965
|
+
:return=>{ :type => "void",
|
|
966
|
+
:name => 'cmock_to_return',
|
|
929
967
|
:ptr? => false,
|
|
930
968
|
:const? => false,
|
|
931
969
|
:str => "void cmock_to_return",
|
|
@@ -943,12 +981,12 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
943
981
|
assert_equal(expected, result[:functions])
|
|
944
982
|
assert_equal(typedefs, result[:typedefs])
|
|
945
983
|
end
|
|
946
|
-
|
|
984
|
+
|
|
947
985
|
should "extract functions containing a function pointer with an implied void" do
|
|
948
986
|
source = "void FunkyTurkey(unsigned int (*func_ptr)())"
|
|
949
987
|
expected = [{ :var_arg=>nil,
|
|
950
|
-
:return=>{ :type => "void",
|
|
951
|
-
:name => 'cmock_to_return',
|
|
988
|
+
:return=>{ :type => "void",
|
|
989
|
+
:name => 'cmock_to_return',
|
|
952
990
|
:ptr? => false,
|
|
953
991
|
:const? => false,
|
|
954
992
|
:str => "void cmock_to_return",
|
|
@@ -966,12 +1004,12 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
966
1004
|
assert_equal(expected, result[:functions])
|
|
967
1005
|
assert_equal(typedefs, result[:typedefs])
|
|
968
1006
|
end
|
|
969
|
-
|
|
1007
|
+
|
|
970
1008
|
should "extract functions containing a constant function pointer and a pointer in the nested arg list" do
|
|
971
1009
|
source = "void FunkyChicken(unsigned int (* const func_ptr)(unsigned long int * , char))"
|
|
972
1010
|
expected = [{ :var_arg=>nil,
|
|
973
|
-
:return=>{ :type => "void",
|
|
974
|
-
:name => 'cmock_to_return',
|
|
1011
|
+
:return=>{ :type => "void",
|
|
1012
|
+
:name => 'cmock_to_return',
|
|
975
1013
|
:ptr? => false,
|
|
976
1014
|
:const? => false,
|
|
977
1015
|
:str => "void cmock_to_return",
|
|
@@ -989,12 +1027,12 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
989
1027
|
assert_equal(expected, result[:functions])
|
|
990
1028
|
assert_equal(typedefs, result[:typedefs])
|
|
991
1029
|
end
|
|
992
|
-
|
|
1030
|
+
|
|
993
1031
|
# should "extract functions containing a function pointer taking a vararg" do
|
|
994
1032
|
# source = "void FunkyParrot(unsigned int (*func_ptr)(int, char, ...))"
|
|
995
1033
|
# expected = [{ :var_arg=>nil,
|
|
996
|
-
# :return=>{ :type => "void",
|
|
997
|
-
# :name => 'cmock_to_return',
|
|
1034
|
+
# :return=>{ :type => "void",
|
|
1035
|
+
# :name => 'cmock_to_return',
|
|
998
1036
|
# :ptr? => false,
|
|
999
1037
|
# :const? => false,
|
|
1000
1038
|
# :str => "void cmock_to_return",
|
|
@@ -1012,12 +1050,12 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
1012
1050
|
# assert_equal(expected, result[:functions])
|
|
1013
1051
|
# assert_equal(typedefs, result[:typedefs])
|
|
1014
1052
|
# end
|
|
1015
|
-
|
|
1053
|
+
|
|
1016
1054
|
should "extract functions containing a function pointer with extra parenthesis and two sets" do
|
|
1017
1055
|
source = "void FunkyBudgie(int (((* func_ptr1)(int, char))), void (*func_ptr2)(void))"
|
|
1018
1056
|
expected = [{ :var_arg=>nil,
|
|
1019
|
-
:return=>{ :type => "void",
|
|
1020
|
-
:name => 'cmock_to_return',
|
|
1057
|
+
:return=>{ :type => "void",
|
|
1058
|
+
:name => 'cmock_to_return',
|
|
1021
1059
|
:ptr? => false,
|
|
1022
1060
|
:const? => false,
|
|
1023
1061
|
:str => "void cmock_to_return",
|
|
@@ -1036,12 +1074,37 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
1036
1074
|
assert_equal(expected, result[:functions])
|
|
1037
1075
|
assert_equal(typedefs, result[:typedefs])
|
|
1038
1076
|
end
|
|
1039
|
-
|
|
1077
|
+
|
|
1078
|
+
should "extract functions containing a function pointers, structs and other things" do
|
|
1079
|
+
source = "struct mytype *FunkyRobin(uint16_t num1, uint16_t num2, void (*func_ptr1)(uint16_t num3, struct mytype2 *s));"
|
|
1080
|
+
expected = [{ :var_arg=>nil,
|
|
1081
|
+
:return=>{ :type => "struct mytype*",
|
|
1082
|
+
:name => 'cmock_to_return',
|
|
1083
|
+
:ptr? => true,
|
|
1084
|
+
:const? => false,
|
|
1085
|
+
:str => "struct mytype* cmock_to_return",
|
|
1086
|
+
:void? => false
|
|
1087
|
+
},
|
|
1088
|
+
:name=>"FunkyRobin",
|
|
1089
|
+
:modifier=>"",
|
|
1090
|
+
:contains_ptr? => false,
|
|
1091
|
+
:args=>[ {:type=>"uint16_t", :name=>"num1", :ptr? => false, :const? => false},
|
|
1092
|
+
{:type=>"uint16_t", :name=>"num2", :ptr? => false, :const? => false},
|
|
1093
|
+
{:type=>"cmock_module_func_ptr1", :name=>"func_ptr1", :ptr? => false, :const? => false}
|
|
1094
|
+
],
|
|
1095
|
+
:args_string=>"uint16_t num1, uint16_t num2, cmock_module_func_ptr1 func_ptr1",
|
|
1096
|
+
:args_call=>"num1, num2, func_ptr1" }]
|
|
1097
|
+
typedefs = ["typedef void(*cmock_module_func_ptr1)(uint16_t num3, struct mytype2* s);"]
|
|
1098
|
+
result = @parser.parse("module", source)
|
|
1099
|
+
assert_equal(expected, result[:functions])
|
|
1100
|
+
assert_equal(typedefs, result[:typedefs])
|
|
1101
|
+
end
|
|
1102
|
+
|
|
1040
1103
|
should "extract functions containing an anonymous function pointer" do
|
|
1041
1104
|
source = "void FunkyFowl(unsigned int (* const)(int, char))"
|
|
1042
1105
|
expected = [{ :var_arg=>nil,
|
|
1043
|
-
:return=>{ :type => "void",
|
|
1044
|
-
:name => 'cmock_to_return',
|
|
1106
|
+
:return=>{ :type => "void",
|
|
1107
|
+
:name => 'cmock_to_return',
|
|
1045
1108
|
:ptr? => false,
|
|
1046
1109
|
:const? => false,
|
|
1047
1110
|
:str => "void cmock_to_return",
|
|
@@ -1059,12 +1122,12 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
1059
1122
|
assert_equal(expected, result[:functions])
|
|
1060
1123
|
assert_equal(typedefs, result[:typedefs])
|
|
1061
1124
|
end
|
|
1062
|
-
|
|
1125
|
+
|
|
1063
1126
|
should "extract functions returning a function pointer" do
|
|
1064
1127
|
source = "unsigned short (*FunkyPidgeon( const char op_code ))( int, long int )"
|
|
1065
1128
|
expected = [{ :var_arg=>nil,
|
|
1066
|
-
:return=>{ :type => "cmock_module_func_ptr1",
|
|
1067
|
-
:name => 'cmock_to_return',
|
|
1129
|
+
:return=>{ :type => "cmock_module_func_ptr1",
|
|
1130
|
+
:name => 'cmock_to_return',
|
|
1068
1131
|
:ptr? => false,
|
|
1069
1132
|
:const? => false,
|
|
1070
1133
|
:str => "cmock_module_func_ptr1 cmock_to_return",
|
|
@@ -1082,12 +1145,12 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
1082
1145
|
assert_equal(expected, result[:functions])
|
|
1083
1146
|
assert_equal(typedefs, result[:typedefs])
|
|
1084
1147
|
end
|
|
1085
|
-
|
|
1148
|
+
|
|
1086
1149
|
should "extract functions returning a function pointer with implied void" do
|
|
1087
1150
|
source = "unsigned short (*FunkyTweetie())()"
|
|
1088
1151
|
expected = [{ :var_arg=>nil,
|
|
1089
|
-
:return=>{ :type => "cmock_module_func_ptr1",
|
|
1090
|
-
:name => 'cmock_to_return',
|
|
1152
|
+
:return=>{ :type => "cmock_module_func_ptr1",
|
|
1153
|
+
:name => 'cmock_to_return',
|
|
1091
1154
|
:ptr? => false,
|
|
1092
1155
|
:const? => false,
|
|
1093
1156
|
:str => "cmock_module_func_ptr1 cmock_to_return",
|
|
@@ -1104,12 +1167,12 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
1104
1167
|
assert_equal(expected, result[:functions])
|
|
1105
1168
|
assert_equal(typedefs, result[:typedefs])
|
|
1106
1169
|
end
|
|
1107
|
-
|
|
1170
|
+
|
|
1108
1171
|
should "extract functions returning a function pointer where everything is a void" do
|
|
1109
1172
|
source = "void (* FunkySeaGull(void))(void)"
|
|
1110
1173
|
expected = [{ :var_arg=>nil,
|
|
1111
|
-
:return=>{ :type => "cmock_module_func_ptr1",
|
|
1112
|
-
:name => 'cmock_to_return',
|
|
1174
|
+
:return=>{ :type => "cmock_module_func_ptr1",
|
|
1175
|
+
:name => 'cmock_to_return',
|
|
1113
1176
|
:ptr? => false,
|
|
1114
1177
|
:const? => false,
|
|
1115
1178
|
:str => "cmock_module_func_ptr1 cmock_to_return",
|
|
@@ -1126,12 +1189,12 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
1126
1189
|
assert_equal(expected, result[:functions])
|
|
1127
1190
|
assert_equal(typedefs, result[:typedefs])
|
|
1128
1191
|
end
|
|
1129
|
-
|
|
1192
|
+
|
|
1130
1193
|
should "extract functions returning a function pointer with some pointer nonsense" do
|
|
1131
1194
|
source = "unsigned int * (* FunkyMacaw(double* foo, THING *bar))(unsigned int)"
|
|
1132
1195
|
expected = [{ :var_arg=>nil,
|
|
1133
|
-
:return=>{ :type => "cmock_module_func_ptr1",
|
|
1134
|
-
:name => 'cmock_to_return',
|
|
1196
|
+
:return=>{ :type => "cmock_module_func_ptr1",
|
|
1197
|
+
:name => 'cmock_to_return',
|
|
1135
1198
|
:ptr? => false,
|
|
1136
1199
|
:const? => false,
|
|
1137
1200
|
:str => "cmock_module_func_ptr1 cmock_to_return",
|
|
@@ -1150,7 +1213,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
1150
1213
|
assert_equal(expected, result[:functions])
|
|
1151
1214
|
assert_equal(typedefs, result[:typedefs])
|
|
1152
1215
|
end
|
|
1153
|
-
|
|
1216
|
+
|
|
1154
1217
|
should "extract this SQLite3 function with an anonymous function pointer arg (regression test)" do
|
|
1155
1218
|
source = "SQLITE_API int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void(*)(void*))"
|
|
1156
1219
|
expected = [{ :var_arg=>nil,
|
|
@@ -1177,12 +1240,12 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
1177
1240
|
assert_equal(expected, result[:functions])
|
|
1178
1241
|
assert_equal(typedefs, result[:typedefs])
|
|
1179
1242
|
end
|
|
1180
|
-
|
|
1243
|
+
|
|
1181
1244
|
should "extract functions with varargs" do
|
|
1182
1245
|
source = "int XFiles(int Scully, int Mulder, ...);\n"
|
|
1183
1246
|
expected = [{ :var_arg=>"...",
|
|
1184
|
-
:return=> { :type => "int",
|
|
1185
|
-
:name => 'cmock_to_return',
|
|
1247
|
+
:return=> { :type => "int",
|
|
1248
|
+
:name => 'cmock_to_return',
|
|
1186
1249
|
:ptr? => false,
|
|
1187
1250
|
:const? => false,
|
|
1188
1251
|
:str => "int cmock_to_return",
|
|
@@ -1191,7 +1254,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
1191
1254
|
:name=>"XFiles",
|
|
1192
1255
|
:modifier=>"",
|
|
1193
1256
|
:contains_ptr? => false,
|
|
1194
|
-
:args=>[ {:type=>"int", :name=>"Scully", :ptr? => false, :const? => false},
|
|
1257
|
+
:args=>[ {:type=>"int", :name=>"Scully", :ptr? => false, :const? => false},
|
|
1195
1258
|
{:type=>"int", :name=>"Mulder", :ptr? => false, :const? => false}
|
|
1196
1259
|
],
|
|
1197
1260
|
:args_string=>"int Scully, int Mulder",
|
|
@@ -1199,12 +1262,12 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
1199
1262
|
}]
|
|
1200
1263
|
assert_equal(expected, @parser.parse("module", source)[:functions])
|
|
1201
1264
|
end
|
|
1202
|
-
|
|
1265
|
+
|
|
1203
1266
|
should "extract functions with strippable confusing junk like gcc attributes" do
|
|
1204
1267
|
source = "int LaverneAndShirley(int Lenny, int Squiggy) __attribute__((weak)) __attribute__ ((deprecated));\n"
|
|
1205
1268
|
expected = [{ :var_arg=>nil,
|
|
1206
|
-
:return=> { :type => "int",
|
|
1207
|
-
:name => 'cmock_to_return',
|
|
1269
|
+
:return=> { :type => "int",
|
|
1270
|
+
:name => 'cmock_to_return',
|
|
1208
1271
|
:ptr? => false,
|
|
1209
1272
|
:const? => false,
|
|
1210
1273
|
:str => "int cmock_to_return",
|
|
@@ -1213,7 +1276,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
1213
1276
|
:name=>"LaverneAndShirley",
|
|
1214
1277
|
:modifier=>"",
|
|
1215
1278
|
:contains_ptr? => false,
|
|
1216
|
-
:args=>[ {:type=>"int", :name=>"Lenny", :ptr? => false, :const? => false},
|
|
1279
|
+
:args=>[ {:type=>"int", :name=>"Lenny", :ptr? => false, :const? => false},
|
|
1217
1280
|
{:type=>"int", :name=>"Squiggy", :ptr? => false, :const? => false}
|
|
1218
1281
|
],
|
|
1219
1282
|
:args_string=>"int Lenny, int Squiggy",
|
|
@@ -1221,12 +1284,12 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
1221
1284
|
}]
|
|
1222
1285
|
assert_equal(expected, @parser.parse("module", source)[:functions])
|
|
1223
1286
|
end
|
|
1224
|
-
|
|
1287
|
+
|
|
1225
1288
|
should "extract functions with strippable confusing junk like gcc attributes with parenthesis" do
|
|
1226
1289
|
source = "int TheCosbyShow(int Cliff, int Claire) __attribute__((weak, alias (\"__f\"));\n"
|
|
1227
1290
|
expected = [{ :var_arg=>nil,
|
|
1228
|
-
:return=> { :type => "int",
|
|
1229
|
-
:name => 'cmock_to_return',
|
|
1291
|
+
:return=> { :type => "int",
|
|
1292
|
+
:name => 'cmock_to_return',
|
|
1230
1293
|
:ptr? => false,
|
|
1231
1294
|
:const? => false,
|
|
1232
1295
|
:str => "int cmock_to_return",
|
|
@@ -1235,7 +1298,7 @@ class CMockHeaderParserTest < Test::Unit::TestCase
|
|
|
1235
1298
|
:name=>"TheCosbyShow",
|
|
1236
1299
|
:modifier=>"",
|
|
1237
1300
|
:contains_ptr? => false,
|
|
1238
|
-
:args=>[ {:type=>"int", :name=>"Cliff", :ptr? => false, :const? => false},
|
|
1301
|
+
:args=>[ {:type=>"int", :name=>"Cliff", :ptr? => false, :const? => false},
|
|
1239
1302
|
{:type=>"int", :name=>"Claire", :ptr? => false, :const? => false}
|
|
1240
1303
|
],
|
|
1241
1304
|
:args_string=>"int Cliff, int Claire",
|