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
data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c
CHANGED
@@ -18,6 +18,7 @@ TEST_GROUP_RUNNER(UnityFixture)
|
|
18
18
|
RUN_TEST_CASE(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer);
|
19
19
|
RUN_TEST_CASE(UnityFixture, CallocFillsWithZero);
|
20
20
|
RUN_TEST_CASE(UnityFixture, PointerSet);
|
21
|
+
RUN_TEST_CASE(UnityFixture, FreeNULLSafety);
|
21
22
|
}
|
22
23
|
|
23
24
|
TEST_GROUP_RUNNER(UnityCommandOptions)
|
@@ -31,6 +32,7 @@ TEST_GROUP_RUNNER(UnityCommandOptions)
|
|
31
32
|
RUN_TEST_CASE(UnityCommandOptions, MultipleOptions);
|
32
33
|
RUN_TEST_CASE(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified);
|
33
34
|
RUN_TEST_CASE(UnityCommandOptions, UnknownCommandIsIgnored);
|
35
|
+
RUN_TEST_CASE(UnityCommandOptions, TestShouldBeIgnored);
|
34
36
|
}
|
35
37
|
|
36
38
|
TEST_GROUP_RUNNER(LeakDetection)
|
@@ -38,4 +40,15 @@ TEST_GROUP_RUNNER(LeakDetection)
|
|
38
40
|
RUN_TEST_CASE(LeakDetection, DetectsLeak);
|
39
41
|
RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringFree);
|
40
42
|
RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringRealloc);
|
43
|
+
RUN_TEST_CASE(LeakDetection, BufferGuardWriteFoundDuringFree);
|
44
|
+
RUN_TEST_CASE(LeakDetection, BufferGuardWriteFoundDuringRealloc);
|
45
|
+
RUN_TEST_CASE(LeakDetection, PointerSettingMax);
|
46
|
+
}
|
47
|
+
|
48
|
+
TEST_GROUP_RUNNER(InternalMalloc)
|
49
|
+
{
|
50
|
+
RUN_TEST_CASE(InternalMalloc, MallocPastBufferFails);
|
51
|
+
RUN_TEST_CASE(InternalMalloc, CallocPastBufferFails);
|
52
|
+
RUN_TEST_CASE(InternalMalloc, MallocThenReallocGrowsMemoryInPlace);
|
53
|
+
RUN_TEST_CASE(InternalMalloc, ReallocFailDoesNotFreeMem);
|
41
54
|
}
|
@@ -7,8 +7,9 @@
|
|
7
7
|
|
8
8
|
|
9
9
|
#include "unity_output_Spy.h"
|
10
|
+
#include "unity_fixture.h"
|
11
|
+
|
10
12
|
#include <stdio.h>
|
11
|
-
#include <stdlib.h>
|
12
13
|
#include <string.h>
|
13
14
|
|
14
15
|
static int size;
|
@@ -21,11 +22,12 @@ void UnityOutputCharSpy_Create(int s)
|
|
21
22
|
size = s;
|
22
23
|
count = 0;
|
23
24
|
spy_enable = 0;
|
24
|
-
buffer = malloc(size);
|
25
|
-
|
25
|
+
buffer = malloc((size_t)size);
|
26
|
+
TEST_ASSERT_NOT_NULL_MESSAGE(buffer, "Internal malloc failed in Spy Create():" __FILE__);
|
27
|
+
memset(buffer, 0, (size_t)size);
|
26
28
|
}
|
27
29
|
|
28
|
-
void UnityOutputCharSpy_Destroy()
|
30
|
+
void UnityOutputCharSpy_Destroy(void)
|
29
31
|
{
|
30
32
|
size = 0;
|
31
33
|
free(buffer);
|
@@ -36,7 +38,7 @@ int UnityOutputCharSpy_OutputChar(int c)
|
|
36
38
|
if (spy_enable)
|
37
39
|
{
|
38
40
|
if (count < (size-1))
|
39
|
-
buffer[count++] = c;
|
41
|
+
buffer[count++] = (char)c;
|
40
42
|
}
|
41
43
|
else
|
42
44
|
{
|
@@ -45,7 +47,7 @@ int UnityOutputCharSpy_OutputChar(int c)
|
|
45
47
|
return c;
|
46
48
|
}
|
47
49
|
|
48
|
-
const char * UnityOutputCharSpy_Get()
|
50
|
+
const char * UnityOutputCharSpy_Get(void)
|
49
51
|
{
|
50
52
|
return buffer;
|
51
53
|
}
|
@@ -9,9 +9,9 @@
|
|
9
9
|
#define D_unity_output_Spy_H
|
10
10
|
|
11
11
|
void UnityOutputCharSpy_Create(int s);
|
12
|
-
void UnityOutputCharSpy_Destroy();
|
12
|
+
void UnityOutputCharSpy_Destroy(void);
|
13
13
|
int UnityOutputCharSpy_OutputChar(int c);
|
14
|
-
const char * UnityOutputCharSpy_Get();
|
14
|
+
const char * UnityOutputCharSpy_Get(void);
|
15
15
|
void UnityOutputCharSpy_Enable(int enable);
|
16
16
|
|
17
17
|
#endif
|
@@ -1,2 +1,2 @@
|
|
1
|
-
|
1
|
+
119
|
2
2
|
|
@@ -1,2 +1,2 @@
|
|
1
|
-
2.
|
1
|
+
2.3.0
|
2
2
|
|
@@ -1,1145 +1,1333 @@
|
|
1
|
-
/* =========================================================================
|
2
|
-
Unity Project - A Test Framework for C
|
3
|
-
Copyright (c) 2007-14 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 <
|
9
|
-
|
10
|
-
|
11
|
-
#define
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
const char
|
20
|
-
const char
|
21
|
-
const char
|
22
|
-
const char
|
23
|
-
const char
|
24
|
-
const char
|
25
|
-
const char
|
26
|
-
const char
|
27
|
-
const char
|
28
|
-
const char
|
29
|
-
const char
|
30
|
-
const char
|
31
|
-
const char
|
32
|
-
const char
|
33
|
-
const char
|
34
|
-
const char
|
35
|
-
const char
|
36
|
-
const char
|
37
|
-
const char
|
38
|
-
const char
|
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
|
-
UNITY_OUTPUT_CHAR(
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
UNITY_OUTPUT_CHAR('
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
UNITY_OUTPUT_CHAR('
|
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
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
}
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
}
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
UNITY_OUTPUT_CHAR(
|
178
|
-
|
179
|
-
}
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
}
|
204
|
-
|
205
|
-
//-----------------------------------------------
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
{
|
269
|
-
|
270
|
-
|
271
|
-
}
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
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
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
}
|
330
|
-
|
331
|
-
//-----------------------------------------------
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
if (
|
352
|
-
{
|
353
|
-
|
354
|
-
UnityPrint(
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
|
366
|
-
|
367
|
-
void
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
{
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
if (
|
423
|
-
{
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
if (
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
#
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
{
|
712
|
-
diff =
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
#
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
|
869
|
-
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
}
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
999
|
-
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
if (
|
1099
|
-
{
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1
|
+
/* =========================================================================
|
2
|
+
Unity Project - A Test Framework for C
|
3
|
+
Copyright (c) 2007-14 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 <stddef.h>
|
9
|
+
|
10
|
+
#define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; longjmp(Unity.AbortFrame, 1); }
|
11
|
+
#define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; longjmp(Unity.AbortFrame, 1); }
|
12
|
+
/// return prematurely if we are already in failure or ignore state
|
13
|
+
#define UNITY_SKIP_EXECUTION { if ((Unity.CurrentTestFailed != 0) || (Unity.CurrentTestIgnored != 0)) {return;} }
|
14
|
+
|
15
|
+
struct _Unity Unity;
|
16
|
+
|
17
|
+
const char UnityStrOk[] = "OK";
|
18
|
+
const char UnityStrPass[] = "PASS";
|
19
|
+
const char UnityStrFail[] = "FAIL";
|
20
|
+
const char UnityStrIgnore[] = "IGNORE";
|
21
|
+
const char UnityStrNull[] = "NULL";
|
22
|
+
const char UnityStrSpacer[] = ". ";
|
23
|
+
const char UnityStrExpected[] = " Expected ";
|
24
|
+
const char UnityStrWas[] = " Was ";
|
25
|
+
const char UnityStrTo[] = " To ";
|
26
|
+
const char UnityStrElement[] = " Element ";
|
27
|
+
const char UnityStrByte[] = " Byte ";
|
28
|
+
const char UnityStrMemory[] = " Memory Mismatch.";
|
29
|
+
const char UnityStrDelta[] = " Values Not Within Delta ";
|
30
|
+
const char UnityStrPointless[] = " You Asked Me To Compare Nothing, Which Was Pointless.";
|
31
|
+
const char UnityStrNullPointerForExpected[] = " Expected pointer to be NULL";
|
32
|
+
const char UnityStrNullPointerForActual[] = " Actual pointer was NULL";
|
33
|
+
const char UnityStrNot[] = "Not ";
|
34
|
+
const char UnityStrInf[] = "Infinity";
|
35
|
+
const char UnityStrNegInf[] = "Negative Infinity";
|
36
|
+
const char UnityStrNaN[] = "NaN";
|
37
|
+
const char UnityStrDet[] = "Determinate";
|
38
|
+
const char UnityStrErrFloat[] = "Unity Floating Point Disabled";
|
39
|
+
const char UnityStrErrDouble[] = "Unity Double Precision Disabled";
|
40
|
+
const char UnityStrErr64[] = "Unity 64-bit Support Disabled";
|
41
|
+
const char UnityStrBreaker[] = "-----------------------";
|
42
|
+
const char UnityStrResultsTests[] = " Tests ";
|
43
|
+
const char UnityStrResultsFailures[] = " Failures ";
|
44
|
+
const char UnityStrResultsIgnored[] = " Ignored ";
|
45
|
+
const char UnityStrDetail1Name[] = UNITY_DETAIL1_NAME " ";
|
46
|
+
const char UnityStrDetail2Name[] = " " UNITY_DETAIL2_NAME " ";
|
47
|
+
|
48
|
+
#ifdef UNITY_FLOAT_NEEDS_ZERO
|
49
|
+
// Dividing by these constants produces +/- infinity.
|
50
|
+
// The rationale is given in UnityAssertFloatIsInf's body.
|
51
|
+
static const _UF f_zero = 0.0f;
|
52
|
+
#endif
|
53
|
+
|
54
|
+
// compiler-generic print formatting masks
|
55
|
+
const _U_UINT UnitySizeMask[] =
|
56
|
+
{
|
57
|
+
255u, // 0xFF
|
58
|
+
65535u, // 0xFFFF
|
59
|
+
65535u,
|
60
|
+
4294967295u, // 0xFFFFFFFF
|
61
|
+
4294967295u,
|
62
|
+
4294967295u,
|
63
|
+
4294967295u
|
64
|
+
#ifdef UNITY_SUPPORT_64
|
65
|
+
,0xFFFFFFFFFFFFFFFF
|
66
|
+
#endif
|
67
|
+
};
|
68
|
+
|
69
|
+
void UnityPrintFail(void);
|
70
|
+
void UnityPrintOk(void);
|
71
|
+
|
72
|
+
//-----------------------------------------------
|
73
|
+
// Pretty Printers & Test Result Output Handlers
|
74
|
+
//-----------------------------------------------
|
75
|
+
|
76
|
+
void UnityPrint(const char* string)
|
77
|
+
{
|
78
|
+
const char* pch = string;
|
79
|
+
|
80
|
+
if (pch != NULL)
|
81
|
+
{
|
82
|
+
while (*pch)
|
83
|
+
{
|
84
|
+
// printable characters plus CR & LF are printed
|
85
|
+
if ((*pch <= 126) && (*pch >= 32))
|
86
|
+
{
|
87
|
+
UNITY_OUTPUT_CHAR(*pch);
|
88
|
+
}
|
89
|
+
//write escaped carriage returns
|
90
|
+
else if (*pch == 13)
|
91
|
+
{
|
92
|
+
UNITY_OUTPUT_CHAR('\\');
|
93
|
+
UNITY_OUTPUT_CHAR('r');
|
94
|
+
}
|
95
|
+
//write escaped line feeds
|
96
|
+
else if (*pch == 10)
|
97
|
+
{
|
98
|
+
UNITY_OUTPUT_CHAR('\\');
|
99
|
+
UNITY_OUTPUT_CHAR('n');
|
100
|
+
}
|
101
|
+
// unprintable characters are shown as codes
|
102
|
+
else
|
103
|
+
{
|
104
|
+
UNITY_OUTPUT_CHAR('\\');
|
105
|
+
UnityPrintNumberHex((_U_UINT)*pch, 2);
|
106
|
+
}
|
107
|
+
pch++;
|
108
|
+
}
|
109
|
+
}
|
110
|
+
}
|
111
|
+
|
112
|
+
void UnityPrintLen(const char* string, const _UU32 length);
|
113
|
+
void UnityPrintLen(const char* string, const _UU32 length)
|
114
|
+
{
|
115
|
+
const char* pch = string;
|
116
|
+
|
117
|
+
if (pch != NULL)
|
118
|
+
{
|
119
|
+
while (*pch && (_UU32)(pch - string) < length)
|
120
|
+
{
|
121
|
+
// printable characters plus CR & LF are printed
|
122
|
+
if ((*pch <= 126) && (*pch >= 32))
|
123
|
+
{
|
124
|
+
UNITY_OUTPUT_CHAR(*pch);
|
125
|
+
}
|
126
|
+
//write escaped carriage returns
|
127
|
+
else if (*pch == 13)
|
128
|
+
{
|
129
|
+
UNITY_OUTPUT_CHAR('\\');
|
130
|
+
UNITY_OUTPUT_CHAR('r');
|
131
|
+
}
|
132
|
+
//write escaped line feeds
|
133
|
+
else if (*pch == 10)
|
134
|
+
{
|
135
|
+
UNITY_OUTPUT_CHAR('\\');
|
136
|
+
UNITY_OUTPUT_CHAR('n');
|
137
|
+
}
|
138
|
+
// unprintable characters are shown as codes
|
139
|
+
else
|
140
|
+
{
|
141
|
+
UNITY_OUTPUT_CHAR('\\');
|
142
|
+
UnityPrintNumberHex((_U_UINT)*pch, 2);
|
143
|
+
}
|
144
|
+
pch++;
|
145
|
+
}
|
146
|
+
}
|
147
|
+
}
|
148
|
+
|
149
|
+
//-----------------------------------------------
|
150
|
+
void UnityPrintNumberByStyle(const _U_SINT number, const UNITY_DISPLAY_STYLE_T style)
|
151
|
+
{
|
152
|
+
if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
|
153
|
+
{
|
154
|
+
UnityPrintNumber(number);
|
155
|
+
}
|
156
|
+
else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT)
|
157
|
+
{
|
158
|
+
UnityPrintNumberUnsigned( (_U_UINT)number & UnitySizeMask[((_U_UINT)style & (_U_UINT)0x0F) - 1] );
|
159
|
+
}
|
160
|
+
else
|
161
|
+
{
|
162
|
+
UnityPrintNumberHex((_U_UINT)number, (char)((style & 0x000F) << 1));
|
163
|
+
}
|
164
|
+
}
|
165
|
+
|
166
|
+
//-----------------------------------------------
|
167
|
+
/// basically do an itoa using as little ram as possible
|
168
|
+
void UnityPrintNumber(const _U_SINT number_to_print)
|
169
|
+
{
|
170
|
+
_U_UINT divisor = 1;
|
171
|
+
_U_UINT next_divisor;
|
172
|
+
_U_UINT number;
|
173
|
+
|
174
|
+
if (number_to_print < 0)
|
175
|
+
{
|
176
|
+
//A negative number, including MIN negative
|
177
|
+
UNITY_OUTPUT_CHAR('-');
|
178
|
+
number = (_U_UINT)(-number_to_print);
|
179
|
+
}
|
180
|
+
else
|
181
|
+
{
|
182
|
+
//Non-negative number
|
183
|
+
number = (_U_UINT)number_to_print;
|
184
|
+
}
|
185
|
+
|
186
|
+
// figure out initial divisor
|
187
|
+
while (number / divisor > 9)
|
188
|
+
{
|
189
|
+
next_divisor = divisor * 10;
|
190
|
+
if (next_divisor > divisor)
|
191
|
+
divisor = next_divisor;
|
192
|
+
else
|
193
|
+
break;
|
194
|
+
}
|
195
|
+
|
196
|
+
// now mod and print, then divide divisor
|
197
|
+
do
|
198
|
+
{
|
199
|
+
UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10)));
|
200
|
+
divisor /= 10;
|
201
|
+
}
|
202
|
+
while (divisor > 0);
|
203
|
+
}
|
204
|
+
|
205
|
+
//-----------------------------------------------
|
206
|
+
/// basically do an itoa using as little ram as possible
|
207
|
+
void UnityPrintNumberUnsigned(const _U_UINT number)
|
208
|
+
{
|
209
|
+
_U_UINT divisor = 1;
|
210
|
+
_U_UINT next_divisor;
|
211
|
+
|
212
|
+
// figure out initial divisor
|
213
|
+
while (number / divisor > 9)
|
214
|
+
{
|
215
|
+
next_divisor = divisor * 10;
|
216
|
+
if (next_divisor > divisor)
|
217
|
+
divisor = next_divisor;
|
218
|
+
else
|
219
|
+
break;
|
220
|
+
}
|
221
|
+
|
222
|
+
// now mod and print, then divide divisor
|
223
|
+
do
|
224
|
+
{
|
225
|
+
UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10)));
|
226
|
+
divisor /= 10;
|
227
|
+
}
|
228
|
+
while (divisor > 0);
|
229
|
+
}
|
230
|
+
|
231
|
+
//-----------------------------------------------
|
232
|
+
void UnityPrintNumberHex(const _U_UINT number, const char nibbles_to_print)
|
233
|
+
{
|
234
|
+
_U_UINT nibble;
|
235
|
+
char nibbles = nibbles_to_print;
|
236
|
+
UNITY_OUTPUT_CHAR('0');
|
237
|
+
UNITY_OUTPUT_CHAR('x');
|
238
|
+
|
239
|
+
while (nibbles > 0)
|
240
|
+
{
|
241
|
+
nibble = (number >> (--nibbles << 2)) & 0x0000000F;
|
242
|
+
if (nibble <= 9)
|
243
|
+
{
|
244
|
+
UNITY_OUTPUT_CHAR((char)('0' + nibble));
|
245
|
+
}
|
246
|
+
else
|
247
|
+
{
|
248
|
+
UNITY_OUTPUT_CHAR((char)('A' - 10 + nibble));
|
249
|
+
}
|
250
|
+
}
|
251
|
+
}
|
252
|
+
|
253
|
+
//-----------------------------------------------
|
254
|
+
void UnityPrintMask(const _U_UINT mask, const _U_UINT number)
|
255
|
+
{
|
256
|
+
_U_UINT current_bit = (_U_UINT)1 << (UNITY_INT_WIDTH - 1);
|
257
|
+
_US32 i;
|
258
|
+
|
259
|
+
for (i = 0; i < UNITY_INT_WIDTH; i++)
|
260
|
+
{
|
261
|
+
if (current_bit & mask)
|
262
|
+
{
|
263
|
+
if (current_bit & number)
|
264
|
+
{
|
265
|
+
UNITY_OUTPUT_CHAR('1');
|
266
|
+
}
|
267
|
+
else
|
268
|
+
{
|
269
|
+
UNITY_OUTPUT_CHAR('0');
|
270
|
+
}
|
271
|
+
}
|
272
|
+
else
|
273
|
+
{
|
274
|
+
UNITY_OUTPUT_CHAR('X');
|
275
|
+
}
|
276
|
+
current_bit = current_bit >> 1;
|
277
|
+
}
|
278
|
+
}
|
279
|
+
|
280
|
+
//-----------------------------------------------
|
281
|
+
#ifdef UNITY_FLOAT_VERBOSE
|
282
|
+
#include <stdio.h>
|
283
|
+
|
284
|
+
#ifndef UNITY_VERBOSE_NUMBER_MAX_LENGTH
|
285
|
+
# ifdef UNITY_DOUBLE_VERBOSE
|
286
|
+
# define UNITY_VERBOSE_NUMBER_MAX_LENGTH 317
|
287
|
+
# else
|
288
|
+
# define UNITY_VERBOSE_NUMBER_MAX_LENGTH 47
|
289
|
+
# endif
|
290
|
+
#endif
|
291
|
+
|
292
|
+
void UnityPrintFloat(_UF number)
|
293
|
+
{
|
294
|
+
char TempBuffer[UNITY_VERBOSE_NUMBER_MAX_LENGTH + 1];
|
295
|
+
snprintf(TempBuffer, sizeof(TempBuffer), "%.6f", number);
|
296
|
+
UnityPrint(TempBuffer);
|
297
|
+
}
|
298
|
+
#endif
|
299
|
+
|
300
|
+
//-----------------------------------------------
|
301
|
+
|
302
|
+
void UnityPrintFail(void);
|
303
|
+
void UnityPrintFail(void)
|
304
|
+
{
|
305
|
+
UnityPrint(UnityStrFail);
|
306
|
+
}
|
307
|
+
|
308
|
+
void UnityPrintOk(void);
|
309
|
+
void UnityPrintOk(void)
|
310
|
+
{
|
311
|
+
UnityPrint(UnityStrOk);
|
312
|
+
}
|
313
|
+
|
314
|
+
//-----------------------------------------------
|
315
|
+
static void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line);
|
316
|
+
static void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line)
|
317
|
+
{
|
318
|
+
#ifndef UNITY_FIXTURES
|
319
|
+
UnityPrint(file);
|
320
|
+
UNITY_OUTPUT_CHAR(':');
|
321
|
+
UnityPrintNumber((_U_SINT)line);
|
322
|
+
UNITY_OUTPUT_CHAR(':');
|
323
|
+
UnityPrint(Unity.CurrentTestName);
|
324
|
+
UNITY_OUTPUT_CHAR(':');
|
325
|
+
#else
|
326
|
+
UNITY_UNUSED(file);
|
327
|
+
UNITY_UNUSED(line);
|
328
|
+
#endif
|
329
|
+
}
|
330
|
+
|
331
|
+
//-----------------------------------------------
|
332
|
+
static void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line);
|
333
|
+
static void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line)
|
334
|
+
{
|
335
|
+
#ifndef UNITY_FIXTURES
|
336
|
+
UnityTestResultsBegin(Unity.TestFile, line);
|
337
|
+
#else
|
338
|
+
UNITY_UNUSED(line);
|
339
|
+
#endif
|
340
|
+
UnityPrint(UnityStrFail);
|
341
|
+
UNITY_OUTPUT_CHAR(':');
|
342
|
+
}
|
343
|
+
|
344
|
+
//-----------------------------------------------
|
345
|
+
void UnityConcludeTest(void)
|
346
|
+
{
|
347
|
+
if (Unity.CurrentTestIgnored)
|
348
|
+
{
|
349
|
+
Unity.TestIgnores++;
|
350
|
+
}
|
351
|
+
else if (!Unity.CurrentTestFailed)
|
352
|
+
{
|
353
|
+
UnityTestResultsBegin(Unity.TestFile, Unity.CurrentTestLineNumber);
|
354
|
+
UnityPrint(UnityStrPass);
|
355
|
+
}
|
356
|
+
else
|
357
|
+
{
|
358
|
+
Unity.TestFailures++;
|
359
|
+
}
|
360
|
+
|
361
|
+
Unity.CurrentTestFailed = 0;
|
362
|
+
Unity.CurrentTestIgnored = 0;
|
363
|
+
UNITY_PRINT_EOL();
|
364
|
+
}
|
365
|
+
|
366
|
+
//-----------------------------------------------
|
367
|
+
static void UnityAddMsgIfSpecified(const char* msg);
|
368
|
+
static void UnityAddMsgIfSpecified(const char* msg)
|
369
|
+
{
|
370
|
+
if (msg)
|
371
|
+
{
|
372
|
+
UnityPrint(UnityStrSpacer);
|
373
|
+
#ifndef UNITY_EXCLUDE_DETAILS
|
374
|
+
if (Unity.CurrentDetail1)
|
375
|
+
{
|
376
|
+
UnityPrint(UnityStrDetail1Name);
|
377
|
+
UnityPrint(Unity.CurrentDetail1);
|
378
|
+
if (Unity.CurrentDetail2)
|
379
|
+
{
|
380
|
+
UnityPrint(UnityStrDetail2Name);
|
381
|
+
UnityPrint(Unity.CurrentDetail2);
|
382
|
+
}
|
383
|
+
UnityPrint(UnityStrSpacer);
|
384
|
+
}
|
385
|
+
#endif
|
386
|
+
UnityPrint(msg);
|
387
|
+
}
|
388
|
+
}
|
389
|
+
|
390
|
+
//-----------------------------------------------
|
391
|
+
static void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual);
|
392
|
+
static void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual)
|
393
|
+
{
|
394
|
+
UnityPrint(UnityStrExpected);
|
395
|
+
if (expected != NULL)
|
396
|
+
{
|
397
|
+
UNITY_OUTPUT_CHAR('\'');
|
398
|
+
UnityPrint(expected);
|
399
|
+
UNITY_OUTPUT_CHAR('\'');
|
400
|
+
}
|
401
|
+
else
|
402
|
+
{
|
403
|
+
UnityPrint(UnityStrNull);
|
404
|
+
}
|
405
|
+
UnityPrint(UnityStrWas);
|
406
|
+
if (actual != NULL)
|
407
|
+
{
|
408
|
+
UNITY_OUTPUT_CHAR('\'');
|
409
|
+
UnityPrint(actual);
|
410
|
+
UNITY_OUTPUT_CHAR('\'');
|
411
|
+
}
|
412
|
+
else
|
413
|
+
{
|
414
|
+
UnityPrint(UnityStrNull);
|
415
|
+
}
|
416
|
+
}
|
417
|
+
|
418
|
+
//-----------------------------------------------
|
419
|
+
static void UnityPrintExpectedAndActualStringsLen(const char* expected, const char* actual, const _UU32 length)
|
420
|
+
{
|
421
|
+
UnityPrint(UnityStrExpected);
|
422
|
+
if (expected != NULL)
|
423
|
+
{
|
424
|
+
UNITY_OUTPUT_CHAR('\'');
|
425
|
+
UnityPrintLen(expected, length);
|
426
|
+
UNITY_OUTPUT_CHAR('\'');
|
427
|
+
}
|
428
|
+
else
|
429
|
+
{
|
430
|
+
UnityPrint(UnityStrNull);
|
431
|
+
}
|
432
|
+
UnityPrint(UnityStrWas);
|
433
|
+
if (actual != NULL)
|
434
|
+
{
|
435
|
+
UNITY_OUTPUT_CHAR('\'');
|
436
|
+
UnityPrintLen(actual, length);
|
437
|
+
UNITY_OUTPUT_CHAR('\'');
|
438
|
+
}
|
439
|
+
else
|
440
|
+
{
|
441
|
+
UnityPrint(UnityStrNull);
|
442
|
+
}
|
443
|
+
}
|
444
|
+
|
445
|
+
|
446
|
+
|
447
|
+
//-----------------------------------------------
|
448
|
+
// Assertion & Control Helpers
|
449
|
+
//-----------------------------------------------
|
450
|
+
|
451
|
+
static int UnityCheckArraysForNull(UNITY_INTERNAL_PTR expected, UNITY_INTERNAL_PTR actual, const UNITY_LINE_TYPE lineNumber, const char* msg)
|
452
|
+
{
|
453
|
+
//return true if they are both NULL
|
454
|
+
if ((expected == NULL) && (actual == NULL))
|
455
|
+
return 1;
|
456
|
+
|
457
|
+
//throw error if just expected is NULL
|
458
|
+
if (expected == NULL)
|
459
|
+
{
|
460
|
+
UnityTestResultsFailBegin(lineNumber);
|
461
|
+
UnityPrint(UnityStrNullPointerForExpected);
|
462
|
+
UnityAddMsgIfSpecified(msg);
|
463
|
+
UNITY_FAIL_AND_BAIL;
|
464
|
+
}
|
465
|
+
|
466
|
+
//throw error if just actual is NULL
|
467
|
+
if (actual == NULL)
|
468
|
+
{
|
469
|
+
UnityTestResultsFailBegin(lineNumber);
|
470
|
+
UnityPrint(UnityStrNullPointerForActual);
|
471
|
+
UnityAddMsgIfSpecified(msg);
|
472
|
+
UNITY_FAIL_AND_BAIL;
|
473
|
+
}
|
474
|
+
|
475
|
+
//return false if neither is NULL
|
476
|
+
return 0;
|
477
|
+
}
|
478
|
+
|
479
|
+
//-----------------------------------------------
|
480
|
+
// Assertion Functions
|
481
|
+
//-----------------------------------------------
|
482
|
+
|
483
|
+
void UnityAssertBits(const _U_SINT mask,
|
484
|
+
const _U_SINT expected,
|
485
|
+
const _U_SINT actual,
|
486
|
+
const char* msg,
|
487
|
+
const UNITY_LINE_TYPE lineNumber)
|
488
|
+
{
|
489
|
+
UNITY_SKIP_EXECUTION;
|
490
|
+
|
491
|
+
if ((mask & expected) != (mask & actual))
|
492
|
+
{
|
493
|
+
UnityTestResultsFailBegin(lineNumber);
|
494
|
+
UnityPrint(UnityStrExpected);
|
495
|
+
UnityPrintMask((_U_UINT)mask, (_U_UINT)expected);
|
496
|
+
UnityPrint(UnityStrWas);
|
497
|
+
UnityPrintMask((_U_UINT)mask, (_U_UINT)actual);
|
498
|
+
UnityAddMsgIfSpecified(msg);
|
499
|
+
UNITY_FAIL_AND_BAIL;
|
500
|
+
}
|
501
|
+
}
|
502
|
+
|
503
|
+
//-----------------------------------------------
|
504
|
+
void UnityAssertEqualNumber(const _U_SINT expected,
|
505
|
+
const _U_SINT actual,
|
506
|
+
const char* msg,
|
507
|
+
const UNITY_LINE_TYPE lineNumber,
|
508
|
+
const UNITY_DISPLAY_STYLE_T style)
|
509
|
+
{
|
510
|
+
UNITY_SKIP_EXECUTION;
|
511
|
+
|
512
|
+
if (expected != actual)
|
513
|
+
{
|
514
|
+
UnityTestResultsFailBegin(lineNumber);
|
515
|
+
UnityPrint(UnityStrExpected);
|
516
|
+
UnityPrintNumberByStyle(expected, style);
|
517
|
+
UnityPrint(UnityStrWas);
|
518
|
+
UnityPrintNumberByStyle(actual, style);
|
519
|
+
UnityAddMsgIfSpecified(msg);
|
520
|
+
UNITY_FAIL_AND_BAIL;
|
521
|
+
}
|
522
|
+
}
|
523
|
+
|
524
|
+
//-----------------------------------------------
|
525
|
+
void UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,
|
526
|
+
UNITY_INTERNAL_PTR actual,
|
527
|
+
const _UU32 num_elements,
|
528
|
+
const char* msg,
|
529
|
+
const UNITY_LINE_TYPE lineNumber,
|
530
|
+
const UNITY_DISPLAY_STYLE_T style)
|
531
|
+
{
|
532
|
+
_UU32 elements = num_elements;
|
533
|
+
UNITY_INTERNAL_PTR ptr_exp = (UNITY_INTERNAL_PTR)expected;
|
534
|
+
UNITY_INTERNAL_PTR ptr_act = (UNITY_INTERNAL_PTR)actual;
|
535
|
+
|
536
|
+
UNITY_SKIP_EXECUTION;
|
537
|
+
|
538
|
+
if (elements == 0)
|
539
|
+
{
|
540
|
+
UnityTestResultsFailBegin(lineNumber);
|
541
|
+
UnityPrint(UnityStrPointless);
|
542
|
+
UnityAddMsgIfSpecified(msg);
|
543
|
+
UNITY_FAIL_AND_BAIL;
|
544
|
+
}
|
545
|
+
|
546
|
+
if (UnityCheckArraysForNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg) == 1)
|
547
|
+
return;
|
548
|
+
|
549
|
+
// If style is UNITY_DISPLAY_STYLE_INT, we'll fall into the default case rather than the INT16 or INT32 (etc) case
|
550
|
+
// as UNITY_DISPLAY_STYLE_INT includes a flag for UNITY_DISPLAY_RANGE_AUTO, which the width-specific
|
551
|
+
// variants do not. Therefore remove this flag.
|
552
|
+
switch(style & (UNITY_DISPLAY_STYLE_T)(~UNITY_DISPLAY_RANGE_AUTO))
|
553
|
+
{
|
554
|
+
case UNITY_DISPLAY_STYLE_HEX8:
|
555
|
+
case UNITY_DISPLAY_STYLE_INT8:
|
556
|
+
case UNITY_DISPLAY_STYLE_UINT8:
|
557
|
+
while (elements--)
|
558
|
+
{
|
559
|
+
if (*(UNITY_PTR_ATTRIBUTE const _US8*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const _US8*)ptr_act)
|
560
|
+
{
|
561
|
+
UnityTestResultsFailBegin(lineNumber);
|
562
|
+
UnityPrint(UnityStrElement);
|
563
|
+
UnityPrintNumberUnsigned(num_elements - elements - 1);
|
564
|
+
UnityPrint(UnityStrExpected);
|
565
|
+
UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US8*)ptr_exp, style);
|
566
|
+
UnityPrint(UnityStrWas);
|
567
|
+
UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US8*)ptr_act, style);
|
568
|
+
UnityAddMsgIfSpecified(msg);
|
569
|
+
UNITY_FAIL_AND_BAIL;
|
570
|
+
}
|
571
|
+
ptr_exp = (UNITY_INTERNAL_PTR)((_UP)ptr_exp + 1);
|
572
|
+
ptr_act = (UNITY_INTERNAL_PTR)((_UP)ptr_act + 1);
|
573
|
+
}
|
574
|
+
break;
|
575
|
+
case UNITY_DISPLAY_STYLE_HEX16:
|
576
|
+
case UNITY_DISPLAY_STYLE_INT16:
|
577
|
+
case UNITY_DISPLAY_STYLE_UINT16:
|
578
|
+
while (elements--)
|
579
|
+
{
|
580
|
+
if (*(UNITY_PTR_ATTRIBUTE const _US16*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const _US16*)ptr_act)
|
581
|
+
{
|
582
|
+
UnityTestResultsFailBegin(lineNumber);
|
583
|
+
UnityPrint(UnityStrElement);
|
584
|
+
UnityPrintNumberUnsigned(num_elements - elements - 1);
|
585
|
+
UnityPrint(UnityStrExpected);
|
586
|
+
UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US16*)ptr_exp, style);
|
587
|
+
UnityPrint(UnityStrWas);
|
588
|
+
UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US16*)ptr_act, style);
|
589
|
+
UnityAddMsgIfSpecified(msg);
|
590
|
+
UNITY_FAIL_AND_BAIL;
|
591
|
+
}
|
592
|
+
ptr_exp = (UNITY_INTERNAL_PTR)((_UP)ptr_exp + 2);
|
593
|
+
ptr_act = (UNITY_INTERNAL_PTR)((_UP)ptr_act + 2);
|
594
|
+
}
|
595
|
+
break;
|
596
|
+
#ifdef UNITY_SUPPORT_64
|
597
|
+
case UNITY_DISPLAY_STYLE_HEX64:
|
598
|
+
case UNITY_DISPLAY_STYLE_INT64:
|
599
|
+
case UNITY_DISPLAY_STYLE_UINT64:
|
600
|
+
while (elements--)
|
601
|
+
{
|
602
|
+
if (*(UNITY_PTR_ATTRIBUTE const _US64*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const _US64*)ptr_act)
|
603
|
+
{
|
604
|
+
UnityTestResultsFailBegin(lineNumber);
|
605
|
+
UnityPrint(UnityStrElement);
|
606
|
+
UnityPrintNumberUnsigned(num_elements - elements - 1);
|
607
|
+
UnityPrint(UnityStrExpected);
|
608
|
+
UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US64*)ptr_exp, style);
|
609
|
+
UnityPrint(UnityStrWas);
|
610
|
+
UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US64*)ptr_act, style);
|
611
|
+
UnityAddMsgIfSpecified(msg);
|
612
|
+
UNITY_FAIL_AND_BAIL;
|
613
|
+
}
|
614
|
+
ptr_exp = (UNITY_INTERNAL_PTR)((_UP)ptr_exp + 8);
|
615
|
+
ptr_act = (UNITY_INTERNAL_PTR)((_UP)ptr_act + 8);
|
616
|
+
}
|
617
|
+
break;
|
618
|
+
#endif
|
619
|
+
default:
|
620
|
+
while (elements--)
|
621
|
+
{
|
622
|
+
if (*(UNITY_PTR_ATTRIBUTE const _US32*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const _US32*)ptr_act)
|
623
|
+
{
|
624
|
+
UnityTestResultsFailBegin(lineNumber);
|
625
|
+
UnityPrint(UnityStrElement);
|
626
|
+
UnityPrintNumberUnsigned(num_elements - elements - 1);
|
627
|
+
UnityPrint(UnityStrExpected);
|
628
|
+
UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US32*)ptr_exp, style);
|
629
|
+
UnityPrint(UnityStrWas);
|
630
|
+
UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const _US32*)ptr_act, style);
|
631
|
+
UnityAddMsgIfSpecified(msg);
|
632
|
+
UNITY_FAIL_AND_BAIL;
|
633
|
+
}
|
634
|
+
ptr_exp = (UNITY_INTERNAL_PTR)((_UP)ptr_exp + 4);
|
635
|
+
ptr_act = (UNITY_INTERNAL_PTR)((_UP)ptr_act + 4);
|
636
|
+
}
|
637
|
+
break;
|
638
|
+
}
|
639
|
+
}
|
640
|
+
|
641
|
+
//-----------------------------------------------
|
642
|
+
#ifndef UNITY_EXCLUDE_FLOAT
|
643
|
+
void UnityAssertEqualFloatArray(UNITY_PTR_ATTRIBUTE const _UF* expected,
|
644
|
+
UNITY_PTR_ATTRIBUTE const _UF* actual,
|
645
|
+
const _UU32 num_elements,
|
646
|
+
const char* msg,
|
647
|
+
const UNITY_LINE_TYPE lineNumber)
|
648
|
+
{
|
649
|
+
_UU32 elements = num_elements;
|
650
|
+
UNITY_PTR_ATTRIBUTE const _UF* ptr_expected = expected;
|
651
|
+
UNITY_PTR_ATTRIBUTE const _UF* ptr_actual = actual;
|
652
|
+
_UF diff, tol;
|
653
|
+
|
654
|
+
UNITY_SKIP_EXECUTION;
|
655
|
+
|
656
|
+
if (elements == 0)
|
657
|
+
{
|
658
|
+
UnityTestResultsFailBegin(lineNumber);
|
659
|
+
UnityPrint(UnityStrPointless);
|
660
|
+
UnityAddMsgIfSpecified(msg);
|
661
|
+
UNITY_FAIL_AND_BAIL;
|
662
|
+
}
|
663
|
+
|
664
|
+
if (UnityCheckArraysForNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg) == 1)
|
665
|
+
return;
|
666
|
+
|
667
|
+
while (elements--)
|
668
|
+
{
|
669
|
+
diff = *ptr_expected - *ptr_actual;
|
670
|
+
if (diff < 0.0f)
|
671
|
+
diff = 0.0f - diff;
|
672
|
+
tol = UNITY_FLOAT_PRECISION * *ptr_expected;
|
673
|
+
if (tol < 0.0f)
|
674
|
+
tol = 0.0f - tol;
|
675
|
+
|
676
|
+
//This first part of this condition will catch any NaN or Infinite values
|
677
|
+
if ((diff * 0.0f != 0.0f) || (diff > tol))
|
678
|
+
{
|
679
|
+
UnityTestResultsFailBegin(lineNumber);
|
680
|
+
UnityPrint(UnityStrElement);
|
681
|
+
UnityPrintNumberUnsigned(num_elements - elements - 1);
|
682
|
+
#ifdef UNITY_FLOAT_VERBOSE
|
683
|
+
UnityPrint(UnityStrExpected);
|
684
|
+
UnityPrintFloat(*ptr_expected);
|
685
|
+
UnityPrint(UnityStrWas);
|
686
|
+
UnityPrintFloat(*ptr_actual);
|
687
|
+
#else
|
688
|
+
UnityPrint(UnityStrDelta);
|
689
|
+
#endif
|
690
|
+
UnityAddMsgIfSpecified(msg);
|
691
|
+
UNITY_FAIL_AND_BAIL;
|
692
|
+
}
|
693
|
+
ptr_expected++;
|
694
|
+
ptr_actual++;
|
695
|
+
}
|
696
|
+
}
|
697
|
+
|
698
|
+
//-----------------------------------------------
|
699
|
+
void UnityAssertFloatsWithin(const _UF delta,
|
700
|
+
const _UF expected,
|
701
|
+
const _UF actual,
|
702
|
+
const char* msg,
|
703
|
+
const UNITY_LINE_TYPE lineNumber)
|
704
|
+
{
|
705
|
+
_UF diff = actual - expected;
|
706
|
+
_UF pos_delta = delta;
|
707
|
+
|
708
|
+
UNITY_SKIP_EXECUTION;
|
709
|
+
|
710
|
+
if (diff < 0.0f)
|
711
|
+
{
|
712
|
+
diff = 0.0f - diff;
|
713
|
+
}
|
714
|
+
if (pos_delta < 0.0f)
|
715
|
+
{
|
716
|
+
pos_delta = 0.0f - pos_delta;
|
717
|
+
}
|
718
|
+
|
719
|
+
//This first part of this condition will catch any NaN or Infinite values
|
720
|
+
if ((diff * 0.0f != 0.0f) || (pos_delta < diff))
|
721
|
+
{
|
722
|
+
UnityTestResultsFailBegin(lineNumber);
|
723
|
+
#ifdef UNITY_FLOAT_VERBOSE
|
724
|
+
UnityPrint(UnityStrExpected);
|
725
|
+
UnityPrintFloat(expected);
|
726
|
+
UnityPrint(UnityStrWas);
|
727
|
+
UnityPrintFloat(actual);
|
728
|
+
#else
|
729
|
+
UnityPrint(UnityStrDelta);
|
730
|
+
#endif
|
731
|
+
UnityAddMsgIfSpecified(msg);
|
732
|
+
UNITY_FAIL_AND_BAIL;
|
733
|
+
}
|
734
|
+
}
|
735
|
+
|
736
|
+
//-----------------------------------------------
|
737
|
+
void UnityAssertFloatSpecial(const _UF actual,
|
738
|
+
const char* msg,
|
739
|
+
const UNITY_LINE_TYPE lineNumber,
|
740
|
+
const UNITY_FLOAT_TRAIT_T style)
|
741
|
+
{
|
742
|
+
const char* trait_names[] = { UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet };
|
743
|
+
_U_SINT should_be_trait = ((_U_SINT)style & 1);
|
744
|
+
_U_SINT is_trait = !should_be_trait;
|
745
|
+
_U_SINT trait_index = (_U_SINT)(style >> 1);
|
746
|
+
|
747
|
+
UNITY_SKIP_EXECUTION;
|
748
|
+
|
749
|
+
switch(style)
|
750
|
+
{
|
751
|
+
//To determine Inf / Neg Inf, we compare to an Inf / Neg Inf value we create on the fly
|
752
|
+
//We are using a variable to hold the zero value because some compilers complain about dividing by zero otherwise
|
753
|
+
case UNITY_FLOAT_IS_INF:
|
754
|
+
case UNITY_FLOAT_IS_NOT_INF:
|
755
|
+
is_trait = isinf(actual) & ispos(actual);
|
756
|
+
break;
|
757
|
+
case UNITY_FLOAT_IS_NEG_INF:
|
758
|
+
case UNITY_FLOAT_IS_NOT_NEG_INF:
|
759
|
+
is_trait = isinf(actual) & isneg(actual);
|
760
|
+
break;
|
761
|
+
|
762
|
+
//NaN is the only floating point value that does NOT equal itself. Therefore if Actual == Actual, then it is NOT NaN.
|
763
|
+
case UNITY_FLOAT_IS_NAN:
|
764
|
+
case UNITY_FLOAT_IS_NOT_NAN:
|
765
|
+
is_trait = isnan(actual);
|
766
|
+
break;
|
767
|
+
|
768
|
+
//A determinate number is non infinite and not NaN. (therefore the opposite of the two above)
|
769
|
+
case UNITY_FLOAT_IS_DET:
|
770
|
+
case UNITY_FLOAT_IS_NOT_DET:
|
771
|
+
if (isinf(actual) | isnan(actual))
|
772
|
+
is_trait = 0;
|
773
|
+
else
|
774
|
+
is_trait = 1;
|
775
|
+
break;
|
776
|
+
|
777
|
+
default:
|
778
|
+
break;
|
779
|
+
}
|
780
|
+
|
781
|
+
if (is_trait != should_be_trait)
|
782
|
+
{
|
783
|
+
UnityTestResultsFailBegin(lineNumber);
|
784
|
+
UnityPrint(UnityStrExpected);
|
785
|
+
if (!should_be_trait)
|
786
|
+
UnityPrint(UnityStrNot);
|
787
|
+
UnityPrint(trait_names[trait_index]);
|
788
|
+
UnityPrint(UnityStrWas);
|
789
|
+
#ifdef UNITY_FLOAT_VERBOSE
|
790
|
+
UnityPrintFloat(actual);
|
791
|
+
#else
|
792
|
+
if (should_be_trait)
|
793
|
+
UnityPrint(UnityStrNot);
|
794
|
+
UnityPrint(trait_names[trait_index]);
|
795
|
+
#endif
|
796
|
+
UnityAddMsgIfSpecified(msg);
|
797
|
+
UNITY_FAIL_AND_BAIL;
|
798
|
+
}
|
799
|
+
}
|
800
|
+
|
801
|
+
#endif //not UNITY_EXCLUDE_FLOAT
|
802
|
+
|
803
|
+
//-----------------------------------------------
|
804
|
+
#ifndef UNITY_EXCLUDE_DOUBLE
|
805
|
+
void UnityAssertEqualDoubleArray(UNITY_PTR_ATTRIBUTE const _UD* expected,
|
806
|
+
UNITY_PTR_ATTRIBUTE const _UD* actual,
|
807
|
+
const _UU32 num_elements,
|
808
|
+
const char* msg,
|
809
|
+
const UNITY_LINE_TYPE lineNumber)
|
810
|
+
{
|
811
|
+
_UU32 elements = num_elements;
|
812
|
+
UNITY_PTR_ATTRIBUTE const _UD* ptr_expected = expected;
|
813
|
+
UNITY_PTR_ATTRIBUTE const _UD* ptr_actual = actual;
|
814
|
+
_UD diff, tol;
|
815
|
+
|
816
|
+
UNITY_SKIP_EXECUTION;
|
817
|
+
|
818
|
+
if (elements == 0)
|
819
|
+
{
|
820
|
+
UnityTestResultsFailBegin(lineNumber);
|
821
|
+
UnityPrint(UnityStrPointless);
|
822
|
+
UnityAddMsgIfSpecified(msg);
|
823
|
+
UNITY_FAIL_AND_BAIL;
|
824
|
+
}
|
825
|
+
|
826
|
+
if (UnityCheckArraysForNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg) == 1)
|
827
|
+
return;
|
828
|
+
|
829
|
+
while (elements--)
|
830
|
+
{
|
831
|
+
diff = *ptr_expected - *ptr_actual;
|
832
|
+
if (diff < 0.0)
|
833
|
+
diff = 0.0 - diff;
|
834
|
+
tol = UNITY_DOUBLE_PRECISION * *ptr_expected;
|
835
|
+
if (tol < 0.0)
|
836
|
+
tol = 0.0 - tol;
|
837
|
+
|
838
|
+
//This first part of this condition will catch any NaN or Infinite values
|
839
|
+
if ((diff * 0.0 != 0.0) || (diff > tol))
|
840
|
+
{
|
841
|
+
UnityTestResultsFailBegin(lineNumber);
|
842
|
+
UnityPrint(UnityStrElement);
|
843
|
+
UnityPrintNumberUnsigned(num_elements - elements - 1);
|
844
|
+
#ifdef UNITY_DOUBLE_VERBOSE
|
845
|
+
UnityPrint(UnityStrExpected);
|
846
|
+
UnityPrintFloat((float)(*ptr_expected));
|
847
|
+
UnityPrint(UnityStrWas);
|
848
|
+
UnityPrintFloat((float)(*ptr_actual));
|
849
|
+
#else
|
850
|
+
UnityPrint(UnityStrDelta);
|
851
|
+
#endif
|
852
|
+
UnityAddMsgIfSpecified(msg);
|
853
|
+
UNITY_FAIL_AND_BAIL;
|
854
|
+
}
|
855
|
+
ptr_expected++;
|
856
|
+
ptr_actual++;
|
857
|
+
}
|
858
|
+
}
|
859
|
+
|
860
|
+
//-----------------------------------------------
|
861
|
+
void UnityAssertDoublesWithin(const _UD delta,
|
862
|
+
const _UD expected,
|
863
|
+
const _UD actual,
|
864
|
+
const char* msg,
|
865
|
+
const UNITY_LINE_TYPE lineNumber)
|
866
|
+
{
|
867
|
+
_UD diff = actual - expected;
|
868
|
+
_UD pos_delta = delta;
|
869
|
+
|
870
|
+
UNITY_SKIP_EXECUTION;
|
871
|
+
|
872
|
+
if (diff < 0.0)
|
873
|
+
{
|
874
|
+
diff = 0.0 - diff;
|
875
|
+
}
|
876
|
+
if (pos_delta < 0.0)
|
877
|
+
{
|
878
|
+
pos_delta = 0.0 - pos_delta;
|
879
|
+
}
|
880
|
+
|
881
|
+
//This first part of this condition will catch any NaN or Infinite values
|
882
|
+
if ((diff * 0.0 != 0.0) || (pos_delta < diff))
|
883
|
+
{
|
884
|
+
UnityTestResultsFailBegin(lineNumber);
|
885
|
+
#ifdef UNITY_DOUBLE_VERBOSE
|
886
|
+
UnityPrint(UnityStrExpected);
|
887
|
+
UnityPrintFloat((float)expected);
|
888
|
+
UnityPrint(UnityStrWas);
|
889
|
+
UnityPrintFloat((float)actual);
|
890
|
+
#else
|
891
|
+
UnityPrint(UnityStrDelta);
|
892
|
+
#endif
|
893
|
+
UnityAddMsgIfSpecified(msg);
|
894
|
+
UNITY_FAIL_AND_BAIL;
|
895
|
+
}
|
896
|
+
}
|
897
|
+
|
898
|
+
//-----------------------------------------------
|
899
|
+
|
900
|
+
void UnityAssertDoubleSpecial(const _UD actual,
|
901
|
+
const char* msg,
|
902
|
+
const UNITY_LINE_TYPE lineNumber,
|
903
|
+
const UNITY_FLOAT_TRAIT_T style)
|
904
|
+
{
|
905
|
+
const char* trait_names[] = { UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet };
|
906
|
+
_U_SINT should_be_trait = ((_U_SINT)style & 1);
|
907
|
+
_U_SINT is_trait = !should_be_trait;
|
908
|
+
_U_SINT trait_index = style >> 1;
|
909
|
+
|
910
|
+
UNITY_SKIP_EXECUTION;
|
911
|
+
|
912
|
+
switch(style)
|
913
|
+
{
|
914
|
+
//To determine Inf / Neg Inf, we compare to an Inf / Neg Inf value we create on the fly
|
915
|
+
//We are using a variable to hold the zero value because some compilers complain about dividing by zero otherwise
|
916
|
+
case UNITY_FLOAT_IS_INF:
|
917
|
+
case UNITY_FLOAT_IS_NOT_INF:
|
918
|
+
is_trait = isinf(actual) & ispos(actual);
|
919
|
+
break;
|
920
|
+
case UNITY_FLOAT_IS_NEG_INF:
|
921
|
+
case UNITY_FLOAT_IS_NOT_NEG_INF:
|
922
|
+
is_trait = isinf(actual) & isneg(actual);
|
923
|
+
break;
|
924
|
+
|
925
|
+
//NaN is the only floating point value that does NOT equal itself. Therefore if Actual == Actual, then it is NOT NaN.
|
926
|
+
case UNITY_FLOAT_IS_NAN:
|
927
|
+
case UNITY_FLOAT_IS_NOT_NAN:
|
928
|
+
is_trait = isnan(actual);
|
929
|
+
break;
|
930
|
+
|
931
|
+
//A determinate number is non infinite and not NaN. (therefore the opposite of the two above)
|
932
|
+
case UNITY_FLOAT_IS_DET:
|
933
|
+
case UNITY_FLOAT_IS_NOT_DET:
|
934
|
+
if (isinf(actual) | isnan(actual))
|
935
|
+
is_trait = 0;
|
936
|
+
else
|
937
|
+
is_trait = 1;
|
938
|
+
break;
|
939
|
+
|
940
|
+
default:
|
941
|
+
break;
|
942
|
+
}
|
943
|
+
|
944
|
+
if (is_trait != should_be_trait)
|
945
|
+
{
|
946
|
+
UnityTestResultsFailBegin(lineNumber);
|
947
|
+
UnityPrint(UnityStrExpected);
|
948
|
+
if (!should_be_trait)
|
949
|
+
UnityPrint(UnityStrNot);
|
950
|
+
UnityPrint(trait_names[trait_index]);
|
951
|
+
UnityPrint(UnityStrWas);
|
952
|
+
#ifdef UNITY_DOUBLE_VERBOSE
|
953
|
+
UnityPrintFloat(actual);
|
954
|
+
#else
|
955
|
+
if (should_be_trait)
|
956
|
+
UnityPrint(UnityStrNot);
|
957
|
+
UnityPrint(trait_names[trait_index]);
|
958
|
+
#endif
|
959
|
+
UnityAddMsgIfSpecified(msg);
|
960
|
+
UNITY_FAIL_AND_BAIL;
|
961
|
+
}
|
962
|
+
}
|
963
|
+
|
964
|
+
|
965
|
+
#endif // not UNITY_EXCLUDE_DOUBLE
|
966
|
+
|
967
|
+
//-----------------------------------------------
|
968
|
+
void UnityAssertNumbersWithin( const _U_UINT delta,
|
969
|
+
const _U_SINT expected,
|
970
|
+
const _U_SINT actual,
|
971
|
+
const char* msg,
|
972
|
+
const UNITY_LINE_TYPE lineNumber,
|
973
|
+
const UNITY_DISPLAY_STYLE_T style)
|
974
|
+
{
|
975
|
+
UNITY_SKIP_EXECUTION;
|
976
|
+
|
977
|
+
if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
|
978
|
+
{
|
979
|
+
if (actual > expected)
|
980
|
+
Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) > delta);
|
981
|
+
else
|
982
|
+
Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) > delta);
|
983
|
+
}
|
984
|
+
else
|
985
|
+
{
|
986
|
+
if ((_U_UINT)actual > (_U_UINT)expected)
|
987
|
+
Unity.CurrentTestFailed = ((_U_UINT)(actual - expected) > delta);
|
988
|
+
else
|
989
|
+
Unity.CurrentTestFailed = ((_U_UINT)(expected - actual) > delta);
|
990
|
+
}
|
991
|
+
|
992
|
+
if (Unity.CurrentTestFailed)
|
993
|
+
{
|
994
|
+
UnityTestResultsFailBegin(lineNumber);
|
995
|
+
UnityPrint(UnityStrDelta);
|
996
|
+
UnityPrintNumberByStyle((_U_SINT)delta, style);
|
997
|
+
UnityPrint(UnityStrExpected);
|
998
|
+
UnityPrintNumberByStyle(expected, style);
|
999
|
+
UnityPrint(UnityStrWas);
|
1000
|
+
UnityPrintNumberByStyle(actual, style);
|
1001
|
+
UnityAddMsgIfSpecified(msg);
|
1002
|
+
UNITY_FAIL_AND_BAIL;
|
1003
|
+
}
|
1004
|
+
}
|
1005
|
+
|
1006
|
+
//-----------------------------------------------
|
1007
|
+
void UnityAssertEqualString(const char* expected,
|
1008
|
+
const char* actual,
|
1009
|
+
const char* msg,
|
1010
|
+
const UNITY_LINE_TYPE lineNumber)
|
1011
|
+
{
|
1012
|
+
_UU32 i;
|
1013
|
+
|
1014
|
+
UNITY_SKIP_EXECUTION;
|
1015
|
+
|
1016
|
+
// if both pointers not null compare the strings
|
1017
|
+
if (expected && actual)
|
1018
|
+
{
|
1019
|
+
for (i = 0; expected[i] || actual[i]; i++)
|
1020
|
+
{
|
1021
|
+
if (expected[i] != actual[i])
|
1022
|
+
{
|
1023
|
+
Unity.CurrentTestFailed = 1;
|
1024
|
+
break;
|
1025
|
+
}
|
1026
|
+
}
|
1027
|
+
}
|
1028
|
+
else
|
1029
|
+
{ // handle case of one pointers being null (if both null, test should pass)
|
1030
|
+
if (expected != actual)
|
1031
|
+
{
|
1032
|
+
Unity.CurrentTestFailed = 1;
|
1033
|
+
}
|
1034
|
+
}
|
1035
|
+
|
1036
|
+
if (Unity.CurrentTestFailed)
|
1037
|
+
{
|
1038
|
+
UnityTestResultsFailBegin(lineNumber);
|
1039
|
+
UnityPrintExpectedAndActualStrings(expected, actual);
|
1040
|
+
UnityAddMsgIfSpecified(msg);
|
1041
|
+
UNITY_FAIL_AND_BAIL;
|
1042
|
+
}
|
1043
|
+
}
|
1044
|
+
|
1045
|
+
//-----------------------------------------------
|
1046
|
+
void UnityAssertEqualStringLen(const char* expected,
|
1047
|
+
const char* actual,
|
1048
|
+
const _UU32 length,
|
1049
|
+
const char* msg,
|
1050
|
+
const UNITY_LINE_TYPE lineNumber)
|
1051
|
+
{
|
1052
|
+
_UU32 i;
|
1053
|
+
|
1054
|
+
UNITY_SKIP_EXECUTION;
|
1055
|
+
|
1056
|
+
// if both pointers not null compare the strings
|
1057
|
+
if (expected && actual)
|
1058
|
+
{
|
1059
|
+
for (i = 0; (expected[i] || actual[i]) && i < length; i++)
|
1060
|
+
{
|
1061
|
+
if (expected[i] != actual[i])
|
1062
|
+
{
|
1063
|
+
Unity.CurrentTestFailed = 1;
|
1064
|
+
break;
|
1065
|
+
}
|
1066
|
+
}
|
1067
|
+
}
|
1068
|
+
else
|
1069
|
+
{ // handle case of one pointers being null (if both null, test should pass)
|
1070
|
+
if (expected != actual)
|
1071
|
+
{
|
1072
|
+
Unity.CurrentTestFailed = 1;
|
1073
|
+
}
|
1074
|
+
}
|
1075
|
+
|
1076
|
+
if (Unity.CurrentTestFailed)
|
1077
|
+
{
|
1078
|
+
UnityTestResultsFailBegin(lineNumber);
|
1079
|
+
UnityPrintExpectedAndActualStringsLen(expected, actual, length);
|
1080
|
+
UnityAddMsgIfSpecified(msg);
|
1081
|
+
UNITY_FAIL_AND_BAIL;
|
1082
|
+
}
|
1083
|
+
}
|
1084
|
+
|
1085
|
+
|
1086
|
+
//-----------------------------------------------
|
1087
|
+
void UnityAssertEqualStringArray( const char** expected,
|
1088
|
+
const char** actual,
|
1089
|
+
const _UU32 num_elements,
|
1090
|
+
const char* msg,
|
1091
|
+
const UNITY_LINE_TYPE lineNumber)
|
1092
|
+
{
|
1093
|
+
_UU32 i, j = 0;
|
1094
|
+
|
1095
|
+
UNITY_SKIP_EXECUTION;
|
1096
|
+
|
1097
|
+
// if no elements, it's an error
|
1098
|
+
if (num_elements == 0)
|
1099
|
+
{
|
1100
|
+
UnityTestResultsFailBegin(lineNumber);
|
1101
|
+
UnityPrint(UnityStrPointless);
|
1102
|
+
UnityAddMsgIfSpecified(msg);
|
1103
|
+
UNITY_FAIL_AND_BAIL;
|
1104
|
+
}
|
1105
|
+
|
1106
|
+
if (UnityCheckArraysForNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg) == 1)
|
1107
|
+
return;
|
1108
|
+
|
1109
|
+
do
|
1110
|
+
{
|
1111
|
+
// if both pointers not null compare the strings
|
1112
|
+
if (expected[j] && actual[j])
|
1113
|
+
{
|
1114
|
+
for (i = 0; expected[j][i] || actual[j][i]; i++)
|
1115
|
+
{
|
1116
|
+
if (expected[j][i] != actual[j][i])
|
1117
|
+
{
|
1118
|
+
Unity.CurrentTestFailed = 1;
|
1119
|
+
break;
|
1120
|
+
}
|
1121
|
+
}
|
1122
|
+
}
|
1123
|
+
else
|
1124
|
+
{ // handle case of one pointers being null (if both null, test should pass)
|
1125
|
+
if (expected[j] != actual[j])
|
1126
|
+
{
|
1127
|
+
Unity.CurrentTestFailed = 1;
|
1128
|
+
}
|
1129
|
+
}
|
1130
|
+
|
1131
|
+
if (Unity.CurrentTestFailed)
|
1132
|
+
{
|
1133
|
+
UnityTestResultsFailBegin(lineNumber);
|
1134
|
+
if (num_elements > 1)
|
1135
|
+
{
|
1136
|
+
UnityPrint(UnityStrElement);
|
1137
|
+
UnityPrintNumberUnsigned(j);
|
1138
|
+
}
|
1139
|
+
UnityPrintExpectedAndActualStrings((const char*)(expected[j]), (const char*)(actual[j]));
|
1140
|
+
UnityAddMsgIfSpecified(msg);
|
1141
|
+
UNITY_FAIL_AND_BAIL;
|
1142
|
+
}
|
1143
|
+
} while (++j < num_elements);
|
1144
|
+
}
|
1145
|
+
|
1146
|
+
//-----------------------------------------------
|
1147
|
+
void UnityAssertEqualMemory( UNITY_INTERNAL_PTR expected,
|
1148
|
+
UNITY_INTERNAL_PTR actual,
|
1149
|
+
const _UU32 length,
|
1150
|
+
const _UU32 num_elements,
|
1151
|
+
const char* msg,
|
1152
|
+
const UNITY_LINE_TYPE lineNumber)
|
1153
|
+
{
|
1154
|
+
UNITY_PTR_ATTRIBUTE const unsigned char* ptr_exp = (UNITY_PTR_ATTRIBUTE const unsigned char*)expected;
|
1155
|
+
UNITY_PTR_ATTRIBUTE const unsigned char* ptr_act = (UNITY_PTR_ATTRIBUTE const unsigned char*)actual;
|
1156
|
+
_UU32 elements = num_elements;
|
1157
|
+
_UU32 bytes;
|
1158
|
+
|
1159
|
+
UNITY_SKIP_EXECUTION;
|
1160
|
+
|
1161
|
+
if ((elements == 0) || (length == 0))
|
1162
|
+
{
|
1163
|
+
UnityTestResultsFailBegin(lineNumber);
|
1164
|
+
UnityPrint(UnityStrPointless);
|
1165
|
+
UnityAddMsgIfSpecified(msg);
|
1166
|
+
UNITY_FAIL_AND_BAIL;
|
1167
|
+
}
|
1168
|
+
|
1169
|
+
if (UnityCheckArraysForNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg) == 1)
|
1170
|
+
return;
|
1171
|
+
|
1172
|
+
while (elements--)
|
1173
|
+
{
|
1174
|
+
/////////////////////////////////////
|
1175
|
+
bytes = length;
|
1176
|
+
while (bytes--)
|
1177
|
+
{
|
1178
|
+
if (*ptr_exp != *ptr_act)
|
1179
|
+
{
|
1180
|
+
UnityTestResultsFailBegin(lineNumber);
|
1181
|
+
UnityPrint(UnityStrMemory);
|
1182
|
+
if (num_elements > 1)
|
1183
|
+
{
|
1184
|
+
UnityPrint(UnityStrElement);
|
1185
|
+
UnityPrintNumberUnsigned(num_elements - elements - 1);
|
1186
|
+
}
|
1187
|
+
UnityPrint(UnityStrByte);
|
1188
|
+
UnityPrintNumberUnsigned(length - bytes - 1);
|
1189
|
+
UnityPrint(UnityStrExpected);
|
1190
|
+
UnityPrintNumberByStyle(*ptr_exp, UNITY_DISPLAY_STYLE_HEX8);
|
1191
|
+
UnityPrint(UnityStrWas);
|
1192
|
+
UnityPrintNumberByStyle(*ptr_act, UNITY_DISPLAY_STYLE_HEX8);
|
1193
|
+
UnityAddMsgIfSpecified(msg);
|
1194
|
+
UNITY_FAIL_AND_BAIL;
|
1195
|
+
}
|
1196
|
+
ptr_exp = (UNITY_INTERNAL_PTR)((_UP)ptr_exp + 1);
|
1197
|
+
ptr_act = (UNITY_INTERNAL_PTR)((_UP)ptr_act + 1);
|
1198
|
+
}
|
1199
|
+
/////////////////////////////////////
|
1200
|
+
|
1201
|
+
}
|
1202
|
+
}
|
1203
|
+
|
1204
|
+
//-----------------------------------------------
|
1205
|
+
// Control Functions
|
1206
|
+
//-----------------------------------------------
|
1207
|
+
|
1208
|
+
void UnityFail(const char* msg, const UNITY_LINE_TYPE line)
|
1209
|
+
{
|
1210
|
+
UNITY_SKIP_EXECUTION;
|
1211
|
+
|
1212
|
+
UnityTestResultsBegin(Unity.TestFile, line);
|
1213
|
+
UnityPrintFail();
|
1214
|
+
if (msg != NULL)
|
1215
|
+
{
|
1216
|
+
UNITY_OUTPUT_CHAR(':');
|
1217
|
+
|
1218
|
+
#ifndef UNITY_EXCLUDE_DETAILS
|
1219
|
+
if (Unity.CurrentDetail1)
|
1220
|
+
{
|
1221
|
+
UnityPrint(UnityStrDetail1Name);
|
1222
|
+
UnityPrint(Unity.CurrentDetail1);
|
1223
|
+
if (Unity.CurrentDetail2)
|
1224
|
+
{
|
1225
|
+
UnityPrint(UnityStrDetail2Name);
|
1226
|
+
UnityPrint(Unity.CurrentDetail2);
|
1227
|
+
}
|
1228
|
+
UnityPrint(UnityStrSpacer);
|
1229
|
+
}
|
1230
|
+
#endif
|
1231
|
+
if (msg[0] != ' ')
|
1232
|
+
{
|
1233
|
+
UNITY_OUTPUT_CHAR(' ');
|
1234
|
+
}
|
1235
|
+
UnityPrint(msg);
|
1236
|
+
}
|
1237
|
+
|
1238
|
+
UNITY_FAIL_AND_BAIL;
|
1239
|
+
}
|
1240
|
+
|
1241
|
+
//-----------------------------------------------
|
1242
|
+
void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line)
|
1243
|
+
{
|
1244
|
+
UNITY_SKIP_EXECUTION;
|
1245
|
+
|
1246
|
+
UnityTestResultsBegin(Unity.TestFile, line);
|
1247
|
+
UnityPrint(UnityStrIgnore);
|
1248
|
+
if (msg != NULL)
|
1249
|
+
{
|
1250
|
+
UNITY_OUTPUT_CHAR(':');
|
1251
|
+
UNITY_OUTPUT_CHAR(' ');
|
1252
|
+
UnityPrint(msg);
|
1253
|
+
}
|
1254
|
+
UNITY_IGNORE_AND_BAIL;
|
1255
|
+
}
|
1256
|
+
|
1257
|
+
//-----------------------------------------------
|
1258
|
+
#if defined(UNITY_WEAK_ATTRIBUTE)
|
1259
|
+
void setUp(void);
|
1260
|
+
void tearDown(void);
|
1261
|
+
UNITY_WEAK_ATTRIBUTE void setUp(void) { }
|
1262
|
+
UNITY_WEAK_ATTRIBUTE void tearDown(void) { }
|
1263
|
+
#elif defined(UNITY_WEAK_PRAGMA)
|
1264
|
+
# pragma weak setUp
|
1265
|
+
void setUp(void) { }
|
1266
|
+
# pragma weak tearDown
|
1267
|
+
void tearDown(void) { }
|
1268
|
+
#else
|
1269
|
+
void setUp(void);
|
1270
|
+
void tearDown(void);
|
1271
|
+
#endif
|
1272
|
+
//-----------------------------------------------
|
1273
|
+
void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum)
|
1274
|
+
{
|
1275
|
+
Unity.CurrentTestName = FuncName;
|
1276
|
+
Unity.CurrentTestLineNumber = (UNITY_LINE_TYPE)FuncLineNum;
|
1277
|
+
Unity.NumberOfTests++;
|
1278
|
+
UNITY_CLR_DETAILS();
|
1279
|
+
if (TEST_PROTECT())
|
1280
|
+
{
|
1281
|
+
setUp();
|
1282
|
+
Func();
|
1283
|
+
}
|
1284
|
+
if (TEST_PROTECT() && !(Unity.CurrentTestIgnored))
|
1285
|
+
{
|
1286
|
+
tearDown();
|
1287
|
+
}
|
1288
|
+
UnityConcludeTest();
|
1289
|
+
}
|
1290
|
+
|
1291
|
+
//-----------------------------------------------
|
1292
|
+
void UnityBegin(const char* filename)
|
1293
|
+
{
|
1294
|
+
Unity.TestFile = filename;
|
1295
|
+
Unity.CurrentTestName = NULL;
|
1296
|
+
Unity.CurrentTestLineNumber = 0;
|
1297
|
+
Unity.NumberOfTests = 0;
|
1298
|
+
Unity.TestFailures = 0;
|
1299
|
+
Unity.TestIgnores = 0;
|
1300
|
+
Unity.CurrentTestFailed = 0;
|
1301
|
+
Unity.CurrentTestIgnored = 0;
|
1302
|
+
|
1303
|
+
UNITY_CLR_DETAILS();
|
1304
|
+
UNITY_OUTPUT_START();
|
1305
|
+
}
|
1306
|
+
|
1307
|
+
//-----------------------------------------------
|
1308
|
+
int UnityEnd(void)
|
1309
|
+
{
|
1310
|
+
UNITY_PRINT_EOL();
|
1311
|
+
UnityPrint(UnityStrBreaker);
|
1312
|
+
UNITY_PRINT_EOL();
|
1313
|
+
UnityPrintNumber((_U_SINT)(Unity.NumberOfTests));
|
1314
|
+
UnityPrint(UnityStrResultsTests);
|
1315
|
+
UnityPrintNumber((_U_SINT)(Unity.TestFailures));
|
1316
|
+
UnityPrint(UnityStrResultsFailures);
|
1317
|
+
UnityPrintNumber((_U_SINT)(Unity.TestIgnores));
|
1318
|
+
UnityPrint(UnityStrResultsIgnored);
|
1319
|
+
UNITY_PRINT_EOL();
|
1320
|
+
if (Unity.TestFailures == 0U)
|
1321
|
+
{
|
1322
|
+
UnityPrintOk();
|
1323
|
+
}
|
1324
|
+
else
|
1325
|
+
{
|
1326
|
+
UnityPrintFail();
|
1327
|
+
}
|
1328
|
+
UNITY_PRINT_EOL();
|
1329
|
+
UNITY_OUTPUT_COMPLETE();
|
1330
|
+
return (int)(Unity.TestFailures);
|
1331
|
+
}
|
1332
|
+
|
1333
|
+
//-----------------------------------------------
|