ceedling 0.12.2 → 0.13.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -14
- data/.gitmodules +9 -0
- data/.rspec +1 -0
- data/Gemfile +10 -2
- data/README.md +97 -67
- data/{new_project_template → assets}/project.yml +0 -0
- data/{new_project_template → assets}/rakefile.rb +0 -0
- data/bin/ceedling +77 -44
- data/ceedling.gemspec +18 -5
- data/config/test_environment.rb +12 -0
- data/docs/CeedlingLogo.png +0 -0
- data/docs/CeedlingPacket.md +1934 -0
- data/docs/CeedlingPacket.odt +0 -0
- data/docs/CeedlingPacket.pdf +0 -0
- data/examples/temp_sensor/project.yml +71 -74
- data/examples/temp_sensor/rakefile.rb +3 -5
- data/examples/temp_sensor/src/AdcConductor.h +2 -0
- data/examples/temp_sensor/src/TemperatureCalculator.h +2 -0
- data/examples/temp_sensor/src/Types.h +0 -13
- data/examples/temp_sensor/src/UsartBaudRateRegisterCalculator.h +2 -0
- data/examples/temp_sensor/src/UsartHardware.c +0 -12
- data/examples/temp_sensor/src/UsartHardware.h +0 -1
- data/examples/temp_sensor/test/{test_AdcConductor.c → TestAdcConductor.c} +0 -0
- data/examples/temp_sensor/test/{test_AdcHardware.c → TestAdcHardware.c} +0 -0
- data/examples/temp_sensor/test/{test_AdcModel.c → TestAdcModel.c} +0 -0
- data/examples/temp_sensor/test/{test_Executor.c → TestExecutor.c} +0 -0
- data/examples/temp_sensor/test/{test_Main.c → TestMain.c} +0 -0
- data/examples/temp_sensor/test/{test_Model.c → TestModel.c} +0 -0
- data/examples/temp_sensor/test/{test_TaskScheduler.c → TestTaskScheduler.c} +0 -0
- data/examples/temp_sensor/test/{test_TemperatureCalculator.c → TestTemperatureCalculator.c} +0 -0
- data/examples/temp_sensor/test/{test_TemperatureFilter.c → TestTemperatureFilter.c} +0 -2
- data/examples/temp_sensor/test/{test_TimerConductor.c → TestTimerConductor.c} +0 -0
- data/examples/temp_sensor/test/{test_TimerHardware.c → TestTimerHardware.c} +0 -0
- data/examples/temp_sensor/test/{test_TimerModel.c → TestTimerModel.c} +0 -0
- data/examples/temp_sensor/test/{test_UsartBaudRateRegisterCalculator.c → TestUsartBaudRateRegisterCalculator.c} +0 -0
- data/examples/temp_sensor/test/{test_UsartConductor.c → TestUsartConductor.c} +0 -0
- data/examples/temp_sensor/test/{test_UsartHardware.c → TestUsartHardware.c} +0 -20
- data/examples/temp_sensor/test/{test_UsartModel.c → TestUsartModel.c} +0 -0
- data/examples/temp_sensor/test/support/UnityHelper.c +7 -5
- data/examples/temp_sensor/test/support/UnityHelper.h +5 -5
- data/{new_project_template/vendor/ceedling/lib → lib}/build_invoker_utils.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/cacheinator.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/cacheinator_helper.rb +0 -0
- data/lib/ceedling.rb +16 -4
- data/lib/ceedling/version.rb +4 -4
- data/lib/ceedling/version.rb.erb +1 -1
- data/{new_project_template/vendor/ceedling/lib → lib}/cmock_builder.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/configurator.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/configurator_builder.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/configurator_plugins.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/configurator_setup.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/configurator_validator.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/constants.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/defaults.rb +2 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/dependinator.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/erb_wrapper.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/file_finder.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/file_finder_helper.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/file_path_utils.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/file_system_utils.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/file_system_wrapper.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/file_wrapper.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/flaginator.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/generator.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/generator_helper.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/generator_test_results.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/generator_test_results_sanity_checker.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/generator_test_runner.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/loginator.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/makefile.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/objects.yml +0 -2
- data/lib/par_map.rb +19 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/plugin.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/plugin_builder.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/plugin_manager.rb +20 -8
- data/{new_project_template/vendor/ceedling/lib → lib}/plugin_manager_helper.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/plugin_reportinator.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/plugin_reportinator_helper.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/preprocessinator.rb +0 -0
- data/lib/preprocessinator_extractor.rb +30 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/preprocessinator_file_handler.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/preprocessinator_helper.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/preprocessinator_includes_handler.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/project_config_manager.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/project_file_loader.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/rake_utils.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/rake_wrapper.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/rakefile.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/release_invoker.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/release_invoker_helper.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/reportinator.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/rules_cmock.rake +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/rules_preprocess.rake +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/rules_release.rake +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/rules_release_deep_dependencies.rake +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/rules_tests.rake +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/rules_tests_deep_dependencies.rake +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/setupinator.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/stream_wrapper.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/streaminator.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/streaminator_helper.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/system_utils.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/system_wrapper.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/task_invoker.rb +7 -3
- data/{new_project_template/vendor/ceedling/lib → lib}/tasks_base.rake +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/tasks_filesystem.rake +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/tasks_release.rake +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/tasks_release_deep_dependencies.rake +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/tasks_tests.rake +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/tasks_tests_deep_dependencies.rake +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/tasks_vendor.rake +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/test_includes_extractor.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/test_invoker.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/test_invoker_helper.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/tool_executor.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/tool_executor_helper.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/verbosinator.rb +0 -0
- data/{new_project_template/vendor/ceedling/lib → lib}/yaml_wrapper.rb +0 -0
- data/{new_project_template/vendor/ceedling/plugins → plugins}/bullseye/bullseye.rake +0 -0
- data/{new_project_template/vendor/ceedling/plugins → plugins}/bullseye/bullseye.rb +0 -0
- data/{new_project_template/vendor/ceedling/plugins → plugins}/bullseye/defaults.yml +0 -0
- data/{new_project_template/vendor/ceedling/plugins → plugins}/bullseye/readme.txt +0 -0
- data/{new_project_template/vendor/ceedling/plugins → plugins}/bullseye/template.erb +0 -0
- data/{new_project_template/vendor/ceedling/plugins → plugins}/gcov/defaults.yml +0 -0
- data/{new_project_template/vendor/ceedling/plugins → plugins}/gcov/gcov.rake +0 -0
- data/{new_project_template/vendor/ceedling/plugins → plugins}/gcov/gcov.rb +0 -0
- data/{new_project_template/vendor/ceedling/plugins → plugins}/gcov/readme.txt +0 -0
- data/{new_project_template/vendor/ceedling/plugins → plugins}/gcov/template.erb +0 -0
- data/{new_project_template/vendor/ceedling/plugins → plugins}/module_generator/config/module_generator.yml +0 -0
- data/{new_project_template/vendor/ceedling/plugins → plugins}/module_generator/lib/module_generator.rb +0 -0
- data/{new_project_template/vendor/ceedling/plugins → plugins}/module_generator/module_generator.rake +0 -0
- data/{new_project_template/vendor/ceedling/plugins → plugins}/stdout_ide_tests_report/config/stdout_ide_tests_report.yml +0 -0
- data/{new_project_template/vendor/ceedling/plugins → plugins}/stdout_ide_tests_report/lib/stdout_ide_tests_report.rb +0 -0
- data/{new_project_template/vendor/ceedling/plugins → plugins}/stdout_pretty_tests_report/assets/template.erb +0 -0
- data/{new_project_template/vendor/ceedling/plugins → plugins}/stdout_pretty_tests_report/config/stdout_pretty_tests_report.yml +0 -0
- data/{new_project_template/vendor/ceedling/plugins → plugins}/stdout_pretty_tests_report/lib/stdout_pretty_tests_report.rb +0 -0
- data/{new_project_template/vendor/ceedling/plugins → plugins}/warnings_report/warnings_report.rb +0 -0
- data/{new_project_template/vendor/ceedling/plugins → plugins}/xml_tests_report/xml_tests_report.rb +0 -0
- data/rakefile.rb +14 -0
- data/release/build.info +2 -0
- data/{new_project_template/vendor/ceedling/release → release}/version.info +0 -0
- data/spec/configurator_builder_spec.rb +7 -0
- data/spec/configurator_helper_spec.rb +5 -0
- data/spec/configurator_spec.rb +10 -0
- data/spec/par_map_spec.rb +57 -0
- data/spec/preprocessinator_extractor_spec.rb +46 -0
- data/spec/spec_helper.rb +46 -0
- data/spec/uncatagorized_specs_spec.rb +8 -0
- data/test_graveyard/integration/paths.yml +17 -0
- data/test_graveyard/integration/paths_test.rb +80 -0
- data/test_graveyard/integration/rake_rules_aux_dependencies_test.rb +75 -0
- data/test_graveyard/integration/rake_rules_cmock_test.rb +74 -0
- data/test_graveyard/integration/rake_rules_preprocess_test.rb +178 -0
- data/test_graveyard/integration/rake_rules_test.rb +268 -0
- data/test_graveyard/integration/rake_tasks_test.rb +103 -0
- data/test_graveyard/integration_test_helper.rb +34 -0
- data/test_graveyard/rakefile_rules.rb +10 -0
- data/test_graveyard/rakefile_rules_aux_dependencies.rb +10 -0
- data/test_graveyard/rakefile_rules_cmock.rb +10 -0
- data/test_graveyard/rakefile_rules_preprocess.rb +10 -0
- data/test_graveyard/rakefile_tasks.rb +10 -0
- data/test_graveyard/system/file_system_dependencies.yml +20 -0
- data/test_graveyard/system/file_system_kitchen_sink.yml +20 -0
- data/test_graveyard/system/file_system_mocks.yml +20 -0
- data/test_graveyard/system/file_system_preprocess.yml +20 -0
- data/test_graveyard/system/file_system_simple.yml +20 -0
- data/test_graveyard/system/file_system_test.rb +78 -0
- data/test_graveyard/system/mocks/include/a_file.h +2 -0
- data/test_graveyard/system/mocks/include/other_stuff.h +2 -0
- data/test_graveyard/system/mocks/include/stuff.h +3 -0
- data/test_graveyard/system/mocks/source/a_file.c +9 -0
- data/test_graveyard/system/mocks/test/test_a_file.c +41 -0
- data/test_graveyard/system/mocks/test/test_no_file.c +14 -0
- data/test_graveyard/system/project_mocks.yml +43 -0
- data/test_graveyard/system/project_mocks_test.rb +38 -0
- data/test_graveyard/system/project_simple.yml +36 -0
- data/test_graveyard/system/project_simple_test.rb +39 -0
- data/test_graveyard/system/rule_mocks_test.rb +44 -0
- data/test_graveyard/system/rule_runners_test.rb +44 -0
- data/test_graveyard/system/simple/include/other_stuff.h +2 -0
- data/test_graveyard/system/simple/include/stuff.h +3 -0
- data/test_graveyard/system/simple/source/other_stuff.c +6 -0
- data/test_graveyard/system/simple/source/stuff.c +7 -0
- data/test_graveyard/system/simple/test/test_other_stuff.c +30 -0
- data/test_graveyard/system/simple/test/test_stuff.c +51 -0
- data/test_graveyard/system_test_helper.rb +73 -0
- data/test_graveyard/test_helper.rb +93 -0
- data/test_graveyard/unit/busted/configurator_builder_test.rb +571 -0
- data/test_graveyard/unit/busted/configurator_helper_test.rb +234 -0
- data/test_graveyard/unit/busted/configurator_test.rb +232 -0
- data/test_graveyard/unit/busted/configurator_validator_test.rb +169 -0
- data/test_graveyard/unit/busted/deep_merge_fix_test.rb +55 -0
- data/test_graveyard/unit/busted/dependinator_test.rb +129 -0
- data/test_graveyard/unit/busted/file_finder_helper_test.rb +45 -0
- data/test_graveyard/unit/busted/file_finder_test.rb +114 -0
- data/test_graveyard/unit/busted/file_path_utils_test.rb +97 -0
- data/test_graveyard/unit/busted/file_system_utils_test.rb +21 -0
- data/test_graveyard/unit/busted/generator_test.rb +187 -0
- data/test_graveyard/unit/busted/generator_test_results_test.rb +129 -0
- data/test_graveyard/unit/busted/generator_test_runner_test.rb +478 -0
- data/test_graveyard/unit/busted/preprocessinator_file_handler_test.rb +38 -0
- data/test_graveyard/unit/busted/preprocessinator_helper_test.rb +156 -0
- data/test_graveyard/unit/busted/preprocessinator_includes_handler_test.rb +93 -0
- data/test_graveyard/unit/busted/preprocessinator_test.rb +57 -0
- data/test_graveyard/unit/busted/project_file_loader_test.rb +142 -0
- data/test_graveyard/unit/busted/setupinator_test.rb +45 -0
- data/test_graveyard/unit/busted/streaminator_test.rb +49 -0
- data/test_graveyard/unit/busted/task_invoker_test.rb +69 -0
- data/test_graveyard/unit/busted/test_includes_extractor_test.rb +111 -0
- data/test_graveyard/unit/busted/test_invoker_helper_test.rb +62 -0
- data/test_graveyard/unit/busted/test_invoker_test.rb +47 -0
- data/test_graveyard/unit/busted/tool_executor_helper_test.rb +100 -0
- data/test_graveyard/unit/busted/tool_executor_test.rb +351 -0
- data/test_graveyard/unit/busted/verbosinator_test.rb +65 -0
- data/test_graveyard/unit/preprocessinator_extractor_test.rb +731 -0
- data/test_graveyard/unit_test_helper.rb +16 -0
- data/vendor/behaviors/Manifest.txt +9 -0
- data/vendor/behaviors/Rakefile +19 -0
- data/vendor/behaviors/lib/behaviors.rb +76 -0
- data/vendor/behaviors/lib/behaviors/reporttask.rb +158 -0
- data/vendor/behaviors/test/behaviors_tasks_test.rb +73 -0
- data/vendor/behaviors/test/behaviors_test.rb +50 -0
- data/vendor/behaviors/test/tasks_test/Rakefile +19 -0
- data/vendor/behaviors/test/tasks_test/lib/user.rb +2 -0
- data/vendor/behaviors/test/tasks_test/test/user_test.rb +17 -0
- data/{new_project_template/vendor/ceedling/vendor → vendor}/c_exception/lib/CException.c +0 -0
- data/{new_project_template/vendor/ceedling/vendor → vendor}/c_exception/lib/CException.h +1 -1
- data/vendor/c_exception/release/build.info +2 -0
- data/{new_project_template/vendor/ceedling/vendor → vendor}/c_exception/release/version.info +0 -0
- data/{new_project_template/vendor/ceedling/vendor → vendor}/cmock/config/production_environment.rb +0 -0
- data/{new_project_template/vendor/ceedling/vendor → vendor}/cmock/config/test_environment.rb +0 -0
- data/{new_project_template/vendor/ceedling/vendor → vendor}/cmock/lib/cmock.rb +0 -0
- data/{new_project_template/vendor/ceedling/vendor → vendor}/cmock/lib/cmock_config.rb +3 -3
- data/{new_project_template/vendor/ceedling/vendor → vendor}/cmock/lib/cmock_file_writer.rb +0 -0
- data/{new_project_template/vendor/ceedling/vendor → vendor}/cmock/lib/cmock_generator.rb +0 -0
- data/{new_project_template/vendor/ceedling/vendor → vendor}/cmock/lib/cmock_generator_plugin_array.rb +0 -0
- data/{new_project_template/vendor/ceedling/vendor → vendor}/cmock/lib/cmock_generator_plugin_callback.rb +0 -0
- data/{new_project_template/vendor/ceedling/vendor → vendor}/cmock/lib/cmock_generator_plugin_cexception.rb +0 -0
- data/{new_project_template/vendor/ceedling/vendor → vendor}/cmock/lib/cmock_generator_plugin_expect.rb +0 -0
- data/{new_project_template/vendor/ceedling/vendor → vendor}/cmock/lib/cmock_generator_plugin_ignore.rb +14 -4
- data/{new_project_template/vendor/ceedling/vendor → vendor}/cmock/lib/cmock_generator_utils.rb +0 -0
- data/{new_project_template/vendor/ceedling/vendor → vendor}/cmock/lib/cmock_header_parser.rb +9 -5
- data/{new_project_template/vendor/ceedling/vendor → vendor}/cmock/lib/cmock_plugin_manager.rb +0 -0
- data/{new_project_template/vendor/ceedling/vendor → vendor}/cmock/lib/cmock_unityhelper_parser.rb +75 -74
- data/vendor/cmock/release/build.info +2 -0
- data/{new_project_template/vendor/ceedling/vendor → vendor}/cmock/release/version.info +0 -0
- data/{new_project_template/vendor/ceedling/vendor → vendor}/cmock/src/cmock.c +0 -0
- data/{new_project_template/vendor/ceedling/vendor → vendor}/cmock/src/cmock.h +0 -0
- data/vendor/constructor/History.rdoc +19 -0
- data/vendor/constructor/README.rdoc +72 -0
- data/vendor/constructor/Rakefile +33 -0
- data/vendor/constructor/homepage/Notes.txt +27 -0
- data/vendor/constructor/homepage/Rakefile +15 -0
- data/vendor/constructor/homepage/index.erb +27 -0
- data/vendor/constructor/homepage/index.html +36 -0
- data/vendor/constructor/homepage/page_header.graffle +0 -0
- data/vendor/constructor/homepage/page_header.html +9 -0
- data/vendor/constructor/homepage/page_header.png +0 -0
- data/vendor/constructor/homepage/sample_code.png +0 -0
- data/vendor/constructor/homepage/sample_code.rb +12 -0
- data/{new_project_template/vendor/ceedling/vendor → vendor}/constructor/lib/constructor.rb +0 -0
- data/{new_project_template/vendor/ceedling/vendor → vendor}/constructor/lib/constructor_struct.rb +0 -0
- data/vendor/constructor/specs/constructor_spec.rb +407 -0
- data/vendor/constructor/specs/constructor_struct_spec.rb +84 -0
- data/vendor/deep_merge/MIT-LICENSE +20 -0
- data/vendor/deep_merge/README +94 -0
- data/vendor/deep_merge/Rakefile +28 -0
- data/{new_project_template/vendor/ceedling/vendor → vendor}/deep_merge/lib/deep_merge.rb +0 -0
- data/vendor/deep_merge/pkg/deep_merge-0.1.0.gem +0 -0
- data/vendor/deep_merge/test/test_deep_merge.rb +553 -0
- data/vendor/diy/History.txt +28 -0
- data/vendor/diy/README.rdoc +233 -0
- data/vendor/diy/Rakefile +33 -0
- data/vendor/diy/TODO.txt +9 -0
- data/vendor/diy/diy.gemspec +131 -0
- data/{new_project_template/vendor/ceedling/vendor → vendor}/diy/lib/diy.rb +0 -0
- data/{new_project_template/vendor/ceedling/vendor → vendor}/diy/lib/diy/factory.rb +0 -0
- data/vendor/diy/sample_code/car.rb +7 -0
- data/vendor/diy/sample_code/chassis.rb +5 -0
- data/vendor/diy/sample_code/diy_example.rb +26 -0
- data/vendor/diy/sample_code/engine.rb +5 -0
- data/vendor/diy/sample_code/objects.yml +10 -0
- data/vendor/diy/test/constructor.rb +119 -0
- data/vendor/diy/test/diy_test.rb +608 -0
- data/vendor/diy/test/factory_test.rb +79 -0
- data/vendor/diy/test/files/broken_construction.yml +7 -0
- data/vendor/diy/test/files/cat/cat.rb +3 -0
- data/vendor/diy/test/files/cat/extra_conflict.yml +5 -0
- data/vendor/diy/test/files/cat/heritage.rb +2 -0
- data/vendor/diy/test/files/cat/needs_input.yml +3 -0
- data/vendor/diy/test/files/cat/the_cat_lineage.rb +1 -0
- data/vendor/diy/test/files/dog/dog_model.rb +3 -0
- data/vendor/diy/test/files/dog/dog_presenter.rb +3 -0
- data/vendor/diy/test/files/dog/dog_view.rb +2 -0
- data/vendor/diy/test/files/dog/file_resolver.rb +2 -0
- data/vendor/diy/test/files/dog/other_thing.rb +2 -0
- data/vendor/diy/test/files/dog/simple.yml +11 -0
- data/vendor/diy/test/files/donkey/foo.rb +8 -0
- data/vendor/diy/test/files/donkey/foo/bar/qux.rb +7 -0
- data/vendor/diy/test/files/factory/beef.rb +5 -0
- data/vendor/diy/test/files/factory/dog.rb +6 -0
- data/vendor/diy/test/files/factory/factory.yml +19 -0
- data/vendor/diy/test/files/factory/farm/llama.rb +7 -0
- data/vendor/diy/test/files/factory/farm/pork.rb +7 -0
- data/vendor/diy/test/files/factory/kitten.rb +13 -0
- data/vendor/diy/test/files/fud/objects.yml +13 -0
- data/vendor/diy/test/files/fud/toy.rb +14 -0
- data/vendor/diy/test/files/functions/attached_things_builder.rb +2 -0
- data/vendor/diy/test/files/functions/invalid_method.yml +5 -0
- data/vendor/diy/test/files/functions/method_extractor.rb +3 -0
- data/vendor/diy/test/files/functions/nonsingleton_objects.yml +6 -0
- data/vendor/diy/test/files/functions/objects.yml +22 -0
- data/vendor/diy/test/files/functions/thing.rb +3 -0
- data/vendor/diy/test/files/functions/thing_builder.rb +25 -0
- data/vendor/diy/test/files/functions/things_builder.rb +3 -0
- data/vendor/diy/test/files/gnu/objects.yml +14 -0
- data/vendor/diy/test/files/gnu/thinger.rb +7 -0
- data/vendor/diy/test/files/goat/base.rb +8 -0
- data/vendor/diy/test/files/goat/can.rb +6 -0
- data/vendor/diy/test/files/goat/goat.rb +6 -0
- data/vendor/diy/test/files/goat/objects.yml +12 -0
- data/vendor/diy/test/files/goat/paper.rb +6 -0
- data/vendor/diy/test/files/goat/plane.rb +7 -0
- data/vendor/diy/test/files/goat/shirt.rb +6 -0
- data/vendor/diy/test/files/goat/wings.rb +8 -0
- data/vendor/diy/test/files/horse/holder_thing.rb +3 -0
- data/vendor/diy/test/files/horse/objects.yml +7 -0
- data/vendor/diy/test/files/namespace/animal/bird.rb +5 -0
- data/vendor/diy/test/files/namespace/animal/cat.rb +5 -0
- data/vendor/diy/test/files/namespace/animal/reptile/hardshell/turtle.rb +8 -0
- data/vendor/diy/test/files/namespace/animal/reptile/lizard.rb +7 -0
- data/vendor/diy/test/files/namespace/bad_module_specified.yml +8 -0
- data/vendor/diy/test/files/namespace/class_name_combine.yml +8 -0
- data/vendor/diy/test/files/namespace/hello.txt +1 -0
- data/vendor/diy/test/files/namespace/no_module_specified.yml +8 -0
- data/vendor/diy/test/files/namespace/objects.yml +21 -0
- data/vendor/diy/test/files/namespace/road.rb +2 -0
- data/vendor/diy/test/files/namespace/sky.rb +2 -0
- data/vendor/diy/test/files/namespace/subcontext.yml +22 -0
- data/vendor/diy/test/files/non_singleton/air.rb +2 -0
- data/vendor/diy/test/files/non_singleton/fat_cat.rb +3 -0
- data/vendor/diy/test/files/non_singleton/objects.yml +19 -0
- data/vendor/diy/test/files/non_singleton/pig.rb +3 -0
- data/vendor/diy/test/files/non_singleton/thread_spinner.rb +3 -0
- data/vendor/diy/test/files/non_singleton/tick.rb +3 -0
- data/vendor/diy/test/files/non_singleton/yard.rb +2 -0
- data/vendor/diy/test/files/yak/core_model.rb +3 -0
- data/vendor/diy/test/files/yak/core_presenter.rb +3 -0
- data/vendor/diy/test/files/yak/core_view.rb +1 -0
- data/vendor/diy/test/files/yak/data_source.rb +1 -0
- data/vendor/diy/test/files/yak/fringe_model.rb +3 -0
- data/vendor/diy/test/files/yak/fringe_presenter.rb +3 -0
- data/vendor/diy/test/files/yak/fringe_view.rb +1 -0
- data/vendor/diy/test/files/yak/giant_squid.rb +3 -0
- data/vendor/diy/test/files/yak/krill.rb +2 -0
- data/vendor/diy/test/files/yak/my_objects.yml +21 -0
- data/vendor/diy/test/files/yak/sub_sub_context_test.yml +27 -0
- data/vendor/diy/test/test_helper.rb +55 -0
- data/vendor/hardmock/CHANGES +78 -0
- data/vendor/hardmock/LICENSE +7 -0
- data/vendor/hardmock/README +70 -0
- data/vendor/hardmock/Rakefile +8 -0
- data/vendor/hardmock/config/environment.rb +12 -0
- data/vendor/hardmock/lib/assert_error.rb +23 -0
- data/vendor/hardmock/lib/extend_test_unit.rb +14 -0
- data/vendor/hardmock/lib/hardmock.rb +86 -0
- data/vendor/hardmock/lib/hardmock/errors.rb +22 -0
- data/vendor/hardmock/lib/hardmock/expectation.rb +229 -0
- data/vendor/hardmock/lib/hardmock/expectation_builder.rb +9 -0
- data/vendor/hardmock/lib/hardmock/expector.rb +26 -0
- data/vendor/hardmock/lib/hardmock/method_cleanout.rb +33 -0
- data/vendor/hardmock/lib/hardmock/mock.rb +180 -0
- data/vendor/hardmock/lib/hardmock/mock_control.rb +53 -0
- data/vendor/hardmock/lib/hardmock/stubbing.rb +210 -0
- data/vendor/hardmock/lib/hardmock/trapper.rb +31 -0
- data/vendor/hardmock/lib/hardmock/utils.rb +9 -0
- data/vendor/hardmock/lib/test_unit_before_after.rb +169 -0
- data/vendor/hardmock/rake_tasks/rdoc.rake +19 -0
- data/vendor/hardmock/rake_tasks/rdoc_options.rb +4 -0
- data/vendor/hardmock/rake_tasks/test.rake +22 -0
- data/vendor/hardmock/test/functional/assert_error_test.rb +52 -0
- data/vendor/hardmock/test/functional/auto_verify_test.rb +178 -0
- data/vendor/hardmock/test/functional/direct_mock_usage_test.rb +396 -0
- data/vendor/hardmock/test/functional/hardmock_test.rb +434 -0
- data/vendor/hardmock/test/functional/stubbing_test.rb +479 -0
- data/vendor/hardmock/test/test_helper.rb +43 -0
- data/vendor/hardmock/test/unit/expectation_builder_test.rb +19 -0
- data/vendor/hardmock/test/unit/expectation_test.rb +372 -0
- data/vendor/hardmock/test/unit/expector_test.rb +57 -0
- data/vendor/hardmock/test/unit/method_cleanout_test.rb +36 -0
- data/vendor/hardmock/test/unit/mock_control_test.rb +175 -0
- data/vendor/hardmock/test/unit/mock_test.rb +279 -0
- data/vendor/hardmock/test/unit/test_unit_before_after_test.rb +452 -0
- data/vendor/hardmock/test/unit/trapper_test.rb +62 -0
- data/vendor/hardmock/test/unit/verify_error_test.rb +40 -0
- data/vendor/unity/auto/colour_prompt.rb +94 -0
- data/vendor/unity/auto/colour_reporter.rb +39 -0
- data/vendor/unity/auto/generate_module.rb +202 -0
- data/{new_project_template/vendor/ceedling/vendor → vendor}/unity/auto/generate_test_runner.rb +0 -0
- data/vendor/unity/auto/test_file_filter.rb +23 -0
- data/vendor/unity/auto/unity_test_summary.rb +139 -0
- data/vendor/unity/release/build.info +2 -0
- data/{new_project_template/vendor/ceedling/vendor → vendor}/unity/release/version.info +0 -0
- data/{new_project_template/vendor/ceedling/vendor → vendor}/unity/src/unity.c +0 -0
- data/{new_project_template/vendor/ceedling/vendor → vendor}/unity/src/unity.h +0 -0
- data/{new_project_template/vendor/ceedling/vendor → vendor}/unity/src/unity_internals.h +94 -6
- metadata +443 -237
- data/.vim +0 -1
- data/.yardopts +0 -1
- data/LICENSE +0 -19
- data/Rakefile +0 -118
- data/ceedling-gem.sublime-project +0 -8
- data/examples/blinky/.DS_Store +0 -0
- 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_AdcHardwareConfigurator.c +0 -43
- data/examples/temp_sensor/test/test_AdcTemperatureSensor.c +0 -47
- data/examples/temp_sensor/test/test_TimerConfigurator.c +0 -112
- 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_UsartConfigurator.c +0 -77
- data/examples/temp_sensor/test/test_UsartGetChar.c +0 -17
- data/examples/temp_sensor/test/test_UsartPutChar.c +0 -43
- data/examples/temp_sensor/test/test_UsartTransmitBufferStatus.c +0 -22
- data/new_project_template/build/.gitkeep +0 -0
- 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/preprocessinator_extractor.rb +0 -36
- data/new_project_template/vendor/ceedling/release/build.info +0 -1
- data/new_project_template/vendor/ceedling/vendor/c_exception/release/build.info +0 -1
- data/new_project_template/vendor/ceedling/vendor/cmock/release/build.info +0 -1
- data/new_project_template/vendor/ceedling/vendor/unity/release/build.info +0 -1
@@ -0,0 +1,97 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../unit_test_helper'
|
2
|
+
require 'file_path_utils'
|
3
|
+
|
4
|
+
|
5
|
+
class FilePathUtilsTest < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def setup
|
8
|
+
objects = create_mocks(:configurator, :file_wrapper)
|
9
|
+
@utils = FilePathUtils.new(objects)
|
10
|
+
end
|
11
|
+
|
12
|
+
def teardown
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
should "standardize paths with forward slash file separators and prepend with ./" do
|
17
|
+
assert_equal('files/dir/dir', FilePathUtils::standardize("files\\dir\\dir/"))
|
18
|
+
assert_equal('root/subdir/dir', FilePathUtils::standardize("root\\subdir\\dir\\"))
|
19
|
+
assert_equal('files/modules/tests', FilePathUtils::standardize("files/modules/tests"))
|
20
|
+
assert_equal('source/modules', FilePathUtils::standardize("source\\modules"))
|
21
|
+
assert_equal('source/modules', FilePathUtils::standardize("./source\\modules"))
|
22
|
+
assert_equal('source/modules', FilePathUtils::standardize(".\\source\\modules"))
|
23
|
+
assert_equal('', FilePathUtils::standardize("./"))
|
24
|
+
assert_equal('.', FilePathUtils::standardize("."))
|
25
|
+
end
|
26
|
+
|
27
|
+
|
28
|
+
should "find base directory up to glob notation or filename" do
|
29
|
+
assert_equal('/files/stuff', FilePathUtils::dirname('/files/stuff/'))
|
30
|
+
assert_equal('/files/stuff', FilePathUtils::dirname('/files/stuff'))
|
31
|
+
assert_equal('.', FilePathUtils::dirname('.'))
|
32
|
+
|
33
|
+
assert_equal('.', FilePathUtils::dirname('./*'))
|
34
|
+
assert_equal('/files/stuff', FilePathUtils::dirname('/files/stuff/**'))
|
35
|
+
assert_equal('/files/stuff', FilePathUtils::dirname('/files/stuff/*'))
|
36
|
+
assert_equal('/files/stuff', FilePathUtils::dirname('/files/stuff/**/more*'))
|
37
|
+
assert_equal('files/tests', FilePathUtils::dirname('files/tests/*test/**/thing*/**'))
|
38
|
+
assert_equal('files', FilePathUtils::dirname('files/test*'))
|
39
|
+
|
40
|
+
assert_equal('files/tests', FilePathUtils::dirname('files/tests/???src'))
|
41
|
+
assert_equal('project/files', FilePathUtils::dirname('project/files/test?'))
|
42
|
+
|
43
|
+
assert_equal('project/files', FilePathUtils::dirname('project/files/test[123]'))
|
44
|
+
|
45
|
+
assert_equal('project/files', FilePathUtils::dirname('project/files/test{ing,s}'))
|
46
|
+
|
47
|
+
assert_equal('project/files', FilePathUtils::dirname('project/files/**/**'))
|
48
|
+
end
|
49
|
+
|
50
|
+
|
51
|
+
should "form valid subdirectory recursing globs from path convention" do
|
52
|
+
assert_equal('/files/stuff/', FilePathUtils::reform_glob('/files/stuff/'))
|
53
|
+
assert_equal('/files/stuff', FilePathUtils::reform_glob('/files/stuff'))
|
54
|
+
assert_equal('.', FilePathUtils::reform_glob('.'))
|
55
|
+
|
56
|
+
assert_equal('./*', FilePathUtils::reform_glob('./*'))
|
57
|
+
assert_equal('/files/stuff/**/**', FilePathUtils::reform_glob('/files/stuff/**'))
|
58
|
+
assert_equal('/files/stuff/*', FilePathUtils::reform_glob('/files/stuff/*'))
|
59
|
+
assert_equal('/files/stuff/**/more*', FilePathUtils::reform_glob('/files/stuff/**/more*'))
|
60
|
+
assert_equal('files/tests/*test/**/thing*/**/**', FilePathUtils::reform_glob('files/tests/*test/**/thing*/**'))
|
61
|
+
|
62
|
+
assert_equal('files/tests/???src', FilePathUtils::reform_glob('files/tests/???src'))
|
63
|
+
assert_equal('project/files/test?', FilePathUtils::reform_glob('project/files/test?'))
|
64
|
+
|
65
|
+
assert_equal('project/files/test[123]', FilePathUtils::reform_glob('project/files/test[123]'))
|
66
|
+
|
67
|
+
assert_equal('project/files/test{ing,s}', FilePathUtils::reform_glob('project/files/test{ing,s}'))
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
should "form runner object file path from configuration and file name" do
|
72
|
+
@configurator.expects.project_test_build_output_path.returns('project/build/output')
|
73
|
+
@configurator.expects.extension_object.returns('.obj')
|
74
|
+
@configurator.expects.extension_object.returns('.obj')
|
75
|
+
@configurator.expects.test_runner_file_suffix.returns('_runner')
|
76
|
+
|
77
|
+
assert_equal('project/build/output/test_stuff_runner.obj', @utils.form_runner_object_filepath_from_test('files/junk/test_stuff.c'))
|
78
|
+
end
|
79
|
+
|
80
|
+
|
81
|
+
should "form runner object file path from configuration and file name" do
|
82
|
+
@configurator.expects.project_test_build_output_path.returns('project/build/output')
|
83
|
+
@configurator.expects.extension_object.returns('.o')
|
84
|
+
|
85
|
+
assert_equal('project/build/output/stuff.o', @utils.form_object_filepath('files/junk/stuff.c'))
|
86
|
+
end
|
87
|
+
|
88
|
+
|
89
|
+
should "form executable file path from configuration and file name" do
|
90
|
+
@configurator.expects.project_test_build_output_path.returns('project/build/output')
|
91
|
+
@configurator.expects.extension_executable.returns('.out')
|
92
|
+
|
93
|
+
assert_equal('project/build/output/test_stuff.out', @utils.form_executable_filepath('files/tests/test_stuff.c'))
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
97
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../unit_test_helper'
|
2
|
+
require 'file_system_utils'
|
3
|
+
|
4
|
+
|
5
|
+
class FileSystemUtilsTest < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def setup
|
8
|
+
objects = create_mocks(:file_wrapper)
|
9
|
+
utils = FileSystemUtils.new(objects)
|
10
|
+
end
|
11
|
+
|
12
|
+
def teardown
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
should "" do
|
17
|
+
# dummy placeholder test; all tests are system tests (system/paths_test) for this guy
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
@@ -0,0 +1,187 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../unit_test_helper'
|
2
|
+
require 'generator'
|
3
|
+
|
4
|
+
|
5
|
+
class GeneratorTest < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def setup
|
8
|
+
objects = create_mocks(:configurator, :preprocessinator, :cmock_factory, :generator_test_runner, :generator_test_results, :test_includes_extractor, :tool_executor, :file_finder, :file_path_utils, :streaminator, :plugin_manager, :file_wrapper)
|
9
|
+
create_mocks(:cmock, :file)
|
10
|
+
@generator = Generator.new(objects)
|
11
|
+
end
|
12
|
+
|
13
|
+
def teardown
|
14
|
+
end
|
15
|
+
|
16
|
+
################### includes preprocessing ####################
|
17
|
+
|
18
|
+
should "generate shallow includes list file" do
|
19
|
+
@preprocessinator.expects.preprocess_shallow_includes('project/tests/test_file.c')
|
20
|
+
|
21
|
+
@generator.generate_shallow_includes_list('project/tests/test_file.c')
|
22
|
+
end
|
23
|
+
|
24
|
+
################### file preprocessing ####################
|
25
|
+
|
26
|
+
should "generate preprocessed version of file" do
|
27
|
+
@streaminator.expects.stdout_puts("Preprocessing test_icle.c...", Verbosity::NORMAL)
|
28
|
+
|
29
|
+
@preprocessinator.expects.preprocess_file('project/tests/test_icle.c')
|
30
|
+
|
31
|
+
@generator.generate_preprocessed_file('project/tests/test_icle.c')
|
32
|
+
end
|
33
|
+
|
34
|
+
################### auxiliary dependencies ####################
|
35
|
+
|
36
|
+
should "generate auxiliary dependencies file" do
|
37
|
+
@streaminator.expects.stdout_puts("Generating dependencies for file.c...", Verbosity::NORMAL)
|
38
|
+
|
39
|
+
@configurator.expects.tools_dependencies_generator.returns('gcc -depgen')
|
40
|
+
@file_path_utils.expects.form_object_filepath('project/files/src/file.c').returns('project/build/file.o')
|
41
|
+
|
42
|
+
@tool_executor.expects.build_command_line('gcc -depgen', 'project/files/src/file.c', ['types.h', 'helper.h'], 'project/build/file.o').returns('dep cmd line')
|
43
|
+
|
44
|
+
@tool_executor.expects.exec('dep cmd line')
|
45
|
+
|
46
|
+
@generator.generate_dependencies_file('project/files/src/file.c', ['types.h', 'helper.h'])
|
47
|
+
end
|
48
|
+
|
49
|
+
################### cmock ####################
|
50
|
+
|
51
|
+
should "manufacture cmock object if not already in existence and verify that cmock gets called" do
|
52
|
+
test_source_header1 = 'files/source/mockable1.h'
|
53
|
+
test_preprocessed_header1 = 'files/preprocessed/mockable1.h'
|
54
|
+
test_source_header2 = 'files/source/mockable2.h'
|
55
|
+
test_preprocessed_header2 = 'files/preprocessed/mockable2.h'
|
56
|
+
|
57
|
+
# instantiate cmock as it doesn't exist and then call against to create mock
|
58
|
+
@configurator.expects.cmock_config_hash.returns({:cmock => []})
|
59
|
+
@cmock_factory.expects.manufacture({:cmock => []}).returns(@cmock)
|
60
|
+
@preprocessinator.expects.form_file_path(test_source_header1).returns(test_preprocessed_header1)
|
61
|
+
@cmock.expects.setup_mocks(test_preprocessed_header1)
|
62
|
+
@generator.generate_mock(test_source_header1)
|
63
|
+
|
64
|
+
# don't instantiate cmock as it already exists and then against it to create mock
|
65
|
+
@preprocessinator.expects.form_file_path(test_source_header2).returns(test_preprocessed_header2)
|
66
|
+
@cmock.expects.setup_mocks(test_preprocessed_header2)
|
67
|
+
@generator.generate_mock(test_source_header2)
|
68
|
+
end
|
69
|
+
|
70
|
+
################### test runner ####################
|
71
|
+
|
72
|
+
should "generate test runner" do
|
73
|
+
test_source = 'tests/test_count_chocula.c'
|
74
|
+
preprocessed_source = 'preprocessed/test_count_chocula.c'
|
75
|
+
test_runner = 'build/runners/test_count_chocula_runner.c'
|
76
|
+
test_cases = ['test_how_much_goodness', 'test_chocolatey_milk']
|
77
|
+
mock_list = ['mock_marshmallows.h', 'mock_cereal_bits.h']
|
78
|
+
|
79
|
+
@preprocessinator.expects.form_file_path(test_source).returns(preprocessed_source)
|
80
|
+
|
81
|
+
@generator_test_runner.expects.find_test_cases(preprocessed_source).returns(test_cases)
|
82
|
+
@test_includes_extractor.expects.lookup_raw_mock_list(preprocessed_source).returns(mock_list)
|
83
|
+
|
84
|
+
@streaminator.expects.stdout_puts("Creating test runner for test_count_chocula.c...", Verbosity::NORMAL)
|
85
|
+
|
86
|
+
@file_wrapper.expects.open(test_runner, 'w').yields(@file)
|
87
|
+
|
88
|
+
@generator_test_runner.expects.create_header(@file, mock_list)
|
89
|
+
@generator_test_runner.expects.create_externs(@file, test_cases)
|
90
|
+
@generator_test_runner.expects.create_mock_management(@file, mock_list)
|
91
|
+
@generator_test_runner.expects.create_runtest(@file, mock_list, test_cases)
|
92
|
+
@generator_test_runner.expects.create_main(@file, 'test_count_chocula.c', test_cases)
|
93
|
+
|
94
|
+
@generator.generate_test_runner(test_source, test_runner)
|
95
|
+
end
|
96
|
+
|
97
|
+
################### compilation ####################
|
98
|
+
|
99
|
+
should "compile object file" do
|
100
|
+
tool_config = {:tools_test_compiler => {}}
|
101
|
+
|
102
|
+
@streaminator.expects.stdout_puts("Compiling compile_me.c...", Verbosity::NORMAL)
|
103
|
+
|
104
|
+
@configurator.expects.tools_test_compiler.returns(tool_config)
|
105
|
+
|
106
|
+
@tool_executor.expects.build_command_line(tool_config, 'files/modules/compile_me.c', 'build/out/compile_me.o').returns('compiler.exe input output')
|
107
|
+
@tool_executor.expects.exec('compiler.exe input output').returns('ignore this')
|
108
|
+
|
109
|
+
@generator.generate_object_file('files/modules/compile_me.c', 'build/out/compile_me.o')
|
110
|
+
end
|
111
|
+
|
112
|
+
################### linking ####################
|
113
|
+
|
114
|
+
should "link executable file" do
|
115
|
+
tool_config = {:tools_test_linker => {}}
|
116
|
+
|
117
|
+
@streaminator.expects.stdout_puts("Linking link_me.out...", Verbosity::NORMAL)
|
118
|
+
|
119
|
+
@configurator.expects.tools_test_linker.returns(tool_config)
|
120
|
+
|
121
|
+
@tool_executor.expects.build_command_line(tool_config, ['build/out/compile_me.o', 'build/out/compile_me_too.o'], 'build/out/link_me.out').returns('linker.exe input output')
|
122
|
+
@tool_executor.expects.exec('linker.exe input output').returns('ignore this')
|
123
|
+
|
124
|
+
@generator.generate_executable_file(['build/out/compile_me.o', 'build/out/compile_me_too.o'], 'build/out/link_me.out')
|
125
|
+
end
|
126
|
+
|
127
|
+
################### test execution ####################
|
128
|
+
|
129
|
+
should "execute test and process results to file" do
|
130
|
+
tool_config = {:tools_test_runner => {}}
|
131
|
+
arg_hash = {:executable => 'build/out/test.out', :result => 'build/results/test.pass'}
|
132
|
+
|
133
|
+
@plugin_manager.expects.pre_test_fixture_execute(arg_hash)
|
134
|
+
|
135
|
+
@streaminator.expects.stdout_puts("Running test.out...", Verbosity::NORMAL)
|
136
|
+
|
137
|
+
@configurator.expects.tools_test_fixture.returns(tool_config)
|
138
|
+
|
139
|
+
@tool_executor.expects.build_command_line(tool_config, arg_hash[:executable]).returns('simulator.exe test.out')
|
140
|
+
@tool_executor.expects.exec('simulator.exe test.out').returns('test results')
|
141
|
+
|
142
|
+
@file_finder.expects.find_test_from_file_path(arg_hash[:executable]).returns('tests/test.c')
|
143
|
+
|
144
|
+
@generator_test_results.expects.process_and_write_results('test results', arg_hash[:result], 'tests/test.c')
|
145
|
+
|
146
|
+
@plugin_manager.expects.post_test_fixture_execute(arg_hash)
|
147
|
+
|
148
|
+
@generator.generate_test_results(arg_hash[:executable], arg_hash[:result])
|
149
|
+
end
|
150
|
+
|
151
|
+
should "raise if test execution yields nil results" do
|
152
|
+
tool_config = {:tools_test_runner => {}}
|
153
|
+
arg_hash = {:executable => 'build/out/test.out', :result => 'build/results/test.pass'}
|
154
|
+
|
155
|
+
@plugin_manager.expects.pre_test_fixture_execute(arg_hash)
|
156
|
+
|
157
|
+
@streaminator.expects.stdout_puts("Running test.out...", Verbosity::NORMAL)
|
158
|
+
|
159
|
+
@configurator.expects.tools_test_fixture.returns(tool_config)
|
160
|
+
|
161
|
+
@tool_executor.expects.build_command_line(tool_config, arg_hash[:executable]).returns('simulator.exe test.out')
|
162
|
+
@tool_executor.expects.exec('simulator.exe test.out').returns(nil)
|
163
|
+
|
164
|
+
@streaminator.expects.stderr_puts("ERROR: Test executable \"test.out\" did not produce any results.", Verbosity::ERRORS)
|
165
|
+
|
166
|
+
assert_raise(RuntimeError) { @generator.generate_test_results(arg_hash[:executable], arg_hash[:result]) }
|
167
|
+
end
|
168
|
+
|
169
|
+
should "raise if test execution yields a string with no parseable results" do
|
170
|
+
tool_config = {:tools_test_runner => {}}
|
171
|
+
arg_hash = {:executable => 'build/out/test.out', :result => 'build/results/test.pass'}
|
172
|
+
|
173
|
+
@plugin_manager.expects.pre_test_fixture_execute(arg_hash)
|
174
|
+
|
175
|
+
@streaminator.expects.stdout_puts("Running test.out...", Verbosity::NORMAL)
|
176
|
+
|
177
|
+
@configurator.expects.tools_test_fixture.returns(tool_config)
|
178
|
+
|
179
|
+
@tool_executor.expects.build_command_line(tool_config, arg_hash[:executable]).returns('simulator.exe test.out')
|
180
|
+
@tool_executor.expects.exec('simulator.exe test.out').returns('')
|
181
|
+
|
182
|
+
@streaminator.expects.stderr_puts("ERROR: Test executable \"test.out\" did not produce any results.", Verbosity::ERRORS)
|
183
|
+
|
184
|
+
assert_raise(RuntimeError) { @generator.generate_test_results('build/out/test.out', 'build/results/test.pass') }
|
185
|
+
end
|
186
|
+
|
187
|
+
end
|
@@ -0,0 +1,129 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../unit_test_helper'
|
2
|
+
require 'generator_test_results'
|
3
|
+
|
4
|
+
|
5
|
+
class GeneratorTestResultsTest < Test::Unit::TestCase
|
6
|
+
|
7
|
+
def setup
|
8
|
+
objects = create_mocks(:configurator, :yaml_wrapper, :streaminator)
|
9
|
+
@utils = GeneratorTestResults.new(objects)
|
10
|
+
end
|
11
|
+
|
12
|
+
def teardown
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
should "complain if output from test fixture includes messed up statistics" do
|
17
|
+
|
18
|
+
# no ignore count
|
19
|
+
raw_unity_output1 = %Q[
|
20
|
+
13 Tests 0 Failures
|
21
|
+
].left_margin(0)
|
22
|
+
|
23
|
+
@configurator.expects.extension_executable.returns('.exe')
|
24
|
+
@streaminator.expects.stderr_puts("ERROR: Results from test fixture 'TestIng.exe' are missing or are malformed.", Verbosity::ERRORS)
|
25
|
+
|
26
|
+
assert_raise(RuntimeError){ @utils.process_and_write_results(raw_unity_output1, 'project/build/results/TestIng.pass', 'files/tests/TestIng.c') }
|
27
|
+
|
28
|
+
# 'Test' not pluralized
|
29
|
+
raw_unity_output2 = %Q[
|
30
|
+
13 Test 0 Failures 3 Ignored
|
31
|
+
].left_margin(0)
|
32
|
+
|
33
|
+
@configurator.expects.extension_executable.returns('.out')
|
34
|
+
@streaminator.expects.stderr_puts("ERROR: Results from test fixture 'TestIcular.out' are missing or are malformed.", Verbosity::ERRORS)
|
35
|
+
|
36
|
+
assert_raise(RuntimeError){ @utils.process_and_write_results(raw_unity_output2, 'project/build/results/TestIcular.pass', 'files/tests/TestIcular.c') }
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
should "write a mixture of test results to a .fail file" do
|
41
|
+
|
42
|
+
# test fixture output with blank lines and junk past the statistics line
|
43
|
+
raw_unity_output = %Q[
|
44
|
+
|
45
|
+
test_a_file.c:13:test_a_single_thing:IGNORE:pay no attention to the test behind the curtain
|
46
|
+
test_a_file.c:18:test_another_thing:IGNORE:pay no attention to the:stray colon
|
47
|
+
test_a_file.c:35:test_your_knowledge:FAIL:Expected TRUE was FALSE
|
48
|
+
test_a_file.c:42:test_a_success_case:PASS
|
49
|
+
|
50
|
+
test_a_file.c:47:test_another_thing:FAIL
|
51
|
+
test_a_file.c:53:test_some_non_void_param_stuff:IGNORE:pay no attention to the test behind the curtain
|
52
|
+
test_a_file.c:60:test_some_multiline_test_case_action:IGNORE:pay no attention to the test behind the curtain
|
53
|
+
|
54
|
+
test_a_file.c:65:test_another_success_case:PASS
|
55
|
+
test_a_file.c:78:test_yet_another_success_case:PASS
|
56
|
+
test_a_file.c:92:test_a_final_thing:FAIL:BOOM!
|
57
|
+
10 Tests 3 Failures 4 Ignored
|
58
|
+
FAIL
|
59
|
+
// a random comment to be ignored
|
60
|
+
].left_margin(0)
|
61
|
+
|
62
|
+
expected_hash = {
|
63
|
+
:counts => {:total => 10, :failed => 3, :ignored => 4, :passed => 3},
|
64
|
+
:source => {:path => 'files/tests', :file => 'test_a_file.c'},
|
65
|
+
:failures => [
|
66
|
+
{:test => 'test_your_knowledge', :line => 35, :message => 'Expected TRUE was FALSE'},
|
67
|
+
{:test => 'test_another_thing', :line => 47, :message => ''},
|
68
|
+
{:test => 'test_a_final_thing', :line => 92, :message => 'BOOM!'},
|
69
|
+
],
|
70
|
+
:ignores => [
|
71
|
+
{:test => 'test_a_single_thing', :line => 13, :message => 'pay no attention to the test behind the curtain'},
|
72
|
+
{:test => 'test_another_thing', :line => 18, :message => 'pay no attention to the:stray colon'},
|
73
|
+
{:test => 'test_some_non_void_param_stuff', :line => 53, :message => 'pay no attention to the test behind the curtain'},
|
74
|
+
{:test => 'test_some_multiline_test_case_action', :line => 60, :message => 'pay no attention to the test behind the curtain'},
|
75
|
+
],
|
76
|
+
:successes => [
|
77
|
+
{:test => 'test_a_success_case', :line => 42, :message => ''},
|
78
|
+
{:test => 'test_another_success_case', :line => 65, :message => ''},
|
79
|
+
{:test => 'test_yet_another_success_case', :line => 78, :message => ''},
|
80
|
+
]
|
81
|
+
}
|
82
|
+
|
83
|
+
@configurator.expects.extension_testfail.returns('.fail')
|
84
|
+
|
85
|
+
@yaml_wrapper.expects.dump('project/build/results/test_a_file.fail', expected_hash)
|
86
|
+
|
87
|
+
@utils.process_and_write_results(raw_unity_output, 'project/build/results/test_a_file.pass', 'files/tests/test_a_file.c')
|
88
|
+
|
89
|
+
end
|
90
|
+
|
91
|
+
|
92
|
+
should "write a mixture of test results to a .pass file" do
|
93
|
+
|
94
|
+
# clean test fixture output
|
95
|
+
raw_unity_output = %Q[
|
96
|
+
test_eez.c:13:test_a_single_thing:IGNORE:pay no attention to the test behind the curtain
|
97
|
+
test_eez.c:18:test_another_thing:IGNORE:pay no attention to the test behind the curtain
|
98
|
+
test_eez.c:30:test_a_success_case:PASS
|
99
|
+
test_eez.c:60:test_some_multiline_test_case_action:IGNORE:pay no attention to the stray:colon
|
100
|
+
test_eez.c:73:test_another_success_case:PASS
|
101
|
+
test_eez.c:83:test_yet_another_success_case:PASS
|
102
|
+
6 Tests 0 Failures 3 Ignored
|
103
|
+
OK
|
104
|
+
].left_margin(0)
|
105
|
+
|
106
|
+
expected_hash = {
|
107
|
+
:counts => {:total => 6, :failed => 0, :ignored => 3, :passed => 3},
|
108
|
+
:source => {:path => 'files/tests', :file => 'test_eez.c'},
|
109
|
+
:failures => [],
|
110
|
+
:ignores => [
|
111
|
+
{:test => 'test_a_single_thing', :line => 13, :message => 'pay no attention to the test behind the curtain'},
|
112
|
+
{:test => 'test_another_thing', :line => 18, :message => 'pay no attention to the test behind the curtain'},
|
113
|
+
{:test => 'test_some_multiline_test_case_action', :line => 60, :message => 'pay no attention to the stray:colon'},
|
114
|
+
],
|
115
|
+
:successes => [
|
116
|
+
{:test => 'test_a_success_case', :line => 30, :message => ''},
|
117
|
+
{:test => 'test_another_success_case', :line => 73, :message => ''},
|
118
|
+
{:test => 'test_yet_another_success_case', :line => 83, :message => ''},
|
119
|
+
]
|
120
|
+
}
|
121
|
+
|
122
|
+
@yaml_wrapper.expects.dump('project/build/results/test_eez.pass', expected_hash)
|
123
|
+
|
124
|
+
@utils.process_and_write_results(raw_unity_output, 'project/build/results/test_eez.pass', 'files/tests/test_eez.c')
|
125
|
+
|
126
|
+
end
|
127
|
+
|
128
|
+
end
|
129
|
+
|
@@ -0,0 +1,478 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../unit_test_helper'
|
2
|
+
require 'generator_test_runner'
|
3
|
+
|
4
|
+
|
5
|
+
# redefine split for convenience of file content comparison in tests.
|
6
|
+
# this is needed because we're using the '<<' operator on real files in source but substituting
|
7
|
+
# an array for file writes in the tests; the '<<' operator tacks on new lines when used with a file,
|
8
|
+
# but, of course, does not do this when inserting into an array.
|
9
|
+
class String
|
10
|
+
def newline_split(pattern=/\n/, limit=nil)
|
11
|
+
return (split(pattern, limit)).map{|elem| elem + "\n"} if !limit.nil?
|
12
|
+
return (split(pattern) ).map{|elem| elem + "\n"}
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
#NOTE: When using newline_split() & left_margin() to manage test code strings,
|
18
|
+
# white space to the left of newlines in otherwise blank lines is important.
|
19
|
+
# That is, *every* line in a test code block must be spaced over.
|
20
|
+
|
21
|
+
|
22
|
+
class GeneratorTestRunnerTest < Test::Unit::TestCase
|
23
|
+
|
24
|
+
def setup
|
25
|
+
objects = create_mocks(:configurator, :file_wrapper)
|
26
|
+
@runner_utils = GeneratorTestRunner.new(objects)
|
27
|
+
end
|
28
|
+
|
29
|
+
def teardown
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
######### find test cases #########
|
34
|
+
|
35
|
+
should "find test case functions in preprocessed test file" do
|
36
|
+
test_file = 'tests/test_me.c'
|
37
|
+
|
38
|
+
test_me_c = %Q[
|
39
|
+
#include "unity.h"
|
40
|
+
#include "Oscar.h"
|
41
|
+
#include "mock_abilly.h"
|
42
|
+
#include "mock_and_roll.h "
|
43
|
+
|
44
|
+
void test_some_stuff(void)
|
45
|
+
{
|
46
|
+
TEST_ASSERT_IGNORE("pay no attention to the test behind the curtain");
|
47
|
+
}
|
48
|
+
|
49
|
+
void test_some_more_stuff ( void )
|
50
|
+
{
|
51
|
+
TEST_ASSERT_IGNORE("pay no attention to the test behind the curtain");
|
52
|
+
}
|
53
|
+
|
54
|
+
void test_some_non_void_param_stuff()
|
55
|
+
{
|
56
|
+
TEST_ASSERT_IGNORE("pay no attention to the test behind the curtain");
|
57
|
+
}
|
58
|
+
|
59
|
+
void
|
60
|
+
test_some_multiline_test_case_action
|
61
|
+
(void)
|
62
|
+
{
|
63
|
+
TEST_ASSERT_IGNORE("pay no attention to the test behind the curtain");
|
64
|
+
}
|
65
|
+
|
66
|
+
].left_margin(0)
|
67
|
+
|
68
|
+
@configurator.expects.project_use_preprocessor.returns(true)
|
69
|
+
|
70
|
+
@file_wrapper.expects.read(test_file).returns(test_me_c)
|
71
|
+
|
72
|
+
assert_equal(
|
73
|
+
['test_some_stuff',
|
74
|
+
'test_some_more_stuff',
|
75
|
+
'test_some_non_void_param_stuff',
|
76
|
+
'test_some_multiline_test_case_action'
|
77
|
+
],
|
78
|
+
@runner_utils.find_test_cases(test_file))
|
79
|
+
end
|
80
|
+
|
81
|
+
should "find test case functions in non-preprocessed test file (do some basic pre-processing with regex)" do
|
82
|
+
test_file = 'tests/test_me.c'
|
83
|
+
|
84
|
+
test_me_c = %Q[
|
85
|
+
#include "unity.h"
|
86
|
+
#include "Oscar.h"
|
87
|
+
#include "mock_abilly.h"
|
88
|
+
#include "mock_and_roll.h "
|
89
|
+
|
90
|
+
#ifdef SOMETHING
|
91
|
+
extern void test_a_thing_to_throw_off_scanning(void);
|
92
|
+
#end
|
93
|
+
|
94
|
+
//void test_some_stuff(void)
|
95
|
+
//{
|
96
|
+
// TEST_ASSERT_IGNORE("pay no attention to the test behind the curtain");
|
97
|
+
//}
|
98
|
+
|
99
|
+
/*
|
100
|
+
void test_some_more_stuff ( void )
|
101
|
+
{
|
102
|
+
TEST_ASSERT_IGNORE("pay no attention to the test behind the curtain");
|
103
|
+
}*/
|
104
|
+
|
105
|
+
void test_some_non_void_param_stuff()
|
106
|
+
{
|
107
|
+
TEST_ASSERT_IGNORE("pay no attention to the test behind the curtain");
|
108
|
+
}
|
109
|
+
|
110
|
+
void
|
111
|
+
test_some_multiline_test_case_action
|
112
|
+
(void)
|
113
|
+
{
|
114
|
+
TEST_ASSERT_IGNORE("pay no attention to the test behind the curtain");
|
115
|
+
}
|
116
|
+
|
117
|
+
].left_margin(0)
|
118
|
+
|
119
|
+
@configurator.expects.project_use_preprocessor.returns(false)
|
120
|
+
|
121
|
+
@file_wrapper.expects.read(test_file).returns(test_me_c)
|
122
|
+
|
123
|
+
assert_equal(
|
124
|
+
['test_some_non_void_param_stuff',
|
125
|
+
'test_some_multiline_test_case_action'
|
126
|
+
],
|
127
|
+
@runner_utils.find_test_cases(test_file))
|
128
|
+
end
|
129
|
+
|
130
|
+
|
131
|
+
######### header block #########
|
132
|
+
|
133
|
+
should "create header block of include statements and internal variables for exception handling, mocks, and strict ordering" do
|
134
|
+
file = []
|
135
|
+
|
136
|
+
expected_output = %Q[
|
137
|
+
/* AUTOGENERATED FILE. DO NOT EDIT. */
|
138
|
+
#include "unity.h"
|
139
|
+
#include "extra_thing1.h"
|
140
|
+
#include "extra_thing2.h"
|
141
|
+
#include <setjmp.h>
|
142
|
+
#include <stdio.h>
|
143
|
+
#include "CException.h"
|
144
|
+
#include "mock_abc.h"
|
145
|
+
#include "mock_123.h"
|
146
|
+
|
147
|
+
int GlobalExpectCount;
|
148
|
+
int GlobalVerifyOrder;
|
149
|
+
char* GlobalOrderError;
|
150
|
+
|
151
|
+
char MessageBuffer[50];
|
152
|
+
].left_margin(0)
|
153
|
+
|
154
|
+
@configurator.expects.test_runner_includes.returns(['extra_thing1.h', 'extra_thing2.h'])
|
155
|
+
@configurator.expects.project_use_exceptions.returns(true)
|
156
|
+
@configurator.expects.extension_header.returns('.h')
|
157
|
+
@configurator.expects.cmock_enforce_strict_ordering.returns(true)
|
158
|
+
|
159
|
+
@runner_utils.create_header(file, ['mock_abc', 'mock_123'])
|
160
|
+
|
161
|
+
assert_equal(expected_output.newline_split[1..-1], file)
|
162
|
+
end
|
163
|
+
|
164
|
+
should "create header block of include statements and internal variables for exception handling & mocks but without strict ordering" do
|
165
|
+
file = []
|
166
|
+
|
167
|
+
expected_output = %Q[
|
168
|
+
/* AUTOGENERATED FILE. DO NOT EDIT. */
|
169
|
+
#include "unity.h"
|
170
|
+
#include "extra_thing1.h"
|
171
|
+
#include "extra_thing2.h"
|
172
|
+
#include <setjmp.h>
|
173
|
+
#include <stdio.h>
|
174
|
+
#include "CException.h"
|
175
|
+
#include "mock_abc.H"
|
176
|
+
#include "mock_123.H"
|
177
|
+
|
178
|
+
char MessageBuffer[50];
|
179
|
+
].left_margin(0)
|
180
|
+
|
181
|
+
@configurator.expects.test_runner_includes.returns(['extra_thing1.h', 'extra_thing2.h'])
|
182
|
+
@configurator.expects.project_use_exceptions.returns(true)
|
183
|
+
@configurator.expects.extension_header.returns('.H')
|
184
|
+
@configurator.expects.cmock_enforce_strict_ordering.returns(false)
|
185
|
+
|
186
|
+
@runner_utils.create_header(file, ['mock_abc', 'mock_123'])
|
187
|
+
|
188
|
+
assert_equal(expected_output.newline_split[1..-1], file)
|
189
|
+
end
|
190
|
+
|
191
|
+
should "create header block of include statements and internal variables for no extra header files, exception handling, or mocks" do
|
192
|
+
file = []
|
193
|
+
|
194
|
+
expected_output = %Q[
|
195
|
+
/* AUTOGENERATED FILE. DO NOT EDIT. */
|
196
|
+
#include "unity.h"
|
197
|
+
#include <setjmp.h>
|
198
|
+
#include <stdio.h>
|
199
|
+
|
200
|
+
char MessageBuffer[50];
|
201
|
+
].left_margin(0)
|
202
|
+
|
203
|
+
@configurator.expects.test_runner_includes.returns([])
|
204
|
+
@configurator.expects.project_use_exceptions.returns(false)
|
205
|
+
|
206
|
+
@runner_utils.create_header(file, [])
|
207
|
+
|
208
|
+
assert_equal(expected_output.newline_split[1..-1], file)
|
209
|
+
end
|
210
|
+
|
211
|
+
|
212
|
+
######### extern block #########
|
213
|
+
|
214
|
+
should "create extern block of setup, teardown, and test cases" do
|
215
|
+
file = []
|
216
|
+
|
217
|
+
expected_output = %Q[
|
218
|
+
extern void setUp(void);
|
219
|
+
extern void tearDown(void);
|
220
|
+
|
221
|
+
extern void test_case1(void);
|
222
|
+
extern void test_case2(void);
|
223
|
+
extern void test_case3(void);
|
224
|
+
].left_margin(0)
|
225
|
+
|
226
|
+
@runner_utils.create_externs(file, ['test_case1', 'test_case2', 'test_case3'])
|
227
|
+
|
228
|
+
assert_equal(expected_output.newline_split, file)
|
229
|
+
end
|
230
|
+
|
231
|
+
|
232
|
+
should "create extern block of setup, teardown, and no test cases" do
|
233
|
+
file = []
|
234
|
+
|
235
|
+
expected_output = %Q[
|
236
|
+
extern void setUp(void);
|
237
|
+
extern void tearDown(void);
|
238
|
+
].left_margin(0)
|
239
|
+
|
240
|
+
@runner_utils.create_externs(file, [])
|
241
|
+
|
242
|
+
assert_equal(expected_output.newline_split, file)
|
243
|
+
end
|
244
|
+
|
245
|
+
|
246
|
+
######### mock management #########
|
247
|
+
|
248
|
+
should "create mock management block for given mock list with strict ordering" do
|
249
|
+
file = []
|
250
|
+
|
251
|
+
expected_output = %Q[
|
252
|
+
static void CMock_Init(void)
|
253
|
+
{
|
254
|
+
GlobalExpectCount = 0;
|
255
|
+
GlobalVerifyOrder = 0;
|
256
|
+
GlobalOrderError = NULL;
|
257
|
+
mock_thinger_Init();
|
258
|
+
mock_stinger_Init();
|
259
|
+
mock_zinger_Init();
|
260
|
+
}
|
261
|
+
|
262
|
+
static void CMock_Verify(void)
|
263
|
+
{
|
264
|
+
mock_thinger_Verify();
|
265
|
+
mock_stinger_Verify();
|
266
|
+
mock_zinger_Verify();
|
267
|
+
}
|
268
|
+
|
269
|
+
static void CMock_Destroy(void)
|
270
|
+
{
|
271
|
+
mock_thinger_Destroy();
|
272
|
+
mock_stinger_Destroy();
|
273
|
+
mock_zinger_Destroy();
|
274
|
+
}
|
275
|
+
|
276
|
+
void CMock_VerifyAndReset(void)
|
277
|
+
{
|
278
|
+
CMock_Verify();
|
279
|
+
CMock_Destroy();
|
280
|
+
CMock_Init();
|
281
|
+
}
|
282
|
+
].left_margin(0)
|
283
|
+
|
284
|
+
@configurator.expects.extension_header.returns('.h')
|
285
|
+
@configurator.expects.cmock_enforce_strict_ordering.returns(true)
|
286
|
+
|
287
|
+
@runner_utils.create_mock_management(file, ['mock_thinger.h', 'mock_stinger.h', 'mock_zinger.h'])
|
288
|
+
|
289
|
+
assert_equal(expected_output.newline_split + ["\n"], file) # add newline array element that split won't do
|
290
|
+
end
|
291
|
+
|
292
|
+
should "create mock management block for given mock list without strict ordering" do
|
293
|
+
file = []
|
294
|
+
|
295
|
+
expected_output = %Q[
|
296
|
+
static void CMock_Init(void)
|
297
|
+
{
|
298
|
+
mock_thinger_Init();
|
299
|
+
mock_stinger_Init();
|
300
|
+
mock_zinger_Init();
|
301
|
+
}
|
302
|
+
|
303
|
+
static void CMock_Verify(void)
|
304
|
+
{
|
305
|
+
mock_thinger_Verify();
|
306
|
+
mock_stinger_Verify();
|
307
|
+
mock_zinger_Verify();
|
308
|
+
}
|
309
|
+
|
310
|
+
static void CMock_Destroy(void)
|
311
|
+
{
|
312
|
+
mock_thinger_Destroy();
|
313
|
+
mock_stinger_Destroy();
|
314
|
+
mock_zinger_Destroy();
|
315
|
+
}
|
316
|
+
|
317
|
+
void CMock_VerifyAndReset(void)
|
318
|
+
{
|
319
|
+
CMock_Verify();
|
320
|
+
CMock_Destroy();
|
321
|
+
CMock_Init();
|
322
|
+
}
|
323
|
+
].left_margin(0)
|
324
|
+
|
325
|
+
@configurator.expects.extension_header.returns('.h')
|
326
|
+
@configurator.expects.cmock_enforce_strict_ordering.returns(false)
|
327
|
+
|
328
|
+
@runner_utils.create_mock_management(file, ['mock_thinger.h', 'mock_stinger.h', 'mock_zinger.h'])
|
329
|
+
|
330
|
+
assert_equal(expected_output.newline_split + ["\n"], file) # add newline array element that split won't do
|
331
|
+
end
|
332
|
+
|
333
|
+
should "create empty mock management block for empty mock list" do
|
334
|
+
file = []
|
335
|
+
|
336
|
+
@runner_utils.create_mock_management(file, [])
|
337
|
+
|
338
|
+
assert_equal([], file)
|
339
|
+
end
|
340
|
+
|
341
|
+
|
342
|
+
######### runTest() #########
|
343
|
+
|
344
|
+
should "create no runTest function if there's no test cases (to prevent unused function compilation warnings)" do
|
345
|
+
file = []
|
346
|
+
@runner_utils.create_runtest(file, [], [])
|
347
|
+
assert_equal([], file)
|
348
|
+
end
|
349
|
+
|
350
|
+
should "create runTest function including mock and exception handling" do
|
351
|
+
file = []
|
352
|
+
|
353
|
+
expected_output = %Q[
|
354
|
+
static void runTest(UnityTestFunction test)
|
355
|
+
{
|
356
|
+
if (TEST_PROTECT())
|
357
|
+
{
|
358
|
+
CEXCEPTION_T e;
|
359
|
+
Try {
|
360
|
+
CMock_Init();
|
361
|
+
setUp();
|
362
|
+
test();
|
363
|
+
CMock_Verify();
|
364
|
+
} Catch(e) { TEST_FAIL("Unhandled Exception!"); }
|
365
|
+
}
|
366
|
+
CMock_Destroy();
|
367
|
+
if (TEST_PROTECT())
|
368
|
+
{
|
369
|
+
tearDown();
|
370
|
+
}
|
371
|
+
}
|
372
|
+
].left_margin(0)
|
373
|
+
|
374
|
+
@configurator.expects.project_use_exceptions.returns(true)
|
375
|
+
|
376
|
+
@runner_utils.create_runtest(file, ['mock_zinger.h'], ['test_icle.c', 'test_ing.c'])
|
377
|
+
assert_equal(expected_output.newline_split, file)
|
378
|
+
end
|
379
|
+
|
380
|
+
should "create runTest function including mock handling but no exception handling" do
|
381
|
+
file = []
|
382
|
+
|
383
|
+
expected_output = %Q[
|
384
|
+
static void runTest(UnityTestFunction test)
|
385
|
+
{
|
386
|
+
if (TEST_PROTECT())
|
387
|
+
{
|
388
|
+
CMock_Init();
|
389
|
+
setUp();
|
390
|
+
test();
|
391
|
+
CMock_Verify();
|
392
|
+
}
|
393
|
+
CMock_Destroy();
|
394
|
+
if (TEST_PROTECT())
|
395
|
+
{
|
396
|
+
tearDown();
|
397
|
+
}
|
398
|
+
}
|
399
|
+
].left_margin(0)
|
400
|
+
|
401
|
+
@configurator.expects.project_use_exceptions.returns(false)
|
402
|
+
|
403
|
+
@runner_utils.create_runtest(file, ['mock_zinger.h'], ['test_icle.c', 'test_ing.c'])
|
404
|
+
assert_equal(expected_output.newline_split, file)
|
405
|
+
end
|
406
|
+
|
407
|
+
should "create runTest function including no mock handling but including exception handling" do
|
408
|
+
file = []
|
409
|
+
|
410
|
+
expected_output = %Q[
|
411
|
+
static void runTest(UnityTestFunction test)
|
412
|
+
{
|
413
|
+
if (TEST_PROTECT())
|
414
|
+
{
|
415
|
+
CEXCEPTION_T e;
|
416
|
+
Try {
|
417
|
+
setUp();
|
418
|
+
test();
|
419
|
+
} Catch(e) { TEST_FAIL("Unhandled Exception!"); }
|
420
|
+
}
|
421
|
+
if (TEST_PROTECT())
|
422
|
+
{
|
423
|
+
tearDown();
|
424
|
+
}
|
425
|
+
}
|
426
|
+
].left_margin(0)
|
427
|
+
|
428
|
+
@configurator.expects.project_use_exceptions.returns(true)
|
429
|
+
|
430
|
+
@runner_utils.create_runtest(file, [], ['test_icle.c', 'test_ing.c'])
|
431
|
+
assert_equal(expected_output.newline_split, file)
|
432
|
+
end
|
433
|
+
|
434
|
+
######### main() #########
|
435
|
+
|
436
|
+
should "create main function with test cases" do
|
437
|
+
file = []
|
438
|
+
|
439
|
+
expected_output = %Q[
|
440
|
+
int main(void)
|
441
|
+
{
|
442
|
+
UnityBegin();
|
443
|
+
Unity.TestFile = "TestMe.c";
|
444
|
+
|
445
|
+
// RUN_TEST calls runTest
|
446
|
+
RUN_TEST(test_a_little_test);
|
447
|
+
RUN_TEST(test_a_wee_test);
|
448
|
+
RUN_TEST(test_a_teeny_test);
|
449
|
+
|
450
|
+
UnityEnd();
|
451
|
+
return 0;
|
452
|
+
}
|
453
|
+
].left_margin(0)
|
454
|
+
|
455
|
+
@runner_utils.create_main(file, 'TestMe.c', ['test_a_little_test', 'test_a_wee_test', 'test_a_teeny_test'])
|
456
|
+
assert_equal(expected_output.newline_split + ["\n"], file) # add newline array element that split won't do
|
457
|
+
end
|
458
|
+
|
459
|
+
should "create main function with no test cases" do
|
460
|
+
file = []
|
461
|
+
|
462
|
+
expected_output = %Q[
|
463
|
+
int main(void)
|
464
|
+
{
|
465
|
+
UnityBegin();
|
466
|
+
Unity.TestFile = "TestIfy.c";
|
467
|
+
|
468
|
+
|
469
|
+
UnityEnd();
|
470
|
+
return 0;
|
471
|
+
}
|
472
|
+
].left_margin(0)
|
473
|
+
|
474
|
+
@runner_utils.create_main(file, 'TestIfy.c', [])
|
475
|
+
assert_equal(expected_output.newline_split + ["\n"], file) # add newline array element that split won't do
|
476
|
+
end
|
477
|
+
|
478
|
+
end
|