ceedling 0.19.0 → 0.20.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +10 -10
- data/bin/ceedling +205 -92
- data/ceedling-0.19.0.gem +0 -0
- data/config/test_environment.rb +12 -12
- data/docs/CeedlingPacket.md +866 -853
- data/docs/CeedlingPacket.odt +0 -0
- data/docs/CeedlingPacket.pdf +0 -0
- data/examples/temp_sensor/rakefile.rb +4 -4
- data/examples/temp_sensor/src/AdcConductor.c +42 -42
- data/examples/temp_sensor/src/AdcConductor.h +13 -13
- data/examples/temp_sensor/src/AdcHardware.c +27 -27
- data/examples/temp_sensor/src/AdcHardware.h +11 -11
- data/examples/temp_sensor/src/AdcHardwareConfigurator.c +18 -18
- data/examples/temp_sensor/src/AdcHardwareConfigurator.h +10 -10
- data/examples/temp_sensor/src/AdcModel.c +33 -33
- data/examples/temp_sensor/src/AdcModel.h +13 -13
- data/examples/temp_sensor/src/AdcTemperatureSensor.c +51 -51
- data/examples/temp_sensor/src/AdcTemperatureSensor.h +10 -10
- data/examples/temp_sensor/src/Executor.c +25 -25
- data/examples/temp_sensor/src/Executor.h +9 -9
- data/examples/temp_sensor/src/IntrinsicsWrapper.c +18 -18
- data/examples/temp_sensor/src/IntrinsicsWrapper.h +7 -7
- data/examples/temp_sensor/src/Main.c +46 -46
- data/examples/temp_sensor/src/Main.h +7 -7
- data/examples/temp_sensor/src/Model.c +10 -10
- data/examples/temp_sensor/src/Model.h +8 -8
- data/examples/temp_sensor/src/ModelConfig.h +7 -7
- data/examples/temp_sensor/src/TaskScheduler.c +72 -72
- data/examples/temp_sensor/src/TaskScheduler.h +11 -11
- data/examples/temp_sensor/src/TemperatureCalculator.c +27 -27
- data/examples/temp_sensor/src/TemperatureCalculator.h +8 -8
- data/examples/temp_sensor/src/TemperatureFilter.c +38 -38
- data/examples/temp_sensor/src/TemperatureFilter.h +10 -10
- data/examples/temp_sensor/src/TimerConductor.c +15 -15
- data/examples/temp_sensor/src/TimerConductor.h +9 -9
- data/examples/temp_sensor/src/TimerConfigurator.c +51 -51
- data/examples/temp_sensor/src/TimerConfigurator.h +15 -15
- data/examples/temp_sensor/src/TimerHardware.c +15 -15
- data/examples/temp_sensor/src/TimerHardware.h +8 -8
- data/examples/temp_sensor/src/TimerInterruptConfigurator.c +55 -55
- data/examples/temp_sensor/src/TimerInterruptConfigurator.h +13 -13
- data/examples/temp_sensor/src/TimerInterruptHandler.c +25 -25
- data/examples/temp_sensor/src/TimerInterruptHandler.h +10 -10
- data/examples/temp_sensor/src/TimerModel.c +9 -9
- data/examples/temp_sensor/src/TimerModel.h +8 -8
- data/examples/temp_sensor/src/Types.h +90 -90
- data/examples/temp_sensor/src/UsartBaudRateRegisterCalculator.c +18 -18
- data/examples/temp_sensor/src/UsartBaudRateRegisterCalculator.h +8 -8
- data/examples/temp_sensor/src/UsartConductor.c +21 -21
- data/examples/temp_sensor/src/UsartConductor.h +7 -7
- data/examples/temp_sensor/src/UsartConfigurator.c +39 -39
- data/examples/temp_sensor/src/UsartConfigurator.h +13 -13
- data/examples/temp_sensor/src/UsartHardware.c +22 -22
- data/examples/temp_sensor/src/UsartHardware.h +9 -9
- data/examples/temp_sensor/src/UsartModel.c +34 -34
- data/examples/temp_sensor/src/UsartModel.h +10 -10
- data/examples/temp_sensor/src/UsartPutChar.c +16 -16
- data/examples/temp_sensor/src/UsartPutChar.h +8 -8
- data/examples/temp_sensor/src/UsartTransmitBufferStatus.c +7 -7
- data/examples/temp_sensor/src/UsartTransmitBufferStatus.h +8 -8
- data/examples/temp_sensor/test/TestAdcConductor.c +121 -121
- data/examples/temp_sensor/test/TestAdcHardware.c +44 -44
- data/examples/temp_sensor/test/TestAdcModel.c +33 -33
- data/examples/temp_sensor/test/TestExecutor.c +36 -36
- data/examples/temp_sensor/test/TestMain.c +24 -24
- data/examples/temp_sensor/test/TestModel.c +20 -20
- data/examples/temp_sensor/test/TestTaskScheduler.c +104 -104
- data/examples/temp_sensor/test/TestTemperatureCalculator.c +33 -33
- data/examples/temp_sensor/test/TestTemperatureFilter.c +79 -79
- data/examples/temp_sensor/test/TestTimerConductor.c +32 -32
- data/examples/temp_sensor/test/TestTimerHardware.c +26 -26
- data/examples/temp_sensor/test/TestTimerModel.c +18 -18
- data/examples/temp_sensor/test/TestUsartBaudRateRegisterCalculator.c +21 -21
- data/examples/temp_sensor/test/TestUsartConductor.c +40 -40
- data/examples/temp_sensor/test/TestUsartHardware.c +36 -36
- data/examples/temp_sensor/test/TestUsartModel.c +36 -36
- data/examples/temp_sensor/test/support/UnityHelper.c +12 -12
- data/examples/temp_sensor/test/support/UnityHelper.h +12 -12
- data/lib/ceedling/configurator_builder.rb +1 -1
- data/lib/ceedling/tasks_base.rake +10 -2
- data/lib/ceedling/tool_executor.rb +3 -0
- data/lib/ceedling/version.rb +3 -3
- data/license.txt +1 -1
- data/plugins/bullseye/bullseye.rake +162 -162
- data/plugins/gcov/gcov.rake +152 -152
- data/plugins/module_generator/lib/module_generator.rb +145 -145
- data/plugins/module_generator/module_generator.rake +14 -14
- data/plugins/stdout_gtestlike_tests_report/assets/template.erb +84 -0
- data/plugins/stdout_gtestlike_tests_report/assets/template.erb copy +59 -0
- data/plugins/stdout_gtestlike_tests_report/config/stdout_gtestlike_tests_report.yml +4 -0
- data/plugins/stdout_gtestlike_tests_report/lib/stdout_gtestlike_tests_report.rb +43 -0
- data/spec/system/deployment_spec.rb +0 -1
- data/test_graveyard/integration/paths_test.rb +80 -80
- data/test_graveyard/integration/rake_rules_aux_dependencies_test.rb +75 -75
- data/test_graveyard/integration/rake_rules_cmock_test.rb +74 -74
- data/test_graveyard/integration/rake_rules_preprocess_test.rb +178 -178
- data/test_graveyard/integration/rake_rules_test.rb +268 -268
- data/test_graveyard/integration/rake_tasks_test.rb +103 -103
- data/test_graveyard/integration_test_helper.rb +34 -34
- data/test_graveyard/rakefile_rules.rb +10 -10
- data/test_graveyard/rakefile_rules_aux_dependencies.rb +10 -10
- data/test_graveyard/rakefile_rules_cmock.rb +10 -10
- data/test_graveyard/rakefile_rules_preprocess.rb +10 -10
- data/test_graveyard/rakefile_tasks.rb +10 -10
- data/test_graveyard/system/file_system_test.rb +78 -78
- data/test_graveyard/system/project_mocks_test.rb +38 -38
- data/test_graveyard/system/project_simple_test.rb +39 -39
- data/test_graveyard/system/rule_mocks_test.rb +44 -44
- data/test_graveyard/system/rule_runners_test.rb +44 -44
- data/test_graveyard/system_test_helper.rb +73 -73
- data/test_graveyard/test_helper.rb +93 -93
- data/test_graveyard/unit/busted/configurator_builder_test.rb +569 -569
- data/test_graveyard/unit/busted/configurator_helper_test.rb +234 -234
- data/test_graveyard/unit/busted/configurator_test.rb +232 -232
- data/test_graveyard/unit/busted/configurator_validator_test.rb +169 -169
- data/test_graveyard/unit/busted/deep_merge_fix_test.rb +55 -55
- data/test_graveyard/unit/busted/dependinator_test.rb +129 -129
- data/test_graveyard/unit/busted/file_finder_helper_test.rb +45 -45
- data/test_graveyard/unit/busted/file_finder_test.rb +114 -114
- data/test_graveyard/unit/busted/file_path_utils_test.rb +97 -97
- data/test_graveyard/unit/busted/file_system_utils_test.rb +21 -21
- data/test_graveyard/unit/busted/generator_test.rb +187 -187
- data/test_graveyard/unit/busted/generator_test_results_test.rb +129 -129
- data/test_graveyard/unit/busted/generator_test_runner_test.rb +475 -475
- data/test_graveyard/unit/busted/preprocessinator_file_handler_test.rb +39 -39
- data/test_graveyard/unit/busted/preprocessinator_helper_test.rb +156 -156
- data/test_graveyard/unit/busted/preprocessinator_includes_handler_test.rb +93 -93
- data/test_graveyard/unit/busted/preprocessinator_test.rb +57 -57
- data/test_graveyard/unit/busted/project_file_loader_test.rb +142 -142
- data/test_graveyard/unit/busted/setupinator_test.rb +45 -45
- data/test_graveyard/unit/busted/streaminator_test.rb +49 -49
- data/test_graveyard/unit/busted/task_invoker_test.rb +69 -69
- data/test_graveyard/unit/busted/test_includes_extractor_test.rb +111 -111
- data/test_graveyard/unit/busted/test_invoker_helper_test.rb +62 -62
- data/test_graveyard/unit/busted/test_invoker_test.rb +47 -47
- data/test_graveyard/unit/busted/tool_executor_helper_test.rb +100 -100
- data/test_graveyard/unit/busted/tool_executor_test.rb +351 -351
- data/test_graveyard/unit/busted/verbosinator_test.rb +65 -65
- data/test_graveyard/unit/preprocessinator_extractor_test.rb +731 -731
- data/test_graveyard/unit_test_helper.rb +16 -16
- data/vendor/c_exception/LICENSE.txt +30 -30
- data/vendor/c_exception/README.md +11 -1
- data/vendor/c_exception/docs/CExceptionSummary.odt +0 -0
- data/vendor/c_exception/docs/CExceptionSummary.pdf +0 -0
- data/vendor/c_exception/docs/readme.txt +261 -242
- data/vendor/c_exception/lib/CException.c +46 -46
- data/vendor/c_exception/lib/CException.h +110 -86
- data/vendor/c_exception/makefile +23 -23
- data/vendor/c_exception/test/CExceptionConfig.h +46 -46
- data/vendor/c_exception/test/TestException.c +391 -342
- data/vendor/c_exception/test/TestException_Runner.c +5 -12
- data/vendor/c_exception/vendor/unity/README.md +211 -0
- data/vendor/c_exception/vendor/unity/auto/colour_prompt.rb +1 -1
- data/vendor/c_exception/vendor/unity/auto/colour_reporter.rb +38 -38
- data/vendor/c_exception/vendor/unity/auto/generate_config.yml +36 -36
- data/vendor/c_exception/vendor/unity/auto/generate_module.rb +202 -202
- data/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +391 -320
- data/vendor/c_exception/vendor/unity/auto/parseOutput.rb +2 -0
- data/vendor/c_exception/vendor/unity/auto/stylize_as_junit.rb +260 -0
- data/vendor/c_exception/vendor/unity/auto/type_sanitizer.rb +8 -0
- data/vendor/c_exception/vendor/unity/auto/unity_test_summary.py +135 -0
- data/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb +148 -139
- data/vendor/c_exception/vendor/unity/docs/Unity Summary.odt +0 -0
- data/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf +0 -0
- data/vendor/c_exception/vendor/unity/docs/Unity Summary.txt +224 -216
- data/vendor/c_exception/vendor/unity/docs/license.txt +21 -31
- data/vendor/c_exception/vendor/unity/examples/example_1/makefile +40 -15
- data/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode2.c +2 -0
- data/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +32 -25
- data/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +29 -22
- data/vendor/c_exception/vendor/unity/examples/example_2/makefile +40 -14
- data/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode2.c +2 -0
- data/vendor/c_exception/vendor/unity/examples/example_2/test/test_runners/all_tests.c +2 -2
- data/vendor/c_exception/vendor/unity/examples/example_3/rakefile.rb +0 -1
- data/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode2.c +2 -0
- data/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb +48 -37
- data/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb +179 -179
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +135 -94
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h +13 -17
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +12 -18
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +30 -0
- data/vendor/c_exception/vendor/unity/extras/fixture/test/Makefile +60 -0
- data/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c +4 -3
- data/vendor/c_exception/vendor/unity/extras/fixture/test/{testunity_fixture.c → template_fixture_tests.c} +0 -0
- data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +182 -27
- data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +13 -0
- data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c +8 -6
- data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h +2 -2
- data/vendor/c_exception/vendor/unity/release/build.info +1 -1
- data/vendor/c_exception/vendor/unity/release/version.info +1 -1
- data/vendor/c_exception/vendor/unity/src/unity.c +1333 -1145
- data/vendor/c_exception/vendor/unity/src/unity.h +290 -307
- data/vendor/c_exception/vendor/unity/src/unity_internals.h +758 -620
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c +7 -3
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c +7 -3
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_head1.c +55 -0
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_head1.h +15 -0
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c +4 -3
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c +4 -3
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_head1.c +75 -0
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_head1.h +13 -0
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c +6 -5
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c +4 -3
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c +4 -3
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c +6 -5
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c +4 -3
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c +7 -6
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c +9 -5
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c +7 -3
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c +7 -3
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c +9 -5
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c +7 -3
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c +10 -6
- data/vendor/c_exception/vendor/unity/{rakefile.rb → test/rakefile} +60 -61
- data/vendor/c_exception/vendor/unity/{rakefile_helper.rb → test/rakefile_helper.rb} +255 -249
- data/vendor/c_exception/vendor/unity/test/targets/clang_file.yml +83 -0
- data/vendor/c_exception/vendor/unity/{targets → test/targets}/clang_strict.yml +83 -83
- data/vendor/c_exception/vendor/unity/test/targets/gcc_32.yml +49 -0
- data/vendor/c_exception/vendor/unity/test/targets/gcc_64.yml +50 -0
- data/vendor/c_exception/vendor/unity/{targets/gcc_64.yml → test/targets/gcc_auto_limits.yml} +46 -45
- data/vendor/c_exception/vendor/unity/test/targets/gcc_auto_sizeof.yml +47 -0
- data/vendor/c_exception/vendor/unity/test/targets/gcc_auto_stdint.yml +58 -0
- data/vendor/{cmock/vendor/c_exception/vendor/unity/targets/gcc_64.yml → c_exception/vendor/unity/test/targets/gcc_manual_math.yml} +46 -45
- data/vendor/{cmock/vendor/c_exception/vendor/unity → c_exception/vendor/unity/test}/targets/hitech_picc18.yml +101 -101
- data/vendor/{cmock/vendor/c_exception/vendor/unity → c_exception/vendor/unity/test}/targets/iar_arm_v4.yml +89 -89
- data/vendor/{cmock/vendor/c_exception/vendor/unity → c_exception/vendor/unity/test}/targets/iar_arm_v5.yml +79 -79
- data/vendor/c_exception/vendor/unity/{targets → test/targets}/iar_arm_v5_3.yml +79 -79
- data/vendor/{cmock/vendor/c_exception/vendor/unity → c_exception/vendor/unity/test}/targets/iar_armcortex_LM3S9B92_v5_4.yml +93 -93
- data/vendor/c_exception/vendor/unity/{targets → test/targets}/iar_cortexm3_v5.yml +83 -83
- data/vendor/{cmock/vendor/c_exception/vendor/unity → c_exception/vendor/unity/test}/targets/iar_msp430.yml +94 -94
- data/vendor/c_exception/vendor/unity/{targets → test/targets}/iar_sh2a_v6.yml +85 -85
- data/vendor/c_exception/vendor/unity/test/testdata/mocksample.c +51 -51
- data/vendor/c_exception/vendor/unity/test/testdata/sample.yml +8 -8
- data/vendor/c_exception/vendor/unity/test/testdata/testsample.c +68 -51
- data/vendor/{cmock/vendor/c_exception/vendor/unity/test → c_exception/vendor/unity/test/tests}/test_generate_test_runner.rb +102 -88
- data/vendor/{cmock/vendor/c_exception/vendor/unity/test → c_exception/vendor/unity/test/tests}/testparameterized.c +104 -101
- data/vendor/c_exception/vendor/unity/test/{testunity.c → tests/testunity.c} +3682 -3447
- data/vendor/cmock/docs/CMock_Summary.md +3 -0
- data/vendor/cmock/lib/cmock_config.rb +1 -0
- data/vendor/cmock/lib/cmock_file_writer.rb +7 -3
- data/vendor/cmock/lib/cmock_generator.rb +3 -2
- data/vendor/cmock/lib/cmock_header_parser.rb +12 -5
- data/vendor/cmock/release/version.info +1 -1
- data/vendor/cmock/test/system/test_compilation/parsing.h +3 -0
- data/vendor/cmock/test/unit/cmock_generator_main_test.rb +7 -0
- data/vendor/cmock/test/unit/cmock_header_parser_test.rb +57 -1
- data/vendor/cmock/vendor/c_exception/LICENSE.txt +30 -30
- data/vendor/cmock/vendor/c_exception/README.md +11 -1
- data/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.odt +0 -0
- data/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.pdf +0 -0
- data/vendor/cmock/vendor/c_exception/docs/readme.txt +261 -242
- data/vendor/cmock/vendor/c_exception/lib/CException.c +46 -46
- data/vendor/cmock/vendor/c_exception/lib/CException.h +110 -86
- data/vendor/cmock/vendor/c_exception/makefile +23 -23
- data/vendor/cmock/vendor/c_exception/test/CExceptionConfig.h +46 -46
- data/vendor/cmock/vendor/c_exception/test/TestException.c +391 -342
- data/vendor/cmock/vendor/c_exception/test/TestException_Runner.c +5 -12
- data/vendor/cmock/vendor/c_exception/vendor/unity/README.md +211 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_prompt.rb +1 -1
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_reporter.rb +38 -38
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_config.yml +36 -36
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_module.rb +202 -202
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +391 -320
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/parseOutput.rb +2 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/stylize_as_junit.rb +260 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/type_sanitizer.rb +8 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_test_summary.py +135 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb +148 -139
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.odt +0 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.pdf +0 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/Unity Summary.txt +224 -216
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/license.txt +21 -31
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/makefile +40 -15
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/src/ProductionCode2.c +2 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +32 -25
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +29 -22
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/makefile +40 -14
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/src/ProductionCode2.c +2 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/test/test_runners/all_tests.c +2 -2
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/rakefile.rb +0 -1
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/src/ProductionCode2.c +2 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb +48 -37
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb +179 -179
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +135 -94
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h +13 -17
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +12 -18
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +30 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/Makefile +60 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c +4 -3
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/{testunity_fixture.c → template_fixture_tests.c} +0 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +182 -27
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +13 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c +8 -6
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h +2 -2
- data/vendor/cmock/vendor/c_exception/vendor/unity/release/build.info +1 -1
- data/vendor/cmock/vendor/c_exception/vendor/unity/release/version.info +1 -1
- data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.c +1333 -1145
- data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.h +290 -307
- data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity_internals.h +758 -620
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c +7 -3
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c +7 -3
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_head1.c +55 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_head1.h +15 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c +4 -3
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c +4 -3
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_head1.c +75 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_head1.h +13 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c +6 -5
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c +4 -3
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c +4 -3
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c +6 -5
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c +4 -3
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c +7 -6
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c +9 -5
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c +7 -3
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c +7 -3
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c +9 -5
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c +7 -3
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c +10 -6
- data/vendor/cmock/vendor/c_exception/vendor/unity/{rakefile.rb → test/rakefile} +60 -61
- data/vendor/cmock/vendor/c_exception/vendor/unity/{rakefile_helper.rb → test/rakefile_helper.rb} +255 -249
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/clang_file.yml +83 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/{targets → test/targets}/clang_strict.yml +83 -83
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_32.yml +49 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_64.yml +50 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/{targets/gcc_32.yml → test/targets/gcc_auto_limits.yml} +46 -44
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_auto_sizeof.yml +47 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/gcc_auto_stdint.yml +58 -0
- data/vendor/{c_exception/vendor/unity/targets/gcc_32.yml → cmock/vendor/c_exception/vendor/unity/test/targets/gcc_manual_math.yml} +46 -44
- data/vendor/{c_exception/vendor/unity → cmock/vendor/c_exception/vendor/unity/test}/targets/hitech_picc18.yml +101 -101
- data/vendor/{c_exception/vendor/unity → cmock/vendor/c_exception/vendor/unity/test}/targets/iar_arm_v4.yml +89 -89
- data/vendor/{c_exception/vendor/unity → cmock/vendor/c_exception/vendor/unity/test}/targets/iar_arm_v5.yml +79 -79
- data/vendor/cmock/vendor/c_exception/vendor/unity/{targets → test/targets}/iar_arm_v5_3.yml +79 -79
- data/vendor/{c_exception/vendor/unity → cmock/vendor/c_exception/vendor/unity/test}/targets/iar_armcortex_LM3S9B92_v5_4.yml +93 -93
- data/vendor/cmock/vendor/c_exception/vendor/unity/{targets → test/targets}/iar_cortexm3_v5.yml +83 -83
- data/vendor/{c_exception/vendor/unity → cmock/vendor/c_exception/vendor/unity/test}/targets/iar_msp430.yml +94 -94
- data/vendor/cmock/vendor/c_exception/vendor/unity/{targets → test/targets}/iar_sh2a_v6.yml +85 -85
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/mocksample.c +51 -51
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/sample.yml +8 -8
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testsample.c +68 -51
- data/vendor/{c_exception/vendor/unity/test → cmock/vendor/c_exception/vendor/unity/test/tests}/test_generate_test_runner.rb +102 -88
- data/vendor/{c_exception/vendor/unity/test → cmock/vendor/c_exception/vendor/unity/test/tests}/testparameterized.c +104 -101
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/{testunity.c → tests/testunity.c} +3682 -3447
- data/vendor/cmock/vendor/unity/auto/generate_test_runner.rb +30 -13
- data/vendor/cmock/vendor/unity/auto/stylize_as_junit.rb +260 -0
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c +96 -93
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h +1 -1
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h +12 -19
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +18 -17
- data/vendor/cmock/vendor/unity/extras/fixture/test/Makefile +66 -5
- data/vendor/cmock/vendor/unity/extras/fixture/test/main/AllTests.c +2 -1
- data/vendor/cmock/vendor/unity/extras/fixture/test/{testunity_fixture.c → template_fixture_tests.c} +0 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c +187 -27
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +14 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.c +6 -5
- data/vendor/cmock/vendor/unity/release/version.info +1 -1
- data/vendor/cmock/vendor/unity/src/unity.c +38 -27
- data/vendor/cmock/vendor/unity/src/unity.h +5 -0
- data/vendor/cmock/vendor/unity/src/unity_internals.h +22 -18
- data/vendor/cmock/vendor/unity/test/Makefile +52 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_cmd.c +4 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_def.c +4 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_head1.c +4 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_head1.h +7 -4
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_head1.h +6 -4
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_new1.c +4 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_new2.c +4 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_param.c +4 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_run1.c +4 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_run2.c +4 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_yaml.c +4 -0
- data/vendor/cmock/vendor/unity/test/rakefile_helper.rb +1 -1
- data/vendor/cmock/vendor/unity/test/targets/clang_file.yml +0 -1
- data/vendor/cmock/vendor/unity/test/targets/clang_strict.yml +0 -1
- data/vendor/cmock/vendor/unity/test/targets/gcc_32.yml +0 -1
- data/vendor/cmock/vendor/unity/test/targets/gcc_64.yml +0 -1
- data/vendor/cmock/vendor/unity/test/targets/gcc_auto_limits.yml +0 -1
- data/vendor/cmock/vendor/unity/test/targets/gcc_auto_sizeof.yml +0 -1
- data/vendor/cmock/vendor/unity/test/targets/gcc_auto_stdint.yml +0 -1
- data/vendor/cmock/vendor/unity/test/targets/gcc_manual_math.yml +0 -1
- data/vendor/cmock/vendor/unity/test/testdata/testsample.c +19 -2
- data/vendor/cmock/vendor/unity/test/tests/testunity.c +55 -4
- data/vendor/unity/auto/generate_test_runner.rb +4 -2
- data/vendor/unity/auto/stylize_as_junit.rb +260 -0
- data/vendor/unity/extras/fixture/src/unity_fixture.c +24 -41
- data/vendor/unity/extras/fixture/src/unity_fixture.h +1 -1
- data/vendor/unity/extras/fixture/src/unity_fixture_internals.h +5 -7
- data/vendor/unity/extras/fixture/test/Makefile +53 -8
- data/vendor/unity/extras/fixture/test/{testunity_fixture.c → template_fixture_tests.c} +0 -0
- data/vendor/unity/extras/fixture/test/unity_fixture_Test.c +129 -32
- data/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +6 -0
- data/vendor/unity/extras/fixture/test/unity_output_Spy.c +4 -4
- data/vendor/unity/release/version.info +1 -1
- data/vendor/unity/src/unity.c +32 -21
- data/vendor/unity/src/unity.h +5 -0
- data/vendor/unity/src/unity_internals.h +7 -3
- data/vendor/unity/test/Makefile +52 -0
- data/vendor/unity/test/expectdata/testsample_cmd.c +4 -0
- data/vendor/unity/test/expectdata/testsample_def.c +4 -0
- data/vendor/unity/test/expectdata/testsample_head1.c +4 -0
- data/vendor/unity/test/expectdata/testsample_head1.h +7 -4
- data/vendor/unity/test/expectdata/testsample_mock_head1.h +6 -4
- data/vendor/unity/test/expectdata/testsample_new1.c +4 -0
- data/vendor/unity/test/expectdata/testsample_new2.c +4 -0
- data/vendor/unity/test/expectdata/testsample_param.c +4 -0
- data/vendor/unity/test/expectdata/testsample_run1.c +4 -0
- data/vendor/unity/test/expectdata/testsample_run2.c +4 -0
- data/vendor/unity/test/expectdata/testsample_yaml.c +4 -0
- data/vendor/unity/test/testdata/testsample.c +19 -2
- data/vendor/unity/test/tests/testunity.c +35 -4
- metadata +75 -52
- data/ceedling-0.18.0.gem +0 -0
- data/docs/CeedlingLogo.png +0 -0
- data/vendor/c_exception/vendor/unity/Gemfile +0 -4
- data/vendor/c_exception/vendor/unity/Gemfile.lock +0 -12
- data/vendor/c_exception/vendor/unity/examples/example_3/makefile +0 -41
- data/vendor/c_exception/vendor/unity/examples/example_3/test/no_ruby/TestProductionCode2_Runner.c +0 -46
- data/vendor/c_exception/vendor/unity/examples/example_3/test/no_ruby/TestProductionCode_Runner.c +0 -50
- data/vendor/c_exception/vendor/unity/makefile +0 -37
- data/vendor/cmock/vendor/c_exception/vendor/unity/Gemfile +0 -4
- data/vendor/cmock/vendor/c_exception/vendor/unity/Gemfile.lock +0 -12
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/makefile +0 -41
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/test/no_ruby/TestProductionCode2_Runner.c +0 -46
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/test/no_ruby/TestProductionCode_Runner.c +0 -50
- data/vendor/cmock/vendor/c_exception/vendor/unity/makefile +0 -37
@@ -1,320 +1,391 @@
|
|
1
|
-
# ==========================================
|
2
|
-
# Unity Project - A Test Framework for C
|
3
|
-
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
|
4
|
-
# [Released under MIT License. Please refer to license.txt for details]
|
5
|
-
# ==========================================
|
6
|
-
|
7
|
-
$QUICK_RUBY_VERSION = RUBY_VERSION.split('.').inject(0){|vv,v| vv * 100 + v.to_i }
|
8
|
-
File.expand_path(File.join(File.dirname(__FILE__),'colour_prompt'))
|
9
|
-
|
10
|
-
class UnityTestRunnerGenerator
|
11
|
-
|
12
|
-
def initialize(options = nil)
|
13
|
-
@options =
|
14
|
-
case(options)
|
15
|
-
when NilClass then @options
|
16
|
-
when String then @options.merge!(UnityTestRunnerGenerator.grab_config(options))
|
17
|
-
when Hash then @options.merge!(options)
|
18
|
-
else raise "If you specify arguments, it should be a filename or a hash of options"
|
19
|
-
end
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
#
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
end
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
output.puts("\
|
163
|
-
output.puts("
|
164
|
-
output.puts(
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
output.puts("}
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
output.puts("
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
output.puts("static
|
216
|
-
output.puts("{")
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
output.puts("
|
255
|
-
output.puts("
|
256
|
-
output.puts("
|
257
|
-
output.puts("
|
258
|
-
output.puts("
|
259
|
-
output.puts("
|
260
|
-
output.puts("
|
261
|
-
output.puts("
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
output.puts("
|
266
|
-
output.puts("
|
267
|
-
output.puts("{")
|
268
|
-
output.puts("
|
269
|
-
output.puts("
|
270
|
-
output.puts("
|
271
|
-
if (
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
output.puts()
|
283
|
-
output.puts("
|
284
|
-
output.puts("
|
285
|
-
output.puts("
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
#
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
1
|
+
# ==========================================
|
2
|
+
# Unity Project - A Test Framework for C
|
3
|
+
# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
|
4
|
+
# [Released under MIT License. Please refer to license.txt for details]
|
5
|
+
# ==========================================
|
6
|
+
|
7
|
+
$QUICK_RUBY_VERSION = RUBY_VERSION.split('.').inject(0){|vv,v| vv * 100 + v.to_i }
|
8
|
+
File.expand_path(File.join(File.dirname(__FILE__),'colour_prompt'))
|
9
|
+
|
10
|
+
class UnityTestRunnerGenerator
|
11
|
+
|
12
|
+
def initialize(options = nil)
|
13
|
+
@options = UnityTestRunnerGenerator.default_options
|
14
|
+
case(options)
|
15
|
+
when NilClass then @options
|
16
|
+
when String then @options.merge!(UnityTestRunnerGenerator.grab_config(options))
|
17
|
+
when Hash then @options.merge!(options)
|
18
|
+
else raise "If you specify arguments, it should be a filename or a hash of options"
|
19
|
+
end
|
20
|
+
require "#{File.expand_path(File.dirname(__FILE__))}/type_sanitizer"
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.default_options
|
24
|
+
{
|
25
|
+
:includes => [],
|
26
|
+
:plugins => [],
|
27
|
+
:framework => :unity,
|
28
|
+
:test_prefix => "test|spec|should",
|
29
|
+
:setup_name => "setUp",
|
30
|
+
:teardown_name => "tearDown",
|
31
|
+
:main_name => "main",
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.grab_config(config_file)
|
36
|
+
options = self.default_options
|
37
|
+
unless (config_file.nil? or config_file.empty?)
|
38
|
+
require 'yaml'
|
39
|
+
yaml_guts = YAML.load_file(config_file)
|
40
|
+
options.merge!(yaml_guts[:unity] || yaml_guts[:cmock])
|
41
|
+
raise "No :unity or :cmock section found in #{config_file}" unless options
|
42
|
+
end
|
43
|
+
return(options)
|
44
|
+
end
|
45
|
+
|
46
|
+
def run(input_file, output_file, options=nil)
|
47
|
+
tests = []
|
48
|
+
testfile_includes = []
|
49
|
+
used_mocks = []
|
50
|
+
|
51
|
+
@options.merge!(options) unless options.nil?
|
52
|
+
module_name = File.basename(input_file)
|
53
|
+
|
54
|
+
#pull required data from source file
|
55
|
+
source = File.read(input_file)
|
56
|
+
source = source.force_encoding("ISO-8859-1").encode("utf-8", :replace => nil) if ($QUICK_RUBY_VERSION > 10900)
|
57
|
+
tests = find_tests(source)
|
58
|
+
headers = find_includes(source)
|
59
|
+
testfile_includes = (headers[:local] + headers[:system])
|
60
|
+
used_mocks = find_mocks(testfile_includes)
|
61
|
+
testfile_includes = (testfile_includes - used_mocks)
|
62
|
+
testfile_includes.delete_if{|inc| inc =~ /(unity|cmock)/}
|
63
|
+
|
64
|
+
#build runner file
|
65
|
+
generate(input_file, output_file, tests, used_mocks, testfile_includes)
|
66
|
+
|
67
|
+
#determine which files were used to return them
|
68
|
+
all_files_used = [input_file, output_file]
|
69
|
+
all_files_used += testfile_includes.map {|filename| filename + '.c'} unless testfile_includes.empty?
|
70
|
+
all_files_used += @options[:includes] unless @options[:includes].empty?
|
71
|
+
return all_files_used.uniq
|
72
|
+
end
|
73
|
+
|
74
|
+
def generate(input_file, output_file, tests, used_mocks, testfile_includes)
|
75
|
+
File.open(output_file, 'w') do |output|
|
76
|
+
create_header(output, used_mocks, testfile_includes)
|
77
|
+
create_externs(output, tests, used_mocks)
|
78
|
+
create_mock_management(output, used_mocks)
|
79
|
+
create_suite_setup_and_teardown(output)
|
80
|
+
create_reset(output, used_mocks)
|
81
|
+
create_main(output, input_file, tests, used_mocks)
|
82
|
+
end
|
83
|
+
|
84
|
+
if (@options[:header_file] && !@options[:header_file].empty?)
|
85
|
+
File.open(@options[:header_file], 'w') do |output|
|
86
|
+
create_h_file(output, @options[:header_file], tests, testfile_includes, used_mocks)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def find_tests(source)
|
92
|
+
tests_and_line_numbers = []
|
93
|
+
|
94
|
+
source_scrubbed = source.clone
|
95
|
+
source_scrubbed = source_scrubbed.gsub(/"[^"]*"/, '') # remove things in strings
|
96
|
+
source_scrubbed = source_scrubbed.gsub(/\/\/.*$/, '') # remove line comments
|
97
|
+
source_scrubbed = source_scrubbed.gsub(/\/\*.*?\*\//m, '') # remove block comments
|
98
|
+
lines = source_scrubbed.split(/(^\s*\#.*$) # Treat preprocessor directives as a logical line
|
99
|
+
| (;|\{|\}) /x) # Match ;, {, and } as end of lines
|
100
|
+
|
101
|
+
lines.each_with_index do |line, index|
|
102
|
+
#find tests
|
103
|
+
if line =~ /^((?:\s*TEST_CASE\s*\(.*?\)\s*)*)\s*void\s+((?:#{@options[:test_prefix]}).*)\s*\(\s*(.*)\s*\)/
|
104
|
+
arguments = $1
|
105
|
+
name = $2
|
106
|
+
call = $3
|
107
|
+
params = $4
|
108
|
+
args = nil
|
109
|
+
if (@options[:use_param_tests] and !arguments.empty?)
|
110
|
+
args = []
|
111
|
+
arguments.scan(/\s*TEST_CASE\s*\((.*)\)\s*$/) {|a| args << a[0]}
|
112
|
+
end
|
113
|
+
tests_and_line_numbers << { :test => name, :args => args, :call => call, :params => params, :line_number => 0 }
|
114
|
+
end
|
115
|
+
end
|
116
|
+
tests_and_line_numbers.uniq! {|v| v[:test] }
|
117
|
+
|
118
|
+
#determine line numbers and create tests to run
|
119
|
+
source_lines = source.split("\n")
|
120
|
+
source_index = 0;
|
121
|
+
tests_and_line_numbers.size.times do |i|
|
122
|
+
source_lines[source_index..-1].each_with_index do |line, index|
|
123
|
+
if (line =~ /#{tests_and_line_numbers[i][:test]}/)
|
124
|
+
source_index += index
|
125
|
+
tests_and_line_numbers[i][:line_number] = source_index + 1
|
126
|
+
break
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
|
131
|
+
return tests_and_line_numbers
|
132
|
+
end
|
133
|
+
|
134
|
+
def find_includes(source)
|
135
|
+
|
136
|
+
#remove comments (block and line, in three steps to ensure correct precedence)
|
137
|
+
source.gsub!(/\/\/(?:.+\/\*|\*(?:$|[^\/])).*$/, '') # remove line comments that comment out the start of blocks
|
138
|
+
source.gsub!(/\/\*.*?\*\//m, '') # remove block comments
|
139
|
+
source.gsub!(/\/\/.*$/, '') # remove line comments (all that remain)
|
140
|
+
|
141
|
+
#parse out includes
|
142
|
+
includes = {
|
143
|
+
:local => source.scan(/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/).flatten,
|
144
|
+
:system => source.scan(/^\s*#include\s+<\s*(.+)\s*>/).flatten.map { |inc| "<#{inc}>" }
|
145
|
+
}
|
146
|
+
return includes
|
147
|
+
end
|
148
|
+
|
149
|
+
def find_mocks(includes)
|
150
|
+
mock_headers = []
|
151
|
+
includes.each do |include_path|
|
152
|
+
include_file = File.basename(include_path)
|
153
|
+
mock_headers << include_path if (include_file =~ /^mock/i)
|
154
|
+
end
|
155
|
+
return mock_headers
|
156
|
+
end
|
157
|
+
|
158
|
+
def create_header(output, mocks, testfile_includes=[])
|
159
|
+
output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */')
|
160
|
+
create_runtest(output, mocks)
|
161
|
+
output.puts("\n//=======Automagically Detected Files To Include=====")
|
162
|
+
output.puts("#include \"#{@options[:framework].to_s}.h\"")
|
163
|
+
output.puts('#include "cmock.h"') unless (mocks.empty?)
|
164
|
+
output.puts('#include <setjmp.h>')
|
165
|
+
output.puts('#include <stdio.h>')
|
166
|
+
output.puts('#include "CException.h"') if @options[:plugins].include?(:cexception)
|
167
|
+
if (@options[:header_file] && !@options[:header_file].empty?)
|
168
|
+
output.puts("#include \"#{File.basename(@options[:header_file])}\"")
|
169
|
+
else
|
170
|
+
@options[:includes].flatten.uniq.compact.each do |inc|
|
171
|
+
output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}")
|
172
|
+
end
|
173
|
+
testfile_includes.each do |inc|
|
174
|
+
output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}")
|
175
|
+
end
|
176
|
+
end
|
177
|
+
mocks.each do |mock|
|
178
|
+
output.puts("#include \"#{mock.gsub('.h','')}.h\"")
|
179
|
+
end
|
180
|
+
if @options[:enforce_strict_ordering]
|
181
|
+
output.puts('')
|
182
|
+
output.puts('int GlobalExpectCount;')
|
183
|
+
output.puts('int GlobalVerifyOrder;')
|
184
|
+
output.puts('char* GlobalOrderError;')
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
def create_externs(output, tests, mocks)
|
189
|
+
output.puts("\n//=======External Functions This Runner Calls=====")
|
190
|
+
output.puts("extern void #{@options[:setup_name]}(void);")
|
191
|
+
output.puts("extern void #{@options[:teardown_name]}(void);")
|
192
|
+
tests.each do |test|
|
193
|
+
output.puts("extern void #{test[:test]}(#{test[:call] || 'void'});")
|
194
|
+
end
|
195
|
+
output.puts('')
|
196
|
+
end
|
197
|
+
|
198
|
+
def create_mock_management(output, mock_headers)
|
199
|
+
unless (mock_headers.empty?)
|
200
|
+
output.puts("\n//=======Mock Management=====")
|
201
|
+
output.puts("static void CMock_Init(void)")
|
202
|
+
output.puts("{")
|
203
|
+
if @options[:enforce_strict_ordering]
|
204
|
+
output.puts(" GlobalExpectCount = 0;")
|
205
|
+
output.puts(" GlobalVerifyOrder = 0;")
|
206
|
+
output.puts(" GlobalOrderError = NULL;")
|
207
|
+
end
|
208
|
+
mocks = mock_headers.map {|mock| File.basename(mock)}
|
209
|
+
mocks.each do |mock|
|
210
|
+
mock_clean = TypeSanitizer.sanitize_c_identifier(mock)
|
211
|
+
output.puts(" #{mock_clean}_Init();")
|
212
|
+
end
|
213
|
+
output.puts("}\n")
|
214
|
+
|
215
|
+
output.puts("static void CMock_Verify(void)")
|
216
|
+
output.puts("{")
|
217
|
+
mocks.each do |mock|
|
218
|
+
mock_clean = TypeSanitizer.sanitize_c_identifier(mock)
|
219
|
+
output.puts(" #{mock_clean}_Verify();")
|
220
|
+
end
|
221
|
+
output.puts("}\n")
|
222
|
+
|
223
|
+
output.puts("static void CMock_Destroy(void)")
|
224
|
+
output.puts("{")
|
225
|
+
mocks.each do |mock|
|
226
|
+
mock_clean = TypeSanitizer.sanitize_c_identifier(mock)
|
227
|
+
output.puts(" #{mock_clean}_Destroy();")
|
228
|
+
end
|
229
|
+
output.puts("}\n")
|
230
|
+
end
|
231
|
+
end
|
232
|
+
|
233
|
+
def create_suite_setup_and_teardown(output)
|
234
|
+
unless (@options[:suite_setup].nil?)
|
235
|
+
output.puts("\n//=======Suite Setup=====")
|
236
|
+
output.puts("static int suite_setup(void)")
|
237
|
+
output.puts("{")
|
238
|
+
output.puts(@options[:suite_setup])
|
239
|
+
output.puts("}")
|
240
|
+
end
|
241
|
+
unless (@options[:suite_teardown].nil?)
|
242
|
+
output.puts("\n//=======Suite Teardown=====")
|
243
|
+
output.puts("static int suite_teardown(int num_failures)")
|
244
|
+
output.puts("{")
|
245
|
+
output.puts(@options[:suite_teardown])
|
246
|
+
output.puts("}")
|
247
|
+
end
|
248
|
+
end
|
249
|
+
|
250
|
+
def create_runtest(output, used_mocks)
|
251
|
+
cexception = @options[:plugins].include? :cexception
|
252
|
+
va_args1 = @options[:use_param_tests] ? ', ...' : ''
|
253
|
+
va_args2 = @options[:use_param_tests] ? '__VA_ARGS__' : ''
|
254
|
+
output.puts("\n//=======Test Runner Used To Run Each Test Below=====")
|
255
|
+
output.puts("#define RUN_TEST_NO_ARGS") if @options[:use_param_tests]
|
256
|
+
output.puts("#define RUN_TEST(TestFunc, TestLineNum#{va_args1}) \\")
|
257
|
+
output.puts("{ \\")
|
258
|
+
output.puts(" Unity.CurrentTestName = #TestFunc#{va_args2.empty? ? '' : " \"(\" ##{va_args2} \")\""}; \\")
|
259
|
+
output.puts(" Unity.CurrentTestLineNumber = TestLineNum; \\")
|
260
|
+
output.puts(" Unity.NumberOfTests++; \\")
|
261
|
+
output.puts(" CMock_Init(); \\") unless (used_mocks.empty?)
|
262
|
+
output.puts(" UNITY_CLR_DETAILS(); \\") unless (used_mocks.empty?)
|
263
|
+
output.puts(" if (TEST_PROTECT()) \\")
|
264
|
+
output.puts(" { \\")
|
265
|
+
output.puts(" CEXCEPTION_T e; \\") if cexception
|
266
|
+
output.puts(" Try { \\") if cexception
|
267
|
+
output.puts(" #{@options[:setup_name]}(); \\")
|
268
|
+
output.puts(" TestFunc(#{va_args2}); \\")
|
269
|
+
output.puts(" } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, \"Unhandled Exception!\"); } \\") if cexception
|
270
|
+
output.puts(" } \\")
|
271
|
+
output.puts(" if (TEST_PROTECT() && !TEST_IS_IGNORED) \\")
|
272
|
+
output.puts(" { \\")
|
273
|
+
output.puts(" #{@options[:teardown_name]}(); \\")
|
274
|
+
output.puts(" CMock_Verify(); \\") unless (used_mocks.empty?)
|
275
|
+
output.puts(" } \\")
|
276
|
+
output.puts(" CMock_Destroy(); \\") unless (used_mocks.empty?)
|
277
|
+
output.puts(" UnityConcludeTest(); \\")
|
278
|
+
output.puts("}\n")
|
279
|
+
end
|
280
|
+
|
281
|
+
def create_reset(output, used_mocks)
|
282
|
+
output.puts("\n//=======Test Reset Option=====")
|
283
|
+
output.puts("void resetTest(void);")
|
284
|
+
output.puts("void resetTest(void)")
|
285
|
+
output.puts("{")
|
286
|
+
output.puts(" CMock_Verify();") unless (used_mocks.empty?)
|
287
|
+
output.puts(" CMock_Destroy();") unless (used_mocks.empty?)
|
288
|
+
output.puts(" #{@options[:teardown_name]}();")
|
289
|
+
output.puts(" CMock_Init();") unless (used_mocks.empty?)
|
290
|
+
output.puts(" #{@options[:setup_name]}();")
|
291
|
+
output.puts("}")
|
292
|
+
end
|
293
|
+
|
294
|
+
def create_main(output, filename, tests, used_mocks)
|
295
|
+
output.puts("\n\n//=======MAIN=====")
|
296
|
+
if (@options[:main_name] != "main")
|
297
|
+
output.puts("int #{@options[:main_name]}(void);")
|
298
|
+
end
|
299
|
+
output.puts("int #{@options[:main_name]}(void)")
|
300
|
+
output.puts("{")
|
301
|
+
output.puts(" suite_setup();") unless @options[:suite_setup].nil?
|
302
|
+
output.puts(" UnityBegin(\"#{filename.gsub(/\\/,'\\\\')}\");")
|
303
|
+
if (@options[:use_param_tests])
|
304
|
+
tests.each do |test|
|
305
|
+
if ((test[:args].nil?) or (test[:args].empty?))
|
306
|
+
output.puts(" RUN_TEST(#{test[:test]}, #{test[:line_number]}, RUN_TEST_NO_ARGS);")
|
307
|
+
else
|
308
|
+
test[:args].each {|args| output.puts(" RUN_TEST(#{test[:test]}, #{test[:line_number]}, #{args});")}
|
309
|
+
end
|
310
|
+
end
|
311
|
+
else
|
312
|
+
tests.each { |test| output.puts(" RUN_TEST(#{test[:test]}, #{test[:line_number]});") }
|
313
|
+
end
|
314
|
+
output.puts()
|
315
|
+
output.puts(" CMock_Guts_MemFreeFinal();") unless used_mocks.empty?
|
316
|
+
output.puts(" return #{@options[:suite_teardown].nil? ? "" : "suite_teardown"}(UnityEnd());")
|
317
|
+
output.puts("}")
|
318
|
+
end
|
319
|
+
|
320
|
+
def create_h_file(output, filename, tests, testfile_includes, used_mocks)
|
321
|
+
filename = File.basename(filename).gsub(/[-\/\\\.\,\s]/, "_").upcase
|
322
|
+
output.puts("/* AUTOGENERATED FILE. DO NOT EDIT. */")
|
323
|
+
output.puts("#ifndef _#{filename}")
|
324
|
+
output.puts("#define _#{filename}\n\n")
|
325
|
+
output.puts("#include \"#{@options[:framework].to_s}.h\"")
|
326
|
+
output.puts('#include "cmock.h"') unless (used_mocks.empty?)
|
327
|
+
@options[:includes].flatten.uniq.compact.each do |inc|
|
328
|
+
output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}")
|
329
|
+
end
|
330
|
+
testfile_includes.each do |inc|
|
331
|
+
output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}")
|
332
|
+
end
|
333
|
+
output.puts "\n"
|
334
|
+
tests.each do |test|
|
335
|
+
if ((test[:params].nil?) or (test[:params].empty?))
|
336
|
+
output.puts("void #{test[:test]}(void);")
|
337
|
+
else
|
338
|
+
output.puts("void #{test[:test]}(#{test[:params]});")
|
339
|
+
end
|
340
|
+
end
|
341
|
+
output.puts("#endif\n\n")
|
342
|
+
end
|
343
|
+
end
|
344
|
+
|
345
|
+
if ($0 == __FILE__)
|
346
|
+
options = { :includes => [] }
|
347
|
+
yaml_file = nil
|
348
|
+
|
349
|
+
#parse out all the options first (these will all be removed as we go)
|
350
|
+
ARGV.reject! do |arg|
|
351
|
+
case(arg)
|
352
|
+
when '-cexception'
|
353
|
+
options[:plugins] = [:cexception]; true
|
354
|
+
when /\.*\.ya?ml/
|
355
|
+
options = UnityTestRunnerGenerator.grab_config(arg); true
|
356
|
+
when /--(\w+)=\"?(.*)\"?/
|
357
|
+
options[$1.to_sym] = $2; true
|
358
|
+
when /\.*\.h/
|
359
|
+
options[:includes] << arg; true
|
360
|
+
else false
|
361
|
+
end
|
362
|
+
end
|
363
|
+
|
364
|
+
#make sure there is at least one parameter left (the input file)
|
365
|
+
if !ARGV[0]
|
366
|
+
puts ["\nusage: ruby #{__FILE__} (files) (options) input_test_file (output)",
|
367
|
+
"\n input_test_file - this is the C file you want to create a runner for",
|
368
|
+
" output - this is the name of the runner file to generate",
|
369
|
+
" defaults to (input_test_file)_Runner",
|
370
|
+
" files:",
|
371
|
+
" *.yml / *.yaml - loads configuration from here in :unity or :cmock",
|
372
|
+
" *.h - header files are added as #includes in runner",
|
373
|
+
" options:",
|
374
|
+
" -cexception - include cexception support",
|
375
|
+
" --setup_name=\"\" - redefine setUp func name to something else",
|
376
|
+
" --teardown_name=\"\" - redefine tearDown func name to something else",
|
377
|
+
" --main_name=\"\" - redefine main func name to something else",
|
378
|
+
" --test_prefix=\"\" - redefine test prefix from default test|spec|should",
|
379
|
+
" --suite_setup=\"\" - code to execute for setup of entire suite",
|
380
|
+
" --suite_teardown=\"\" - code to execute for teardown of entire suite",
|
381
|
+
" --use_param_tests=1 - enable parameterized tests (disabled by default)",
|
382
|
+
" --header_file=\"\" - path/name of test header file to generate too"
|
383
|
+
].join("\n")
|
384
|
+
exit 1
|
385
|
+
end
|
386
|
+
|
387
|
+
#create the default test runner name if not specified
|
388
|
+
ARGV[1] = ARGV[0].gsub(".c","_Runner.c") if (!ARGV[1])
|
389
|
+
|
390
|
+
UnityTestRunnerGenerator.new(options).run(ARGV[0], ARGV[1])
|
391
|
+
end
|