ceedling 0.25.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/assets/project_as_gem.yml +13 -0
- data/assets/project_with_guts.yml +13 -0
- data/bin/ceedling +91 -67
- data/docs/CeedlingPacket.md +61 -23
- data/docs/CeedlingPacket.odt +0 -0
- data/docs/CeedlingPacket.pdf +0 -0
- data/docs/ThrowTheSwitchCodingStandard.md +207 -0
- data/examples/temp_sensor/test/TestTemperatureCalculator.c +4 -1
- data/lib/ceedling/configurator.rb +14 -1
- data/lib/ceedling/configurator_builder.rb +2 -1
- data/lib/ceedling/configurator_validator.rb +12 -3
- data/lib/ceedling/constants.rb +3 -1
- data/lib/ceedling/defaults.rb +12 -1
- data/lib/ceedling/file_finder.rb +3 -0
- data/lib/ceedling/file_path_utils.rb +1 -1
- data/lib/ceedling/file_wrapper.rb +4 -4
- data/lib/ceedling/generator.rb +12 -3
- data/lib/ceedling/preprocessinator_helper.rb +5 -5
- data/lib/ceedling/preprocessinator_includes_handler.rb +10 -1
- data/lib/ceedling/project_config_manager.rb +1 -2
- data/lib/ceedling/project_file_loader.rb +27 -9
- data/lib/ceedling/rakefile.rb +6 -6
- data/lib/ceedling/release_invoker.rb +21 -6
- data/lib/ceedling/rules_release.rake +9 -5
- data/lib/ceedling/rules_tests.rake +6 -1
- data/lib/ceedling/setupinator.rb +1 -0
- data/lib/ceedling/tasks_base.rake +3 -0
- data/lib/ceedling/tasks_filesystem.rake +10 -7
- data/lib/ceedling/tasks_release.rake +3 -1
- data/lib/ceedling/test_includes_extractor.rb +16 -12
- data/lib/ceedling/test_invoker.rb +40 -0
- data/lib/ceedling/version.rb +3 -3
- data/lib/ceedling/version.rb.erb +1 -1
- data/plugins/command_hooks/lib/command_hooks.rb +1 -1
- data/plugins/fake_function_framework/examples/fff_example/src/bar.h +1 -0
- data/plugins/fake_function_framework/examples/fff_example/src/event_processor.c +1 -0
- data/plugins/fake_function_framework/lib/fff_mock_generator.rb +4 -0
- data/plugins/fake_function_framework/spec/{fff_mock_generator_spec.rb → fff_mock_header_generator_spec.rb} +34 -194
- data/plugins/fake_function_framework/spec/fff_mock_source_generator_spec.rb +149 -0
- data/plugins/fake_function_framework/spec/header_generator.rb +51 -0
- data/plugins/junit_tests_report/lib/junit_tests_report.rb +115 -0
- data/plugins/subprojects/README.md +63 -0
- data/plugins/subprojects/config/defaults.yml +33 -0
- data/plugins/subprojects/lib/subprojects.rb +92 -0
- data/plugins/subprojects/subprojects.rake +78 -0
- data/spec/preprocessinator_includes_handler_spec.rb +15 -5
- data/spec/spec_helper.rb +2 -2
- data/spec/spec_system_helper.rb +49 -1
- data/spec/system/deployment_spec.rb +29 -0
- data/vendor/c_exception/README.md +8 -2
- data/vendor/c_exception/docs/{readme.txt → CException.md} +133 -102
- data/vendor/c_exception/docs/ThrowTheSwitchCodingStandard.md +207 -0
- data/vendor/c_exception/vendor/unity/README.md +19 -10
- data/vendor/c_exception/vendor/unity/auto/colour_prompt.rb +67 -64
- data/vendor/c_exception/vendor/unity/auto/colour_reporter.rb +20 -20
- data/vendor/c_exception/vendor/unity/auto/generate_module.rb +149 -142
- data/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +234 -232
- data/vendor/c_exception/vendor/unity/auto/parse_output.rb +220 -0
- data/vendor/c_exception/vendor/unity/auto/stylize_as_junit.rb +108 -120
- data/vendor/c_exception/vendor/unity/auto/test_file_filter.rb +11 -9
- data/vendor/c_exception/vendor/unity/auto/type_sanitizer.rb +1 -3
- data/vendor/c_exception/vendor/unity/auto/unity_test_summary.py +6 -2
- data/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb +45 -57
- data/vendor/c_exception/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +207 -0
- data/vendor/c_exception/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
- data/vendor/c_exception/vendor/unity/docs/UnityAssertionsReference.md +716 -0
- data/vendor/c_exception/vendor/unity/docs/UnityConfigurationGuide.md +398 -0
- data/vendor/c_exception/vendor/unity/docs/UnityGettingStartedGuide.md +191 -0
- data/vendor/c_exception/vendor/unity/docs/UnityHelperScriptsGuide.md +242 -0
- data/vendor/c_exception/vendor/unity/examples/example_1/makefile +22 -17
- data/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +1 -1
- data/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +1 -1
- data/vendor/c_exception/vendor/unity/examples/example_2/makefile +16 -17
- data/vendor/c_exception/vendor/unity/examples/example_3/rakefile.rb +15 -15
- data/vendor/c_exception/vendor/unity/examples/example_3/rakefile_helper.rb +93 -100
- data/vendor/c_exception/vendor/unity/examples/example_3/readme.txt +4 -10
- data/vendor/c_exception/vendor/unity/examples/unity_config.h +14 -26
- data/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb +12 -12
- data/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb +87 -88
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +15 -8
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h +6 -1
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +3 -0
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +1 -0
- data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +1 -1
- data/vendor/c_exception/vendor/unity/src/unity.c +396 -330
- data/vendor/c_exception/vendor/unity/src/unity.h +50 -4
- data/vendor/c_exception/vendor/unity/src/unity_internals.h +119 -84
- data/vendor/c_exception/vendor/unity/test/Makefile +17 -17
- data/vendor/c_exception/vendor/unity/test/rakefile +63 -3
- data/vendor/c_exception/vendor/unity/test/rakefile_helper.rb +108 -105
- data/vendor/c_exception/vendor/unity/test/spec/generate_module_existing_file_spec.rb +158 -0
- data/vendor/c_exception/vendor/unity/test/targets/clang_file.yml +0 -6
- data/vendor/c_exception/vendor/unity/test/targets/clang_strict.yml +1 -9
- data/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +2 -0
- data/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +2 -2
- data/vendor/c_exception/vendor/unity/test/tests/test_generate_test_runner.rb +5 -5
- data/vendor/c_exception/vendor/unity/test/tests/testunity.c +1338 -151
- data/vendor/cmock/README.md +10 -1
- data/vendor/cmock/config/test_environment.rb +7 -7
- data/vendor/cmock/docs/CMock_Summary.md +325 -128
- data/vendor/cmock/docs/ThrowTheSwitchCodingStandard.md +207 -0
- data/vendor/cmock/examples/make_example/Makefile +2 -2
- data/vendor/cmock/examples/temp_sensor/gcc.yml +5 -4
- data/vendor/cmock/examples/temp_sensor/iar_v4.yml +5 -4
- data/vendor/cmock/examples/temp_sensor/iar_v5.yml +5 -4
- data/vendor/cmock/examples/temp_sensor/rakefile.rb +11 -1
- data/vendor/cmock/examples/temp_sensor/rakefile_helper.rb +12 -10
- data/vendor/cmock/lib/cmock.rb +0 -3
- data/vendor/cmock/lib/cmock_generator_plugin_callback.rb +6 -2
- data/vendor/cmock/lib/cmock_generator_plugin_return_thru_ptr.rb +2 -1
- data/vendor/cmock/lib/cmock_header_parser.rb +5 -6
- data/vendor/cmock/release/version.info +1 -1
- data/vendor/cmock/scripts/create_makefile.rb +4 -2
- data/vendor/cmock/scripts/test_summary.rb +17 -9
- data/vendor/cmock/src/cmock.c +1 -0
- data/vendor/cmock/src/cmock.h +1 -1
- data/vendor/cmock/src/cmock_internals.h +14 -1
- data/vendor/cmock/test/c/TestCMockC.yml +4 -4
- data/vendor/cmock/test/c/TestCMockCDynamic.yml +4 -4
- data/vendor/cmock/{iar → test/iar}/iar_v4/Resource/SAM7_FLASH.mac +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/Resource/SAM7_RAM.mac +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/Resource/SAM7_SIM.mac +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/Resource/at91SAM7X256_FLASH.xcl +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/Resource/at91SAM7X256_RAM.xcl +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/Resource/ioat91sam7x256.ddf +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/cmock_demo.dep +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/cmock_demo.ewd +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/cmock_demo.ewp +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/cmock_demo.eww +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/incIAR/AT91SAM7X-EK.h +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/incIAR/AT91SAM7X256.inc +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/incIAR/AT91SAM7X256.rdf +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/incIAR/AT91SAM7X256.tcl +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/incIAR/AT91SAM7X256_inc.h +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/incIAR/ioat91sam7x256.h +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/incIAR/lib_AT91SAM7X256.h +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/settings/cmock_demo.cspy.bat +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/settings/cmock_demo.dbgdt +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/settings/cmock_demo.dni +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/settings/cmock_demo.wsdt +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/srcIAR/Cstartup.s79 +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/srcIAR/Cstartup_SAM7.c +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/Resource/SAM7_FLASH.mac +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/Resource/SAM7_RAM.mac +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/Resource/SAM7_SIM.mac +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/Resource/at91SAM7X256_FLASH.icf +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/Resource/at91SAM7X256_RAM.icf +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/cmock_demo.dep +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/cmock_demo.ewd +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/cmock_demo.ewp +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/cmock_demo.eww +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/incIAR/AT91SAM7X-EK.h +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/incIAR/AT91SAM7X256_inc.h +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/incIAR/lib_AT91SAM7X256.h +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/incIAR/project.h +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/settings/BasicInterrupt_SAM7X.cspy.bat +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/settings/BasicInterrupt_SAM7X.dbgdt +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/settings/BasicInterrupt_SAM7X.dni +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/settings/BasicInterrupt_SAM7X.wsdt +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/settings/BasicInterrupt_SAM7X_FLASH_Debug.jlink +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/settings/cmock_demo.cspy.bat +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/settings/cmock_demo.dbgdt +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/settings/cmock_demo.dni +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/settings/cmock_demo.wsdt +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/settings/cmock_demo_Binary.jlink +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/settings/cmock_demo_FLASH_Debug.jlink +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/settings/cmock_demo_RAM_Debug.jlink +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/srcIAR/Cstartup.s +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/srcIAR/Cstartup_SAM7.c +0 -0
- data/vendor/cmock/{Rakefile → test/rakefile} +9 -9
- data/vendor/cmock/{rakefile_helper.rb → test/rakefile_helper.rb} +13 -13
- data/vendor/cmock/test/system/test_compilation/config.yml +4 -4
- data/vendor/cmock/test/system/test_interactions/parsing_challenges.yml +2 -0
- data/vendor/cmock/{targets → test/targets}/clang_strict.yml +11 -11
- data/vendor/cmock/{targets → test/targets}/gcc.yml +9 -9
- data/vendor/cmock/{targets → test/targets}/gcc_64.yml +9 -9
- data/vendor/cmock/{targets → test/targets}/gcc_tiny.yml +9 -9
- data/vendor/cmock/{targets → test/targets}/iar_arm_v4.yml +9 -9
- data/vendor/cmock/{targets → test/targets}/iar_arm_v5.yml +10 -10
- data/vendor/cmock/test/test_helper.rb +4 -8
- data/vendor/cmock/test/unit/cmock_config_test.rb +1 -1
- data/vendor/cmock/test/unit/cmock_file_writer_test.rb +1 -1
- data/vendor/cmock/test/unit/cmock_generator_main_test.rb +1 -1
- data/vendor/cmock/test/unit/cmock_generator_plugin_array_test.rb +1 -1
- data/vendor/cmock/test/unit/cmock_generator_plugin_callback_test.rb +3 -1
- data/vendor/cmock/test/unit/cmock_generator_plugin_cexception_test.rb +1 -1
- data/vendor/cmock/test/unit/cmock_generator_plugin_expect_a_test.rb +1 -1
- data/vendor/cmock/test/unit/cmock_generator_plugin_expect_any_args_test.rb +1 -1
- data/vendor/cmock/test/unit/cmock_generator_plugin_expect_b_test.rb +1 -1
- data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_arg_test.rb +1 -1
- data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_test.rb +1 -1
- data/vendor/cmock/test/unit/cmock_generator_plugin_return_thru_ptr_test.rb +1 -1
- data/vendor/cmock/test/unit/cmock_generator_utils_test.rb +1 -1
- data/vendor/cmock/test/unit/cmock_header_parser_test.rb +15 -2
- data/vendor/cmock/test/unit/cmock_plugin_manager_test.rb +6 -10
- data/vendor/cmock/test/unit/cmock_unityhelper_parser_test.rb +1 -1
- data/vendor/cmock/vendor/c_exception/README.md +8 -2
- data/vendor/cmock/vendor/c_exception/docs/{readme.txt → CException.md} +133 -102
- data/vendor/cmock/vendor/c_exception/docs/ThrowTheSwitchCodingStandard.md +207 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/README.md +19 -10
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_prompt.rb +67 -64
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_reporter.rb +20 -20
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_module.rb +149 -142
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +234 -232
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/parse_output.rb +220 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/stylize_as_junit.rb +108 -120
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/test_file_filter.rb +11 -9
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/type_sanitizer.rb +1 -3
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_test_summary.py +6 -2
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb +45 -57
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +207 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityAssertionsReference.md +716 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityConfigurationGuide.md +398 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityGettingStartedGuide.md +191 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityHelperScriptsGuide.md +242 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/makefile +22 -17
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +1 -1
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +1 -1
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/makefile +16 -17
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/rakefile.rb +15 -15
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/rakefile_helper.rb +93 -100
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/readme.txt +4 -10
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/unity_config.h +14 -26
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb +12 -12
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb +87 -88
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +15 -8
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h +6 -1
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +3 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +1 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +1 -1
- data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.c +396 -330
- data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.h +50 -4
- data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity_internals.h +119 -84
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/Makefile +17 -17
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/rakefile +63 -3
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/rakefile_helper.rb +108 -105
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/spec/generate_module_existing_file_spec.rb +158 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/clang_file.yml +0 -6
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/clang_strict.yml +1 -9
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +2 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +2 -2
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/tests/test_generate_test_runner.rb +5 -5
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/tests/testunity.c +1338 -151
- data/vendor/cmock/vendor/unity/README.md +19 -10
- data/vendor/cmock/vendor/unity/auto/colour_prompt.rb +67 -64
- data/vendor/cmock/vendor/unity/auto/colour_reporter.rb +20 -20
- data/vendor/cmock/vendor/unity/auto/generate_module.rb +149 -142
- data/vendor/cmock/vendor/unity/auto/generate_test_runner.rb +234 -232
- data/vendor/cmock/vendor/unity/auto/parse_output.rb +220 -0
- data/vendor/cmock/vendor/unity/auto/stylize_as_junit.rb +108 -120
- data/vendor/cmock/vendor/unity/auto/test_file_filter.rb +11 -9
- data/vendor/cmock/vendor/unity/auto/type_sanitizer.rb +1 -3
- data/vendor/cmock/vendor/unity/auto/unity_test_summary.py +6 -2
- data/vendor/cmock/vendor/unity/auto/unity_test_summary.rb +45 -57
- data/vendor/cmock/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +207 -0
- data/vendor/cmock/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
- data/vendor/cmock/vendor/unity/docs/UnityAssertionsReference.md +716 -0
- data/vendor/cmock/vendor/unity/docs/UnityConfigurationGuide.md +398 -0
- data/vendor/cmock/vendor/unity/docs/UnityGettingStartedGuide.md +191 -0
- data/vendor/cmock/vendor/unity/docs/UnityHelperScriptsGuide.md +242 -0
- data/vendor/cmock/vendor/unity/examples/example_1/makefile +22 -17
- data/vendor/cmock/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +1 -1
- data/vendor/cmock/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +1 -1
- data/vendor/cmock/vendor/unity/examples/example_2/makefile +16 -17
- data/vendor/cmock/vendor/unity/examples/example_3/rakefile.rb +15 -15
- data/vendor/cmock/vendor/unity/examples/example_3/rakefile_helper.rb +93 -100
- data/vendor/cmock/vendor/unity/examples/example_3/readme.txt +4 -10
- data/vendor/cmock/vendor/unity/examples/unity_config.h +14 -26
- data/vendor/cmock/vendor/unity/extras/fixture/rakefile.rb +12 -12
- data/vendor/cmock/vendor/unity/extras/fixture/rakefile_helper.rb +87 -88
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c +15 -8
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h +6 -1
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h +3 -0
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +1 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c +1 -1
- data/vendor/cmock/vendor/unity/release/version.info +1 -1
- data/vendor/cmock/vendor/unity/src/unity.c +396 -330
- data/vendor/cmock/vendor/unity/src/unity.h +50 -4
- data/vendor/cmock/vendor/unity/src/unity_internals.h +119 -84
- data/vendor/cmock/vendor/unity/test/Makefile +17 -17
- data/vendor/cmock/vendor/unity/test/rakefile +63 -3
- data/vendor/cmock/vendor/unity/test/rakefile_helper.rb +108 -105
- data/vendor/cmock/vendor/unity/test/spec/generate_module_existing_file_spec.rb +158 -0
- data/vendor/cmock/vendor/unity/test/targets/clang_file.yml +0 -6
- data/vendor/cmock/vendor/unity/test/targets/clang_strict.yml +1 -9
- data/vendor/cmock/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +2 -0
- data/vendor/cmock/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +2 -2
- data/vendor/cmock/vendor/unity/test/tests/test_generate_test_runner.rb +5 -5
- data/vendor/cmock/vendor/unity/test/tests/testunity.c +1338 -151
- data/vendor/deep_merge/Rakefile +1 -1
- data/vendor/unity/README.md +19 -10
- data/vendor/unity/auto/colour_prompt.rb +67 -64
- data/vendor/unity/auto/colour_reporter.rb +20 -20
- data/vendor/unity/auto/generate_module.rb +149 -142
- data/vendor/unity/auto/generate_test_runner.rb +234 -232
- data/vendor/unity/auto/parse_output.rb +220 -0
- data/vendor/unity/auto/stylize_as_junit.rb +108 -120
- data/vendor/unity/auto/test_file_filter.rb +11 -9
- data/vendor/unity/auto/type_sanitizer.rb +1 -3
- data/vendor/unity/auto/unity_test_summary.py +6 -2
- data/vendor/unity/auto/unity_test_summary.rb +45 -57
- data/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +207 -0
- data/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
- data/vendor/unity/docs/UnityAssertionsReference.md +716 -0
- data/vendor/unity/docs/UnityConfigurationGuide.md +398 -0
- data/vendor/unity/docs/UnityGettingStartedGuide.md +191 -0
- data/vendor/unity/docs/UnityHelperScriptsGuide.md +242 -0
- data/vendor/unity/examples/example_1/makefile +22 -17
- data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +1 -1
- data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +1 -1
- data/vendor/unity/examples/example_2/makefile +16 -17
- data/vendor/unity/examples/example_3/rakefile.rb +15 -15
- data/vendor/unity/examples/example_3/rakefile_helper.rb +93 -100
- data/vendor/unity/examples/example_3/readme.txt +4 -10
- data/vendor/unity/examples/unity_config.h +14 -26
- data/vendor/unity/extras/fixture/rakefile.rb +12 -12
- data/vendor/unity/extras/fixture/rakefile_helper.rb +87 -88
- data/vendor/unity/extras/fixture/src/unity_fixture.c +15 -8
- data/vendor/unity/extras/fixture/src/unity_fixture.h +6 -1
- data/vendor/unity/extras/fixture/src/unity_fixture_internals.h +3 -0
- data/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +1 -0
- data/vendor/unity/extras/fixture/test/unity_fixture_Test.c +1 -1
- data/vendor/unity/release/version.info +1 -1
- data/vendor/unity/src/unity.c +396 -330
- data/vendor/unity/src/unity.h +50 -4
- data/vendor/unity/src/unity_internals.h +119 -84
- data/vendor/unity/test/Makefile +17 -17
- data/vendor/unity/test/rakefile +63 -3
- data/vendor/unity/test/rakefile_helper.rb +108 -105
- data/vendor/unity/test/spec/generate_module_existing_file_spec.rb +158 -0
- data/vendor/unity/test/targets/clang_file.yml +0 -6
- data/vendor/unity/test/targets/clang_strict.yml +1 -9
- data/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +2 -0
- data/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +2 -2
- data/vendor/unity/test/tests/test_generate_test_runner.rb +5 -5
- data/vendor/unity/test/tests/testunity.c +1338 -151
- metadata +102 -157
- data/test_graveyard/integration/paths.yml +0 -17
- data/test_graveyard/integration/paths_test.rb +0 -80
- data/test_graveyard/integration/rake_rules_aux_dependencies_test.rb +0 -75
- data/test_graveyard/integration/rake_rules_cmock_test.rb +0 -74
- data/test_graveyard/integration/rake_rules_preprocess_test.rb +0 -178
- data/test_graveyard/integration/rake_rules_test.rb +0 -268
- data/test_graveyard/integration/rake_tasks_test.rb +0 -103
- data/test_graveyard/integration_test_helper.rb +0 -34
- data/test_graveyard/rakefile_rules.rb +0 -10
- data/test_graveyard/rakefile_rules_aux_dependencies.rb +0 -10
- data/test_graveyard/rakefile_rules_cmock.rb +0 -10
- data/test_graveyard/rakefile_rules_preprocess.rb +0 -10
- data/test_graveyard/rakefile_tasks.rb +0 -10
- data/test_graveyard/system/file_system_dependencies.yml +0 -20
- data/test_graveyard/system/file_system_kitchen_sink.yml +0 -20
- data/test_graveyard/system/file_system_mocks.yml +0 -20
- data/test_graveyard/system/file_system_preprocess.yml +0 -20
- data/test_graveyard/system/file_system_simple.yml +0 -20
- data/test_graveyard/system/file_system_test.rb +0 -78
- data/test_graveyard/system/mocks/include/a_file.h +0 -2
- data/test_graveyard/system/mocks/include/other_stuff.h +0 -2
- data/test_graveyard/system/mocks/include/stuff.h +0 -3
- data/test_graveyard/system/mocks/source/a_file.c +0 -9
- data/test_graveyard/system/mocks/test/test_a_file.c +0 -41
- data/test_graveyard/system/mocks/test/test_no_file.c +0 -14
- data/test_graveyard/system/project_mocks.yml +0 -43
- data/test_graveyard/system/project_mocks_test.rb +0 -38
- data/test_graveyard/system/project_simple.yml +0 -36
- data/test_graveyard/system/project_simple_test.rb +0 -39
- data/test_graveyard/system/rule_mocks_test.rb +0 -44
- data/test_graveyard/system/rule_runners_test.rb +0 -44
- data/test_graveyard/system/simple/include/other_stuff.h +0 -2
- data/test_graveyard/system/simple/include/stuff.h +0 -3
- data/test_graveyard/system/simple/source/other_stuff.c +0 -6
- data/test_graveyard/system/simple/source/stuff.c +0 -7
- data/test_graveyard/system/simple/test/test_other_stuff.c +0 -30
- data/test_graveyard/system/simple/test/test_stuff.c +0 -51
- data/test_graveyard/system_test_helper.rb +0 -73
- data/test_graveyard/test_helper.rb +0 -93
- data/test_graveyard/unit/busted/configurator_builder_test.rb +0 -569
- data/test_graveyard/unit/busted/configurator_helper_test.rb +0 -234
- data/test_graveyard/unit/busted/configurator_test.rb +0 -232
- data/test_graveyard/unit/busted/configurator_validator_test.rb +0 -169
- data/test_graveyard/unit/busted/deep_merge_fix_test.rb +0 -55
- data/test_graveyard/unit/busted/dependinator_test.rb +0 -129
- data/test_graveyard/unit/busted/file_finder_helper_test.rb +0 -45
- data/test_graveyard/unit/busted/file_finder_test.rb +0 -114
- data/test_graveyard/unit/busted/file_path_utils_test.rb +0 -97
- data/test_graveyard/unit/busted/file_system_utils_test.rb +0 -21
- data/test_graveyard/unit/busted/generator_test.rb +0 -187
- data/test_graveyard/unit/busted/generator_test_results_test.rb +0 -129
- data/test_graveyard/unit/busted/generator_test_runner_test.rb +0 -475
- data/test_graveyard/unit/busted/preprocessinator_file_handler_test.rb +0 -39
- data/test_graveyard/unit/busted/preprocessinator_helper_test.rb +0 -156
- data/test_graveyard/unit/busted/preprocessinator_includes_handler_test.rb +0 -93
- data/test_graveyard/unit/busted/preprocessinator_test.rb +0 -57
- data/test_graveyard/unit/busted/project_file_loader_test.rb +0 -142
- data/test_graveyard/unit/busted/setupinator_test.rb +0 -45
- data/test_graveyard/unit/busted/streaminator_test.rb +0 -49
- data/test_graveyard/unit/busted/task_invoker_test.rb +0 -69
- data/test_graveyard/unit/busted/test_includes_extractor_test.rb +0 -111
- data/test_graveyard/unit/busted/test_invoker_helper_test.rb +0 -62
- data/test_graveyard/unit/busted/test_invoker_test.rb +0 -47
- data/test_graveyard/unit/busted/tool_executor_helper_test.rb +0 -100
- data/test_graveyard/unit/busted/tool_executor_test.rb +0 -351
- data/test_graveyard/unit/busted/verbosinator_test.rb +0 -65
- data/test_graveyard/unit/preprocessinator_extractor_test.rb +0 -731
- data/test_graveyard/unit_test_helper.rb +0 -16
- data/vendor/c_exception/docs/CExceptionSummary.odt +0 -0
- data/vendor/c_exception/docs/CExceptionSummary.pdf +0 -0
- data/vendor/c_exception/vendor/unity/auto/parseOutput.rb +0 -191
- data/vendor/c_exception/vendor/unity/docs/UnityAssertionsReference.pdf +0 -0
- data/vendor/c_exception/vendor/unity/docs/UnityConfigurationGuide.pdf +0 -0
- data/vendor/c_exception/vendor/unity/docs/UnityGettingStartedGuide.pdf +0 -0
- data/vendor/c_exception/vendor/unity/docs/UnityHelperScriptsGuide.pdf +0 -0
- data/vendor/cmock/docs/CMock Summary.odt +0 -0
- data/vendor/cmock/docs/CMock Summary.pdf +0 -0
- 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/vendor/unity/auto/parseOutput.rb +0 -191
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityAssertionsReference.pdf +0 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityConfigurationGuide.pdf +0 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityGettingStartedGuide.pdf +0 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityHelperScriptsGuide.pdf +0 -0
- data/vendor/cmock/vendor/unity/auto/parseOutput.rb +0 -191
- data/vendor/cmock/vendor/unity/docs/UnityAssertionsReference.pdf +0 -0
- data/vendor/cmock/vendor/unity/docs/UnityConfigurationGuide.pdf +0 -0
- data/vendor/cmock/vendor/unity/docs/UnityGettingStartedGuide.pdf +0 -0
- data/vendor/cmock/vendor/unity/docs/UnityHelperScriptsGuide.pdf +0 -0
- data/vendor/unity/auto/parseOutput.rb +0 -191
- data/vendor/unity/docs/UnityAssertionsReference.pdf +0 -0
- data/vendor/unity/docs/UnityConfigurationGuide.pdf +0 -0
- data/vendor/unity/docs/UnityGettingStartedGuide.pdf +0 -0
- data/vendor/unity/docs/UnityHelperScriptsGuide.pdf +0 -0
|
@@ -6,28 +6,27 @@
|
|
|
6
6
|
|
|
7
7
|
require 'yaml'
|
|
8
8
|
require 'fileutils'
|
|
9
|
-
require HERE+'../../auto/unity_test_summary'
|
|
10
|
-
require HERE+'../../auto/generate_test_runner'
|
|
11
|
-
require HERE+'../../auto/colour_reporter'
|
|
9
|
+
require HERE + '../../auto/unity_test_summary'
|
|
10
|
+
require HERE + '../../auto/generate_test_runner'
|
|
11
|
+
require HERE + '../../auto/colour_reporter'
|
|
12
12
|
|
|
13
13
|
module RakefileHelpers
|
|
14
|
-
|
|
15
|
-
C_EXTENSION = '.c'
|
|
14
|
+
C_EXTENSION = '.c'.freeze
|
|
16
15
|
|
|
17
16
|
def load_configuration(config_file)
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
return if $configured
|
|
18
|
+
|
|
19
|
+
$cfg_file = HERE + "../../test/targets/#{config_file}" unless config_file =~ /[\\|\/]/
|
|
20
|
+
$cfg = YAML.load(File.read($cfg_file))
|
|
21
|
+
$colour_output = false unless $cfg['colour']
|
|
22
|
+
$configured = true if config_file != DEFAULT_CONFIG_FILE
|
|
24
23
|
end
|
|
25
24
|
|
|
26
25
|
def configure_clean
|
|
27
26
|
CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil?
|
|
28
27
|
end
|
|
29
28
|
|
|
30
|
-
def configure_toolchain(config_file=DEFAULT_CONFIG_FILE)
|
|
29
|
+
def configure_toolchain(config_file = DEFAULT_CONFIG_FILE)
|
|
31
30
|
config_file += '.yml' unless config_file =~ /\.yml$/
|
|
32
31
|
config_file = config_file unless config_file =~ /[\\|\/]/
|
|
33
32
|
load_configuration(config_file)
|
|
@@ -35,105 +34,105 @@ module RakefileHelpers
|
|
|
35
34
|
end
|
|
36
35
|
|
|
37
36
|
def tackit(strings)
|
|
38
|
-
if strings.is_a?(Array)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
37
|
+
result = if strings.is_a?(Array)
|
|
38
|
+
"\"#{strings.join}\""
|
|
39
|
+
else
|
|
40
|
+
strings
|
|
41
|
+
end
|
|
42
|
+
result
|
|
44
43
|
end
|
|
45
44
|
|
|
46
45
|
def squash(prefix, items)
|
|
47
46
|
result = ''
|
|
48
47
|
items.each { |item| result += " #{prefix}#{tackit(item)}" }
|
|
49
|
-
|
|
48
|
+
result
|
|
50
49
|
end
|
|
51
50
|
|
|
52
51
|
def build_compiler_fields
|
|
53
|
-
command
|
|
54
|
-
if $cfg['compiler']['defines']['items'].nil?
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
52
|
+
command = tackit($cfg['compiler']['path'])
|
|
53
|
+
defines = if $cfg['compiler']['defines']['items'].nil?
|
|
54
|
+
''
|
|
55
|
+
else
|
|
56
|
+
squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items'] + ['UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar'])
|
|
57
|
+
end
|
|
59
58
|
options = squash('', $cfg['compiler']['options'])
|
|
60
59
|
includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items'])
|
|
61
60
|
includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR)
|
|
62
|
-
|
|
61
|
+
|
|
62
|
+
{ command: command, defines: defines, options: options, includes: includes }
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
-
def compile(file,
|
|
65
|
+
def compile(file, _defines = [])
|
|
66
66
|
compiler = build_compiler_fields
|
|
67
|
-
unity_include = $cfg['compiler']['includes']['prefix']+'../../src'
|
|
68
|
-
cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{unity_include} #{file} "
|
|
69
|
-
|
|
70
|
-
|
|
67
|
+
unity_include = $cfg['compiler']['includes']['prefix'] + '../../src'
|
|
68
|
+
cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{unity_include} #{file} " \
|
|
69
|
+
"#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" \
|
|
70
|
+
"#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}"
|
|
71
|
+
|
|
71
72
|
execute(cmd_str)
|
|
72
73
|
end
|
|
73
74
|
|
|
74
75
|
def build_linker_fields
|
|
75
|
-
command
|
|
76
|
-
if $cfg['linker']['options'].nil?
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
if
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
76
|
+
command = tackit($cfg['linker']['path'])
|
|
77
|
+
options = if $cfg['linker']['options'].nil?
|
|
78
|
+
''
|
|
79
|
+
else
|
|
80
|
+
squash('', $cfg['linker']['options'])
|
|
81
|
+
end
|
|
82
|
+
includes = if $cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil?
|
|
83
|
+
''
|
|
84
|
+
else
|
|
85
|
+
squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items'])
|
|
86
|
+
end.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR)
|
|
87
|
+
|
|
88
|
+
{ command: command, options: options, includes: includes }
|
|
88
89
|
end
|
|
89
90
|
|
|
90
91
|
def link_it(exe_name, obj_list)
|
|
91
92
|
linker = build_linker_fields
|
|
92
93
|
cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " +
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
(obj_list.map { |obj| "#{$cfg['linker']['object_files']['path']}#{obj} " }).join +
|
|
95
|
+
$cfg['linker']['bin_files']['prefix'] + ' ' +
|
|
96
|
+
$cfg['linker']['bin_files']['destination'] +
|
|
97
|
+
exe_name + $cfg['linker']['bin_files']['extension']
|
|
97
98
|
execute(cmd_str)
|
|
98
99
|
end
|
|
99
100
|
|
|
100
101
|
def build_simulator_fields
|
|
101
102
|
return nil if $cfg['simulator'].nil?
|
|
102
|
-
if $cfg['simulator']['path'].nil?
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if $cfg['simulator']['pre_support'].nil?
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
if $cfg['simulator']['post_support'].nil?
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
103
|
+
command = if $cfg['simulator']['path'].nil?
|
|
104
|
+
''
|
|
105
|
+
else
|
|
106
|
+
(tackit($cfg['simulator']['path']) + ' ')
|
|
107
|
+
end
|
|
108
|
+
pre_support = if $cfg['simulator']['pre_support'].nil?
|
|
109
|
+
''
|
|
110
|
+
else
|
|
111
|
+
squash('', $cfg['simulator']['pre_support'])
|
|
112
|
+
end
|
|
113
|
+
post_support = if $cfg['simulator']['post_support'].nil?
|
|
114
|
+
''
|
|
115
|
+
else
|
|
116
|
+
squash('', $cfg['simulator']['post_support'])
|
|
117
|
+
end
|
|
118
|
+
{ command: command, pre_support: pre_support, post_support: post_support }
|
|
118
119
|
end
|
|
119
120
|
|
|
120
|
-
def execute(command_string, verbose=true)
|
|
121
|
+
def execute(command_string, verbose = true)
|
|
121
122
|
report command_string
|
|
122
123
|
output = `#{command_string}`.chomp
|
|
123
|
-
report(output) if
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
end
|
|
127
|
-
return output
|
|
124
|
+
report(output) if verbose && !output.nil? && !output.empty?
|
|
125
|
+
raise "Command failed. (Returned #{$?.exitstatus})" if $?.exitstatus != 0
|
|
126
|
+
output
|
|
128
127
|
end
|
|
129
128
|
|
|
130
129
|
def report_summary
|
|
131
130
|
summary = UnityTestSummary.new
|
|
132
|
-
summary.
|
|
131
|
+
summary.root = HERE
|
|
133
132
|
results_glob = "#{$cfg['compiler']['build_path']}*.test*"
|
|
134
|
-
results_glob.
|
|
133
|
+
results_glob.tr!('\\', '/')
|
|
135
134
|
results = Dir[results_glob]
|
|
136
|
-
summary.
|
|
135
|
+
summary.targets = results
|
|
137
136
|
summary.run
|
|
138
137
|
end
|
|
139
138
|
|
|
@@ -146,34 +145,34 @@ module RakefileHelpers
|
|
|
146
145
|
$cfg['compiler']['defines']['items'] = [] if $cfg['compiler']['defines']['items'].nil?
|
|
147
146
|
|
|
148
147
|
# Get a list of all source files needed
|
|
149
|
-
src_files = Dir[HERE+'src/*.c']
|
|
150
|
-
src_files += Dir[HERE+'test/*.c']
|
|
151
|
-
src_files += Dir[HERE+'test/main/*.c']
|
|
148
|
+
src_files = Dir[HERE + 'src/*.c']
|
|
149
|
+
src_files += Dir[HERE + 'test/*.c']
|
|
150
|
+
src_files += Dir[HERE + 'test/main/*.c']
|
|
152
151
|
src_files << '../../src/unity.c'
|
|
153
152
|
|
|
154
153
|
# Build object files
|
|
155
154
|
src_files.each { |f| compile(f, test_defines) }
|
|
156
|
-
obj_list = src_files.map {|f| File.basename(f.ext($cfg['compiler']['object_files']['extension'])) }
|
|
155
|
+
obj_list = src_files.map { |f| File.basename(f.ext($cfg['compiler']['object_files']['extension'])) }
|
|
157
156
|
|
|
158
157
|
# Link the test executable
|
|
159
|
-
test_base =
|
|
158
|
+
test_base = 'framework_test'
|
|
160
159
|
link_it(test_base, obj_list)
|
|
161
160
|
|
|
162
161
|
# Execute unit test and generate results file
|
|
163
162
|
simulator = build_simulator_fields
|
|
164
163
|
executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension']
|
|
165
|
-
if simulator.nil?
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
164
|
+
cmd_str = if simulator.nil?
|
|
165
|
+
executable + ' -v -r'
|
|
166
|
+
else
|
|
167
|
+
"#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}"
|
|
168
|
+
end
|
|
170
169
|
output = execute(cmd_str)
|
|
171
170
|
test_results = $cfg['compiler']['build_path'] + test_base
|
|
172
|
-
if output.match(/OK$/m).nil?
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
171
|
+
test_results += if output.match(/OK$/m).nil?
|
|
172
|
+
'.testfail'
|
|
173
|
+
else
|
|
174
|
+
'.testpass'
|
|
175
|
+
end
|
|
177
176
|
File.open(test_results, 'w') { |f| f.print output }
|
|
178
177
|
end
|
|
179
178
|
end
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* [Released under MIT License. Please refer to license.txt for details]
|
|
6
6
|
* ========================================== */
|
|
7
7
|
|
|
8
|
-
#include <string.h>
|
|
9
8
|
#include "unity_fixture.h"
|
|
10
9
|
#include "unity_internals.h"
|
|
10
|
+
#include <string.h>
|
|
11
11
|
|
|
12
12
|
struct UNITY_FIXTURE_T UnityFixture;
|
|
13
13
|
|
|
@@ -71,7 +71,8 @@ void UnityTestRunner(unityfunction* setup,
|
|
|
71
71
|
const char* printableName,
|
|
72
72
|
const char* group,
|
|
73
73
|
const char* name,
|
|
74
|
-
const char* file,
|
|
74
|
+
const char* file,
|
|
75
|
+
unsigned int line)
|
|
75
76
|
{
|
|
76
77
|
if (testSelected(name) && groupSelected(group))
|
|
77
78
|
{
|
|
@@ -81,7 +82,12 @@ void UnityTestRunner(unityfunction* setup,
|
|
|
81
82
|
if (!UnityFixture.Verbose)
|
|
82
83
|
UNITY_OUTPUT_CHAR('.');
|
|
83
84
|
else
|
|
85
|
+
{
|
|
84
86
|
UnityPrint(printableName);
|
|
87
|
+
#ifndef UNITY_REPEAT_TEST_NAME
|
|
88
|
+
Unity.CurrentTestName = NULL;
|
|
89
|
+
#endif
|
|
90
|
+
}
|
|
85
91
|
|
|
86
92
|
Unity.NumberOfTests++;
|
|
87
93
|
UnityMalloc_StartTest();
|
|
@@ -193,7 +199,7 @@ void* unity_malloc(size_t size)
|
|
|
193
199
|
}
|
|
194
200
|
else
|
|
195
201
|
{
|
|
196
|
-
guard = (Guard*)
|
|
202
|
+
guard = (Guard*)&unity_heap[heap_index];
|
|
197
203
|
heap_index += total_size;
|
|
198
204
|
}
|
|
199
205
|
#else
|
|
@@ -285,7 +291,7 @@ void* unity_realloc(void* oldMem, size_t size)
|
|
|
285
291
|
if (oldMem == unity_heap + heap_index - guard->size - sizeof(end) &&
|
|
286
292
|
heap_index + size - guard->size <= UNITY_INTERNAL_HEAP_SIZE_BYTES)
|
|
287
293
|
{
|
|
288
|
-
release_memory(oldMem);
|
|
294
|
+
release_memory(oldMem); /* Not thread-safe, like unity_heap generally */
|
|
289
295
|
return unity_malloc(size); /* No memcpy since data is in place */
|
|
290
296
|
}
|
|
291
297
|
#endif
|
|
@@ -305,8 +311,7 @@ struct PointerPair
|
|
|
305
311
|
void* old_value;
|
|
306
312
|
};
|
|
307
313
|
|
|
308
|
-
|
|
309
|
-
static struct PointerPair pointer_store[MAX_POINTERS];
|
|
314
|
+
static struct PointerPair pointer_store[UNITY_MAX_POINTERS];
|
|
310
315
|
static int pointer_index = 0;
|
|
311
316
|
|
|
312
317
|
void UnityPointer_Init(void)
|
|
@@ -316,7 +321,7 @@ void UnityPointer_Init(void)
|
|
|
316
321
|
|
|
317
322
|
void UnityPointer_Set(void** pointer, void* newValue, UNITY_LINE_TYPE line)
|
|
318
323
|
{
|
|
319
|
-
if (pointer_index >=
|
|
324
|
+
if (pointer_index >= UNITY_MAX_POINTERS)
|
|
320
325
|
{
|
|
321
326
|
UNITY_TEST_FAIL(line, "Too many pointers set");
|
|
322
327
|
}
|
|
@@ -391,7 +396,9 @@ int UnityGetCommandLineOptions(int argc, const char* argv[])
|
|
|
391
396
|
i++;
|
|
392
397
|
}
|
|
393
398
|
}
|
|
394
|
-
}
|
|
399
|
+
}
|
|
400
|
+
else
|
|
401
|
+
{
|
|
395
402
|
/* ignore unknown parameter */
|
|
396
403
|
i++;
|
|
397
404
|
}
|
|
@@ -49,6 +49,7 @@ int UnityMain(int argc, const char* argv[], void (*runAllTests)(void));
|
|
|
49
49
|
}\
|
|
50
50
|
void TEST_##group##_##name##_(void)
|
|
51
51
|
|
|
52
|
+
/* Call this for each test, insider the group runner */
|
|
52
53
|
#define RUN_TEST_CASE(group, name) \
|
|
53
54
|
{ void TEST_##group##_##name##_run(void);\
|
|
54
55
|
TEST_##group##_##name##_run(); }
|
|
@@ -64,6 +65,8 @@ int UnityMain(int argc, const char* argv[], void (*runAllTests)(void));
|
|
|
64
65
|
TEST_##group##_GROUP_RUNNER(); }
|
|
65
66
|
|
|
66
67
|
/* CppUTest Compatibility Macros */
|
|
68
|
+
#ifndef UNITY_EXCLUDE_CPPUTEST_ASSERTS
|
|
69
|
+
/* Sets a pointer and automatically restores it to its old value after teardown */
|
|
67
70
|
#define UT_PTR_SET(ptr, newPointerValue) UnityPointer_Set((void**)&(ptr), (void*)(newPointerValue), __LINE__)
|
|
68
71
|
#define TEST_ASSERT_POINTERS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_PTR((expected), (actual))
|
|
69
72
|
#define TEST_ASSERT_BYTES_EQUAL(expected, actual) TEST_ASSERT_EQUAL_HEX8(0xff & (expected), 0xff & (actual))
|
|
@@ -71,8 +74,10 @@ int UnityMain(int argc, const char* argv[], void (*runAllTests)(void));
|
|
|
71
74
|
#define CHECK(condition) TEST_ASSERT_TRUE((condition))
|
|
72
75
|
#define LONGS_EQUAL(expected, actual) TEST_ASSERT_EQUAL_INT((expected), (actual))
|
|
73
76
|
#define STRCMP_EQUAL(expected, actual) TEST_ASSERT_EQUAL_STRING((expected), (actual))
|
|
74
|
-
#define DOUBLES_EQUAL(expected, actual, delta)
|
|
77
|
+
#define DOUBLES_EQUAL(expected, actual, delta) TEST_ASSERT_DOUBLE_WITHIN((delta), (expected), (actual))
|
|
78
|
+
#endif
|
|
75
79
|
|
|
80
|
+
/* You must compile with malloc replacement, as defined in unity_fixture_malloc_overrides.h */
|
|
76
81
|
void UnityMalloc_MakeMallocFailAfterCount(int count);
|
|
77
82
|
|
|
78
83
|
#endif /* UNITY_FIXTURE_H_ */
|
|
@@ -40,6 +40,9 @@ void UnityConcludeFixtureTest(void);
|
|
|
40
40
|
void UnityPointer_Set(void** ptr, void* newValue, UNITY_LINE_TYPE line);
|
|
41
41
|
void UnityPointer_UndoAllSets(void);
|
|
42
42
|
void UnityPointer_Init(void);
|
|
43
|
+
#ifndef UNITY_MAX_POINTERS
|
|
44
|
+
#define UNITY_MAX_POINTERS 5
|
|
45
|
+
#endif
|
|
43
46
|
|
|
44
47
|
#ifdef __cplusplus
|
|
45
48
|
}
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
* For example, when using FreeRTOS UNITY_FIXTURE_MALLOC becomes pvPortMalloc()
|
|
27
27
|
* and UNITY_FIXTURE_FREE becomes vPortFree(). */
|
|
28
28
|
#if !defined(UNITY_FIXTURE_MALLOC) || !defined(UNITY_FIXTURE_FREE)
|
|
29
|
+
#include <stdlib.h>
|
|
29
30
|
#define UNITY_FIXTURE_MALLOC(size) malloc(size)
|
|
30
31
|
#define UNITY_FIXTURE_FREE(ptr) free(ptr)
|
|
31
32
|
#else
|
|
@@ -465,7 +465,7 @@ TEST(LeakDetection, PointerSettingMax)
|
|
|
465
465
|
TEST_IGNORE();
|
|
466
466
|
#else
|
|
467
467
|
int i;
|
|
468
|
-
for (i = 0; i <
|
|
468
|
+
for (i = 0; i < UNITY_MAX_POINTERS; i++) UT_PTR_SET(pointer1, &int1);
|
|
469
469
|
UnityOutputCharSpy_Enable(1);
|
|
470
470
|
EXPECT_ABORT_BEGIN
|
|
471
471
|
UT_PTR_SET(pointer1, &int1);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
2.4.
|
|
1
|
+
2.4.1
|
|
2
2
|
|
data/vendor/unity/src/unity.c
CHANGED
|
@@ -12,12 +12,10 @@
|
|
|
12
12
|
void UNITY_OUTPUT_CHAR(int);
|
|
13
13
|
#endif
|
|
14
14
|
|
|
15
|
-
/* Helpful macros for us to use here */
|
|
16
|
-
#define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1;
|
|
17
|
-
#define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1;
|
|
18
|
-
|
|
19
|
-
/* return prematurely if we are already in failure or ignore state */
|
|
20
|
-
#define UNITY_SKIP_EXECUTION { if ((Unity.CurrentTestFailed != 0) || (Unity.CurrentTestIgnored != 0)) {return;} }
|
|
15
|
+
/* Helpful macros for us to use here in Assert functions */
|
|
16
|
+
#define UNITY_FAIL_AND_BAIL { Unity.CurrentTestFailed = 1; TEST_ABORT(); }
|
|
17
|
+
#define UNITY_IGNORE_AND_BAIL { Unity.CurrentTestIgnored = 1; TEST_ABORT(); }
|
|
18
|
+
#define RETURN_IF_FAIL_OR_IGNORE if (Unity.CurrentTestFailed || Unity.CurrentTestIgnored) return
|
|
21
19
|
|
|
22
20
|
struct UNITY_STORAGE_T Unity;
|
|
23
21
|
|
|
@@ -54,21 +52,6 @@ static const char UnityStrResultsIgnored[] = " Ignored ";
|
|
|
54
52
|
static const char UnityStrDetail1Name[] = UNITY_DETAIL1_NAME " ";
|
|
55
53
|
static const char UnityStrDetail2Name[] = " " UNITY_DETAIL2_NAME " ";
|
|
56
54
|
|
|
57
|
-
/* compiler-generic print formatting masks */
|
|
58
|
-
static const UNITY_UINT UnitySizeMask[] =
|
|
59
|
-
{
|
|
60
|
-
255u, /* 0xFF */
|
|
61
|
-
65535u, /* 0xFFFF */
|
|
62
|
-
65535u,
|
|
63
|
-
4294967295u, /* 0xFFFFFFFF */
|
|
64
|
-
4294967295u,
|
|
65
|
-
4294967295u,
|
|
66
|
-
4294967295u
|
|
67
|
-
#ifdef UNITY_SUPPORT_64
|
|
68
|
-
,0xFFFFFFFFFFFFFFFF
|
|
69
|
-
#endif
|
|
70
|
-
};
|
|
71
|
-
|
|
72
55
|
/*-----------------------------------------------
|
|
73
56
|
* Pretty Printers & Test Result Output Handlers
|
|
74
57
|
*-----------------------------------------------*/
|
|
@@ -110,7 +93,6 @@ void UnityPrint(const char* string)
|
|
|
110
93
|
}
|
|
111
94
|
}
|
|
112
95
|
|
|
113
|
-
void UnityPrintLen(const char* string, const UNITY_UINT32 length);
|
|
114
96
|
void UnityPrintLen(const char* string, const UNITY_UINT32 length)
|
|
115
97
|
{
|
|
116
98
|
const char* pch = string;
|
|
@@ -157,13 +139,13 @@ void UnityPrintNumberByStyle(const UNITY_INT number, const UNITY_DISPLAY_STYLE_T
|
|
|
157
139
|
}
|
|
158
140
|
else if ((style & UNITY_DISPLAY_RANGE_UINT) == UNITY_DISPLAY_RANGE_UINT)
|
|
159
141
|
{
|
|
160
|
-
UnityPrintNumberUnsigned(
|
|
142
|
+
UnityPrintNumberUnsigned((UNITY_UINT)number);
|
|
161
143
|
}
|
|
162
144
|
else
|
|
163
145
|
{
|
|
164
146
|
UNITY_OUTPUT_CHAR('0');
|
|
165
147
|
UNITY_OUTPUT_CHAR('x');
|
|
166
|
-
UnityPrintNumberHex((UNITY_UINT)number, (char)((style &
|
|
148
|
+
UnityPrintNumberHex((UNITY_UINT)number, (char)((style & 0xF) * 2));
|
|
167
149
|
}
|
|
168
150
|
}
|
|
169
151
|
|
|
@@ -198,19 +180,21 @@ void UnityPrintNumberUnsigned(const UNITY_UINT number)
|
|
|
198
180
|
{
|
|
199
181
|
UNITY_OUTPUT_CHAR((char)('0' + (number / divisor % 10)));
|
|
200
182
|
divisor /= 10;
|
|
201
|
-
}
|
|
202
|
-
while (divisor > 0);
|
|
183
|
+
} while (divisor > 0);
|
|
203
184
|
}
|
|
204
185
|
|
|
205
186
|
/*-----------------------------------------------*/
|
|
206
187
|
void UnityPrintNumberHex(const UNITY_UINT number, const char nibbles_to_print)
|
|
207
188
|
{
|
|
208
|
-
|
|
189
|
+
int nibble;
|
|
209
190
|
char nibbles = nibbles_to_print;
|
|
191
|
+
if ((unsigned)nibbles > (2 * sizeof(number)))
|
|
192
|
+
nibbles = 2 * sizeof(number);
|
|
210
193
|
|
|
211
194
|
while (nibbles > 0)
|
|
212
195
|
{
|
|
213
|
-
|
|
196
|
+
nibbles--;
|
|
197
|
+
nibble = (int)(number >> (nibbles * 4)) & 0x0F;
|
|
214
198
|
if (nibble <= 9)
|
|
215
199
|
{
|
|
216
200
|
UNITY_OUTPUT_CHAR((char)('0' + nibble));
|
|
@@ -250,65 +234,115 @@ void UnityPrintMask(const UNITY_UINT mask, const UNITY_UINT number)
|
|
|
250
234
|
}
|
|
251
235
|
|
|
252
236
|
/*-----------------------------------------------*/
|
|
253
|
-
#
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
#ifndef UNITY_VERBOSE_NUMBER_MAX_LENGTH
|
|
257
|
-
# ifdef UNITY_DOUBLE_VERBOSE
|
|
258
|
-
# define UNITY_VERBOSE_NUMBER_MAX_LENGTH 317
|
|
259
|
-
# else
|
|
260
|
-
# define UNITY_VERBOSE_NUMBER_MAX_LENGTH 47
|
|
261
|
-
# endif
|
|
262
|
-
#endif
|
|
263
|
-
|
|
264
|
-
void UnityPrintFloat(UNITY_DOUBLE number)
|
|
237
|
+
#ifndef UNITY_EXCLUDE_FLOAT_PRINT
|
|
238
|
+
static void UnityPrintDecimalAndNumberWithLeadingZeros(UNITY_INT32 fraction_part, UNITY_INT32 divisor)
|
|
265
239
|
{
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
240
|
+
UNITY_OUTPUT_CHAR('.');
|
|
241
|
+
while (divisor > 0)
|
|
242
|
+
{
|
|
243
|
+
UNITY_OUTPUT_CHAR('0' + fraction_part / divisor);
|
|
244
|
+
fraction_part %= divisor;
|
|
245
|
+
divisor /= 10;
|
|
246
|
+
if (fraction_part == 0) break; /* Truncate trailing 0's */
|
|
247
|
+
}
|
|
269
248
|
}
|
|
249
|
+
#ifndef UNITY_ROUND_TIES_AWAY_FROM_ZERO
|
|
250
|
+
/* If rounds up && remainder 0.5 && result odd && below cutoff for double precision issues */
|
|
251
|
+
#define ROUND_TIES_TO_EVEN(orig, num_int, num) \
|
|
252
|
+
if (num_int > (num) && (num) - (num_int-1) <= 0.5 && (num_int & 1) == 1 && orig < 1e22) \
|
|
253
|
+
num_int -= 1 /* => a tie to round down to even */
|
|
254
|
+
#else
|
|
255
|
+
#define ROUND_TIES_TO_EVEN(orig, num_int, num) /* Remove macro */
|
|
270
256
|
#endif
|
|
271
257
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
258
|
+
/* Printing floating point numbers is hard. Some goals of this implementation: works for embedded
|
|
259
|
+
* systems, floats or doubles, and has a reasonable format. The key paper in this area,
|
|
260
|
+
* 'How to Print Floating-Point Numbers Accurately' by Steele & White, shows an approximation by
|
|
261
|
+
* scaling called Dragon 2. This code uses a similar idea. The other core algorithm uses casts and
|
|
262
|
+
* floating subtraction to give exact remainders after the decimal, to be scaled into an integer.
|
|
263
|
+
* Extra trailing 0's are excluded. The output defaults to rounding to nearest, ties to even. You
|
|
264
|
+
* can enable rounding ties away from zero. Note: UNITY_DOUBLE param can typedef to float or double
|
|
265
|
+
|
|
266
|
+
* The old version required compiling in snprintf. For reference, with a similar format as now:
|
|
267
|
+
* char buf[19];
|
|
268
|
+
* if (number > 4294967296.0 || -number > 4294967296.0) snprintf(buf, sizeof buf, "%.8e", number);
|
|
269
|
+
* else snprintf(buf, sizeof buf, "%.6f", number);
|
|
270
|
+
* UnityPrint(buf);
|
|
271
|
+
*/
|
|
272
|
+
void UnityPrintFloat(const UNITY_DOUBLE input_number)
|
|
276
273
|
{
|
|
277
|
-
|
|
278
|
-
}
|
|
274
|
+
UNITY_DOUBLE number;
|
|
279
275
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
276
|
+
if (input_number < 0)
|
|
277
|
+
{
|
|
278
|
+
UNITY_OUTPUT_CHAR('-');
|
|
279
|
+
number = -input_number;
|
|
280
|
+
} else
|
|
281
|
+
{
|
|
282
|
+
number = input_number;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
if (isnan(number)) UnityPrint(UnityStrNaN);
|
|
286
|
+
else if (isinf(number)) UnityPrintLen(UnityStrInf, 3);
|
|
287
|
+
else if (number <= 0.0000005 && number > 0) UnityPrint("0.000000..."); /* Small number */
|
|
288
|
+
else if (number < 4294967295.9999995) /* Rounded result fits in 32 bits, "%.6f" format */
|
|
289
|
+
{
|
|
290
|
+
const UNITY_INT32 divisor = 1000000/10;
|
|
291
|
+
UNITY_UINT32 integer_part = (UNITY_UINT32)number;
|
|
292
|
+
UNITY_INT32 fraction_part = (UNITY_INT32)((number - (UNITY_DOUBLE)integer_part)*1000000.0 + 0.5);
|
|
293
|
+
/* Double precision calculation gives best performance for six rounded decimal places */
|
|
294
|
+
ROUND_TIES_TO_EVEN(number, fraction_part, (number - (UNITY_DOUBLE)integer_part)*1000000.0);
|
|
295
|
+
|
|
296
|
+
if (fraction_part == 1000000) /* Carry across the decimal point */
|
|
297
|
+
{
|
|
298
|
+
fraction_part = 0;
|
|
299
|
+
integer_part += 1;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
UnityPrintNumberUnsigned(integer_part);
|
|
303
|
+
UnityPrintDecimalAndNumberWithLeadingZeros(fraction_part, divisor);
|
|
304
|
+
}
|
|
305
|
+
else /* Number is larger, use exponential format of 9 digits, "%.8e" */
|
|
306
|
+
{
|
|
307
|
+
const UNITY_INT32 divisor = 1000000000/10;
|
|
308
|
+
UNITY_INT32 integer_part;
|
|
309
|
+
UNITY_DOUBLE_TYPE divide = 10.0;
|
|
310
|
+
int exponent = 9;
|
|
311
|
+
|
|
312
|
+
while (number / divide >= 1000000000.0 - 0.5)
|
|
313
|
+
{
|
|
314
|
+
divide *= 10;
|
|
315
|
+
exponent++;
|
|
316
|
+
}
|
|
317
|
+
integer_part = (UNITY_INT32)(number / divide + 0.5);
|
|
318
|
+
/* Double precision calculation required for float, to produce 9 rounded digits */
|
|
319
|
+
ROUND_TIES_TO_EVEN(number, integer_part, number / divide);
|
|
320
|
+
|
|
321
|
+
UNITY_OUTPUT_CHAR('0' + integer_part / divisor);
|
|
322
|
+
UnityPrintDecimalAndNumberWithLeadingZeros(integer_part % divisor, divisor / 10);
|
|
323
|
+
UNITY_OUTPUT_CHAR('e');
|
|
324
|
+
UNITY_OUTPUT_CHAR('+');
|
|
325
|
+
if (exponent < 10) UNITY_OUTPUT_CHAR('0');
|
|
326
|
+
UnityPrintNumber(exponent);
|
|
327
|
+
}
|
|
284
328
|
}
|
|
329
|
+
#endif /* ! UNITY_EXCLUDE_FLOAT_PRINT */
|
|
285
330
|
|
|
286
331
|
/*-----------------------------------------------*/
|
|
287
|
-
static void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line);
|
|
288
332
|
static void UnityTestResultsBegin(const char* file, const UNITY_LINE_TYPE line)
|
|
289
333
|
{
|
|
290
|
-
#ifndef UNITY_FIXTURES
|
|
291
334
|
UnityPrint(file);
|
|
292
335
|
UNITY_OUTPUT_CHAR(':');
|
|
293
336
|
UnityPrintNumber((UNITY_INT)line);
|
|
294
337
|
UNITY_OUTPUT_CHAR(':');
|
|
295
338
|
UnityPrint(Unity.CurrentTestName);
|
|
296
339
|
UNITY_OUTPUT_CHAR(':');
|
|
297
|
-
#else
|
|
298
|
-
UNITY_UNUSED(file);
|
|
299
|
-
UNITY_UNUSED(line);
|
|
300
|
-
#endif
|
|
301
340
|
}
|
|
302
341
|
|
|
303
342
|
/*-----------------------------------------------*/
|
|
304
|
-
static void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line);
|
|
305
343
|
static void UnityTestResultsFailBegin(const UNITY_LINE_TYPE line)
|
|
306
344
|
{
|
|
307
|
-
#ifndef UNITY_FIXTURES
|
|
308
345
|
UnityTestResultsBegin(Unity.TestFile, line);
|
|
309
|
-
#else
|
|
310
|
-
UNITY_UNUSED(line);
|
|
311
|
-
#endif
|
|
312
346
|
UnityPrint(UnityStrFail);
|
|
313
347
|
UNITY_OUTPUT_CHAR(':');
|
|
314
348
|
}
|
|
@@ -337,7 +371,6 @@ void UnityConcludeTest(void)
|
|
|
337
371
|
}
|
|
338
372
|
|
|
339
373
|
/*-----------------------------------------------*/
|
|
340
|
-
static void UnityAddMsgIfSpecified(const char* msg);
|
|
341
374
|
static void UnityAddMsgIfSpecified(const char* msg)
|
|
342
375
|
{
|
|
343
376
|
if (msg)
|
|
@@ -361,7 +394,6 @@ static void UnityAddMsgIfSpecified(const char* msg)
|
|
|
361
394
|
}
|
|
362
395
|
|
|
363
396
|
/*-----------------------------------------------*/
|
|
364
|
-
static void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual);
|
|
365
397
|
static void UnityPrintExpectedAndActualStrings(const char* expected, const char* actual)
|
|
366
398
|
{
|
|
367
399
|
UnityPrint(UnityStrExpected);
|
|
@@ -373,7 +405,7 @@ static void UnityPrintExpectedAndActualStrings(const char* expected, const char*
|
|
|
373
405
|
}
|
|
374
406
|
else
|
|
375
407
|
{
|
|
376
|
-
|
|
408
|
+
UnityPrint(UnityStrNull);
|
|
377
409
|
}
|
|
378
410
|
UnityPrint(UnityStrWas);
|
|
379
411
|
if (actual != NULL)
|
|
@@ -384,12 +416,14 @@ static void UnityPrintExpectedAndActualStrings(const char* expected, const char*
|
|
|
384
416
|
}
|
|
385
417
|
else
|
|
386
418
|
{
|
|
387
|
-
|
|
419
|
+
UnityPrint(UnityStrNull);
|
|
388
420
|
}
|
|
389
421
|
}
|
|
390
422
|
|
|
391
423
|
/*-----------------------------------------------*/
|
|
392
|
-
static void UnityPrintExpectedAndActualStringsLen(const char* expected,
|
|
424
|
+
static void UnityPrintExpectedAndActualStringsLen(const char* expected,
|
|
425
|
+
const char* actual,
|
|
426
|
+
const UNITY_UINT32 length)
|
|
393
427
|
{
|
|
394
428
|
UnityPrint(UnityStrExpected);
|
|
395
429
|
if (expected != NULL)
|
|
@@ -400,7 +434,7 @@ static void UnityPrintExpectedAndActualStringsLen(const char* expected, const ch
|
|
|
400
434
|
}
|
|
401
435
|
else
|
|
402
436
|
{
|
|
403
|
-
|
|
437
|
+
UnityPrint(UnityStrNull);
|
|
404
438
|
}
|
|
405
439
|
UnityPrint(UnityStrWas);
|
|
406
440
|
if (actual != NULL)
|
|
@@ -411,42 +445,40 @@ static void UnityPrintExpectedAndActualStringsLen(const char* expected, const ch
|
|
|
411
445
|
}
|
|
412
446
|
else
|
|
413
447
|
{
|
|
414
|
-
|
|
448
|
+
UnityPrint(UnityStrNull);
|
|
415
449
|
}
|
|
416
450
|
}
|
|
417
451
|
|
|
418
|
-
|
|
419
|
-
|
|
420
452
|
/*-----------------------------------------------
|
|
421
453
|
* Assertion & Control Helpers
|
|
422
454
|
*-----------------------------------------------*/
|
|
423
455
|
|
|
424
|
-
static int
|
|
456
|
+
static int UnityIsOneArrayNull(UNITY_INTERNAL_PTR expected,
|
|
457
|
+
UNITY_INTERNAL_PTR actual,
|
|
458
|
+
const UNITY_LINE_TYPE lineNumber,
|
|
459
|
+
const char* msg)
|
|
425
460
|
{
|
|
426
|
-
|
|
427
|
-
if ((expected == NULL) && (actual == NULL))
|
|
428
|
-
return 1;
|
|
461
|
+
if (expected == actual) return 0; /* Both are NULL or same pointer */
|
|
429
462
|
|
|
430
|
-
/*
|
|
463
|
+
/* print and return true if just expected is NULL */
|
|
431
464
|
if (expected == NULL)
|
|
432
465
|
{
|
|
433
466
|
UnityTestResultsFailBegin(lineNumber);
|
|
434
467
|
UnityPrint(UnityStrNullPointerForExpected);
|
|
435
468
|
UnityAddMsgIfSpecified(msg);
|
|
436
|
-
|
|
469
|
+
return 1;
|
|
437
470
|
}
|
|
438
471
|
|
|
439
|
-
/*
|
|
472
|
+
/* print and return true if just actual is NULL */
|
|
440
473
|
if (actual == NULL)
|
|
441
474
|
{
|
|
442
475
|
UnityTestResultsFailBegin(lineNumber);
|
|
443
476
|
UnityPrint(UnityStrNullPointerForActual);
|
|
444
477
|
UnityAddMsgIfSpecified(msg);
|
|
445
|
-
|
|
478
|
+
return 1;
|
|
446
479
|
}
|
|
447
480
|
|
|
448
|
-
/* return false if neither is NULL */
|
|
449
|
-
return 0;
|
|
481
|
+
return 0; /* return false if neither is NULL */
|
|
450
482
|
}
|
|
451
483
|
|
|
452
484
|
/*-----------------------------------------------
|
|
@@ -459,7 +491,7 @@ void UnityAssertBits(const UNITY_INT mask,
|
|
|
459
491
|
const char* msg,
|
|
460
492
|
const UNITY_LINE_TYPE lineNumber)
|
|
461
493
|
{
|
|
462
|
-
|
|
494
|
+
RETURN_IF_FAIL_OR_IGNORE;
|
|
463
495
|
|
|
464
496
|
if ((mask & expected) != (mask & actual))
|
|
465
497
|
{
|
|
@@ -480,7 +512,7 @@ void UnityAssertEqualNumber(const UNITY_INT expected,
|
|
|
480
512
|
const UNITY_LINE_TYPE lineNumber,
|
|
481
513
|
const UNITY_DISPLAY_STYLE_T style)
|
|
482
514
|
{
|
|
483
|
-
|
|
515
|
+
RETURN_IF_FAIL_OR_IGNORE;
|
|
484
516
|
|
|
485
517
|
if (expected != actual)
|
|
486
518
|
{
|
|
@@ -507,122 +539,86 @@ void UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,
|
|
|
507
539
|
const UNITY_UINT32 num_elements,
|
|
508
540
|
const char* msg,
|
|
509
541
|
const UNITY_LINE_TYPE lineNumber,
|
|
510
|
-
const UNITY_DISPLAY_STYLE_T style
|
|
542
|
+
const UNITY_DISPLAY_STYLE_T style,
|
|
543
|
+
const UNITY_FLAGS_T flags)
|
|
511
544
|
{
|
|
512
545
|
UNITY_UINT32 elements = num_elements;
|
|
513
|
-
|
|
514
|
-
UNITY_INTERNAL_PTR ptr_act = (UNITY_INTERNAL_PTR)actual;
|
|
546
|
+
unsigned int length = style & 0xF;
|
|
515
547
|
|
|
516
|
-
|
|
548
|
+
RETURN_IF_FAIL_OR_IGNORE;
|
|
517
549
|
|
|
518
|
-
if (
|
|
550
|
+
if (num_elements == 0)
|
|
519
551
|
{
|
|
520
552
|
UnityPrintPointlessAndBail();
|
|
521
553
|
}
|
|
522
554
|
|
|
523
|
-
if (
|
|
524
|
-
|
|
555
|
+
if (expected == actual) return; /* Both are NULL or same pointer */
|
|
556
|
+
if (UnityIsOneArrayNull(expected, actual, lineNumber, msg))
|
|
557
|
+
UNITY_FAIL_AND_BAIL;
|
|
525
558
|
|
|
526
|
-
|
|
527
|
-
* as UNITY_DISPLAY_STYLE_INT includes a flag for UNITY_DISPLAY_RANGE_AUTO, which the width-specific
|
|
528
|
-
* variants do not. Therefore remove this flag. */
|
|
529
|
-
switch(style & (UNITY_DISPLAY_STYLE_T)(~UNITY_DISPLAY_RANGE_AUTO))
|
|
559
|
+
while (elements--)
|
|
530
560
|
{
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
UnityPrint(UnityStrWas);
|
|
544
|
-
UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const UNITY_INT8*)ptr_act, style);
|
|
545
|
-
UnityAddMsgIfSpecified(msg);
|
|
546
|
-
UNITY_FAIL_AND_BAIL;
|
|
547
|
-
}
|
|
548
|
-
ptr_exp = (UNITY_INTERNAL_PTR)((UNITY_PTR)ptr_exp + 1);
|
|
549
|
-
ptr_act = (UNITY_INTERNAL_PTR)((UNITY_PTR)ptr_act + 1);
|
|
550
|
-
}
|
|
551
|
-
break;
|
|
552
|
-
case UNITY_DISPLAY_STYLE_HEX16:
|
|
553
|
-
case UNITY_DISPLAY_STYLE_INT16:
|
|
554
|
-
case UNITY_DISPLAY_STYLE_UINT16:
|
|
555
|
-
while (elements--)
|
|
556
|
-
{
|
|
557
|
-
if (*(UNITY_PTR_ATTRIBUTE const UNITY_INT16*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const UNITY_INT16*)ptr_act)
|
|
558
|
-
{
|
|
559
|
-
UnityTestResultsFailBegin(lineNumber);
|
|
560
|
-
UnityPrint(UnityStrElement);
|
|
561
|
-
UnityPrintNumberUnsigned(num_elements - elements - 1);
|
|
562
|
-
UnityPrint(UnityStrExpected);
|
|
563
|
-
UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const UNITY_INT16*)ptr_exp, style);
|
|
564
|
-
UnityPrint(UnityStrWas);
|
|
565
|
-
UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const UNITY_INT16*)ptr_act, style);
|
|
566
|
-
UnityAddMsgIfSpecified(msg);
|
|
567
|
-
UNITY_FAIL_AND_BAIL;
|
|
568
|
-
}
|
|
569
|
-
ptr_exp = (UNITY_INTERNAL_PTR)((UNITY_PTR)ptr_exp + 2);
|
|
570
|
-
ptr_act = (UNITY_INTERNAL_PTR)((UNITY_PTR)ptr_act + 2);
|
|
571
|
-
}
|
|
572
|
-
break;
|
|
561
|
+
UNITY_INT expect_val;
|
|
562
|
+
UNITY_INT actual_val;
|
|
563
|
+
switch (length)
|
|
564
|
+
{
|
|
565
|
+
case 1:
|
|
566
|
+
expect_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT8*)expected;
|
|
567
|
+
actual_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT8*)actual;
|
|
568
|
+
break;
|
|
569
|
+
case 2:
|
|
570
|
+
expect_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT16*)expected;
|
|
571
|
+
actual_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT16*)actual;
|
|
572
|
+
break;
|
|
573
573
|
#ifdef UNITY_SUPPORT_64
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
{
|
|
579
|
-
if (*(UNITY_PTR_ATTRIBUTE const UNITY_INT64*)ptr_exp != *(UNITY_PTR_ATTRIBUTE const UNITY_INT64*)ptr_act)
|
|
580
|
-
{
|
|
581
|
-
UnityTestResultsFailBegin(lineNumber);
|
|
582
|
-
UnityPrint(UnityStrElement);
|
|
583
|
-
UnityPrintNumberUnsigned(num_elements - elements - 1);
|
|
584
|
-
UnityPrint(UnityStrExpected);
|
|
585
|
-
UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const UNITY_INT64*)ptr_exp, style);
|
|
586
|
-
UnityPrint(UnityStrWas);
|
|
587
|
-
UnityPrintNumberByStyle(*(UNITY_PTR_ATTRIBUTE const UNITY_INT64*)ptr_act, style);
|
|
588
|
-
UnityAddMsgIfSpecified(msg);
|
|
589
|
-
UNITY_FAIL_AND_BAIL;
|
|
590
|
-
}
|
|
591
|
-
ptr_exp = (UNITY_INTERNAL_PTR)((UNITY_PTR)ptr_exp + 8);
|
|
592
|
-
ptr_act = (UNITY_INTERNAL_PTR)((UNITY_PTR)ptr_act + 8);
|
|
593
|
-
}
|
|
594
|
-
break;
|
|
574
|
+
case 8:
|
|
575
|
+
expect_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT64*)expected;
|
|
576
|
+
actual_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT64*)actual;
|
|
577
|
+
break;
|
|
595
578
|
#endif
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
ptr_exp = (UNITY_INTERNAL_PTR)((UNITY_PTR)ptr_exp + 4);
|
|
612
|
-
ptr_act = (UNITY_INTERNAL_PTR)((UNITY_PTR)ptr_act + 4);
|
|
579
|
+
default: /* length 4 bytes */
|
|
580
|
+
expect_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT32*)expected;
|
|
581
|
+
actual_val = *(UNITY_PTR_ATTRIBUTE const UNITY_INT32*)actual;
|
|
582
|
+
length = 4;
|
|
583
|
+
break;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
if (expect_val != actual_val)
|
|
587
|
+
{
|
|
588
|
+
if (style & UNITY_DISPLAY_RANGE_UINT && length < sizeof(expect_val))
|
|
589
|
+
{ /* For UINT, remove sign extension (padding 1's) from signed type casts above */
|
|
590
|
+
UNITY_INT mask = 1;
|
|
591
|
+
mask = (mask << 8 * length) - 1;
|
|
592
|
+
expect_val &= mask;
|
|
593
|
+
actual_val &= mask;
|
|
613
594
|
}
|
|
614
|
-
|
|
595
|
+
UnityTestResultsFailBegin(lineNumber);
|
|
596
|
+
UnityPrint(UnityStrElement);
|
|
597
|
+
UnityPrintNumberUnsigned(num_elements - elements - 1);
|
|
598
|
+
UnityPrint(UnityStrExpected);
|
|
599
|
+
UnityPrintNumberByStyle(expect_val, style);
|
|
600
|
+
UnityPrint(UnityStrWas);
|
|
601
|
+
UnityPrintNumberByStyle(actual_val, style);
|
|
602
|
+
UnityAddMsgIfSpecified(msg);
|
|
603
|
+
UNITY_FAIL_AND_BAIL;
|
|
604
|
+
}
|
|
605
|
+
if (flags == UNITY_ARRAY_TO_ARRAY)
|
|
606
|
+
{
|
|
607
|
+
expected = (UNITY_INTERNAL_PTR)(length + (const char*)expected);
|
|
608
|
+
}
|
|
609
|
+
actual = (UNITY_INTERNAL_PTR)(length + (const char*)actual);
|
|
615
610
|
}
|
|
616
611
|
}
|
|
617
612
|
|
|
618
613
|
/*-----------------------------------------------*/
|
|
614
|
+
#ifndef UNITY_EXCLUDE_FLOAT
|
|
619
615
|
/* Wrap this define in a function with variable types as float or double */
|
|
620
616
|
#define UNITY_FLOAT_OR_DOUBLE_WITHIN(delta, expected, actual, diff) \
|
|
621
|
-
if (isinf(expected) && isinf(actual) && (
|
|
617
|
+
if (isinf(expected) && isinf(actual) && ((expected < 0) == (actual < 0))) return 1; \
|
|
622
618
|
if (UNITY_NAN_CHECK) return 1; \
|
|
623
619
|
diff = actual - expected; \
|
|
624
|
-
if (diff < 0
|
|
625
|
-
if (delta < 0
|
|
620
|
+
if (diff < 0) diff = -diff; \
|
|
621
|
+
if (delta < 0) delta = -delta; \
|
|
626
622
|
return !(isnan(diff) || isinf(diff) || (diff > delta))
|
|
627
623
|
/* This first part of this condition will catch any NaN or Infinite values */
|
|
628
624
|
#ifndef UNITY_NAN_NOT_EQUAL_NAN
|
|
@@ -631,7 +627,18 @@ void UnityAssertEqualIntArray(UNITY_INTERNAL_PTR expected,
|
|
|
631
627
|
#define UNITY_NAN_CHECK 0
|
|
632
628
|
#endif
|
|
633
629
|
|
|
634
|
-
#ifndef
|
|
630
|
+
#ifndef UNITY_EXCLUDE_FLOAT_PRINT
|
|
631
|
+
#define UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT(expected, actual) \
|
|
632
|
+
{ \
|
|
633
|
+
UnityPrint(UnityStrExpected); \
|
|
634
|
+
UnityPrintFloat(expected); \
|
|
635
|
+
UnityPrint(UnityStrWas); \
|
|
636
|
+
UnityPrintFloat(actual); }
|
|
637
|
+
#else
|
|
638
|
+
#define UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT(expected, actual) \
|
|
639
|
+
UnityPrint(UnityStrDelta)
|
|
640
|
+
#endif /* UNITY_EXCLUDE_FLOAT_PRINT */
|
|
641
|
+
|
|
635
642
|
static int UnityFloatsWithin(UNITY_FLOAT delta, UNITY_FLOAT expected, UNITY_FLOAT actual)
|
|
636
643
|
{
|
|
637
644
|
UNITY_FLOAT diff;
|
|
@@ -642,21 +649,23 @@ void UnityAssertEqualFloatArray(UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* expected,
|
|
|
642
649
|
UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* actual,
|
|
643
650
|
const UNITY_UINT32 num_elements,
|
|
644
651
|
const char* msg,
|
|
645
|
-
const UNITY_LINE_TYPE lineNumber
|
|
652
|
+
const UNITY_LINE_TYPE lineNumber,
|
|
653
|
+
const UNITY_FLAGS_T flags)
|
|
646
654
|
{
|
|
647
655
|
UNITY_UINT32 elements = num_elements;
|
|
648
656
|
UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* ptr_expected = expected;
|
|
649
657
|
UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* ptr_actual = actual;
|
|
650
658
|
|
|
651
|
-
|
|
659
|
+
RETURN_IF_FAIL_OR_IGNORE;
|
|
652
660
|
|
|
653
661
|
if (elements == 0)
|
|
654
662
|
{
|
|
655
663
|
UnityPrintPointlessAndBail();
|
|
656
664
|
}
|
|
657
665
|
|
|
658
|
-
if (
|
|
659
|
-
|
|
666
|
+
if (expected == actual) return; /* Both are NULL or same pointer */
|
|
667
|
+
if (UnityIsOneArrayNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg))
|
|
668
|
+
UNITY_FAIL_AND_BAIL;
|
|
660
669
|
|
|
661
670
|
while (elements--)
|
|
662
671
|
{
|
|
@@ -665,18 +674,14 @@ void UnityAssertEqualFloatArray(UNITY_PTR_ATTRIBUTE const UNITY_FLOAT* expected,
|
|
|
665
674
|
UnityTestResultsFailBegin(lineNumber);
|
|
666
675
|
UnityPrint(UnityStrElement);
|
|
667
676
|
UnityPrintNumberUnsigned(num_elements - elements - 1);
|
|
668
|
-
|
|
669
|
-
UnityPrint(UnityStrExpected);
|
|
670
|
-
UnityPrintFloat(*ptr_expected);
|
|
671
|
-
UnityPrint(UnityStrWas);
|
|
672
|
-
UnityPrintFloat(*ptr_actual);
|
|
673
|
-
#else
|
|
674
|
-
UnityPrint(UnityStrDelta);
|
|
675
|
-
#endif
|
|
677
|
+
UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT((UNITY_DOUBLE)*ptr_expected, (UNITY_DOUBLE)*ptr_actual);
|
|
676
678
|
UnityAddMsgIfSpecified(msg);
|
|
677
679
|
UNITY_FAIL_AND_BAIL;
|
|
678
680
|
}
|
|
679
|
-
|
|
681
|
+
if (flags == UNITY_ARRAY_TO_ARRAY)
|
|
682
|
+
{
|
|
683
|
+
ptr_expected++;
|
|
684
|
+
}
|
|
680
685
|
ptr_actual++;
|
|
681
686
|
}
|
|
682
687
|
}
|
|
@@ -688,20 +693,13 @@ void UnityAssertFloatsWithin(const UNITY_FLOAT delta,
|
|
|
688
693
|
const char* msg,
|
|
689
694
|
const UNITY_LINE_TYPE lineNumber)
|
|
690
695
|
{
|
|
691
|
-
|
|
696
|
+
RETURN_IF_FAIL_OR_IGNORE;
|
|
692
697
|
|
|
693
698
|
|
|
694
699
|
if (!UnityFloatsWithin(delta, expected, actual))
|
|
695
700
|
{
|
|
696
701
|
UnityTestResultsFailBegin(lineNumber);
|
|
697
|
-
|
|
698
|
-
UnityPrint(UnityStrExpected);
|
|
699
|
-
UnityPrintFloat(expected);
|
|
700
|
-
UnityPrint(UnityStrWas);
|
|
701
|
-
UnityPrintFloat(actual);
|
|
702
|
-
#else
|
|
703
|
-
UnityPrint(UnityStrDelta);
|
|
704
|
-
#endif
|
|
702
|
+
UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT((UNITY_DOUBLE)expected, (UNITY_DOUBLE)actual);
|
|
705
703
|
UnityAddMsgIfSpecified(msg);
|
|
706
704
|
UNITY_FAIL_AND_BAIL;
|
|
707
705
|
}
|
|
@@ -713,22 +711,22 @@ void UnityAssertFloatSpecial(const UNITY_FLOAT actual,
|
|
|
713
711
|
const UNITY_LINE_TYPE lineNumber,
|
|
714
712
|
const UNITY_FLOAT_TRAIT_T style)
|
|
715
713
|
{
|
|
716
|
-
const char* trait_names[] = {
|
|
717
|
-
UNITY_INT should_be_trait
|
|
718
|
-
UNITY_INT is_trait
|
|
719
|
-
UNITY_INT trait_index
|
|
714
|
+
const char* trait_names[] = {UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet};
|
|
715
|
+
UNITY_INT should_be_trait = ((UNITY_INT)style & 1);
|
|
716
|
+
UNITY_INT is_trait = !should_be_trait;
|
|
717
|
+
UNITY_INT trait_index = (UNITY_INT)(style >> 1);
|
|
720
718
|
|
|
721
|
-
|
|
719
|
+
RETURN_IF_FAIL_OR_IGNORE;
|
|
722
720
|
|
|
723
|
-
switch(style)
|
|
721
|
+
switch (style)
|
|
724
722
|
{
|
|
725
723
|
case UNITY_FLOAT_IS_INF:
|
|
726
724
|
case UNITY_FLOAT_IS_NOT_INF:
|
|
727
|
-
is_trait = isinf(actual)
|
|
725
|
+
is_trait = isinf(actual) && (actual > 0);
|
|
728
726
|
break;
|
|
729
727
|
case UNITY_FLOAT_IS_NEG_INF:
|
|
730
728
|
case UNITY_FLOAT_IS_NOT_NEG_INF:
|
|
731
|
-
is_trait = isinf(actual)
|
|
729
|
+
is_trait = isinf(actual) && (actual < 0);
|
|
732
730
|
break;
|
|
733
731
|
|
|
734
732
|
case UNITY_FLOAT_IS_NAN:
|
|
@@ -736,13 +734,9 @@ void UnityAssertFloatSpecial(const UNITY_FLOAT actual,
|
|
|
736
734
|
is_trait = isnan(actual) ? 1 : 0;
|
|
737
735
|
break;
|
|
738
736
|
|
|
739
|
-
/* A determinate number is non infinite and not NaN.
|
|
740
|
-
case UNITY_FLOAT_IS_DET:
|
|
737
|
+
case UNITY_FLOAT_IS_DET: /* A determinate number is non infinite and not NaN. */
|
|
741
738
|
case UNITY_FLOAT_IS_NOT_DET:
|
|
742
|
-
|
|
743
|
-
is_trait = 0;
|
|
744
|
-
else
|
|
745
|
-
is_trait = 1;
|
|
739
|
+
is_trait = !isinf(actual) && !isnan(actual);
|
|
746
740
|
break;
|
|
747
741
|
|
|
748
742
|
default:
|
|
@@ -759,8 +753,8 @@ void UnityAssertFloatSpecial(const UNITY_FLOAT actual,
|
|
|
759
753
|
UnityPrint(UnityStrNot);
|
|
760
754
|
UnityPrint(trait_names[trait_index]);
|
|
761
755
|
UnityPrint(UnityStrWas);
|
|
762
|
-
#
|
|
763
|
-
UnityPrintFloat(actual);
|
|
756
|
+
#ifndef UNITY_EXCLUDE_FLOAT_PRINT
|
|
757
|
+
UnityPrintFloat((UNITY_DOUBLE)actual);
|
|
764
758
|
#else
|
|
765
759
|
if (should_be_trait)
|
|
766
760
|
UnityPrint(UnityStrNot);
|
|
@@ -785,21 +779,23 @@ void UnityAssertEqualDoubleArray(UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* expecte
|
|
|
785
779
|
UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* actual,
|
|
786
780
|
const UNITY_UINT32 num_elements,
|
|
787
781
|
const char* msg,
|
|
788
|
-
const UNITY_LINE_TYPE lineNumber
|
|
782
|
+
const UNITY_LINE_TYPE lineNumber,
|
|
783
|
+
const UNITY_FLAGS_T flags)
|
|
789
784
|
{
|
|
790
785
|
UNITY_UINT32 elements = num_elements;
|
|
791
786
|
UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* ptr_expected = expected;
|
|
792
787
|
UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* ptr_actual = actual;
|
|
793
788
|
|
|
794
|
-
|
|
789
|
+
RETURN_IF_FAIL_OR_IGNORE;
|
|
795
790
|
|
|
796
791
|
if (elements == 0)
|
|
797
792
|
{
|
|
798
793
|
UnityPrintPointlessAndBail();
|
|
799
794
|
}
|
|
800
795
|
|
|
801
|
-
if (
|
|
802
|
-
|
|
796
|
+
if (expected == actual) return; /* Both are NULL or same pointer */
|
|
797
|
+
if (UnityIsOneArrayNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg))
|
|
798
|
+
UNITY_FAIL_AND_BAIL;
|
|
803
799
|
|
|
804
800
|
while (elements--)
|
|
805
801
|
{
|
|
@@ -808,18 +804,14 @@ void UnityAssertEqualDoubleArray(UNITY_PTR_ATTRIBUTE const UNITY_DOUBLE* expecte
|
|
|
808
804
|
UnityTestResultsFailBegin(lineNumber);
|
|
809
805
|
UnityPrint(UnityStrElement);
|
|
810
806
|
UnityPrintNumberUnsigned(num_elements - elements - 1);
|
|
811
|
-
|
|
812
|
-
UnityPrint(UnityStrExpected);
|
|
813
|
-
UnityPrintFloat((float)(*ptr_expected));
|
|
814
|
-
UnityPrint(UnityStrWas);
|
|
815
|
-
UnityPrintFloat((float)(*ptr_actual));
|
|
816
|
-
#else
|
|
817
|
-
UnityPrint(UnityStrDelta);
|
|
818
|
-
#endif
|
|
807
|
+
UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT(*ptr_expected, *ptr_actual);
|
|
819
808
|
UnityAddMsgIfSpecified(msg);
|
|
820
809
|
UNITY_FAIL_AND_BAIL;
|
|
821
810
|
}
|
|
822
|
-
|
|
811
|
+
if (flags == UNITY_ARRAY_TO_ARRAY)
|
|
812
|
+
{
|
|
813
|
+
ptr_expected++;
|
|
814
|
+
}
|
|
823
815
|
ptr_actual++;
|
|
824
816
|
}
|
|
825
817
|
}
|
|
@@ -831,19 +823,12 @@ void UnityAssertDoublesWithin(const UNITY_DOUBLE delta,
|
|
|
831
823
|
const char* msg,
|
|
832
824
|
const UNITY_LINE_TYPE lineNumber)
|
|
833
825
|
{
|
|
834
|
-
|
|
826
|
+
RETURN_IF_FAIL_OR_IGNORE;
|
|
835
827
|
|
|
836
828
|
if (!UnityDoublesWithin(delta, expected, actual))
|
|
837
829
|
{
|
|
838
830
|
UnityTestResultsFailBegin(lineNumber);
|
|
839
|
-
|
|
840
|
-
UnityPrint(UnityStrExpected);
|
|
841
|
-
UnityPrintFloat((float)expected);
|
|
842
|
-
UnityPrint(UnityStrWas);
|
|
843
|
-
UnityPrintFloat((float)actual);
|
|
844
|
-
#else
|
|
845
|
-
UnityPrint(UnityStrDelta);
|
|
846
|
-
#endif
|
|
831
|
+
UNITY_PRINT_EXPECTED_AND_ACTUAL_FLOAT(expected, actual);
|
|
847
832
|
UnityAddMsgIfSpecified(msg);
|
|
848
833
|
UNITY_FAIL_AND_BAIL;
|
|
849
834
|
}
|
|
@@ -856,22 +841,22 @@ void UnityAssertDoubleSpecial(const UNITY_DOUBLE actual,
|
|
|
856
841
|
const UNITY_LINE_TYPE lineNumber,
|
|
857
842
|
const UNITY_FLOAT_TRAIT_T style)
|
|
858
843
|
{
|
|
859
|
-
const char* trait_names[] = {
|
|
860
|
-
UNITY_INT should_be_trait
|
|
861
|
-
UNITY_INT is_trait
|
|
862
|
-
UNITY_INT trait_index
|
|
844
|
+
const char* trait_names[] = {UnityStrInf, UnityStrNegInf, UnityStrNaN, UnityStrDet};
|
|
845
|
+
UNITY_INT should_be_trait = ((UNITY_INT)style & 1);
|
|
846
|
+
UNITY_INT is_trait = !should_be_trait;
|
|
847
|
+
UNITY_INT trait_index = (UNITY_INT)(style >> 1);
|
|
863
848
|
|
|
864
|
-
|
|
849
|
+
RETURN_IF_FAIL_OR_IGNORE;
|
|
865
850
|
|
|
866
|
-
|
|
851
|
+
switch (style)
|
|
867
852
|
{
|
|
868
853
|
case UNITY_FLOAT_IS_INF:
|
|
869
854
|
case UNITY_FLOAT_IS_NOT_INF:
|
|
870
|
-
is_trait = isinf(actual)
|
|
855
|
+
is_trait = isinf(actual) && (actual > 0);
|
|
871
856
|
break;
|
|
872
857
|
case UNITY_FLOAT_IS_NEG_INF:
|
|
873
858
|
case UNITY_FLOAT_IS_NOT_NEG_INF:
|
|
874
|
-
is_trait = isinf(actual)
|
|
859
|
+
is_trait = isinf(actual) && (actual < 0);
|
|
875
860
|
break;
|
|
876
861
|
|
|
877
862
|
case UNITY_FLOAT_IS_NAN:
|
|
@@ -879,13 +864,9 @@ void UnityAssertDoubleSpecial(const UNITY_DOUBLE actual,
|
|
|
879
864
|
is_trait = isnan(actual) ? 1 : 0;
|
|
880
865
|
break;
|
|
881
866
|
|
|
882
|
-
/* A determinate number is non infinite and not NaN.
|
|
883
|
-
case UNITY_FLOAT_IS_DET:
|
|
867
|
+
case UNITY_FLOAT_IS_DET: /* A determinate number is non infinite and not NaN. */
|
|
884
868
|
case UNITY_FLOAT_IS_NOT_DET:
|
|
885
|
-
|
|
886
|
-
is_trait = 0;
|
|
887
|
-
else
|
|
888
|
-
is_trait = 1;
|
|
869
|
+
is_trait = !isinf(actual) && !isnan(actual);
|
|
889
870
|
break;
|
|
890
871
|
|
|
891
872
|
default:
|
|
@@ -902,7 +883,7 @@ void UnityAssertDoubleSpecial(const UNITY_DOUBLE actual,
|
|
|
902
883
|
UnityPrint(UnityStrNot);
|
|
903
884
|
UnityPrint(trait_names[trait_index]);
|
|
904
885
|
UnityPrint(UnityStrWas);
|
|
905
|
-
#
|
|
886
|
+
#ifndef UNITY_EXCLUDE_FLOAT_PRINT
|
|
906
887
|
UnityPrintFloat(actual);
|
|
907
888
|
#else
|
|
908
889
|
if (should_be_trait)
|
|
@@ -914,32 +895,31 @@ void UnityAssertDoubleSpecial(const UNITY_DOUBLE actual,
|
|
|
914
895
|
}
|
|
915
896
|
}
|
|
916
897
|
|
|
917
|
-
|
|
918
898
|
#endif /* not UNITY_EXCLUDE_DOUBLE */
|
|
919
899
|
|
|
920
900
|
/*-----------------------------------------------*/
|
|
921
|
-
void UnityAssertNumbersWithin(
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
901
|
+
void UnityAssertNumbersWithin(const UNITY_UINT delta,
|
|
902
|
+
const UNITY_INT expected,
|
|
903
|
+
const UNITY_INT actual,
|
|
904
|
+
const char* msg,
|
|
905
|
+
const UNITY_LINE_TYPE lineNumber,
|
|
906
|
+
const UNITY_DISPLAY_STYLE_T style)
|
|
927
907
|
{
|
|
928
|
-
|
|
908
|
+
RETURN_IF_FAIL_OR_IGNORE;
|
|
929
909
|
|
|
930
910
|
if ((style & UNITY_DISPLAY_RANGE_INT) == UNITY_DISPLAY_RANGE_INT)
|
|
931
911
|
{
|
|
932
912
|
if (actual > expected)
|
|
933
|
-
|
|
913
|
+
Unity.CurrentTestFailed = (UNITY_UINT)((UNITY_UINT)(actual - expected) > delta);
|
|
934
914
|
else
|
|
935
|
-
Unity.CurrentTestFailed = ((UNITY_UINT)(expected - actual) > delta);
|
|
915
|
+
Unity.CurrentTestFailed = (UNITY_UINT)((UNITY_UINT)(expected - actual) > delta);
|
|
936
916
|
}
|
|
937
917
|
else
|
|
938
918
|
{
|
|
939
919
|
if ((UNITY_UINT)actual > (UNITY_UINT)expected)
|
|
940
|
-
Unity.CurrentTestFailed = ((UNITY_UINT)(actual - expected) > delta);
|
|
920
|
+
Unity.CurrentTestFailed = (UNITY_UINT)((UNITY_UINT)(actual - expected) > delta);
|
|
941
921
|
else
|
|
942
|
-
Unity.CurrentTestFailed = ((UNITY_UINT)(expected - actual) > delta);
|
|
922
|
+
Unity.CurrentTestFailed = (UNITY_UINT)((UNITY_UINT)(expected - actual) > delta);
|
|
943
923
|
}
|
|
944
924
|
|
|
945
925
|
if (Unity.CurrentTestFailed)
|
|
@@ -964,7 +944,7 @@ void UnityAssertEqualString(const char* expected,
|
|
|
964
944
|
{
|
|
965
945
|
UNITY_UINT32 i;
|
|
966
946
|
|
|
967
|
-
|
|
947
|
+
RETURN_IF_FAIL_OR_IGNORE;
|
|
968
948
|
|
|
969
949
|
/* if both pointers not null compare the strings */
|
|
970
950
|
if (expected && actual)
|
|
@@ -988,23 +968,23 @@ void UnityAssertEqualString(const char* expected,
|
|
|
988
968
|
|
|
989
969
|
if (Unity.CurrentTestFailed)
|
|
990
970
|
{
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
971
|
+
UnityTestResultsFailBegin(lineNumber);
|
|
972
|
+
UnityPrintExpectedAndActualStrings(expected, actual);
|
|
973
|
+
UnityAddMsgIfSpecified(msg);
|
|
974
|
+
UNITY_FAIL_AND_BAIL;
|
|
995
975
|
}
|
|
996
976
|
}
|
|
997
977
|
|
|
998
978
|
/*-----------------------------------------------*/
|
|
999
979
|
void UnityAssertEqualStringLen(const char* expected,
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
980
|
+
const char* actual,
|
|
981
|
+
const UNITY_UINT32 length,
|
|
982
|
+
const char* msg,
|
|
983
|
+
const UNITY_LINE_TYPE lineNumber)
|
|
1004
984
|
{
|
|
1005
985
|
UNITY_UINT32 i;
|
|
1006
986
|
|
|
1007
|
-
|
|
987
|
+
RETURN_IF_FAIL_OR_IGNORE;
|
|
1008
988
|
|
|
1009
989
|
/* if both pointers not null compare the strings */
|
|
1010
990
|
if (expected && actual)
|
|
@@ -1028,24 +1008,27 @@ void UnityAssertEqualStringLen(const char* expected,
|
|
|
1028
1008
|
|
|
1029
1009
|
if (Unity.CurrentTestFailed)
|
|
1030
1010
|
{
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1011
|
+
UnityTestResultsFailBegin(lineNumber);
|
|
1012
|
+
UnityPrintExpectedAndActualStringsLen(expected, actual, length);
|
|
1013
|
+
UnityAddMsgIfSpecified(msg);
|
|
1014
|
+
UNITY_FAIL_AND_BAIL;
|
|
1035
1015
|
}
|
|
1036
1016
|
}
|
|
1037
1017
|
|
|
1038
|
-
|
|
1039
1018
|
/*-----------------------------------------------*/
|
|
1040
|
-
void UnityAssertEqualStringArray(
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1019
|
+
void UnityAssertEqualStringArray(UNITY_INTERNAL_PTR expected,
|
|
1020
|
+
const char** actual,
|
|
1021
|
+
const UNITY_UINT32 num_elements,
|
|
1022
|
+
const char* msg,
|
|
1023
|
+
const UNITY_LINE_TYPE lineNumber,
|
|
1024
|
+
const UNITY_FLAGS_T flags)
|
|
1045
1025
|
{
|
|
1046
|
-
UNITY_UINT32 i
|
|
1026
|
+
UNITY_UINT32 i = 0;
|
|
1027
|
+
UNITY_UINT32 j = 0;
|
|
1028
|
+
const char* exp = NULL;
|
|
1029
|
+
const char* act = NULL;
|
|
1047
1030
|
|
|
1048
|
-
|
|
1031
|
+
RETURN_IF_FAIL_OR_IGNORE;
|
|
1049
1032
|
|
|
1050
1033
|
/* if no elements, it's an error */
|
|
1051
1034
|
if (num_elements == 0)
|
|
@@ -1053,17 +1036,35 @@ void UnityAssertEqualStringArray( const char** expected,
|
|
|
1053
1036
|
UnityPrintPointlessAndBail();
|
|
1054
1037
|
}
|
|
1055
1038
|
|
|
1056
|
-
if (
|
|
1057
|
-
|
|
1039
|
+
if ((const void*)expected == (const void*)actual)
|
|
1040
|
+
{
|
|
1041
|
+
return; /* Both are NULL or same pointer */
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
if (UnityIsOneArrayNull((UNITY_INTERNAL_PTR)expected, (UNITY_INTERNAL_PTR)actual, lineNumber, msg))
|
|
1045
|
+
{
|
|
1046
|
+
UNITY_FAIL_AND_BAIL;
|
|
1047
|
+
}
|
|
1048
|
+
|
|
1049
|
+
if (flags != UNITY_ARRAY_TO_ARRAY)
|
|
1050
|
+
{
|
|
1051
|
+
exp = (const char*)expected;
|
|
1052
|
+
}
|
|
1058
1053
|
|
|
1059
1054
|
do
|
|
1060
1055
|
{
|
|
1056
|
+
act = actual[j];
|
|
1057
|
+
if (flags == UNITY_ARRAY_TO_ARRAY)
|
|
1058
|
+
{
|
|
1059
|
+
exp = ((const char* const*)expected)[j];
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1061
1062
|
/* if both pointers not null compare the strings */
|
|
1062
|
-
if (
|
|
1063
|
+
if (exp && act)
|
|
1063
1064
|
{
|
|
1064
|
-
for (i = 0;
|
|
1065
|
+
for (i = 0; exp[i] || act[i]; i++)
|
|
1065
1066
|
{
|
|
1066
|
-
if (
|
|
1067
|
+
if (exp[i] != act[i])
|
|
1067
1068
|
{
|
|
1068
1069
|
Unity.CurrentTestFailed = 1;
|
|
1069
1070
|
break;
|
|
@@ -1072,7 +1073,7 @@ void UnityAssertEqualStringArray( const char** expected,
|
|
|
1072
1073
|
}
|
|
1073
1074
|
else
|
|
1074
1075
|
{ /* handle case of one pointers being null (if both null, test should pass) */
|
|
1075
|
-
if (
|
|
1076
|
+
if (exp != act)
|
|
1076
1077
|
{
|
|
1077
1078
|
Unity.CurrentTestFailed = 1;
|
|
1078
1079
|
}
|
|
@@ -1086,7 +1087,7 @@ void UnityAssertEqualStringArray( const char** expected,
|
|
|
1086
1087
|
UnityPrint(UnityStrElement);
|
|
1087
1088
|
UnityPrintNumberUnsigned(j);
|
|
1088
1089
|
}
|
|
1089
|
-
UnityPrintExpectedAndActualStrings(
|
|
1090
|
+
UnityPrintExpectedAndActualStrings(exp, act);
|
|
1090
1091
|
UnityAddMsgIfSpecified(msg);
|
|
1091
1092
|
UNITY_FAIL_AND_BAIL;
|
|
1092
1093
|
}
|
|
@@ -1094,27 +1095,29 @@ void UnityAssertEqualStringArray( const char** expected,
|
|
|
1094
1095
|
}
|
|
1095
1096
|
|
|
1096
1097
|
/*-----------------------------------------------*/
|
|
1097
|
-
void UnityAssertEqualMemory(
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1098
|
+
void UnityAssertEqualMemory(UNITY_INTERNAL_PTR expected,
|
|
1099
|
+
UNITY_INTERNAL_PTR actual,
|
|
1100
|
+
const UNITY_UINT32 length,
|
|
1101
|
+
const UNITY_UINT32 num_elements,
|
|
1102
|
+
const char* msg,
|
|
1103
|
+
const UNITY_LINE_TYPE lineNumber,
|
|
1104
|
+
const UNITY_FLAGS_T flags)
|
|
1103
1105
|
{
|
|
1104
1106
|
UNITY_PTR_ATTRIBUTE const unsigned char* ptr_exp = (UNITY_PTR_ATTRIBUTE const unsigned char*)expected;
|
|
1105
1107
|
UNITY_PTR_ATTRIBUTE const unsigned char* ptr_act = (UNITY_PTR_ATTRIBUTE const unsigned char*)actual;
|
|
1106
1108
|
UNITY_UINT32 elements = num_elements;
|
|
1107
1109
|
UNITY_UINT32 bytes;
|
|
1108
1110
|
|
|
1109
|
-
|
|
1111
|
+
RETURN_IF_FAIL_OR_IGNORE;
|
|
1110
1112
|
|
|
1111
1113
|
if ((elements == 0) || (length == 0))
|
|
1112
1114
|
{
|
|
1113
1115
|
UnityPrintPointlessAndBail();
|
|
1114
1116
|
}
|
|
1115
1117
|
|
|
1116
|
-
if (
|
|
1117
|
-
|
|
1118
|
+
if (expected == actual) return; /* Both are NULL or same pointer */
|
|
1119
|
+
if (UnityIsOneArrayNull(expected, actual, lineNumber, msg))
|
|
1120
|
+
UNITY_FAIL_AND_BAIL;
|
|
1118
1121
|
|
|
1119
1122
|
while (elements--)
|
|
1120
1123
|
{
|
|
@@ -1139,22 +1142,83 @@ void UnityAssertEqualMemory( UNITY_INTERNAL_PTR expected,
|
|
|
1139
1142
|
UnityAddMsgIfSpecified(msg);
|
|
1140
1143
|
UNITY_FAIL_AND_BAIL;
|
|
1141
1144
|
}
|
|
1142
|
-
ptr_exp
|
|
1143
|
-
ptr_act
|
|
1145
|
+
ptr_exp++;
|
|
1146
|
+
ptr_act++;
|
|
1147
|
+
}
|
|
1148
|
+
if (flags == UNITY_ARRAY_TO_VAL)
|
|
1149
|
+
{
|
|
1150
|
+
ptr_exp = (UNITY_PTR_ATTRIBUTE const unsigned char*)expected;
|
|
1144
1151
|
}
|
|
1145
1152
|
}
|
|
1146
1153
|
}
|
|
1147
1154
|
|
|
1155
|
+
/*-----------------------------------------------*/
|
|
1156
|
+
|
|
1157
|
+
static union
|
|
1158
|
+
{
|
|
1159
|
+
UNITY_INT8 i8;
|
|
1160
|
+
UNITY_INT16 i16;
|
|
1161
|
+
UNITY_INT32 i32;
|
|
1162
|
+
#ifdef UNITY_SUPPORT_64
|
|
1163
|
+
UNITY_INT64 i64;
|
|
1164
|
+
#endif
|
|
1165
|
+
#ifndef UNITY_EXCLUDE_FLOAT
|
|
1166
|
+
float f;
|
|
1167
|
+
#endif
|
|
1168
|
+
#ifndef UNITY_EXCLUDE_DOUBLE
|
|
1169
|
+
double d;
|
|
1170
|
+
#endif
|
|
1171
|
+
} UnityQuickCompare;
|
|
1172
|
+
|
|
1173
|
+
UNITY_INTERNAL_PTR UnityNumToPtr(const UNITY_INT num, const UNITY_UINT8 size)
|
|
1174
|
+
{
|
|
1175
|
+
switch(size)
|
|
1176
|
+
{
|
|
1177
|
+
case 1:
|
|
1178
|
+
UnityQuickCompare.i8 = (UNITY_INT8)num;
|
|
1179
|
+
return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.i8);
|
|
1180
|
+
|
|
1181
|
+
case 2:
|
|
1182
|
+
UnityQuickCompare.i16 = (UNITY_INT16)num;
|
|
1183
|
+
return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.i16);
|
|
1184
|
+
|
|
1185
|
+
#ifdef UNITY_SUPPORT_64
|
|
1186
|
+
case 8:
|
|
1187
|
+
UnityQuickCompare.i64 = (UNITY_INT64)num;
|
|
1188
|
+
return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.i64);
|
|
1189
|
+
#endif
|
|
1190
|
+
default: /* 4 bytes */
|
|
1191
|
+
UnityQuickCompare.i32 = (UNITY_INT32)num;
|
|
1192
|
+
return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.i32);
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1196
|
+
#ifndef UNITY_EXCLUDE_FLOAT
|
|
1197
|
+
UNITY_INTERNAL_PTR UnityFloatToPtr(const float num)
|
|
1198
|
+
{
|
|
1199
|
+
UnityQuickCompare.f = num;
|
|
1200
|
+
return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.f);
|
|
1201
|
+
}
|
|
1202
|
+
#endif
|
|
1203
|
+
|
|
1204
|
+
#ifndef UNITY_EXCLUDE_DOUBLE
|
|
1205
|
+
UNITY_INTERNAL_PTR UnityDoubleToPtr(const double num)
|
|
1206
|
+
{
|
|
1207
|
+
UnityQuickCompare.d = num;
|
|
1208
|
+
return (UNITY_INTERNAL_PTR)(&UnityQuickCompare.d);
|
|
1209
|
+
}
|
|
1210
|
+
#endif
|
|
1211
|
+
|
|
1148
1212
|
/*-----------------------------------------------
|
|
1149
1213
|
* Control Functions
|
|
1150
1214
|
*-----------------------------------------------*/
|
|
1151
1215
|
|
|
1152
1216
|
void UnityFail(const char* msg, const UNITY_LINE_TYPE line)
|
|
1153
1217
|
{
|
|
1154
|
-
|
|
1218
|
+
RETURN_IF_FAIL_OR_IGNORE;
|
|
1155
1219
|
|
|
1156
1220
|
UnityTestResultsBegin(Unity.TestFile, line);
|
|
1157
|
-
|
|
1221
|
+
UnityPrint(UnityStrFail);
|
|
1158
1222
|
if (msg != NULL)
|
|
1159
1223
|
{
|
|
1160
1224
|
UNITY_OUTPUT_CHAR(':');
|
|
@@ -1185,29 +1249,30 @@ void UnityFail(const char* msg, const UNITY_LINE_TYPE line)
|
|
|
1185
1249
|
/*-----------------------------------------------*/
|
|
1186
1250
|
void UnityIgnore(const char* msg, const UNITY_LINE_TYPE line)
|
|
1187
1251
|
{
|
|
1188
|
-
|
|
1252
|
+
RETURN_IF_FAIL_OR_IGNORE;
|
|
1189
1253
|
|
|
1190
1254
|
UnityTestResultsBegin(Unity.TestFile, line);
|
|
1191
1255
|
UnityPrint(UnityStrIgnore);
|
|
1192
1256
|
if (msg != NULL)
|
|
1193
1257
|
{
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1258
|
+
UNITY_OUTPUT_CHAR(':');
|
|
1259
|
+
UNITY_OUTPUT_CHAR(' ');
|
|
1260
|
+
UnityPrint(msg);
|
|
1197
1261
|
}
|
|
1198
1262
|
UNITY_IGNORE_AND_BAIL;
|
|
1199
1263
|
}
|
|
1200
1264
|
|
|
1201
1265
|
/*-----------------------------------------------*/
|
|
1202
1266
|
#if defined(UNITY_WEAK_ATTRIBUTE)
|
|
1203
|
-
|
|
1204
|
-
|
|
1267
|
+
UNITY_WEAK_ATTRIBUTE void setUp(void) { }
|
|
1268
|
+
UNITY_WEAK_ATTRIBUTE void tearDown(void) { }
|
|
1205
1269
|
#elif defined(UNITY_WEAK_PRAGMA)
|
|
1206
|
-
#
|
|
1207
|
-
|
|
1208
|
-
#
|
|
1209
|
-
|
|
1270
|
+
#pragma weak setUp
|
|
1271
|
+
void setUp(void) { }
|
|
1272
|
+
#pragma weak tearDown
|
|
1273
|
+
void tearDown(void) { }
|
|
1210
1274
|
#endif
|
|
1275
|
+
|
|
1211
1276
|
/*-----------------------------------------------*/
|
|
1212
1277
|
void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int FuncLineNum)
|
|
1213
1278
|
{
|
|
@@ -1220,7 +1285,7 @@ void UnityDefaultTestRun(UnityTestFunction Func, const char* FuncName, const int
|
|
|
1220
1285
|
setUp();
|
|
1221
1286
|
Func();
|
|
1222
1287
|
}
|
|
1223
|
-
if (TEST_PROTECT()
|
|
1288
|
+
if (TEST_PROTECT())
|
|
1224
1289
|
{
|
|
1225
1290
|
tearDown();
|
|
1226
1291
|
}
|
|
@@ -1258,11 +1323,11 @@ int UnityEnd(void)
|
|
|
1258
1323
|
UNITY_PRINT_EOL();
|
|
1259
1324
|
if (Unity.TestFailures == 0U)
|
|
1260
1325
|
{
|
|
1261
|
-
|
|
1326
|
+
UnityPrint(UnityStrOk);
|
|
1262
1327
|
}
|
|
1263
1328
|
else
|
|
1264
1329
|
{
|
|
1265
|
-
|
|
1330
|
+
UnityPrint(UnityStrFail);
|
|
1266
1331
|
#ifdef UNITY_DIFFERENTIATE_FINAL_FAIL
|
|
1267
1332
|
UNITY_OUTPUT_CHAR('E'); UNITY_OUTPUT_CHAR('D');
|
|
1268
1333
|
#endif
|
|
@@ -1280,7 +1345,7 @@ int UnityEnd(void)
|
|
|
1280
1345
|
|
|
1281
1346
|
char* UnityOptionIncludeNamed = NULL;
|
|
1282
1347
|
char* UnityOptionExcludeNamed = NULL;
|
|
1283
|
-
int
|
|
1348
|
+
int UnityVerbosity = 1;
|
|
1284
1349
|
|
|
1285
1350
|
int UnityParseOptions(int argc, char** argv)
|
|
1286
1351
|
{
|
|
@@ -1291,7 +1356,7 @@ int UnityParseOptions(int argc, char** argv)
|
|
|
1291
1356
|
{
|
|
1292
1357
|
if (argv[i][0] == '-')
|
|
1293
1358
|
{
|
|
1294
|
-
switch(argv[i][1])
|
|
1359
|
+
switch (argv[i][1])
|
|
1295
1360
|
{
|
|
1296
1361
|
case 'l': /* list tests */
|
|
1297
1362
|
return -1;
|
|
@@ -1340,9 +1405,9 @@ int UnityParseOptions(int argc, char** argv)
|
|
|
1340
1405
|
|
|
1341
1406
|
int IsStringInBiggerString(const char* longstring, const char* shortstring)
|
|
1342
1407
|
{
|
|
1343
|
-
char* lptr =
|
|
1344
|
-
char* sptr =
|
|
1345
|
-
char* lnext = lptr;
|
|
1408
|
+
const char* lptr = longstring;
|
|
1409
|
+
const char* sptr = shortstring;
|
|
1410
|
+
const char* lnext = lptr;
|
|
1346
1411
|
|
|
1347
1412
|
if (*sptr == '*')
|
|
1348
1413
|
return 1;
|
|
@@ -1374,7 +1439,7 @@ int IsStringInBiggerString(const char* longstring, const char* shortstring)
|
|
|
1374
1439
|
|
|
1375
1440
|
/* Otherwise we start in the long pointer 1 character further and try again */
|
|
1376
1441
|
lptr = lnext;
|
|
1377
|
-
sptr =
|
|
1442
|
+
sptr = shortstring;
|
|
1378
1443
|
}
|
|
1379
1444
|
return 0;
|
|
1380
1445
|
}
|
|
@@ -1396,7 +1461,8 @@ int UnityStringArgumentMatches(const char* str)
|
|
|
1396
1461
|
/* look for the start of the next partial */
|
|
1397
1462
|
ptr2 = ptr1;
|
|
1398
1463
|
ptrf = 0;
|
|
1399
|
-
do
|
|
1464
|
+
do
|
|
1465
|
+
{
|
|
1400
1466
|
ptr2++;
|
|
1401
1467
|
if ((ptr2[0] == ':') && (ptr2[1] != 0) && (ptr2[0] != '\'') && (ptr2[0] != '"') && (ptr2[0] != ','))
|
|
1402
1468
|
ptrf = &ptr2[1];
|