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