ceedling 0.29.1 → 0.30.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/Gemfile +15 -16
- data/Gemfile.lock +1 -1
- data/README.md +108 -107
- data/Rakefile +11 -11
- data/assets/ceedling +3 -3
- data/assets/ceedling.cmd +0 -0
- data/assets/default_gitignore +5 -5
- data/assets/example_file.c +5 -5
- data/assets/example_file.h +6 -6
- data/assets/project_as_gem.yml +101 -97
- data/assets/project_with_guts.yml +102 -98
- data/assets/project_with_guts_gcov.yml +102 -98
- data/assets/project_with_guts_gcov_abortonuncovered.yml +93 -0
- data/assets/test_example_file.c +13 -13
- data/assets/test_example_file_boom.c +13 -13
- data/assets/test_example_file_success.c +14 -14
- data/assets/test_example_file_verbose.c +12 -12
- data/assets/uncovered_example_file.c +5 -0
- data/bin/ceedling +351 -339
- data/ceedling.gemspec +52 -36
- data/config/test_environment.rb +11 -11
- data/docs/Ceedling Basic Porting.pdf +0 -0
- data/docs/Ceedling Managing Release Code.pdf +0 -0
- data/docs/Ceedling Powerful Plugins.pdf +0 -0
- data/docs/Ceedling Working with IDEs.pdf +0 -0
- data/docs/CeedlingPacket.md +2213 -2134
- data/docs/CeedlingUpgrade.md +83 -83
- data/docs/ThrowTheSwitchCodingStandard.md +207 -207
- data/examples/blinky/project.yml +99 -99
- data/examples/blinky/rakefile.rb +31 -31
- data/examples/blinky/src/BlinkTask.c +21 -21
- data/examples/blinky/src/BlinkTask.h +6 -6
- data/examples/blinky/src/Configure.c +36 -36
- data/examples/blinky/src/Configure.h +6 -6
- data/examples/blinky/src/main.c +51 -51
- data/examples/blinky/src/main.h +9 -9
- data/examples/blinky/test/support/stub_interrupt.h +347 -347
- data/examples/blinky/test/support/stub_io.h +421 -421
- data/examples/blinky/test/support/stub_iom328p.h +883 -883
- data/examples/blinky/test/support/stub_sfr_defs.h +269 -269
- data/examples/blinky/test/test_BlinkTask.c +42 -42
- data/examples/blinky/test/test_Configure.c +29 -29
- data/examples/blinky/test/test_main.c +60 -60
- data/examples/temp_sensor/project.yml +66 -76
- data/examples/temp_sensor/rakefile.rb +6 -6
- data/examples/temp_sensor/src/AdcConductor.c +42 -42
- data/examples/temp_sensor/src/AdcConductor.h +13 -13
- data/examples/temp_sensor/src/AdcHardware.c +27 -27
- data/examples/temp_sensor/src/AdcHardware.h +11 -11
- data/examples/temp_sensor/src/AdcHardwareConfigurator.c +18 -18
- data/examples/temp_sensor/src/AdcHardwareConfigurator.h +10 -10
- data/examples/temp_sensor/src/AdcModel.c +33 -33
- data/examples/temp_sensor/src/AdcModel.h +13 -13
- data/examples/temp_sensor/src/AdcTemperatureSensor.c +51 -51
- data/examples/temp_sensor/src/AdcTemperatureSensor.h +10 -10
- data/examples/temp_sensor/src/Executor.c +25 -25
- data/examples/temp_sensor/src/Executor.h +9 -9
- data/examples/temp_sensor/src/IntrinsicsWrapper.c +18 -18
- data/examples/temp_sensor/src/IntrinsicsWrapper.h +7 -7
- data/examples/temp_sensor/src/Main.c +46 -46
- data/examples/temp_sensor/src/Main.h +7 -7
- data/examples/temp_sensor/src/Model.c +10 -10
- data/examples/temp_sensor/src/Model.h +8 -8
- data/examples/temp_sensor/src/ModelConfig.h +7 -7
- data/examples/temp_sensor/src/TaskScheduler.c +72 -72
- data/examples/temp_sensor/src/TaskScheduler.h +11 -11
- data/examples/temp_sensor/src/TemperatureCalculator.c +27 -27
- data/examples/temp_sensor/src/TemperatureCalculator.h +8 -8
- data/examples/temp_sensor/src/TemperatureFilter.c +38 -38
- data/examples/temp_sensor/src/TemperatureFilter.h +10 -10
- data/examples/temp_sensor/src/TimerConductor.c +15 -15
- data/examples/temp_sensor/src/TimerConductor.h +9 -9
- data/examples/temp_sensor/src/TimerConfigurator.c +51 -51
- data/examples/temp_sensor/src/TimerConfigurator.h +15 -15
- data/examples/temp_sensor/src/TimerHardware.c +15 -15
- data/examples/temp_sensor/src/TimerHardware.h +8 -8
- data/examples/temp_sensor/src/TimerInterruptConfigurator.c +55 -55
- data/examples/temp_sensor/src/TimerInterruptConfigurator.h +13 -13
- data/examples/temp_sensor/src/TimerInterruptHandler.c +25 -25
- data/examples/temp_sensor/src/TimerInterruptHandler.h +10 -10
- data/examples/temp_sensor/src/TimerModel.c +9 -9
- data/examples/temp_sensor/src/TimerModel.h +8 -8
- data/examples/temp_sensor/src/Types.h +90 -90
- data/examples/temp_sensor/src/UsartBaudRateRegisterCalculator.c +18 -18
- data/examples/temp_sensor/src/UsartBaudRateRegisterCalculator.h +8 -8
- data/examples/temp_sensor/src/UsartConductor.c +21 -21
- data/examples/temp_sensor/src/UsartConductor.h +7 -7
- data/examples/temp_sensor/src/UsartConfigurator.c +39 -39
- data/examples/temp_sensor/src/UsartConfigurator.h +13 -13
- data/examples/temp_sensor/src/UsartHardware.c +22 -22
- data/examples/temp_sensor/src/UsartHardware.h +9 -9
- data/examples/temp_sensor/src/UsartModel.c +34 -34
- data/examples/temp_sensor/src/UsartModel.h +10 -10
- data/examples/temp_sensor/src/UsartPutChar.c +16 -16
- data/examples/temp_sensor/src/UsartPutChar.h +8 -8
- data/examples/temp_sensor/src/UsartTransmitBufferStatus.c +7 -7
- data/examples/temp_sensor/src/UsartTransmitBufferStatus.h +8 -8
- data/examples/temp_sensor/test/TestAdcConductor.c +121 -121
- data/examples/temp_sensor/test/TestAdcHardware.c +44 -44
- data/examples/temp_sensor/test/TestAdcModel.c +33 -33
- data/examples/temp_sensor/test/TestExecutor.c +36 -36
- data/examples/temp_sensor/test/TestMain.c +24 -24
- data/examples/temp_sensor/test/TestModel.c +20 -20
- data/examples/temp_sensor/test/TestTaskScheduler.c +104 -104
- data/examples/temp_sensor/test/TestTemperatureCalculator.c +36 -36
- data/examples/temp_sensor/test/TestTemperatureFilter.c +79 -79
- data/examples/temp_sensor/test/TestTimerConductor.c +32 -32
- data/examples/temp_sensor/test/TestTimerHardware.c +26 -26
- data/examples/temp_sensor/test/TestTimerModel.c +18 -18
- data/examples/temp_sensor/test/TestUsartBaudRateRegisterCalculator.c +21 -21
- data/examples/temp_sensor/test/TestUsartConductor.c +40 -40
- data/examples/temp_sensor/test/TestUsartHardware.c +36 -36
- data/examples/temp_sensor/test/TestUsartModel.c +40 -40
- data/examples/temp_sensor/test/support/UnityHelper.c +12 -12
- data/examples/temp_sensor/test/support/UnityHelper.h +12 -12
- data/lib/ceedling.rb +99 -99
- data/lib/ceedling/build_invoker_utils.rb +39 -39
- data/lib/ceedling/cacheinator.rb +47 -47
- data/lib/ceedling/cacheinator_helper.rb +35 -31
- data/lib/ceedling/cmock_builder.rb +15 -15
- data/lib/ceedling/configurator.rb +372 -363
- data/lib/ceedling/configurator_builder.rb +463 -458
- data/lib/ceedling/configurator_plugins.rb +111 -111
- data/lib/ceedling/configurator_setup.rb +127 -127
- data/lib/ceedling/configurator_validator.rb +193 -193
- data/lib/ceedling/constants.rb +99 -97
- data/lib/ceedling/defaults.rb +447 -418
- data/lib/ceedling/dependinator.rb +97 -98
- data/lib/ceedling/erb_wrapper.rb +8 -8
- data/lib/ceedling/file_finder.rb +149 -149
- data/lib/ceedling/file_finder_helper.rb +56 -54
- data/lib/ceedling/file_path_utils.rb +202 -200
- data/lib/ceedling/file_system_utils.rb +69 -69
- data/lib/ceedling/file_system_wrapper.rb +9 -9
- data/lib/ceedling/file_wrapper.rb +83 -83
- data/lib/ceedling/flaginator.rb +74 -74
- data/lib/ceedling/generator.rb +186 -183
- data/lib/ceedling/generator_helper.rb +40 -40
- data/lib/ceedling/generator_test_results.rb +100 -100
- data/lib/ceedling/generator_test_results_sanity_checker.rb +65 -65
- data/lib/ceedling/generator_test_runner.rb +58 -56
- data/lib/ceedling/loginator.rb +31 -31
- data/lib/ceedling/makefile.rb +46 -46
- data/lib/ceedling/objects.yml +311 -310
- data/lib/ceedling/par_map.rb +19 -19
- data/lib/ceedling/plugin.rb +80 -80
- data/lib/ceedling/plugin_builder.rb +52 -52
- data/lib/ceedling/plugin_manager.rb +107 -107
- data/lib/ceedling/plugin_manager_helper.rb +19 -19
- data/lib/ceedling/plugin_reportinator.rb +76 -76
- data/lib/ceedling/plugin_reportinator_helper.rb +51 -51
- data/lib/ceedling/preprocessinator.rb +47 -42
- data/lib/ceedling/preprocessinator_extractor.rb +30 -30
- data/lib/ceedling/preprocessinator_file_handler.rb +21 -21
- data/lib/ceedling/preprocessinator_helper.rb +50 -46
- data/lib/ceedling/preprocessinator_includes_handler.rb +181 -181
- data/lib/ceedling/project_config_manager.rb +52 -46
- data/lib/ceedling/project_file_loader.rb +99 -99
- data/lib/ceedling/rake_utils.rb +17 -17
- data/lib/ceedling/rake_wrapper.rb +33 -33
- data/lib/ceedling/rakefile.rb +86 -86
- data/lib/ceedling/release_invoker.rb +98 -73
- data/lib/ceedling/release_invoker_helper.rb +19 -19
- data/lib/ceedling/reportinator.rb +26 -26
- data/lib/ceedling/rules_cmock.rake +9 -9
- data/lib/ceedling/rules_preprocess.rake +26 -26
- data/lib/ceedling/rules_release.rake +99 -86
- data/lib/ceedling/rules_release_deep_dependencies.rake +15 -15
- data/lib/ceedling/rules_tests.rake +73 -74
- data/lib/ceedling/rules_tests_deep_dependencies.rake +15 -15
- data/lib/ceedling/setupinator.rb +53 -53
- data/lib/ceedling/stream_wrapper.rb +28 -28
- data/lib/ceedling/streaminator.rb +40 -40
- data/lib/ceedling/streaminator_helper.rb +15 -15
- data/lib/ceedling/system_utils.rb +37 -37
- data/lib/ceedling/system_wrapper.rb +80 -80
- data/lib/ceedling/target_loader.rb +38 -38
- data/lib/ceedling/task_invoker.rb +122 -117
- data/lib/ceedling/tasks_base.rake +116 -105
- data/lib/ceedling/tasks_filesystem.rake +113 -112
- data/lib/ceedling/tasks_release.rake +30 -30
- data/lib/ceedling/tasks_release_deep_dependencies.rake +9 -9
- data/lib/ceedling/tasks_tests.rake +60 -60
- data/lib/ceedling/tasks_tests_deep_dependencies.rake +9 -9
- data/lib/ceedling/tasks_vendor.rake +35 -35
- data/lib/ceedling/test_includes_extractor.rb +111 -85
- data/lib/ceedling/test_invoker.rb +164 -188
- data/lib/ceedling/test_invoker_helper.rb +32 -32
- data/lib/ceedling/tool_executor.rb +229 -229
- data/lib/ceedling/tool_executor_helper.rb +164 -164
- data/lib/ceedling/verbosinator.rb +10 -10
- data/lib/ceedling/version.rb +50 -50
- data/lib/ceedling/yaml_wrapper.rb +17 -17
- data/license.txt +31 -31
- data/plugins/beep/README.md +22 -22
- data/plugins/beep/lib/beep.rb +40 -40
- data/plugins/bullseye/README.md +76 -0
- data/plugins/bullseye/assets/template.erb +15 -15
- data/plugins/bullseye/bullseye.rake +173 -169
- data/plugins/bullseye/config/defaults.yml +57 -57
- data/plugins/bullseye/lib/bullseye.rb +194 -194
- data/plugins/colour_report/README.md +20 -0
- data/plugins/colour_report/lib/colour_report.rb +16 -16
- data/plugins/command_hooks/README.md +53 -53
- data/plugins/command_hooks/lib/command_hooks.rb +92 -92
- data/plugins/compile_commands_json/README.md +29 -0
- data/plugins/compile_commands_json/lib/compile_commands_json.rb +35 -0
- data/plugins/dependencies/README.md +254 -0
- data/plugins/dependencies/config/defaults.yml +5 -0
- data/plugins/dependencies/dependencies.rake +144 -0
- data/plugins/dependencies/lib/dependencies.rb +231 -0
- data/plugins/fake_function_framework/README.md +250 -250
- data/plugins/fake_function_framework/Rakefile +18 -18
- data/plugins/fake_function_framework/examples/fff_example/project.yml +71 -71
- data/plugins/fake_function_framework/examples/fff_example/rakefile.rb +7 -7
- data/plugins/fake_function_framework/examples/fff_example/src/bar.c +1 -1
- data/plugins/fake_function_framework/examples/fff_example/src/bar.h +14 -14
- data/plugins/fake_function_framework/examples/fff_example/src/custom_types.h +6 -6
- data/plugins/fake_function_framework/examples/fff_example/src/display.c +6 -6
- data/plugins/fake_function_framework/examples/fff_example/src/display.h +16 -16
- data/plugins/fake_function_framework/examples/fff_example/src/event_processor.c +93 -93
- data/plugins/fake_function_framework/examples/fff_example/src/event_processor.h +11 -11
- data/plugins/fake_function_framework/examples/fff_example/src/foo.c +16 -16
- data/plugins/fake_function_framework/examples/fff_example/src/foo.h +8 -8
- data/plugins/fake_function_framework/examples/fff_example/src/subfolder/zzz.c +1 -1
- data/plugins/fake_function_framework/examples/fff_example/src/subfolder/zzz.h +6 -6
- data/plugins/fake_function_framework/examples/fff_example/test/test_event_processor.c +155 -155
- data/plugins/fake_function_framework/examples/fff_example/test/test_foo.c +47 -47
- data/plugins/fake_function_framework/lib/fake_function_framework.rb +87 -87
- data/plugins/fake_function_framework/lib/fff_mock_generator.rb +163 -163
- data/plugins/fake_function_framework/spec/fff_mock_header_generator_spec.rb +304 -304
- data/plugins/fake_function_framework/spec/fff_mock_source_generator_spec.rb +148 -148
- data/plugins/fake_function_framework/spec/header_generator.rb +50 -50
- data/plugins/fake_function_framework/spec/spec_helper.rb +96 -96
- data/plugins/fake_function_framework/src/fff_unity_helper.h +32 -32
- data/plugins/gcov/README.md +412 -101
- data/plugins/gcov/assets/template.erb +15 -15
- data/plugins/gcov/config/defaults.yml +51 -73
- data/plugins/gcov/gcov.rake +209 -220
- data/plugins/gcov/lib/gcov.rb +133 -113
- data/plugins/gcov/lib/gcov_constants.rb +48 -19
- data/plugins/gcov/lib/gcovr_reportinator.rb +331 -0
- data/plugins/gcov/lib/reportgenerator_reportinator.rb +153 -0
- data/plugins/gcov/lib/reportinator_helper.rb +15 -0
- data/plugins/json_tests_report/README.md +36 -0
- data/plugins/json_tests_report/lib/json_tests_report.rb +83 -0
- data/plugins/junit_tests_report/README.md +36 -36
- data/plugins/junit_tests_report/lib/junit_tests_report.rb +134 -130
- data/plugins/module_generator/README.md +105 -0
- data/plugins/module_generator/config/module_generator.yml +3 -3
- data/plugins/module_generator/lib/module_generator.rb +79 -70
- data/plugins/module_generator/module_generator.rake +62 -47
- data/plugins/raw_output_report/README.md +19 -0
- data/plugins/raw_output_report/lib/raw_output_report.rb +41 -41
- data/plugins/stdout_gtestlike_tests_report/README.md +19 -0
- data/plugins/stdout_gtestlike_tests_report/assets/template.erb +84 -84
- data/plugins/stdout_gtestlike_tests_report/assets/template.erb copy +59 -59
- data/plugins/stdout_gtestlike_tests_report/config/stdout_gtestlike_tests_report.yml +4 -4
- data/plugins/stdout_gtestlike_tests_report/lib/stdout_gtestlike_tests_report.rb +43 -43
- data/plugins/stdout_ide_tests_report/README.md +18 -0
- data/plugins/stdout_ide_tests_report/config/stdout_ide_tests_report.yml +4 -4
- data/plugins/stdout_ide_tests_report/lib/stdout_ide_tests_report.rb +44 -44
- data/plugins/stdout_pretty_tests_report/README.md +20 -0
- data/plugins/stdout_pretty_tests_report/assets/template.erb +59 -59
- data/plugins/stdout_pretty_tests_report/config/stdout_pretty_tests_report.yml +4 -4
- data/plugins/stdout_pretty_tests_report/lib/stdout_pretty_tests_report.rb +47 -47
- data/plugins/subprojects/README.md +63 -63
- data/plugins/subprojects/config/defaults.yml +33 -33
- data/plugins/subprojects/lib/subprojects.rb +92 -92
- data/plugins/subprojects/subprojects.rake +78 -78
- data/plugins/teamcity_tests_report/README.md +18 -0
- data/plugins/teamcity_tests_report/config/teamcity_tests_report.yml +4 -4
- data/plugins/teamcity_tests_report/lib/teamcity_tests_report.rb +57 -57
- data/plugins/warnings_report/README.md +19 -0
- data/plugins/warnings_report/lib/warnings_report.rb +69 -69
- data/plugins/xml_tests_report/README.md +36 -36
- data/plugins/xml_tests_report/lib/xml_tests_report.rb +110 -110
- data/spec/build_invoker_utils_spec.rb +54 -54
- data/spec/ceedling_spec.rb +154 -154
- data/spec/configurator_builder_spec.rb +6 -6
- data/spec/configurator_helper_spec.rb +4 -4
- data/spec/configurator_spec.rb +9 -9
- data/spec/file_finder_helper_spec.rb +53 -53
- data/spec/gcov/gcov_deployment_spec.rb +72 -70
- data/spec/gcov/gcov_test_cases_spec.rb +128 -91
- data/spec/generator_test_results_sanity_checker_spec.rb +88 -88
- data/spec/generator_test_results_spec.rb +107 -107
- data/spec/par_map_spec.rb +57 -57
- data/spec/preprocessinator_extractor_spec.rb +45 -45
- data/spec/preprocessinator_includes_handler_spec.rb +202 -202
- data/spec/reportinator_spec.rb +19 -19
- data/spec/spec_helper.rb +27 -27
- data/spec/spec_system_helper.rb +616 -615
- data/spec/support/test_example.fail +24 -24
- data/spec/support/test_example.pass +24 -24
- data/spec/support/test_example_empty.pass +14 -14
- data/spec/support/test_example_ignore.pass +24 -24
- data/spec/support/test_example_mangled.pass +21 -21
- data/spec/support/test_example_with_time.pass +24 -24
- data/spec/system/deployment_spec.rb +225 -225
- data/spec/system_utils_spec.rb +56 -56
- data/spec/target_loader_spec.rb +30 -30
- data/spec/tool_executor_helper_spec.rb +310 -310
- data/spec/uncatagorized_specs_spec.rb +8 -8
- data/vendor/behaviors/Manifest.txt +9 -9
- data/vendor/behaviors/Rakefile +19 -19
- data/vendor/behaviors/lib/behaviors.rb +76 -76
- data/vendor/behaviors/lib/behaviors/reporttask.rb +158 -158
- data/vendor/behaviors/test/behaviors_tasks_test.rb +73 -73
- data/vendor/behaviors/test/behaviors_test.rb +50 -50
- data/vendor/behaviors/test/tasks_test/Rakefile +19 -19
- data/vendor/behaviors/test/tasks_test/lib/user.rb +2 -2
- data/vendor/behaviors/test/tasks_test/test/user_test.rb +17 -17
- data/vendor/c_exception/Gemfile +4 -4
- data/vendor/c_exception/Gemfile.lock +12 -12
- data/vendor/c_exception/README.md +249 -162
- data/vendor/c_exception/docs/CException.md +332 -292
- data/vendor/c_exception/docs/ThrowTheSwitchCodingStandard.md +207 -207
- data/vendor/c_exception/lib/CException.c +46 -46
- data/vendor/c_exception/lib/CException.h +115 -115
- data/vendor/c_exception/lib/meson.build +11 -0
- data/vendor/c_exception/meson.build +48 -0
- data/vendor/c_exception/project.yml +37 -0
- data/vendor/c_exception/test/TestException.c +391 -391
- data/vendor/{cmock/vendor/c_exception/test → c_exception/test/support}/CExceptionConfig.h +46 -46
- data/vendor/c_exception/vendor/unity/README.md +220 -220
- data/vendor/c_exception/vendor/unity/auto/colour_prompt.rb +118 -118
- data/vendor/c_exception/vendor/unity/auto/colour_reporter.rb +39 -39
- data/vendor/c_exception/vendor/unity/auto/generate_config.yml +36 -36
- data/vendor/c_exception/vendor/unity/auto/generate_module.rb +308 -308
- data/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +437 -437
- data/vendor/c_exception/vendor/unity/auto/parse_output.rb +220 -220
- data/vendor/c_exception/vendor/unity/auto/stylize_as_junit.rb +252 -252
- data/vendor/c_exception/vendor/unity/auto/test_file_filter.rb +25 -25
- data/vendor/c_exception/vendor/unity/auto/type_sanitizer.rb +6 -6
- data/vendor/c_exception/vendor/unity/auto/unity_test_summary.py +139 -139
- data/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb +136 -136
- data/vendor/c_exception/vendor/unity/auto/unity_to_junit.py +146 -146
- data/vendor/c_exception/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +207 -207
- data/vendor/c_exception/vendor/unity/docs/UnityAssertionsReference.md +716 -716
- data/vendor/c_exception/vendor/unity/docs/UnityConfigurationGuide.md +398 -398
- data/vendor/c_exception/vendor/unity/docs/UnityGettingStartedGuide.md +191 -191
- data/vendor/c_exception/vendor/unity/docs/UnityHelperScriptsGuide.md +242 -242
- data/vendor/c_exception/vendor/unity/docs/license.txt +21 -21
- data/vendor/c_exception/vendor/unity/examples/example_1/makefile +71 -71
- data/vendor/c_exception/vendor/unity/examples/example_1/readme.txt +4 -4
- data/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode.c +24 -24
- data/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode.h +3 -3
- data/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode2.c +11 -11
- data/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode2.h +2 -2
- data/vendor/c_exception/vendor/unity/examples/example_1/test/TestProductionCode.c +62 -62
- data/vendor/c_exception/vendor/unity/examples/example_1/test/TestProductionCode2.c +31 -31
- data/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +53 -53
- data/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +57 -57
- data/vendor/c_exception/vendor/unity/examples/example_2/makefile +70 -70
- data/vendor/c_exception/vendor/unity/examples/example_2/readme.txt +4 -4
- data/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode.c +24 -24
- data/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode.h +3 -3
- data/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode2.c +11 -11
- data/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode2.h +2 -2
- data/vendor/c_exception/vendor/unity/examples/example_2/test/TestProductionCode.c +64 -64
- data/vendor/c_exception/vendor/unity/examples/example_2/test/TestProductionCode2.c +33 -33
- data/vendor/c_exception/vendor/unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c +8 -8
- data/vendor/c_exception/vendor/unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c +10 -10
- data/vendor/c_exception/vendor/unity/examples/example_2/test/test_runners/all_tests.c +12 -12
- data/vendor/c_exception/vendor/unity/examples/example_3/helper/UnityHelper.c +10 -10
- data/vendor/c_exception/vendor/unity/examples/example_3/helper/UnityHelper.h +12 -12
- data/vendor/c_exception/vendor/unity/examples/example_3/rakefile.rb +43 -43
- data/vendor/c_exception/vendor/unity/examples/example_3/rakefile_helper.rb +249 -249
- data/vendor/c_exception/vendor/unity/examples/example_3/readme.txt +13 -13
- data/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode.c +24 -24
- data/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode.h +3 -3
- data/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode2.c +11 -11
- data/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode2.h +2 -2
- data/vendor/c_exception/vendor/unity/examples/example_3/target_gcc_32.yml +46 -46
- data/vendor/c_exception/vendor/unity/examples/example_3/test/TestProductionCode.c +62 -62
- data/vendor/c_exception/vendor/unity/examples/example_3/test/TestProductionCode2.c +31 -31
- data/vendor/c_exception/vendor/unity/examples/unity_config.h +237 -237
- data/vendor/c_exception/vendor/unity/extras/eclipse/error_parsers.txt +26 -26
- data/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb +48 -48
- data/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb +178 -178
- data/vendor/c_exception/vendor/unity/extras/fixture/readme.txt +8 -8
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +432 -432
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h +83 -83
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +51 -51
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +47 -47
- data/vendor/c_exception/vendor/unity/extras/fixture/test/Makefile +74 -74
- data/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c +22 -22
- data/vendor/c_exception/vendor/unity/extras/fixture/test/template_fixture_tests.c +39 -39
- data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +543 -543
- data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +57 -57
- data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c +57 -57
- data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h +17 -17
- data/vendor/c_exception/vendor/unity/release/build.info +2 -2
- data/vendor/c_exception/vendor/unity/release/version.info +2 -2
- data/vendor/c_exception/vendor/unity/src/unity.c +1517 -1517
- data/vendor/c_exception/vendor/unity/src/unity.h +339 -339
- data/vendor/c_exception/vendor/unity/src/unity_internals.h +784 -784
- data/vendor/c_exception/vendor/unity/test/Makefile +63 -63
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c +61 -61
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c +57 -57
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_head1.c +55 -55
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_head1.h +15 -15
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c +80 -80
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c +76 -76
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_head1.c +75 -75
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_head1.h +13 -13
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c +89 -89
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c +89 -89
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c +77 -77
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c +89 -89
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c +89 -89
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c +90 -90
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c +67 -67
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c +70 -70
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c +58 -58
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c +67 -67
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c +70 -70
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c +71 -71
- data/vendor/c_exception/vendor/unity/test/rakefile +125 -125
- data/vendor/c_exception/vendor/unity/test/rakefile_helper.rb +260 -260
- data/vendor/c_exception/vendor/unity/test/spec/generate_module_existing_file_spec.rb +158 -158
- data/vendor/c_exception/vendor/unity/test/targets/clang_file.yml +78 -78
- data/vendor/c_exception/vendor/unity/test/targets/clang_strict.yml +78 -78
- data/vendor/c_exception/vendor/unity/test/targets/gcc_32.yml +49 -49
- data/vendor/c_exception/vendor/unity/test/targets/gcc_64.yml +50 -50
- data/vendor/c_exception/vendor/unity/test/targets/gcc_auto_limits.yml +47 -47
- data/vendor/c_exception/vendor/unity/test/targets/gcc_auto_stdint.yml +59 -59
- data/vendor/c_exception/vendor/unity/test/targets/gcc_manual_math.yml +47 -47
- data/vendor/c_exception/vendor/unity/test/targets/hitech_picc18.yml +101 -101
- data/vendor/c_exception/vendor/unity/test/targets/iar_arm_v4.yml +90 -90
- data/vendor/c_exception/vendor/unity/test/targets/iar_arm_v5.yml +80 -80
- data/vendor/c_exception/vendor/unity/test/targets/iar_arm_v5_3.yml +80 -80
- data/vendor/c_exception/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +94 -94
- data/vendor/c_exception/vendor/unity/test/targets/iar_cortexm3_v5.yml +84 -84
- data/vendor/c_exception/vendor/unity/test/targets/iar_msp430.yml +95 -95
- data/vendor/c_exception/vendor/unity/test/targets/iar_sh2a_v6.yml +86 -86
- data/vendor/c_exception/vendor/unity/test/testdata/CException.h +11 -11
- data/vendor/c_exception/vendor/unity/test/testdata/Defs.h +8 -8
- data/vendor/c_exception/vendor/unity/test/testdata/cmock.h +14 -14
- data/vendor/c_exception/vendor/unity/test/testdata/mockMock.h +13 -13
- data/vendor/c_exception/vendor/unity/test/testdata/testRunnerGenerator.c +183 -183
- data/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +67 -67
- data/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +192 -192
- data/vendor/c_exception/vendor/unity/test/tests/test_generate_test_runner.rb +1252 -1252
- data/vendor/c_exception/vendor/unity/test/tests/testparameterized.c +110 -110
- data/vendor/c_exception/vendor/unity/test/tests/testunity.c +4993 -4993
- data/vendor/cmock/Gemfile +8 -9
- data/vendor/cmock/LICENSE.txt +18 -18
- data/vendor/cmock/README.md +34 -34
- data/vendor/cmock/config/production_environment.rb +12 -14
- data/vendor/cmock/config/test_environment.rb +16 -16
- data/vendor/cmock/docs/CMock_Summary.md +806 -696
- data/vendor/cmock/docs/ThrowTheSwitchCodingStandard.md +207 -207
- data/vendor/cmock/examples/make_example/Makefile +30 -30
- data/vendor/cmock/examples/make_example/src/foo.c +5 -5
- data/vendor/cmock/examples/make_example/src/foo.h +5 -5
- data/vendor/cmock/examples/make_example/src/main.c +15 -15
- data/vendor/cmock/examples/make_example/test/test_foo.c +17 -17
- data/vendor/cmock/examples/make_example/test/test_main.c +15 -15
- data/vendor/cmock/examples/temp_sensor/gcc.yml +44 -44
- data/vendor/cmock/examples/temp_sensor/iar_v4.yml +92 -92
- data/vendor/cmock/examples/temp_sensor/iar_v5.yml +81 -81
- data/vendor/cmock/examples/temp_sensor/rakefile.rb +42 -42
- data/vendor/cmock/examples/temp_sensor/rakefile_helper.rb +268 -272
- data/vendor/cmock/examples/temp_sensor/src/AT91SAM7X256.h +2556 -2556
- data/vendor/cmock/examples/temp_sensor/src/AdcConductor.c +42 -42
- data/vendor/cmock/examples/temp_sensor/src/AdcConductor.h +11 -11
- data/vendor/cmock/examples/temp_sensor/src/AdcHardware.c +27 -27
- data/vendor/cmock/examples/temp_sensor/src/AdcHardware.h +9 -9
- data/vendor/cmock/examples/temp_sensor/src/AdcHardwareConfigurator.c +18 -18
- data/vendor/cmock/examples/temp_sensor/src/AdcHardwareConfigurator.h +10 -10
- data/vendor/cmock/examples/temp_sensor/src/AdcModel.c +33 -33
- data/vendor/cmock/examples/temp_sensor/src/AdcModel.h +13 -13
- data/vendor/cmock/examples/temp_sensor/src/AdcTemperatureSensor.c +51 -51
- data/vendor/cmock/examples/temp_sensor/src/AdcTemperatureSensor.h +10 -10
- data/vendor/cmock/examples/temp_sensor/src/Executor.c +25 -25
- data/vendor/cmock/examples/temp_sensor/src/Executor.h +9 -9
- data/vendor/cmock/examples/temp_sensor/src/IntrinsicsWrapper.c +18 -18
- data/vendor/cmock/examples/temp_sensor/src/IntrinsicsWrapper.h +7 -7
- data/vendor/cmock/examples/temp_sensor/src/Main.c +46 -46
- data/vendor/cmock/examples/temp_sensor/src/Main.h +7 -7
- data/vendor/cmock/examples/temp_sensor/src/Model.c +10 -10
- data/vendor/cmock/examples/temp_sensor/src/Model.h +8 -8
- data/vendor/cmock/examples/temp_sensor/src/ModelConfig.h +7 -7
- data/vendor/cmock/examples/temp_sensor/src/TaskScheduler.c +72 -72
- data/vendor/cmock/examples/temp_sensor/src/TaskScheduler.h +11 -11
- data/vendor/cmock/examples/temp_sensor/src/TemperatureCalculator.c +27 -27
- data/vendor/cmock/examples/temp_sensor/src/TemperatureCalculator.h +6 -6
- data/vendor/cmock/examples/temp_sensor/src/TemperatureFilter.c +39 -39
- data/vendor/cmock/examples/temp_sensor/src/TemperatureFilter.h +10 -10
- data/vendor/cmock/examples/temp_sensor/src/TimerConductor.c +15 -15
- data/vendor/cmock/examples/temp_sensor/src/TimerConductor.h +9 -9
- data/vendor/cmock/examples/temp_sensor/src/TimerConfigurator.c +51 -51
- data/vendor/cmock/examples/temp_sensor/src/TimerConfigurator.h +15 -15
- data/vendor/cmock/examples/temp_sensor/src/TimerHardware.c +15 -15
- data/vendor/cmock/examples/temp_sensor/src/TimerHardware.h +8 -8
- data/vendor/cmock/examples/temp_sensor/src/TimerInterruptConfigurator.c +55 -55
- data/vendor/cmock/examples/temp_sensor/src/TimerInterruptConfigurator.h +13 -13
- data/vendor/cmock/examples/temp_sensor/src/TimerInterruptHandler.c +25 -25
- data/vendor/cmock/examples/temp_sensor/src/TimerInterruptHandler.h +10 -10
- data/vendor/cmock/examples/temp_sensor/src/TimerModel.c +9 -9
- data/vendor/cmock/examples/temp_sensor/src/TimerModel.h +8 -8
- data/vendor/cmock/examples/temp_sensor/src/Types.h +103 -103
- data/vendor/cmock/examples/temp_sensor/src/UsartBaudRateRegisterCalculator.c +18 -18
- data/vendor/cmock/examples/temp_sensor/src/UsartBaudRateRegisterCalculator.h +6 -6
- data/vendor/cmock/examples/temp_sensor/src/UsartConductor.c +21 -21
- data/vendor/cmock/examples/temp_sensor/src/UsartConductor.h +7 -7
- data/vendor/cmock/examples/temp_sensor/src/UsartConfigurator.c +39 -39
- data/vendor/cmock/examples/temp_sensor/src/UsartConfigurator.h +13 -13
- data/vendor/cmock/examples/temp_sensor/src/UsartHardware.c +22 -22
- data/vendor/cmock/examples/temp_sensor/src/UsartHardware.h +9 -9
- data/vendor/cmock/examples/temp_sensor/src/UsartModel.c +34 -34
- data/vendor/cmock/examples/temp_sensor/src/UsartModel.h +10 -10
- data/vendor/cmock/examples/temp_sensor/src/UsartPutChar.c +16 -16
- data/vendor/cmock/examples/temp_sensor/src/UsartPutChar.h +8 -8
- data/vendor/cmock/examples/temp_sensor/src/UsartTransmitBufferStatus.c +7 -7
- data/vendor/cmock/examples/temp_sensor/src/UsartTransmitBufferStatus.h +8 -8
- data/vendor/cmock/examples/temp_sensor/test/TestAdcConductor.c +121 -121
- data/vendor/cmock/examples/temp_sensor/test/TestAdcHardware.c +44 -44
- data/vendor/cmock/examples/temp_sensor/test/TestAdcHardwareConfigurator.c +43 -43
- data/vendor/cmock/examples/temp_sensor/test/TestAdcModel.c +33 -33
- data/vendor/cmock/examples/temp_sensor/test/TestAdcTemperatureSensor.c +47 -47
- data/vendor/cmock/examples/temp_sensor/test/TestExecutor.c +36 -36
- data/vendor/cmock/examples/temp_sensor/test/TestMain.c +24 -24
- data/vendor/cmock/examples/temp_sensor/test/TestModel.c +20 -20
- data/vendor/cmock/examples/temp_sensor/test/TestTaskScheduler.c +104 -104
- data/vendor/cmock/examples/temp_sensor/test/TestTemperatureCalculator.c +33 -33
- data/vendor/cmock/examples/temp_sensor/test/TestTemperatureFilter.c +69 -69
- data/vendor/cmock/examples/temp_sensor/test/TestTimerConductor.c +32 -32
- data/vendor/cmock/examples/temp_sensor/test/TestTimerConfigurator.c +112 -112
- data/vendor/cmock/examples/temp_sensor/test/TestTimerHardware.c +26 -26
- data/vendor/cmock/examples/temp_sensor/test/TestTimerInterruptConfigurator.c +78 -78
- data/vendor/cmock/examples/temp_sensor/test/TestTimerInterruptHandler.c +66 -66
- data/vendor/cmock/examples/temp_sensor/test/TestTimerModel.c +18 -18
- data/vendor/cmock/examples/temp_sensor/test/TestUsartBaudRateRegisterCalculator.c +21 -21
- data/vendor/cmock/examples/temp_sensor/test/TestUsartConductor.c +40 -40
- data/vendor/cmock/examples/temp_sensor/test/TestUsartConfigurator.c +77 -77
- data/vendor/cmock/examples/temp_sensor/test/TestUsartHardware.c +37 -37
- data/vendor/cmock/examples/temp_sensor/test/TestUsartModel.c +40 -40
- data/vendor/cmock/examples/temp_sensor/test/TestUsartPutChar.c +43 -43
- data/vendor/cmock/examples/temp_sensor/test/TestUsartTransmitBufferStatus.c +22 -22
- data/vendor/cmock/lib/cmock.rb +104 -86
- data/vendor/cmock/lib/cmock_config.rb +173 -163
- data/vendor/cmock/lib/cmock_file_writer.rb +48 -44
- data/vendor/cmock/lib/cmock_generator.rb +333 -275
- data/vendor/cmock/lib/cmock_generator_plugin_array.rb +63 -63
- data/vendor/cmock/lib/cmock_generator_plugin_callback.rb +88 -88
- data/vendor/cmock/lib/cmock_generator_plugin_cexception.rb +49 -51
- data/vendor/cmock/lib/cmock_generator_plugin_expect.rb +100 -103
- data/vendor/cmock/lib/cmock_generator_plugin_expect_any_args.rb +50 -53
- data/vendor/cmock/lib/cmock_generator_plugin_ignore.rb +88 -75
- data/vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb +42 -42
- data/vendor/cmock/lib/cmock_generator_plugin_return_thru_ptr.rb +79 -79
- data/vendor/cmock/lib/cmock_generator_utils.rb +247 -253
- data/vendor/cmock/lib/cmock_header_parser.rb +595 -474
- data/vendor/cmock/lib/cmock_plugin_manager.rb +50 -55
- data/vendor/cmock/lib/cmock_unityhelper_parser.rb +77 -75
- data/vendor/cmock/meson.build +53 -72
- data/vendor/cmock/scripts/create_makefile.rb +203 -202
- data/vendor/cmock/scripts/create_mock.rb +8 -8
- data/vendor/cmock/scripts/create_runner.rb +18 -20
- data/vendor/cmock/scripts/test_summary.rb +18 -19
- data/vendor/cmock/src/cmock.c +216 -216
- data/vendor/cmock/src/cmock.h +41 -40
- data/vendor/cmock/src/cmock_internals.h +91 -91
- data/vendor/cmock/src/meson.build +12 -17
- data/vendor/cmock/test/c/TestCMockC.c +333 -333
- data/vendor/cmock/test/c/TestCMockC.yml +14 -14
- data/vendor/cmock/test/c/TestCMockCDynamic.c +186 -186
- data/vendor/cmock/test/c/TestCMockCDynamic.yml +12 -12
- data/vendor/cmock/test/c/TestCMockCDynamic_Runner.c +36 -36
- data/vendor/cmock/test/c/TestCMockC_Runner.c +41 -41
- data/vendor/cmock/test/iar/iar_v4/Resource/at91SAM7X256_FLASH.xcl +185 -185
- data/vendor/cmock/test/iar/iar_v4/Resource/at91SAM7X256_RAM.xcl +185 -185
- data/vendor/cmock/test/iar/iar_v4/Resource/ioat91sam7x256.ddf +2259 -2259
- data/vendor/cmock/test/iar/iar_v4/cmock_demo.dep +3691 -3691
- data/vendor/cmock/test/iar/iar_v4/cmock_demo.ewp +2581 -2581
- data/vendor/cmock/test/iar/iar_v4/incIAR/AT91SAM7X-EK.h +61 -61
- data/vendor/cmock/test/iar/iar_v4/incIAR/AT91SAM7X256.inc +2314 -2314
- data/vendor/cmock/test/iar/iar_v4/incIAR/AT91SAM7X256.rdf +4704 -4704
- data/vendor/cmock/test/iar/iar_v4/incIAR/AT91SAM7X256.tcl +3407 -3407
- data/vendor/cmock/test/iar/iar_v4/incIAR/AT91SAM7X256_inc.h +2268 -2268
- data/vendor/cmock/test/iar/iar_v4/incIAR/ioat91sam7x256.h +4380 -4380
- data/vendor/cmock/test/iar/iar_v4/incIAR/lib_AT91SAM7X256.h +4211 -4211
- data/vendor/cmock/test/iar/iar_v4/settings/cmock_demo.cspy.bat +32 -32
- data/vendor/cmock/test/iar/iar_v4/srcIAR/Cstartup.s79 +265 -265
- data/vendor/cmock/test/iar/iar_v4/srcIAR/Cstartup_SAM7.c +98 -98
- data/vendor/cmock/test/iar/iar_v5/Resource/at91SAM7X256_FLASH.icf +43 -43
- data/vendor/cmock/test/iar/iar_v5/Resource/at91SAM7X256_RAM.icf +42 -42
- data/vendor/cmock/test/iar/iar_v5/cmock_demo.dep +4204 -4204
- data/vendor/cmock/test/iar/iar_v5/cmock_demo.ewp +2426 -2426
- data/vendor/cmock/test/iar/iar_v5/incIAR/AT91SAM7X-EK.h +61 -61
- data/vendor/cmock/test/iar/iar_v5/incIAR/AT91SAM7X256_inc.h +2268 -2268
- data/vendor/cmock/test/iar/iar_v5/incIAR/lib_AT91SAM7X256.h +4211 -4211
- data/vendor/cmock/test/iar/iar_v5/incIAR/project.h +30 -30
- data/vendor/cmock/test/iar/iar_v5/settings/BasicInterrupt_SAM7X.cspy.bat +33 -33
- data/vendor/cmock/test/iar/iar_v5/settings/BasicInterrupt_SAM7X_FLASH_Debug.jlink +12 -12
- data/vendor/cmock/test/iar/iar_v5/settings/cmock_demo.cspy.bat +33 -33
- data/vendor/cmock/test/iar/iar_v5/settings/cmock_demo_Binary.jlink +12 -12
- data/vendor/cmock/test/iar/iar_v5/settings/cmock_demo_FLASH_Debug.jlink +12 -12
- data/vendor/cmock/test/iar/iar_v5/settings/cmock_demo_RAM_Debug.jlink +12 -12
- data/vendor/cmock/test/iar/iar_v5/srcIAR/Cstartup.s +299 -299
- data/vendor/cmock/test/iar/iar_v5/srcIAR/Cstartup_SAM7.c +98 -98
- data/vendor/cmock/test/rakefile +147 -106
- data/vendor/cmock/test/rakefile_helper.rb +403 -382
- data/vendor/cmock/test/system/systest_generator.rb +205 -193
- data/vendor/cmock/test/system/test_compilation/callingconv.h +11 -11
- data/vendor/cmock/test/system/test_compilation/config.yml +10 -10
- data/vendor/cmock/test/system/test_compilation/const.h +37 -37
- data/vendor/cmock/test/system/test_compilation/inline.h +23 -23
- data/vendor/cmock/test/system/test_compilation/osek.h +275 -275
- data/vendor/cmock/test/system/test_compilation/parsing.h +89 -89
- data/vendor/cmock/test/system/test_interactions/all_plugins_but_other_limits.yml +375 -375
- data/vendor/cmock/test/system/test_interactions/all_plugins_coexist.yml +460 -460
- data/vendor/cmock/test/system/test_interactions/array_and_pointer_handling.yml +446 -446
- data/vendor/cmock/test/system/test_interactions/basic_expect_and_return.yml +124 -124
- data/vendor/cmock/test/system/test_interactions/const_primitives_handling.yml +87 -87
- data/vendor/cmock/test/system/test_interactions/doesnt_leave_details_behind.yml +308 -308
- data/vendor/cmock/test/system/test_interactions/enforce_strict_ordering.yml +247 -247
- data/vendor/cmock/test/system/test_interactions/expect_and_return_custom_types.yml +108 -108
- data/vendor/cmock/test/system/test_interactions/expect_and_return_treat_as.yml +173 -173
- data/vendor/cmock/test/system/test_interactions/expect_and_throw.yml +170 -170
- data/vendor/cmock/test/system/test_interactions/expect_any_args.yml +238 -238
- data/vendor/cmock/test/system/test_interactions/fancy_pointer_handling.yml +210 -210
- data/vendor/cmock/test/system/test_interactions/function_pointer_handling.yml +83 -82
- data/vendor/cmock/test/system/test_interactions/ignore_and_return.yml +329 -329
- data/vendor/cmock/test/system/test_interactions/ignore_strict_mock_calling.yml +37 -37
- data/vendor/cmock/test/system/test_interactions/newer_standards_stuff1.yml +52 -52
- data/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_1.yml +91 -91
- data/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_2.yml +59 -59
- data/vendor/cmock/test/system/test_interactions/out_of_memory.yml +65 -65
- data/vendor/cmock/test/system/test_interactions/parsing_challenges.yml +242 -242
- data/vendor/cmock/test/system/test_interactions/return_thru_ptr_and_expect_any_args.yml +235 -235
- data/vendor/cmock/test/system/test_interactions/return_thru_ptr_ignore_arg.yml +231 -231
- data/vendor/cmock/test/system/test_interactions/skeleton.yml +55 -0
- data/vendor/cmock/test/system/test_interactions/skeleton_update.yml +76 -0
- data/vendor/cmock/test/system/test_interactions/struct_union_enum_expect_and_return.yml +277 -277
- data/vendor/cmock/test/system/test_interactions/struct_union_enum_expect_and_return_with_plugins.yml +280 -280
- data/vendor/cmock/test/system/test_interactions/stubs_with_callbacks.yml +221 -221
- data/vendor/cmock/test/system/test_interactions/unity_64bit_support.yml +77 -77
- data/vendor/cmock/test/system/test_interactions/unity_ignores.yml +139 -139
- data/vendor/cmock/test/system/test_interactions/unity_void_pointer_compare.yml +91 -91
- data/vendor/cmock/test/targets/clang_strict.yml +90 -90
- data/vendor/cmock/test/targets/gcc.yml +58 -58
- data/vendor/cmock/test/targets/gcc_64.yml +58 -58
- data/vendor/cmock/test/targets/gcc_tiny.yml +80 -80
- data/vendor/cmock/test/targets/iar_arm_v4.yml +110 -110
- data/vendor/cmock/test/targets/iar_arm_v5.yml +95 -95
- data/vendor/cmock/test/test_helper.rb +44 -44
- data/vendor/cmock/test/unit/cmock_config_test.rb +126 -123
- data/vendor/cmock/test/unit/cmock_config_test.yml +7 -6
- data/vendor/cmock/test/unit/cmock_file_writer_test.rb +27 -27
- data/vendor/cmock/test/unit/cmock_generator_main_test.rb +686 -551
- data/vendor/cmock/test/unit/cmock_generator_plugin_array_test.rb +141 -141
- data/vendor/cmock/test/unit/cmock_generator_plugin_callback_test.rb +281 -281
- data/vendor/cmock/test/unit/cmock_generator_plugin_cexception_test.rb +96 -96
- data/vendor/cmock/test/unit/cmock_generator_plugin_expect_a_test.rb +185 -183
- data/vendor/cmock/test/unit/cmock_generator_plugin_expect_any_args_test.rb +67 -67
- data/vendor/cmock/test/unit/cmock_generator_plugin_expect_b_test.rb +201 -200
- data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_arg_test.rb +116 -116
- data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_test.rb +119 -105
- data/vendor/cmock/test/unit/cmock_generator_plugin_return_thru_ptr_test.rb +136 -136
- data/vendor/cmock/test/unit/cmock_generator_utils_test.rb +398 -415
- data/vendor/cmock/test/unit/cmock_header_parser_test.rb +2717 -2000
- data/vendor/cmock/test/unit/cmock_plugin_manager_test.rb +100 -100
- data/vendor/cmock/test/unit/cmock_unityhelper_parser_test.rb +223 -223
- data/vendor/cmock/vendor/behaviors/Manifest.txt +9 -9
- data/vendor/cmock/vendor/behaviors/Rakefile +19 -19
- data/vendor/cmock/vendor/behaviors/lib/behaviors.rb +76 -76
- data/vendor/cmock/vendor/behaviors/lib/behaviors/reporttask.rb +158 -158
- data/vendor/cmock/vendor/behaviors/test/behaviors_tasks_test.rb +73 -73
- data/vendor/cmock/vendor/behaviors/test/behaviors_test.rb +50 -50
- data/vendor/cmock/vendor/behaviors/test/tasks_test/Rakefile +19 -19
- data/vendor/cmock/vendor/behaviors/test/tasks_test/lib/user.rb +2 -2
- data/vendor/cmock/vendor/behaviors/test/tasks_test/test/user_test.rb +17 -17
- data/vendor/cmock/vendor/c_exception/Gemfile +4 -4
- data/vendor/cmock/vendor/c_exception/Gemfile.lock +12 -12
- data/vendor/cmock/vendor/c_exception/README.md +249 -162
- data/vendor/cmock/vendor/c_exception/docs/CException.md +332 -292
- data/vendor/cmock/vendor/c_exception/docs/ThrowTheSwitchCodingStandard.md +207 -207
- data/vendor/cmock/vendor/c_exception/lib/CException.c +46 -46
- data/vendor/cmock/vendor/c_exception/lib/CException.h +115 -115
- data/vendor/cmock/vendor/c_exception/lib/meson.build +11 -0
- data/vendor/cmock/vendor/c_exception/meson.build +48 -0
- data/vendor/cmock/vendor/c_exception/project.yml +37 -0
- data/vendor/cmock/vendor/c_exception/test/TestException.c +391 -391
- data/vendor/{c_exception/test → cmock/vendor/c_exception/test/support}/CExceptionConfig.h +46 -46
- data/vendor/cmock/vendor/c_exception/vendor/unity/README.md +220 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_prompt.rb +118 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_reporter.rb +39 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_config.yml +36 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_module.rb +308 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +437 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/parse_output.rb +220 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/stylize_as_junit.rb +252 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/test_file_filter.rb +25 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/type_sanitizer.rb +6 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_test_summary.py +139 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb +136 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_to_junit.py +146 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +207 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityAssertionsReference.md +716 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityConfigurationGuide.md +398 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityGettingStartedGuide.md +191 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityHelperScriptsGuide.md +242 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/license.txt +21 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/makefile +71 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/readme.txt +5 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode.c +24 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode.h +3 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode2.c +11 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode2.h +2 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/TestProductionCode.c +62 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/TestProductionCode2.c +31 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +53 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +57 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/makefile +70 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/readme.txt +5 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode.c +24 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode.h +3 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode2.c +11 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode2.h +2 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/test/TestProductionCode.c +64 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/test/TestProductionCode2.c +33 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c +9 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c +11 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/test/test_runners/all_tests.c +12 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/helper/UnityHelper.c +10 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/helper/UnityHelper.h +12 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/rakefile.rb +43 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/rakefile_helper.rb +249 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/readme.txt +13 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode.c +24 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode.h +3 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode2.c +11 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode2.h +2 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/target_gcc_32.yml +46 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/test/TestProductionCode.c +62 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/test/TestProductionCode2.c +31 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/unity_config.h +237 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/eclipse/error_parsers.txt +26 -0
- data/vendor/cmock/vendor/{unity → c_exception/vendor/unity}/extras/fixture/rakefile.rb +48 -44
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb +178 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/readme.txt +9 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +432 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h +83 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +51 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +47 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/Makefile +74 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c +22 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/template_fixture_tests.c +39 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +543 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +57 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c +57 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h +17 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/release/build.info +2 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/release/version.info +2 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.c +1517 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.h +339 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity_internals.h +784 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/Makefile +63 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c +61 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c +57 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_head1.c +55 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_head1.h +15 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c +80 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c +76 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_head1.c +75 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_head1.h +13 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c +89 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c +89 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c +77 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c +89 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c +89 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c +90 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c +67 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c +70 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c +58 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c +67 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c +70 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c +71 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/rakefile +125 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/rakefile_helper.rb +260 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/spec/generate_module_existing_file_spec.rb +158 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/clang_file.yml +78 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/clang_strict.yml +78 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_32.yml +49 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_64.yml +50 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_auto_limits.yml +47 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_auto_stdint.yml +59 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_manual_math.yml +47 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/hitech_picc18.yml +101 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_arm_v4.yml +90 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_arm_v5.yml +80 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_arm_v5_3.yml +80 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +94 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_cortexm3_v5.yml +84 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_msp430.yml +95 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/iar_sh2a_v6.yml +86 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/CException.h +11 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/Defs.h +8 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/cmock.h +14 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/mockMock.h +13 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testRunnerGenerator.c +183 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +67 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +192 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/tests/test_generate_test_runner.rb +1252 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/tests/testparameterized.c +110 -0
- data/vendor/cmock/vendor/{unity → c_exception/vendor/unity}/test/tests/testunity.c +4993 -8168
- data/vendor/cmock/vendor/unity/CMakeLists.txt +133 -31
- data/vendor/cmock/vendor/unity/LICENSE.txt +21 -21
- data/vendor/cmock/vendor/unity/README.md +191 -191
- data/vendor/cmock/vendor/unity/auto/colour_prompt.rb +119 -119
- data/vendor/cmock/vendor/unity/auto/colour_reporter.rb +39 -39
- data/vendor/cmock/vendor/unity/auto/generate_config.yml +36 -36
- data/vendor/cmock/vendor/unity/auto/generate_module.rb +312 -309
- data/vendor/cmock/vendor/unity/auto/generate_test_runner.rb +511 -495
- data/vendor/cmock/vendor/unity/auto/parse_output.rb +322 -322
- data/vendor/cmock/vendor/unity/auto/run_test.erb +37 -36
- data/vendor/cmock/vendor/unity/auto/stylize_as_junit.rb +251 -251
- data/vendor/cmock/vendor/unity/auto/test_file_filter.rb +25 -25
- data/vendor/cmock/vendor/unity/auto/type_sanitizer.rb +6 -6
- data/vendor/cmock/vendor/unity/auto/unity_test_summary.py +139 -139
- data/vendor/cmock/vendor/unity/auto/unity_test_summary.rb +135 -135
- data/vendor/cmock/vendor/unity/auto/unity_to_junit.py +146 -146
- data/vendor/cmock/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +206 -206
- data/vendor/cmock/vendor/unity/docs/UnityAssertionsReference.md +831 -850
- data/vendor/cmock/vendor/unity/docs/UnityConfigurationGuide.md +563 -541
- data/vendor/cmock/vendor/unity/docs/UnityGettingStartedGuide.md +251 -251
- data/vendor/cmock/vendor/unity/docs/UnityHelperScriptsGuide.md +278 -266
- data/vendor/cmock/vendor/unity/examples/example_1/makefile +72 -72
- data/vendor/cmock/vendor/unity/examples/example_1/readme.txt +4 -4
- data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode.c +24 -24
- data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode.h +3 -3
- data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode2.c +11 -11
- data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode2.h +2 -2
- data/vendor/cmock/vendor/unity/examples/example_1/test/TestProductionCode.c +62 -62
- data/vendor/cmock/vendor/unity/examples/example_1/test/TestProductionCode2.c +31 -31
- data/vendor/cmock/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +53 -53
- data/vendor/cmock/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +57 -57
- data/vendor/cmock/vendor/unity/examples/example_2/makefile +71 -71
- data/vendor/cmock/vendor/unity/examples/example_2/readme.txt +4 -4
- data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode.c +24 -24
- data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode.h +3 -3
- data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode2.c +11 -11
- data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode2.h +2 -2
- data/vendor/cmock/vendor/unity/examples/example_2/test/TestProductionCode.c +64 -64
- data/vendor/cmock/vendor/unity/examples/example_2/test/TestProductionCode2.c +33 -33
- data/vendor/cmock/vendor/unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c +8 -8
- data/vendor/cmock/vendor/unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c +10 -10
- data/vendor/cmock/vendor/unity/examples/example_2/test/test_runners/all_tests.c +12 -12
- data/vendor/cmock/vendor/unity/examples/example_3/helper/UnityHelper.c +10 -10
- data/vendor/cmock/vendor/unity/examples/example_3/helper/UnityHelper.h +12 -12
- data/vendor/cmock/vendor/unity/examples/example_3/rakefile.rb +38 -38
- data/vendor/cmock/vendor/unity/examples/example_3/rakefile_helper.rb +250 -250
- data/vendor/cmock/vendor/unity/examples/example_3/readme.txt +13 -13
- data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode.c +24 -24
- data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode.h +3 -3
- data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode2.c +11 -11
- data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode2.h +2 -2
- data/vendor/cmock/vendor/unity/examples/example_3/target_gcc_32.yml +47 -47
- data/vendor/cmock/vendor/unity/examples/example_3/test/TestProductionCode.c +62 -62
- data/vendor/cmock/vendor/unity/examples/example_3/test/TestProductionCode2.c +31 -31
- data/vendor/cmock/vendor/unity/examples/example_4/meson.build +12 -17
- data/vendor/cmock/vendor/unity/examples/example_4/readme.txt +14 -14
- data/vendor/cmock/vendor/unity/examples/example_4/src/ProductionCode.c +24 -24
- data/vendor/cmock/vendor/unity/examples/example_4/src/ProductionCode.h +3 -3
- data/vendor/cmock/vendor/unity/examples/example_4/src/ProductionCode2.c +11 -11
- data/vendor/cmock/vendor/unity/examples/example_4/src/ProductionCode2.h +2 -2
- data/vendor/cmock/vendor/unity/examples/example_4/src/meson.build +16 -21
- data/vendor/cmock/vendor/unity/examples/example_4/subprojects/unity.wrap +4 -4
- data/vendor/cmock/vendor/unity/examples/example_4/test/TestProductionCode.c +63 -63
- data/vendor/cmock/vendor/unity/examples/example_4/test/TestProductionCode2.c +35 -35
- data/vendor/cmock/vendor/unity/examples/example_4/test/meson.build +7 -12
- data/vendor/cmock/vendor/unity/examples/example_4/test/test_runners/TestProductionCode2_Runner.c +53 -53
- data/vendor/cmock/vendor/unity/examples/example_4/test/test_runners/TestProductionCode_Runner.c +57 -57
- data/vendor/cmock/vendor/unity/examples/example_4/test/test_runners/meson.build +13 -16
- data/vendor/cmock/vendor/unity/examples/unity_config.h +244 -263
- data/vendor/cmock/vendor/unity/extras/eclipse/error_parsers.txt +26 -26
- data/vendor/cmock/vendor/unity/extras/fixture/readme.md +29 -17
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c +310 -275
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h +83 -83
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h +50 -50
- data/vendor/cmock/vendor/unity/extras/fixture/test/Makefile +72 -72
- data/vendor/cmock/vendor/unity/extras/fixture/test/main/AllTests.c +20 -20
- data/vendor/cmock/vendor/unity/extras/fixture/test/template_fixture_tests.c +39 -39
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c +245 -245
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +32 -32
- data/vendor/cmock/vendor/unity/extras/memory/readme.md +49 -49
- data/vendor/cmock/vendor/unity/extras/memory/src/unity_memory.c +202 -202
- data/vendor/cmock/vendor/unity/extras/memory/src/unity_memory.h +60 -60
- data/vendor/cmock/vendor/unity/extras/memory/test/Makefile +78 -78
- data/vendor/cmock/vendor/unity/extras/memory/test/unity_memory_Test.c +325 -325
- data/vendor/cmock/vendor/unity/extras/memory/test/unity_memory_TestRunner.c +49 -49
- data/vendor/cmock/vendor/unity/extras/memory/test/unity_output_Spy.c +56 -56
- data/vendor/cmock/vendor/unity/extras/memory/test/unity_output_Spy.h +16 -16
- data/vendor/cmock/vendor/unity/meson.build +48 -69
- data/vendor/cmock/vendor/unity/src/meson.build +11 -16
- data/vendor/cmock/vendor/unity/src/unity.c +2109 -2085
- data/vendor/cmock/vendor/unity/src/unity.h +661 -617
- data/vendor/cmock/vendor/unity/src/unity_internals.h +1030 -1002
- data/vendor/cmock/vendor/unity/test/Makefile +159 -67
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_cmd.c +61 -61
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_def.c +57 -57
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_head1.c +55 -55
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_head1.h +15 -15
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_cmd.c +80 -80
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_def.c +76 -76
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_head1.c +75 -75
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_head1.h +13 -13
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new1.c +89 -89
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new2.c +89 -89
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_param.c +77 -77
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run1.c +89 -89
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run2.c +89 -89
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_yaml.c +90 -90
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_new1.c +67 -67
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_new2.c +70 -70
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_param.c +58 -58
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_run1.c +67 -67
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_run2.c +70 -70
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_yaml.c +71 -71
- data/vendor/cmock/vendor/unity/test/rakefile +163 -124
- data/vendor/cmock/vendor/unity/test/rakefile_helper.rb +315 -269
- data/vendor/cmock/vendor/unity/test/spec/generate_module_existing_file_spec.rb +158 -158
- data/vendor/cmock/vendor/unity/test/targets/ansi.yml +44 -49
- data/vendor/cmock/vendor/unity/test/targets/clang_file.yml +72 -78
- data/vendor/cmock/vendor/unity/test/targets/clang_strict.yml +71 -78
- data/vendor/cmock/vendor/unity/test/targets/gcc_32.yml +45 -49
- data/vendor/cmock/vendor/unity/test/targets/gcc_64.yml +46 -50
- data/vendor/cmock/vendor/unity/test/targets/gcc_auto_limits.yml +43 -47
- data/vendor/cmock/vendor/unity/test/targets/gcc_auto_stdint.yml +55 -59
- data/vendor/cmock/vendor/unity/test/targets/gcc_manual_math.yml +43 -47
- data/vendor/cmock/vendor/unity/test/targets/hitech_picc18.yml +91 -101
- data/vendor/cmock/vendor/unity/test/targets/iar_arm_v4.yml +98 -90
- data/vendor/cmock/vendor/unity/test/targets/iar_arm_v5.yml +92 -80
- data/vendor/cmock/vendor/unity/test/targets/iar_arm_v5_3.yml +92 -80
- data/vendor/cmock/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +90 -94
- data/vendor/cmock/vendor/unity/test/targets/iar_cortexm3_v5.yml +94 -84
- data/vendor/cmock/vendor/unity/test/targets/iar_msp430.yml +112 -95
- data/vendor/cmock/vendor/unity/test/targets/iar_sh2a_v6.yml +99 -86
- data/vendor/cmock/vendor/unity/test/testdata/CException.h +11 -11
- data/vendor/cmock/vendor/unity/test/testdata/Defs.h +8 -8
- data/vendor/cmock/vendor/unity/test/testdata/cmock.h +14 -14
- data/vendor/cmock/vendor/unity/test/testdata/mockMock.h +13 -13
- data/vendor/cmock/vendor/unity/test/testdata/testRunnerGenerator.c +189 -189
- data/vendor/cmock/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +70 -70
- data/vendor/cmock/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +197 -197
- data/vendor/cmock/vendor/unity/test/tests/self_assessment_utils.h +144 -0
- data/vendor/cmock/vendor/unity/test/tests/test_generate_test_runner.rb +1260 -1268
- data/vendor/cmock/vendor/unity/test/tests/test_unity_arrays.c +2874 -0
- data/vendor/cmock/vendor/unity/test/tests/test_unity_core.c +371 -0
- data/vendor/cmock/vendor/unity/test/tests/test_unity_doubles.c +773 -0
- data/vendor/cmock/vendor/unity/test/tests/test_unity_floats.c +884 -0
- data/vendor/cmock/vendor/unity/test/tests/test_unity_integers.c +2847 -0
- data/vendor/cmock/vendor/unity/test/tests/test_unity_integers_64.c +773 -0
- data/vendor/cmock/vendor/unity/test/tests/test_unity_memory.c +81 -0
- data/vendor/{unity/test/tests/testparameterized.c → cmock/vendor/unity/test/tests/test_unity_parameterized.c} +171 -171
- data/vendor/cmock/vendor/unity/test/tests/test_unity_strings.c +329 -0
- data/vendor/cmock/vendor/unity/unityConfig.cmake +1 -0
- data/vendor/deep_merge/MIT-LICENSE +20 -20
- data/vendor/deep_merge/README +94 -94
- data/vendor/deep_merge/Rakefile +28 -28
- data/vendor/deep_merge/lib/deep_merge.rb +211 -211
- data/vendor/deep_merge/test/test_deep_merge.rb +553 -553
- data/vendor/diy/History.txt +28 -28
- data/vendor/diy/README.rdoc +233 -233
- data/vendor/diy/Rakefile +33 -33
- data/vendor/diy/TODO.txt +9 -9
- data/vendor/diy/diy.gemspec +131 -131
- data/vendor/diy/lib/diy.rb +403 -403
- data/vendor/diy/lib/diy/factory.rb +36 -36
- data/vendor/diy/sample_code/car.rb +7 -7
- data/vendor/diy/sample_code/chassis.rb +5 -5
- data/vendor/diy/sample_code/diy_example.rb +26 -26
- data/vendor/diy/sample_code/engine.rb +5 -5
- data/vendor/diy/sample_code/objects.yml +10 -10
- data/vendor/diy/test/constructor.rb +119 -119
- data/vendor/diy/test/diy_test.rb +608 -608
- data/vendor/diy/test/factory_test.rb +79 -79
- data/vendor/diy/test/files/broken_construction.yml +7 -7
- data/vendor/diy/test/files/cat/cat.rb +3 -3
- data/vendor/diy/test/files/cat/extra_conflict.yml +5 -5
- data/vendor/diy/test/files/cat/heritage.rb +2 -2
- data/vendor/diy/test/files/cat/needs_input.yml +3 -3
- data/vendor/diy/test/files/cat/the_cat_lineage.rb +1 -1
- data/vendor/diy/test/files/dog/dog_model.rb +3 -3
- data/vendor/diy/test/files/dog/dog_presenter.rb +3 -3
- data/vendor/diy/test/files/dog/dog_view.rb +2 -2
- data/vendor/diy/test/files/dog/file_resolver.rb +2 -2
- data/vendor/diy/test/files/dog/other_thing.rb +2 -2
- data/vendor/diy/test/files/dog/simple.yml +11 -11
- data/vendor/diy/test/files/donkey/foo.rb +8 -8
- data/vendor/diy/test/files/donkey/foo/bar/qux.rb +7 -7
- data/vendor/diy/test/files/factory/beef.rb +5 -5
- data/vendor/diy/test/files/factory/dog.rb +6 -6
- data/vendor/diy/test/files/factory/factory.yml +19 -19
- data/vendor/diy/test/files/factory/farm/llama.rb +7 -7
- data/vendor/diy/test/files/factory/farm/pork.rb +7 -7
- data/vendor/diy/test/files/factory/kitten.rb +13 -13
- data/vendor/diy/test/files/fud/objects.yml +13 -13
- data/vendor/diy/test/files/fud/toy.rb +14 -14
- data/vendor/diy/test/files/functions/attached_things_builder.rb +1 -1
- data/vendor/diy/test/files/functions/invalid_method.yml +4 -4
- data/vendor/diy/test/files/functions/method_extractor.rb +2 -2
- data/vendor/diy/test/files/functions/nonsingleton_objects.yml +5 -5
- data/vendor/diy/test/files/functions/objects.yml +21 -21
- data/vendor/diy/test/files/functions/thing.rb +2 -2
- data/vendor/diy/test/files/functions/thing_builder.rb +24 -24
- data/vendor/diy/test/files/functions/things_builder.rb +2 -2
- data/vendor/diy/test/files/gnu/objects.yml +14 -14
- data/vendor/diy/test/files/gnu/thinger.rb +7 -7
- data/vendor/diy/test/files/goat/base.rb +8 -8
- data/vendor/diy/test/files/goat/can.rb +6 -6
- data/vendor/diy/test/files/goat/goat.rb +6 -6
- data/vendor/diy/test/files/goat/objects.yml +12 -12
- data/vendor/diy/test/files/goat/paper.rb +6 -6
- data/vendor/diy/test/files/goat/plane.rb +7 -7
- data/vendor/diy/test/files/goat/shirt.rb +6 -6
- data/vendor/diy/test/files/goat/wings.rb +8 -8
- data/vendor/diy/test/files/horse/holder_thing.rb +3 -3
- data/vendor/diy/test/files/horse/objects.yml +7 -7
- data/vendor/diy/test/files/namespace/animal/bird.rb +5 -5
- data/vendor/diy/test/files/namespace/animal/cat.rb +5 -5
- data/vendor/diy/test/files/namespace/animal/reptile/hardshell/turtle.rb +8 -8
- data/vendor/diy/test/files/namespace/animal/reptile/lizard.rb +7 -7
- data/vendor/diy/test/files/namespace/bad_module_specified.yml +8 -8
- data/vendor/diy/test/files/namespace/class_name_combine.yml +8 -8
- data/vendor/diy/test/files/namespace/no_module_specified.yml +8 -8
- data/vendor/diy/test/files/namespace/objects.yml +21 -21
- data/vendor/diy/test/files/namespace/road.rb +2 -2
- data/vendor/diy/test/files/namespace/sky.rb +2 -2
- data/vendor/diy/test/files/namespace/subcontext.yml +22 -22
- data/vendor/diy/test/files/non_singleton/air.rb +2 -2
- data/vendor/diy/test/files/non_singleton/fat_cat.rb +3 -3
- data/vendor/diy/test/files/non_singleton/objects.yml +19 -19
- data/vendor/diy/test/files/non_singleton/pig.rb +3 -3
- data/vendor/diy/test/files/non_singleton/thread_spinner.rb +3 -3
- data/vendor/diy/test/files/non_singleton/tick.rb +3 -3
- data/vendor/diy/test/files/non_singleton/yard.rb +2 -2
- data/vendor/diy/test/files/yak/core_model.rb +3 -3
- data/vendor/diy/test/files/yak/core_presenter.rb +3 -3
- data/vendor/diy/test/files/yak/core_view.rb +1 -1
- data/vendor/diy/test/files/yak/data_source.rb +1 -1
- data/vendor/diy/test/files/yak/fringe_model.rb +3 -3
- data/vendor/diy/test/files/yak/fringe_presenter.rb +3 -3
- data/vendor/diy/test/files/yak/fringe_view.rb +1 -1
- data/vendor/diy/test/files/yak/giant_squid.rb +3 -3
- data/vendor/diy/test/files/yak/krill.rb +2 -2
- data/vendor/diy/test/files/yak/my_objects.yml +21 -21
- data/vendor/diy/test/files/yak/sub_sub_context_test.yml +27 -27
- data/vendor/diy/test/test_helper.rb +55 -55
- data/vendor/hardmock/CHANGES +78 -78
- data/vendor/hardmock/LICENSE +7 -7
- data/vendor/hardmock/README +70 -70
- data/vendor/hardmock/Rakefile +8 -8
- data/vendor/hardmock/config/environment.rb +12 -12
- data/vendor/hardmock/lib/assert_error.rb +23 -23
- data/vendor/hardmock/lib/extend_test_unit.rb +14 -14
- data/vendor/hardmock/lib/hardmock.rb +86 -86
- data/vendor/hardmock/lib/hardmock/errors.rb +22 -22
- data/vendor/hardmock/lib/hardmock/expectation.rb +229 -229
- data/vendor/hardmock/lib/hardmock/expectation_builder.rb +9 -9
- data/vendor/hardmock/lib/hardmock/expector.rb +26 -26
- data/vendor/hardmock/lib/hardmock/method_cleanout.rb +33 -33
- data/vendor/hardmock/lib/hardmock/mock.rb +180 -180
- data/vendor/hardmock/lib/hardmock/mock_control.rb +53 -53
- data/vendor/hardmock/lib/hardmock/stubbing.rb +210 -210
- data/vendor/hardmock/lib/hardmock/trapper.rb +31 -31
- data/vendor/hardmock/lib/hardmock/utils.rb +9 -9
- data/vendor/hardmock/lib/test_unit_before_after.rb +169 -169
- data/vendor/hardmock/rake_tasks/rdoc.rake +19 -19
- data/vendor/hardmock/rake_tasks/rdoc_options.rb +4 -4
- data/vendor/hardmock/rake_tasks/test.rake +22 -22
- data/vendor/hardmock/test/functional/assert_error_test.rb +52 -52
- data/vendor/hardmock/test/functional/auto_verify_test.rb +178 -178
- data/vendor/hardmock/test/functional/direct_mock_usage_test.rb +396 -396
- data/vendor/hardmock/test/functional/hardmock_test.rb +434 -434
- data/vendor/hardmock/test/functional/stubbing_test.rb +479 -479
- data/vendor/hardmock/test/test_helper.rb +43 -43
- data/vendor/hardmock/test/unit/expectation_builder_test.rb +19 -19
- data/vendor/hardmock/test/unit/expectation_test.rb +372 -372
- data/vendor/hardmock/test/unit/expector_test.rb +57 -57
- data/vendor/hardmock/test/unit/method_cleanout_test.rb +36 -36
- data/vendor/hardmock/test/unit/mock_control_test.rb +175 -175
- data/vendor/hardmock/test/unit/mock_test.rb +279 -279
- data/vendor/hardmock/test/unit/test_unit_before_after_test.rb +452 -452
- data/vendor/hardmock/test/unit/trapper_test.rb +62 -62
- data/vendor/hardmock/test/unit/verify_error_test.rb +40 -40
- data/vendor/unity/CMakeLists.txt +133 -31
- data/vendor/unity/LICENSE.txt +21 -21
- data/vendor/unity/README.md +191 -191
- data/vendor/unity/auto/colour_prompt.rb +119 -119
- data/vendor/unity/auto/colour_reporter.rb +39 -39
- data/vendor/unity/auto/generate_config.yml +36 -36
- data/vendor/unity/auto/generate_module.rb +312 -309
- data/vendor/unity/auto/generate_test_runner.rb +511 -495
- data/vendor/unity/auto/parse_output.rb +322 -322
- data/vendor/unity/auto/run_test.erb +37 -36
- data/vendor/unity/auto/stylize_as_junit.rb +251 -251
- data/vendor/unity/auto/test_file_filter.rb +25 -25
- data/vendor/unity/auto/type_sanitizer.rb +6 -6
- data/vendor/unity/auto/unity_test_summary.py +139 -139
- data/vendor/unity/auto/unity_test_summary.rb +135 -135
- data/vendor/unity/auto/unity_to_junit.py +146 -146
- data/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +206 -206
- data/vendor/unity/docs/UnityAssertionsReference.md +831 -850
- data/vendor/unity/docs/UnityConfigurationGuide.md +563 -541
- data/vendor/unity/docs/UnityGettingStartedGuide.md +251 -251
- data/vendor/unity/docs/UnityHelperScriptsGuide.md +278 -266
- data/vendor/unity/examples/example_1/makefile +72 -72
- data/vendor/unity/examples/example_1/readme.txt +4 -4
- data/vendor/unity/examples/example_1/src/ProductionCode.c +24 -24
- data/vendor/unity/examples/example_1/src/ProductionCode.h +3 -3
- data/vendor/unity/examples/example_1/src/ProductionCode2.c +11 -11
- data/vendor/unity/examples/example_1/src/ProductionCode2.h +2 -2
- data/vendor/unity/examples/example_1/test/TestProductionCode.c +62 -62
- data/vendor/unity/examples/example_1/test/TestProductionCode2.c +31 -31
- data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +53 -53
- data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +57 -57
- data/vendor/unity/examples/example_2/makefile +71 -71
- data/vendor/unity/examples/example_2/readme.txt +4 -4
- data/vendor/unity/examples/example_2/src/ProductionCode.c +24 -24
- data/vendor/unity/examples/example_2/src/ProductionCode.h +3 -3
- data/vendor/unity/examples/example_2/src/ProductionCode2.c +11 -11
- data/vendor/unity/examples/example_2/src/ProductionCode2.h +2 -2
- data/vendor/unity/examples/example_2/test/TestProductionCode.c +64 -64
- data/vendor/unity/examples/example_2/test/TestProductionCode2.c +33 -33
- data/vendor/unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c +8 -8
- data/vendor/unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c +10 -10
- data/vendor/unity/examples/example_2/test/test_runners/all_tests.c +12 -12
- data/vendor/unity/examples/example_3/helper/UnityHelper.c +10 -10
- data/vendor/unity/examples/example_3/helper/UnityHelper.h +12 -12
- data/vendor/unity/examples/example_3/rakefile.rb +38 -38
- data/vendor/unity/examples/example_3/rakefile_helper.rb +250 -250
- data/vendor/unity/examples/example_3/readme.txt +13 -13
- data/vendor/unity/examples/example_3/src/ProductionCode.c +24 -24
- data/vendor/unity/examples/example_3/src/ProductionCode.h +3 -3
- data/vendor/unity/examples/example_3/src/ProductionCode2.c +11 -11
- data/vendor/unity/examples/example_3/src/ProductionCode2.h +2 -2
- data/vendor/unity/examples/example_3/target_gcc_32.yml +47 -47
- data/vendor/unity/examples/example_3/test/TestProductionCode.c +62 -62
- data/vendor/unity/examples/example_3/test/TestProductionCode2.c +31 -31
- data/vendor/unity/examples/example_4/meson.build +12 -17
- data/vendor/unity/examples/example_4/readme.txt +14 -14
- data/vendor/unity/examples/example_4/src/ProductionCode.c +24 -24
- data/vendor/unity/examples/example_4/src/ProductionCode.h +3 -3
- data/vendor/unity/examples/example_4/src/ProductionCode2.c +11 -11
- data/vendor/unity/examples/example_4/src/ProductionCode2.h +2 -2
- data/vendor/unity/examples/example_4/src/meson.build +16 -21
- data/vendor/unity/examples/example_4/subprojects/unity.wrap +4 -4
- data/vendor/unity/examples/example_4/test/TestProductionCode.c +63 -63
- data/vendor/unity/examples/example_4/test/TestProductionCode2.c +35 -35
- data/vendor/unity/examples/example_4/test/meson.build +7 -12
- data/vendor/unity/examples/example_4/test/test_runners/TestProductionCode2_Runner.c +53 -53
- data/vendor/unity/examples/example_4/test/test_runners/TestProductionCode_Runner.c +57 -57
- data/vendor/unity/examples/example_4/test/test_runners/meson.build +13 -16
- data/vendor/unity/examples/unity_config.h +244 -263
- data/vendor/unity/extras/eclipse/error_parsers.txt +26 -26
- data/vendor/unity/extras/fixture/readme.md +29 -17
- data/vendor/unity/extras/fixture/src/unity_fixture.c +310 -275
- data/vendor/unity/extras/fixture/src/unity_fixture.h +83 -83
- data/vendor/unity/extras/fixture/src/unity_fixture_internals.h +50 -50
- data/vendor/unity/extras/fixture/test/Makefile +72 -72
- data/vendor/unity/extras/fixture/test/main/AllTests.c +20 -20
- data/vendor/unity/extras/fixture/test/template_fixture_tests.c +39 -39
- data/vendor/unity/extras/fixture/test/unity_fixture_Test.c +245 -245
- data/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +32 -32
- data/vendor/unity/extras/memory/readme.md +49 -49
- data/vendor/unity/extras/memory/src/unity_memory.c +202 -202
- data/vendor/unity/extras/memory/src/unity_memory.h +60 -60
- data/vendor/unity/extras/memory/test/Makefile +78 -78
- data/vendor/unity/extras/memory/test/unity_memory_Test.c +325 -325
- data/vendor/unity/extras/memory/test/unity_memory_TestRunner.c +49 -49
- data/vendor/unity/extras/memory/test/unity_output_Spy.c +56 -56
- data/vendor/unity/extras/memory/test/unity_output_Spy.h +16 -16
- data/vendor/unity/meson.build +48 -69
- data/vendor/unity/src/meson.build +11 -16
- data/vendor/unity/src/unity.c +2109 -2085
- data/vendor/unity/src/unity.h +661 -617
- data/vendor/unity/src/unity_internals.h +1030 -1002
- data/vendor/unity/test/Makefile +159 -67
- data/vendor/unity/test/expectdata/testsample_cmd.c +61 -61
- data/vendor/unity/test/expectdata/testsample_def.c +57 -57
- data/vendor/unity/test/expectdata/testsample_head1.c +55 -55
- data/vendor/unity/test/expectdata/testsample_head1.h +15 -15
- data/vendor/unity/test/expectdata/testsample_mock_cmd.c +80 -80
- data/vendor/unity/test/expectdata/testsample_mock_def.c +76 -76
- data/vendor/unity/test/expectdata/testsample_mock_head1.c +75 -75
- data/vendor/unity/test/expectdata/testsample_mock_head1.h +13 -13
- data/vendor/unity/test/expectdata/testsample_mock_new1.c +89 -89
- data/vendor/unity/test/expectdata/testsample_mock_new2.c +89 -89
- data/vendor/unity/test/expectdata/testsample_mock_param.c +77 -77
- data/vendor/unity/test/expectdata/testsample_mock_run1.c +89 -89
- data/vendor/unity/test/expectdata/testsample_mock_run2.c +89 -89
- data/vendor/unity/test/expectdata/testsample_mock_yaml.c +90 -90
- data/vendor/unity/test/expectdata/testsample_new1.c +67 -67
- data/vendor/unity/test/expectdata/testsample_new2.c +70 -70
- data/vendor/unity/test/expectdata/testsample_param.c +58 -58
- data/vendor/unity/test/expectdata/testsample_run1.c +67 -67
- data/vendor/unity/test/expectdata/testsample_run2.c +70 -70
- data/vendor/unity/test/expectdata/testsample_yaml.c +71 -71
- data/vendor/unity/test/rakefile +163 -124
- data/vendor/unity/test/rakefile_helper.rb +315 -269
- data/vendor/unity/test/spec/generate_module_existing_file_spec.rb +158 -158
- data/vendor/unity/test/targets/ansi.yml +44 -49
- data/vendor/unity/test/targets/clang_file.yml +72 -78
- data/vendor/unity/test/targets/clang_strict.yml +71 -78
- data/vendor/unity/test/targets/gcc_32.yml +45 -49
- data/vendor/unity/test/targets/gcc_64.yml +46 -50
- data/vendor/unity/test/targets/gcc_auto_limits.yml +43 -47
- data/vendor/unity/test/targets/gcc_auto_stdint.yml +55 -59
- data/vendor/unity/test/targets/gcc_manual_math.yml +43 -47
- data/vendor/unity/test/targets/hitech_picc18.yml +91 -101
- data/vendor/unity/test/targets/iar_arm_v4.yml +98 -90
- data/vendor/unity/test/targets/iar_arm_v5.yml +92 -80
- data/vendor/unity/test/targets/iar_arm_v5_3.yml +92 -80
- data/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +90 -94
- data/vendor/unity/test/targets/iar_cortexm3_v5.yml +94 -84
- data/vendor/unity/test/targets/iar_msp430.yml +112 -95
- data/vendor/unity/test/targets/iar_sh2a_v6.yml +99 -86
- data/vendor/unity/test/testdata/CException.h +11 -11
- data/vendor/unity/test/testdata/Defs.h +8 -8
- data/vendor/unity/test/testdata/cmock.h +14 -14
- data/vendor/unity/test/testdata/mockMock.h +13 -13
- data/vendor/unity/test/testdata/testRunnerGenerator.c +189 -189
- data/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +70 -70
- data/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +197 -197
- data/vendor/unity/test/tests/self_assessment_utils.h +144 -0
- data/vendor/unity/test/tests/test_generate_test_runner.rb +1260 -1268
- data/vendor/unity/test/tests/test_unity_arrays.c +2874 -0
- data/vendor/unity/test/tests/test_unity_core.c +371 -0
- data/vendor/unity/test/tests/test_unity_doubles.c +773 -0
- data/vendor/unity/test/tests/test_unity_floats.c +884 -0
- data/vendor/unity/test/tests/test_unity_integers.c +2847 -0
- data/vendor/unity/test/tests/test_unity_integers_64.c +773 -0
- data/vendor/unity/test/tests/test_unity_memory.c +81 -0
- data/vendor/{cmock/vendor/unity/test/tests/testparameterized.c → unity/test/tests/test_unity_parameterized.c} +171 -171
- data/vendor/unity/test/tests/test_unity_strings.c +329 -0
- data/vendor/unity/unityConfig.cmake +1 -0
- metadata +225 -62
- data/ceedling.sublime-project +0 -28
- data/ceedling.sublime-workspace +0 -1276
- data/docs/CeedlingPacket.odt +0 -0
- data/docs/CeedlingPacket.pdf +0 -0
- data/plugins/bullseye/readme.txt +0 -0
- data/vendor/c_exception/LICENSE.txt +0 -30
- data/vendor/c_exception/Rakefile +0 -42
- data/vendor/c_exception/makefile +0 -24
- data/vendor/c_exception/test/TestException_Runner.c +0 -67
- data/vendor/cmock/vendor/c_exception/LICENSE.txt +0 -30
- data/vendor/cmock/vendor/c_exception/Rakefile +0 -42
- data/vendor/cmock/vendor/c_exception/makefile +0 -24
- data/vendor/cmock/vendor/c_exception/test/TestException_Runner.c +0 -67
- data/vendor/cmock/vendor/unity/extras/fixture/rakefile_helper.rb +0 -183
- data/vendor/cmock/vendor/unity/extras/memory/rakefile.rb +0 -45
- data/vendor/cmock/vendor/unity/extras/memory/rakefile_helper.rb +0 -187
- data/vendor/cmock/vendor/unity/src/CMakeLists.txt +0 -22
- data/vendor/unity/extras/fixture/rakefile.rb +0 -44
- data/vendor/unity/extras/fixture/rakefile_helper.rb +0 -183
- data/vendor/unity/extras/memory/rakefile.rb +0 -45
- data/vendor/unity/extras/memory/rakefile_helper.rb +0 -187
- data/vendor/unity/src/CMakeLists.txt +0 -22
- data/vendor/unity/test/tests/testunity.c +0 -8168
@@ -1,2000 +1,2717 @@
|
|
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
|
-
$ThisIsOnlyATest = true
|
8
|
-
|
9
|
-
require File.expand_path(File.dirname(__FILE__)) + "/../test_helper"
|
10
|
-
require File.expand_path(File.dirname(__FILE__)) + '/../../lib/cmock_header_parser'
|
11
|
-
|
12
|
-
describe CMockHeaderParser, "Verify CMockHeaderParser Module" do
|
13
|
-
|
14
|
-
before do
|
15
|
-
create_mocks :config
|
16
|
-
@test_name = 'test_file.h'
|
17
|
-
@config.expect :strippables, ["STRIPPABLE"]
|
18
|
-
@config.expect :attributes, ['__ramfunc', 'funky_attrib', 'SQLITE_API']
|
19
|
-
@config.expect :c_calling_conventions, ['__stdcall']
|
20
|
-
@config.expect :treat_as_void, ['MY_FUNKY_VOID']
|
21
|
-
@config.expect :treat_as, { "BANJOS" => "INT", "TUBAS" => "HEX16"}
|
22
|
-
@config.expect :treat_as_array, {"IntArray" => "int", "Book" => "Page"}
|
23
|
-
@config.expect :when_no_prototypes, :error
|
24
|
-
@config.expect :verbosity, 1
|
25
|
-
@config.expect :treat_externs, :exclude
|
26
|
-
@config.expect :treat_inlines, :exclude
|
27
|
-
@config.expect :
|
28
|
-
@config.expect :
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
assert_equal([
|
39
|
-
assert_equal(['
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
"
|
46
|
-
"
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
"
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
"
|
61
|
-
"
|
62
|
-
"
|
63
|
-
"
|
64
|
-
"//
|
65
|
-
"
|
66
|
-
"
|
67
|
-
"
|
68
|
-
"
|
69
|
-
"
|
70
|
-
"
|
71
|
-
"
|
72
|
-
"
|
73
|
-
"
|
74
|
-
"
|
75
|
-
"
|
76
|
-
"
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
"
|
82
|
-
"
|
83
|
-
"
|
84
|
-
"
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
"void
|
94
|
-
"
|
95
|
-
"
|
96
|
-
"
|
97
|
-
"
|
98
|
-
"
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
"void
|
104
|
-
"void
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
"void
|
114
|
-
"
|
115
|
-
"
|
116
|
-
"
|
117
|
-
"
|
118
|
-
"
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
"void
|
124
|
-
"void
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
"#
|
134
|
-
"#
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
"
|
146
|
-
"
|
147
|
-
"
|
148
|
-
"
|
149
|
-
"
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
"
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
"
|
175
|
-
"and the
|
176
|
-
"
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
"
|
188
|
-
"int
|
189
|
-
"int
|
190
|
-
"
|
191
|
-
"
|
192
|
-
"
|
193
|
-
"
|
194
|
-
"typedef
|
195
|
-
"
|
196
|
-
"
|
197
|
-
"
|
198
|
-
"
|
199
|
-
"
|
200
|
-
"
|
201
|
-
"
|
202
|
-
"
|
203
|
-
"
|
204
|
-
"
|
205
|
-
"
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
"int
|
211
|
-
"
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
"
|
222
|
-
"
|
223
|
-
"
|
224
|
-
"
|
225
|
-
"
|
226
|
-
"
|
227
|
-
"
|
228
|
-
"
|
229
|
-
"
|
230
|
-
"
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
"
|
240
|
-
"
|
241
|
-
"
|
242
|
-
"
|
243
|
-
"
|
244
|
-
"
|
245
|
-
"
|
246
|
-
"
|
247
|
-
"
|
248
|
-
"
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
"
|
258
|
-
"
|
259
|
-
"
|
260
|
-
"
|
261
|
-
"
|
262
|
-
"
|
263
|
-
"
|
264
|
-
"
|
265
|
-
"
|
266
|
-
"
|
267
|
-
"
|
268
|
-
"
|
269
|
-
"
|
270
|
-
"
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
"uint32
|
280
|
-
"uint32
|
281
|
-
"
|
282
|
-
"
|
283
|
-
"
|
284
|
-
"
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
"uint32
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
"uint32 func_with_decl_a(unsigned int
|
299
|
-
"uint32
|
300
|
-
"uint32 func_with_decl_b(unsigned int
|
301
|
-
"
|
302
|
-
"
|
303
|
-
"
|
304
|
-
"
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
"uint32 func_with_decl_a",
|
310
|
-
"uint32
|
311
|
-
"uint32 func_with_decl_b",
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
"uint32 func_with_decl_a(unsigned int
|
321
|
-
"
|
322
|
-
"
|
323
|
-
"
|
324
|
-
"
|
325
|
-
"
|
326
|
-
"
|
327
|
-
"
|
328
|
-
"uint32 func_with_decl_b(unsigned int
|
329
|
-
"
|
330
|
-
"
|
331
|
-
"
|
332
|
-
"
|
333
|
-
"
|
334
|
-
"uint32 func_with_decl_c(unsigned int
|
335
|
-
"
|
336
|
-
"
|
337
|
-
"
|
338
|
-
"
|
339
|
-
"
|
340
|
-
"
|
341
|
-
"
|
342
|
-
"
|
343
|
-
"
|
344
|
-
"}\n"
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
"uint32 func_with_decl_a",
|
350
|
-
"uint32
|
351
|
-
"uint32 func_with_decl_b",
|
352
|
-
"uint32
|
353
|
-
"uint32 func_with_decl_c",
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
"inline void
|
363
|
-
"inline void bar(unsigned int a)
|
364
|
-
"
|
365
|
-
"
|
366
|
-
"
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
"
|
387
|
-
"
|
388
|
-
"
|
389
|
-
"
|
390
|
-
"
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
"
|
411
|
-
"
|
412
|
-
"
|
413
|
-
"
|
414
|
-
"
|
415
|
-
"
|
416
|
-
"
|
417
|
-
"
|
418
|
-
"
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
"uint32
|
439
|
-
"uint32
|
440
|
-
"
|
441
|
-
"
|
442
|
-
"
|
443
|
-
"
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
"uint32
|
449
|
-
"
|
450
|
-
"extern void
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
"uint32
|
461
|
-
"uint32
|
462
|
-
"
|
463
|
-
"
|
464
|
-
"
|
465
|
-
"static inline void
|
466
|
-
"static inline void bar(unsigned int)
|
467
|
-
"
|
468
|
-
"
|
469
|
-
"
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
"
|
475
|
-
"void
|
476
|
-
"void
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
"uint32
|
487
|
-
"uint32
|
488
|
-
"
|
489
|
-
"
|
490
|
-
"
|
491
|
-
"static inline void
|
492
|
-
"static inline void bar(unsigned int)
|
493
|
-
"
|
494
|
-
"
|
495
|
-
"
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
"uint32
|
501
|
-
"
|
502
|
-
"
|
503
|
-
"
|
504
|
-
"void
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
@parser.
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
"
|
516
|
-
"
|
517
|
-
"
|
518
|
-
"
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
"
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
"
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
it "
|
545
|
-
source =
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
:
|
580
|
-
:
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
:
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
source
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
"
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
assert_equal(
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
#
|
670
|
-
|
671
|
-
@parser.parse("module", source)
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
:
|
735
|
-
:
|
736
|
-
:
|
737
|
-
:
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
:name=>"
|
742
|
-
|
743
|
-
|
744
|
-
:
|
745
|
-
:
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
:
|
756
|
-
:
|
757
|
-
:
|
758
|
-
:
|
759
|
-
:
|
760
|
-
|
761
|
-
|
762
|
-
:
|
763
|
-
:
|
764
|
-
:
|
765
|
-
:
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
:
|
782
|
-
:
|
783
|
-
:
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
:
|
789
|
-
:
|
790
|
-
|
791
|
-
|
792
|
-
:
|
793
|
-
:
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
:
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
:
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
:return
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
:
|
913
|
-
:
|
914
|
-
:
|
915
|
-
:
|
916
|
-
:
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
:
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
:
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
:
|
1026
|
-
|
1027
|
-
:
|
1028
|
-
:
|
1029
|
-
:
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
expected
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
:
|
1054
|
-
:
|
1055
|
-
:
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
},
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
:
|
1099
|
-
|
1100
|
-
|
1101
|
-
:
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
},
|
1109
|
-
:
|
1110
|
-
:
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
1247
|
-
|
1248
|
-
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
:
|
1265
|
-
:
|
1266
|
-
:
|
1267
|
-
:
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
:
|
1272
|
-
:
|
1273
|
-
:
|
1274
|
-
:
|
1275
|
-
|
1276
|
-
{:type=>"
|
1277
|
-
|
1278
|
-
|
1279
|
-
:
|
1280
|
-
|
1281
|
-
|
1282
|
-
|
1283
|
-
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1289
|
-
:
|
1290
|
-
:
|
1291
|
-
:
|
1292
|
-
:
|
1293
|
-
:
|
1294
|
-
|
1295
|
-
|
1296
|
-
:
|
1297
|
-
:
|
1298
|
-
:
|
1299
|
-
:
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
|
1306
|
-
|
1307
|
-
|
1308
|
-
|
1309
|
-
|
1310
|
-
|
1311
|
-
|
1312
|
-
|
1313
|
-
|
1314
|
-
|
1315
|
-
|
1316
|
-
|
1317
|
-
:
|
1318
|
-
:
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
:
|
1326
|
-
:
|
1327
|
-
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
:
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
:
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1351
|
-
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1372
|
-
|
1373
|
-
:
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
:
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
1392
|
-
:
|
1393
|
-
:
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1429
|
-
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1433
|
-
|
1434
|
-
|
1435
|
-
|
1436
|
-
|
1437
|
-
:
|
1438
|
-
:
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
|
1446
|
-
:
|
1447
|
-
:
|
1448
|
-
|
1449
|
-
|
1450
|
-
|
1451
|
-
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1460
|
-
|
1461
|
-
|
1462
|
-
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1468
|
-
|
1469
|
-
|
1470
|
-
|
1471
|
-
|
1472
|
-
:
|
1473
|
-
:
|
1474
|
-
|
1475
|
-
|
1476
|
-
|
1477
|
-
|
1478
|
-
|
1479
|
-
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1486
|
-
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1490
|
-
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1495
|
-
|
1496
|
-
|
1497
|
-
|
1498
|
-
|
1499
|
-
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
:
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1517
|
-
:
|
1518
|
-
|
1519
|
-
|
1520
|
-
|
1521
|
-
|
1522
|
-
|
1523
|
-
|
1524
|
-
|
1525
|
-
|
1526
|
-
|
1527
|
-
|
1528
|
-
|
1529
|
-
|
1530
|
-
|
1531
|
-
:
|
1532
|
-
|
1533
|
-
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1544
|
-
:
|
1545
|
-
|
1546
|
-
|
1547
|
-
|
1548
|
-
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
|
1553
|
-
|
1554
|
-
:
|
1555
|
-
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
1566
|
-
|
1567
|
-
|
1568
|
-
|
1569
|
-
|
1570
|
-
|
1571
|
-
|
1572
|
-
|
1573
|
-
|
1574
|
-
|
1575
|
-
|
1576
|
-
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
|
1581
|
-
|
1582
|
-
|
1583
|
-
|
1584
|
-
|
1585
|
-
:name=>"
|
1586
|
-
|
1587
|
-
:
|
1588
|
-
:
|
1589
|
-
|
1590
|
-
|
1591
|
-
|
1592
|
-
|
1593
|
-
|
1594
|
-
|
1595
|
-
|
1596
|
-
|
1597
|
-
|
1598
|
-
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
1602
|
-
|
1603
|
-
|
1604
|
-
|
1605
|
-
|
1606
|
-
|
1607
|
-
|
1608
|
-
|
1609
|
-
|
1610
|
-
|
1611
|
-
|
1612
|
-
|
1613
|
-
|
1614
|
-
|
1615
|
-
|
1616
|
-
|
1617
|
-
|
1618
|
-
|
1619
|
-
|
1620
|
-
|
1621
|
-
|
1622
|
-
|
1623
|
-
|
1624
|
-
|
1625
|
-
|
1626
|
-
|
1627
|
-
|
1628
|
-
|
1629
|
-
|
1630
|
-
|
1631
|
-
|
1632
|
-
|
1633
|
-
|
1634
|
-
|
1635
|
-
|
1636
|
-
|
1637
|
-
|
1638
|
-
|
1639
|
-
|
1640
|
-
|
1641
|
-
|
1642
|
-
|
1643
|
-
|
1644
|
-
|
1645
|
-
|
1646
|
-
|
1647
|
-
assert_equal(
|
1648
|
-
end
|
1649
|
-
|
1650
|
-
it "extract functions
|
1651
|
-
source = "
|
1652
|
-
expected = [{ :var_arg=>nil,
|
1653
|
-
|
1654
|
-
|
1655
|
-
|
1656
|
-
|
1657
|
-
|
1658
|
-
|
1659
|
-
|
1660
|
-
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1664
|
-
|
1665
|
-
|
1666
|
-
|
1667
|
-
|
1668
|
-
|
1669
|
-
|
1670
|
-
|
1671
|
-
|
1672
|
-
|
1673
|
-
|
1674
|
-
|
1675
|
-
|
1676
|
-
|
1677
|
-
|
1678
|
-
|
1679
|
-
|
1680
|
-
|
1681
|
-
|
1682
|
-
|
1683
|
-
|
1684
|
-
|
1685
|
-
|
1686
|
-
|
1687
|
-
|
1688
|
-
|
1689
|
-
|
1690
|
-
|
1691
|
-
|
1692
|
-
|
1693
|
-
|
1694
|
-
|
1695
|
-
|
1696
|
-
|
1697
|
-
|
1698
|
-
|
1699
|
-
|
1700
|
-
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1704
|
-
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1708
|
-
|
1709
|
-
|
1710
|
-
|
1711
|
-
|
1712
|
-
|
1713
|
-
|
1714
|
-
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1718
|
-
|
1719
|
-
|
1720
|
-
|
1721
|
-
|
1722
|
-
|
1723
|
-
|
1724
|
-
|
1725
|
-
|
1726
|
-
|
1727
|
-
|
1728
|
-
|
1729
|
-
|
1730
|
-
|
1731
|
-
|
1732
|
-
|
1733
|
-
|
1734
|
-
|
1735
|
-
|
1736
|
-
|
1737
|
-
|
1738
|
-
|
1739
|
-
|
1740
|
-
|
1741
|
-
|
1742
|
-
|
1743
|
-
|
1744
|
-
|
1745
|
-
|
1746
|
-
|
1747
|
-
|
1748
|
-
|
1749
|
-
|
1750
|
-
|
1751
|
-
|
1752
|
-
|
1753
|
-
|
1754
|
-
|
1755
|
-
|
1756
|
-
|
1757
|
-
|
1758
|
-
|
1759
|
-
|
1760
|
-
|
1761
|
-
|
1762
|
-
|
1763
|
-
|
1764
|
-
|
1765
|
-
|
1766
|
-
|
1767
|
-
|
1768
|
-
|
1769
|
-
|
1770
|
-
|
1771
|
-
|
1772
|
-
|
1773
|
-
|
1774
|
-
|
1775
|
-
|
1776
|
-
|
1777
|
-
|
1778
|
-
|
1779
|
-
|
1780
|
-
|
1781
|
-
|
1782
|
-
|
1783
|
-
|
1784
|
-
|
1785
|
-
|
1786
|
-
|
1787
|
-
|
1788
|
-
|
1789
|
-
|
1790
|
-
|
1791
|
-
|
1792
|
-
|
1793
|
-
|
1794
|
-
|
1795
|
-
|
1796
|
-
|
1797
|
-
|
1798
|
-
|
1799
|
-
|
1800
|
-
|
1801
|
-
|
1802
|
-
|
1803
|
-
|
1804
|
-
|
1805
|
-
|
1806
|
-
|
1807
|
-
|
1808
|
-
|
1809
|
-
|
1810
|
-
|
1811
|
-
|
1812
|
-
|
1813
|
-
|
1814
|
-
|
1815
|
-
|
1816
|
-
|
1817
|
-
|
1818
|
-
|
1819
|
-
|
1820
|
-
|
1821
|
-
|
1822
|
-
|
1823
|
-
|
1824
|
-
|
1825
|
-
|
1826
|
-
|
1827
|
-
|
1828
|
-
|
1829
|
-
|
1830
|
-
|
1831
|
-
|
1832
|
-
|
1833
|
-
|
1834
|
-
|
1835
|
-
|
1836
|
-
|
1837
|
-
|
1838
|
-
|
1839
|
-
|
1840
|
-
|
1841
|
-
|
1842
|
-
|
1843
|
-
|
1844
|
-
|
1845
|
-
|
1846
|
-
|
1847
|
-
|
1848
|
-
|
1849
|
-
|
1850
|
-
|
1851
|
-
|
1852
|
-
|
1853
|
-
|
1854
|
-
|
1855
|
-
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1859
|
-
|
1860
|
-
|
1861
|
-
|
1862
|
-
|
1863
|
-
|
1864
|
-
|
1865
|
-
|
1866
|
-
|
1867
|
-
|
1868
|
-
|
1869
|
-
|
1870
|
-
|
1871
|
-
|
1872
|
-
|
1873
|
-
|
1874
|
-
|
1875
|
-
|
1876
|
-
|
1877
|
-
|
1878
|
-
|
1879
|
-
|
1880
|
-
|
1881
|
-
|
1882
|
-
|
1883
|
-
|
1884
|
-
|
1885
|
-
|
1886
|
-
|
1887
|
-
|
1888
|
-
|
1889
|
-
|
1890
|
-
|
1891
|
-
|
1892
|
-
|
1893
|
-
|
1894
|
-
|
1895
|
-
|
1896
|
-
|
1897
|
-
|
1898
|
-
|
1899
|
-
|
1900
|
-
|
1901
|
-
|
1902
|
-
|
1903
|
-
|
1904
|
-
|
1905
|
-
|
1906
|
-
|
1907
|
-
|
1908
|
-
|
1909
|
-
|
1910
|
-
|
1911
|
-
|
1912
|
-
|
1913
|
-
|
1914
|
-
|
1915
|
-
|
1916
|
-
|
1917
|
-
|
1918
|
-
|
1919
|
-
|
1920
|
-
|
1921
|
-
|
1922
|
-
|
1923
|
-
|
1924
|
-
|
1925
|
-
|
1926
|
-
|
1927
|
-
|
1928
|
-
|
1929
|
-
|
1930
|
-
|
1931
|
-
|
1932
|
-
|
1933
|
-
|
1934
|
-
|
1935
|
-
|
1936
|
-
|
1937
|
-
|
1938
|
-
|
1939
|
-
|
1940
|
-
|
1941
|
-
|
1942
|
-
|
1943
|
-
|
1944
|
-
assert_equal(expected, @parser.
|
1945
|
-
end
|
1946
|
-
|
1947
|
-
it "
|
1948
|
-
|
1949
|
-
|
1950
|
-
"
|
1951
|
-
"
|
1952
|
-
"
|
1953
|
-
|
1954
|
-
"
|
1955
|
-
"
|
1956
|
-
"
|
1957
|
-
"
|
1958
|
-
"
|
1959
|
-
"
|
1960
|
-
"
|
1961
|
-
"
|
1962
|
-
"
|
1963
|
-
"
|
1964
|
-
"
|
1965
|
-
"
|
1966
|
-
"
|
1967
|
-
|
1968
|
-
|
1969
|
-
|
1970
|
-
|
1971
|
-
|
1972
|
-
|
1973
|
-
|
1974
|
-
|
1975
|
-
|
1976
|
-
|
1977
|
-
|
1978
|
-
|
1979
|
-
|
1980
|
-
|
1981
|
-
|
1982
|
-
|
1983
|
-
|
1984
|
-
"
|
1985
|
-
"
|
1986
|
-
"
|
1987
|
-
"
|
1988
|
-
"
|
1989
|
-
"
|
1990
|
-
"
|
1991
|
-
|
1992
|
-
"
|
1993
|
-
"
|
1994
|
-
|
1995
|
-
|
1996
|
-
|
1997
|
-
|
1998
|
-
|
1999
|
-
|
2000
|
-
|
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
|
+
$ThisIsOnlyATest = true
|
8
|
+
|
9
|
+
require File.expand_path(File.dirname(__FILE__)) + "/../test_helper"
|
10
|
+
require File.expand_path(File.dirname(__FILE__)) + '/../../lib/cmock_header_parser'
|
11
|
+
|
12
|
+
describe CMockHeaderParser, "Verify CMockHeaderParser Module" do
|
13
|
+
|
14
|
+
before do
|
15
|
+
create_mocks :config
|
16
|
+
@test_name = 'test_file.h'
|
17
|
+
@config.expect :strippables, ["STRIPPABLE"]
|
18
|
+
@config.expect :attributes, ['__ramfunc', 'funky_attrib', 'SQLITE_API']
|
19
|
+
@config.expect :c_calling_conventions, ['__stdcall']
|
20
|
+
@config.expect :treat_as_void, ['MY_FUNKY_VOID']
|
21
|
+
@config.expect :treat_as, { "BANJOS" => "INT", "TUBAS" => "HEX16"}
|
22
|
+
@config.expect :treat_as_array, {"IntArray" => "int", "Book" => "Page"}
|
23
|
+
@config.expect :when_no_prototypes, :error
|
24
|
+
@config.expect :verbosity, 1
|
25
|
+
@config.expect :treat_externs, :exclude
|
26
|
+
@config.expect :treat_inlines, :exclude
|
27
|
+
@config.expect :inline_function_patterns, ['(static\s+inline|inline\s+static)\s*', '(\bstatic\b|\binline\b)\s*']
|
28
|
+
@config.expect :array_size_type, ['int', 'size_t']
|
29
|
+
@config.expect :array_size_name, 'size|len'
|
30
|
+
|
31
|
+
@parser = CMockHeaderParser.new(@config)
|
32
|
+
end
|
33
|
+
|
34
|
+
after do
|
35
|
+
end
|
36
|
+
|
37
|
+
it "create and initialize variables to defaults appropriately" do
|
38
|
+
assert_equal([], @parser.funcs)
|
39
|
+
assert_equal(['const', '__ramfunc', 'funky_attrib', 'SQLITE_API'], @parser.c_attributes)
|
40
|
+
assert_equal(['void','MY_FUNKY_VOID'], @parser.treat_as_void)
|
41
|
+
end
|
42
|
+
|
43
|
+
it "strip out line comments" do
|
44
|
+
source =
|
45
|
+
" abcd;\n" +
|
46
|
+
"// hello;\n" +
|
47
|
+
"who // is you\n"
|
48
|
+
|
49
|
+
expected =
|
50
|
+
[
|
51
|
+
"abcd",
|
52
|
+
"who"
|
53
|
+
]
|
54
|
+
|
55
|
+
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
|
56
|
+
end
|
57
|
+
|
58
|
+
it "remove block comments" do
|
59
|
+
source =
|
60
|
+
" no_comments;\n" +
|
61
|
+
"// basic_line_comment;\n" +
|
62
|
+
"/* basic_block_comment;*/\n" +
|
63
|
+
"pre_block; /* start_of_block_comment;\n" +
|
64
|
+
"// embedded_line_comment_in_block_comment; */\n" +
|
65
|
+
"// /* commented_out_block_comment_line\n" +
|
66
|
+
"shown_because_block_comment_invalid_from_line_comment;\n" +
|
67
|
+
"// */\n" +
|
68
|
+
"//* shorter_commented_out_block_comment_line; \n" +
|
69
|
+
"shown_because_block_comment_invalid_from_shorter_line_comment;\n" +
|
70
|
+
"/*/\n" +
|
71
|
+
"not_shown_because_line_above_started_comment;\n" +
|
72
|
+
"//*/\n" +
|
73
|
+
"/* \n" +
|
74
|
+
"not_shown_because_block_comment_started_this_time;\n" +
|
75
|
+
"/*/\n" +
|
76
|
+
"shown_because_line_above_ended_comment_this_time;\n" +
|
77
|
+
"//*/\n"
|
78
|
+
|
79
|
+
expected =
|
80
|
+
[
|
81
|
+
"no_comments",
|
82
|
+
"pre_block",
|
83
|
+
"shown_because_block_comment_invalid_from_line_comment",
|
84
|
+
"shown_because_block_comment_invalid_from_shorter_line_comment",
|
85
|
+
"shown_because_line_above_ended_comment_this_time"
|
86
|
+
]
|
87
|
+
|
88
|
+
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
|
89
|
+
end
|
90
|
+
|
91
|
+
it "remove strippables from the beginning or end of function declarations" do
|
92
|
+
source =
|
93
|
+
"void* my_calloc(size_t, size_t) STRIPPABLE;\n" +
|
94
|
+
"void\n" +
|
95
|
+
" my_realloc(void*, size_t) STRIPPABLE;\n" +
|
96
|
+
"extern int\n" +
|
97
|
+
" my_printf (void *my_object, const char *my_format, ...)\n" +
|
98
|
+
" STRIPPABLE;\n" +
|
99
|
+
" void STRIPPABLE universal_handler ();\n"
|
100
|
+
|
101
|
+
expected =
|
102
|
+
[
|
103
|
+
"void* my_calloc(size_t, size_t)",
|
104
|
+
"void my_realloc(void*, size_t)",
|
105
|
+
"void universal_handler()"
|
106
|
+
]
|
107
|
+
|
108
|
+
assert_equal(expected, @parser.import_source(source))
|
109
|
+
end
|
110
|
+
|
111
|
+
it "remove gcc's function __attribute__'s" do
|
112
|
+
source =
|
113
|
+
"void* my_calloc(size_t, size_t) __attribute__((alloc_size(1,2)));\n" +
|
114
|
+
"void\n" +
|
115
|
+
" my_realloc(void*, size_t) __attribute__((alloc_size(2)));\n" +
|
116
|
+
"extern int\n" +
|
117
|
+
" my_printf (void *my_object, const char *my_format, ...)\n" +
|
118
|
+
" __attribute__ ((format (printf, 2, 3)));\n" +
|
119
|
+
" void __attribute__ ((interrupt)) universal_handler ();\n"
|
120
|
+
|
121
|
+
expected =
|
122
|
+
[
|
123
|
+
"void* my_calloc(size_t, size_t)",
|
124
|
+
"void my_realloc(void*, size_t)",
|
125
|
+
"void universal_handler()"
|
126
|
+
]
|
127
|
+
|
128
|
+
assert_equal(expected, @parser.import_source(source))
|
129
|
+
end
|
130
|
+
|
131
|
+
it "remove preprocessor directives" do
|
132
|
+
source =
|
133
|
+
"#when stuff_happens\n" +
|
134
|
+
"#ifdef _TEST\n" +
|
135
|
+
"#pragma stack_switch"
|
136
|
+
|
137
|
+
expected = []
|
138
|
+
|
139
|
+
assert_equal(expected, @parser.import_source(source))
|
140
|
+
end
|
141
|
+
|
142
|
+
|
143
|
+
it "remove assembler pragma sections" do
|
144
|
+
source =
|
145
|
+
" #pragma\tasm\n" +
|
146
|
+
" .foo\n" +
|
147
|
+
" lda %m\n" +
|
148
|
+
" nop\n" +
|
149
|
+
"# pragma endasm \n" +
|
150
|
+
"foo"
|
151
|
+
|
152
|
+
expected = ["foo"]
|
153
|
+
|
154
|
+
assert_equal(expected, @parser.import_source(source))
|
155
|
+
end
|
156
|
+
|
157
|
+
|
158
|
+
it "smush lines together that contain continuation characters" do
|
159
|
+
source =
|
160
|
+
"hoo hah \\\n" +
|
161
|
+
"when \\ \n"
|
162
|
+
|
163
|
+
expected =
|
164
|
+
[
|
165
|
+
"hoo hah when"
|
166
|
+
]
|
167
|
+
|
168
|
+
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
|
169
|
+
end
|
170
|
+
|
171
|
+
|
172
|
+
it "remove C macro definitions" do
|
173
|
+
source =
|
174
|
+
"#define this is the first line\\\n" +
|
175
|
+
"and the second\\\n" +
|
176
|
+
"and the third that should be removed\n" +
|
177
|
+
"but I'm here\n"
|
178
|
+
|
179
|
+
expected = ["but I'm here"]
|
180
|
+
|
181
|
+
assert_equal(expected, @parser.import_source(source))
|
182
|
+
end
|
183
|
+
|
184
|
+
|
185
|
+
it "remove typedef statements" do
|
186
|
+
source =
|
187
|
+
"typedef uint32 (unsigned int);\n" +
|
188
|
+
"const typedef int INT;\n" +
|
189
|
+
"int notatypedef;\n" +
|
190
|
+
"int typedef_isnt_me;\n" +
|
191
|
+
" typedef who cares what really comes here \n" + # exercise multiline typedef
|
192
|
+
" continuation;\n" +
|
193
|
+
"this should remain!;\n" +
|
194
|
+
"typedef blah bleh;\n" +
|
195
|
+
"typedef struct shell_command_struct {\n" +
|
196
|
+
" char_ptr COMMAND;\n" +
|
197
|
+
" int_32 (*SHELL_FUNC)(int_32 argc);\n" +
|
198
|
+
"} SHELL_COMMAND_STRUCT, * SHELL_COMMAND_PTR;\n" +
|
199
|
+
"typedef struct shell_command_struct {\n" +
|
200
|
+
" char_ptr COMMAND;\n" +
|
201
|
+
" int_32 (*SHELL_FUNC)(int_32 argc, char_ptr argv[]);\n" +
|
202
|
+
"} SHELL_COMMAND_STRUCT, * SHELL_COMMAND_PTR;\n" +
|
203
|
+
"typedef struct shell_command_struct {\n" +
|
204
|
+
" char_ptr COMMAND;\n" +
|
205
|
+
" int_32 (*SHELL_FUNC)(int_32 argc);\n" +
|
206
|
+
"};\n"
|
207
|
+
|
208
|
+
expected =
|
209
|
+
[
|
210
|
+
"int notatypedef",
|
211
|
+
"int typedef_isnt_me",
|
212
|
+
"this should remain!"
|
213
|
+
]
|
214
|
+
|
215
|
+
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
|
216
|
+
end
|
217
|
+
|
218
|
+
|
219
|
+
it "remove enum statements" do
|
220
|
+
source =
|
221
|
+
"enum _NamedEnum {\n" +
|
222
|
+
" THING1 = (0x0001),\n" +
|
223
|
+
" THING2 = (0x0001 << 5),\n" +
|
224
|
+
"}ListOValues;\n\n" +
|
225
|
+
"don't delete me!!\n" +
|
226
|
+
" modifier_str enum _NamedEnum {THING1 = (0x0001), THING2 = (0x0001 << 5)} ListOValues;\n\n" +
|
227
|
+
"typedef enum {\n" +
|
228
|
+
" THING1,\n" +
|
229
|
+
" THING2,\n" +
|
230
|
+
"} Thinger;\n" +
|
231
|
+
"or me!!\n"
|
232
|
+
|
233
|
+
assert_equal(["don't delete me!! or me!!"], @parser.import_source(source).map!{|s|s.strip})
|
234
|
+
end
|
235
|
+
|
236
|
+
|
237
|
+
it "remove union statements" do
|
238
|
+
source =
|
239
|
+
"union _NamedDoohicky {\n" +
|
240
|
+
" unsigned int a;\n" +
|
241
|
+
" char b;\n" +
|
242
|
+
"} Doohicky;\n\n" +
|
243
|
+
"I want to live!!\n" +
|
244
|
+
"some_modifier union { unsigned int a; char b;} Whatever;\n" +
|
245
|
+
"typedef union {\n" +
|
246
|
+
" unsigned int a;\n" +
|
247
|
+
" char b;\n" +
|
248
|
+
"} Whatever;\n" +
|
249
|
+
"me too!!\n"
|
250
|
+
|
251
|
+
assert_equal(["I want to live!! me too!!"], @parser.import_source(source).map!{|s|s.strip})
|
252
|
+
end
|
253
|
+
|
254
|
+
|
255
|
+
it "remove struct statements" do
|
256
|
+
source =
|
257
|
+
"struct _NamedStruct1 {\n" +
|
258
|
+
" unsigned int a;\n" +
|
259
|
+
" signed long int b;\n" +
|
260
|
+
"} Thing ;\n\n" +
|
261
|
+
"extern struct ForwardDeclared_t TestDataType1;\n" +
|
262
|
+
"void foo(void);\n" +
|
263
|
+
"struct\n"+
|
264
|
+
" MultilineForwardDeclared_t\n" +
|
265
|
+
" TestDataType2;\n" +
|
266
|
+
"struct THINGER foo(void);\n" +
|
267
|
+
"typedef struct {\n" +
|
268
|
+
" unsigned int a;\n" +
|
269
|
+
" signed char b;\n" +
|
270
|
+
"}Thinger;\n" +
|
271
|
+
"I want to live!!\n"
|
272
|
+
|
273
|
+
assert_equal(["void foo(void)", "struct THINGER foo(void)", "I want to live!!"],
|
274
|
+
@parser.import_source(source).map!{|s|s.strip})
|
275
|
+
end
|
276
|
+
|
277
|
+
it "remove externed and inline functions" do
|
278
|
+
source =
|
279
|
+
" extern uint32 foobar(unsigned int);\n" +
|
280
|
+
"uint32 extern_name_func(unsigned int);\n" +
|
281
|
+
"uint32 funcinline(unsigned int);\n" +
|
282
|
+
"extern void bar(unsigned int);\n" +
|
283
|
+
"inline void bar(unsigned int);\n" +
|
284
|
+
"extern\n" +
|
285
|
+
"void kinda_ugly_on_the_next_line(unsigned int);\n"
|
286
|
+
|
287
|
+
expected =
|
288
|
+
[
|
289
|
+
"uint32 extern_name_func(unsigned int)",
|
290
|
+
"uint32 funcinline(unsigned int)"
|
291
|
+
]
|
292
|
+
|
293
|
+
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
|
294
|
+
end
|
295
|
+
|
296
|
+
it "remove function definitions but keep function declarations" do
|
297
|
+
source =
|
298
|
+
"uint32 func_with_decl_a(unsigned int);\n" +
|
299
|
+
"uint32 func_with_decl_a(unsigned int a) { return a; }\n" +
|
300
|
+
"uint32 func_with_decl_b(unsigned int);\n" +
|
301
|
+
"uint32 func_with_decl_b(unsigned int a)\n" +
|
302
|
+
"{\n" +
|
303
|
+
" bar((unsigned int) a);\n" +
|
304
|
+
" stripme(a);\n" +
|
305
|
+
"}\n"
|
306
|
+
|
307
|
+
expected =
|
308
|
+
[
|
309
|
+
"uint32 func_with_decl_a(unsigned int)",
|
310
|
+
"uint32 func_with_decl_a", #okay. it's not going to be interpretted as another function
|
311
|
+
"uint32 func_with_decl_b(unsigned int)",
|
312
|
+
"uint32 func_with_decl_b", #okay. it's not going to be interpretted as another function
|
313
|
+
]
|
314
|
+
|
315
|
+
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
|
316
|
+
end
|
317
|
+
|
318
|
+
it "remove function definitions with nested braces but keep function declarations" do
|
319
|
+
source =
|
320
|
+
"uint32 func_with_decl_a(unsigned int);\n" +
|
321
|
+
"uint32 func_with_decl_a(unsigned int a) {\n" +
|
322
|
+
" while (stuff) {\n" +
|
323
|
+
" not_a_definition1(void);\n" +
|
324
|
+
" }\n" +
|
325
|
+
" not_a_definition2(blah, bleh);\n" +
|
326
|
+
" return a;\n" +
|
327
|
+
"}\n" +
|
328
|
+
"uint32 func_with_decl_b(unsigned int);\n" +
|
329
|
+
"uint32 func_with_decl_b(unsigned int a)\n" +
|
330
|
+
"{\n" +
|
331
|
+
" bar((unsigned int) a);\n" +
|
332
|
+
" stripme(a);\n" +
|
333
|
+
"}\n" +
|
334
|
+
"uint32 func_with_decl_c(unsigned int);\n" +
|
335
|
+
"uint32 func_with_decl_c(unsigned int a)\n" +
|
336
|
+
"{\n" +
|
337
|
+
" if(a > 0)\n" +
|
338
|
+
" {\n" +
|
339
|
+
" return 1;\n" +
|
340
|
+
" }\n" +
|
341
|
+
" else\n"+
|
342
|
+
" {\n" +
|
343
|
+
" return 2;\n" +
|
344
|
+
" }\n" +
|
345
|
+
"}\n"
|
346
|
+
|
347
|
+
expected =
|
348
|
+
[
|
349
|
+
"uint32 func_with_decl_a(unsigned int)",
|
350
|
+
"uint32 func_with_decl_a", #okay. it's not going to be interpretted as another function
|
351
|
+
"uint32 func_with_decl_b(unsigned int)",
|
352
|
+
"uint32 func_with_decl_b", #okay. it's not going to be interpretted as another function
|
353
|
+
"uint32 func_with_decl_c(unsigned int)",
|
354
|
+
"uint32 func_with_decl_c", #okay. it's not going to be interpretted as another function
|
355
|
+
]
|
356
|
+
|
357
|
+
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
|
358
|
+
end
|
359
|
+
|
360
|
+
it "remove a fully defined inline function" do
|
361
|
+
source =
|
362
|
+
"inline void foo(unsigned int a) { oranges = a; }\n" +
|
363
|
+
"inline void bar(unsigned int a) { apples = a; };\n" +
|
364
|
+
"inline void bar(unsigned int a)\n" +
|
365
|
+
"{" +
|
366
|
+
" bananas = a;\n" +
|
367
|
+
"}"
|
368
|
+
|
369
|
+
# ensure it's expected type of exception
|
370
|
+
assert_raises RuntimeError do
|
371
|
+
@parser.parse("module", source)
|
372
|
+
end
|
373
|
+
|
374
|
+
assert_equal([], @parser.funcs)
|
375
|
+
|
376
|
+
# verify exception message
|
377
|
+
begin
|
378
|
+
@parser.parse("module", source)
|
379
|
+
rescue RuntimeError => e
|
380
|
+
assert_equal("ERROR: No function prototypes found!", e.message)
|
381
|
+
end
|
382
|
+
end
|
383
|
+
|
384
|
+
it "remove a fully defined inline function that is multiple lines" do
|
385
|
+
source =
|
386
|
+
"inline void bar(unsigned int a)\n" +
|
387
|
+
"{" +
|
388
|
+
" bananas = a;\n" +
|
389
|
+
" grapes = a;\n" +
|
390
|
+
" apples(bananas, grapes);\n" +
|
391
|
+
"}"
|
392
|
+
|
393
|
+
# ensure it's expected type of exception
|
394
|
+
assert_raises RuntimeError do
|
395
|
+
@parser.parse("module", source)
|
396
|
+
end
|
397
|
+
|
398
|
+
assert_equal([], @parser.funcs)
|
399
|
+
|
400
|
+
# verify exception message
|
401
|
+
begin
|
402
|
+
@parser.parse("module", source)
|
403
|
+
rescue RuntimeError => e
|
404
|
+
assert_equal("ERROR: No function prototypes found!", e.message)
|
405
|
+
end
|
406
|
+
end
|
407
|
+
|
408
|
+
it "remove a fully defined inline function that contains nested braces" do
|
409
|
+
source =
|
410
|
+
"inline void bar(unsigned int a)\n" +
|
411
|
+
"{" +
|
412
|
+
" apples(bananas, grapes);\n" +
|
413
|
+
" if (bananas == a)\n" +
|
414
|
+
" {\n" +
|
415
|
+
" oranges(a);\n" +
|
416
|
+
" grapes = a;\n" +
|
417
|
+
" }\n" +
|
418
|
+
" grapefruit(bananas, grapes);\n" +
|
419
|
+
"}"
|
420
|
+
|
421
|
+
# ensure it's expected type of exception
|
422
|
+
assert_raises RuntimeError do
|
423
|
+
@parser.parse("module", source)
|
424
|
+
end
|
425
|
+
|
426
|
+
assert_equal([], @parser.funcs)
|
427
|
+
|
428
|
+
# verify exception message
|
429
|
+
begin
|
430
|
+
@parser.parse("module", source)
|
431
|
+
rescue RuntimeError => e
|
432
|
+
assert_equal("ERROR: No function prototypes found!", e.message)
|
433
|
+
end
|
434
|
+
end
|
435
|
+
|
436
|
+
it "remove just inline functions if externs to be included" do
|
437
|
+
source =
|
438
|
+
" extern uint32 foobar(unsigned int);\n" +
|
439
|
+
"uint32 extern_name_func(unsigned int);\n" +
|
440
|
+
"uint32 funcinline(unsigned int);\n" +
|
441
|
+
"extern void bar(unsigned int);\n" +
|
442
|
+
"inline void bar(unsigned int);\n" +
|
443
|
+
"extern\n" +
|
444
|
+
"void kinda_ugly_on_the_next_line(unsigned int);\n"
|
445
|
+
|
446
|
+
expected =
|
447
|
+
[ "extern uint32 foobar(unsigned int)",
|
448
|
+
"uint32 extern_name_func(unsigned int)",
|
449
|
+
"uint32 funcinline(unsigned int)",
|
450
|
+
"extern void bar(unsigned int)",
|
451
|
+
"extern void kinda_ugly_on_the_next_line(unsigned int)"
|
452
|
+
]
|
453
|
+
|
454
|
+
@parser.treat_externs = :include
|
455
|
+
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
|
456
|
+
end
|
457
|
+
|
458
|
+
it "leave inline functions if inline to be included" do
|
459
|
+
source =
|
460
|
+
"extern uint32 foobar(unsigned int);\n" +
|
461
|
+
"uint32 extern_name_func(unsigned int);\n" +
|
462
|
+
"uint32 funcinline(unsigned int);\n" +
|
463
|
+
"inline void inlineBar(unsigned int);\n" +
|
464
|
+
"extern int extern_bar(void);\n" +
|
465
|
+
"static inline void staticinlineBar(unsigned int);\n" +
|
466
|
+
"static inline void bar(unsigned int);\n" +
|
467
|
+
"static inline void bar(unsigned int)\n" +
|
468
|
+
"{\n" +
|
469
|
+
" // NOP\n" +
|
470
|
+
"}\n"
|
471
|
+
|
472
|
+
expected =
|
473
|
+
[ "uint32 extern_name_func(unsigned int)",
|
474
|
+
"uint32 funcinline(unsigned int)",
|
475
|
+
"void inlineBar(unsigned int)",
|
476
|
+
"void staticinlineBar(unsigned int)",
|
477
|
+
"void bar(unsigned int)"
|
478
|
+
]
|
479
|
+
|
480
|
+
@parser.treat_inlines = :include
|
481
|
+
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
|
482
|
+
end
|
483
|
+
|
484
|
+
it "leave inline and extern functions if inline and extern to be included" do
|
485
|
+
source =
|
486
|
+
"extern uint32 foobar(unsigned int);\n" +
|
487
|
+
"uint32 extern_name_func(unsigned int);\n" +
|
488
|
+
"uint32 funcinline(unsigned int);\n" +
|
489
|
+
"inline void inlineBar(unsigned int);\n" +
|
490
|
+
"extern int extern_bar(void);\n" +
|
491
|
+
"static inline void staticinlineBar(unsigned int);\n" +
|
492
|
+
"static inline void bar(unsigned int);\n" +
|
493
|
+
"static inline void bar(unsigned int)\n" +
|
494
|
+
"{\n" +
|
495
|
+
" // NOP\n" +
|
496
|
+
"}\n"
|
497
|
+
|
498
|
+
expected =
|
499
|
+
[ "extern uint32 foobar(unsigned int)",
|
500
|
+
"uint32 extern_name_func(unsigned int)",
|
501
|
+
"uint32 funcinline(unsigned int)",
|
502
|
+
"void inlineBar(unsigned int)",
|
503
|
+
"extern int extern_bar(void)",
|
504
|
+
"void staticinlineBar(unsigned int)",
|
505
|
+
"void bar(unsigned int)"
|
506
|
+
]
|
507
|
+
|
508
|
+
@parser.treat_externs = :include
|
509
|
+
@parser.treat_inlines = :include
|
510
|
+
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
|
511
|
+
end
|
512
|
+
|
513
|
+
it "Include inline functions that contain user defined inline function formats" do
|
514
|
+
source =
|
515
|
+
"uint32 foo(unsigned int);\n" +
|
516
|
+
"uint32 bar(unsigned int);\n" +
|
517
|
+
"inline void inlineBar(void)\n" +
|
518
|
+
"{\n" +
|
519
|
+
" return 43;\n" +
|
520
|
+
"}\n" +
|
521
|
+
"static __inline__ __attribute__ ((always_inline)) int alwaysinlinefunc(int a)\n" +
|
522
|
+
"{\n" +
|
523
|
+
" return a + inlineBar();\n" +
|
524
|
+
"}\n" +
|
525
|
+
"static __inline__ void inlinebar(unsigned int)\n" +
|
526
|
+
"{\n" +
|
527
|
+
" int a = alwaysinlinefunc()\n" +
|
528
|
+
"}\n"
|
529
|
+
|
530
|
+
expected =
|
531
|
+
[
|
532
|
+
"uint32 foo(unsigned int)",
|
533
|
+
"uint32 bar(unsigned int)",
|
534
|
+
"void inlineBar(void)",
|
535
|
+
"int alwaysinlinefunc(int a)",
|
536
|
+
"void inlinebar(unsigned int)"
|
537
|
+
]
|
538
|
+
|
539
|
+
@parser.treat_inlines = :include
|
540
|
+
@parser.inline_function_patterns = ['static __inline__ __attribute__ \(\(always_inline\)\)', 'static __inline__', '\binline\b']
|
541
|
+
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
|
542
|
+
end
|
543
|
+
|
544
|
+
it "remove defines" do
|
545
|
+
source =
|
546
|
+
"#define whatever you feel like defining\n" +
|
547
|
+
"void hello(void);\n" +
|
548
|
+
"#DEFINE I JUST DON'T CARE\n" +
|
549
|
+
"#deFINE\n" +
|
550
|
+
"#define get_foo() \\\n ((Thing)foo.bar)" # exercise multiline define
|
551
|
+
|
552
|
+
expected =
|
553
|
+
[
|
554
|
+
"void hello(void)",
|
555
|
+
]
|
556
|
+
|
557
|
+
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
|
558
|
+
end
|
559
|
+
|
560
|
+
|
561
|
+
it "remove keywords that would keep things from going smoothly in the future" do
|
562
|
+
source =
|
563
|
+
"const int TheMatrix(register int Trinity, unsigned int *restrict Neo)"
|
564
|
+
|
565
|
+
expected =
|
566
|
+
[
|
567
|
+
"const int TheMatrix(int Trinity, unsigned int * Neo)",
|
568
|
+
]
|
569
|
+
|
570
|
+
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
|
571
|
+
end
|
572
|
+
|
573
|
+
|
574
|
+
# some code actually typedef's void even though it's not ANSI C and is, frankly, weird
|
575
|
+
# since cmock treats void specially, we can't let void be obfuscated
|
576
|
+
it "handle odd case of typedef'd void returned" do
|
577
|
+
source = "MY_FUNKY_VOID FunkyVoidReturned(int a)"
|
578
|
+
expected = { :var_arg=>nil,
|
579
|
+
:name=>"FunkyVoidReturned",
|
580
|
+
:unscoped_name=>"FunkyVoidReturned",
|
581
|
+
:namespace=>[],
|
582
|
+
:class=>nil,
|
583
|
+
:return=>{ :type => "void",
|
584
|
+
:name => 'cmock_to_return',
|
585
|
+
:ptr? => false,
|
586
|
+
:const? => false,
|
587
|
+
:const_ptr? => false,
|
588
|
+
:str => "void cmock_to_return",
|
589
|
+
:void? => true
|
590
|
+
},
|
591
|
+
:modifier=>"",
|
592
|
+
:contains_ptr? => false,
|
593
|
+
:args=>[{:type=>"int", :name=>"a", :ptr? => false, :const? => false, :const_ptr? => false}],
|
594
|
+
:args_string=>"int a",
|
595
|
+
:args_call=>"a"}
|
596
|
+
assert_equal(expected, @parser.parse_declaration(source))
|
597
|
+
end
|
598
|
+
|
599
|
+
it "handle odd case of typedef'd void as arg" do
|
600
|
+
source = "int FunkyVoidAsArg(MY_FUNKY_VOID)"
|
601
|
+
expected = { :var_arg=>nil,
|
602
|
+
:name=>"FunkyVoidAsArg",
|
603
|
+
:unscoped_name=>"FunkyVoidAsArg",
|
604
|
+
:namespace=>[],
|
605
|
+
:class=>nil,
|
606
|
+
:return=>{ :type => "int",
|
607
|
+
:name => 'cmock_to_return',
|
608
|
+
:ptr? => false,
|
609
|
+
:const? => false,
|
610
|
+
:const_ptr? => false,
|
611
|
+
:str => "int cmock_to_return",
|
612
|
+
:void? => false
|
613
|
+
},
|
614
|
+
:modifier=>"",
|
615
|
+
:contains_ptr? => false,
|
616
|
+
:args=>[],
|
617
|
+
:args_string=>"void",
|
618
|
+
:args_call=>"" }
|
619
|
+
assert_equal(expected, @parser.parse_declaration(source))
|
620
|
+
end
|
621
|
+
|
622
|
+
it "handle odd case of typedef'd void as arg pointer" do
|
623
|
+
source = "char FunkyVoidPointer(MY_FUNKY_VOID* bluh)"
|
624
|
+
expected = { :var_arg=>nil,
|
625
|
+
:name=>"FunkyVoidPointer",
|
626
|
+
:unscoped_name=>"FunkyVoidPointer",
|
627
|
+
:namespace=>[],
|
628
|
+
:class=>nil,
|
629
|
+
:return=>{ :type => "char",
|
630
|
+
:name => 'cmock_to_return',
|
631
|
+
:ptr? => false,
|
632
|
+
:const? => false,
|
633
|
+
:const_ptr? => false,
|
634
|
+
:str => "char cmock_to_return",
|
635
|
+
:void? => false
|
636
|
+
},
|
637
|
+
:modifier=>"",
|
638
|
+
:contains_ptr? => true,
|
639
|
+
:args=>[{:type=>"MY_FUNKY_VOID*", :name=>"bluh", :ptr? => true, :const? => false, :const_ptr? => false}],
|
640
|
+
:args_string=>"MY_FUNKY_VOID* bluh",
|
641
|
+
:args_call=>"bluh" }
|
642
|
+
assert_equal(expected, @parser.parse_declaration(source))
|
643
|
+
end
|
644
|
+
|
645
|
+
|
646
|
+
it "strip default values from function parameter lists" do
|
647
|
+
source =
|
648
|
+
"void Foo(int a = 57, float b=37.52, char c= 'd', char* e=\"junk\");\n"
|
649
|
+
|
650
|
+
expected =
|
651
|
+
[
|
652
|
+
"void Foo(int a, float b, char c, char* e)"
|
653
|
+
]
|
654
|
+
|
655
|
+
assert_equal(expected, @parser.import_source(source).map!{|s|s.strip})
|
656
|
+
end
|
657
|
+
|
658
|
+
|
659
|
+
it "raise upon empty file" do
|
660
|
+
source = ''
|
661
|
+
|
662
|
+
# ensure it's expected type of exception
|
663
|
+
assert_raises RuntimeError do
|
664
|
+
@parser.parse("module", source)
|
665
|
+
end
|
666
|
+
|
667
|
+
assert_equal([], @parser.funcs)
|
668
|
+
|
669
|
+
# verify exception message
|
670
|
+
begin
|
671
|
+
@parser.parse("module", source)
|
672
|
+
rescue RuntimeError => e
|
673
|
+
assert_equal("ERROR: No function prototypes found!", e.message)
|
674
|
+
end
|
675
|
+
end
|
676
|
+
|
677
|
+
it "clean up module names that contain spaces, dashes, and such" do
|
678
|
+
source = 'void meh(int (*func)(int));'
|
679
|
+
|
680
|
+
retval = @parser.parse("C:\Ugly Module-Name", source)
|
681
|
+
assert (retval[:typedefs][0] =~ /CUglyModuleName/)
|
682
|
+
end
|
683
|
+
|
684
|
+
it "raise upon no function prototypes found in file" do
|
685
|
+
source =
|
686
|
+
"typedef void SILLY_VOID_TYPE1;\n" +
|
687
|
+
"typedef (void) SILLY_VOID_TYPE2 ;\n" +
|
688
|
+
"typedef ( void ) (*FUNCPTR)(void);\n\n" +
|
689
|
+
"#define get_foo() \\\n ((Thing)foo.bar)"
|
690
|
+
|
691
|
+
# ensure it's expected type of exception
|
692
|
+
assert_raises(RuntimeError) do
|
693
|
+
@parser.parse("module", source)
|
694
|
+
end
|
695
|
+
|
696
|
+
assert_equal([], @parser.funcs)
|
697
|
+
|
698
|
+
# verify exception message
|
699
|
+
begin
|
700
|
+
@parser.parse("module", source)
|
701
|
+
rescue RuntimeError => e
|
702
|
+
assert_equal("ERROR: No function prototypes found!", e.message)
|
703
|
+
end
|
704
|
+
end
|
705
|
+
|
706
|
+
|
707
|
+
it "raise upon prototype parsing failure" do
|
708
|
+
source = "void (int, )"
|
709
|
+
|
710
|
+
# ensure it's expected type of exception
|
711
|
+
assert_raises(RuntimeError) do
|
712
|
+
@parser.parse("module", source)
|
713
|
+
end
|
714
|
+
|
715
|
+
# verify exception message
|
716
|
+
begin
|
717
|
+
@parser.parse("module", source)
|
718
|
+
rescue RuntimeError => e
|
719
|
+
assert(e.message.include?("Failed Parsing Declaration Prototype!"))
|
720
|
+
end
|
721
|
+
end
|
722
|
+
|
723
|
+
it "extract and return function declarations with retval and args" do
|
724
|
+
|
725
|
+
source = "int Foo(int a, unsigned int b)"
|
726
|
+
expected = { :var_arg=>nil,
|
727
|
+
:name=>"Foo",
|
728
|
+
:unscoped_name=>"Foo",
|
729
|
+
:namespace=>[],
|
730
|
+
:class=>nil,
|
731
|
+
:return=>{ :type => "int",
|
732
|
+
:name => 'cmock_to_return',
|
733
|
+
:ptr? => false,
|
734
|
+
:const? => false,
|
735
|
+
:const_ptr? => false,
|
736
|
+
:str => "int cmock_to_return",
|
737
|
+
:void? => false
|
738
|
+
},
|
739
|
+
:modifier=>"",
|
740
|
+
:contains_ptr? => false,
|
741
|
+
:args=>[ {:type=>"int", :name=>"a", :ptr? => false, :const? => false, :const_ptr? => false},
|
742
|
+
{:type=>"unsigned int", :name=>"b", :ptr? => false, :const? => false, :const_ptr? => false}
|
743
|
+
],
|
744
|
+
:args_string=>"int a, unsigned int b",
|
745
|
+
:args_call=>"a, b" }
|
746
|
+
assert_equal(expected, @parser.parse_declaration(source))
|
747
|
+
end
|
748
|
+
|
749
|
+
it "extract and return function declarations with no retval" do
|
750
|
+
|
751
|
+
source = "void FunkyChicken( uint la, int de, bool da)"
|
752
|
+
expected = { :var_arg=>nil,
|
753
|
+
:return=>{ :type => "void",
|
754
|
+
:name => 'cmock_to_return',
|
755
|
+
:ptr? => false,
|
756
|
+
:const? => false,
|
757
|
+
:const_ptr? => false,
|
758
|
+
:str => "void cmock_to_return",
|
759
|
+
:void? => true
|
760
|
+
},
|
761
|
+
:name=>"FunkyChicken",
|
762
|
+
:unscoped_name=>"FunkyChicken",
|
763
|
+
:namespace=>[],
|
764
|
+
:class=>nil,
|
765
|
+
:modifier=>"",
|
766
|
+
:contains_ptr? => false,
|
767
|
+
:args=>[ {:type=>"uint", :name=>"la", :ptr? => false, :const? => false, :const_ptr? => false},
|
768
|
+
{:type=>"int", :name=>"de", :ptr? => false, :const? => false, :const_ptr? => false},
|
769
|
+
{:type=>"bool", :name=>"da", :ptr? => false, :const? => false, :const_ptr? => false}
|
770
|
+
],
|
771
|
+
:args_string=>"uint la, int de, bool da",
|
772
|
+
:args_call=>"la, de, da" }
|
773
|
+
assert_equal(expected, @parser.parse_declaration(source))
|
774
|
+
end
|
775
|
+
|
776
|
+
it "extract and return function declarations with implied voids" do
|
777
|
+
|
778
|
+
source = "void tat()"
|
779
|
+
expected = { :var_arg=>nil,
|
780
|
+
:return=>{ :type => "void",
|
781
|
+
:name => 'cmock_to_return',
|
782
|
+
:ptr? => false,
|
783
|
+
:const? => false,
|
784
|
+
:const_ptr? => false,
|
785
|
+
:str => "void cmock_to_return",
|
786
|
+
:void? => true
|
787
|
+
},
|
788
|
+
:name=>"tat",
|
789
|
+
:unscoped_name=>"tat",
|
790
|
+
:namespace=>[],
|
791
|
+
:class=>nil,
|
792
|
+
:modifier=>"",
|
793
|
+
:contains_ptr? => false,
|
794
|
+
:args=>[ ],
|
795
|
+
:args_string=>"void",
|
796
|
+
:args_call=>"" }
|
797
|
+
assert_equal(expected, @parser.parse_declaration(source))
|
798
|
+
end
|
799
|
+
|
800
|
+
it "extract modifiers properly" do
|
801
|
+
|
802
|
+
source = "const int TheMatrix(int Trinity, unsigned int * Neo)"
|
803
|
+
expected = { :var_arg=>nil,
|
804
|
+
:return=>{ :type => "int",
|
805
|
+
:name => 'cmock_to_return',
|
806
|
+
:ptr? => false,
|
807
|
+
:const? => true,
|
808
|
+
:const_ptr? => false,
|
809
|
+
:str => "int cmock_to_return",
|
810
|
+
:void? => false
|
811
|
+
},
|
812
|
+
:name=>"TheMatrix",
|
813
|
+
:unscoped_name=>"TheMatrix",
|
814
|
+
:namespace=>[],
|
815
|
+
:class=>nil,
|
816
|
+
:modifier=>"const",
|
817
|
+
:contains_ptr? => true,
|
818
|
+
:args=>[ {:type=>"int", :name=>"Trinity", :ptr? => false, :const? => false, :const_ptr? => false},
|
819
|
+
{:type=>"unsigned int*", :name=>"Neo", :ptr? => true, :const? => false, :const_ptr? => false}
|
820
|
+
],
|
821
|
+
:args_string=>"int Trinity, unsigned int* Neo",
|
822
|
+
:args_call=>"Trinity, Neo" }
|
823
|
+
assert_equal(expected, @parser.parse_declaration(source))
|
824
|
+
end
|
825
|
+
|
826
|
+
it "extract c calling conventions properly" do
|
827
|
+
|
828
|
+
source = "const int __stdcall TheMatrix(int Trinity, unsigned int * Neo)"
|
829
|
+
expected = { :var_arg=>nil,
|
830
|
+
:return=>{ :type => "int",
|
831
|
+
:name => 'cmock_to_return',
|
832
|
+
:ptr? => false,
|
833
|
+
:const? => true,
|
834
|
+
:const_ptr? => false,
|
835
|
+
:str => "int cmock_to_return",
|
836
|
+
:void? => false
|
837
|
+
},
|
838
|
+
:name=>"TheMatrix",
|
839
|
+
:unscoped_name=>"TheMatrix",
|
840
|
+
:namespace=>[],
|
841
|
+
:class=>nil,
|
842
|
+
:modifier=>"const",
|
843
|
+
:c_calling_convention=>"__stdcall",
|
844
|
+
:contains_ptr? => true,
|
845
|
+
:args=>[ {:type=>"int", :name=>"Trinity", :ptr? => false, :const? => false, :const_ptr? => false},
|
846
|
+
{:type=>"unsigned int*", :name=>"Neo", :ptr? => true, :const? => false, :const_ptr? => false}
|
847
|
+
],
|
848
|
+
:args_string=>"int Trinity, unsigned int* Neo",
|
849
|
+
:args_call=>"Trinity, Neo" }
|
850
|
+
assert_equal(expected, @parser.parse_declaration(source))
|
851
|
+
end
|
852
|
+
|
853
|
+
it "extract and return function declarations inside namespace and class" do
|
854
|
+
source = "int Foo(int a, unsigned int b)"
|
855
|
+
expected = { :var_arg=>nil,
|
856
|
+
:name=>"ns1_ns2_Bar_Foo",
|
857
|
+
:unscoped_name=>"Foo",
|
858
|
+
:class=>"Bar",
|
859
|
+
:namespace=>["ns1", "ns2"],
|
860
|
+
:return=>{ :type => "int",
|
861
|
+
:name => 'cmock_to_return',
|
862
|
+
:ptr? => false,
|
863
|
+
:const? => false,
|
864
|
+
:const_ptr? => false,
|
865
|
+
:str => "int cmock_to_return",
|
866
|
+
:void? => false
|
867
|
+
},
|
868
|
+
:modifier=>"",
|
869
|
+
:contains_ptr? => false,
|
870
|
+
:args=>[ {:type=>"int", :name=>"a", :ptr? => false, :const? => false, :const_ptr? => false},
|
871
|
+
{:type=>"unsigned int", :name=>"b", :ptr? => false, :const? => false, :const_ptr? => false}
|
872
|
+
],
|
873
|
+
:args_string=>"int a, unsigned int b",
|
874
|
+
:args_call=>"a, b" }
|
875
|
+
assert_equal(expected, @parser.parse_declaration(source, ["ns1", "ns2"], "Bar"))
|
876
|
+
end
|
877
|
+
|
878
|
+
it "fully parse multiple prototypes" do
|
879
|
+
|
880
|
+
source = "const int TheMatrix(int Trinity, unsigned int * Neo);\n" +
|
881
|
+
"int Morpheus(int, unsigned int*);\n"
|
882
|
+
|
883
|
+
expected = [{ :var_arg=>nil,
|
884
|
+
:return=> { :type => "int",
|
885
|
+
:name => 'cmock_to_return',
|
886
|
+
:ptr? => false,
|
887
|
+
:const? => true,
|
888
|
+
:const_ptr? => false,
|
889
|
+
:str => "int cmock_to_return",
|
890
|
+
:void? => false
|
891
|
+
},
|
892
|
+
:name=>"TheMatrix",
|
893
|
+
:unscoped_name=>"TheMatrix",
|
894
|
+
:namespace=>[],
|
895
|
+
:class=>nil,
|
896
|
+
:modifier=>"const",
|
897
|
+
:contains_ptr? => true,
|
898
|
+
:args=>[ {:type=>"int", :name=>"Trinity", :ptr? => false, :const? => false, :const_ptr? => false},
|
899
|
+
{:type=>"unsigned int*", :name=>"Neo", :ptr? => true, :const? => false, :const_ptr? => false}
|
900
|
+
],
|
901
|
+
:args_string=>"int Trinity, unsigned int* Neo",
|
902
|
+
:args_call=>"Trinity, Neo" },
|
903
|
+
{ :var_arg=>nil,
|
904
|
+
:return=> { :type => "int",
|
905
|
+
:name => 'cmock_to_return',
|
906
|
+
:ptr? => false,
|
907
|
+
:const? => false,
|
908
|
+
:const_ptr? => false,
|
909
|
+
:str => "int cmock_to_return",
|
910
|
+
:void? => false
|
911
|
+
},
|
912
|
+
:name=>"Morpheus",
|
913
|
+
:unscoped_name=>"Morpheus",
|
914
|
+
:namespace=>[],
|
915
|
+
:class=>nil,
|
916
|
+
:modifier=>"",
|
917
|
+
:contains_ptr? => true,
|
918
|
+
:args=>[ {:type=>"int", :name=>"cmock_arg1", :ptr? => false, :const? => false, :const_ptr? => false},
|
919
|
+
{:type=>"unsigned int*", :name=>"cmock_arg2", :ptr? => true, :const? => false, :const_ptr? => false}
|
920
|
+
],
|
921
|
+
:args_string=>"int cmock_arg1, unsigned int* cmock_arg2",
|
922
|
+
:args_call=>"cmock_arg1, cmock_arg2"
|
923
|
+
}]
|
924
|
+
assert_equal(expected, @parser.parse("module", source)[:functions])
|
925
|
+
end
|
926
|
+
|
927
|
+
it "not extract for mocking multiply defined prototypes" do
|
928
|
+
|
929
|
+
source = "const int TheMatrix(int Trinity, unsigned int * Neo);\n" +
|
930
|
+
"const int TheMatrix(int, unsigned int*);\n"
|
931
|
+
|
932
|
+
expected = [{ :var_arg=>nil,
|
933
|
+
:name=>"TheMatrix",
|
934
|
+
:unscoped_name=>"TheMatrix",
|
935
|
+
:namespace=>[],
|
936
|
+
:class=>nil,
|
937
|
+
:return=> { :type => "int",
|
938
|
+
:name => 'cmock_to_return',
|
939
|
+
:ptr? => false,
|
940
|
+
:const? => true,
|
941
|
+
:const_ptr? => false,
|
942
|
+
:str => "int cmock_to_return",
|
943
|
+
:void? => false
|
944
|
+
},
|
945
|
+
:modifier=>"const",
|
946
|
+
:contains_ptr? => true,
|
947
|
+
:args=>[ {:type=>"int", :name=>"Trinity", :ptr? => false, :const? => false, :const_ptr? => false},
|
948
|
+
{:type=>"unsigned int*", :name=>"Neo", :ptr? => true, :const? => false, :const_ptr? => false}
|
949
|
+
],
|
950
|
+
:args_string=>"int Trinity, unsigned int* Neo",
|
951
|
+
:args_call=>"Trinity, Neo"
|
952
|
+
}]
|
953
|
+
assert_equal(expected, @parser.parse("module", source)[:functions])
|
954
|
+
end
|
955
|
+
|
956
|
+
it "should properly handle const before return type" do
|
957
|
+
sources = [
|
958
|
+
"const int * PorkRoast(void);\n",
|
959
|
+
"const int* PorkRoast(void);\n",
|
960
|
+
"const int *PorkRoast(void);\n"
|
961
|
+
]
|
962
|
+
|
963
|
+
expected = [{ :var_arg => nil,
|
964
|
+
:name => "PorkRoast",
|
965
|
+
:unscoped_name => "PorkRoast",
|
966
|
+
:namespace=>[],
|
967
|
+
:class=>nil,
|
968
|
+
:return => { :type => "const int*",
|
969
|
+
:name => 'cmock_to_return',
|
970
|
+
:ptr? => true,
|
971
|
+
:const? => true,
|
972
|
+
:const_ptr? => false,
|
973
|
+
:str => "const int* cmock_to_return",
|
974
|
+
:void? => false
|
975
|
+
},
|
976
|
+
:modifier => "",
|
977
|
+
:contains_ptr? => false,
|
978
|
+
:args => [],
|
979
|
+
:args_string => "void",
|
980
|
+
:args_call => ""
|
981
|
+
}]
|
982
|
+
|
983
|
+
sources.each do |source|
|
984
|
+
assert_equal(expected, @parser.parse("module", source)[:functions])
|
985
|
+
end
|
986
|
+
end
|
987
|
+
|
988
|
+
it "should properly handle const before return type" do
|
989
|
+
sources = [
|
990
|
+
"int const * PorkRoast(void);\n",
|
991
|
+
"int const* PorkRoast(void);\n",
|
992
|
+
"int const *PorkRoast(void);\n"
|
993
|
+
]
|
994
|
+
|
995
|
+
expected = [{ :var_arg => nil,
|
996
|
+
:name => "PorkRoast",
|
997
|
+
:unscoped_name => "PorkRoast",
|
998
|
+
:namespace=>[],
|
999
|
+
:class=>nil,
|
1000
|
+
:return => { :type => "int const*",
|
1001
|
+
:name => 'cmock_to_return',
|
1002
|
+
:ptr? => true,
|
1003
|
+
:const? => true,
|
1004
|
+
:const_ptr? => false,
|
1005
|
+
:str => "int const* cmock_to_return",
|
1006
|
+
:void? => false
|
1007
|
+
},
|
1008
|
+
:modifier => "",
|
1009
|
+
:contains_ptr? => false,
|
1010
|
+
:args => [],
|
1011
|
+
:args_string => "void",
|
1012
|
+
:args_call => ""
|
1013
|
+
}]
|
1014
|
+
|
1015
|
+
sources.each do |source|
|
1016
|
+
assert_equal(expected, @parser.parse("module", source)[:functions])
|
1017
|
+
end
|
1018
|
+
end
|
1019
|
+
|
1020
|
+
it "should properly handle const applied after asterisk in return type (not legal C, but sometimes used)" do
|
1021
|
+
|
1022
|
+
source = "int * const PorkRoast(void);\n"
|
1023
|
+
|
1024
|
+
expected = [{ :var_arg=>nil,
|
1025
|
+
:name=>"PorkRoast",
|
1026
|
+
:unscoped_name=>"PorkRoast",
|
1027
|
+
:namespace=>[],
|
1028
|
+
:class=>nil,
|
1029
|
+
:return=> { :type => "int*",
|
1030
|
+
:name => 'cmock_to_return',
|
1031
|
+
:ptr? => true,
|
1032
|
+
:const? => false,
|
1033
|
+
:const_ptr? => true,
|
1034
|
+
:str => "int* cmock_to_return",
|
1035
|
+
:void? => false
|
1036
|
+
},
|
1037
|
+
:modifier=>"const",
|
1038
|
+
:contains_ptr? => false,
|
1039
|
+
:args=>[],
|
1040
|
+
:args_string=>"void",
|
1041
|
+
:args_call=>""
|
1042
|
+
}]
|
1043
|
+
assert_equal(expected, @parser.parse("module", source)[:functions])
|
1044
|
+
end
|
1045
|
+
|
1046
|
+
it "properly parse const and pointer argument types with no arg names" do
|
1047
|
+
|
1048
|
+
source = "void foo(int const*, int*const, const int*, const int*const, int const*const, int*, int, const int);\n"
|
1049
|
+
|
1050
|
+
expected = [{ :name => "foo",
|
1051
|
+
:unscoped_name => "foo",
|
1052
|
+
:namespace=>[],
|
1053
|
+
:class=>nil,
|
1054
|
+
:modifier => "",
|
1055
|
+
:return => { :type => "void",
|
1056
|
+
:name => "cmock_to_return",
|
1057
|
+
:str => "void cmock_to_return",
|
1058
|
+
:void? => true,
|
1059
|
+
:ptr? => false,
|
1060
|
+
:const? => false,
|
1061
|
+
:const_ptr? => false
|
1062
|
+
},
|
1063
|
+
:var_arg => nil,
|
1064
|
+
:args_string => "int const* cmock_arg1, int* const cmock_arg2, const int* cmock_arg3, const int* const cmock_arg4, " +
|
1065
|
+
"int const* const cmock_arg5, int* cmock_arg6, int cmock_arg7, const int cmock_arg8",
|
1066
|
+
:args => [{ :type=>"int const*", :name => "cmock_arg1", :ptr? => true, :const? => true, :const_ptr? => false },
|
1067
|
+
{ :type=>"int*", :name => "cmock_arg2", :ptr? => true, :const? => false, :const_ptr? => true },
|
1068
|
+
{ :type=>"const int*", :name => "cmock_arg3", :ptr? => true, :const? => true, :const_ptr? => false },
|
1069
|
+
{ :type=>"const int*", :name => "cmock_arg4", :ptr? => true, :const? => true, :const_ptr? => true },
|
1070
|
+
{ :type=>"int const*", :name => "cmock_arg5", :ptr? => true, :const? => true, :const_ptr? => true },
|
1071
|
+
{ :type=>"int*", :name => "cmock_arg6", :ptr? => true, :const? => false, :const_ptr? => false },
|
1072
|
+
{ :type=>"int", :name => "cmock_arg7", :ptr? => false, :const? => false, :const_ptr? => false },
|
1073
|
+
{ :type=>"int", :name => "cmock_arg8", :ptr? => false, :const? => true, :const_ptr? => false }],
|
1074
|
+
:args_call => "cmock_arg1, cmock_arg2, cmock_arg3, cmock_arg4, cmock_arg5, cmock_arg6, cmock_arg7, cmock_arg8",
|
1075
|
+
:contains_ptr? => true
|
1076
|
+
}]
|
1077
|
+
assert_equal(expected, @parser.parse("module", source)[:functions])
|
1078
|
+
end
|
1079
|
+
|
1080
|
+
it "properly parse const and pointer argument types with arg names" do
|
1081
|
+
|
1082
|
+
source = "void bar(int const* param1, int*const param2, const int* param3, const int*const param4,\n" +
|
1083
|
+
" int const*const param5, int*param6, int param7, const int param8);\n"
|
1084
|
+
|
1085
|
+
expected = [{ :name => "bar",
|
1086
|
+
:unscoped_name => "bar",
|
1087
|
+
:namespace=>[],
|
1088
|
+
:class=>nil,
|
1089
|
+
:modifier => "",
|
1090
|
+
:return => { :type => "void",
|
1091
|
+
:name => "cmock_to_return",
|
1092
|
+
:str => "void cmock_to_return",
|
1093
|
+
:void? => true,
|
1094
|
+
:ptr? => false,
|
1095
|
+
:const? => false,
|
1096
|
+
:const_ptr? => false
|
1097
|
+
},
|
1098
|
+
:var_arg => nil,
|
1099
|
+
:args_string => "int const* param1, int* const param2, const int* param3, const int* const param4, " +
|
1100
|
+
"int const* const param5, int* param6, int param7, const int param8",
|
1101
|
+
:args => [{ :type=>"int const*", :name => "param1", :ptr? => true, :const? => true, :const_ptr? => false },
|
1102
|
+
{ :type=>"int*", :name => "param2", :ptr? => true, :const? => false, :const_ptr? => true },
|
1103
|
+
{ :type=>"const int*", :name => "param3", :ptr? => true, :const? => true, :const_ptr? => false },
|
1104
|
+
{ :type=>"const int*", :name => "param4", :ptr? => true, :const? => true, :const_ptr? => true },
|
1105
|
+
{ :type=>"int const*", :name => "param5", :ptr? => true, :const? => true, :const_ptr? => true },
|
1106
|
+
{ :type=>"int*", :name => "param6", :ptr? => true, :const? => false, :const_ptr? => false },
|
1107
|
+
{ :type=>"int", :name => "param7", :ptr? => false, :const? => false, :const_ptr? => false },
|
1108
|
+
{ :type=>"int", :name => "param8", :ptr? => false, :const? => true, :const_ptr? => false }],
|
1109
|
+
:args_call => "param1, param2, param3, param4, param5, param6, param7, param8",
|
1110
|
+
:contains_ptr? => true
|
1111
|
+
}].freeze
|
1112
|
+
assert_equal(expected, @parser.parse("module", source)[:functions])
|
1113
|
+
end
|
1114
|
+
|
1115
|
+
it "converts typedef'd array arguments to pointers" do
|
1116
|
+
|
1117
|
+
source = "Book AddToBook(Book book, const IntArray values);\n"
|
1118
|
+
|
1119
|
+
expected = [{ :name => "AddToBook",
|
1120
|
+
:unscoped_name => "AddToBook",
|
1121
|
+
:namespace=>[],
|
1122
|
+
:class=>nil,
|
1123
|
+
:modifier=>"",
|
1124
|
+
:return => { :type => "Book",
|
1125
|
+
:name => "cmock_to_return",
|
1126
|
+
:str => "Book cmock_to_return",
|
1127
|
+
:void? => false,
|
1128
|
+
:ptr? => false,
|
1129
|
+
:const? => false,
|
1130
|
+
:const_ptr? => false
|
1131
|
+
},
|
1132
|
+
:var_arg => nil,
|
1133
|
+
:args => [{ :type => "Page*", :name => "book", :ptr? => true, :const? => false, :const_ptr? => false },
|
1134
|
+
{ :type => "const int*", :name => "values", :ptr? => true, :const? => true, :const_ptr? => false }],
|
1135
|
+
:args_string => "Book book, const IntArray values",
|
1136
|
+
:args_call => "book, values",
|
1137
|
+
:contains_ptr? => true
|
1138
|
+
}]
|
1139
|
+
|
1140
|
+
assert_equal(expected, @parser.parse("module", source)[:functions])
|
1141
|
+
|
1142
|
+
end
|
1143
|
+
|
1144
|
+
it "properly detect typedef'd variants of void and use those" do
|
1145
|
+
|
1146
|
+
source = "typedef (void) FUNKY_VOID_T;\n" +
|
1147
|
+
"typedef void CHUNKY_VOID_T;\n" +
|
1148
|
+
"FUNKY_VOID_T DrHorrible(int SingAlong);\n" +
|
1149
|
+
"int CaptainHammer(CHUNKY_VOID_T);\n"
|
1150
|
+
|
1151
|
+
expected = [{ :var_arg=>nil,
|
1152
|
+
:name=>"DrHorrible",
|
1153
|
+
:unscoped_name=>"DrHorrible",
|
1154
|
+
:namespace=>[],
|
1155
|
+
:class=>nil,
|
1156
|
+
:return => { :type => "void",
|
1157
|
+
:name => 'cmock_to_return',
|
1158
|
+
:ptr? => false,
|
1159
|
+
:const? => false,
|
1160
|
+
:const_ptr? => false,
|
1161
|
+
:str => "void cmock_to_return",
|
1162
|
+
:void? => true
|
1163
|
+
},
|
1164
|
+
:modifier=>"",
|
1165
|
+
:contains_ptr? => false,
|
1166
|
+
:args=>[ {:type=>"int", :name=>"SingAlong", :ptr? => false, :const? => false, :const_ptr? => false} ],
|
1167
|
+
:args_string=>"int SingAlong",
|
1168
|
+
:args_call=>"SingAlong"
|
1169
|
+
},
|
1170
|
+
{ :var_arg=>nil,
|
1171
|
+
:return=> { :type => "int",
|
1172
|
+
:name => 'cmock_to_return',
|
1173
|
+
:ptr? => false,
|
1174
|
+
:const? => false,
|
1175
|
+
:const_ptr? => false,
|
1176
|
+
:str => "int cmock_to_return",
|
1177
|
+
:void? => false
|
1178
|
+
},
|
1179
|
+
:name=>"CaptainHammer",
|
1180
|
+
:unscoped_name=>"CaptainHammer",
|
1181
|
+
:namespace=>[],
|
1182
|
+
:class=>nil,
|
1183
|
+
:modifier=>"",
|
1184
|
+
:contains_ptr? => false,
|
1185
|
+
:args=>[ ],
|
1186
|
+
:args_string=>"void",
|
1187
|
+
:args_call=>""
|
1188
|
+
}]
|
1189
|
+
assert_equal(expected, @parser.parse("module", source)[:functions])
|
1190
|
+
end
|
1191
|
+
|
1192
|
+
it "be ok with structs inside of function declarations" do
|
1193
|
+
|
1194
|
+
source = "int DrHorrible(struct SingAlong Blog);\n" +
|
1195
|
+
"void Penny(struct const _KeepYourHeadUp_ * const BillyBuddy);\n" +
|
1196
|
+
"struct TheseArentTheHammer CaptainHammer(void);\n"
|
1197
|
+
|
1198
|
+
expected = [{ :var_arg=>nil,
|
1199
|
+
:return =>{ :type => "int",
|
1200
|
+
:name => 'cmock_to_return',
|
1201
|
+
:ptr? => false,
|
1202
|
+
:const? => false,
|
1203
|
+
:const_ptr? => false,
|
1204
|
+
:str => "int cmock_to_return",
|
1205
|
+
:void? => false
|
1206
|
+
},
|
1207
|
+
:name=>"DrHorrible",
|
1208
|
+
:unscoped_name=>"DrHorrible",
|
1209
|
+
:namespace=>[],
|
1210
|
+
:class=>nil,
|
1211
|
+
:modifier=>"",
|
1212
|
+
:contains_ptr? => false,
|
1213
|
+
:args=>[ {:type=>"struct SingAlong", :name=>"Blog", :ptr? => false, :const? => false, :const_ptr? => false} ],
|
1214
|
+
:args_string=>"struct SingAlong Blog",
|
1215
|
+
:args_call=>"Blog"
|
1216
|
+
},
|
1217
|
+
{ :var_arg=>nil,
|
1218
|
+
:return=> { :type => "void",
|
1219
|
+
:name => 'cmock_to_return',
|
1220
|
+
:ptr? => false,
|
1221
|
+
:const? => false,
|
1222
|
+
:const_ptr? => false,
|
1223
|
+
:str => "void cmock_to_return",
|
1224
|
+
:void? => true
|
1225
|
+
},
|
1226
|
+
:name=>"Penny",
|
1227
|
+
:unscoped_name=>"Penny",
|
1228
|
+
:namespace=>[],
|
1229
|
+
:class=>nil,
|
1230
|
+
:modifier=>"",
|
1231
|
+
:contains_ptr? => true,
|
1232
|
+
:args=>[ {:type=>"struct const _KeepYourHeadUp_*", :name=>"BillyBuddy", :ptr? => true, :const? => true, :const_ptr? => true} ],
|
1233
|
+
:args_string=>"struct const _KeepYourHeadUp_* const BillyBuddy",
|
1234
|
+
:args_call=>"BillyBuddy"
|
1235
|
+
},
|
1236
|
+
{ :var_arg=>nil,
|
1237
|
+
:return=> { :type => "struct TheseArentTheHammer",
|
1238
|
+
:name => 'cmock_to_return',
|
1239
|
+
:ptr? => false,
|
1240
|
+
:const? => false,
|
1241
|
+
:const_ptr? => false,
|
1242
|
+
:str => "struct TheseArentTheHammer cmock_to_return",
|
1243
|
+
:void? => false
|
1244
|
+
},
|
1245
|
+
:name=>"CaptainHammer",
|
1246
|
+
:unscoped_name=>"CaptainHammer",
|
1247
|
+
:namespace=>[],
|
1248
|
+
:class=>nil,
|
1249
|
+
:modifier=>"",
|
1250
|
+
:contains_ptr? => false,
|
1251
|
+
:args=>[ ],
|
1252
|
+
:args_string=>"void",
|
1253
|
+
:args_call=>""
|
1254
|
+
}]
|
1255
|
+
assert_equal(expected, @parser.parse("module", source)[:functions])
|
1256
|
+
end
|
1257
|
+
|
1258
|
+
it "extract functions containing unions with union specifier" do
|
1259
|
+
source = "void OrangePeel(union STARS_AND_STRIPES * a, union AFL_CIO b)"
|
1260
|
+
expected = [{ :var_arg=>nil,
|
1261
|
+
:return=>{ :type => "void",
|
1262
|
+
:name => 'cmock_to_return',
|
1263
|
+
:ptr? => false,
|
1264
|
+
:const? => false,
|
1265
|
+
:const_ptr? => false,
|
1266
|
+
:str => "void cmock_to_return",
|
1267
|
+
:void? => true
|
1268
|
+
},
|
1269
|
+
:name=>"OrangePeel",
|
1270
|
+
:unscoped_name=>"OrangePeel",
|
1271
|
+
:namespace=>[],
|
1272
|
+
:class=>nil,
|
1273
|
+
:modifier=>"",
|
1274
|
+
:contains_ptr? => true,
|
1275
|
+
:args=>[ {:type=>"union STARS_AND_STRIPES*", :name=>"a", :ptr? => true, :const? => false, :const_ptr? => false},
|
1276
|
+
{:type=>"union AFL_CIO", :name=>"b", :ptr? => false, :const? => false, :const_ptr? => false}
|
1277
|
+
],
|
1278
|
+
:args_string=>"union STARS_AND_STRIPES* a, union AFL_CIO b",
|
1279
|
+
:args_call=>"a, b" }]
|
1280
|
+
result = @parser.parse("module", source)
|
1281
|
+
assert_equal(expected, result[:functions])
|
1282
|
+
end
|
1283
|
+
|
1284
|
+
it "not be thwarted by variables named with primitive types as part of the name" do
|
1285
|
+
source = "void ApplePeel(const unsigned int const_param, int int_param, int integer, char character, int* const constant)"
|
1286
|
+
expected = [{ :var_arg=>nil,
|
1287
|
+
:return=>{ :type => "void",
|
1288
|
+
:name => 'cmock_to_return',
|
1289
|
+
:ptr? => false,
|
1290
|
+
:const? => false,
|
1291
|
+
:const_ptr? => false,
|
1292
|
+
:str => "void cmock_to_return",
|
1293
|
+
:void? => true
|
1294
|
+
},
|
1295
|
+
:name=>"ApplePeel",
|
1296
|
+
:unscoped_name=>"ApplePeel",
|
1297
|
+
:namespace=>[],
|
1298
|
+
:class=>nil,
|
1299
|
+
:modifier=>"",
|
1300
|
+
:contains_ptr? => true,
|
1301
|
+
:args=>[ {:type=> "unsigned int", :name=>"const_param", :ptr? => false, :const? => true, :const_ptr? => false},
|
1302
|
+
{:type=>"int", :name=>"int_param", :ptr? => false, :const? => false, :const_ptr? => false},
|
1303
|
+
{:type=>"int", :name=>"integer", :ptr? => false, :const? => false, :const_ptr? => false},
|
1304
|
+
{:type=>"char", :name=>"character", :ptr? => false, :const? => false, :const_ptr? => false},
|
1305
|
+
{:type=>"int*", :name=>"constant", :ptr? => true, :const? => false, :const_ptr? => true}
|
1306
|
+
],
|
1307
|
+
:args_string=>"const unsigned int const_param, int int_param, int integer, char character, int* const constant",
|
1308
|
+
:args_call=>"const_param, int_param, integer, character, constant" }]
|
1309
|
+
result = @parser.parse("module", source)
|
1310
|
+
assert_equal(expected, result[:functions])
|
1311
|
+
end
|
1312
|
+
|
1313
|
+
it "not be thwarted by custom types named similarly to primitive types" do
|
1314
|
+
source = "void LemonPeel(integer param, character thing, longint * junk, constant value, int32_t const number)"
|
1315
|
+
expected = [{:var_arg=>nil,
|
1316
|
+
:return=>{ :type => "void",
|
1317
|
+
:name => 'cmock_to_return',
|
1318
|
+
:ptr? => false,
|
1319
|
+
:const? => false,
|
1320
|
+
:const_ptr? => false,
|
1321
|
+
:str => "void cmock_to_return",
|
1322
|
+
:void? => true
|
1323
|
+
},
|
1324
|
+
:name=>"LemonPeel",
|
1325
|
+
:unscoped_name=>"LemonPeel",
|
1326
|
+
:namespace=>[],
|
1327
|
+
:class=>nil,
|
1328
|
+
:modifier=>"",
|
1329
|
+
:contains_ptr? => true,
|
1330
|
+
:args=>[ {:type=>"integer", :name=>"param", :ptr? => false, :const? => false, :const_ptr? => false},
|
1331
|
+
{:type=>"character", :name=>"thing", :ptr? => false, :const? => false, :const_ptr? => false},
|
1332
|
+
{:type=>"longint*", :name=>"junk", :ptr? => true, :const? => false, :const_ptr? => false},
|
1333
|
+
{:type=>"constant", :name=>"value", :ptr? => false, :const? => false, :const_ptr? => false},
|
1334
|
+
{:type=>"int32_t", :name=>"number", :ptr? => false, :const? => true, :const_ptr? => false}
|
1335
|
+
],
|
1336
|
+
:args_string=>"integer param, character thing, longint* junk, constant value, int32_t const number",
|
1337
|
+
:args_call=>"param, thing, junk, value, number" }]
|
1338
|
+
result = @parser.parse("module", source)
|
1339
|
+
assert_equal(expected, result[:functions])
|
1340
|
+
end
|
1341
|
+
|
1342
|
+
it "handle some of those chains of C name specifiers naturally" do
|
1343
|
+
source = "void CoinOperated(signed char abc, const unsigned long int xyz_123, unsigned int const abc_123, long long arm_of_the_law)"
|
1344
|
+
expected = [{:var_arg=>nil,
|
1345
|
+
:return=>{ :type => "void",
|
1346
|
+
:name => 'cmock_to_return',
|
1347
|
+
:ptr? => false,
|
1348
|
+
:const? => false,
|
1349
|
+
:const_ptr? => false,
|
1350
|
+
:str => "void cmock_to_return",
|
1351
|
+
:void? => true
|
1352
|
+
},
|
1353
|
+
:name=>"CoinOperated",
|
1354
|
+
:unscoped_name=>"CoinOperated",
|
1355
|
+
:namespace=>[],
|
1356
|
+
:class=>nil,
|
1357
|
+
:modifier=>"",
|
1358
|
+
:contains_ptr? => false,
|
1359
|
+
:args=>[ {:type=>"signed char", :name=>"abc", :ptr? => false, :const? => false, :const_ptr? => false},
|
1360
|
+
{:type=>"unsigned long int", :name=>"xyz_123", :ptr? => false, :const? => true, :const_ptr? => false},
|
1361
|
+
{:type=>"unsigned int", :name=>"abc_123", :ptr? => false, :const? => true, :const_ptr? => false},
|
1362
|
+
{:type=>"long long", :name=>"arm_of_the_law", :ptr? => false, :const? => false, :const_ptr? => false}
|
1363
|
+
],
|
1364
|
+
:args_string=>"signed char abc, const unsigned long int xyz_123, unsigned int const abc_123, long long arm_of_the_law",
|
1365
|
+
:args_call=>"abc, xyz_123, abc_123, arm_of_the_law" }]
|
1366
|
+
result = @parser.parse("module", source)
|
1367
|
+
assert_equal(expected, result[:functions])
|
1368
|
+
end
|
1369
|
+
|
1370
|
+
it "handle custom types of various formats" do
|
1371
|
+
source = "void CardOperated(CUSTOM_TYPE abc, CUSTOM_TYPE* xyz_123, CUSTOM_TYPE const abcxyz, struct CUSTOM_TYPE const * const abc123)"
|
1372
|
+
expected = [{:var_arg=>nil,
|
1373
|
+
:return=>{ :type => "void",
|
1374
|
+
:name => 'cmock_to_return',
|
1375
|
+
:ptr? => false,
|
1376
|
+
:const? => false,
|
1377
|
+
:const_ptr? => false,
|
1378
|
+
:str => "void cmock_to_return",
|
1379
|
+
:void? => true
|
1380
|
+
},
|
1381
|
+
:name=>"CardOperated",
|
1382
|
+
:unscoped_name=>"CardOperated",
|
1383
|
+
:namespace=>[],
|
1384
|
+
:class=>nil,
|
1385
|
+
:modifier=>"",
|
1386
|
+
:contains_ptr? => true,
|
1387
|
+
:args=>[ {:type=>"CUSTOM_TYPE", :name=>"abc", :ptr? => false, :const? => false, :const_ptr? => false},
|
1388
|
+
{:type=>"CUSTOM_TYPE*", :name=>"xyz_123", :ptr? => true, :const? => false, :const_ptr? => false},
|
1389
|
+
{:type=>"CUSTOM_TYPE", :name=>"abcxyz", :ptr? => false, :const? => true, :const_ptr? => false},
|
1390
|
+
{:type=>"struct CUSTOM_TYPE const*", :name=>"abc123", :ptr? => true, :const? => true, :const_ptr? => true}
|
1391
|
+
],
|
1392
|
+
:args_string=>"CUSTOM_TYPE abc, CUSTOM_TYPE* xyz_123, CUSTOM_TYPE const abcxyz, struct CUSTOM_TYPE const* const abc123",
|
1393
|
+
:args_call=>"abc, xyz_123, abcxyz, abc123" }]
|
1394
|
+
result = @parser.parse("module", source)
|
1395
|
+
assert_equal(expected, result[:functions])
|
1396
|
+
end
|
1397
|
+
|
1398
|
+
it "handle arrays and treat them as pointers or strings" do
|
1399
|
+
source = 'void KeyOperated(CUSTOM_TYPE thing1[], int thing2 [ ], ' \
|
1400
|
+
'char thing3 [][2 ][ 3], int* thing4[4], u8 thing5[((u8)((5 + 5*2)/3))])'
|
1401
|
+
expected_args = [
|
1402
|
+
{ type: 'CUSTOM_TYPE*', name: 'thing1', ptr?: true, const?: false, const_ptr?: false },
|
1403
|
+
{ type: 'int*', name: 'thing2', ptr?: true, const?: false, const_ptr?: false },
|
1404
|
+
# this one will likely change in the future when we improve multidimensional array support
|
1405
|
+
{ type: 'char*', name: 'thing3', ptr?: false, const?: false, const_ptr?: false },
|
1406
|
+
# this one will likely change in the future when we improve multidimensional array support
|
1407
|
+
{ type: 'int**', name: 'thing4', ptr?: true, const?: false, const_ptr?: false },
|
1408
|
+
{ type: 'u8*', name: 'thing5', ptr?: true, const?: false, const_ptr?: false }
|
1409
|
+
]
|
1410
|
+
expected = [{:var_arg=>nil,
|
1411
|
+
:return=>{ :type => "void",
|
1412
|
+
:name => 'cmock_to_return',
|
1413
|
+
:ptr? => false,
|
1414
|
+
:const? => false,
|
1415
|
+
:const_ptr? => false,
|
1416
|
+
:str => "void cmock_to_return",
|
1417
|
+
:void? => true
|
1418
|
+
},
|
1419
|
+
:name=>"KeyOperated",
|
1420
|
+
:unscoped_name=>"KeyOperated",
|
1421
|
+
:namespace=>[],
|
1422
|
+
:class=>nil,
|
1423
|
+
:modifier=>"",
|
1424
|
+
:contains_ptr? => true,
|
1425
|
+
:args => expected_args,
|
1426
|
+
:args_string => 'CUSTOM_TYPE* thing1, int* thing2, ' \
|
1427
|
+
'char* thing3, int** thing4, u8* thing5',
|
1428
|
+
:args_call => 'thing1, thing2, thing3, thing4, thing5' }]
|
1429
|
+
result = @parser.parse("module", source)
|
1430
|
+
assert_equal(expected, result[:functions])
|
1431
|
+
end
|
1432
|
+
|
1433
|
+
it "give a reasonable guess when dealing with weird combinations of custom types and modifiers" do
|
1434
|
+
source = "void Cheese(unsigned CUSTOM_TYPE abc, unsigned xyz, CUSTOM_TYPE1 CUSTOM_TYPE2 pdq)"
|
1435
|
+
expected = [{:var_arg=>nil,
|
1436
|
+
:return=>{ :type => "void",
|
1437
|
+
:name => 'cmock_to_return',
|
1438
|
+
:ptr? => false,
|
1439
|
+
:const? => false,
|
1440
|
+
:const_ptr? => false,
|
1441
|
+
:str => "void cmock_to_return",
|
1442
|
+
:void? => true
|
1443
|
+
},
|
1444
|
+
:name=>"Cheese",
|
1445
|
+
:unscoped_name=>"Cheese",
|
1446
|
+
:namespace=>[],
|
1447
|
+
:class=>nil,
|
1448
|
+
:modifier=>"",
|
1449
|
+
:contains_ptr? => false,
|
1450
|
+
:args=>[ {:type=>"unsigned CUSTOM_TYPE", :name=>"abc", :ptr? => false, :const? => false, :const_ptr? => false},
|
1451
|
+
{:type=>"unsigned", :name=>"xyz", :ptr? => false, :const? => false, :const_ptr? => false},
|
1452
|
+
{:type=>"CUSTOM_TYPE1 CUSTOM_TYPE2", :name=>"pdq", :ptr? => false, :const? => false, :const_ptr? => false}
|
1453
|
+
],
|
1454
|
+
:args_string=>"unsigned CUSTOM_TYPE abc, unsigned xyz, CUSTOM_TYPE1 CUSTOM_TYPE2 pdq",
|
1455
|
+
:args_call=>"abc, xyz, pdq" }]
|
1456
|
+
result = @parser.parse("module", source)
|
1457
|
+
assert_equal(expected, result[:functions])
|
1458
|
+
end
|
1459
|
+
|
1460
|
+
it "extract functions containing a function pointer" do
|
1461
|
+
source = "void FunkyTurkey(unsigned int (*func_ptr)(int, char))"
|
1462
|
+
expected = [{ :var_arg=>nil,
|
1463
|
+
:return=>{ :type => "void",
|
1464
|
+
:name => 'cmock_to_return',
|
1465
|
+
:ptr? => false,
|
1466
|
+
:const? => false,
|
1467
|
+
:const_ptr? => false,
|
1468
|
+
:str => "void cmock_to_return",
|
1469
|
+
:void? => true
|
1470
|
+
},
|
1471
|
+
:name=>"FunkyTurkey",
|
1472
|
+
:unscoped_name=>"FunkyTurkey",
|
1473
|
+
:namespace=>[],
|
1474
|
+
:class=>nil,
|
1475
|
+
:modifier=>"",
|
1476
|
+
:contains_ptr? => false,
|
1477
|
+
:args=>[ {:type=>"cmock_module_func_ptr1", :name=>"func_ptr", :ptr? => false, :const? => false, :const_ptr? => false}
|
1478
|
+
],
|
1479
|
+
:args_string=>"cmock_module_func_ptr1 func_ptr",
|
1480
|
+
:args_call=>"func_ptr" }]
|
1481
|
+
typedefs = ["typedef unsigned int(*cmock_module_func_ptr1)(int, char);"]
|
1482
|
+
result = @parser.parse("module", source)
|
1483
|
+
assert_equal(expected, result[:functions])
|
1484
|
+
assert_equal(typedefs, result[:typedefs])
|
1485
|
+
end
|
1486
|
+
|
1487
|
+
it "extract functions using a function pointer with shorthand notation" do
|
1488
|
+
source = "void FunkyTurkey(unsigned int func_ptr(int, char))"
|
1489
|
+
expected = [{ :var_arg=>nil,
|
1490
|
+
:return=>{ :type => "void",
|
1491
|
+
:name => 'cmock_to_return',
|
1492
|
+
:ptr? => false,
|
1493
|
+
:const? => false,
|
1494
|
+
:const_ptr? => false,
|
1495
|
+
:str => "void cmock_to_return",
|
1496
|
+
:void? => true
|
1497
|
+
},
|
1498
|
+
:name=>"FunkyTurkey",
|
1499
|
+
:unscoped_name=>"FunkyTurkey",
|
1500
|
+
:namespace=>[],
|
1501
|
+
:class=>nil,
|
1502
|
+
:modifier=>"",
|
1503
|
+
:contains_ptr? => false,
|
1504
|
+
:args=>[ {:type=>"cmock_module_func_ptr1", :name=>"func_ptr", :ptr? => false, :const? => false, :const_ptr? => false}
|
1505
|
+
],
|
1506
|
+
:args_string=>"cmock_module_func_ptr1 func_ptr",
|
1507
|
+
:args_call=>"func_ptr" }]
|
1508
|
+
typedefs = ["typedef unsigned int(*cmock_module_func_ptr1)(int, char);"]
|
1509
|
+
result = @parser.parse("module", source)
|
1510
|
+
assert_equal(expected, result[:functions])
|
1511
|
+
assert_equal(typedefs, result[:typedefs])
|
1512
|
+
end
|
1513
|
+
|
1514
|
+
it "extract functions containing a function pointer with a void" do
|
1515
|
+
source = "void FunkyTurkey(void (*func_ptr)(void))"
|
1516
|
+
expected = [{ :var_arg=>nil,
|
1517
|
+
:return=>{ :type => "void",
|
1518
|
+
:name => 'cmock_to_return',
|
1519
|
+
:ptr? => false,
|
1520
|
+
:const? => false,
|
1521
|
+
:const_ptr? => false,
|
1522
|
+
:str => "void cmock_to_return",
|
1523
|
+
:void? => true
|
1524
|
+
},
|
1525
|
+
:name=>"FunkyTurkey",
|
1526
|
+
:unscoped_name=>"FunkyTurkey",
|
1527
|
+
:namespace=>[],
|
1528
|
+
:class=>nil,
|
1529
|
+
:modifier=>"",
|
1530
|
+
:contains_ptr? => false,
|
1531
|
+
:args=>[ {:type=>"cmock_module_func_ptr1", :name=>"func_ptr", :ptr? => false, :const? => false, :const_ptr? => false}
|
1532
|
+
],
|
1533
|
+
:args_string=>"cmock_module_func_ptr1 func_ptr",
|
1534
|
+
:args_call=>"func_ptr" }]
|
1535
|
+
typedefs = ["typedef void(*cmock_module_func_ptr1)(void);"]
|
1536
|
+
result = @parser.parse("module", source)
|
1537
|
+
assert_equal(expected, result[:functions])
|
1538
|
+
assert_equal(typedefs, result[:typedefs])
|
1539
|
+
end
|
1540
|
+
|
1541
|
+
it "extract functions containing a function pointer with an implied void" do
|
1542
|
+
source = "void FunkyTurkey(unsigned int (*func_ptr)())"
|
1543
|
+
expected = [{ :var_arg=>nil,
|
1544
|
+
:return=>{ :type => "void",
|
1545
|
+
:name => 'cmock_to_return',
|
1546
|
+
:ptr? => false,
|
1547
|
+
:const? => false,
|
1548
|
+
:const_ptr? => false,
|
1549
|
+
:str => "void cmock_to_return",
|
1550
|
+
:void? => true
|
1551
|
+
},
|
1552
|
+
:name=>"FunkyTurkey",
|
1553
|
+
:unscoped_name=>"FunkyTurkey",
|
1554
|
+
:namespace=>[],
|
1555
|
+
:class=>nil,
|
1556
|
+
:modifier=>"",
|
1557
|
+
:contains_ptr? => false,
|
1558
|
+
:args=>[ {:type=>"cmock_module_func_ptr1", :name=>"func_ptr", :ptr? => false, :const? => false, :const_ptr? => false}
|
1559
|
+
],
|
1560
|
+
:args_string=>"cmock_module_func_ptr1 func_ptr",
|
1561
|
+
:args_call=>"func_ptr" }]
|
1562
|
+
typedefs = ["typedef unsigned int(*cmock_module_func_ptr1)();"]
|
1563
|
+
result = @parser.parse("module", source)
|
1564
|
+
assert_equal(expected, result[:functions])
|
1565
|
+
assert_equal(typedefs, result[:typedefs])
|
1566
|
+
end
|
1567
|
+
|
1568
|
+
it "extract functions containing a constant function pointer and a pointer in the nested arg list" do
|
1569
|
+
source = "void FunkyChicken(unsigned int (* const func_ptr)(unsigned long int * , char))"
|
1570
|
+
expected = [{ :var_arg=>nil,
|
1571
|
+
:return=>{ :type => "void",
|
1572
|
+
:name => 'cmock_to_return',
|
1573
|
+
:ptr? => false,
|
1574
|
+
:const? => false,
|
1575
|
+
:const_ptr? => false,
|
1576
|
+
:str => "void cmock_to_return",
|
1577
|
+
:void? => true
|
1578
|
+
},
|
1579
|
+
:name=>"FunkyChicken",
|
1580
|
+
:unscoped_name=>"FunkyChicken",
|
1581
|
+
:namespace=>[],
|
1582
|
+
:class=>nil,
|
1583
|
+
:modifier=>"",
|
1584
|
+
:contains_ptr? => false,
|
1585
|
+
:args=>[ {:type=>"cmock_module_func_ptr1", :name=>"func_ptr", :ptr? => false, :const? => true, :const_ptr? => false}
|
1586
|
+
],
|
1587
|
+
:args_string=>"cmock_module_func_ptr1 const func_ptr",
|
1588
|
+
:args_call=>"func_ptr" }]
|
1589
|
+
typedefs = ["typedef unsigned int(*cmock_module_func_ptr1)(unsigned long int* , char);"]
|
1590
|
+
result = @parser.parse("module", source)
|
1591
|
+
assert_equal(expected, result[:functions])
|
1592
|
+
assert_equal(typedefs, result[:typedefs])
|
1593
|
+
end
|
1594
|
+
|
1595
|
+
# it "extract functions containing a function pointer taking a vararg" do
|
1596
|
+
# source = "void FunkyParrot(unsigned int (*func_ptr)(int, char, ...))"
|
1597
|
+
# expected = [{ :var_arg=>nil,
|
1598
|
+
# :return=>{ :type => "void",
|
1599
|
+
# :name => 'cmock_to_return',
|
1600
|
+
# :ptr? => false,
|
1601
|
+
# :const? => false,
|
1602
|
+
# :const_ptr? => false,
|
1603
|
+
# :str => "void cmock_to_return",
|
1604
|
+
# :void? => true
|
1605
|
+
# },
|
1606
|
+
# :name=>"FunkyParrot",
|
1607
|
+
# :unscoped_name=>"FunkyParrot",
|
1608
|
+
# :namespace=>[],
|
1609
|
+
# :class=>nil,
|
1610
|
+
# :modifier=>"",
|
1611
|
+
# :contains_ptr? => false,
|
1612
|
+
# :args=>[ {:type=>"cmock_module_func_ptr1", :name=>"func_ptr", :ptr? => false, :const? => false, :const_ptr? => false}
|
1613
|
+
# ],
|
1614
|
+
# :args_string=>"cmock_module_func_ptr1 func_ptr",
|
1615
|
+
# :args_call=>"func_ptr" }]
|
1616
|
+
# typedefs = ["typedef unsigned int(*cmock_module_func_ptr1)(int, char, ...);"]
|
1617
|
+
# result = @parser.parse("module", source)
|
1618
|
+
# assert_equal(expected, result[:functions])
|
1619
|
+
# assert_equal(typedefs, result[:typedefs])
|
1620
|
+
# end
|
1621
|
+
|
1622
|
+
it "extract functions containing a function pointer with extra parenthesis and two sets" do
|
1623
|
+
source = "void FunkyBudgie(int (((* func_ptr1)(int, char))), void (*func_ptr2)(void))"
|
1624
|
+
expected = [{ :var_arg=>nil,
|
1625
|
+
:return=>{ :type => "void",
|
1626
|
+
:name => 'cmock_to_return',
|
1627
|
+
:ptr? => false,
|
1628
|
+
:const? => false,
|
1629
|
+
:const_ptr? => false,
|
1630
|
+
:str => "void cmock_to_return",
|
1631
|
+
:void? => true
|
1632
|
+
},
|
1633
|
+
:name=>"FunkyBudgie",
|
1634
|
+
:unscoped_name=>"FunkyBudgie",
|
1635
|
+
:namespace=>[],
|
1636
|
+
:class=>nil,
|
1637
|
+
:modifier=>"",
|
1638
|
+
:contains_ptr? => false,
|
1639
|
+
:args=>[ {:type=>"cmock_module_func_ptr1", :name=>"func_ptr1", :ptr? => false, :const? => false, :const_ptr? => false},
|
1640
|
+
{:type=>"cmock_module_func_ptr2", :name=>"func_ptr2", :ptr? => false, :const? => false, :const_ptr? => false}
|
1641
|
+
],
|
1642
|
+
:args_string=>"cmock_module_func_ptr1 func_ptr1, cmock_module_func_ptr2 func_ptr2",
|
1643
|
+
:args_call=>"func_ptr1, func_ptr2" }]
|
1644
|
+
typedefs = ["typedef int(*cmock_module_func_ptr1)(int, char);", "typedef void(*cmock_module_func_ptr2)(void);"]
|
1645
|
+
result = @parser.parse("module", source)
|
1646
|
+
assert_equal(expected, result[:functions])
|
1647
|
+
assert_equal(typedefs, result[:typedefs])
|
1648
|
+
end
|
1649
|
+
|
1650
|
+
it "extract functions containing a function pointers, structs and other things" do
|
1651
|
+
source = "struct mytype *FunkyRobin(uint16_t num1, uint16_t num2, void (*func_ptr1)(uint16_t num3, struct mytype2 *s));"
|
1652
|
+
expected = [{ :var_arg=>nil,
|
1653
|
+
:return=>{ :type => "struct mytype*",
|
1654
|
+
:name => 'cmock_to_return',
|
1655
|
+
:ptr? => true,
|
1656
|
+
:const? => false,
|
1657
|
+
:const_ptr? => false,
|
1658
|
+
:str => "struct mytype* cmock_to_return",
|
1659
|
+
:void? => false
|
1660
|
+
},
|
1661
|
+
:name=>"FunkyRobin",
|
1662
|
+
:unscoped_name=>"FunkyRobin",
|
1663
|
+
:namespace=>[],
|
1664
|
+
:class=>nil,
|
1665
|
+
:modifier=>"",
|
1666
|
+
:contains_ptr? => false,
|
1667
|
+
:args=>[ {:type=>"uint16_t", :name=>"num1", :ptr? => false, :const? => false, :const_ptr? => false},
|
1668
|
+
{:type=>"uint16_t", :name=>"num2", :ptr? => false, :const? => false, :const_ptr? => false},
|
1669
|
+
{:type=>"cmock_module_func_ptr1", :name=>"func_ptr1", :ptr? => false, :const? => false, :const_ptr? => false}
|
1670
|
+
],
|
1671
|
+
:args_string=>"uint16_t num1, uint16_t num2, cmock_module_func_ptr1 func_ptr1",
|
1672
|
+
:args_call=>"num1, num2, func_ptr1" }]
|
1673
|
+
typedefs = ["typedef void(*cmock_module_func_ptr1)(uint16_t num3, struct mytype2* s);"]
|
1674
|
+
result = @parser.parse("module", source)
|
1675
|
+
assert_equal(expected, result[:functions])
|
1676
|
+
assert_equal(typedefs, result[:typedefs])
|
1677
|
+
end
|
1678
|
+
|
1679
|
+
it "extract functions containing an anonymous function pointer" do
|
1680
|
+
source = "void FunkyFowl(unsigned int (* const)(int, char))"
|
1681
|
+
expected = [{ :var_arg=>nil,
|
1682
|
+
:return=>{ :type => "void",
|
1683
|
+
:name => 'cmock_to_return',
|
1684
|
+
:ptr? => false,
|
1685
|
+
:const? => false,
|
1686
|
+
:const_ptr? => false,
|
1687
|
+
:str => "void cmock_to_return",
|
1688
|
+
:void? => true
|
1689
|
+
},
|
1690
|
+
:name=>"FunkyFowl",
|
1691
|
+
:unscoped_name=>"FunkyFowl",
|
1692
|
+
:namespace=>[],
|
1693
|
+
:class=>nil,
|
1694
|
+
:modifier=>"",
|
1695
|
+
:contains_ptr? => false,
|
1696
|
+
:args=>[ {:type=>"cmock_module_func_ptr1", :name=>"cmock_arg1", :ptr? => false, :const? => true, :const_ptr? => false}
|
1697
|
+
],
|
1698
|
+
:args_string=>"cmock_module_func_ptr1 const cmock_arg1",
|
1699
|
+
:args_call=>"cmock_arg1" }]
|
1700
|
+
typedefs = ["typedef unsigned int(*cmock_module_func_ptr1)(int, char);"]
|
1701
|
+
result = @parser.parse("module", source)
|
1702
|
+
assert_equal(expected, result[:functions])
|
1703
|
+
assert_equal(typedefs, result[:typedefs])
|
1704
|
+
end
|
1705
|
+
|
1706
|
+
it "extract functions returning a function pointer" do
|
1707
|
+
source = "unsigned short (*FunkyPidgeon( const char op_code ))( int, long int )"
|
1708
|
+
expected = [{ :var_arg=>nil,
|
1709
|
+
:return=>{ :type => "cmock_module_func_ptr1",
|
1710
|
+
:name => 'cmock_to_return',
|
1711
|
+
:ptr? => false,
|
1712
|
+
:const? => false,
|
1713
|
+
:const_ptr? => false,
|
1714
|
+
:str => "cmock_module_func_ptr1 cmock_to_return",
|
1715
|
+
:void? => false
|
1716
|
+
},
|
1717
|
+
:name=>"FunkyPidgeon",
|
1718
|
+
:unscoped_name=>"FunkyPidgeon",
|
1719
|
+
:namespace=>[],
|
1720
|
+
:class=>nil,
|
1721
|
+
:modifier=>"",
|
1722
|
+
:contains_ptr? => false,
|
1723
|
+
:args=>[ {:type=>"char", :name=>"op_code", :ptr? => false, :const? => true, :const_ptr? => false}
|
1724
|
+
],
|
1725
|
+
:args_string=>"const char op_code",
|
1726
|
+
:args_call=>"op_code" }]
|
1727
|
+
typedefs = ["typedef unsigned short(*cmock_module_func_ptr1)( int, long int );"]
|
1728
|
+
result = @parser.parse("module", source)
|
1729
|
+
assert_equal(expected, result[:functions])
|
1730
|
+
assert_equal(typedefs, result[:typedefs])
|
1731
|
+
end
|
1732
|
+
|
1733
|
+
it "extract functions returning a function pointer with implied void" do
|
1734
|
+
source = "unsigned short (*FunkyTweetie())()"
|
1735
|
+
expected = [{ :var_arg=>nil,
|
1736
|
+
:return=>{ :type => "cmock_module_func_ptr1",
|
1737
|
+
:name => 'cmock_to_return',
|
1738
|
+
:ptr? => false,
|
1739
|
+
:const? => false,
|
1740
|
+
:const_ptr? => false,
|
1741
|
+
:str => "cmock_module_func_ptr1 cmock_to_return",
|
1742
|
+
:void? => false
|
1743
|
+
},
|
1744
|
+
:name=>"FunkyTweetie",
|
1745
|
+
:unscoped_name=>"FunkyTweetie",
|
1746
|
+
:namespace=>[],
|
1747
|
+
:class=>nil,
|
1748
|
+
:modifier=>"",
|
1749
|
+
:contains_ptr? => false,
|
1750
|
+
:args=>[],
|
1751
|
+
:args_string=>"void",
|
1752
|
+
:args_call=>"" }]
|
1753
|
+
typedefs = ["typedef unsigned short(*cmock_module_func_ptr1)();"]
|
1754
|
+
result = @parser.parse("module", source)
|
1755
|
+
assert_equal(expected, result[:functions])
|
1756
|
+
assert_equal(typedefs, result[:typedefs])
|
1757
|
+
end
|
1758
|
+
|
1759
|
+
it "extract functions returning a function pointer where everything is a void" do
|
1760
|
+
source = "void (* FunkySeaGull(void))(void)"
|
1761
|
+
expected = [{ :var_arg=>nil,
|
1762
|
+
:return=>{ :type => "cmock_module_func_ptr1",
|
1763
|
+
:name => 'cmock_to_return',
|
1764
|
+
:ptr? => false,
|
1765
|
+
:const? => false,
|
1766
|
+
:const_ptr? => false,
|
1767
|
+
:str => "cmock_module_func_ptr1 cmock_to_return",
|
1768
|
+
:void? => false
|
1769
|
+
},
|
1770
|
+
:name=>"FunkySeaGull",
|
1771
|
+
:unscoped_name=>"FunkySeaGull",
|
1772
|
+
:namespace=>[],
|
1773
|
+
:class=>nil,
|
1774
|
+
:modifier=>"",
|
1775
|
+
:contains_ptr? => false,
|
1776
|
+
:args=>[],
|
1777
|
+
:args_string=>"void",
|
1778
|
+
:args_call=>"" }]
|
1779
|
+
typedefs = ["typedef void(*cmock_module_func_ptr1)(void);"]
|
1780
|
+
result = @parser.parse("module", source)
|
1781
|
+
assert_equal(expected, result[:functions])
|
1782
|
+
assert_equal(typedefs, result[:typedefs])
|
1783
|
+
end
|
1784
|
+
|
1785
|
+
it "extract functions returning a function pointer with some pointer nonsense" do
|
1786
|
+
source = "unsigned int * (* FunkyMacaw(double* foo, THING *bar))(unsigned int)"
|
1787
|
+
expected = [{ :var_arg=>nil,
|
1788
|
+
:return=>{ :type => "cmock_module_func_ptr1",
|
1789
|
+
:name => 'cmock_to_return',
|
1790
|
+
:ptr? => false,
|
1791
|
+
:const? => false,
|
1792
|
+
:const_ptr? => false,
|
1793
|
+
:str => "cmock_module_func_ptr1 cmock_to_return",
|
1794
|
+
:void? => false
|
1795
|
+
},
|
1796
|
+
:name=>"FunkyMacaw",
|
1797
|
+
:unscoped_name=>"FunkyMacaw",
|
1798
|
+
:namespace=>[],
|
1799
|
+
:class=>nil,
|
1800
|
+
:modifier=>"",
|
1801
|
+
:contains_ptr? => true,
|
1802
|
+
:args=>[ {:type=>"double*", :name=>"foo", :ptr? => true, :const? => false, :const_ptr? => false},
|
1803
|
+
{:type=>"THING*", :name=>"bar", :ptr? => true, :const? => false, :const_ptr? => false}
|
1804
|
+
],
|
1805
|
+
:args_string=>"double* foo, THING* bar",
|
1806
|
+
:args_call=>"foo, bar" }]
|
1807
|
+
typedefs = ["typedef unsigned int *(*cmock_module_func_ptr1)(unsigned int);"]
|
1808
|
+
result = @parser.parse("module", source)
|
1809
|
+
assert_equal(expected, result[:functions])
|
1810
|
+
assert_equal(typedefs, result[:typedefs])
|
1811
|
+
end
|
1812
|
+
|
1813
|
+
it "extract this SQLite3 function with an anonymous function pointer arg (regression test)" do
|
1814
|
+
source = "SQLITE_API int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void(*)(void*))"
|
1815
|
+
expected = [{ :var_arg=>nil,
|
1816
|
+
:return=>{ :type => "int",
|
1817
|
+
:name => "cmock_to_return",
|
1818
|
+
:ptr? => false,
|
1819
|
+
:const? => false,
|
1820
|
+
:const_ptr? => false,
|
1821
|
+
:str => "int cmock_to_return",
|
1822
|
+
:void? => false
|
1823
|
+
},
|
1824
|
+
:name=>"sqlite3_bind_text",
|
1825
|
+
:unscoped_name=>"sqlite3_bind_text",
|
1826
|
+
:namespace=>[],
|
1827
|
+
:class=>nil,
|
1828
|
+
:modifier=>"SQLITE_API",
|
1829
|
+
:contains_ptr? => true,
|
1830
|
+
:args=>[ {:type=>"sqlite3_stmt*", :name=>"cmock_arg2", :ptr? => true, :const? => false, :const_ptr? => false},
|
1831
|
+
{:type=>"int", :name=>"cmock_arg3", :ptr? => false, :const? => false, :const_ptr? => false},
|
1832
|
+
{:type=>"const char*", :name=>"cmock_arg4", :ptr? => false, :const? => true, :const_ptr? => false},
|
1833
|
+
{:type=>"int", :name=>"n", :ptr? => false, :const? => false, :const_ptr? => false},
|
1834
|
+
{:type=>"cmock_module_func_ptr1", :name=>"cmock_arg1", :ptr? => false, :const? => false, :const_ptr? => false}
|
1835
|
+
],
|
1836
|
+
:args_string=>"sqlite3_stmt* cmock_arg2, int cmock_arg3, const char* cmock_arg4, int n, cmock_module_func_ptr1 cmock_arg1",
|
1837
|
+
:args_call=>"cmock_arg2, cmock_arg3, cmock_arg4, n, cmock_arg1" }]
|
1838
|
+
typedefs = ["typedef void(*cmock_module_func_ptr1)(void*);"]
|
1839
|
+
result = @parser.parse("module", source)
|
1840
|
+
assert_equal(expected, result[:functions])
|
1841
|
+
assert_equal(typedefs, result[:typedefs])
|
1842
|
+
end
|
1843
|
+
|
1844
|
+
it "extract functions with varargs" do
|
1845
|
+
source = "int XFiles(int Scully, int Mulder, ...);\n"
|
1846
|
+
expected = [{ :var_arg=>"...",
|
1847
|
+
:return=> { :type => "int",
|
1848
|
+
:name => 'cmock_to_return',
|
1849
|
+
:ptr? => false,
|
1850
|
+
:const? => false,
|
1851
|
+
:const_ptr? => false,
|
1852
|
+
:str => "int cmock_to_return",
|
1853
|
+
:void? => false
|
1854
|
+
},
|
1855
|
+
:name=>"XFiles",
|
1856
|
+
:unscoped_name=>"XFiles",
|
1857
|
+
:namespace=>[],
|
1858
|
+
:class=>nil,
|
1859
|
+
:modifier=>"",
|
1860
|
+
:contains_ptr? => false,
|
1861
|
+
:args=>[ {:type=>"int", :name=>"Scully", :ptr? => false, :const? => false, :const_ptr? => false},
|
1862
|
+
{:type=>"int", :name=>"Mulder", :ptr? => false, :const? => false, :const_ptr? => false}
|
1863
|
+
],
|
1864
|
+
:args_string=>"int Scully, int Mulder",
|
1865
|
+
:args_call=>"Scully, Mulder"
|
1866
|
+
}]
|
1867
|
+
assert_equal(expected, @parser.parse("module", source)[:functions])
|
1868
|
+
end
|
1869
|
+
|
1870
|
+
it "extract functions with void pointers" do
|
1871
|
+
source = "void* MoreSillySongs(void* stuff);\n"
|
1872
|
+
expected = [{ :var_arg=>nil,
|
1873
|
+
:return=> { :type => "void*",
|
1874
|
+
:name => 'cmock_to_return',
|
1875
|
+
:ptr? => true,
|
1876
|
+
:const? => false,
|
1877
|
+
:const_ptr? => false,
|
1878
|
+
:str => "void* cmock_to_return",
|
1879
|
+
:void? => false
|
1880
|
+
},
|
1881
|
+
:name=>"MoreSillySongs",
|
1882
|
+
:unscoped_name=>"MoreSillySongs",
|
1883
|
+
:namespace=>[],
|
1884
|
+
:class=>nil,
|
1885
|
+
:modifier=>"",
|
1886
|
+
:contains_ptr? => true,
|
1887
|
+
:args=>[ {:type=>"void*", :name=>"stuff", :ptr? => true, :const? => false, :const_ptr? => false}
|
1888
|
+
],
|
1889
|
+
:args_string=>"void* stuff",
|
1890
|
+
:args_call=>"stuff"
|
1891
|
+
}]
|
1892
|
+
assert_equal(expected, @parser.parse("module", source)[:functions])
|
1893
|
+
end
|
1894
|
+
|
1895
|
+
it "extract functions with strippable confusing junk like gcc attributes" do
|
1896
|
+
source = "int LaverneAndShirley(int Lenny, int Squiggy) __attribute__((weak)) __attribute__ ((deprecated));\n"
|
1897
|
+
expected = [{ :var_arg=>nil,
|
1898
|
+
:return=> { :type => "int",
|
1899
|
+
:name => 'cmock_to_return',
|
1900
|
+
:ptr? => false,
|
1901
|
+
:const? => false,
|
1902
|
+
:const_ptr? => false,
|
1903
|
+
:str => "int cmock_to_return",
|
1904
|
+
:void? => false
|
1905
|
+
},
|
1906
|
+
:name=>"LaverneAndShirley",
|
1907
|
+
:unscoped_name=>"LaverneAndShirley",
|
1908
|
+
:namespace=>[],
|
1909
|
+
:class=>nil,
|
1910
|
+
:modifier=>"",
|
1911
|
+
:contains_ptr? => false,
|
1912
|
+
:args=>[ {:type=>"int", :name=>"Lenny", :ptr? => false, :const? => false, :const_ptr? => false},
|
1913
|
+
{:type=>"int", :name=>"Squiggy", :ptr? => false, :const? => false, :const_ptr? => false}
|
1914
|
+
],
|
1915
|
+
:args_string=>"int Lenny, int Squiggy",
|
1916
|
+
:args_call=>"Lenny, Squiggy"
|
1917
|
+
}]
|
1918
|
+
assert_equal(expected, @parser.parse("module", source)[:functions])
|
1919
|
+
end
|
1920
|
+
|
1921
|
+
it "extract functions with strippable confusing junk like gcc attributes with parenthesis" do
|
1922
|
+
source = "int TheCosbyShow(int Cliff, int Claire) __attribute__((weak, alias (\"__f\"));\n"
|
1923
|
+
expected = [{ :var_arg=>nil,
|
1924
|
+
:return=> { :type => "int",
|
1925
|
+
:name => 'cmock_to_return',
|
1926
|
+
:ptr? => false,
|
1927
|
+
:const? => false,
|
1928
|
+
:const_ptr? => false,
|
1929
|
+
:str => "int cmock_to_return",
|
1930
|
+
:void? => false
|
1931
|
+
},
|
1932
|
+
:name=>"TheCosbyShow",
|
1933
|
+
:unscoped_name=>"TheCosbyShow",
|
1934
|
+
:namespace=>[],
|
1935
|
+
:class=>nil,
|
1936
|
+
:modifier=>"",
|
1937
|
+
:contains_ptr? => false,
|
1938
|
+
:args=>[ {:type=>"int", :name=>"Cliff", :ptr? => false, :const? => false, :const_ptr? => false},
|
1939
|
+
{:type=>"int", :name=>"Claire", :ptr? => false, :const? => false, :const_ptr? => false}
|
1940
|
+
],
|
1941
|
+
:args_string=>"int Cliff, int Claire",
|
1942
|
+
:args_call=>"Cliff, Claire"
|
1943
|
+
}]
|
1944
|
+
assert_equal(expected, @parser.parse("module", source)[:functions])
|
1945
|
+
end
|
1946
|
+
|
1947
|
+
it "divines all permutations of ptr, const, and const_ptr correctly" do
|
1948
|
+
truth_table = [
|
1949
|
+
# argument ptr const const_ptr
|
1950
|
+
[ "constNOTconst constNOTconst", false, false, false ],
|
1951
|
+
[ "const constNOTconst constNOTconst", false, true, false ],
|
1952
|
+
[ "constNOTconst const constNOTconst", false, true, false ],
|
1953
|
+
[ "constNOTconst *constNOTconst", true, false, false ],
|
1954
|
+
[ "const constNOTconst *constNOTconst", true, true, false ],
|
1955
|
+
[ "constNOTconst const *constNOTconst", true, true, false ],
|
1956
|
+
[ "constNOTconst *const constNOTconst", true, false, true ],
|
1957
|
+
[ "const constNOTconst *const constNOTconst", true, true, true ],
|
1958
|
+
[ "constNOTconst const *const constNOTconst", true, true, true ],
|
1959
|
+
[ "constNOTconst **constNOTconst", true, false, false ],
|
1960
|
+
[ "const constNOTconst **constNOTconst", true, false, false ],
|
1961
|
+
[ "constNOTconst const **constNOTconst", true, false, false ],
|
1962
|
+
[ "constNOTconst *const *constNOTconst", true, true, false ],
|
1963
|
+
[ "const constNOTconst *const *constNOTconst", true, true, false ],
|
1964
|
+
[ "constNOTconst const *const *constNOTconst", true, true, false ],
|
1965
|
+
[ "constNOTconst **const constNOTconst", true, false, true ],
|
1966
|
+
[ "const constNOTconst **const constNOTconst", true, false, true ],
|
1967
|
+
[ "constNOTconst const **const constNOTconst", true, false, true ],
|
1968
|
+
[ "constNOTconst *const *const constNOTconst", true, true, true ],
|
1969
|
+
[ "const constNOTconst *const *const constNOTconst", true, true, true ],
|
1970
|
+
[ "constNOTconst const *const *const constNOTconst", true, true, true ]
|
1971
|
+
]
|
1972
|
+
|
1973
|
+
truth_table.each do |entry|
|
1974
|
+
assert_equal(@parser.divine_ptr(entry[0]), entry[1])
|
1975
|
+
assert_equal(@parser.divine_const(entry[0]), entry[2])
|
1976
|
+
assert_equal(@parser.divine_ptr_and_const(entry[0]),
|
1977
|
+
{ ptr?: entry[1], const?: entry[2], const_ptr?: entry[3] })
|
1978
|
+
end
|
1979
|
+
end
|
1980
|
+
|
1981
|
+
it "divines ptr correctly for string types" do
|
1982
|
+
truth_table = [
|
1983
|
+
# argument ptr
|
1984
|
+
[ "char s", false ],
|
1985
|
+
[ "const char s", false ],
|
1986
|
+
[ "char const s", false ],
|
1987
|
+
[ "char *s", false ],
|
1988
|
+
[ "const char *s", false ],
|
1989
|
+
[ "char const *s", false ],
|
1990
|
+
[ "char *const s", false ],
|
1991
|
+
[ "const char *const s", false ],
|
1992
|
+
[ "char const *const s", false ],
|
1993
|
+
[ "char **s", true ],
|
1994
|
+
[ "const char **s", true ],
|
1995
|
+
[ "char const **s", true ],
|
1996
|
+
[ "char *const *s", true ],
|
1997
|
+
[ "const char *const *s", true ],
|
1998
|
+
[ "char const *const *s", true ],
|
1999
|
+
[ "char **const s", true ],
|
2000
|
+
[ "const char **const s", true ],
|
2001
|
+
[ "char const **const s", true ],
|
2002
|
+
[ "char *const *const s", true ],
|
2003
|
+
[ "const char *const *const s", true ],
|
2004
|
+
[ "char const *const *const s", true ]
|
2005
|
+
]
|
2006
|
+
|
2007
|
+
truth_table.each do |entry|
|
2008
|
+
assert_equal(@parser.divine_ptr(entry[0]), entry[1])
|
2009
|
+
end
|
2010
|
+
end
|
2011
|
+
|
2012
|
+
it "Transform inline functions doesn't change a header with no inlines" do
|
2013
|
+
source =
|
2014
|
+
"#ifndef _NOINCLUDES\n" +
|
2015
|
+
"#define _NOINCLUDES\n" +
|
2016
|
+
"#include \"unity.h\"\n" +
|
2017
|
+
"#include \"cmock.h\"\n" +
|
2018
|
+
"#include \"YetAnotherHeader.h\"\n" +
|
2019
|
+
"\n" +
|
2020
|
+
"/* Ignore the following warnings since we are copying code */\n" +
|
2021
|
+
"#if defined(__GNUC__) && !defined(__ICC) && !defined(__TMS470__)\n" +
|
2022
|
+
"#if __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 6 || (__GNUC_MINOR__ == 6 && __GNUC_PATCHLEVEL__ > 0)))\n" +
|
2023
|
+
"#pragma GCC diagnostic push\n" +
|
2024
|
+
"#endif\n" +
|
2025
|
+
"#if !defined(__clang__)\n" +
|
2026
|
+
"#pragma GCC diagnostic ignored \"-Wpragmas\"\n" +
|
2027
|
+
"#endif\n" +
|
2028
|
+
"#pragma GCC diagnostic ignored \"-Wunknown-pragmas\"\n" +
|
2029
|
+
"#pragma GCC diagnostic ignored \"-Wduplicate-decl-specifier\"\n" +
|
2030
|
+
"#endif\n" +
|
2031
|
+
"\n" +
|
2032
|
+
"struct my_struct {\n" +
|
2033
|
+
"int a;\n" +
|
2034
|
+
"int b;\n" +
|
2035
|
+
"int b;\n" +
|
2036
|
+
"char c;\n" +
|
2037
|
+
"};\n" +
|
2038
|
+
"int my_function(int a);\n" +
|
2039
|
+
"int my_better_function(struct my_struct *s);\n" +
|
2040
|
+
"\n" +
|
2041
|
+
"#endif _NOINCLUDES\n"
|
2042
|
+
|
2043
|
+
assert_equal(source, @parser.transform_inline_functions(source))
|
2044
|
+
end
|
2045
|
+
|
2046
|
+
it "Transform inline functions changes inline functions to function declarations" do
|
2047
|
+
source =
|
2048
|
+
"#ifndef _NOINCLUDES\n" +
|
2049
|
+
"#define _NOINCLUDES\n" +
|
2050
|
+
"#include \"unity.h\"\n" +
|
2051
|
+
"#include \"cmock.h\"\n" +
|
2052
|
+
"#include \"YetAnotherHeader.h\"\n" +
|
2053
|
+
"\n" +
|
2054
|
+
"/* Ignore the following warnings since we are copying code */\n" +
|
2055
|
+
"#if defined(__GNUC__) && !defined(__ICC) && !defined(__TMS470__)\n" +
|
2056
|
+
"#if __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 6 || (__GNUC_MINOR__ == 6 && __GNUC_PATCHLEVEL__ > 0)))\n" +
|
2057
|
+
"#pragma GCC diagnostic push\n" +
|
2058
|
+
"#endif\n" +
|
2059
|
+
"#if !defined(__clang__)\n" +
|
2060
|
+
"#pragma GCC diagnostic ignored \"-Wpragmas\"\n" +
|
2061
|
+
"#endif\n" +
|
2062
|
+
"#pragma GCC diagnostic ignored \"-Wunknown-pragmas\"\n" +
|
2063
|
+
"#pragma GCC diagnostic ignored \"-Wduplicate-decl-specifier\"\n" +
|
2064
|
+
"#endif\n" +
|
2065
|
+
"\n" +
|
2066
|
+
"struct my_struct {\n" +
|
2067
|
+
"int a;\n" +
|
2068
|
+
"int b;\n" +
|
2069
|
+
"int b;\n" +
|
2070
|
+
"char c;\n" +
|
2071
|
+
"};\n" +
|
2072
|
+
"int my_function(int a);\n" +
|
2073
|
+
"int my_better_function(struct my_struct *s);\n" +
|
2074
|
+
"static inline int staticinlinebar(struct my_struct *s)\n" + # This is a function with a lot of indentation levels, we should be able to handle it
|
2075
|
+
"{\n" +
|
2076
|
+
"\t{\n" +
|
2077
|
+
"\t\t{\n" +
|
2078
|
+
"\t\t\treturn s->a;\n" +
|
2079
|
+
"\t\t}\n" +
|
2080
|
+
"\t}\n" +
|
2081
|
+
"}\n" +
|
2082
|
+
"static inline int staticinlinefunc(struct my_struct *s)\n" +
|
2083
|
+
"{\n" +
|
2084
|
+
" return s->a;\n" +
|
2085
|
+
"}\n" +
|
2086
|
+
"int bar(struct my_struct *s);\n" + # A normal function to screw with our parser
|
2087
|
+
"inline static int inlinestaticfunc(int a) {\n" +
|
2088
|
+
" return a + 42;\n" +
|
2089
|
+
"}\n" +
|
2090
|
+
"inline int StaticInlineFunc(struct my_struct *s)\n" +
|
2091
|
+
"{\n" +
|
2092
|
+
" return get_member_a(s) + 42;\n" +
|
2093
|
+
"}\n" +
|
2094
|
+
"int inline StaticInlineBar(struct my_struct *s)\n" +
|
2095
|
+
"{\n" +
|
2096
|
+
" return get_member_a(s) + 42;\n" +
|
2097
|
+
"}\n" +
|
2098
|
+
"struct staticinlinestruct {\n" + # Add a structure declaration between the inline functions, just to make sure we don't touch it!
|
2099
|
+
"int a;\n" +
|
2100
|
+
"};\n" +
|
2101
|
+
"\n" +
|
2102
|
+
"struct staticinlinestruct fubarstruct(struct my_struct *s);\n" + # Another normal function to screw with our parser
|
2103
|
+
"static inline struct staticinlinestruct inlinefubarfunction(struct my_struct *s)\n" +
|
2104
|
+
"{\n" +
|
2105
|
+
" return (struct staticinlinestruct)*s;\n" +
|
2106
|
+
"}\n" +
|
2107
|
+
"int fubar(struct my_struct *s);\n" + # Another normal function to screw with our parser
|
2108
|
+
"inline int stuff(int num)" +
|
2109
|
+
"{" +
|
2110
|
+
" int reg = 0x12;" +
|
2111
|
+
" if (num > 0)" +
|
2112
|
+
" {" +
|
2113
|
+
" reg |= (0x0Eu);" +
|
2114
|
+
" }" +
|
2115
|
+
" else" +
|
2116
|
+
" {" +
|
2117
|
+
" reg |= (0x07u);" +
|
2118
|
+
" }" +
|
2119
|
+
" return reg;" +
|
2120
|
+
"}" +
|
2121
|
+
"\n" +
|
2122
|
+
"int inline static dummy_func_2(int a, char b, float c) {" + # This is a sneaky one, inline static is placed AFTER the return value
|
2123
|
+
" c += 3.14;" +
|
2124
|
+
" b -= 32;" +
|
2125
|
+
" return a + (int)(b) + (int)c;" +
|
2126
|
+
"}" +
|
2127
|
+
"#endif _NOINCLUDES\n"
|
2128
|
+
|
2129
|
+
expected =
|
2130
|
+
"#ifndef _NOINCLUDES\n" +
|
2131
|
+
"#define _NOINCLUDES\n" +
|
2132
|
+
"#include \"unity.h\"\n" +
|
2133
|
+
"#include \"cmock.h\"\n" +
|
2134
|
+
"#include \"YetAnotherHeader.h\"\n" +
|
2135
|
+
"\n" +
|
2136
|
+
"/* Ignore the following warnings since we are copying code */\n" +
|
2137
|
+
"#if defined(__GNUC__) && !defined(__ICC) && !defined(__TMS470__)\n" +
|
2138
|
+
"#if __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 6 || (__GNUC_MINOR__ == 6 && __GNUC_PATCHLEVEL__ > 0)))\n" +
|
2139
|
+
"#pragma GCC diagnostic push\n" +
|
2140
|
+
"#endif\n" +
|
2141
|
+
"#if !defined(__clang__)\n" +
|
2142
|
+
"#pragma GCC diagnostic ignored \"-Wpragmas\"\n" +
|
2143
|
+
"#endif\n" +
|
2144
|
+
"#pragma GCC diagnostic ignored \"-Wunknown-pragmas\"\n" +
|
2145
|
+
"#pragma GCC diagnostic ignored \"-Wduplicate-decl-specifier\"\n" +
|
2146
|
+
"#endif\n" +
|
2147
|
+
"\n" +
|
2148
|
+
"struct my_struct {\n" +
|
2149
|
+
"int a;\n" +
|
2150
|
+
"int b;\n" +
|
2151
|
+
"int b;\n" +
|
2152
|
+
"char c;\n" +
|
2153
|
+
"};\n" +
|
2154
|
+
"int my_function(int a);\n" +
|
2155
|
+
"int my_better_function(struct my_struct *s);\n" +
|
2156
|
+
"int staticinlinebar(struct my_struct *s);\n" +
|
2157
|
+
"int staticinlinefunc(struct my_struct *s);\n" +
|
2158
|
+
"int bar(struct my_struct *s);\n" +
|
2159
|
+
"int inlinestaticfunc(int a);\n" +
|
2160
|
+
"int StaticInlineFunc(struct my_struct *s);\n" +
|
2161
|
+
"int StaticInlineBar(struct my_struct *s);\n" +
|
2162
|
+
"struct staticinlinestruct {\n" +
|
2163
|
+
"int a;\n" +
|
2164
|
+
"};\n" +
|
2165
|
+
"\n" +
|
2166
|
+
"struct staticinlinestruct fubarstruct(struct my_struct *s);\n" +
|
2167
|
+
"struct staticinlinestruct inlinefubarfunction(struct my_struct *s);\n" +
|
2168
|
+
"int fubar(struct my_struct *s);\n" +
|
2169
|
+
"int stuff(int num);\n" +
|
2170
|
+
"int dummy_func_2(int a, char b, float c);" +
|
2171
|
+
"#endif _NOINCLUDES\n"
|
2172
|
+
|
2173
|
+
assert_equal(expected, @parser.transform_inline_functions(source))
|
2174
|
+
end
|
2175
|
+
|
2176
|
+
it "Count number of pairs of braces in function succesfully" do
|
2177
|
+
source =
|
2178
|
+
"int foo(struct my_struct *s)\n" +
|
2179
|
+
"{\n" +
|
2180
|
+
" return get_member_a(s) + 42;\n" +
|
2181
|
+
"}\n"
|
2182
|
+
complex_source =
|
2183
|
+
"int bar(struct my_struct *s)\n" +
|
2184
|
+
"{\n" +
|
2185
|
+
"\tint a = 6;\n" +
|
2186
|
+
"\tint res = foo(&(struct my_struct){.nr = a});\n" +
|
2187
|
+
"\t{\n" +
|
2188
|
+
"\t\tint a = 5;\n" +
|
2189
|
+
"\t\tint res = foo(&(struct my_struct){.nr = a});\n" +
|
2190
|
+
"\t\t{\n" +
|
2191
|
+
"\t\t\tstruct my_struct a = {.nr = 1};\n" +
|
2192
|
+
"\t\t}\n" +
|
2193
|
+
"\t}\n" +
|
2194
|
+
"\treturn 42;\n" +
|
2195
|
+
"}\n"
|
2196
|
+
|
2197
|
+
assert_equal(1, @parser.count_number_of_pairs_of_braces_in_function(source))
|
2198
|
+
assert_equal(6, @parser.count_number_of_pairs_of_braces_in_function(complex_source))
|
2199
|
+
end
|
2200
|
+
|
2201
|
+
it "Count number of pairs of braces returns 0 if bad source is supplied" do
|
2202
|
+
bad_source_0 =
|
2203
|
+
"int foo(struct my_struct *s)\n" +
|
2204
|
+
"{\n" +
|
2205
|
+
" return get_member_a(s) + 42;\n" +
|
2206
|
+
"\n" # Missing closing brace
|
2207
|
+
bad_source_1 =
|
2208
|
+
"int bar(struct my_struct *s)\n" +
|
2209
|
+
"{\n" +
|
2210
|
+
"\tint a = 6;\n" +
|
2211
|
+
"\tint res = foo(&(struct my_struct){.nr = a});\n" +
|
2212
|
+
"\t{\n" +
|
2213
|
+
"\t\tint a = 5;\n" +
|
2214
|
+
"\t\tint res = foo(&(struct my_struct){.nr = a});\n" +
|
2215
|
+
"\t\t{\n" +
|
2216
|
+
"\t\t\n" + # Missing closing brace
|
2217
|
+
"\t}\n" +
|
2218
|
+
"\treturn 42;\n" +
|
2219
|
+
"}\n"
|
2220
|
+
bad_source_2 =
|
2221
|
+
"int foo(struct my_struct *s)\n" +
|
2222
|
+
"\n" # No braces in source
|
2223
|
+
|
2224
|
+
assert_equal(0, @parser.count_number_of_pairs_of_braces_in_function(bad_source_0))
|
2225
|
+
assert_equal(0, @parser.count_number_of_pairs_of_braces_in_function(bad_source_1))
|
2226
|
+
assert_equal(0, @parser.count_number_of_pairs_of_braces_in_function(bad_source_2))
|
2227
|
+
end
|
2228
|
+
|
2229
|
+
it "handles parsing multiline functions" do
|
2230
|
+
source = "int\nLaverneAndShirley(int Lenny,\n int Squiggy);\n"
|
2231
|
+
expected = [{ :var_arg=>nil,
|
2232
|
+
:return=> { :type => "int",
|
2233
|
+
:name => 'cmock_to_return',
|
2234
|
+
:ptr? => false,
|
2235
|
+
:const? => false,
|
2236
|
+
:const_ptr? => false,
|
2237
|
+
:str => "int cmock_to_return",
|
2238
|
+
:void? => false
|
2239
|
+
},
|
2240
|
+
:name=>"LaverneAndShirley",
|
2241
|
+
:unscoped_name=>"LaverneAndShirley",
|
2242
|
+
:namespace=>[],
|
2243
|
+
:class=>nil,
|
2244
|
+
:modifier=>"",
|
2245
|
+
:contains_ptr? => false,
|
2246
|
+
:args=>[ {:type=>"int", :name=>"Lenny", :ptr? => false, :const? => false, :const_ptr? => false},
|
2247
|
+
{:type=>"int", :name=>"Squiggy", :ptr? => false, :const? => false, :const_ptr? => false}
|
2248
|
+
],
|
2249
|
+
:args_string=>"int Lenny, int Squiggy",
|
2250
|
+
:args_call=>"Lenny, Squiggy"
|
2251
|
+
}]
|
2252
|
+
assert_equal(expected, @parser.parse("module", source)[:functions])
|
2253
|
+
end
|
2254
|
+
|
2255
|
+
it "imports C++ differently when asked" do
|
2256
|
+
source =
|
2257
|
+
[
|
2258
|
+
"namespace ns1 {\n",
|
2259
|
+
" namespace ns2 {\n",
|
2260
|
+
"\n",
|
2261
|
+
" class cls1 {\n",
|
2262
|
+
" public:\n",
|
2263
|
+
" int f_header_impl(int a, int b){\n",
|
2264
|
+
" return a + b;\n",
|
2265
|
+
" }\n",
|
2266
|
+
"\n",
|
2267
|
+
" static void f_void();\n",
|
2268
|
+
" static int f_ret_simple();\n",
|
2269
|
+
"\n",
|
2270
|
+
" protected:\n",
|
2271
|
+
" static void protected_f_void();\n",
|
2272
|
+
"\n",
|
2273
|
+
" public:\n",
|
2274
|
+
" private:\n",
|
2275
|
+
" static void private_f_void();\n",
|
2276
|
+
" }; // cls1\n",
|
2277
|
+
" } // ns2\n",
|
2278
|
+
"} // ns1\n"
|
2279
|
+
].join
|
2280
|
+
|
2281
|
+
expected =
|
2282
|
+
[
|
2283
|
+
"namespace ns1 { namespace ns2 { class cls1 { public: int f_header_impl",
|
2284
|
+
"static void f_void()",
|
2285
|
+
"static int f_ret_simple()",
|
2286
|
+
"protected: static void protected_f_void()",
|
2287
|
+
"public: private: static void private_f_void()",
|
2288
|
+
"}",
|
2289
|
+
"} }"
|
2290
|
+
]
|
2291
|
+
|
2292
|
+
assert_equal(expected, @parser.import_source(source, cpp=true))
|
2293
|
+
refute_equal(expected, @parser.import_source(source))
|
2294
|
+
end
|
2295
|
+
|
2296
|
+
# only so parse_functions does not raise an error
|
2297
|
+
def dummy_source
|
2298
|
+
"void dummy(void);"
|
2299
|
+
end
|
2300
|
+
|
2301
|
+
# Expected result of above
|
2302
|
+
def dummy_func
|
2303
|
+
{ :name => "dummy",
|
2304
|
+
:unscoped_name => "dummy",
|
2305
|
+
:class => nil,
|
2306
|
+
:namespace => [],
|
2307
|
+
:var_arg => nil,
|
2308
|
+
:args_string => "void",
|
2309
|
+
:args => [],
|
2310
|
+
:args_call => "",
|
2311
|
+
:contains_ptr? => false,
|
2312
|
+
:modifier => "",
|
2313
|
+
:return => {
|
2314
|
+
:type => "void",
|
2315
|
+
:name => "cmock_to_return",
|
2316
|
+
:str => "void cmock_to_return",
|
2317
|
+
:void? => true,
|
2318
|
+
:ptr? => false,
|
2319
|
+
:const? => false,
|
2320
|
+
:const_ptr? => false}}
|
2321
|
+
end
|
2322
|
+
|
2323
|
+
# Commonly used example function
|
2324
|
+
def voidvoid_func(namespace=[], name="Classic_functional")
|
2325
|
+
{ :name => name,
|
2326
|
+
:unscoped_name => "functional",
|
2327
|
+
:class => "Classic",
|
2328
|
+
:namespace => namespace,
|
2329
|
+
:var_arg => nil,
|
2330
|
+
:args_string => "void",
|
2331
|
+
:args => [],
|
2332
|
+
:args_call => "",
|
2333
|
+
:contains_ptr? => false,
|
2334
|
+
:modifier => "",
|
2335
|
+
:return => {
|
2336
|
+
:type=>"void",
|
2337
|
+
:name=>"cmock_to_return",
|
2338
|
+
:str=>"void cmock_to_return",
|
2339
|
+
:void? => true,
|
2340
|
+
:ptr? => false,
|
2341
|
+
:const? => false,
|
2342
|
+
:const_ptr? => false}}
|
2343
|
+
end
|
2344
|
+
|
2345
|
+
it "parses public C++ functions" do
|
2346
|
+
source = dummy_source + <<~SOURCE
|
2347
|
+
class Classic {
|
2348
|
+
public:
|
2349
|
+
static void functional(void);
|
2350
|
+
};
|
2351
|
+
SOURCE
|
2352
|
+
|
2353
|
+
expected = [dummy_func, voidvoid_func]
|
2354
|
+
|
2355
|
+
assert_equal(expected, @parser.parse("module", source)[:functions])
|
2356
|
+
end
|
2357
|
+
|
2358
|
+
it "handles a namespace" do
|
2359
|
+
source = dummy_source + <<~SOURCE
|
2360
|
+
namespace ns1 {
|
2361
|
+
class Classic {
|
2362
|
+
public:
|
2363
|
+
static void functional(void);
|
2364
|
+
};
|
2365
|
+
} // ns1
|
2366
|
+
SOURCE
|
2367
|
+
|
2368
|
+
expected = [dummy_func,
|
2369
|
+
voidvoid_func(namespace=["ns1"], name="ns1_Classic_functional")]
|
2370
|
+
|
2371
|
+
assert_equal(expected, @parser.parse("module", source)[:functions])
|
2372
|
+
end
|
2373
|
+
|
2374
|
+
it "handles nested namespaces" do
|
2375
|
+
source = dummy_source + <<~SOURCE
|
2376
|
+
namespace ns1 {
|
2377
|
+
namespace ns2 {
|
2378
|
+
class Classic {
|
2379
|
+
public:
|
2380
|
+
static void functional(void);
|
2381
|
+
};
|
2382
|
+
} // ns1
|
2383
|
+
} // ns1
|
2384
|
+
SOURCE
|
2385
|
+
|
2386
|
+
expected = [dummy_func,
|
2387
|
+
voidvoid_func(namespace=["ns1", "ns2"], name="ns1_ns2_Classic_functional")]
|
2388
|
+
|
2389
|
+
assert_equal(expected, @parser.parse("module", source)[:functions])
|
2390
|
+
end
|
2391
|
+
|
2392
|
+
it "ignores non-static C++ functions" do
|
2393
|
+
source = dummy_source + <<~SOURCE
|
2394
|
+
class Classic {
|
2395
|
+
public:
|
2396
|
+
void functional(void);
|
2397
|
+
};
|
2398
|
+
SOURCE
|
2399
|
+
|
2400
|
+
expected = [dummy_func]
|
2401
|
+
|
2402
|
+
assert_equal(expected, @parser.parse("module", source)[:functions])
|
2403
|
+
end
|
2404
|
+
|
2405
|
+
it "ignores private functions" do
|
2406
|
+
source = dummy_source + <<~SOURCE
|
2407
|
+
class Classic {
|
2408
|
+
private:
|
2409
|
+
static void functional(void);
|
2410
|
+
};
|
2411
|
+
SOURCE
|
2412
|
+
|
2413
|
+
expected = [dummy_func]
|
2414
|
+
|
2415
|
+
assert_equal(expected, @parser.parse("module", source)[:functions])
|
2416
|
+
end
|
2417
|
+
|
2418
|
+
it "parses public C++ functions after private functions" do
|
2419
|
+
source = dummy_source + <<~SOURCE
|
2420
|
+
class Classic {
|
2421
|
+
private:
|
2422
|
+
static void ignoreme(void);
|
2423
|
+
public:
|
2424
|
+
static void functional(void);
|
2425
|
+
};
|
2426
|
+
SOURCE
|
2427
|
+
|
2428
|
+
expected = [dummy_func, voidvoid_func]
|
2429
|
+
|
2430
|
+
assert_equal(expected, @parser.parse("module", source)[:functions])
|
2431
|
+
end
|
2432
|
+
|
2433
|
+
it "ignores protected functions" do
|
2434
|
+
source = dummy_source + <<~SOURCE
|
2435
|
+
class Classic {
|
2436
|
+
protected:
|
2437
|
+
static void functional(void);
|
2438
|
+
};
|
2439
|
+
SOURCE
|
2440
|
+
|
2441
|
+
expected = [dummy_func]
|
2442
|
+
|
2443
|
+
assert_equal(expected, @parser.parse("module", source)[:functions])
|
2444
|
+
end
|
2445
|
+
|
2446
|
+
it "parses public C++ functions after protected functions" do
|
2447
|
+
source = dummy_source + <<~SOURCE
|
2448
|
+
class Classic {
|
2449
|
+
protected:
|
2450
|
+
static void ignoreme(void);
|
2451
|
+
public:
|
2452
|
+
static void functional(void);
|
2453
|
+
};
|
2454
|
+
SOURCE
|
2455
|
+
|
2456
|
+
expected = [dummy_func, voidvoid_func]
|
2457
|
+
|
2458
|
+
assert_equal(expected, @parser.parse("module", source)[:functions])
|
2459
|
+
end
|
2460
|
+
|
2461
|
+
it "parses multiple classes in same file with uniquely named functions" do
|
2462
|
+
source = dummy_source + <<~SOURCE
|
2463
|
+
namespace ns1 {
|
2464
|
+
class Classic {
|
2465
|
+
public:
|
2466
|
+
static void functional(void);
|
2467
|
+
};
|
2468
|
+
|
2469
|
+
class Classical {
|
2470
|
+
public:
|
2471
|
+
static int functionality(int a);
|
2472
|
+
};
|
2473
|
+
} // ns1
|
2474
|
+
|
2475
|
+
class Classy {
|
2476
|
+
public:
|
2477
|
+
static int* func(int* a);
|
2478
|
+
};
|
2479
|
+
SOURCE
|
2480
|
+
|
2481
|
+
expected = [dummy_func,
|
2482
|
+
voidvoid_func(["ns1"], name="ns1_Classic_functional"),
|
2483
|
+
{ :name => "ns1_Classical_functionality",
|
2484
|
+
:unscoped_name => "functionality",
|
2485
|
+
:class => "Classical",
|
2486
|
+
:namespace => ["ns1"],
|
2487
|
+
:var_arg => nil,
|
2488
|
+
:args_string => "int a",
|
2489
|
+
:args => [
|
2490
|
+
{ :ptr? => false,
|
2491
|
+
:const? => false,
|
2492
|
+
:const_ptr? => false,
|
2493
|
+
:name => "a",
|
2494
|
+
:type => "int"}],
|
2495
|
+
:args_call => "a",
|
2496
|
+
:contains_ptr? => false,
|
2497
|
+
:modifier => "",
|
2498
|
+
:return => {
|
2499
|
+
:type=>"int",
|
2500
|
+
:name=>"cmock_to_return",
|
2501
|
+
:str=>"int cmock_to_return",
|
2502
|
+
:void? => false,
|
2503
|
+
:ptr? => false,
|
2504
|
+
:const? => false,
|
2505
|
+
:const_ptr? => false}},
|
2506
|
+
{ :name => "Classy_func",
|
2507
|
+
:unscoped_name => "func",
|
2508
|
+
:class => "Classy",
|
2509
|
+
:namespace => [],
|
2510
|
+
:var_arg => nil,
|
2511
|
+
:args_string => "int* a",
|
2512
|
+
:args => [
|
2513
|
+
{ :ptr? => true,
|
2514
|
+
:const? => false,
|
2515
|
+
:const_ptr? => false,
|
2516
|
+
:name => "a",
|
2517
|
+
:type => "int*"}],
|
2518
|
+
:args_call => "a",
|
2519
|
+
:contains_ptr? => true,
|
2520
|
+
:modifier => "",
|
2521
|
+
:return => {
|
2522
|
+
:type=>"int*",
|
2523
|
+
:name=>"cmock_to_return",
|
2524
|
+
:str=>"int* cmock_to_return",
|
2525
|
+
:void? => false,
|
2526
|
+
:ptr? => true,
|
2527
|
+
:const? => false,
|
2528
|
+
:const_ptr? => false}}]
|
2529
|
+
|
2530
|
+
assert_equal(expected, @parser.parse("module", source)[:functions])
|
2531
|
+
end
|
2532
|
+
|
2533
|
+
it "handles multiple classes in same file with identically named functions" do
|
2534
|
+
source = dummy_source + <<~SOURCE
|
2535
|
+
namespace ns1 {
|
2536
|
+
class Classic {
|
2537
|
+
public:
|
2538
|
+
static void functional(void);
|
2539
|
+
};
|
2540
|
+
|
2541
|
+
class Classical {
|
2542
|
+
public:
|
2543
|
+
static int functional(int a);
|
2544
|
+
};
|
2545
|
+
} // ns1
|
2546
|
+
|
2547
|
+
class Classy {
|
2548
|
+
public:
|
2549
|
+
static int* functional(int* a);
|
2550
|
+
};
|
2551
|
+
SOURCE
|
2552
|
+
|
2553
|
+
expected = [dummy_func,
|
2554
|
+
voidvoid_func(["ns1"], name="ns1_Classic_functional"),
|
2555
|
+
{ :name => "ns1_Classical_functional",
|
2556
|
+
:unscoped_name => "functional",
|
2557
|
+
:class => "Classical",
|
2558
|
+
:namespace => ["ns1"],
|
2559
|
+
:var_arg => nil,
|
2560
|
+
:args_string => "int a",
|
2561
|
+
:args => [
|
2562
|
+
{ :ptr? => false,
|
2563
|
+
:const? => false,
|
2564
|
+
:const_ptr? => false,
|
2565
|
+
:name => "a",
|
2566
|
+
:type => "int"}],
|
2567
|
+
:args_call => "a",
|
2568
|
+
:contains_ptr? => false,
|
2569
|
+
:modifier => "",
|
2570
|
+
:return => {
|
2571
|
+
:type=>"int",
|
2572
|
+
:name=>"cmock_to_return",
|
2573
|
+
:str=>"int cmock_to_return",
|
2574
|
+
:void? => false,
|
2575
|
+
:ptr? => false,
|
2576
|
+
:const? => false,
|
2577
|
+
:const_ptr? => false}},
|
2578
|
+
{ :name => "Classy_functional",
|
2579
|
+
:unscoped_name => "functional",
|
2580
|
+
:class => "Classy",
|
2581
|
+
:namespace => [],
|
2582
|
+
:var_arg => nil,
|
2583
|
+
:args_string => "int* a",
|
2584
|
+
:args => [
|
2585
|
+
{ :ptr? => true,
|
2586
|
+
:const? => false,
|
2587
|
+
:const_ptr? => false,
|
2588
|
+
:name => "a",
|
2589
|
+
:type => "int*"}],
|
2590
|
+
:args_call => "a",
|
2591
|
+
:contains_ptr? => true,
|
2592
|
+
:modifier => "",
|
2593
|
+
:return => {
|
2594
|
+
:type=>"int*",
|
2595
|
+
:name=>"cmock_to_return",
|
2596
|
+
:str=>"int* cmock_to_return",
|
2597
|
+
:void? => false,
|
2598
|
+
:ptr? => true,
|
2599
|
+
:const? => false,
|
2600
|
+
:const_ptr? => false}}]
|
2601
|
+
|
2602
|
+
assert_equal(expected, @parser.parse("module", source)[:functions])
|
2603
|
+
end
|
2604
|
+
|
2605
|
+
it "Transform inline functions can handle inline function declarations" do
|
2606
|
+
source =
|
2607
|
+
"static inline int dummy_func_decl(int a, char b, float c);\n" + # First declaration
|
2608
|
+
"static inline int dummy_func_decl2(int a, char b, float c)\n\n\n\n\n\n;\n" + # Second declaration with a lot of newlines before the semicolon to mess with the parser
|
2609
|
+
"static inline int staticinlinefunc(struct my_struct *s)\n" + # 'normal' inline pattern
|
2610
|
+
"{\n" +
|
2611
|
+
" return dummy_func_decl(1, 1, 1);\n" +
|
2612
|
+
"}\n" +
|
2613
|
+
"struct my_struct_with_inline_in_it\n" + # struct definition in between to mess with the parser
|
2614
|
+
"{\n" +
|
2615
|
+
" int a;\n" +
|
2616
|
+
" char b;\n" +
|
2617
|
+
" float inlineb;\n" +
|
2618
|
+
"};\n" +
|
2619
|
+
"static inline int dummy_func_decl(int a, char b, float c) {\n" + # Second user pattern
|
2620
|
+
" return 42;\n" +
|
2621
|
+
"}\n" +
|
2622
|
+
"\n"
|
2623
|
+
|
2624
|
+
expected =
|
2625
|
+
"int dummy_func_decl(int a, char b, float c);\n" +
|
2626
|
+
"int dummy_func_decl2(int a, char b, float c)\n\n\n\n\n\n;\n" + # Second declaration with a lot of newlines until the semicolon to mess with the parser
|
2627
|
+
"int staticinlinefunc(struct my_struct *s);\n" +
|
2628
|
+
"struct my_struct_with_inline_in_it\n" +
|
2629
|
+
"{\n" +
|
2630
|
+
" int a;\n" +
|
2631
|
+
" char b;\n" +
|
2632
|
+
" float inlineb;\n" +
|
2633
|
+
"};\n" +
|
2634
|
+
"int dummy_func_decl(int a, char b, float c);\n" +
|
2635
|
+
"\n"
|
2636
|
+
|
2637
|
+
@parser.treat_inlines = :include
|
2638
|
+
assert_equal(expected, @parser.transform_inline_functions(source))
|
2639
|
+
end
|
2640
|
+
|
2641
|
+
it "Transform inline functions can handle header with only inline function declarations" do
|
2642
|
+
source =
|
2643
|
+
"static inline int dummy_func_decl(int a, char b, float c);\n" +
|
2644
|
+
"\n"
|
2645
|
+
|
2646
|
+
expected =
|
2647
|
+
"int dummy_func_decl(int a, char b, float c);\n" +
|
2648
|
+
"\n"
|
2649
|
+
|
2650
|
+
@parser.treat_inlines = :include
|
2651
|
+
assert_equal(expected, @parser.transform_inline_functions(source))
|
2652
|
+
end
|
2653
|
+
|
2654
|
+
it "Transform inline functions takes user provided patterns into account" do
|
2655
|
+
source =
|
2656
|
+
"static __inline__ __attribute__ ((always_inline)) uint16_t _somefunc (uint32_t a)\n" +
|
2657
|
+
"{\n" +
|
2658
|
+
" return _someotherfunc (a);\n" +
|
2659
|
+
"}\n" +
|
2660
|
+
"static __inline__ uint16_t _somefunc_0 (uint32_t a)\n" +
|
2661
|
+
"{\n" +
|
2662
|
+
" return (uint16_t) a;\n" +
|
2663
|
+
"}\n" +
|
2664
|
+
"\n"
|
2665
|
+
|
2666
|
+
expected =
|
2667
|
+
"uint16_t _somefunc (uint32_t a);\n" +
|
2668
|
+
"uint16_t _somefunc_0 (uint32_t a);\n" +
|
2669
|
+
"\n"
|
2670
|
+
|
2671
|
+
@parser.treat_inlines = :include
|
2672
|
+
@parser.inline_function_patterns = ['static __inline__ __attribute__ \(\(always_inline\)\)', 'static __inline__']
|
2673
|
+
assert_equal(expected, @parser.transform_inline_functions(source))
|
2674
|
+
end
|
2675
|
+
|
2676
|
+
it "Transform inline functions limits deleting user macro to actual line/word" do
|
2677
|
+
source =
|
2678
|
+
"#if defined (FORCE_INLINE)\n" +
|
2679
|
+
"#define MY_LIBRARY_INLINE static __inline__ __attribute__ ((always_inline))\n" +
|
2680
|
+
"#else\n" +
|
2681
|
+
"#define MY_LIBRARY_INLINE\n" +
|
2682
|
+
"#endif\n" +
|
2683
|
+
"#define INLINE static __inline__ __attribute__ ((always_inline))\n" +
|
2684
|
+
"#define INLINE_TWO \\\nstatic\\\ninline\n" +
|
2685
|
+
"INLINE uint16_t _somefunc (uint32_t a)\n" +
|
2686
|
+
"{\n" +
|
2687
|
+
" return _someotherfunc (a);\n" +
|
2688
|
+
"}\n" +
|
2689
|
+
"static __inline__ uint16_t _somefunc_0 (uint32_t a)\n" +
|
2690
|
+
"{\n" +
|
2691
|
+
" return (uint16_t) a;\n" +
|
2692
|
+
"}\n" +
|
2693
|
+
"static __inline__ __attribute__ \(\(always_inline\)\) uint16_t _somefunc_1 (uint32_t a)\n" +
|
2694
|
+
"{\n" +
|
2695
|
+
" return (uint16_t) a;\n" +
|
2696
|
+
"}\n" +
|
2697
|
+
"INLINE_TWO uint16_t _somefunc_2(uint32_t a)\n" +
|
2698
|
+
"{\n" +
|
2699
|
+
" return (uint16_t) a;\n" +
|
2700
|
+
"}\n" +
|
2701
|
+
"#define INLINE_THREE \\\nstatic\\\ninline"
|
2702
|
+
|
2703
|
+
expected =
|
2704
|
+
"#if defined (FORCE_INLINE)\n" +
|
2705
|
+
"#else\n" +
|
2706
|
+
"#endif\n" +
|
2707
|
+
"uint16_t _somefunc (uint32_t a);\n" +
|
2708
|
+
"uint16_t _somefunc_0 (uint32_t a);\n" +
|
2709
|
+
"uint16_t _somefunc_1 (uint32_t a);\n" +
|
2710
|
+
"uint16_t _somefunc_2(uint32_t a);\n"
|
2711
|
+
|
2712
|
+
@parser.treat_inlines = :include
|
2713
|
+
@parser.inline_function_patterns = ['MY_LIBRARY_INLINE', 'INLINE_THREE', 'INLINE_TWO', 'INLINE', 'static __inline__ __attribute__ \(\(always_inline\)\)', 'static __inline__']
|
2714
|
+
assert_equal(expected, @parser.transform_inline_functions(source))
|
2715
|
+
end
|
2716
|
+
|
2717
|
+
end
|