ceedling 0.13.0.rc1 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +32 -0
- data/README.md +8 -8
- data/assets/example_file.c +5 -0
- data/assets/example_file.h +6 -0
- data/assets/project_as_gem.yml +71 -0
- data/assets/{project.yml → project_with_guts.yml} +2 -0
- data/assets/rakefile_as_gem.rb +1 -0
- data/assets/{rakefile.rb → rakefile_with_guts.rb} +0 -0
- data/assets/test_example_file.c +13 -0
- data/bin/ceedling +55 -31
- data/ceedling-0.13.0.rc4.gem +0 -0
- data/ceedling.gemspec +13 -12
- data/ceedling.sublime-project +8 -0
- data/ceedling.sublime-workspace +365 -0
- data/examples/temp_sensor/project.yml +3 -4
- data/lib/ceedling.rb +13 -4
- data/lib/ceedling/version.rb +3 -3
- data/lib/project_file_loader.rb +1 -1
- data/lib/rakefile.rb +14 -1
- data/lib/target_loader.rb +38 -0
- data/plugins/bullseye/{template.erb → assets/template.erb} +0 -0
- data/plugins/bullseye/{defaults.yml → config/defaults.yml} +0 -0
- data/plugins/bullseye/{bullseye.rb → lib/bullseye.rb} +9 -10
- data/spec/spec_system_helper.rb +192 -0
- data/spec/system/deployment_spec.rb +116 -0
- data/tags +977 -0
- data/vendor/c_exception/docs/CExceptionSummary.odt +0 -0
- data/vendor/c_exception/docs/CExceptionSummary.pdf +0 -0
- data/vendor/c_exception/docs/license.txt +30 -0
- data/vendor/c_exception/docs/readme.txt +242 -0
- data/vendor/c_exception/makefile +24 -0
- data/vendor/c_exception/rakefile.rb +41 -0
- data/vendor/c_exception/test/CExceptionConfig.h +44 -0
- data/vendor/c_exception/test/TestException.c +328 -0
- data/vendor/c_exception/test/TestException_Runner.c +57 -0
- data/vendor/c_exception/vendor/unity/auto/colour_prompt.rb +94 -0
- data/vendor/c_exception/vendor/unity/auto/colour_reporter.rb +39 -0
- data/vendor/c_exception/vendor/unity/auto/generate_config.yml +36 -0
- data/vendor/c_exception/vendor/unity/auto/generate_module.rb +202 -0
- data/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +313 -0
- data/vendor/c_exception/vendor/unity/auto/test_file_filter.rb +23 -0
- data/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb +139 -0
- 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 +217 -0
- data/vendor/c_exception/vendor/unity/docs/license.txt +31 -0
- data/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.c +10 -0
- data/vendor/c_exception/vendor/unity/examples/helper/UnityHelper.h +12 -0
- data/vendor/c_exception/vendor/unity/examples/makefile +40 -0
- data/vendor/c_exception/vendor/unity/examples/rakefile.rb +32 -0
- data/vendor/c_exception/vendor/unity/examples/rakefile_helper.rb +256 -0
- data/vendor/c_exception/vendor/unity/examples/readme.txt +18 -0
- data/vendor/c_exception/vendor/unity/examples/src/ProductionCode.c +24 -0
- data/vendor/c_exception/vendor/unity/examples/src/ProductionCode.h +3 -0
- data/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.c +9 -0
- data/vendor/c_exception/vendor/unity/examples/src/ProductionCode2.h +2 -0
- data/vendor/c_exception/vendor/unity/examples/test/TestProductionCode.c +62 -0
- data/vendor/c_exception/vendor/unity/examples/test/TestProductionCode2.c +31 -0
- data/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c +46 -0
- data/vendor/c_exception/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c +50 -0
- data/vendor/c_exception/vendor/unity/extras/fixture/build/MakefileWorker.mk +331 -0
- data/vendor/c_exception/vendor/unity/extras/fixture/build/filterGcov.sh +61 -0
- data/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb +37 -0
- data/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb +178 -0
- data/vendor/c_exception/vendor/unity/extras/fixture/readme.txt +9 -0
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +381 -0
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h +81 -0
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +44 -0
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +16 -0
- data/vendor/c_exception/vendor/unity/extras/fixture/test/main/AllTests.c +21 -0
- data/vendor/c_exception/vendor/unity/extras/fixture/test/testunity_fixture.c +39 -0
- data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +321 -0
- data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +40 -0
- data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.c +56 -0
- data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_output_Spy.h +17 -0
- data/vendor/c_exception/vendor/unity/makefile +35 -0
- data/vendor/c_exception/vendor/unity/rakefile.rb +59 -0
- data/vendor/c_exception/vendor/unity/rakefile_helper.rb +240 -0
- data/vendor/c_exception/vendor/unity/release/build.info +2 -0
- data/vendor/c_exception/vendor/unity/release/version.info +2 -0
- data/vendor/c_exception/vendor/unity/src/unity.c +979 -0
- data/vendor/c_exception/vendor/unity/src/unity.h +232 -0
- data/vendor/c_exception/vendor/unity/src/unity_internals.h +424 -0
- data/vendor/c_exception/vendor/unity/targets/gcc.yml +43 -0
- data/vendor/c_exception/vendor/unity/targets/gcc_64.yml +44 -0
- data/vendor/c_exception/vendor/unity/targets/hitech_picc18.yml +101 -0
- data/vendor/c_exception/vendor/unity/targets/iar_arm_v4.yml +89 -0
- data/vendor/c_exception/vendor/unity/targets/iar_arm_v5.yml +79 -0
- data/vendor/c_exception/vendor/unity/targets/iar_arm_v5_3.yml +79 -0
- data/vendor/c_exception/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml +93 -0
- data/vendor/c_exception/vendor/unity/targets/iar_cortexm3_v5.yml +83 -0
- data/vendor/c_exception/vendor/unity/targets/iar_msp430.yml +94 -0
- data/vendor/c_exception/vendor/unity/targets/iar_sh2a_v6.yml +85 -0
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_cmd.c +54 -0
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_def.c +50 -0
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_cmd.c +76 -0
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_def.c +72 -0
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new1.c +85 -0
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_new2.c +85 -0
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_param.c +73 -0
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run1.c +85 -0
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_run2.c +85 -0
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_mock_yaml.c +86 -0
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_new1.c +60 -0
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_new2.c +63 -0
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_param.c +51 -0
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_run1.c +60 -0
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_run2.c +63 -0
- data/vendor/c_exception/vendor/unity/test/expectdata/testsample_yaml.c +64 -0
- data/vendor/c_exception/vendor/unity/test/test_generate_test_runner.rb +94 -0
- data/vendor/c_exception/vendor/unity/test/testdata/mocksample.c +51 -0
- data/vendor/c_exception/vendor/unity/test/testdata/sample.yml +9 -0
- data/vendor/c_exception/vendor/unity/test/testdata/testsample.c +51 -0
- data/vendor/c_exception/vendor/unity/test/testparameterized.c +101 -0
- data/vendor/c_exception/vendor/unity/test/testunity.c +2024 -0
- data/vendor/cmock/docs/CMock Summary.odt +0 -0
- data/vendor/cmock/docs/CMock Summary.pdf +0 -0
- data/vendor/cmock/docs/CMock_Summary.md +356 -0
- data/vendor/cmock/docs/license.txt +31 -0
- data/vendor/cmock/examples/gcc.yml +43 -0
- data/vendor/cmock/examples/iar_v4.yml +91 -0
- data/vendor/cmock/examples/iar_v5.yml +80 -0
- data/vendor/cmock/examples/rakefile.rb +32 -0
- data/vendor/cmock/examples/rakefile_helper.rb +270 -0
- data/vendor/cmock/examples/src/AT91SAM7X256.h +2556 -0
- data/vendor/cmock/examples/src/AdcConductor.c +42 -0
- data/vendor/cmock/examples/src/AdcConductor.h +11 -0
- data/vendor/cmock/examples/src/AdcHardware.c +27 -0
- data/vendor/cmock/examples/src/AdcHardware.h +9 -0
- data/vendor/cmock/examples/src/AdcHardwareConfigurator.c +18 -0
- data/vendor/cmock/examples/src/AdcHardwareConfigurator.h +10 -0
- data/vendor/cmock/examples/src/AdcModel.c +33 -0
- data/vendor/cmock/examples/src/AdcModel.h +13 -0
- data/vendor/cmock/examples/src/AdcTemperatureSensor.c +51 -0
- data/vendor/cmock/examples/src/AdcTemperatureSensor.h +10 -0
- data/vendor/cmock/examples/src/Executor.c +25 -0
- data/vendor/cmock/examples/src/Executor.h +9 -0
- data/vendor/cmock/examples/src/IntrinsicsWrapper.c +18 -0
- data/vendor/cmock/examples/src/IntrinsicsWrapper.h +7 -0
- data/vendor/cmock/examples/src/Main.c +46 -0
- data/vendor/cmock/examples/src/Main.h +7 -0
- data/vendor/cmock/examples/src/Model.c +10 -0
- data/vendor/cmock/examples/src/Model.h +8 -0
- data/vendor/cmock/examples/src/ModelConfig.h +7 -0
- data/vendor/cmock/examples/src/TaskScheduler.c +72 -0
- data/vendor/cmock/examples/src/TaskScheduler.h +11 -0
- data/vendor/cmock/examples/src/TemperatureCalculator.c +27 -0
- data/vendor/cmock/examples/src/TemperatureCalculator.h +6 -0
- data/vendor/cmock/examples/src/TemperatureFilter.c +39 -0
- data/vendor/cmock/examples/src/TemperatureFilter.h +10 -0
- data/vendor/cmock/examples/src/TimerConductor.c +15 -0
- data/vendor/cmock/examples/src/TimerConductor.h +9 -0
- data/vendor/cmock/examples/src/TimerConfigurator.c +51 -0
- data/vendor/cmock/examples/src/TimerConfigurator.h +15 -0
- data/vendor/cmock/examples/src/TimerHardware.c +15 -0
- data/vendor/cmock/examples/src/TimerHardware.h +8 -0
- data/vendor/cmock/examples/src/TimerInterruptConfigurator.c +55 -0
- data/vendor/cmock/examples/src/TimerInterruptConfigurator.h +13 -0
- data/vendor/cmock/examples/src/TimerInterruptHandler.c +25 -0
- data/vendor/cmock/examples/src/TimerInterruptHandler.h +10 -0
- data/vendor/cmock/examples/src/TimerModel.c +9 -0
- data/vendor/cmock/examples/src/TimerModel.h +8 -0
- data/vendor/cmock/examples/src/Types.h +103 -0
- data/vendor/cmock/examples/src/UsartBaudRateRegisterCalculator.c +18 -0
- data/vendor/cmock/examples/src/UsartBaudRateRegisterCalculator.h +6 -0
- data/vendor/cmock/examples/src/UsartConductor.c +21 -0
- data/vendor/cmock/examples/src/UsartConductor.h +7 -0
- data/vendor/cmock/examples/src/UsartConfigurator.c +39 -0
- data/vendor/cmock/examples/src/UsartConfigurator.h +13 -0
- data/vendor/cmock/examples/src/UsartHardware.c +22 -0
- data/vendor/cmock/examples/src/UsartHardware.h +9 -0
- data/vendor/cmock/examples/src/UsartModel.c +34 -0
- data/vendor/cmock/examples/src/UsartModel.h +10 -0
- data/vendor/cmock/examples/src/UsartPutChar.c +16 -0
- data/vendor/cmock/examples/src/UsartPutChar.h +8 -0
- data/vendor/cmock/examples/src/UsartTransmitBufferStatus.c +7 -0
- data/vendor/cmock/examples/src/UsartTransmitBufferStatus.h +8 -0
- data/vendor/cmock/examples/test/TestAdcConductor.c +121 -0
- data/vendor/cmock/examples/test/TestAdcHardware.c +44 -0
- data/vendor/cmock/examples/test/TestAdcHardwareConfigurator.c +43 -0
- data/vendor/cmock/examples/test/TestAdcModel.c +33 -0
- data/vendor/cmock/examples/test/TestAdcTemperatureSensor.c +47 -0
- data/vendor/cmock/examples/test/TestExecutor.c +36 -0
- data/vendor/cmock/examples/test/TestMain.c +24 -0
- data/vendor/cmock/examples/test/TestModel.c +20 -0
- data/vendor/cmock/examples/test/TestTaskScheduler.c +104 -0
- data/vendor/cmock/examples/test/TestTemperatureCalculator.c +33 -0
- data/vendor/cmock/examples/test/TestTemperatureFilter.c +69 -0
- data/vendor/cmock/examples/test/TestTimerConductor.c +32 -0
- data/vendor/cmock/examples/test/TestTimerConfigurator.c +112 -0
- data/vendor/cmock/examples/test/TestTimerHardware.c +26 -0
- data/vendor/cmock/examples/test/TestTimerInterruptConfigurator.c +78 -0
- data/vendor/cmock/examples/test/TestTimerInterruptHandler.c +66 -0
- data/vendor/cmock/examples/test/TestTimerModel.c +18 -0
- data/vendor/cmock/examples/test/TestUsartBaudRateRegisterCalculator.c +21 -0
- data/vendor/cmock/examples/test/TestUsartConductor.c +40 -0
- data/vendor/cmock/examples/test/TestUsartConfigurator.c +77 -0
- data/vendor/cmock/examples/test/TestUsartHardware.c +37 -0
- data/vendor/cmock/examples/test/TestUsartModel.c +40 -0
- data/vendor/cmock/examples/test/TestUsartPutChar.c +43 -0
- data/vendor/cmock/examples/test/TestUsartTransmitBufferStatus.c +22 -0
- data/vendor/cmock/iar/iar_v4/Resource/SAM7_FLASH.mac +71 -0
- data/vendor/cmock/iar/iar_v4/Resource/SAM7_RAM.mac +94 -0
- data/vendor/cmock/iar/iar_v4/Resource/SAM7_SIM.mac +67 -0
- data/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_FLASH.xcl +185 -0
- data/vendor/cmock/iar/iar_v4/Resource/at91SAM7X256_RAM.xcl +185 -0
- data/vendor/cmock/iar/iar_v4/Resource/ioat91sam7x256.ddf +2259 -0
- data/vendor/cmock/iar/iar_v4/cmock_demo.dep +3691 -0
- data/vendor/cmock/iar/iar_v4/cmock_demo.ewd +1696 -0
- data/vendor/cmock/iar/iar_v4/cmock_demo.ewp +2581 -0
- data/vendor/cmock/iar/iar_v4/cmock_demo.eww +10 -0
- data/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X-EK.h +61 -0
- data/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.inc +2314 -0
- data/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.rdf +4704 -0
- data/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256.tcl +3407 -0
- data/vendor/cmock/iar/iar_v4/incIAR/AT91SAM7X256_inc.h +2268 -0
- data/vendor/cmock/iar/iar_v4/incIAR/ioat91sam7x256.h +4380 -0
- data/vendor/cmock/iar/iar_v4/incIAR/lib_AT91SAM7X256.h +4211 -0
- data/vendor/cmock/iar/iar_v4/settings/cmock_demo.cspy.bat +32 -0
- data/vendor/cmock/iar/iar_v4/settings/cmock_demo.dbgdt +86 -0
- data/vendor/cmock/iar/iar_v4/settings/cmock_demo.dni +42 -0
- data/vendor/cmock/iar/iar_v4/settings/cmock_demo.wsdt +76 -0
- data/vendor/cmock/iar/iar_v4/srcIAR/Cstartup.s79 +266 -0
- data/vendor/cmock/iar/iar_v4/srcIAR/Cstartup_SAM7.c +98 -0
- data/vendor/cmock/iar/iar_v5/Resource/SAM7_FLASH.mac +71 -0
- data/vendor/cmock/iar/iar_v5/Resource/SAM7_RAM.mac +94 -0
- data/vendor/cmock/iar/iar_v5/Resource/SAM7_SIM.mac +67 -0
- data/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_FLASH.icf +43 -0
- data/vendor/cmock/iar/iar_v5/Resource/at91SAM7X256_RAM.icf +42 -0
- data/vendor/cmock/iar/iar_v5/cmock_demo.dep +4204 -0
- data/vendor/cmock/iar/iar_v5/cmock_demo.ewd +1906 -0
- data/vendor/cmock/iar/iar_v5/cmock_demo.ewp +2426 -0
- data/vendor/cmock/iar/iar_v5/cmock_demo.eww +26 -0
- data/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X-EK.h +61 -0
- data/vendor/cmock/iar/iar_v5/incIAR/AT91SAM7X256_inc.h +2268 -0
- data/vendor/cmock/iar/iar_v5/incIAR/lib_AT91SAM7X256.h +4211 -0
- data/vendor/cmock/iar/iar_v5/incIAR/project.h +30 -0
- data/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.cspy.bat +33 -0
- data/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dbgdt +5 -0
- data/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.dni +18 -0
- data/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X.wsdt +74 -0
- data/vendor/cmock/iar/iar_v5/settings/BasicInterrupt_SAM7X_FLASH_Debug.jlink +12 -0
- data/vendor/cmock/iar/iar_v5/settings/cmock_demo.cspy.bat +33 -0
- data/vendor/cmock/iar/iar_v5/settings/cmock_demo.dbgdt +85 -0
- data/vendor/cmock/iar/iar_v5/settings/cmock_demo.dni +44 -0
- data/vendor/cmock/iar/iar_v5/settings/cmock_demo.wsdt +73 -0
- data/vendor/cmock/iar/iar_v5/settings/cmock_demo_Binary.jlink +12 -0
- data/vendor/cmock/iar/iar_v5/settings/cmock_demo_FLASH_Debug.jlink +12 -0
- data/vendor/cmock/iar/iar_v5/settings/cmock_demo_RAM_Debug.jlink +12 -0
- data/vendor/cmock/iar/iar_v5/srcIAR/Cstartup.s +299 -0
- data/vendor/cmock/iar/iar_v5/srcIAR/Cstartup_SAM7.c +98 -0
- data/vendor/cmock/rakefile.rb +111 -0
- data/vendor/cmock/rakefile_helper.rb +381 -0
- data/vendor/cmock/targets/gcc.yml +53 -0
- data/vendor/cmock/targets/iar_arm_v4.yml +108 -0
- data/vendor/cmock/targets/iar_arm_v5.yml +93 -0
- data/vendor/cmock/test/c/TestCMockC.c +280 -0
- data/vendor/cmock/test/c/TestCMockC.yml +12 -0
- data/vendor/cmock/test/c/TestCMockCDynamic.c +186 -0
- data/vendor/cmock/test/c/TestCMockCDynamic.yml +12 -0
- data/vendor/cmock/test/c/TestCMockCDynamic_Runner.c +35 -0
- data/vendor/cmock/test/c/TestCMockC_Runner.c +37 -0
- data/vendor/cmock/test/spec/cmock_file_writer_spec.rb +25 -0
- data/vendor/cmock/test/spec/spec_helper.rb +12 -0
- data/vendor/cmock/test/system/systest_generator.rb +178 -0
- data/vendor/cmock/test/system/test_compilation/callingconv.h +11 -0
- data/vendor/cmock/test/system/test_compilation/config.yml +9 -0
- data/vendor/cmock/test/system/test_compilation/const.h +15 -0
- data/vendor/cmock/test/system/test_compilation/osek.h +275 -0
- data/vendor/cmock/test/system/test_compilation/parsing.h +47 -0
- data/vendor/cmock/test/system/test_interactions/all_plugins_but_other_limits.yml +341 -0
- data/vendor/cmock/test/system/test_interactions/all_plugins_coexist.yml +382 -0
- data/vendor/cmock/test/system/test_interactions/array_and_pointer_handling.yml +382 -0
- data/vendor/cmock/test/system/test_interactions/basic_expect_and_return.yml +123 -0
- data/vendor/cmock/test/system/test_interactions/const_primitives_handling.yml +87 -0
- data/vendor/cmock/test/system/test_interactions/enforce_strict_ordering.yml +247 -0
- data/vendor/cmock/test/system/test_interactions/expect_and_return_custom_types.yml +108 -0
- data/vendor/cmock/test/system/test_interactions/expect_and_return_treat_as.yml +173 -0
- data/vendor/cmock/test/system/test_interactions/expect_and_throw.yml +170 -0
- data/vendor/cmock/test/system/test_interactions/fancy_pointer_handling.yml +208 -0
- data/vendor/cmock/test/system/test_interactions/function_pointer_handling.yml +82 -0
- data/vendor/cmock/test/system/test_interactions/ignore_and_return.yml +153 -0
- data/vendor/cmock/test/system/test_interactions/newer_standards_stuff1.yml +52 -0
- data/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_1.yml +91 -0
- data/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_2.yml +59 -0
- data/vendor/cmock/test/system/test_interactions/parsing_challenges.yml +222 -0
- data/vendor/cmock/test/system/test_interactions/struct_union_enum_expect_and_return.yml +277 -0
- data/vendor/cmock/test/system/test_interactions/stubs_with_callbacks.yml +221 -0
- data/vendor/cmock/test/system/test_interactions/unity_64bit_support.yml +77 -0
- data/vendor/cmock/test/system/test_interactions/unity_ignores.yml +139 -0
- data/vendor/cmock/test/test_helper.rb +44 -0
- data/vendor/cmock/test/unit/cmock_config_test.rb +121 -0
- data/vendor/cmock/test/unit/cmock_config_test.yml +5 -0
- data/vendor/cmock/test/unit/cmock_file_writer_test.rb +30 -0
- data/vendor/cmock/test/unit/cmock_generator_main_test.rb +413 -0
- data/vendor/cmock/test/unit/cmock_generator_plugin_array_test.rb +114 -0
- data/vendor/cmock/test/unit/cmock_generator_plugin_callback_test.rb +190 -0
- data/vendor/cmock/test/unit/cmock_generator_plugin_cexception_test.rb +94 -0
- data/vendor/cmock/test/unit/cmock_generator_plugin_expect_test.rb +206 -0
- data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_test.rb +168 -0
- data/vendor/cmock/test/unit/cmock_generator_utils_test.rb +291 -0
- data/vendor/cmock/test/unit/cmock_header_parser_test.rb +1247 -0
- data/vendor/cmock/test/unit/cmock_plugin_manager_test.rb +85 -0
- data/vendor/cmock/test/unit/cmock_unityhelper_parser_test.rb +223 -0
- data/vendor/cmock/vendor/behaviors/Manifest.txt +9 -0
- data/vendor/cmock/vendor/behaviors/Rakefile +19 -0
- data/vendor/cmock/vendor/behaviors/lib/behaviors.rb +76 -0
- data/vendor/cmock/vendor/behaviors/lib/behaviors/reporttask.rb +158 -0
- data/vendor/cmock/vendor/behaviors/test/behaviors_tasks_test.rb +73 -0
- data/vendor/cmock/vendor/behaviors/test/behaviors_test.rb +50 -0
- data/vendor/cmock/vendor/behaviors/test/tasks_test/Rakefile +19 -0
- data/vendor/cmock/vendor/behaviors/test/tasks_test/lib/user.rb +2 -0
- data/vendor/cmock/vendor/behaviors/test/tasks_test/test/user_test.rb +17 -0
- data/vendor/cmock/vendor/hardmock/CHANGES +78 -0
- data/vendor/cmock/vendor/hardmock/LICENSE +7 -0
- data/vendor/cmock/vendor/hardmock/README +70 -0
- data/vendor/cmock/vendor/hardmock/Rakefile +8 -0
- data/vendor/cmock/vendor/hardmock/config/environment.rb +12 -0
- data/vendor/cmock/vendor/hardmock/lib/assert_error.rb +23 -0
- data/vendor/cmock/vendor/hardmock/lib/extend_test_unit.rb +14 -0
- data/vendor/cmock/vendor/hardmock/lib/hardmock.rb +86 -0
- data/vendor/cmock/vendor/hardmock/lib/hardmock/errors.rb +22 -0
- data/vendor/cmock/vendor/hardmock/lib/hardmock/expectation.rb +229 -0
- data/vendor/cmock/vendor/hardmock/lib/hardmock/expectation_builder.rb +9 -0
- data/vendor/cmock/vendor/hardmock/lib/hardmock/expector.rb +26 -0
- data/vendor/cmock/vendor/hardmock/lib/hardmock/method_cleanout.rb +33 -0
- data/vendor/cmock/vendor/hardmock/lib/hardmock/mock.rb +180 -0
- data/vendor/cmock/vendor/hardmock/lib/hardmock/mock_control.rb +53 -0
- data/vendor/cmock/vendor/hardmock/lib/hardmock/stubbing.rb +210 -0
- data/vendor/cmock/vendor/hardmock/lib/hardmock/trapper.rb +31 -0
- data/vendor/cmock/vendor/hardmock/lib/hardmock/utils.rb +9 -0
- data/vendor/cmock/vendor/hardmock/lib/test_unit_before_after.rb +169 -0
- data/vendor/cmock/vendor/hardmock/rake_tasks/rdoc.rake +19 -0
- data/vendor/cmock/vendor/hardmock/rake_tasks/rdoc_options.rb +4 -0
- data/vendor/cmock/vendor/hardmock/rake_tasks/test.rake +22 -0
- data/vendor/cmock/vendor/hardmock/test/functional/assert_error_test.rb +52 -0
- data/vendor/cmock/vendor/hardmock/test/functional/auto_verify_test.rb +178 -0
- data/vendor/cmock/vendor/hardmock/test/functional/direct_mock_usage_test.rb +396 -0
- data/vendor/cmock/vendor/hardmock/test/functional/hardmock_test.rb +434 -0
- data/vendor/cmock/vendor/hardmock/test/functional/stubbing_test.rb +479 -0
- data/vendor/cmock/vendor/hardmock/test/test_helper.rb +43 -0
- data/vendor/cmock/vendor/hardmock/test/unit/expectation_builder_test.rb +19 -0
- data/vendor/cmock/vendor/hardmock/test/unit/expectation_test.rb +372 -0
- data/vendor/cmock/vendor/hardmock/test/unit/expector_test.rb +57 -0
- data/vendor/cmock/vendor/hardmock/test/unit/method_cleanout_test.rb +36 -0
- data/vendor/cmock/vendor/hardmock/test/unit/mock_control_test.rb +175 -0
- data/vendor/cmock/vendor/hardmock/test/unit/mock_test.rb +279 -0
- data/vendor/cmock/vendor/hardmock/test/unit/test_unit_before_after_test.rb +452 -0
- data/vendor/cmock/vendor/hardmock/test/unit/trapper_test.rb +62 -0
- data/vendor/cmock/vendor/hardmock/test/unit/verify_error_test.rb +40 -0
- data/vendor/unity/auto/generate_config.yml +36 -0
- data/vendor/unity/auto/unity_test_summary.rb +2 -2
- data/vendor/unity/docs/Unity Summary.odt +0 -0
- data/vendor/unity/docs/Unity Summary.pdf +0 -0
- data/vendor/unity/docs/Unity Summary.txt +216 -0
- data/vendor/unity/docs/license.txt +31 -0
- data/vendor/unity/examples/helper/UnityHelper.c +10 -0
- data/vendor/unity/examples/helper/UnityHelper.h +12 -0
- data/vendor/unity/examples/makefile +40 -0
- data/vendor/unity/examples/rakefile.rb +32 -0
- data/vendor/unity/examples/rakefile_helper.rb +256 -0
- data/vendor/unity/examples/readme.txt +18 -0
- data/vendor/unity/examples/src/ProductionCode.c +24 -0
- data/vendor/unity/examples/src/ProductionCode.h +3 -0
- data/vendor/unity/examples/src/ProductionCode2.c +9 -0
- data/vendor/unity/examples/src/ProductionCode2.h +2 -0
- data/vendor/unity/examples/test/TestProductionCode.c +62 -0
- data/vendor/unity/examples/test/TestProductionCode2.c +31 -0
- data/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c +46 -0
- data/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c +50 -0
- data/vendor/unity/extras/fixture/build/MakefileWorker.mk +331 -0
- data/vendor/unity/extras/fixture/build/filterGcov.sh +61 -0
- data/vendor/unity/extras/fixture/rakefile.rb +37 -0
- data/vendor/unity/extras/fixture/rakefile_helper.rb +178 -0
- data/vendor/unity/extras/fixture/readme.txt +9 -0
- data/vendor/unity/extras/fixture/src/unity_fixture.c +381 -0
- data/vendor/unity/extras/fixture/src/unity_fixture.h +81 -0
- data/vendor/unity/extras/fixture/src/unity_fixture_internals.h +44 -0
- data/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +16 -0
- data/vendor/unity/extras/fixture/test/main/AllTests.c +21 -0
- data/vendor/unity/extras/fixture/test/testunity_fixture.c +39 -0
- data/vendor/unity/extras/fixture/test/unity_fixture_Test.c +321 -0
- data/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +40 -0
- data/vendor/unity/extras/fixture/test/unity_output_Spy.c +56 -0
- data/vendor/unity/extras/fixture/test/unity_output_Spy.h +17 -0
- data/vendor/unity/makefile +35 -0
- data/vendor/unity/rakefile.rb +59 -0
- data/vendor/unity/rakefile_helper.rb +240 -0
- data/vendor/unity/release/version.info +1 -1
- data/vendor/unity/src/unity.c +1 -1
- data/vendor/unity/src/unity_internals.h +5 -5
- data/vendor/unity/targets/gcc_32.yml +44 -0
- data/vendor/unity/targets/hitech_picc18.yml +101 -0
- data/vendor/unity/targets/iar_arm_v4.yml +89 -0
- data/vendor/unity/targets/iar_arm_v5.yml +79 -0
- data/vendor/unity/targets/iar_arm_v5_3.yml +79 -0
- data/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml +93 -0
- data/vendor/unity/targets/iar_cortexm3_v5.yml +83 -0
- data/vendor/unity/targets/iar_msp430.yml +94 -0
- data/vendor/unity/targets/iar_sh2a_v6.yml +85 -0
- data/vendor/unity/test/expectdata/testsample_cmd.c +54 -0
- data/vendor/unity/test/expectdata/testsample_def.c +50 -0
- data/vendor/unity/test/expectdata/testsample_mock_cmd.c +76 -0
- data/vendor/unity/test/expectdata/testsample_mock_def.c +72 -0
- data/vendor/unity/test/expectdata/testsample_mock_new1.c +85 -0
- data/vendor/unity/test/expectdata/testsample_mock_new2.c +85 -0
- data/vendor/unity/test/expectdata/testsample_mock_param.c +73 -0
- data/vendor/unity/test/expectdata/testsample_mock_run1.c +85 -0
- data/vendor/unity/test/expectdata/testsample_mock_run2.c +85 -0
- data/vendor/unity/test/expectdata/testsample_mock_yaml.c +86 -0
- data/vendor/unity/test/expectdata/testsample_new1.c +60 -0
- data/vendor/unity/test/expectdata/testsample_new2.c +63 -0
- data/vendor/unity/test/expectdata/testsample_param.c +51 -0
- data/vendor/unity/test/expectdata/testsample_run1.c +60 -0
- data/vendor/unity/test/expectdata/testsample_run2.c +63 -0
- data/vendor/unity/test/expectdata/testsample_yaml.c +64 -0
- data/vendor/unity/test/test_generate_test_runner.rb +94 -0
- data/vendor/unity/test/testdata/mocksample.c +51 -0
- data/vendor/unity/test/testdata/sample.yml +9 -0
- data/vendor/unity/test/testdata/testsample.c +51 -0
- data/vendor/unity/test/testparameterized.c +101 -0
- data/vendor/unity/test/testunity.c +2559 -0
- metadata +464 -53
- data/.gitignore +0 -6
- data/.gitmodules +0 -9
- data/.rspec +0 -1
@@ -0,0 +1,979 @@
|
|
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
|
+
#include "unity.h"
|
8
|
+
#include <stdio.h>
|
9
|
+
#include <string.h>
|
10
|
+
|
11
|
+
#define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); }
|
12
|
+
#define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; UNITY_OUTPUT_CHAR('\n'); longjmp(Unity.AbortFrame, 1); }
|
13
|
+
/// return prematurely if we are already in failure or ignore state
|
14
|
+
#define UNITY_SKIP_EXECUTION { if ((Unity.CurrentTestFailed != 0) || (Unity.CurrentTestIgnored != 0)) {return;} }
|
15
|
+
#define UNITY_PRINT_EOL { UNITY_OUTPUT_CHAR('\n'); }
|
16
|
+
|
17
|
+
struct _Unity Unity = { 0 };
|
18
|
+
|
19
|
+
const char* UnityStrNull = "NULL";
|
20
|
+
const char* UnityStrSpacer = ". ";
|
21
|
+
const char* UnityStrExpected = " Expected ";
|
22
|
+
const char* UnityStrWas = " Was ";
|
23
|
+
const char* UnityStrTo = " To ";
|
24
|
+
const char* UnityStrElement = " Element ";
|
25
|
+
const char* UnityStrByte = " Byte ";
|
26
|
+
const char* UnityStrMemory = " Memory Mismatch.";
|
27
|
+
const char* UnityStrDelta = " Values Not Within Delta ";
|
28
|
+
const char* UnityStrPointless= " You Asked Me To Compare Nothing, Which Was Pointless.";
|
29
|
+
const char* UnityStrNullPointerForExpected= " Expected pointer to be NULL";
|
30
|
+
const char* UnityStrNullPointerForActual = " Actual pointer was NULL";
|
31
|
+
|
32
|
+
// compiler-generic print formatting masks
|
33
|
+
const _U_UINT UnitySizeMask[] =
|
34
|
+
{
|
35
|
+
255u, // 0xFF
|
36
|
+
65535u, // 0xFFFF
|
37
|
+
65535u,
|
38
|
+
4294967295u, // 0xFFFFFFFF
|
39
|
+
4294967295u,
|
40
|
+
4294967295u,
|
41
|
+
4294967295u
|
42
|
+
#ifdef UNITY_SUPPORT_64
|
43
|
+
,0xFFFFFFFFFFFFFFFF
|
44
|
+
#endif
|
45
|
+
};
|
46
|
+
|
47
|
+
void UnityPrintFail(void);
|
48
|
+
void UnityPrintOk(void);
|
49
|
+
|
50
|
+
//-----------------------------------------------
|
51
|
+
// Pretty Printers & Test Result Output Handlers
|
52
|
+
//-----------------------------------------------
|
53
|
+
|
54
|
+
void UnityPrint(const char* string)
|
55
|
+
{
|
56
|
+
const char* pch = string;
|
57
|
+
|
58
|
+
if (pch != NULL)
|
59
|
+
{
|
60
|
+
while (*pch)
|
61
|
+
{
|
62
|
+
// printable characters plus CR & LF are printed
|
63
|
+
if ((*pch <= 126) && (*pch >= 32))
|
64
|
+
{
|
65
|
+
UNITY_OUTPUT_CHAR(*pch);
|
66
|
+
}
|
67
|
+
//write escaped carriage returns
|
68
|
+
else if (*pch == 13)
|
69
|
+
{
|
70
|
+
UNITY_OUTPUT_CHAR('\\');
|
71
|
+
UNITY_OUTPUT_CHAR('r');
|
72
|
+
}
|
73
|
+
//write escaped line feeds
|
74
|
+
else if (*pch == 10)
|
75
|
+
{
|
76
|
+
UNITY_OUTPUT_CHAR('\\');
|
77
|
+
UNITY_OUTPUT_CHAR('n');
|
78
|
+
}
|
79
|
+
// unprintable characters are shown as codes
|
80
|
+
else
|
81
|
+
{
|
82
|
+
UNITY_OUTPUT_CHAR('\\');
|
83
|
+
UnityPrintNumberHex((_U_SINT)*pch, 2);
|
84
|
+
}
|
85
|
+
pch++;
|
86
|
+
}
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
//-----------------------------------------------
|
91
|
+
void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style)
|
92
|
+
{
|
93
|
+
if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
|
94
|
+
{
|
95
|
+
UnityPrintNumber(number);
|
96
|
+
}
|
97
|
+
else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT)
|
98
|
+
{
|
99
|
+
UnityPrintNumberUnsigned( (_U_UINT)number & UnitySizeMask[((_U_UINT)style & (_U_UINT)0x0F) - 1] );
|
100
|
+
}
|
101
|
+
else
|
102
|
+
{
|
103
|
+
UnityPrintNumberHex((_U_UINT)number, (style & 0x000F) << 1);
|
104
|
+
}
|
105
|
+
}
|
106
|
+
|
107
|
+
//-----------------------------------------------
|
108
|
+
/// basically do an itoa using as little ram as possible
|
109
|
+
void UnityPrintNumber(const _U_SINT number_to_print)
|
110
|
+
{
|
111
|
+
_U_SINT divisor = 1;
|
112
|
+
_U_SINT next_divisor;
|
113
|
+
_U_SINT number = number_to_print;
|
114
|
+
|
115
|
+
if (number < 0)
|
116
|
+
{
|
117
|
+
UNITY_OUTPUT_CHAR('-');
|
118
|
+
number = -number;
|
119
|
+
}
|
120
|
+
|
121
|
+
// figure out initial divisor
|
122
|
+
while (number / divisor > 9)
|
123
|
+
{
|
124
|
+
next_divisor = divisor * 10;
|
125
|
+
if (next_divisor > divisor)
|
126
|
+
divisor = next_divisor;
|
127
|
+
else
|
128
|
+
break;
|
129
|
+
}
|
130
|
+
|
131
|
+
// now mod and print, then divide divisor
|
132
|
+
do
|
133
|
+
{
|
134
|
+
UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10)));
|
135
|
+
divisor /= 10;
|
136
|
+
}
|
137
|
+
while (divisor > 0);
|
138
|
+
}
|
139
|
+
|
140
|
+
//-----------------------------------------------
|
141
|
+
/// basically do an itoa using as little ram as possible
|
142
|
+
void UnityPrintNumberUnsigned(const _U_UINT number)
|
143
|
+
{
|
144
|
+
_U_UINT divisor = 1;
|
145
|
+
_U_UINT next_divisor;
|
146
|
+
|
147
|
+
// figure out initial divisor
|
148
|
+
while (number / divisor > 9)
|
149
|
+
{
|
150
|
+
next_divisor = divisor * 10;
|
151
|
+
if (next_divisor > divisor)
|
152
|
+
divisor = next_divisor;
|
153
|
+
else
|
154
|
+
break;
|
155
|
+
}
|
156
|
+
|
157
|
+
// now mod and print, then divide divisor
|
158
|
+
do
|
159
|
+
{
|
160
|
+
UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10)));
|
161
|
+
divisor /= 10;
|
162
|
+
}
|
163
|
+
while (divisor > 0);
|
164
|
+
}
|
165
|
+
|
166
|
+
//-----------------------------------------------
|
167
|
+
void UnityPrintNumberHex(const _U_UINT number, const char nibbles_to_print)
|
168
|
+
{
|
169
|
+
_U_UINT nibble;
|
170
|
+
char nibbles = nibbles_to_print;
|
171
|
+
UNITY_OUTPUT_CHAR('0');
|
172
|
+
UNITY_OUTPUT_CHAR('x');
|
173
|
+
|
174
|
+
while (nibbles > 0)
|
175
|
+
{
|
176
|
+
nibble = (number >> (--nibbles << 2)) & 0x0000000F;
|
177
|
+
if (nibble <= 9)
|
178
|
+
{
|
179
|
+
UNITY_OUTPUT_CHAR((char)('0' + nibble));
|
180
|
+
}
|
181
|
+
else
|
182
|
+
{
|
183
|
+
UNITY_OUTPUT_CHAR((char)('A' - 10 + nibble));
|
184
|
+
}
|
185
|
+
}
|
186
|
+
}
|
187
|
+
|
188
|
+
//-----------------------------------------------
|
189
|
+
void UnityPrintMask(const _U_UINT mask, const _U_UINT number)
|
190
|
+
{
|
191
|
+
_U_UINT current_bit = (_U_UINT)1 << (UNITY_INT_WIDTH - 1);
|
192
|
+
_US32 i;
|
193
|
+
|
194
|
+
for (i = 0; i < UNITY_INT_WIDTH; i++)
|
195
|
+
{
|
196
|
+
if (current_bit & mask)
|
197
|
+
{
|
198
|
+
if (current_bit & number)
|
199
|
+
{
|
200
|
+
UNITY_OUTPUT_CHAR('1');
|
201
|
+
}
|
202
|
+
else
|
203
|
+
{
|
204
|
+
UNITY_OUTPUT_CHAR('0');
|
205
|
+
}
|
206
|
+
}
|
207
|
+
else
|
208
|
+
{
|
209
|
+
UNITY_OUTPUT_CHAR('X');
|
210
|
+
}
|
211
|
+
current_bit = current_bit >> 1;
|
212
|
+
}
|
213
|
+
}
|
214
|
+
|
215
|
+
//-----------------------------------------------
|
216
|
+
#ifdef UNITY_FLOAT_VERBOSE
|
217
|
+
void UnityPrintFloat(_UF number)
|
218
|
+
{
|
219
|
+
char TempBuffer[32];
|
220
|
+
sprintf(TempBuffer, "%.6f", number);
|
221
|
+
UnityPrint(TempBuffer);
|
222
|
+
}
|
223
|
+
#endif
|
224
|
+
|
225
|
+
//-----------------------------------------------
|
226
|
+
|
227
|
+
void UnityPrintFail(void)
|
228
|
+
{
|
229
|
+
UnityPrint("FAIL");
|
230
|
+
}
|
231
|
+
|
232
|
+
void UnityPrintOk(void)
|
233
|
+
{
|
234
|
+
UnityPrint("OK");
|
235
|
+
}
|
236
|
+
|
237
|
+
//-----------------------------------------------
|
238
|
+
void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line)
|
239
|
+
{
|
240
|
+
UnityPrint(file);
|
241
|
+
UNITY_OUTPUT_CHAR(':');
|
242
|
+
UnityPrintNumber(line);
|
243
|
+
UNITY_OUTPUT_CHAR(':');
|
244
|
+
UnityPrint(Unity.CurrentTestName);
|
245
|
+
UNITY_OUTPUT_CHAR(':');
|
246
|
+
}
|
247
|
+
|
248
|
+
//-----------------------------------------------
|
249
|
+
void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line)
|
250
|
+
{
|
251
|
+
UnityTestResultsBegin(Unity.TestFile, line);
|
252
|
+
UnityPrint("FAIL:");
|
253
|
+
}
|
254
|
+
|
255
|
+
//-----------------------------------------------
|
256
|
+
void UnityConcludeTest(void)
|
257
|
+
{
|
258
|
+
if (Unity.CurrentTestIgnored)
|
259
|
+
{
|
260
|
+
Unity.TestIgnores++;
|
261
|
+
}
|
262
|
+
else if (!Unity.CurrentTestFailed)
|
263
|
+
{
|
264
|
+
UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber);
|
265
|
+
UnityPrint("PASS");
|
266
|
+
UNITY_PRINT_EOL;
|
267
|
+
}
|
268
|
+
else
|
269
|
+
{
|
270
|
+
Unity.TestFailures++;
|
271
|
+
}
|
272
|
+
|
273
|
+
Unity.CurrentTestFailed = 0;
|
274
|
+
Unity.CurrentTestIgnored = 0;
|
275
|
+
}
|
276
|
+
|
277
|
+
//-----------------------------------------------
|
278
|
+
void UnityAddMsgIfSpecified(const char* msg)
|
279
|
+
{
|
280
|
+
if (msg)
|
281
|
+
{
|
282
|
+
UnityPrint(UnityStrSpacer);
|
283
|
+
UnityPrint(msg);
|
284
|
+
}
|
285
|
+
}
|
286
|
+
|
287
|
+
//-----------------------------------------------
|
288
|
+
void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual)
|
289
|
+
{
|
290
|
+
UnityPrint(UnityStrExpected);
|
291
|
+
if (expected != NULL)
|
292
|
+
{
|
293
|
+
UNITY_OUTPUT_CHAR('\'');
|
294
|
+
UnityPrint(expected);
|
295
|
+
UNITY_OUTPUT_CHAR('\'');
|
296
|
+
}
|
297
|
+
else
|
298
|
+
{
|
299
|
+
UnityPrint(UnityStrNull);
|
300
|
+
}
|
301
|
+
UnityPrint(UnityStrWas);
|
302
|
+
if (actual != NULL)
|
303
|
+
{
|
304
|
+
UNITY_OUTPUT_CHAR('\'');
|
305
|
+
UnityPrint(actual);
|
306
|
+
UNITY_OUTPUT_CHAR('\'');
|
307
|
+
}
|
308
|
+
else
|
309
|
+
{
|
310
|
+
UnityPrint(UnityStrNull);
|
311
|
+
}
|
312
|
+
}
|
313
|
+
|
314
|
+
//-----------------------------------------------
|
315
|
+
// Assertion & Control Helpers
|
316
|
+
//-----------------------------------------------
|
317
|
+
|
318
|
+
int UnityCheckArraysForNull(const void* expected, const void* actual, const UNITY_LINE_TYPE lineNumber, const char* msg)
|
319
|
+
{
|
320
|
+
//return true if they are both NULL
|
321
|
+
if ((expected == NULL) && (actual == NULL))
|
322
|
+
return 1;
|
323
|
+
|
324
|
+
//throw error if just expected is NULL
|
325
|
+
if (expected == NULL)
|
326
|
+
{
|
327
|
+
UnityTestResultsFailBegin(lineNumber);
|
328
|
+
UnityPrint(UnityStrNullPointerForExpected);
|
329
|
+
UnityAddMsgIfSpecified(msg);
|
330
|
+
UNITY_FAIL_AND_BAIL;
|
331
|
+
}
|
332
|
+
|
333
|
+
//throw error if just actual is NULL
|
334
|
+
if (actual == NULL)
|
335
|
+
{
|
336
|
+
UnityTestResultsFailBegin(lineNumber);
|
337
|
+
UnityPrint(UnityStrNullPointerForActual);
|
338
|
+
UnityAddMsgIfSpecified(msg);
|
339
|
+
UNITY_FAIL_AND_BAIL;
|
340
|
+
}
|
341
|
+
|
342
|
+
//return false if neither is NULL
|
343
|
+
return 0;
|
344
|
+
}
|
345
|
+
|
346
|
+
//-----------------------------------------------
|
347
|
+
// Assertion Functions
|
348
|
+
//-----------------------------------------------
|
349
|
+
|
350
|
+
void UnityAssertBits(const _U_SINT mask,
|
351
|
+
const _U_SINT expected,
|
352
|
+
const _U_SINT actual,
|
353
|
+
const char* msg,
|
354
|
+
const UNITY_LINE_TYPE lineNumber)
|
355
|
+
{
|
356
|
+
UNITY_SKIP_EXECUTION;
|
357
|
+
|
358
|
+
if ((mask & expected) != (mask & actual))
|
359
|
+
{
|
360
|
+
UnityTestResultsFailBegin(lineNumber);
|
361
|
+
UnityPrint(UnityStrExpected);
|
362
|
+
UnityPrintMask(mask, expected);
|
363
|
+
UnityPrint(UnityStrWas);
|
364
|
+
UnityPrintMask(mask, actual);
|
365
|
+
UnityAddMsgIfSpecified(msg);
|
366
|
+
UNITY_FAIL_AND_BAIL;
|
367
|
+
}
|
368
|
+
}
|
369
|
+
|
370
|
+
//-----------------------------------------------
|
371
|
+
void UnityAssertEqualNumber(const _U_SINT expected,
|
372
|
+
const _U_SINT actual,
|
373
|
+
const char* msg,
|
374
|
+
const UNITY_LINE_TYPE lineNumber,
|
375
|
+
const UNITY_DISPLAY_STYLE_T style)
|
376
|
+
{
|
377
|
+
UNITY_SKIP_EXECUTION;
|
378
|
+
|
379
|
+
if (expected != actual)
|
380
|
+
{
|
381
|
+
UnityTestResultsFailBegin(lineNumber);
|
382
|
+
UnityPrint(UnityStrExpected);
|
383
|
+
UnityPrintNumberByStyle(expected, style);
|
384
|
+
UnityPrint(UnityStrWas);
|
385
|
+
UnityPrintNumberByStyle(actual, style);
|
386
|
+
UnityAddMsgIfSpecified(msg);
|
387
|
+
UNITY_FAIL_AND_BAIL;
|
388
|
+
}
|
389
|
+
}
|
390
|
+
|
391
|
+
//-----------------------------------------------
|
392
|
+
void UnityAssertEqualIntArray(const _U_SINT* expected,
|
393
|
+
const _U_SINT* actual,
|
394
|
+
const _UU32 num_elements,
|
395
|
+
const char* msg,
|
396
|
+
const UNITY_LINE_TYPE lineNumber,
|
397
|
+
const UNITY_DISPLAY_STYLE_T style)
|
398
|
+
{
|
399
|
+
_UU32 elements = num_elements;
|
400
|
+
const _US8* ptr_exp = (_US8*)expected;
|
401
|
+
const _US8* ptr_act = (_US8*)actual;
|
402
|
+
|
403
|
+
UNITY_SKIP_EXECUTION;
|
404
|
+
|
405
|
+
if (elements == 0)
|
406
|
+
{
|
407
|
+
UnityTestResultsFailBegin(lineNumber);
|
408
|
+
UnityPrint(UnityStrPointless);
|
409
|
+
UnityAddMsgIfSpecified(msg);
|
410
|
+
UNITY_FAIL_AND_BAIL;
|
411
|
+
}
|
412
|
+
|
413
|
+
if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1)
|
414
|
+
return;
|
415
|
+
|
416
|
+
switch(style)
|
417
|
+
{
|
418
|
+
case UNITY_DISPLAY_STYLE_HEX8:
|
419
|
+
case UNITY_DISPLAY_STYLE_INT8:
|
420
|
+
case UNITY_DISPLAY_STYLE_UINT8:
|
421
|
+
while (elements--)
|
422
|
+
{
|
423
|
+
if (*ptr_exp != *ptr_act)
|
424
|
+
{
|
425
|
+
UnityTestResultsFailBegin(lineNumber);
|
426
|
+
UnityPrint(UnityStrElement);
|
427
|
+
UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
|
428
|
+
UnityPrint(UnityStrExpected);
|
429
|
+
UnityPrintNumberByStyle(*ptr_exp, style);
|
430
|
+
UnityPrint(UnityStrWas);
|
431
|
+
UnityPrintNumberByStyle(*ptr_act, style);
|
432
|
+
UnityAddMsgIfSpecified(msg);
|
433
|
+
UNITY_FAIL_AND_BAIL;
|
434
|
+
}
|
435
|
+
ptr_exp += 1;
|
436
|
+
ptr_act += 1;
|
437
|
+
}
|
438
|
+
break;
|
439
|
+
case UNITY_DISPLAY_STYLE_HEX16:
|
440
|
+
case UNITY_DISPLAY_STYLE_INT16:
|
441
|
+
case UNITY_DISPLAY_STYLE_UINT16:
|
442
|
+
while (elements--)
|
443
|
+
{
|
444
|
+
if (*(_US16*)ptr_exp != *(_US16*)ptr_act)
|
445
|
+
{
|
446
|
+
UnityTestResultsFailBegin(lineNumber);
|
447
|
+
UnityPrint(UnityStrElement);
|
448
|
+
UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
|
449
|
+
UnityPrint(UnityStrExpected);
|
450
|
+
UnityPrintNumberByStyle(*(_US16*)ptr_exp, style);
|
451
|
+
UnityPrint(UnityStrWas);
|
452
|
+
UnityPrintNumberByStyle(*(_US16*)ptr_act, style);
|
453
|
+
UnityAddMsgIfSpecified(msg);
|
454
|
+
UNITY_FAIL_AND_BAIL;
|
455
|
+
}
|
456
|
+
ptr_exp += 2;
|
457
|
+
ptr_act += 2;
|
458
|
+
}
|
459
|
+
break;
|
460
|
+
#ifdef UNITY_SUPPORT_64
|
461
|
+
case UNITY_DISPLAY_STYLE_HEX64:
|
462
|
+
case UNITY_DISPLAY_STYLE_INT64:
|
463
|
+
case UNITY_DISPLAY_STYLE_UINT64:
|
464
|
+
while (elements--)
|
465
|
+
{
|
466
|
+
if (*(_US64*)ptr_exp != *(_US64*)ptr_act)
|
467
|
+
{
|
468
|
+
UnityTestResultsFailBegin(lineNumber);
|
469
|
+
UnityPrint(UnityStrElement);
|
470
|
+
UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
|
471
|
+
UnityPrint(UnityStrExpected);
|
472
|
+
UnityPrintNumberByStyle(*(_US64*)ptr_exp, style);
|
473
|
+
UnityPrint(UnityStrWas);
|
474
|
+
UnityPrintNumberByStyle(*(_US64*)ptr_act, style);
|
475
|
+
UnityAddMsgIfSpecified(msg);
|
476
|
+
UNITY_FAIL_AND_BAIL;
|
477
|
+
}
|
478
|
+
ptr_exp += 8;
|
479
|
+
ptr_act += 8;
|
480
|
+
}
|
481
|
+
break;
|
482
|
+
#endif
|
483
|
+
default:
|
484
|
+
while (elements--)
|
485
|
+
{
|
486
|
+
if (*(_US32*)ptr_exp != *(_US32*)ptr_act)
|
487
|
+
{
|
488
|
+
UnityTestResultsFailBegin(lineNumber);
|
489
|
+
UnityPrint(UnityStrElement);
|
490
|
+
UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
|
491
|
+
UnityPrint(UnityStrExpected);
|
492
|
+
UnityPrintNumberByStyle(*(_US32*)ptr_exp, style);
|
493
|
+
UnityPrint(UnityStrWas);
|
494
|
+
UnityPrintNumberByStyle(*(_US32*)ptr_act, style);
|
495
|
+
UnityAddMsgIfSpecified(msg);
|
496
|
+
UNITY_FAIL_AND_BAIL;
|
497
|
+
}
|
498
|
+
ptr_exp += 4;
|
499
|
+
ptr_act += 4;
|
500
|
+
}
|
501
|
+
break;
|
502
|
+
}
|
503
|
+
}
|
504
|
+
|
505
|
+
//-----------------------------------------------
|
506
|
+
#ifndef UNITY_EXCLUDE_FLOAT
|
507
|
+
void UnityAssertEqualFloatArray(const _UF* expected,
|
508
|
+
const _UF* actual,
|
509
|
+
const _UU32 num_elements,
|
510
|
+
const char* msg,
|
511
|
+
const UNITY_LINE_TYPE lineNumber)
|
512
|
+
{
|
513
|
+
_UU32 elements = num_elements;
|
514
|
+
const _UF* ptr_expected = expected;
|
515
|
+
const _UF* ptr_actual = actual;
|
516
|
+
_UF diff, tol;
|
517
|
+
|
518
|
+
UNITY_SKIP_EXECUTION;
|
519
|
+
|
520
|
+
if (elements == 0)
|
521
|
+
{
|
522
|
+
UnityTestResultsFailBegin(lineNumber);
|
523
|
+
UnityPrint(UnityStrPointless);
|
524
|
+
UnityAddMsgIfSpecified(msg);
|
525
|
+
UNITY_FAIL_AND_BAIL;
|
526
|
+
}
|
527
|
+
|
528
|
+
if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1)
|
529
|
+
return;
|
530
|
+
|
531
|
+
while (elements--)
|
532
|
+
{
|
533
|
+
diff = *ptr_expected - *ptr_actual;
|
534
|
+
if (diff < 0.0)
|
535
|
+
diff = 0.0 - diff;
|
536
|
+
tol = UNITY_FLOAT_PRECISION * *ptr_expected;
|
537
|
+
if (tol < 0.0)
|
538
|
+
tol = 0.0 - tol;
|
539
|
+
if (diff > tol)
|
540
|
+
{
|
541
|
+
UnityTestResultsFailBegin(lineNumber);
|
542
|
+
UnityPrint(UnityStrElement);
|
543
|
+
UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
|
544
|
+
#ifdef UNITY_FLOAT_VERBOSE
|
545
|
+
UnityPrint(UnityStrExpected);
|
546
|
+
UnityPrintFloat(*ptr_expected);
|
547
|
+
UnityPrint(UnityStrWas);
|
548
|
+
UnityPrintFloat(*ptr_actual);
|
549
|
+
#else
|
550
|
+
UnityPrint(UnityStrDelta);
|
551
|
+
#endif
|
552
|
+
UnityAddMsgIfSpecified(msg);
|
553
|
+
UNITY_FAIL_AND_BAIL;
|
554
|
+
}
|
555
|
+
ptr_expected++;
|
556
|
+
ptr_actual++;
|
557
|
+
}
|
558
|
+
}
|
559
|
+
|
560
|
+
//-----------------------------------------------
|
561
|
+
void UnityAssertFloatsWithin(const _UF delta,
|
562
|
+
const _UF expected,
|
563
|
+
const _UF actual,
|
564
|
+
const char* msg,
|
565
|
+
const UNITY_LINE_TYPE lineNumber)
|
566
|
+
{
|
567
|
+
_UF diff = actual - expected;
|
568
|
+
_UF pos_delta = delta;
|
569
|
+
|
570
|
+
UNITY_SKIP_EXECUTION;
|
571
|
+
|
572
|
+
if (diff < 0)
|
573
|
+
{
|
574
|
+
diff = 0.0f - diff;
|
575
|
+
}
|
576
|
+
if (pos_delta < 0)
|
577
|
+
{
|
578
|
+
pos_delta = 0.0f - pos_delta;
|
579
|
+
}
|
580
|
+
|
581
|
+
if (pos_delta < diff)
|
582
|
+
{
|
583
|
+
UnityTestResultsFailBegin(lineNumber);
|
584
|
+
#ifdef UNITY_FLOAT_VERBOSE
|
585
|
+
UnityPrint(UnityStrExpected);
|
586
|
+
UnityPrintFloat(expected);
|
587
|
+
UnityPrint(UnityStrWas);
|
588
|
+
UnityPrintFloat(actual);
|
589
|
+
#else
|
590
|
+
UnityPrint(UnityStrDelta);
|
591
|
+
#endif
|
592
|
+
UnityAddMsgIfSpecified(msg);
|
593
|
+
UNITY_FAIL_AND_BAIL;
|
594
|
+
}
|
595
|
+
}
|
596
|
+
|
597
|
+
#endif //not UNITY_EXCLUDE_FLOAT
|
598
|
+
|
599
|
+
//-----------------------------------------------
|
600
|
+
#ifndef UNITY_EXCLUDE_DOUBLE
|
601
|
+
void UnityAssertEqualDoubleArray(const _UD* expected,
|
602
|
+
const _UD* actual,
|
603
|
+
const _UU32 num_elements,
|
604
|
+
const char* msg,
|
605
|
+
const UNITY_LINE_TYPE lineNumber)
|
606
|
+
{
|
607
|
+
_UU32 elements = num_elements;
|
608
|
+
const _UD* ptr_expected = expected;
|
609
|
+
const _UD* ptr_actual = actual;
|
610
|
+
_UD diff, tol;
|
611
|
+
|
612
|
+
UNITY_SKIP_EXECUTION;
|
613
|
+
|
614
|
+
if (elements == 0)
|
615
|
+
{
|
616
|
+
UnityTestResultsFailBegin(lineNumber);
|
617
|
+
UnityPrint(UnityStrPointless);
|
618
|
+
UnityAddMsgIfSpecified(msg);
|
619
|
+
UNITY_FAIL_AND_BAIL;
|
620
|
+
}
|
621
|
+
|
622
|
+
if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1)
|
623
|
+
return;
|
624
|
+
|
625
|
+
while (elements--)
|
626
|
+
{
|
627
|
+
diff = *ptr_expected - *ptr_actual;
|
628
|
+
if (diff < 0.0)
|
629
|
+
diff = 0.0 - diff;
|
630
|
+
tol = UNITY_DOUBLE_PRECISION * *ptr_expected;
|
631
|
+
if (tol < 0.0)
|
632
|
+
tol = 0.0 - tol;
|
633
|
+
if (diff > tol)
|
634
|
+
{
|
635
|
+
UnityTestResultsFailBegin(lineNumber);
|
636
|
+
UnityPrint(UnityStrElement);
|
637
|
+
UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
|
638
|
+
#ifdef UNITY_DOUBLE_VERBOSE
|
639
|
+
UnityPrint(UnityStrExpected);
|
640
|
+
UnityPrintFloat((float)(*ptr_expected));
|
641
|
+
UnityPrint(UnityStrWas);
|
642
|
+
UnityPrintFloat((float)(*ptr_actual));
|
643
|
+
#else
|
644
|
+
UnityPrint(UnityStrDelta);
|
645
|
+
#endif
|
646
|
+
UnityAddMsgIfSpecified(msg);
|
647
|
+
UNITY_FAIL_AND_BAIL;
|
648
|
+
}
|
649
|
+
ptr_expected++;
|
650
|
+
ptr_actual++;
|
651
|
+
}
|
652
|
+
}
|
653
|
+
|
654
|
+
//-----------------------------------------------
|
655
|
+
void UnityAssertDoublesWithin(const _UD delta,
|
656
|
+
const _UD expected,
|
657
|
+
const _UD actual,
|
658
|
+
const char* msg,
|
659
|
+
const UNITY_LINE_TYPE lineNumber)
|
660
|
+
{
|
661
|
+
_UD diff = actual - expected;
|
662
|
+
_UD pos_delta = delta;
|
663
|
+
|
664
|
+
UNITY_SKIP_EXECUTION;
|
665
|
+
|
666
|
+
if (diff < 0)
|
667
|
+
{
|
668
|
+
diff = 0.0f - diff;
|
669
|
+
}
|
670
|
+
if (pos_delta < 0)
|
671
|
+
{
|
672
|
+
pos_delta = 0.0f - pos_delta;
|
673
|
+
}
|
674
|
+
|
675
|
+
if (pos_delta < diff)
|
676
|
+
{
|
677
|
+
UnityTestResultsFailBegin(lineNumber);
|
678
|
+
#ifdef UNITY_DOUBLE_VERBOSE
|
679
|
+
UnityPrint(UnityStrExpected);
|
680
|
+
UnityPrintFloat((float)expected);
|
681
|
+
UnityPrint(UnityStrWas);
|
682
|
+
UnityPrintFloat((float)actual);
|
683
|
+
#else
|
684
|
+
UnityPrint(UnityStrDelta);
|
685
|
+
#endif
|
686
|
+
UnityAddMsgIfSpecified(msg);
|
687
|
+
UNITY_FAIL_AND_BAIL;
|
688
|
+
}
|
689
|
+
}
|
690
|
+
|
691
|
+
#endif // not UNITY_EXCLUDE_DOUBLE
|
692
|
+
|
693
|
+
//-----------------------------------------------
|
694
|
+
void UnityAssertNumbersWithin( const _U_SINT delta,
|
695
|
+
const _U_SINT expected,
|
696
|
+
const _U_SINT actual,
|
697
|
+
const char* msg,
|
698
|
+
const UNITY_LINE_TYPE lineNumber,
|
699
|
+
const UNITY_DISPLAY_STYLE_T style)
|
700
|
+
{
|
701
|
+
UNITY_SKIP_EXECUTION;
|
702
|
+
|
703
|
+
if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
|
704
|
+
{
|
705
|
+
if (actual > expected)
|
706
|
+
Unity.CurrentTestFailed = ((actual - expected) > delta);
|
707
|
+
else
|
708
|
+
Unity.CurrentTestFailed = ((expected - actual) > delta);
|
709
|
+
}
|
710
|
+
else
|
711
|
+
{
|
712
|
+
if ((_U_UINT)actual > (_U_UINT)expected)
|
713
|
+
Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) > (_U_UINT)delta);
|
714
|
+
else
|
715
|
+
Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) > (_U_UINT)delta);
|
716
|
+
}
|
717
|
+
|
718
|
+
if (Unity.CurrentTestFailed)
|
719
|
+
{
|
720
|
+
UnityTestResultsFailBegin(lineNumber);
|
721
|
+
UnityPrint(UnityStrDelta);
|
722
|
+
UnityPrintNumberByStyle(delta, style);
|
723
|
+
UnityPrint(UnityStrExpected);
|
724
|
+
UnityPrintNumberByStyle(expected, style);
|
725
|
+
UnityPrint(UnityStrWas);
|
726
|
+
UnityPrintNumberByStyle(actual, style);
|
727
|
+
UnityAddMsgIfSpecified(msg);
|
728
|
+
UNITY_FAIL_AND_BAIL;
|
729
|
+
}
|
730
|
+
}
|
731
|
+
|
732
|
+
//-----------------------------------------------
|
733
|
+
void UnityAssertEqualString(const char* expected,
|
734
|
+
const char* actual,
|
735
|
+
const char* msg,
|
736
|
+
const UNITY_LINE_TYPE lineNumber)
|
737
|
+
{
|
738
|
+
_UU32 i;
|
739
|
+
|
740
|
+
UNITY_SKIP_EXECUTION;
|
741
|
+
|
742
|
+
// if both pointers not null compare the strings
|
743
|
+
if (expected && actual)
|
744
|
+
{
|
745
|
+
for (i = 0; expected[i] || actual[i]; i++)
|
746
|
+
{
|
747
|
+
if (expected[i] != actual[i])
|
748
|
+
{
|
749
|
+
Unity.CurrentTestFailed = 1;
|
750
|
+
break;
|
751
|
+
}
|
752
|
+
}
|
753
|
+
}
|
754
|
+
else
|
755
|
+
{ // handle case of one pointers being null (if both null, test should pass)
|
756
|
+
if (expected != actual)
|
757
|
+
{
|
758
|
+
Unity.CurrentTestFailed = 1;
|
759
|
+
}
|
760
|
+
}
|
761
|
+
|
762
|
+
if (Unity.CurrentTestFailed)
|
763
|
+
{
|
764
|
+
UnityTestResultsFailBegin(lineNumber);
|
765
|
+
UnityPrintExpectedAndActualStrings(expected, actual);
|
766
|
+
UnityAddMsgIfSpecified(msg);
|
767
|
+
UNITY_FAIL_AND_BAIL;
|
768
|
+
}
|
769
|
+
}
|
770
|
+
|
771
|
+
//-----------------------------------------------
|
772
|
+
void UnityAssertEqualStringArray( const char** expected,
|
773
|
+
const char** actual,
|
774
|
+
const _UU32 num_elements,
|
775
|
+
const char* msg,
|
776
|
+
const UNITY_LINE_TYPE lineNumber)
|
777
|
+
{
|
778
|
+
_UU32 i, j = 0;
|
779
|
+
|
780
|
+
UNITY_SKIP_EXECUTION;
|
781
|
+
|
782
|
+
// if no elements, it's an error
|
783
|
+
if (num_elements == 0)
|
784
|
+
{
|
785
|
+
UnityTestResultsFailBegin(lineNumber);
|
786
|
+
UnityPrint(UnityStrPointless);
|
787
|
+
UnityAddMsgIfSpecified(msg);
|
788
|
+
UNITY_FAIL_AND_BAIL;
|
789
|
+
}
|
790
|
+
|
791
|
+
if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1)
|
792
|
+
return;
|
793
|
+
|
794
|
+
do
|
795
|
+
{
|
796
|
+
// if both pointers not null compare the strings
|
797
|
+
if (expected[j] && actual[j])
|
798
|
+
{
|
799
|
+
for (i = 0; expected[j][i] || actual[j][i]; i++)
|
800
|
+
{
|
801
|
+
if (expected[j][i] != actual[j][i])
|
802
|
+
{
|
803
|
+
Unity.CurrentTestFailed = 1;
|
804
|
+
break;
|
805
|
+
}
|
806
|
+
}
|
807
|
+
}
|
808
|
+
else
|
809
|
+
{ // handle case of one pointers being null (if both null, test should pass)
|
810
|
+
if (expected[j] != actual[j])
|
811
|
+
{
|
812
|
+
Unity.CurrentTestFailed = 1;
|
813
|
+
}
|
814
|
+
}
|
815
|
+
|
816
|
+
if (Unity.CurrentTestFailed)
|
817
|
+
{
|
818
|
+
UnityTestResultsFailBegin(lineNumber);
|
819
|
+
if (num_elements > 1)
|
820
|
+
{
|
821
|
+
UnityPrint(UnityStrElement);
|
822
|
+
UnityPrintNumberByStyle((num_elements - j - 1), UNITY_DISPLAY_STYLE_UINT);
|
823
|
+
}
|
824
|
+
UnityPrintExpectedAndActualStrings((const char*)(expected[j]), (const char*)(actual[j]));
|
825
|
+
UnityAddMsgIfSpecified(msg);
|
826
|
+
UNITY_FAIL_AND_BAIL;
|
827
|
+
}
|
828
|
+
} while (++j < num_elements);
|
829
|
+
}
|
830
|
+
|
831
|
+
//-----------------------------------------------
|
832
|
+
void UnityAssertEqualMemory( const void* expected,
|
833
|
+
const void* actual,
|
834
|
+
const _UU32 length,
|
835
|
+
const _UU32 num_elements,
|
836
|
+
const char* msg,
|
837
|
+
const UNITY_LINE_TYPE lineNumber)
|
838
|
+
{
|
839
|
+
unsigned char* ptr_exp = (unsigned char*)expected;
|
840
|
+
unsigned char* ptr_act = (unsigned char*)actual;
|
841
|
+
_UU32 elements = num_elements;
|
842
|
+
_UU32 bytes;
|
843
|
+
|
844
|
+
UNITY_SKIP_EXECUTION;
|
845
|
+
|
846
|
+
if ((elements == 0) || (length == 0))
|
847
|
+
{
|
848
|
+
UnityTestResultsFailBegin(lineNumber);
|
849
|
+
UnityPrint(UnityStrPointless);
|
850
|
+
UnityAddMsgIfSpecified(msg);
|
851
|
+
UNITY_FAIL_AND_BAIL;
|
852
|
+
}
|
853
|
+
|
854
|
+
if (UnityCheckArraysForNull((void*)expected, (void*)actual, lineNumber, msg) == 1)
|
855
|
+
return;
|
856
|
+
|
857
|
+
while (elements--)
|
858
|
+
{
|
859
|
+
/////////////////////////////////////
|
860
|
+
bytes = length;
|
861
|
+
while (bytes--)
|
862
|
+
{
|
863
|
+
if (*ptr_exp != *ptr_act)
|
864
|
+
{
|
865
|
+
UnityTestResultsFailBegin(lineNumber);
|
866
|
+
UnityPrint(UnityStrMemory);
|
867
|
+
if (num_elements > 1)
|
868
|
+
{
|
869
|
+
UnityPrint(UnityStrElement);
|
870
|
+
UnityPrintNumberByStyle((num_elements - elements - 1), UNITY_DISPLAY_STYLE_UINT);
|
871
|
+
}
|
872
|
+
UnityPrint(UnityStrByte);
|
873
|
+
UnityPrintNumberByStyle((length - bytes - 1), UNITY_DISPLAY_STYLE_UINT);
|
874
|
+
UnityPrint(UnityStrExpected);
|
875
|
+
UnityPrintNumberByStyle(*ptr_exp, UNITY_DISPLAY_STYLE_HEX8);
|
876
|
+
UnityPrint(UnityStrWas);
|
877
|
+
UnityPrintNumberByStyle(*ptr_act, UNITY_DISPLAY_STYLE_HEX8);
|
878
|
+
UnityAddMsgIfSpecified(msg);
|
879
|
+
UNITY_FAIL_AND_BAIL;
|
880
|
+
}
|
881
|
+
ptr_exp += 1;
|
882
|
+
ptr_act += 1;
|
883
|
+
}
|
884
|
+
/////////////////////////////////////
|
885
|
+
|
886
|
+
}
|
887
|
+
}
|
888
|
+
|
889
|
+
//-----------------------------------------------
|
890
|
+
// Control Functions
|
891
|
+
//-----------------------------------------------
|
892
|
+
|
893
|
+
void UnityFail(const char* msg, const UNITY_LINE_TYPE line)
|
894
|
+
{
|
895
|
+
UNITY_SKIP_EXECUTION;
|
896
|
+
|
897
|
+
UnityTestResultsBegin(Unity.TestFile, line);
|
898
|
+
UnityPrintFail();
|
899
|
+
if (msg != NULL)
|
900
|
+
{
|
901
|
+
UNITY_OUTPUT_CHAR(':');
|
902
|
+
if (msg[0] != ' ')
|
903
|
+
{
|
904
|
+
UNITY_OUTPUT_CHAR(' ');
|
905
|
+
}
|
906
|
+
UnityPrint(msg);
|
907
|
+
}
|
908
|
+
UNITY_FAIL_AND_BAIL;
|
909
|
+
}
|
910
|
+
|
911
|
+
//-----------------------------------------------
|
912
|
+
void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line)
|
913
|
+
{
|
914
|
+
UNITY_SKIP_EXECUTION;
|
915
|
+
|
916
|
+
UnityTestResultsBegin(Unity.TestFile, line);
|
917
|
+
UnityPrint("IGNORE");
|
918
|
+
if (msg != NULL)
|
919
|
+
{
|
920
|
+
UNITY_OUTPUT_CHAR(':');
|
921
|
+
UNITY_OUTPUT_CHAR(' ');
|
922
|
+
UnityPrint(msg);
|
923
|
+
}
|
924
|
+
UNITY_IGNORE_AND_BAIL;
|
925
|
+
}
|
926
|
+
|
927
|
+
//-----------------------------------------------
|
928
|
+
void setUp(void);
|
929
|
+
void tearDown(void);
|
930
|
+
void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum)
|
931
|
+
{
|
932
|
+
Unity.CurrentTestName = FuncName;
|
933
|
+
Unity.CurrentTestLineNumber = FuncLineNum;
|
934
|
+
Unity.NumberOfTests++;
|
935
|
+
if (TEST_PROTECT())
|
936
|
+
{
|
937
|
+
setUp();
|
938
|
+
Func();
|
939
|
+
}
|
940
|
+
if (TEST_PROTECT() && !(Unity.CurrentTestIgnored))
|
941
|
+
{
|
942
|
+
tearDown();
|
943
|
+
}
|
944
|
+
UnityConcludeTest();
|
945
|
+
}
|
946
|
+
|
947
|
+
//-----------------------------------------------
|
948
|
+
void UnityBegin(void)
|
949
|
+
{
|
950
|
+
Unity.NumberOfTests = 0;
|
951
|
+
Unity.TestFailures = 0;
|
952
|
+
Unity.TestIgnores = 0;
|
953
|
+
Unity.CurrentTestFailed = 0;
|
954
|
+
Unity.CurrentTestIgnored = 0;
|
955
|
+
}
|
956
|
+
|
957
|
+
//-----------------------------------------------
|
958
|
+
int UnityEnd(void)
|
959
|
+
{
|
960
|
+
UnityPrint("-----------------------");
|
961
|
+
UNITY_PRINT_EOL;
|
962
|
+
UnityPrintNumber(Unity.NumberOfTests);
|
963
|
+
UnityPrint(" Tests ");
|
964
|
+
UnityPrintNumber(Unity.TestFailures);
|
965
|
+
UnityPrint(" Failures ");
|
966
|
+
UnityPrintNumber(Unity.TestIgnores);
|
967
|
+
UnityPrint(" Ignored");
|
968
|
+
UNITY_PRINT_EOL;
|
969
|
+
if (Unity.TestFailures == 0U)
|
970
|
+
{
|
971
|
+
UnityPrintOk();
|
972
|
+
}
|
973
|
+
else
|
974
|
+
{
|
975
|
+
UnityPrintFail();
|
976
|
+
}
|
977
|
+
UNITY_PRINT_EOL;
|
978
|
+
return Unity.TestFailures;
|
979
|
+
}
|