From 03bfdbbcdf950eeb2adbddc875bbcb0fb7f20529 Mon Sep 17 00:00:00 2001 From: wenjun Date: Wed, 9 Sep 2020 09:26:41 +0800 Subject: [PATCH] add OpenHarmony 1.0 baseline --- .editorconfig | 0 .gitattributes | 0 .github/CONTRIBUTING.md | 0 .gitignore | 0 .travis.yml | 0 BUILD.gn | 59 +- CHANGELOG.md | 0 CMakeLists.txt | 0 CONTRIBUTORS.md | 0 COPYRIGHT.OpenSource | 7 - LICENSE | 0 Makefile | 0 NOTICE | 1 - README.OpenSource | 12 - README.md | 0 appveyor.yml | 0 cJSON.c | 0 cJSON.h | 0 cJSON_Utils.c | 0 cJSON_Utils.h | 0 fuzzing/.gitignore | 0 fuzzing/CMakeLists.txt | 0 fuzzing/afl.c | 0 fuzzing/cjson_read_fuzzer.c | 0 fuzzing/fuzz_main.c | 0 fuzzing/inputs/test1 | 0 fuzzing/inputs/test10 | 0 fuzzing/inputs/test11 | 0 fuzzing/inputs/test2 | 0 fuzzing/inputs/test3 | 0 fuzzing/inputs/test3.bu | 0 fuzzing/inputs/test3.uf | 0 fuzzing/inputs/test3.uu | 0 fuzzing/inputs/test4 | 0 fuzzing/inputs/test5 | 0 fuzzing/inputs/test6 | 0 fuzzing/inputs/test7 | 0 fuzzing/inputs/test8 | 0 fuzzing/inputs/test9 | 0 fuzzing/json.dict | 0 library_config/cJSONConfig.cmake.in | 0 library_config/cJSONConfigVersion.cmake.in | 0 library_config/libcjson.pc.in | 0 library_config/libcjson_utils.pc.in | 0 library_config/uninstall.cmake | 0 test.c | 0 tests/CMakeLists.txt | 0 tests/cjson_add.c | 0 tests/common.h | 0 tests/compare_tests.c | 0 tests/inputs/test1 | 0 tests/inputs/test1.expected | 0 tests/inputs/test10 | 0 tests/inputs/test10.expected | 0 tests/inputs/test11 | 0 tests/inputs/test11.expected | 0 tests/inputs/test2 | 0 tests/inputs/test2.expected | 0 tests/inputs/test3 | 0 tests/inputs/test3.expected | 0 tests/inputs/test4 | 0 tests/inputs/test4.expected | 0 tests/inputs/test5 | 0 tests/inputs/test5.expected | 0 tests/inputs/test6 | 0 tests/inputs/test7 | 0 tests/inputs/test7.expected | 0 tests/inputs/test8 | 0 tests/inputs/test8.expected | 0 tests/inputs/test9 | 0 tests/inputs/test9.expected | 0 tests/json-patch-tests/.editorconfig | 0 tests/json-patch-tests/.gitignore | 0 tests/json-patch-tests/.npmignore | 0 tests/json-patch-tests/README.md | 0 tests/json-patch-tests/cjson-utils-tests.json | 0 tests/json-patch-tests/package.json | 0 tests/json-patch-tests/spec_tests.json | 0 tests/json-patch-tests/tests.json | 0 tests/json_patch_tests.c | 0 tests/minify_tests.c | 0 tests/misc_tests.c | 0 tests/misc_utils_tests.c | 0 tests/old_utils_tests.c | 0 tests/parse_array.c | 0 tests/parse_examples.c | 0 tests/parse_hex4.c | 0 tests/parse_number.c | 0 tests/parse_object.c | 0 tests/parse_string.c | 0 tests/parse_value.c | 0 tests/parse_with_opts.c | 0 tests/print_array.c | 0 tests/print_number.c | 0 tests/print_object.c | 0 tests/print_string.c | 0 tests/print_value.c | 0 tests/readme_examples.c | 0 tests/unity/.gitattributes | 0 tests/unity/.gitignore | 0 tests/unity/.travis.yml | 0 tests/unity/README.md | 0 tests/unity/auto/colour_prompt.rb | 0 tests/unity/auto/colour_reporter.rb | 0 tests/unity/auto/generate_config.yml | 0 tests/unity/auto/generate_module.rb | 0 tests/unity/auto/generate_test_runner.rb | 0 tests/unity/auto/parse_output.rb | 0 tests/unity/auto/test_file_filter.rb | 0 tests/unity/auto/type_sanitizer.rb | 0 tests/unity/auto/unity_test_summary.py | 0 tests/unity/auto/unity_test_summary.rb | 0 tests/unity/auto/unity_to_junit.py | 0 .../docs/ThrowTheSwitchCodingStandard.md | 0 ...tSuitableforPrintingandPossiblyFraming.pdf | Bin tests/unity/docs/UnityAssertionsReference.md | 0 tests/unity/docs/UnityConfigurationGuide.md | 0 tests/unity/docs/UnityGettingStartedGuide.md | 0 tests/unity/docs/UnityHelperScriptsGuide.md | 0 tests/unity/docs/license.txt | 0 tests/unity/examples/example_1/makefile | 0 tests/unity/examples/example_1/readme.txt | 0 .../examples/example_1/src/ProductionCode.c | 0 .../examples/example_1/src/ProductionCode.h | 0 .../examples/example_1/src/ProductionCode2.c | 0 .../examples/example_1/src/ProductionCode2.h | 0 .../example_1/test/TestProductionCode.c | 62 - .../example_1/test/TestProductionCode2.c | 31 - .../test_runners/TestProductionCode2_Runner.c | 53 - .../test_runners/TestProductionCode_Runner.c | 57 - tests/unity/examples/example_2/makefile | 0 tests/unity/examples/example_2/readme.txt | 0 .../examples/example_2/src/ProductionCode.c | 0 .../examples/example_2/src/ProductionCode.h | 0 .../examples/example_2/src/ProductionCode2.c | 0 .../examples/example_2/src/ProductionCode2.h | 0 .../example_2/test/TestProductionCode.c | 64 - .../example_2/test/TestProductionCode2.c | 33 - .../test_runners/TestProductionCode2_Runner.c | 9 - .../test_runners/TestProductionCode_Runner.c | 11 - .../example_2/test/test_runners/all_tests.c | 12 - .../examples/example_3/helper/UnityHelper.c | 0 .../examples/example_3/helper/UnityHelper.h | 0 tests/unity/examples/example_3/rakefile.rb | 0 .../examples/example_3/rakefile_helper.rb | 0 tests/unity/examples/example_3/readme.txt | 0 .../examples/example_3/src/ProductionCode.c | 0 .../examples/example_3/src/ProductionCode.h | 0 .../examples/example_3/src/ProductionCode2.c | 0 .../examples/example_3/src/ProductionCode2.h | 0 .../examples/example_3/target_gcc_32.yml | 0 .../example_3/test/TestProductionCode.c | 62 - .../example_3/test/TestProductionCode2.c | 31 - tests/unity/examples/unity_config.h | 0 tests/unity/extras/eclipse/error_parsers.txt | 0 tests/unity/extras/fixture/rakefile.rb | 0 tests/unity/extras/fixture/rakefile_helper.rb | 0 tests/unity/extras/fixture/readme.txt | 0 .../unity/extras/fixture/src/unity_fixture.c | 0 .../unity/extras/fixture/src/unity_fixture.h | 0 .../fixture/src/unity_fixture_internals.h | 0 .../src/unity_fixture_malloc_overrides.h | 0 tests/unity/extras/fixture/test/Makefile | 75 - .../unity/extras/fixture/test/main/AllTests.c | 22 - .../fixture/test/template_fixture_tests.c | 39 - .../extras/fixture/test/unity_fixture_Test.c | 543 -- .../fixture/test/unity_fixture_TestRunner.c | 57 - .../extras/fixture/test/unity_output_Spy.c | 57 - .../extras/fixture/test/unity_output_Spy.h | 17 - tests/unity/release/build.info | 0 tests/unity/release/version.info | 0 tests/unity/src/unity.c | 0 tests/unity/src/unity.h | 0 tests/unity/test/.rubocop.yml | 58 - tests/unity/test/Makefile | 66 - tests/unity/test/expectdata/testsample_cmd.c | 61 - tests/unity/test/expectdata/testsample_def.c | 57 - .../unity/test/expectdata/testsample_head1.c | 55 - .../unity/test/expectdata/testsample_head1.h | 15 - .../test/expectdata/testsample_mock_cmd.c | 80 - .../test/expectdata/testsample_mock_def.c | 76 - .../test/expectdata/testsample_mock_head1.c | 75 - .../test/expectdata/testsample_mock_head1.h | 13 - .../test/expectdata/testsample_mock_new1.c | 89 - .../test/expectdata/testsample_mock_new2.c | 89 - .../test/expectdata/testsample_mock_param.c | 77 - .../test/expectdata/testsample_mock_run1.c | 89 - .../test/expectdata/testsample_mock_run2.c | 89 - .../test/expectdata/testsample_mock_yaml.c | 90 - tests/unity/test/expectdata/testsample_new1.c | 67 - tests/unity/test/expectdata/testsample_new2.c | 70 - .../unity/test/expectdata/testsample_param.c | 58 - tests/unity/test/expectdata/testsample_run1.c | 67 - tests/unity/test/expectdata/testsample_run2.c | 70 - tests/unity/test/expectdata/testsample_yaml.c | 71 - tests/unity/test/rakefile | 125 - tests/unity/test/rakefile_helper.rb | 260 - .../generate_module_existing_file_spec.rb | 158 - tests/unity/test/targets/clang_file.yml | 78 - tests/unity/test/targets/clang_strict.yml | 78 - tests/unity/test/targets/gcc_32.yml | 49 - tests/unity/test/targets/gcc_64.yml | 50 - tests/unity/test/targets/gcc_auto_limits.yml | 47 - tests/unity/test/targets/gcc_auto_stdint.yml | 59 - tests/unity/test/targets/gcc_manual_math.yml | 47 - tests/unity/test/targets/hitech_picc18.yml | 101 - tests/unity/test/targets/iar_arm_v4.yml | 90 - tests/unity/test/targets/iar_arm_v5.yml | 80 - tests/unity/test/targets/iar_arm_v5_3.yml | 80 - .../targets/iar_armcortex_LM3S9B92_v5_4.yml | 94 - tests/unity/test/targets/iar_cortexm3_v5.yml | 84 - tests/unity/test/targets/iar_msp430.yml | 95 - tests/unity/test/targets/iar_sh2a_v6.yml | 86 - tests/unity/test/testdata/CException.h | 11 - tests/unity/test/testdata/Defs.h | 8 - tests/unity/test/testdata/cmock.h | 14 - tests/unity/test/testdata/mockMock.h | 13 - .../unity/test/testdata/testRunnerGenerator.c | 183 - .../test/testdata/testRunnerGeneratorSmall.c | 67 - .../testdata/testRunnerGeneratorWithMocks.c | 192 - .../test/tests/test_generate_test_runner.rb | 1252 ---- tests/unity/test/tests/testparameterized.c | 110 - tests/unity/test/tests/testunity.c | 5337 ----------------- tests/unity_setup.c | 0 valgrind.supp | 0 225 files changed, 43 insertions(+), 11601 deletions(-) mode change 100644 => 100755 .editorconfig mode change 100644 => 100755 .gitattributes mode change 100644 => 100755 .github/CONTRIBUTING.md mode change 100644 => 100755 .gitignore mode change 100644 => 100755 .travis.yml mode change 100644 => 100755 BUILD.gn mode change 100644 => 100755 CHANGELOG.md mode change 100644 => 100755 CMakeLists.txt mode change 100644 => 100755 CONTRIBUTORS.md delete mode 100755 COPYRIGHT.OpenSource mode change 100644 => 100755 LICENSE mode change 100644 => 100755 Makefile delete mode 120000 NOTICE delete mode 100644 README.OpenSource mode change 100644 => 100755 README.md mode change 100644 => 100755 appveyor.yml mode change 100644 => 100755 cJSON.c mode change 100644 => 100755 cJSON.h mode change 100644 => 100755 cJSON_Utils.c mode change 100644 => 100755 cJSON_Utils.h mode change 100644 => 100755 fuzzing/.gitignore mode change 100644 => 100755 fuzzing/CMakeLists.txt mode change 100644 => 100755 fuzzing/afl.c mode change 100644 => 100755 fuzzing/cjson_read_fuzzer.c mode change 100644 => 100755 fuzzing/fuzz_main.c mode change 100644 => 100755 fuzzing/inputs/test1 mode change 100644 => 100755 fuzzing/inputs/test10 mode change 100644 => 100755 fuzzing/inputs/test11 mode change 100644 => 100755 fuzzing/inputs/test2 mode change 100644 => 100755 fuzzing/inputs/test3 mode change 100644 => 100755 fuzzing/inputs/test3.bu mode change 100644 => 100755 fuzzing/inputs/test3.uf mode change 100644 => 100755 fuzzing/inputs/test3.uu mode change 100644 => 100755 fuzzing/inputs/test4 mode change 100644 => 100755 fuzzing/inputs/test5 mode change 100644 => 100755 fuzzing/inputs/test6 mode change 100644 => 100755 fuzzing/inputs/test7 mode change 100644 => 100755 fuzzing/inputs/test8 mode change 100644 => 100755 fuzzing/inputs/test9 mode change 100644 => 100755 fuzzing/json.dict mode change 100644 => 100755 library_config/cJSONConfig.cmake.in mode change 100644 => 100755 library_config/cJSONConfigVersion.cmake.in mode change 100644 => 100755 library_config/libcjson.pc.in mode change 100644 => 100755 library_config/libcjson_utils.pc.in mode change 100644 => 100755 library_config/uninstall.cmake mode change 100644 => 100755 test.c mode change 100644 => 100755 tests/CMakeLists.txt mode change 100644 => 100755 tests/cjson_add.c mode change 100644 => 100755 tests/common.h mode change 100644 => 100755 tests/compare_tests.c mode change 100644 => 100755 tests/inputs/test1 mode change 100644 => 100755 tests/inputs/test1.expected mode change 100644 => 100755 tests/inputs/test10 mode change 100644 => 100755 tests/inputs/test10.expected mode change 100644 => 100755 tests/inputs/test11 mode change 100644 => 100755 tests/inputs/test11.expected mode change 100644 => 100755 tests/inputs/test2 mode change 100644 => 100755 tests/inputs/test2.expected mode change 100644 => 100755 tests/inputs/test3 mode change 100644 => 100755 tests/inputs/test3.expected mode change 100644 => 100755 tests/inputs/test4 mode change 100644 => 100755 tests/inputs/test4.expected mode change 100644 => 100755 tests/inputs/test5 mode change 100644 => 100755 tests/inputs/test5.expected mode change 100644 => 100755 tests/inputs/test6 mode change 100644 => 100755 tests/inputs/test7 mode change 100644 => 100755 tests/inputs/test7.expected mode change 100644 => 100755 tests/inputs/test8 mode change 100644 => 100755 tests/inputs/test8.expected mode change 100644 => 100755 tests/inputs/test9 mode change 100644 => 100755 tests/inputs/test9.expected mode change 100644 => 100755 tests/json-patch-tests/.editorconfig mode change 100644 => 100755 tests/json-patch-tests/.gitignore mode change 100644 => 100755 tests/json-patch-tests/.npmignore mode change 100644 => 100755 tests/json-patch-tests/README.md mode change 100644 => 100755 tests/json-patch-tests/cjson-utils-tests.json mode change 100644 => 100755 tests/json-patch-tests/package.json mode change 100644 => 100755 tests/json-patch-tests/spec_tests.json mode change 100644 => 100755 tests/json-patch-tests/tests.json mode change 100644 => 100755 tests/json_patch_tests.c mode change 100644 => 100755 tests/minify_tests.c mode change 100644 => 100755 tests/misc_tests.c mode change 100644 => 100755 tests/misc_utils_tests.c mode change 100644 => 100755 tests/old_utils_tests.c mode change 100644 => 100755 tests/parse_array.c mode change 100644 => 100755 tests/parse_examples.c mode change 100644 => 100755 tests/parse_hex4.c mode change 100644 => 100755 tests/parse_number.c mode change 100644 => 100755 tests/parse_object.c mode change 100644 => 100755 tests/parse_string.c mode change 100644 => 100755 tests/parse_value.c mode change 100644 => 100755 tests/parse_with_opts.c mode change 100644 => 100755 tests/print_array.c mode change 100644 => 100755 tests/print_number.c mode change 100644 => 100755 tests/print_object.c mode change 100644 => 100755 tests/print_string.c mode change 100644 => 100755 tests/print_value.c mode change 100644 => 100755 tests/readme_examples.c mode change 100644 => 100755 tests/unity/.gitattributes mode change 100644 => 100755 tests/unity/.gitignore mode change 100644 => 100755 tests/unity/.travis.yml mode change 100644 => 100755 tests/unity/README.md mode change 100644 => 100755 tests/unity/auto/colour_prompt.rb mode change 100644 => 100755 tests/unity/auto/colour_reporter.rb mode change 100644 => 100755 tests/unity/auto/generate_config.yml mode change 100644 => 100755 tests/unity/auto/generate_module.rb mode change 100644 => 100755 tests/unity/auto/generate_test_runner.rb mode change 100644 => 100755 tests/unity/auto/parse_output.rb mode change 100644 => 100755 tests/unity/auto/test_file_filter.rb mode change 100644 => 100755 tests/unity/auto/type_sanitizer.rb mode change 100644 => 100755 tests/unity/auto/unity_test_summary.py mode change 100644 => 100755 tests/unity/auto/unity_test_summary.rb mode change 100644 => 100755 tests/unity/auto/unity_to_junit.py mode change 100644 => 100755 tests/unity/docs/ThrowTheSwitchCodingStandard.md mode change 100644 => 100755 tests/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf mode change 100644 => 100755 tests/unity/docs/UnityAssertionsReference.md mode change 100644 => 100755 tests/unity/docs/UnityConfigurationGuide.md mode change 100644 => 100755 tests/unity/docs/UnityGettingStartedGuide.md mode change 100644 => 100755 tests/unity/docs/UnityHelperScriptsGuide.md mode change 100644 => 100755 tests/unity/docs/license.txt mode change 100644 => 100755 tests/unity/examples/example_1/makefile mode change 100644 => 100755 tests/unity/examples/example_1/readme.txt mode change 100644 => 100755 tests/unity/examples/example_1/src/ProductionCode.c mode change 100644 => 100755 tests/unity/examples/example_1/src/ProductionCode.h mode change 100644 => 100755 tests/unity/examples/example_1/src/ProductionCode2.c mode change 100644 => 100755 tests/unity/examples/example_1/src/ProductionCode2.h delete mode 100644 tests/unity/examples/example_1/test/TestProductionCode.c delete mode 100644 tests/unity/examples/example_1/test/TestProductionCode2.c delete mode 100644 tests/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c delete mode 100644 tests/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c mode change 100644 => 100755 tests/unity/examples/example_2/makefile mode change 100644 => 100755 tests/unity/examples/example_2/readme.txt mode change 100644 => 100755 tests/unity/examples/example_2/src/ProductionCode.c mode change 100644 => 100755 tests/unity/examples/example_2/src/ProductionCode.h mode change 100644 => 100755 tests/unity/examples/example_2/src/ProductionCode2.c mode change 100644 => 100755 tests/unity/examples/example_2/src/ProductionCode2.h delete mode 100644 tests/unity/examples/example_2/test/TestProductionCode.c delete mode 100644 tests/unity/examples/example_2/test/TestProductionCode2.c delete mode 100644 tests/unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c delete mode 100644 tests/unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c delete mode 100644 tests/unity/examples/example_2/test/test_runners/all_tests.c mode change 100644 => 100755 tests/unity/examples/example_3/helper/UnityHelper.c mode change 100644 => 100755 tests/unity/examples/example_3/helper/UnityHelper.h mode change 100644 => 100755 tests/unity/examples/example_3/rakefile.rb mode change 100644 => 100755 tests/unity/examples/example_3/rakefile_helper.rb mode change 100644 => 100755 tests/unity/examples/example_3/readme.txt mode change 100644 => 100755 tests/unity/examples/example_3/src/ProductionCode.c mode change 100644 => 100755 tests/unity/examples/example_3/src/ProductionCode.h mode change 100644 => 100755 tests/unity/examples/example_3/src/ProductionCode2.c mode change 100644 => 100755 tests/unity/examples/example_3/src/ProductionCode2.h mode change 100644 => 100755 tests/unity/examples/example_3/target_gcc_32.yml delete mode 100644 tests/unity/examples/example_3/test/TestProductionCode.c delete mode 100644 tests/unity/examples/example_3/test/TestProductionCode2.c mode change 100644 => 100755 tests/unity/examples/unity_config.h mode change 100644 => 100755 tests/unity/extras/eclipse/error_parsers.txt mode change 100644 => 100755 tests/unity/extras/fixture/rakefile.rb mode change 100644 => 100755 tests/unity/extras/fixture/rakefile_helper.rb mode change 100644 => 100755 tests/unity/extras/fixture/readme.txt mode change 100644 => 100755 tests/unity/extras/fixture/src/unity_fixture.c mode change 100644 => 100755 tests/unity/extras/fixture/src/unity_fixture.h mode change 100644 => 100755 tests/unity/extras/fixture/src/unity_fixture_internals.h mode change 100644 => 100755 tests/unity/extras/fixture/src/unity_fixture_malloc_overrides.h delete mode 100644 tests/unity/extras/fixture/test/Makefile delete mode 100644 tests/unity/extras/fixture/test/main/AllTests.c delete mode 100644 tests/unity/extras/fixture/test/template_fixture_tests.c delete mode 100644 tests/unity/extras/fixture/test/unity_fixture_Test.c delete mode 100644 tests/unity/extras/fixture/test/unity_fixture_TestRunner.c delete mode 100644 tests/unity/extras/fixture/test/unity_output_Spy.c delete mode 100644 tests/unity/extras/fixture/test/unity_output_Spy.h mode change 100644 => 100755 tests/unity/release/build.info mode change 100644 => 100755 tests/unity/release/version.info mode change 100644 => 100755 tests/unity/src/unity.c mode change 100644 => 100755 tests/unity/src/unity.h delete mode 100644 tests/unity/test/.rubocop.yml delete mode 100644 tests/unity/test/Makefile delete mode 100644 tests/unity/test/expectdata/testsample_cmd.c delete mode 100644 tests/unity/test/expectdata/testsample_def.c delete mode 100644 tests/unity/test/expectdata/testsample_head1.c delete mode 100644 tests/unity/test/expectdata/testsample_head1.h delete mode 100644 tests/unity/test/expectdata/testsample_mock_cmd.c delete mode 100644 tests/unity/test/expectdata/testsample_mock_def.c delete mode 100644 tests/unity/test/expectdata/testsample_mock_head1.c delete mode 100644 tests/unity/test/expectdata/testsample_mock_head1.h delete mode 100644 tests/unity/test/expectdata/testsample_mock_new1.c delete mode 100644 tests/unity/test/expectdata/testsample_mock_new2.c delete mode 100644 tests/unity/test/expectdata/testsample_mock_param.c delete mode 100644 tests/unity/test/expectdata/testsample_mock_run1.c delete mode 100644 tests/unity/test/expectdata/testsample_mock_run2.c delete mode 100644 tests/unity/test/expectdata/testsample_mock_yaml.c delete mode 100644 tests/unity/test/expectdata/testsample_new1.c delete mode 100644 tests/unity/test/expectdata/testsample_new2.c delete mode 100644 tests/unity/test/expectdata/testsample_param.c delete mode 100644 tests/unity/test/expectdata/testsample_run1.c delete mode 100644 tests/unity/test/expectdata/testsample_run2.c delete mode 100644 tests/unity/test/expectdata/testsample_yaml.c delete mode 100644 tests/unity/test/rakefile delete mode 100644 tests/unity/test/rakefile_helper.rb delete mode 100644 tests/unity/test/spec/generate_module_existing_file_spec.rb delete mode 100644 tests/unity/test/targets/clang_file.yml delete mode 100644 tests/unity/test/targets/clang_strict.yml delete mode 100644 tests/unity/test/targets/gcc_32.yml delete mode 100644 tests/unity/test/targets/gcc_64.yml delete mode 100644 tests/unity/test/targets/gcc_auto_limits.yml delete mode 100644 tests/unity/test/targets/gcc_auto_stdint.yml delete mode 100644 tests/unity/test/targets/gcc_manual_math.yml delete mode 100644 tests/unity/test/targets/hitech_picc18.yml delete mode 100644 tests/unity/test/targets/iar_arm_v4.yml delete mode 100644 tests/unity/test/targets/iar_arm_v5.yml delete mode 100644 tests/unity/test/targets/iar_arm_v5_3.yml delete mode 100644 tests/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml delete mode 100644 tests/unity/test/targets/iar_cortexm3_v5.yml delete mode 100644 tests/unity/test/targets/iar_msp430.yml delete mode 100644 tests/unity/test/targets/iar_sh2a_v6.yml delete mode 100644 tests/unity/test/testdata/CException.h delete mode 100644 tests/unity/test/testdata/Defs.h delete mode 100644 tests/unity/test/testdata/cmock.h delete mode 100644 tests/unity/test/testdata/mockMock.h delete mode 100644 tests/unity/test/testdata/testRunnerGenerator.c delete mode 100644 tests/unity/test/testdata/testRunnerGeneratorSmall.c delete mode 100644 tests/unity/test/testdata/testRunnerGeneratorWithMocks.c delete mode 100644 tests/unity/test/tests/test_generate_test_runner.rb delete mode 100644 tests/unity/test/tests/testparameterized.c delete mode 100644 tests/unity/test/tests/testunity.c mode change 100644 => 100755 tests/unity_setup.c mode change 100644 => 100755 valgrind.supp diff --git a/.editorconfig b/.editorconfig old mode 100644 new mode 100755 diff --git a/.gitattributes b/.gitattributes old mode 100644 new mode 100755 diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md old mode 100644 new mode 100755 diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 diff --git a/.travis.yml b/.travis.yml old mode 100644 new mode 100755 diff --git a/BUILD.gn b/BUILD.gn old mode 100644 new mode 100755 index 1680a00..81f7d31 --- a/BUILD.gn +++ b/BUILD.gn @@ -1,27 +1,54 @@ -# Copyright (C) 2019. Huawei Technologies Co., Ltd. All rights reserved. +# Copyright (c) 2020 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. -import("//build/ohos.gni") +import("//build/lite/config/component/lite_component.gni") +import("//build/lite/ndk/ndk.gni") -config("cJSON_config") { +config("cjson_config") { include_dirs = [ - ".", + ".", ] } -ohos_source_set("cjson_src") { - sources = [ - "cJSON.c", - ] - configs = [":cJSON_config"] +cjson_sources = [ + "cJSON.c", + "cJSON_Utils.c", +] + +lite_library("cjson_static") { + target_type = "static_library" + sources = cjson_sources + public_configs = [ ":cjson_config" ] } -ohos_static_library("cjson_static") { - deps = [":cjson_src"] - public_configs = [":cJSON_config"] +lite_library("cjson_shared") { + target_type = "shared_library" + sources = cjson_sources + public_configs = [ ":cjson_config" ] } -ohos_shared_library("cjson") { - deps = [":cjson_src"] - public_configs = [":cJSON_config"] - subsystem_name = "hiviewdfx" +ndk_lib("cjson_ndk") { + if (board_name != "hi3861v100") { + lib_extension = ".so" + deps = [ + ":cjson_shared" + ] + } else { + deps = [ + ":cjson_static" + ] + } + head_files = [ + "//third_party/cJSON" + ] } diff --git a/CHANGELOG.md b/CHANGELOG.md old mode 100644 new mode 100755 diff --git a/CMakeLists.txt b/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md old mode 100644 new mode 100755 diff --git a/COPYRIGHT.OpenSource b/COPYRIGHT.OpenSource deleted file mode 100755 index 9989be5..0000000 --- a/COPYRIGHT.OpenSource +++ /dev/null @@ -1,7 +0,0 @@ -Copyright (c) 2009-2019 Dave Gamble and cJSON contributors -Copyright (c) 2010 James Grenning and Contributed to Unity Project -Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams -Copyright (c) 2007 - 2017 Unity Project by Mike Karlesky, Mark VanderVoord, and Greg Williams -Copyright (c) 2007-14 Mike Karlesky, Mark VanderVoord, Greg Williams -Copyright (c) 2009-2017 Dave Gamble and cJSON contributors -Copyright (c) 2015 Alexander Mueller / XelaRellum@web.de diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/Makefile b/Makefile old mode 100644 new mode 100755 diff --git a/NOTICE b/NOTICE deleted file mode 120000 index 7a694c9..0000000 --- a/NOTICE +++ /dev/null @@ -1 +0,0 @@ -LICENSE \ No newline at end of file diff --git a/README.OpenSource b/README.OpenSource deleted file mode 100644 index 345fc21..0000000 --- a/README.OpenSource +++ /dev/null @@ -1,12 +0,0 @@ -[ - { - "Name": "cJSON", - "License": "MIT License", - "License File": "LICENSE", - "Version Number": "1.7.13", - "Owner": "sirius.liwei@huawei.com", - "Upstream URL": "https://github.com/DaveGamble/cJSON/releases", - "Description": "Ultralightweight JSON parser in ANSI C." - } -] - diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/appveyor.yml b/appveyor.yml old mode 100644 new mode 100755 diff --git a/cJSON.c b/cJSON.c old mode 100644 new mode 100755 diff --git a/cJSON.h b/cJSON.h old mode 100644 new mode 100755 diff --git a/cJSON_Utils.c b/cJSON_Utils.c old mode 100644 new mode 100755 diff --git a/cJSON_Utils.h b/cJSON_Utils.h old mode 100644 new mode 100755 diff --git a/fuzzing/.gitignore b/fuzzing/.gitignore old mode 100644 new mode 100755 diff --git a/fuzzing/CMakeLists.txt b/fuzzing/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/fuzzing/afl.c b/fuzzing/afl.c old mode 100644 new mode 100755 diff --git a/fuzzing/cjson_read_fuzzer.c b/fuzzing/cjson_read_fuzzer.c old mode 100644 new mode 100755 diff --git a/fuzzing/fuzz_main.c b/fuzzing/fuzz_main.c old mode 100644 new mode 100755 diff --git a/fuzzing/inputs/test1 b/fuzzing/inputs/test1 old mode 100644 new mode 100755 diff --git a/fuzzing/inputs/test10 b/fuzzing/inputs/test10 old mode 100644 new mode 100755 diff --git a/fuzzing/inputs/test11 b/fuzzing/inputs/test11 old mode 100644 new mode 100755 diff --git a/fuzzing/inputs/test2 b/fuzzing/inputs/test2 old mode 100644 new mode 100755 diff --git a/fuzzing/inputs/test3 b/fuzzing/inputs/test3 old mode 100644 new mode 100755 diff --git a/fuzzing/inputs/test3.bu b/fuzzing/inputs/test3.bu old mode 100644 new mode 100755 diff --git a/fuzzing/inputs/test3.uf b/fuzzing/inputs/test3.uf old mode 100644 new mode 100755 diff --git a/fuzzing/inputs/test3.uu b/fuzzing/inputs/test3.uu old mode 100644 new mode 100755 diff --git a/fuzzing/inputs/test4 b/fuzzing/inputs/test4 old mode 100644 new mode 100755 diff --git a/fuzzing/inputs/test5 b/fuzzing/inputs/test5 old mode 100644 new mode 100755 diff --git a/fuzzing/inputs/test6 b/fuzzing/inputs/test6 old mode 100644 new mode 100755 diff --git a/fuzzing/inputs/test7 b/fuzzing/inputs/test7 old mode 100644 new mode 100755 diff --git a/fuzzing/inputs/test8 b/fuzzing/inputs/test8 old mode 100644 new mode 100755 diff --git a/fuzzing/inputs/test9 b/fuzzing/inputs/test9 old mode 100644 new mode 100755 diff --git a/fuzzing/json.dict b/fuzzing/json.dict old mode 100644 new mode 100755 diff --git a/library_config/cJSONConfig.cmake.in b/library_config/cJSONConfig.cmake.in old mode 100644 new mode 100755 diff --git a/library_config/cJSONConfigVersion.cmake.in b/library_config/cJSONConfigVersion.cmake.in old mode 100644 new mode 100755 diff --git a/library_config/libcjson.pc.in b/library_config/libcjson.pc.in old mode 100644 new mode 100755 diff --git a/library_config/libcjson_utils.pc.in b/library_config/libcjson_utils.pc.in old mode 100644 new mode 100755 diff --git a/library_config/uninstall.cmake b/library_config/uninstall.cmake old mode 100644 new mode 100755 diff --git a/test.c b/test.c old mode 100644 new mode 100755 diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/tests/cjson_add.c b/tests/cjson_add.c old mode 100644 new mode 100755 diff --git a/tests/common.h b/tests/common.h old mode 100644 new mode 100755 diff --git a/tests/compare_tests.c b/tests/compare_tests.c old mode 100644 new mode 100755 diff --git a/tests/inputs/test1 b/tests/inputs/test1 old mode 100644 new mode 100755 diff --git a/tests/inputs/test1.expected b/tests/inputs/test1.expected old mode 100644 new mode 100755 diff --git a/tests/inputs/test10 b/tests/inputs/test10 old mode 100644 new mode 100755 diff --git a/tests/inputs/test10.expected b/tests/inputs/test10.expected old mode 100644 new mode 100755 diff --git a/tests/inputs/test11 b/tests/inputs/test11 old mode 100644 new mode 100755 diff --git a/tests/inputs/test11.expected b/tests/inputs/test11.expected old mode 100644 new mode 100755 diff --git a/tests/inputs/test2 b/tests/inputs/test2 old mode 100644 new mode 100755 diff --git a/tests/inputs/test2.expected b/tests/inputs/test2.expected old mode 100644 new mode 100755 diff --git a/tests/inputs/test3 b/tests/inputs/test3 old mode 100644 new mode 100755 diff --git a/tests/inputs/test3.expected b/tests/inputs/test3.expected old mode 100644 new mode 100755 diff --git a/tests/inputs/test4 b/tests/inputs/test4 old mode 100644 new mode 100755 diff --git a/tests/inputs/test4.expected b/tests/inputs/test4.expected old mode 100644 new mode 100755 diff --git a/tests/inputs/test5 b/tests/inputs/test5 old mode 100644 new mode 100755 diff --git a/tests/inputs/test5.expected b/tests/inputs/test5.expected old mode 100644 new mode 100755 diff --git a/tests/inputs/test6 b/tests/inputs/test6 old mode 100644 new mode 100755 diff --git a/tests/inputs/test7 b/tests/inputs/test7 old mode 100644 new mode 100755 diff --git a/tests/inputs/test7.expected b/tests/inputs/test7.expected old mode 100644 new mode 100755 diff --git a/tests/inputs/test8 b/tests/inputs/test8 old mode 100644 new mode 100755 diff --git a/tests/inputs/test8.expected b/tests/inputs/test8.expected old mode 100644 new mode 100755 diff --git a/tests/inputs/test9 b/tests/inputs/test9 old mode 100644 new mode 100755 diff --git a/tests/inputs/test9.expected b/tests/inputs/test9.expected old mode 100644 new mode 100755 diff --git a/tests/json-patch-tests/.editorconfig b/tests/json-patch-tests/.editorconfig old mode 100644 new mode 100755 diff --git a/tests/json-patch-tests/.gitignore b/tests/json-patch-tests/.gitignore old mode 100644 new mode 100755 diff --git a/tests/json-patch-tests/.npmignore b/tests/json-patch-tests/.npmignore old mode 100644 new mode 100755 diff --git a/tests/json-patch-tests/README.md b/tests/json-patch-tests/README.md old mode 100644 new mode 100755 diff --git a/tests/json-patch-tests/cjson-utils-tests.json b/tests/json-patch-tests/cjson-utils-tests.json old mode 100644 new mode 100755 diff --git a/tests/json-patch-tests/package.json b/tests/json-patch-tests/package.json old mode 100644 new mode 100755 diff --git a/tests/json-patch-tests/spec_tests.json b/tests/json-patch-tests/spec_tests.json old mode 100644 new mode 100755 diff --git a/tests/json-patch-tests/tests.json b/tests/json-patch-tests/tests.json old mode 100644 new mode 100755 diff --git a/tests/json_patch_tests.c b/tests/json_patch_tests.c old mode 100644 new mode 100755 diff --git a/tests/minify_tests.c b/tests/minify_tests.c old mode 100644 new mode 100755 diff --git a/tests/misc_tests.c b/tests/misc_tests.c old mode 100644 new mode 100755 diff --git a/tests/misc_utils_tests.c b/tests/misc_utils_tests.c old mode 100644 new mode 100755 diff --git a/tests/old_utils_tests.c b/tests/old_utils_tests.c old mode 100644 new mode 100755 diff --git a/tests/parse_array.c b/tests/parse_array.c old mode 100644 new mode 100755 diff --git a/tests/parse_examples.c b/tests/parse_examples.c old mode 100644 new mode 100755 diff --git a/tests/parse_hex4.c b/tests/parse_hex4.c old mode 100644 new mode 100755 diff --git a/tests/parse_number.c b/tests/parse_number.c old mode 100644 new mode 100755 diff --git a/tests/parse_object.c b/tests/parse_object.c old mode 100644 new mode 100755 diff --git a/tests/parse_string.c b/tests/parse_string.c old mode 100644 new mode 100755 diff --git a/tests/parse_value.c b/tests/parse_value.c old mode 100644 new mode 100755 diff --git a/tests/parse_with_opts.c b/tests/parse_with_opts.c old mode 100644 new mode 100755 diff --git a/tests/print_array.c b/tests/print_array.c old mode 100644 new mode 100755 diff --git a/tests/print_number.c b/tests/print_number.c old mode 100644 new mode 100755 diff --git a/tests/print_object.c b/tests/print_object.c old mode 100644 new mode 100755 diff --git a/tests/print_string.c b/tests/print_string.c old mode 100644 new mode 100755 diff --git a/tests/print_value.c b/tests/print_value.c old mode 100644 new mode 100755 diff --git a/tests/readme_examples.c b/tests/readme_examples.c old mode 100644 new mode 100755 diff --git a/tests/unity/.gitattributes b/tests/unity/.gitattributes old mode 100644 new mode 100755 diff --git a/tests/unity/.gitignore b/tests/unity/.gitignore old mode 100644 new mode 100755 diff --git a/tests/unity/.travis.yml b/tests/unity/.travis.yml old mode 100644 new mode 100755 diff --git a/tests/unity/README.md b/tests/unity/README.md old mode 100644 new mode 100755 diff --git a/tests/unity/auto/colour_prompt.rb b/tests/unity/auto/colour_prompt.rb old mode 100644 new mode 100755 diff --git a/tests/unity/auto/colour_reporter.rb b/tests/unity/auto/colour_reporter.rb old mode 100644 new mode 100755 diff --git a/tests/unity/auto/generate_config.yml b/tests/unity/auto/generate_config.yml old mode 100644 new mode 100755 diff --git a/tests/unity/auto/generate_module.rb b/tests/unity/auto/generate_module.rb old mode 100644 new mode 100755 diff --git a/tests/unity/auto/generate_test_runner.rb b/tests/unity/auto/generate_test_runner.rb old mode 100644 new mode 100755 diff --git a/tests/unity/auto/parse_output.rb b/tests/unity/auto/parse_output.rb old mode 100644 new mode 100755 diff --git a/tests/unity/auto/test_file_filter.rb b/tests/unity/auto/test_file_filter.rb old mode 100644 new mode 100755 diff --git a/tests/unity/auto/type_sanitizer.rb b/tests/unity/auto/type_sanitizer.rb old mode 100644 new mode 100755 diff --git a/tests/unity/auto/unity_test_summary.py b/tests/unity/auto/unity_test_summary.py old mode 100644 new mode 100755 diff --git a/tests/unity/auto/unity_test_summary.rb b/tests/unity/auto/unity_test_summary.rb old mode 100644 new mode 100755 diff --git a/tests/unity/auto/unity_to_junit.py b/tests/unity/auto/unity_to_junit.py old mode 100644 new mode 100755 diff --git a/tests/unity/docs/ThrowTheSwitchCodingStandard.md b/tests/unity/docs/ThrowTheSwitchCodingStandard.md old mode 100644 new mode 100755 diff --git a/tests/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf b/tests/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf old mode 100644 new mode 100755 diff --git a/tests/unity/docs/UnityAssertionsReference.md b/tests/unity/docs/UnityAssertionsReference.md old mode 100644 new mode 100755 diff --git a/tests/unity/docs/UnityConfigurationGuide.md b/tests/unity/docs/UnityConfigurationGuide.md old mode 100644 new mode 100755 diff --git a/tests/unity/docs/UnityGettingStartedGuide.md b/tests/unity/docs/UnityGettingStartedGuide.md old mode 100644 new mode 100755 diff --git a/tests/unity/docs/UnityHelperScriptsGuide.md b/tests/unity/docs/UnityHelperScriptsGuide.md old mode 100644 new mode 100755 diff --git a/tests/unity/docs/license.txt b/tests/unity/docs/license.txt old mode 100644 new mode 100755 diff --git a/tests/unity/examples/example_1/makefile b/tests/unity/examples/example_1/makefile old mode 100644 new mode 100755 diff --git a/tests/unity/examples/example_1/readme.txt b/tests/unity/examples/example_1/readme.txt old mode 100644 new mode 100755 diff --git a/tests/unity/examples/example_1/src/ProductionCode.c b/tests/unity/examples/example_1/src/ProductionCode.c old mode 100644 new mode 100755 diff --git a/tests/unity/examples/example_1/src/ProductionCode.h b/tests/unity/examples/example_1/src/ProductionCode.h old mode 100644 new mode 100755 diff --git a/tests/unity/examples/example_1/src/ProductionCode2.c b/tests/unity/examples/example_1/src/ProductionCode2.c old mode 100644 new mode 100755 diff --git a/tests/unity/examples/example_1/src/ProductionCode2.h b/tests/unity/examples/example_1/src/ProductionCode2.h old mode 100644 new mode 100755 diff --git a/tests/unity/examples/example_1/test/TestProductionCode.c b/tests/unity/examples/example_1/test/TestProductionCode.c deleted file mode 100644 index 8060886..0000000 --- a/tests/unity/examples/example_1/test/TestProductionCode.c +++ /dev/null @@ -1,62 +0,0 @@ - -#include "ProductionCode.h" -#include "unity.h" - -/* sometimes you may want to get at local data in a module. - * for example: If you plan to pass by reference, this could be useful - * however, it should often be avoided */ -extern int Counter; - -void setUp(void) -{ - /* This is run before EACH TEST */ - Counter = 0x5a5a; -} - -void tearDown(void) -{ -} - -void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void) -{ - /* All of these should pass */ - TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(78)); - TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(1)); - TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(33)); - TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(999)); - TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(-1)); -} - -void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void) -{ - /* You should see this line fail in your test summary */ - TEST_ASSERT_EQUAL(1, FindFunction_WhichIsBroken(34)); - - /* Notice the rest of these didn't get a chance to run because the line above failed. - * Unit tests abort each test function on the first sign of trouble. - * Then NEXT test function runs as normal. */ - TEST_ASSERT_EQUAL(8, FindFunction_WhichIsBroken(8888)); -} - -void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void) -{ - /* This should be true because setUp set this up for us before this test */ - TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); - - /* This should be true because we can still change our answer */ - Counter = 0x1234; - TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); -} - -void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void) -{ - /* This should be true again because setup was rerun before this test (and after we changed it to 0x1234) */ - TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); -} - -void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void) -{ - /* Sometimes you get the test wrong. When that happens, you get a failure too... and a quick look should tell - * you what actually happened...which in this case was a failure to setup the initial condition. */ - TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); -} diff --git a/tests/unity/examples/example_1/test/TestProductionCode2.c b/tests/unity/examples/example_1/test/TestProductionCode2.c deleted file mode 100644 index 7d940c1..0000000 --- a/tests/unity/examples/example_1/test/TestProductionCode2.c +++ /dev/null @@ -1,31 +0,0 @@ - -#include "ProductionCode2.h" -#include "unity.h" - -/* These should be ignored because they are commented out in various ways: -#include "whatever.h" -#include "somethingelse.h" -*/ - -void setUp(void) -{ -} - -void tearDown(void) -{ -} - -void test_IgnoredTest(void) -{ - TEST_IGNORE_MESSAGE("This Test Was Ignored On Purpose"); -} - -void test_AnotherIgnoredTest(void) -{ - TEST_IGNORE_MESSAGE("These Can Be Useful For Leaving Yourself Notes On What You Need To Do Yet"); -} - -void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void) -{ - TEST_IGNORE(); /* Like This */ -} diff --git a/tests/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c b/tests/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c deleted file mode 100644 index cf72c21..0000000 --- a/tests/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +++ /dev/null @@ -1,53 +0,0 @@ -/* AUTOGENERATED FILE. DO NOT EDIT. */ - -/*=======Test Runner Used To Run Each Test Below=====*/ -#define RUN_TEST(TestFunc, TestLineNum) \ -{ \ - Unity.CurrentTestName = #TestFunc; \ - Unity.CurrentTestLineNumber = TestLineNum; \ - Unity.NumberOfTests++; \ - if (TEST_PROTECT()) \ - { \ - setUp(); \ - TestFunc(); \ - } \ - if (TEST_PROTECT()) \ - { \ - tearDown(); \ - } \ - UnityConcludeTest(); \ -} - -/*=======Automagically Detected Files To Include=====*/ -#include "unity.h" -#include -#include -#include "ProductionCode2.h" - -/*=======External Functions This Runner Calls=====*/ -extern void setUp(void); -extern void tearDown(void); -extern void test_IgnoredTest(void); -extern void test_AnotherIgnoredTest(void); -extern void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void); - - -/*=======Test Reset Option=====*/ -void resetTest(void); -void resetTest(void) -{ - tearDown(); - setUp(); -} - - -/*=======MAIN=====*/ -int main(void) -{ - UnityBegin("test/TestProductionCode2.c"); - RUN_TEST(test_IgnoredTest, 18); - RUN_TEST(test_AnotherIgnoredTest, 23); - RUN_TEST(test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented, 28); - - return (UnityEnd()); -} diff --git a/tests/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c b/tests/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c deleted file mode 100644 index 3b49af7..0000000 --- a/tests/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +++ /dev/null @@ -1,57 +0,0 @@ -/* AUTOGENERATED FILE. DO NOT EDIT. */ - -/*=======Test Runner Used To Run Each Test Below=====*/ -#define RUN_TEST(TestFunc, TestLineNum) \ -{ \ - Unity.CurrentTestName = #TestFunc; \ - Unity.CurrentTestLineNumber = TestLineNum; \ - Unity.NumberOfTests++; \ - if (TEST_PROTECT()) \ - { \ - setUp(); \ - TestFunc(); \ - } \ - if (TEST_PROTECT()) \ - { \ - tearDown(); \ - } \ - UnityConcludeTest(); \ -} - -/*=======Automagically Detected Files To Include=====*/ -#include "unity.h" -#include -#include -#include "ProductionCode.h" - -/*=======External Functions This Runner Calls=====*/ -extern void setUp(void); -extern void tearDown(void); -extern void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void); -extern void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void); -extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void); -extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void); -extern void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void); - - -/*=======Test Reset Option=====*/ -void resetTest(void); -void resetTest(void) -{ - tearDown(); - setUp(); -} - - -/*=======MAIN=====*/ -int main(void) -{ - UnityBegin("test/TestProductionCode.c"); - RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode, 20); - RUN_TEST(test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken, 30); - RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue, 41); - RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain, 51); - RUN_TEST(test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed, 57); - - return (UnityEnd()); -} diff --git a/tests/unity/examples/example_2/makefile b/tests/unity/examples/example_2/makefile old mode 100644 new mode 100755 diff --git a/tests/unity/examples/example_2/readme.txt b/tests/unity/examples/example_2/readme.txt old mode 100644 new mode 100755 diff --git a/tests/unity/examples/example_2/src/ProductionCode.c b/tests/unity/examples/example_2/src/ProductionCode.c old mode 100644 new mode 100755 diff --git a/tests/unity/examples/example_2/src/ProductionCode.h b/tests/unity/examples/example_2/src/ProductionCode.h old mode 100644 new mode 100755 diff --git a/tests/unity/examples/example_2/src/ProductionCode2.c b/tests/unity/examples/example_2/src/ProductionCode2.c old mode 100644 new mode 100755 diff --git a/tests/unity/examples/example_2/src/ProductionCode2.h b/tests/unity/examples/example_2/src/ProductionCode2.h old mode 100644 new mode 100755 diff --git a/tests/unity/examples/example_2/test/TestProductionCode.c b/tests/unity/examples/example_2/test/TestProductionCode.c deleted file mode 100644 index ff318ab..0000000 --- a/tests/unity/examples/example_2/test/TestProductionCode.c +++ /dev/null @@ -1,64 +0,0 @@ -#include "ProductionCode.h" -#include "unity.h" -#include "unity_fixture.h" - -TEST_GROUP(ProductionCode); - -//sometimes you may want to get at local data in a module. -//for example: If you plan to pass by reference, this could be useful -//however, it should often be avoided -extern int Counter; - -TEST_SETUP(ProductionCode) -{ - //This is run before EACH TEST - Counter = 0x5a5a; -} - -TEST_TEAR_DOWN(ProductionCode) -{ -} - -TEST(ProductionCode, FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode) -{ - //All of these should pass - TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(78)); - TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(1)); - TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(33)); - TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(999)); - TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(-1)); -} - -TEST(ProductionCode, FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken) -{ - // You should see this line fail in your test summary - TEST_ASSERT_EQUAL(1, FindFunction_WhichIsBroken(34)); - - // Notice the rest of these didn't get a chance to run because the line above failed. - // Unit tests abort each test function on the first sign of trouble. - // Then NEXT test function runs as normal. - TEST_ASSERT_EQUAL(8, FindFunction_WhichIsBroken(8888)); -} - -TEST(ProductionCode, FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue) -{ - //This should be true because setUp set this up for us before this test - TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); - - //This should be true because we can still change our answer - Counter = 0x1234; - TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); -} - -TEST(ProductionCode, FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain) -{ - //This should be true again because setup was rerun before this test (and after we changed it to 0x1234) - TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); -} - -TEST(ProductionCode, FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed) -{ - //Sometimes you get the test wrong. When that happens, you get a failure too... and a quick look should tell - // you what actually happened...which in this case was a failure to setup the initial condition. - TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); -} diff --git a/tests/unity/examples/example_2/test/TestProductionCode2.c b/tests/unity/examples/example_2/test/TestProductionCode2.c deleted file mode 100644 index d9f4efe..0000000 --- a/tests/unity/examples/example_2/test/TestProductionCode2.c +++ /dev/null @@ -1,33 +0,0 @@ -#include "ProductionCode2.h" -#include "unity.h" -#include "unity_fixture.h" - -TEST_GROUP(ProductionCode2); - -/* These should be ignored because they are commented out in various ways: -#include "whatever.h" -*/ -//#include "somethingelse.h" - -TEST_SETUP(ProductionCode2) -{ -} - -TEST_TEAR_DOWN(ProductionCode2) -{ -} - -TEST(ProductionCode2, IgnoredTest) -{ - TEST_IGNORE_MESSAGE("This Test Was Ignored On Purpose"); -} - -TEST(ProductionCode2, AnotherIgnoredTest) -{ - TEST_IGNORE_MESSAGE("These Can Be Useful For Leaving Yourself Notes On What You Need To Do Yet"); -} - -TEST(ProductionCode2, ThisFunctionHasNotBeenTested_NeedsToBeImplemented) -{ - TEST_IGNORE(); //Like This -} diff --git a/tests/unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c b/tests/unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c deleted file mode 100644 index 6fcc3b1..0000000 --- a/tests/unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "unity.h" -#include "unity_fixture.h" - -TEST_GROUP_RUNNER(ProductionCode2) -{ - RUN_TEST_CASE(ProductionCode2, IgnoredTest); - RUN_TEST_CASE(ProductionCode2, AnotherIgnoredTest); - RUN_TEST_CASE(ProductionCode2, ThisFunctionHasNotBeenTested_NeedsToBeImplemented); -} \ No newline at end of file diff --git a/tests/unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c b/tests/unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c deleted file mode 100644 index 41a416a..0000000 --- a/tests/unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c +++ /dev/null @@ -1,11 +0,0 @@ -#include "unity.h" -#include "unity_fixture.h" - -TEST_GROUP_RUNNER(ProductionCode) -{ - RUN_TEST_CASE(ProductionCode, FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode); - RUN_TEST_CASE(ProductionCode, FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken); - RUN_TEST_CASE(ProductionCode, FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue); - RUN_TEST_CASE(ProductionCode, FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain); - RUN_TEST_CASE(ProductionCode, FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed); -} \ No newline at end of file diff --git a/tests/unity/examples/example_2/test/test_runners/all_tests.c b/tests/unity/examples/example_2/test/test_runners/all_tests.c deleted file mode 100644 index e706ece..0000000 --- a/tests/unity/examples/example_2/test/test_runners/all_tests.c +++ /dev/null @@ -1,12 +0,0 @@ -#include "unity_fixture.h" - -static void RunAllTests(void) -{ - RUN_TEST_GROUP(ProductionCode); - RUN_TEST_GROUP(ProductionCode2); -} - -int main(int argc, const char * argv[]) -{ - return UnityMain(argc, argv, RunAllTests); -} diff --git a/tests/unity/examples/example_3/helper/UnityHelper.c b/tests/unity/examples/example_3/helper/UnityHelper.c old mode 100644 new mode 100755 diff --git a/tests/unity/examples/example_3/helper/UnityHelper.h b/tests/unity/examples/example_3/helper/UnityHelper.h old mode 100644 new mode 100755 diff --git a/tests/unity/examples/example_3/rakefile.rb b/tests/unity/examples/example_3/rakefile.rb old mode 100644 new mode 100755 diff --git a/tests/unity/examples/example_3/rakefile_helper.rb b/tests/unity/examples/example_3/rakefile_helper.rb old mode 100644 new mode 100755 diff --git a/tests/unity/examples/example_3/readme.txt b/tests/unity/examples/example_3/readme.txt old mode 100644 new mode 100755 diff --git a/tests/unity/examples/example_3/src/ProductionCode.c b/tests/unity/examples/example_3/src/ProductionCode.c old mode 100644 new mode 100755 diff --git a/tests/unity/examples/example_3/src/ProductionCode.h b/tests/unity/examples/example_3/src/ProductionCode.h old mode 100644 new mode 100755 diff --git a/tests/unity/examples/example_3/src/ProductionCode2.c b/tests/unity/examples/example_3/src/ProductionCode2.c old mode 100644 new mode 100755 diff --git a/tests/unity/examples/example_3/src/ProductionCode2.h b/tests/unity/examples/example_3/src/ProductionCode2.h old mode 100644 new mode 100755 diff --git a/tests/unity/examples/example_3/target_gcc_32.yml b/tests/unity/examples/example_3/target_gcc_32.yml old mode 100644 new mode 100755 diff --git a/tests/unity/examples/example_3/test/TestProductionCode.c b/tests/unity/examples/example_3/test/TestProductionCode.c deleted file mode 100644 index 28a5581..0000000 --- a/tests/unity/examples/example_3/test/TestProductionCode.c +++ /dev/null @@ -1,62 +0,0 @@ - -#include "ProductionCode.h" -#include "unity.h" - -//sometimes you may want to get at local data in a module. -//for example: If you plan to pass by reference, this could be useful -//however, it should often be avoided -extern int Counter; - -void setUp(void) -{ - //This is run before EACH TEST - Counter = 0x5a5a; -} - -void tearDown(void) -{ -} - -void test_FindFunction_WhichIsBroken_ShouldReturnZeroIfItemIsNotInList_WhichWorksEvenInOurBrokenCode(void) -{ - //All of these should pass - TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(78)); - TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(1)); - TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(33)); - TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(999)); - TEST_ASSERT_EQUAL(0, FindFunction_WhichIsBroken(-1)); -} - -void test_FindFunction_WhichIsBroken_ShouldReturnTheIndexForItemsInList_WhichWillFailBecauseOurFunctionUnderTestIsBroken(void) -{ - // You should see this line fail in your test summary - TEST_ASSERT_EQUAL(1, FindFunction_WhichIsBroken(34)); - - // Notice the rest of these didn't get a chance to run because the line above failed. - // Unit tests abort each test function on the first sign of trouble. - // Then NEXT test function runs as normal. - TEST_ASSERT_EQUAL(8, FindFunction_WhichIsBroken(8888)); -} - -void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValue(void) -{ - //This should be true because setUp set this up for us before this test - TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); - - //This should be true because we can still change our answer - Counter = 0x1234; - TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); -} - -void test_FunctionWhichReturnsLocalVariable_ShouldReturnTheCurrentCounterValueAgain(void) -{ - //This should be true again because setup was rerun before this test (and after we changed it to 0x1234) - TEST_ASSERT_EQUAL_HEX(0x5a5a, FunctionWhichReturnsLocalVariable()); -} - -void test_FunctionWhichReturnsLocalVariable_ShouldReturnCurrentCounter_ButFailsBecauseThisTestIsActuallyFlawed(void) -{ - //Sometimes you get the test wrong. When that happens, you get a failure too... and a quick look should tell - // you what actually happened...which in this case was a failure to setup the initial condition. - TEST_ASSERT_EQUAL_HEX(0x1234, FunctionWhichReturnsLocalVariable()); -} diff --git a/tests/unity/examples/example_3/test/TestProductionCode2.c b/tests/unity/examples/example_3/test/TestProductionCode2.c deleted file mode 100644 index e2119cc..0000000 --- a/tests/unity/examples/example_3/test/TestProductionCode2.c +++ /dev/null @@ -1,31 +0,0 @@ - -#include "ProductionCode2.h" -#include "unity.h" - -/* These should be ignored because they are commented out in various ways: -#include "whatever.h" -*/ -//#include "somethingelse.h" - -void setUp(void) -{ -} - -void tearDown(void) -{ -} - -void test_IgnoredTest(void) -{ - TEST_IGNORE_MESSAGE("This Test Was Ignored On Purpose"); -} - -void test_AnotherIgnoredTest(void) -{ - TEST_IGNORE_MESSAGE("These Can Be Useful For Leaving Yourself Notes On What You Need To Do Yet"); -} - -void test_ThisFunctionHasNotBeenTested_NeedsToBeImplemented(void) -{ - TEST_IGNORE(); //Like This -} diff --git a/tests/unity/examples/unity_config.h b/tests/unity/examples/unity_config.h old mode 100644 new mode 100755 diff --git a/tests/unity/extras/eclipse/error_parsers.txt b/tests/unity/extras/eclipse/error_parsers.txt old mode 100644 new mode 100755 diff --git a/tests/unity/extras/fixture/rakefile.rb b/tests/unity/extras/fixture/rakefile.rb old mode 100644 new mode 100755 diff --git a/tests/unity/extras/fixture/rakefile_helper.rb b/tests/unity/extras/fixture/rakefile_helper.rb old mode 100644 new mode 100755 diff --git a/tests/unity/extras/fixture/readme.txt b/tests/unity/extras/fixture/readme.txt old mode 100644 new mode 100755 diff --git a/tests/unity/extras/fixture/src/unity_fixture.c b/tests/unity/extras/fixture/src/unity_fixture.c old mode 100644 new mode 100755 diff --git a/tests/unity/extras/fixture/src/unity_fixture.h b/tests/unity/extras/fixture/src/unity_fixture.h old mode 100644 new mode 100755 diff --git a/tests/unity/extras/fixture/src/unity_fixture_internals.h b/tests/unity/extras/fixture/src/unity_fixture_internals.h old mode 100644 new mode 100755 diff --git a/tests/unity/extras/fixture/src/unity_fixture_malloc_overrides.h b/tests/unity/extras/fixture/src/unity_fixture_malloc_overrides.h old mode 100644 new mode 100755 diff --git a/tests/unity/extras/fixture/test/Makefile b/tests/unity/extras/fixture/test/Makefile deleted file mode 100644 index e6c6255..0000000 --- a/tests/unity/extras/fixture/test/Makefile +++ /dev/null @@ -1,75 +0,0 @@ -CC = gcc -ifeq ($(shell uname -s), Darwin) -CC = clang -endif -#DEBUG = -O0 -g -CFLAGS += -std=c99 -pedantic -Wall -Wextra -Werror -CFLAGS += $(DEBUG) -DEFINES = -D UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar -DEFINES += -D UNITY_OUTPUT_CHAR_HEADER_DECLARATION=UnityOutputCharSpy_OutputChar\(int\) -SRC = ../src/unity_fixture.c \ - ../../../src/unity.c \ - unity_fixture_Test.c \ - unity_fixture_TestRunner.c \ - unity_output_Spy.c \ - main/AllTests.c - -INC_DIR = -I../src -I../../../src/ -BUILD_DIR = ../build -TARGET = ../build/fixture_tests.exe - -all: default noStdlibMalloc 32bits - -default: $(BUILD_DIR) - $(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -D UNITY_SUPPORT_64 - @ echo "default build" - ./$(TARGET) - -32bits: $(BUILD_DIR) - $(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -m32 - @ echo "32bits build" - ./$(TARGET) - -noStdlibMalloc: $(BUILD_DIR) - $(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -D UNITY_EXCLUDE_STDLIB_MALLOC - @ echo "build with noStdlibMalloc" - ./$(TARGET) - -C89: CFLAGS += -D UNITY_EXCLUDE_STDINT_H # C89 did not have type 'long long', -C89: $(BUILD_DIR) - $(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -std=c89 && ./$(TARGET) - $(CC) $(CFLAGS) $(DEFINES) $(SRC) $(INC_DIR) -o $(TARGET) -D UNITY_EXCLUDE_STDLIB_MALLOC -std=c89 - ./$(TARGET) - -$(BUILD_DIR): - mkdir -p $(BUILD_DIR) - -clean: - rm -f $(TARGET) $(BUILD_DIR)/*.gc* - -cov: $(BUILD_DIR) - cd $(BUILD_DIR) && \ - $(CC) $(DEFINES) $(foreach i, $(SRC), ../test/$(i)) $(INC_DIR) -o $(TARGET) -fprofile-arcs -ftest-coverage - rm -f $(BUILD_DIR)/*.gcda - ./$(TARGET) > /dev/null ; ./$(TARGET) -v > /dev/null - cd $(BUILD_DIR) && \ - gcov unity_fixture.c | head -3 - grep '###' $(BUILD_DIR)/unity_fixture.c.gcov -C2 || true # Show uncovered lines - -# These extended flags DO get included before any target build runs -CFLAGS += -Wbad-function-cast -CFLAGS += -Wcast-qual -CFLAGS += -Wconversion -CFLAGS += -Wformat=2 -CFLAGS += -Wmissing-prototypes -CFLAGS += -Wold-style-definition -CFLAGS += -Wpointer-arith -CFLAGS += -Wshadow -CFLAGS += -Wstrict-overflow=5 -CFLAGS += -Wstrict-prototypes -CFLAGS += -Wswitch-default -CFLAGS += -Wundef -CFLAGS += -Wno-error=undef # Warning only, this should not stop the build -CFLAGS += -Wunreachable-code -CFLAGS += -Wunused -CFLAGS += -fstrict-aliasing diff --git a/tests/unity/extras/fixture/test/main/AllTests.c b/tests/unity/extras/fixture/test/main/AllTests.c deleted file mode 100644 index e30dd85..0000000 --- a/tests/unity/extras/fixture/test/main/AllTests.c +++ /dev/null @@ -1,22 +0,0 @@ -/* Copyright (c) 2010 James Grenning and Contributed to Unity Project - * ========================================== - * Unity Project - A Test Framework for C - * Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams - * [Released under MIT License. Please refer to license.txt for details] - * ========================================== */ - -#include "unity_fixture.h" - -static void runAllTests(void) -{ - RUN_TEST_GROUP(UnityFixture); - RUN_TEST_GROUP(UnityCommandOptions); - RUN_TEST_GROUP(LeakDetection); - RUN_TEST_GROUP(InternalMalloc); -} - -int main(int argc, const char* argv[]) -{ - return UnityMain(argc, argv, runAllTests); -} - diff --git a/tests/unity/extras/fixture/test/template_fixture_tests.c b/tests/unity/extras/fixture/test/template_fixture_tests.c deleted file mode 100644 index 18bbb89..0000000 --- a/tests/unity/extras/fixture/test/template_fixture_tests.c +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright (c) 2010 James Grenning and Contributed to Unity Project - * ========================================== - * Unity Project - A Test Framework for C - * Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams - * [Released under MIT License. Please refer to license.txt for details] - * ========================================== */ - -#include "unity_fixture.h" - -static int data = -1; - -TEST_GROUP(mygroup); - -TEST_SETUP(mygroup) -{ - data = 0; -} - -TEST_TEAR_DOWN(mygroup) -{ - data = -1; -} - -TEST(mygroup, test1) -{ - TEST_ASSERT_EQUAL_INT(0, data); -} - -TEST(mygroup, test2) -{ - TEST_ASSERT_EQUAL_INT(0, data); - data = 5; -} - -TEST(mygroup, test3) -{ - data = 7; - TEST_ASSERT_EQUAL_INT(7, data); -} diff --git a/tests/unity/extras/fixture/test/unity_fixture_Test.c b/tests/unity/extras/fixture/test/unity_fixture_Test.c deleted file mode 100644 index a842b08..0000000 --- a/tests/unity/extras/fixture/test/unity_fixture_Test.c +++ /dev/null @@ -1,543 +0,0 @@ -/* Copyright (c) 2010 James Grenning and Contributed to Unity Project - * ========================================== - * Unity Project - A Test Framework for C - * Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams - * [Released under MIT License. Please refer to license.txt for details] - * ========================================== */ - -#include "unity_fixture.h" -#include "unity_output_Spy.h" -#include -#include - -TEST_GROUP(UnityFixture); - -TEST_SETUP(UnityFixture) -{ -} - -TEST_TEAR_DOWN(UnityFixture) -{ -} - -static int* pointer1 = 0; -static int* pointer2 = (int*)2; -static int* pointer3 = (int*)3; -static int int1; -static int int2; -static int int3; -static int int4; - -TEST(UnityFixture, PointerSetting) -{ - TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); - UT_PTR_SET(pointer1, &int1); - UT_PTR_SET(pointer2, &int2); - UT_PTR_SET(pointer3, &int3); - TEST_ASSERT_POINTERS_EQUAL(pointer1, &int1); - TEST_ASSERT_POINTERS_EQUAL(pointer2, &int2); - TEST_ASSERT_POINTERS_EQUAL(pointer3, &int3); - UT_PTR_SET(pointer1, &int4); - UnityPointer_UndoAllSets(); - TEST_ASSERT_POINTERS_EQUAL(pointer1, 0); - TEST_ASSERT_POINTERS_EQUAL(pointer2, (int*)2); - TEST_ASSERT_POINTERS_EQUAL(pointer3, (int*)3); -} - -TEST(UnityFixture, ForceMallocFail) -{ - void* m; - void* mfails; - UnityMalloc_MakeMallocFailAfterCount(1); - m = malloc(10); - CHECK(m); - mfails = malloc(10); - TEST_ASSERT_POINTERS_EQUAL(0, mfails); - free(m); -} - -TEST(UnityFixture, ReallocSmallerIsUnchanged) -{ - void* m1 = malloc(10); - void* m2 = realloc(m1, 5); - TEST_ASSERT_POINTERS_EQUAL(m1, m2); - free(m2); -} - -TEST(UnityFixture, ReallocSameIsUnchanged) -{ - void* m1 = malloc(10); - void* m2 = realloc(m1, 10); - TEST_ASSERT_POINTERS_EQUAL(m1, m2); - free(m2); -} - -TEST(UnityFixture, ReallocLargerNeeded) -{ - void* m1 = malloc(10); - void* m2; - CHECK(m1); - strcpy((char*)m1, "123456789"); - m2 = realloc(m1, 15); - /* CHECK(m1 != m2); //Depends on implementation */ - STRCMP_EQUAL("123456789", m2); - free(m2); -} - -TEST(UnityFixture, ReallocNullPointerIsLikeMalloc) -{ - void* m = realloc(0, 15); - CHECK(m != 0); - free(m); -} - -TEST(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer) -{ - void* m1 = malloc(10); - void* m2 = realloc(m1, 0); - TEST_ASSERT_POINTERS_EQUAL(0, m2); -} - -TEST(UnityFixture, CallocFillsWithZero) -{ - void* m = calloc(3, sizeof(char)); - char* s = (char*)m; - CHECK(m); - TEST_ASSERT_BYTES_EQUAL(0, s[0]); - TEST_ASSERT_BYTES_EQUAL(0, s[1]); - TEST_ASSERT_BYTES_EQUAL(0, s[2]); - free(m); -} - -static char *p1; -static char *p2; - -TEST(UnityFixture, PointerSet) -{ - char c1; - char c2; - char newC1; - char newC2; - p1 = &c1; - p2 = &c2; - - UnityPointer_Init(); - UT_PTR_SET(p1, &newC1); - UT_PTR_SET(p2, &newC2); - TEST_ASSERT_POINTERS_EQUAL(&newC1, p1); - TEST_ASSERT_POINTERS_EQUAL(&newC2, p2); - UnityPointer_UndoAllSets(); - TEST_ASSERT_POINTERS_EQUAL(&c1, p1); - TEST_ASSERT_POINTERS_EQUAL(&c2, p2); -} - -TEST(UnityFixture, FreeNULLSafety) -{ - free(NULL); -} - -TEST(UnityFixture, ConcludeTestIncrementsFailCount) -{ - UNITY_UINT savedFails = Unity.TestFailures; - UNITY_UINT savedIgnores = Unity.TestIgnores; - UnityOutputCharSpy_Enable(1); - Unity.CurrentTestFailed = 1; - UnityConcludeFixtureTest(); /* Resets TestFailed for this test to pass */ - Unity.CurrentTestIgnored = 1; - UnityConcludeFixtureTest(); /* Resets TestIgnored */ - UnityOutputCharSpy_Enable(0); - TEST_ASSERT_EQUAL(savedFails + 1, Unity.TestFailures); - TEST_ASSERT_EQUAL(savedIgnores + 1, Unity.TestIgnores); - Unity.TestFailures = savedFails; - Unity.TestIgnores = savedIgnores; -} - -/*------------------------------------------------------------ */ - -TEST_GROUP(UnityCommandOptions); - -static int savedVerbose; -static unsigned int savedRepeat; -static const char* savedName; -static const char* savedGroup; - -TEST_SETUP(UnityCommandOptions) -{ - savedVerbose = UnityFixture.Verbose; - savedRepeat = UnityFixture.RepeatCount; - savedName = UnityFixture.NameFilter; - savedGroup = UnityFixture.GroupFilter; -} - -TEST_TEAR_DOWN(UnityCommandOptions) -{ - UnityFixture.Verbose = savedVerbose; - UnityFixture.RepeatCount= savedRepeat; - UnityFixture.NameFilter = savedName; - UnityFixture.GroupFilter = savedGroup; -} - - -static const char* noOptions[] = { - "testrunner.exe" -}; - -TEST(UnityCommandOptions, DefaultOptions) -{ - UnityGetCommandLineOptions(1, noOptions); - TEST_ASSERT_EQUAL(0, UnityFixture.Verbose); - TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.GroupFilter); - TEST_ASSERT_POINTERS_EQUAL(0, UnityFixture.NameFilter); - TEST_ASSERT_EQUAL(1, UnityFixture.RepeatCount); -} - -static const char* verbose[] = { - "testrunner.exe", - "-v" -}; - -TEST(UnityCommandOptions, OptionVerbose) -{ - TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, verbose)); - TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); -} - -static const char* group[] = { - "testrunner.exe", - "-g", "groupname" -}; - -TEST(UnityCommandOptions, OptionSelectTestByGroup) -{ - TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, group)); - STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); -} - -static const char* name[] = { - "testrunner.exe", - "-n", "testname" -}; - -TEST(UnityCommandOptions, OptionSelectTestByName) -{ - TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, name)); - STRCMP_EQUAL("testname", UnityFixture.NameFilter); -} - -static const char* repeat[] = { - "testrunner.exe", - "-r", "99" -}; - -TEST(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount) -{ - TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(2, repeat)); - TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); -} - -TEST(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount) -{ - TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(3, repeat)); - TEST_ASSERT_EQUAL(99, UnityFixture.RepeatCount); -} - -static const char* multiple[] = { - "testrunner.exe", - "-v", - "-g", "groupname", - "-n", "testname", - "-r", "98" -}; - -TEST(UnityCommandOptions, MultipleOptions) -{ - TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(8, multiple)); - TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); - STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); - STRCMP_EQUAL("testname", UnityFixture.NameFilter); - TEST_ASSERT_EQUAL(98, UnityFixture.RepeatCount); -} - -static const char* dashRNotLast[] = { - "testrunner.exe", - "-v", - "-g", "gggg", - "-r", - "-n", "tttt", -}; - -TEST(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified) -{ - TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(7, dashRNotLast)); - TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); - STRCMP_EQUAL("gggg", UnityFixture.GroupFilter); - STRCMP_EQUAL("tttt", UnityFixture.NameFilter); - TEST_ASSERT_EQUAL(2, UnityFixture.RepeatCount); -} - -static const char* unknownCommand[] = { - "testrunner.exe", - "-v", - "-g", "groupname", - "-n", "testname", - "-r", "98", - "-z" -}; -TEST(UnityCommandOptions, UnknownCommandIsIgnored) -{ - TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(9, unknownCommand)); - TEST_ASSERT_EQUAL(1, UnityFixture.Verbose); - STRCMP_EQUAL("groupname", UnityFixture.GroupFilter); - STRCMP_EQUAL("testname", UnityFixture.NameFilter); - TEST_ASSERT_EQUAL(98, UnityFixture.RepeatCount); -} - -TEST(UnityCommandOptions, GroupOrNameFilterWithoutStringFails) -{ - TEST_ASSERT_EQUAL(1, UnityGetCommandLineOptions(3, unknownCommand)); - TEST_ASSERT_EQUAL(1, UnityGetCommandLineOptions(5, unknownCommand)); - TEST_ASSERT_EQUAL(1, UnityMain(3, unknownCommand, NULL)); -} - -TEST(UnityCommandOptions, GroupFilterReallyFilters) -{ - UNITY_UINT saved = Unity.NumberOfTests; - TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(4, unknownCommand)); - UnityIgnoreTest(NULL, "non-matching", NULL); - TEST_ASSERT_EQUAL(saved, Unity.NumberOfTests); -} - -IGNORE_TEST(UnityCommandOptions, TestShouldBeIgnored) -{ - TEST_FAIL_MESSAGE("This test should not run!"); -} - -/*------------------------------------------------------------ */ - -TEST_GROUP(LeakDetection); - -TEST_SETUP(LeakDetection) -{ -#ifdef UNITY_EXCLUDE_STDLIB_MALLOC - UnityOutputCharSpy_Create(200); -#else - UnityOutputCharSpy_Create(1000); -#endif -} - -TEST_TEAR_DOWN(LeakDetection) -{ - UnityOutputCharSpy_Destroy(); -} - -#define EXPECT_ABORT_BEGIN \ - { \ - jmp_buf TestAbortFrame; \ - memcpy(TestAbortFrame, Unity.AbortFrame, sizeof(jmp_buf)); \ - if (TEST_PROTECT()) \ - { - -#define EXPECT_ABORT_END \ - } \ - memcpy(Unity.AbortFrame, TestAbortFrame, sizeof(jmp_buf)); \ - } - -/* This tricky set of defines lets us see if we are using the Spy, returns 1 if true */ -#ifdef __STDC_VERSION__ - -#if __STDC_VERSION__ >= 199901L -#define USING_SPY_AS(a) EXPAND_AND_USE_2ND(ASSIGN_VALUE(a), 0) -#define ASSIGN_VALUE(a) VAL_##a -#define VAL_UnityOutputCharSpy_OutputChar 0, 1 -#define EXPAND_AND_USE_2ND(a, b) SECOND_PARAM(a, b, throwaway) -#define SECOND_PARAM(a, b, ...) b -#if USING_SPY_AS(UNITY_OUTPUT_CHAR) - #define USING_OUTPUT_SPY /* UNITY_OUTPUT_CHAR = UnityOutputCharSpy_OutputChar */ -#endif -#endif /* >= 199901 */ - -#else /* __STDC_VERSION__ else */ -#define UnityOutputCharSpy_OutputChar 42 -#if UNITY_OUTPUT_CHAR == UnityOutputCharSpy_OutputChar /* Works if no -Wundef -Werror */ - #define USING_OUTPUT_SPY -#endif -#undef UnityOutputCharSpy_OutputChar -#endif /* __STDC_VERSION__ */ - -TEST(LeakDetection, DetectsLeak) -{ -#ifndef USING_OUTPUT_SPY - TEST_IGNORE_MESSAGE("Build with '-D UNITY_OUTPUT_CHAR=UnityOutputCharSpy_OutputChar' to enable tests"); -#else - void* m = malloc(10); - TEST_ASSERT_NOT_NULL(m); - UnityOutputCharSpy_Enable(1); - EXPECT_ABORT_BEGIN - UnityMalloc_EndTest(); - EXPECT_ABORT_END - UnityOutputCharSpy_Enable(0); - Unity.CurrentTestFailed = 0; - CHECK(strstr(UnityOutputCharSpy_Get(), "This test leaks!")); - free(m); -#endif -} - -TEST(LeakDetection, BufferOverrunFoundDuringFree) -{ -#ifndef USING_OUTPUT_SPY - TEST_IGNORE(); -#else - void* m = malloc(10); - char* s = (char*)m; - TEST_ASSERT_NOT_NULL(m); - s[10] = (char)0xFF; - UnityOutputCharSpy_Enable(1); - EXPECT_ABORT_BEGIN - free(m); - EXPECT_ABORT_END - UnityOutputCharSpy_Enable(0); - Unity.CurrentTestFailed = 0; - CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during free()")); -#endif -} - -TEST(LeakDetection, BufferOverrunFoundDuringRealloc) -{ -#ifndef USING_OUTPUT_SPY - TEST_IGNORE(); -#else - void* m = malloc(10); - char* s = (char*)m; - TEST_ASSERT_NOT_NULL(m); - s[10] = (char)0xFF; - UnityOutputCharSpy_Enable(1); - EXPECT_ABORT_BEGIN - m = realloc(m, 100); - EXPECT_ABORT_END - UnityOutputCharSpy_Enable(0); - Unity.CurrentTestFailed = 0; - CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during realloc()")); -#endif -} - -TEST(LeakDetection, BufferGuardWriteFoundDuringFree) -{ -#ifndef USING_OUTPUT_SPY - TEST_IGNORE(); -#else - void* m = malloc(10); - char* s = (char*)m; - TEST_ASSERT_NOT_NULL(m); - s[-1] = (char)0x00; /* Will not detect 0 */ - s[-2] = (char)0x01; - UnityOutputCharSpy_Enable(1); - EXPECT_ABORT_BEGIN - free(m); - EXPECT_ABORT_END - UnityOutputCharSpy_Enable(0); - Unity.CurrentTestFailed = 0; - CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during free()")); -#endif -} - -TEST(LeakDetection, BufferGuardWriteFoundDuringRealloc) -{ -#ifndef USING_OUTPUT_SPY - TEST_IGNORE(); -#else - void* m = malloc(10); - char* s = (char*)m; - TEST_ASSERT_NOT_NULL(m); - s[-1] = (char)0x0A; - UnityOutputCharSpy_Enable(1); - EXPECT_ABORT_BEGIN - m = realloc(m, 100); - EXPECT_ABORT_END - UnityOutputCharSpy_Enable(0); - Unity.CurrentTestFailed = 0; - CHECK(strstr(UnityOutputCharSpy_Get(), "Buffer overrun detected during realloc()")); -#endif -} - -TEST(LeakDetection, PointerSettingMax) -{ -#ifndef USING_OUTPUT_SPY - TEST_IGNORE(); -#else - int i; - for (i = 0; i < UNITY_MAX_POINTERS; i++) UT_PTR_SET(pointer1, &int1); - UnityOutputCharSpy_Enable(1); - EXPECT_ABORT_BEGIN - UT_PTR_SET(pointer1, &int1); - EXPECT_ABORT_END - UnityOutputCharSpy_Enable(0); - Unity.CurrentTestFailed = 0; - CHECK(strstr(UnityOutputCharSpy_Get(), "Too many pointers set")); -#endif -} - -/*------------------------------------------------------------ */ - -TEST_GROUP(InternalMalloc); -#define TEST_ASSERT_MEMORY_ALL_FREE_LIFO_ORDER(first_mem_ptr, ptr) \ - ptr = malloc(10); free(ptr); \ - TEST_ASSERT_EQUAL_PTR_MESSAGE(first_mem_ptr, ptr, "Memory was stranded, free in LIFO order"); - - -TEST_SETUP(InternalMalloc) { } -TEST_TEAR_DOWN(InternalMalloc) { } - -TEST(InternalMalloc, MallocPastBufferFails) -{ -#ifdef UNITY_EXCLUDE_STDLIB_MALLOC - void* m = malloc(UNITY_INTERNAL_HEAP_SIZE_BYTES/2 + 1); - void* n = malloc(UNITY_INTERNAL_HEAP_SIZE_BYTES/2); - free(m); - TEST_ASSERT_NOT_NULL(m); - TEST_ASSERT_NULL(n); - TEST_ASSERT_MEMORY_ALL_FREE_LIFO_ORDER(m, n); -#endif -} - -TEST(InternalMalloc, CallocPastBufferFails) -{ -#ifdef UNITY_EXCLUDE_STDLIB_MALLOC - void* m = calloc(1, UNITY_INTERNAL_HEAP_SIZE_BYTES/2 + 1); - void* n = calloc(1, UNITY_INTERNAL_HEAP_SIZE_BYTES/2); - free(m); - TEST_ASSERT_NOT_NULL(m); - TEST_ASSERT_NULL(n); - TEST_ASSERT_MEMORY_ALL_FREE_LIFO_ORDER(m, n); -#endif -} - -TEST(InternalMalloc, MallocThenReallocGrowsMemoryInPlace) -{ -#ifdef UNITY_EXCLUDE_STDLIB_MALLOC - void* m = malloc(UNITY_INTERNAL_HEAP_SIZE_BYTES/2 + 1); - void* n = realloc(m, UNITY_INTERNAL_HEAP_SIZE_BYTES/2 + 9); - free(n); - TEST_ASSERT_NOT_NULL(m); - TEST_ASSERT_EQUAL(m, n); - TEST_ASSERT_MEMORY_ALL_FREE_LIFO_ORDER(m, n); -#endif -} - -TEST(InternalMalloc, ReallocFailDoesNotFreeMem) -{ -#ifdef UNITY_EXCLUDE_STDLIB_MALLOC - void* m = malloc(UNITY_INTERNAL_HEAP_SIZE_BYTES/2); - void* n1 = malloc(10); - void* out_of_mem = realloc(n1, UNITY_INTERNAL_HEAP_SIZE_BYTES/2 + 1); - void* n2 = malloc(10); - - free(n2); - if (out_of_mem == NULL) free(n1); - free(m); - - TEST_ASSERT_NOT_NULL(m); /* Got a real memory location */ - TEST_ASSERT_NULL(out_of_mem); /* The realloc should have failed */ - TEST_ASSERT_NOT_EQUAL(n2, n1); /* If n1 != n2 then realloc did not free n1 */ - TEST_ASSERT_MEMORY_ALL_FREE_LIFO_ORDER(m, n2); -#endif -} diff --git a/tests/unity/extras/fixture/test/unity_fixture_TestRunner.c b/tests/unity/extras/fixture/test/unity_fixture_TestRunner.c deleted file mode 100644 index e8713e1..0000000 --- a/tests/unity/extras/fixture/test/unity_fixture_TestRunner.c +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright (c) 2010 James Grenning and Contributed to Unity Project - * ========================================== - * Unity Project - A Test Framework for C - * Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams - * [Released under MIT License. Please refer to license.txt for details] - * ========================================== */ - -#include "unity_fixture.h" - -TEST_GROUP_RUNNER(UnityFixture) -{ - RUN_TEST_CASE(UnityFixture, PointerSetting); - RUN_TEST_CASE(UnityFixture, ForceMallocFail); - RUN_TEST_CASE(UnityFixture, ReallocSmallerIsUnchanged); - RUN_TEST_CASE(UnityFixture, ReallocSameIsUnchanged); - RUN_TEST_CASE(UnityFixture, ReallocLargerNeeded); - RUN_TEST_CASE(UnityFixture, ReallocNullPointerIsLikeMalloc); - RUN_TEST_CASE(UnityFixture, ReallocSizeZeroFreesMemAndReturnsNullPointer); - RUN_TEST_CASE(UnityFixture, CallocFillsWithZero); - RUN_TEST_CASE(UnityFixture, PointerSet); - RUN_TEST_CASE(UnityFixture, FreeNULLSafety); - RUN_TEST_CASE(UnityFixture, ConcludeTestIncrementsFailCount); -} - -TEST_GROUP_RUNNER(UnityCommandOptions) -{ - RUN_TEST_CASE(UnityCommandOptions, DefaultOptions); - RUN_TEST_CASE(UnityCommandOptions, OptionVerbose); - RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByGroup); - RUN_TEST_CASE(UnityCommandOptions, OptionSelectTestByName); - RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsDefaultCount); - RUN_TEST_CASE(UnityCommandOptions, OptionSelectRepeatTestsSpecificCount); - RUN_TEST_CASE(UnityCommandOptions, MultipleOptions); - RUN_TEST_CASE(UnityCommandOptions, MultipleOptionsDashRNotLastAndNoValueSpecified); - RUN_TEST_CASE(UnityCommandOptions, UnknownCommandIsIgnored); - RUN_TEST_CASE(UnityCommandOptions, GroupOrNameFilterWithoutStringFails); - RUN_TEST_CASE(UnityCommandOptions, GroupFilterReallyFilters); - RUN_TEST_CASE(UnityCommandOptions, TestShouldBeIgnored); -} - -TEST_GROUP_RUNNER(LeakDetection) -{ - RUN_TEST_CASE(LeakDetection, DetectsLeak); - RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringFree); - RUN_TEST_CASE(LeakDetection, BufferOverrunFoundDuringRealloc); - RUN_TEST_CASE(LeakDetection, BufferGuardWriteFoundDuringFree); - RUN_TEST_CASE(LeakDetection, BufferGuardWriteFoundDuringRealloc); - RUN_TEST_CASE(LeakDetection, PointerSettingMax); -} - -TEST_GROUP_RUNNER(InternalMalloc) -{ - RUN_TEST_CASE(InternalMalloc, MallocPastBufferFails); - RUN_TEST_CASE(InternalMalloc, CallocPastBufferFails); - RUN_TEST_CASE(InternalMalloc, MallocThenReallocGrowsMemoryInPlace); - RUN_TEST_CASE(InternalMalloc, ReallocFailDoesNotFreeMem); -} diff --git a/tests/unity/extras/fixture/test/unity_output_Spy.c b/tests/unity/extras/fixture/test/unity_output_Spy.c deleted file mode 100644 index be87bd5..0000000 --- a/tests/unity/extras/fixture/test/unity_output_Spy.c +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright (c) 2010 James Grenning and Contributed to Unity Project - * ========================================== - * Unity Project - A Test Framework for C - * Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams - * [Released under MIT License. Please refer to license.txt for details] - * ========================================== */ - - -#include "unity_output_Spy.h" -#include "unity_fixture.h" - -#include -#include - -static int size; -static int count; -static char* buffer; -static int spy_enable; - -void UnityOutputCharSpy_Create(int s) -{ - size = (s > 0) ? s : 0; - count = 0; - spy_enable = 0; - buffer = malloc((size_t)size); - TEST_ASSERT_NOT_NULL_MESSAGE(buffer, "Internal malloc failed in Spy Create():" __FILE__); - memset(buffer, 0, (size_t)size); -} - -void UnityOutputCharSpy_Destroy(void) -{ - size = 0; - free(buffer); -} - -void UnityOutputCharSpy_OutputChar(int c) -{ - if (spy_enable) - { - if (count < (size-1)) - buffer[count++] = (char)c; - } - else - { - putchar(c); - } -} - -const char * UnityOutputCharSpy_Get(void) -{ - return buffer; -} - -void UnityOutputCharSpy_Enable(int enable) -{ - spy_enable = enable; -} diff --git a/tests/unity/extras/fixture/test/unity_output_Spy.h b/tests/unity/extras/fixture/test/unity_output_Spy.h deleted file mode 100644 index b30a7f1..0000000 --- a/tests/unity/extras/fixture/test/unity_output_Spy.h +++ /dev/null @@ -1,17 +0,0 @@ -/* Copyright (c) 2010 James Grenning and Contributed to Unity Project - * ========================================== - * Unity Project - A Test Framework for C - * Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams - * [Released under MIT License. Please refer to license.txt for details] - * ========================================== */ - -#ifndef D_unity_output_Spy_H -#define D_unity_output_Spy_H - -void UnityOutputCharSpy_Create(int s); -void UnityOutputCharSpy_Destroy(void); -void UnityOutputCharSpy_OutputChar(int c); -const char * UnityOutputCharSpy_Get(void); -void UnityOutputCharSpy_Enable(int enable); - -#endif diff --git a/tests/unity/release/build.info b/tests/unity/release/build.info old mode 100644 new mode 100755 diff --git a/tests/unity/release/version.info b/tests/unity/release/version.info old mode 100644 new mode 100755 diff --git a/tests/unity/src/unity.c b/tests/unity/src/unity.c old mode 100644 new mode 100755 diff --git a/tests/unity/src/unity.h b/tests/unity/src/unity.h old mode 100644 new mode 100755 diff --git a/tests/unity/test/.rubocop.yml b/tests/unity/test/.rubocop.yml deleted file mode 100644 index c074ca9..0000000 --- a/tests/unity/test/.rubocop.yml +++ /dev/null @@ -1,58 +0,0 @@ -# This is the configuration used to check the rubocop source code. - -#inherit_from: .rubocop_todo.yml - -AllCops: - TargetRubyVersion: 2.1 - -# These are areas where ThrowTheSwitch's coding style diverges from the Ruby standard -Style/SpecialGlobalVars: - EnforcedStyle: use_perl_names -Style/FormatString: - Enabled: false -Style/GlobalVars: - Enabled: false -Style/RegexpLiteral: - AllowInnerSlashes: true -Style/HashSyntax: - EnforcedStyle: no_mixed_keys - -# This is disabled because it seems to get confused over nested hashes -Style/AlignHash: - Enabled: false - EnforcedHashRocketStyle: table - EnforcedColonStyle: table - -# We purposefully use these insecure features because they're what makes Ruby awesome -Security/Eval: - Enabled: false -Security/YAMLLoad: - Enabled: false - -# At this point, we're not ready to enforce inline documentation requirements -Style/Documentation: - Enabled: false -Style/DocumentationMethod: - Enabled: false - -# At this point, we're not ready to enforce any metrics -Metrics/AbcSize: - Enabled: false -Metrics/BlockLength: - Enabled: false -Metrics/BlockNesting: - Enabled: false -Metrics/ClassLength: - Enabled: false -Metrics/CyclomaticComplexity: - Enabled: false -Metrics/LineLength: - Enabled: false -Metrics/MethodLength: - Enabled: false -Metrics/ModuleLength: - Enabled: false -Metrics/ParameterLists: - Enabled: false -Metrics/PerceivedComplexity: - Enabled: false diff --git a/tests/unity/test/Makefile b/tests/unity/test/Makefile deleted file mode 100644 index c2710f1..0000000 --- a/tests/unity/test/Makefile +++ /dev/null @@ -1,66 +0,0 @@ -CC = gcc -ifeq ($(shell uname -s), Darwin) -CC = clang -endif -ifeq ($(findstring clang, $(CC)), clang) -E = -Weverything -CFLAGS += $E -Wno-unknown-warning-option -Wno-missing-prototypes -CFLAGS += -Wno-unused-macros -Wno-padded -Wno-missing-noreturn -endif -CFLAGS += -std=c99 -pedantic -Wall -Wextra -Wconversion -Werror -CFLAGS += -Wno-switch-enum -Wno-double-promotion -CFLAGS += -Wbad-function-cast -Wcast-qual -Wold-style-definition -Wshadow -Wstrict-overflow \ - -Wstrict-prototypes -Wswitch-default -Wundef -#DEBUG = -O0 -g -CFLAGS += $(DEBUG) -DEFINES = -D UNITY_OUTPUT_CHAR=putcharSpy -DEFINES += -D UNITY_OUTPUT_CHAR_HEADER_DECLARATION=putcharSpy\(int\) -DEFINES += $(UNITY_SUPPORT_64) $(UNITY_INCLUDE_DOUBLE) -UNITY_SUPPORT_64 = -D UNITY_SUPPORT_64 -UNITY_INCLUDE_DOUBLE = -D UNITY_INCLUDE_DOUBLE -SRC = ../src/unity.c tests/testunity.c build/testunityRunner.c -INC_DIR = -I ../src -COV_FLAGS = -fprofile-arcs -ftest-coverage -I ../../src -BUILD_DIR = build -TARGET = build/testunity-cov.exe - -# To generate coverage, call 'make -s', the default target runs. -# For verbose output of all the tests, run 'make test'. -default: coverage -.PHONY: default coverage test clean -coverage: DEFINES += -D UNITY_NO_WEAK -coverage: $(BUILD_DIR)/testunityRunner.c - cd $(BUILD_DIR) && \ - $(CC) $(CFLAGS) $(DEFINES) $(foreach i,$(SRC), ../$i) $(COV_FLAGS) -o ../$(TARGET) - rm -f $(BUILD_DIR)/*.gcda - ./$(TARGET) | grep 'Tests\|]]]' -A1 - cd $(BUILD_DIR) && \ - gcov unity.c | head -3 - grep '###' $(BUILD_DIR)/unity.c.gcov -C2 || true - -test: $(BUILD_DIR)/testunityRunner.c - $(CC) $(CFLAGS) $(DEFINES) $(INC_DIR) $(SRC) -o $(TARGET) - ./$(TARGET) - -# Compile only, for testing that preprocessor detection works -UNITY_C_ONLY =-c ../src/unity.c -o $(BUILD_DIR)/unity.o -intDetection: - $(CC) $(CFLAGS) $(INC_DIR) $(UNITY_C_ONLY) -D UNITY_EXCLUDE_STDINT_H - $(CC) $(CFLAGS) $(INC_DIR) $(UNITY_C_ONLY) -D UNITY_EXCLUDE_LIMITS_H - -$(BUILD_DIR)/testunityRunner.c: tests/testunity.c | $(BUILD_DIR) - awk $(AWK_SCRIPT) tests/testunity.c > $@ - -AWK_SCRIPT=\ - '/^void test/{ declarations[d++]=$$0; gsub(/\(?void\)? ?/,""); tests[t++]=$$0; line[u++]=NR } \ - END{ print "\#include \"unity.h\" /* Autogenerated by awk in Makefile */" ; \ - for (i=0; i -#include -#include "CException.h" -#include "funky.h" -#include "stanky.h" -#include - -/*=======External Functions This Runner Calls=====*/ -extern void setUp(void); -extern void tearDown(void); -extern void test_TheFirstThingToTest(void); -extern void test_TheSecondThingToTest(void); -extern void test_TheThirdThingToTest(void); -extern void test_TheFourthThingToTest(void); - - -/*=======Test Reset Option=====*/ -void resetTest(void); -void resetTest(void) -{ - tearDown(); - setUp(); -} - - -/*=======MAIN=====*/ -int main(void) -{ - UnityBegin("testdata/testsample.c"); - RUN_TEST(test_TheFirstThingToTest, 21); - RUN_TEST(test_TheSecondThingToTest, 43); - RUN_TEST(test_TheThirdThingToTest, 53); - RUN_TEST(test_TheFourthThingToTest, 58); - - return (UnityEnd()); -} diff --git a/tests/unity/test/expectdata/testsample_def.c b/tests/unity/test/expectdata/testsample_def.c deleted file mode 100644 index b8ad559..0000000 --- a/tests/unity/test/expectdata/testsample_def.c +++ /dev/null @@ -1,57 +0,0 @@ -/* AUTOGENERATED FILE. DO NOT EDIT. */ - -/*=======Test Runner Used To Run Each Test Below=====*/ -#define RUN_TEST(TestFunc, TestLineNum) \ -{ \ - Unity.CurrentTestName = #TestFunc; \ - Unity.CurrentTestLineNumber = TestLineNum; \ - Unity.NumberOfTests++; \ - if (TEST_PROTECT()) \ - { \ - setUp(); \ - TestFunc(); \ - } \ - if (TEST_PROTECT() && !TEST_IS_IGNORED) \ - { \ - tearDown(); \ - } \ - UnityConcludeTest(); \ -} - -/*=======Automagically Detected Files To Include=====*/ -#include "unity.h" -#include -#include -#include "funky.h" -#include "stanky.h" -#include - -/*=======External Functions This Runner Calls=====*/ -extern void setUp(void); -extern void tearDown(void); -extern void test_TheFirstThingToTest(void); -extern void test_TheSecondThingToTest(void); -extern void test_TheThirdThingToTest(void); -extern void test_TheFourthThingToTest(void); - - -/*=======Test Reset Option=====*/ -void resetTest(void); -void resetTest(void) -{ - tearDown(); - setUp(); -} - - -/*=======MAIN=====*/ -int main(void) -{ - UnityBegin("testdata/testsample.c"); - RUN_TEST(test_TheFirstThingToTest, 21); - RUN_TEST(test_TheSecondThingToTest, 43); - RUN_TEST(test_TheThirdThingToTest, 53); - RUN_TEST(test_TheFourthThingToTest, 58); - - return (UnityEnd()); -} diff --git a/tests/unity/test/expectdata/testsample_head1.c b/tests/unity/test/expectdata/testsample_head1.c deleted file mode 100644 index 1d01551..0000000 --- a/tests/unity/test/expectdata/testsample_head1.c +++ /dev/null @@ -1,55 +0,0 @@ -/* AUTOGENERATED FILE. DO NOT EDIT. */ - -/*=======Test Runner Used To Run Each Test Below=====*/ -#define RUN_TEST(TestFunc, TestLineNum) \ -{ \ - Unity.CurrentTestName = #TestFunc; \ - Unity.CurrentTestLineNumber = TestLineNum; \ - Unity.NumberOfTests++; \ - if (TEST_PROTECT()) \ - { \ - setUp(); \ - TestFunc(); \ - } \ - if (TEST_PROTECT() && !TEST_IS_IGNORED) \ - { \ - tearDown(); \ - } \ - UnityConcludeTest(); \ -} - -/*=======Automagically Detected Files To Include=====*/ -#include "unity.h" -#include -#include -#include "testsample_head1.h" - -/*=======External Functions This Runner Calls=====*/ -extern void setUp(void); -extern void tearDown(void); -extern void test_TheFirstThingToTest(void); -extern void test_TheSecondThingToTest(void); -extern void test_TheThirdThingToTest(void); -extern void test_TheFourthThingToTest(void); - - -/*=======Test Reset Option=====*/ -void resetTest(void); -void resetTest(void) -{ - tearDown(); - setUp(); -} - - -/*=======MAIN=====*/ -int main(void) -{ - UnityBegin("testdata/testsample.c"); - RUN_TEST(test_TheFirstThingToTest, 21); - RUN_TEST(test_TheSecondThingToTest, 43); - RUN_TEST(test_TheThirdThingToTest, 53); - RUN_TEST(test_TheFourthThingToTest, 58); - - return (UnityEnd()); -} diff --git a/tests/unity/test/expectdata/testsample_head1.h b/tests/unity/test/expectdata/testsample_head1.h deleted file mode 100644 index da6b7ab..0000000 --- a/tests/unity/test/expectdata/testsample_head1.h +++ /dev/null @@ -1,15 +0,0 @@ -/* AUTOGENERATED FILE. DO NOT EDIT. */ -#ifndef _TESTSAMPLE_HEAD1_H -#define _TESTSAMPLE_HEAD1_H - -#include "unity.h" -#include "funky.h" -#include "stanky.h" -#include - -void test_TheFirstThingToTest(void); -void test_TheSecondThingToTest(void); -void test_TheThirdThingToTest(void); -void test_TheFourthThingToTest(void); -#endif - diff --git a/tests/unity/test/expectdata/testsample_mock_cmd.c b/tests/unity/test/expectdata/testsample_mock_cmd.c deleted file mode 100644 index 45a09af..0000000 --- a/tests/unity/test/expectdata/testsample_mock_cmd.c +++ /dev/null @@ -1,80 +0,0 @@ -/* AUTOGENERATED FILE. DO NOT EDIT. */ - -/*=======Test Runner Used To Run Each Test Below=====*/ -#define RUN_TEST(TestFunc, TestLineNum) \ -{ \ - Unity.CurrentTestName = #TestFunc; \ - Unity.CurrentTestLineNumber = TestLineNum; \ - Unity.NumberOfTests++; \ - CMock_Init(); \ - UNITY_CLR_DETAILS(); \ - if (TEST_PROTECT()) \ - { \ - CEXCEPTION_T e; \ - Try { \ - setUp(); \ - TestFunc(); \ - } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ - } \ - if (TEST_PROTECT() && !TEST_IS_IGNORED) \ - { \ - tearDown(); \ - CMock_Verify(); \ - } \ - CMock_Destroy(); \ - UnityConcludeTest(); \ -} - -/*=======Automagically Detected Files To Include=====*/ -#include "unity.h" -#include "cmock.h" -#include -#include -#include "CException.h" -#include "funky.h" -#include -#include "Mockstanky.h" - -/*=======External Functions This Runner Calls=====*/ -extern void setUp(void); -extern void tearDown(void); -extern void test_TheFirstThingToTest(void); -extern void test_TheSecondThingToTest(void); - - -/*=======Mock Management=====*/ -static void CMock_Init(void) -{ - Mockstanky_Init(); -} -static void CMock_Verify(void) -{ - Mockstanky_Verify(); -} -static void CMock_Destroy(void) -{ - Mockstanky_Destroy(); -} - -/*=======Test Reset Option=====*/ -void resetTest(void); -void resetTest(void) -{ - CMock_Verify(); - CMock_Destroy(); - tearDown(); - CMock_Init(); - setUp(); -} - - -/*=======MAIN=====*/ -int main(void) -{ - UnityBegin("testdata/mocksample.c"); - RUN_TEST(test_TheFirstThingToTest, 21); - RUN_TEST(test_TheSecondThingToTest, 43); - - CMock_Guts_MemFreeFinal(); - return (UnityEnd()); -} diff --git a/tests/unity/test/expectdata/testsample_mock_def.c b/tests/unity/test/expectdata/testsample_mock_def.c deleted file mode 100644 index a7a2607..0000000 --- a/tests/unity/test/expectdata/testsample_mock_def.c +++ /dev/null @@ -1,76 +0,0 @@ -/* AUTOGENERATED FILE. DO NOT EDIT. */ - -/*=======Test Runner Used To Run Each Test Below=====*/ -#define RUN_TEST(TestFunc, TestLineNum) \ -{ \ - Unity.CurrentTestName = #TestFunc; \ - Unity.CurrentTestLineNumber = TestLineNum; \ - Unity.NumberOfTests++; \ - CMock_Init(); \ - UNITY_CLR_DETAILS(); \ - if (TEST_PROTECT()) \ - { \ - setUp(); \ - TestFunc(); \ - } \ - if (TEST_PROTECT() && !TEST_IS_IGNORED) \ - { \ - tearDown(); \ - CMock_Verify(); \ - } \ - CMock_Destroy(); \ - UnityConcludeTest(); \ -} - -/*=======Automagically Detected Files To Include=====*/ -#include "unity.h" -#include "cmock.h" -#include -#include -#include "funky.h" -#include -#include "Mockstanky.h" - -/*=======External Functions This Runner Calls=====*/ -extern void setUp(void); -extern void tearDown(void); -extern void test_TheFirstThingToTest(void); -extern void test_TheSecondThingToTest(void); - - -/*=======Mock Management=====*/ -static void CMock_Init(void) -{ - Mockstanky_Init(); -} -static void CMock_Verify(void) -{ - Mockstanky_Verify(); -} -static void CMock_Destroy(void) -{ - Mockstanky_Destroy(); -} - -/*=======Test Reset Option=====*/ -void resetTest(void); -void resetTest(void) -{ - CMock_Verify(); - CMock_Destroy(); - tearDown(); - CMock_Init(); - setUp(); -} - - -/*=======MAIN=====*/ -int main(void) -{ - UnityBegin("testdata/mocksample.c"); - RUN_TEST(test_TheFirstThingToTest, 21); - RUN_TEST(test_TheSecondThingToTest, 43); - - CMock_Guts_MemFreeFinal(); - return (UnityEnd()); -} diff --git a/tests/unity/test/expectdata/testsample_mock_head1.c b/tests/unity/test/expectdata/testsample_mock_head1.c deleted file mode 100644 index 45829fe..0000000 --- a/tests/unity/test/expectdata/testsample_mock_head1.c +++ /dev/null @@ -1,75 +0,0 @@ -/* AUTOGENERATED FILE. DO NOT EDIT. */ - -/*=======Test Runner Used To Run Each Test Below=====*/ -#define RUN_TEST(TestFunc, TestLineNum) \ -{ \ - Unity.CurrentTestName = #TestFunc; \ - Unity.CurrentTestLineNumber = TestLineNum; \ - Unity.NumberOfTests++; \ - CMock_Init(); \ - UNITY_CLR_DETAILS(); \ - if (TEST_PROTECT()) \ - { \ - setUp(); \ - TestFunc(); \ - } \ - if (TEST_PROTECT() && !TEST_IS_IGNORED) \ - { \ - tearDown(); \ - CMock_Verify(); \ - } \ - CMock_Destroy(); \ - UnityConcludeTest(); \ -} - -/*=======Automagically Detected Files To Include=====*/ -#include "unity.h" -#include "cmock.h" -#include -#include -#include "testsample_mock_head1.h" -#include "Mockstanky.h" - -/*=======External Functions This Runner Calls=====*/ -extern void setUp(void); -extern void tearDown(void); -extern void test_TheFirstThingToTest(void); -extern void test_TheSecondThingToTest(void); - - -/*=======Mock Management=====*/ -static void CMock_Init(void) -{ - Mockstanky_Init(); -} -static void CMock_Verify(void) -{ - Mockstanky_Verify(); -} -static void CMock_Destroy(void) -{ - Mockstanky_Destroy(); -} - -/*=======Test Reset Option=====*/ -void resetTest(void); -void resetTest(void) -{ - CMock_Verify(); - CMock_Destroy(); - tearDown(); - CMock_Init(); - setUp(); -} - - -/*=======MAIN=====*/ -int main(void) -{ - UnityBegin("testdata/mocksample.c"); - RUN_TEST(test_TheFirstThingToTest, 21); - RUN_TEST(test_TheSecondThingToTest, 43); - - CMock_Guts_MemFreeFinal(); - return (UnityEnd()); -} diff --git a/tests/unity/test/expectdata/testsample_mock_head1.h b/tests/unity/test/expectdata/testsample_mock_head1.h deleted file mode 100644 index 30c509a..0000000 --- a/tests/unity/test/expectdata/testsample_mock_head1.h +++ /dev/null @@ -1,13 +0,0 @@ -/* AUTOGENERATED FILE. DO NOT EDIT. */ -#ifndef _TESTSAMPLE_MOCK_HEAD1_H -#define _TESTSAMPLE_MOCK_HEAD1_H - -#include "unity.h" -#include "cmock.h" -#include "funky.h" -#include - -void test_TheFirstThingToTest(void); -void test_TheSecondThingToTest(void); -#endif - diff --git a/tests/unity/test/expectdata/testsample_mock_new1.c b/tests/unity/test/expectdata/testsample_mock_new1.c deleted file mode 100644 index 0061822..0000000 --- a/tests/unity/test/expectdata/testsample_mock_new1.c +++ /dev/null @@ -1,89 +0,0 @@ -/* AUTOGENERATED FILE. DO NOT EDIT. */ - -/*=======Test Runner Used To Run Each Test Below=====*/ -#define RUN_TEST(TestFunc, TestLineNum) \ -{ \ - Unity.CurrentTestName = #TestFunc; \ - Unity.CurrentTestLineNumber = TestLineNum; \ - Unity.NumberOfTests++; \ - CMock_Init(); \ - UNITY_CLR_DETAILS(); \ - if (TEST_PROTECT()) \ - { \ - CEXCEPTION_T e; \ - Try { \ - setUp(); \ - TestFunc(); \ - } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ - } \ - if (TEST_PROTECT() && !TEST_IS_IGNORED) \ - { \ - tearDown(); \ - CMock_Verify(); \ - } \ - CMock_Destroy(); \ - UnityConcludeTest(); \ -} - -/*=======Automagically Detected Files To Include=====*/ -#include "unity.h" -#include "cmock.h" -#include -#include -#include "CException.h" -#include "one.h" -#include "two.h" -#include "funky.h" -#include -#include "Mockstanky.h" - -int GlobalExpectCount; -int GlobalVerifyOrder; -char* GlobalOrderError; - -/*=======External Functions This Runner Calls=====*/ -extern void setUp(void); -extern void tearDown(void); -extern void test_TheFirstThingToTest(void); -extern void test_TheSecondThingToTest(void); - - -/*=======Mock Management=====*/ -static void CMock_Init(void) -{ - GlobalExpectCount = 0; - GlobalVerifyOrder = 0; - GlobalOrderError = NULL; - Mockstanky_Init(); -} -static void CMock_Verify(void) -{ - Mockstanky_Verify(); -} -static void CMock_Destroy(void) -{ - Mockstanky_Destroy(); -} - -/*=======Test Reset Option=====*/ -void resetTest(void); -void resetTest(void) -{ - CMock_Verify(); - CMock_Destroy(); - tearDown(); - CMock_Init(); - setUp(); -} - - -/*=======MAIN=====*/ -int main(void) -{ - UnityBegin("testdata/mocksample.c"); - RUN_TEST(test_TheFirstThingToTest, 21); - RUN_TEST(test_TheSecondThingToTest, 43); - - CMock_Guts_MemFreeFinal(); - return (UnityEnd()); -} diff --git a/tests/unity/test/expectdata/testsample_mock_new2.c b/tests/unity/test/expectdata/testsample_mock_new2.c deleted file mode 100644 index ee63cdc..0000000 --- a/tests/unity/test/expectdata/testsample_mock_new2.c +++ /dev/null @@ -1,89 +0,0 @@ -/* AUTOGENERATED FILE. DO NOT EDIT. */ - -/*=======Test Runner Used To Run Each Test Below=====*/ -#define RUN_TEST(TestFunc, TestLineNum) \ -{ \ - Unity.CurrentTestName = #TestFunc; \ - Unity.CurrentTestLineNumber = TestLineNum; \ - Unity.NumberOfTests++; \ - CMock_Init(); \ - UNITY_CLR_DETAILS(); \ - if (TEST_PROTECT()) \ - { \ - setUp(); \ - TestFunc(); \ - } \ - if (TEST_PROTECT() && !TEST_IS_IGNORED) \ - { \ - tearDown(); \ - CMock_Verify(); \ - } \ - CMock_Destroy(); \ - UnityConcludeTest(); \ -} - -/*=======Automagically Detected Files To Include=====*/ -#include "unity.h" -#include "cmock.h" -#include -#include -#include "funky.h" -#include -#include "Mockstanky.h" - -/*=======External Functions This Runner Calls=====*/ -extern void setUp(void); -extern void tearDown(void); -extern void test_TheFirstThingToTest(void); -extern void test_TheSecondThingToTest(void); - - -/*=======Mock Management=====*/ -static void CMock_Init(void) -{ - Mockstanky_Init(); -} -static void CMock_Verify(void) -{ - Mockstanky_Verify(); -} -static void CMock_Destroy(void) -{ - Mockstanky_Destroy(); -} - -/*=======Suite Setup=====*/ -static int suite_setup(void) -{ -a_custom_setup(); -} - -/*=======Suite Teardown=====*/ -static int suite_teardown(int num_failures) -{ -a_custom_teardown(); -} - -/*=======Test Reset Option=====*/ -void resetTest(void); -void resetTest(void) -{ - CMock_Verify(); - CMock_Destroy(); - tearDown(); - CMock_Init(); - setUp(); -} - - -/*=======MAIN=====*/ -int main(void) -{ - suite_setup(); - UnityBegin("testdata/mocksample.c"); - RUN_TEST(test_TheFirstThingToTest, 21); - RUN_TEST(test_TheSecondThingToTest, 43); - - CMock_Guts_MemFreeFinal(); - return suite_teardown(UnityEnd()); -} diff --git a/tests/unity/test/expectdata/testsample_mock_param.c b/tests/unity/test/expectdata/testsample_mock_param.c deleted file mode 100644 index a42b7de..0000000 --- a/tests/unity/test/expectdata/testsample_mock_param.c +++ /dev/null @@ -1,77 +0,0 @@ -/* AUTOGENERATED FILE. DO NOT EDIT. */ - -/*=======Test Runner Used To Run Each Test Below=====*/ -#define RUN_TEST_NO_ARGS -#define RUN_TEST(TestFunc, TestLineNum, ...) \ -{ \ - Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ - Unity.CurrentTestLineNumber = TestLineNum; \ - Unity.NumberOfTests++; \ - CMock_Init(); \ - UNITY_CLR_DETAILS(); \ - if (TEST_PROTECT()) \ - { \ - setUp(); \ - TestFunc(__VA_ARGS__); \ - } \ - if (TEST_PROTECT() && !TEST_IS_IGNORED) \ - { \ - tearDown(); \ - CMock_Verify(); \ - } \ - CMock_Destroy(); \ - UnityConcludeTest(); \ -} - -/*=======Automagically Detected Files To Include=====*/ -#include "unity.h" -#include "cmock.h" -#include -#include -#include "funky.h" -#include -#include "Mockstanky.h" - -/*=======External Functions This Runner Calls=====*/ -extern void setUp(void); -extern void tearDown(void); -extern void test_TheFirstThingToTest(void); -extern void test_TheSecondThingToTest(void); - - -/*=======Mock Management=====*/ -static void CMock_Init(void) -{ - Mockstanky_Init(); -} -static void CMock_Verify(void) -{ - Mockstanky_Verify(); -} -static void CMock_Destroy(void) -{ - Mockstanky_Destroy(); -} - -/*=======Test Reset Option=====*/ -void resetTest(void); -void resetTest(void) -{ - CMock_Verify(); - CMock_Destroy(); - tearDown(); - CMock_Init(); - setUp(); -} - - -/*=======MAIN=====*/ -int main(void) -{ - UnityBegin("testdata/mocksample.c"); - RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); - RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); - - CMock_Guts_MemFreeFinal(); - return (UnityEnd()); -} diff --git a/tests/unity/test/expectdata/testsample_mock_run1.c b/tests/unity/test/expectdata/testsample_mock_run1.c deleted file mode 100644 index 0061822..0000000 --- a/tests/unity/test/expectdata/testsample_mock_run1.c +++ /dev/null @@ -1,89 +0,0 @@ -/* AUTOGENERATED FILE. DO NOT EDIT. */ - -/*=======Test Runner Used To Run Each Test Below=====*/ -#define RUN_TEST(TestFunc, TestLineNum) \ -{ \ - Unity.CurrentTestName = #TestFunc; \ - Unity.CurrentTestLineNumber = TestLineNum; \ - Unity.NumberOfTests++; \ - CMock_Init(); \ - UNITY_CLR_DETAILS(); \ - if (TEST_PROTECT()) \ - { \ - CEXCEPTION_T e; \ - Try { \ - setUp(); \ - TestFunc(); \ - } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ - } \ - if (TEST_PROTECT() && !TEST_IS_IGNORED) \ - { \ - tearDown(); \ - CMock_Verify(); \ - } \ - CMock_Destroy(); \ - UnityConcludeTest(); \ -} - -/*=======Automagically Detected Files To Include=====*/ -#include "unity.h" -#include "cmock.h" -#include -#include -#include "CException.h" -#include "one.h" -#include "two.h" -#include "funky.h" -#include -#include "Mockstanky.h" - -int GlobalExpectCount; -int GlobalVerifyOrder; -char* GlobalOrderError; - -/*=======External Functions This Runner Calls=====*/ -extern void setUp(void); -extern void tearDown(void); -extern void test_TheFirstThingToTest(void); -extern void test_TheSecondThingToTest(void); - - -/*=======Mock Management=====*/ -static void CMock_Init(void) -{ - GlobalExpectCount = 0; - GlobalVerifyOrder = 0; - GlobalOrderError = NULL; - Mockstanky_Init(); -} -static void CMock_Verify(void) -{ - Mockstanky_Verify(); -} -static void CMock_Destroy(void) -{ - Mockstanky_Destroy(); -} - -/*=======Test Reset Option=====*/ -void resetTest(void); -void resetTest(void) -{ - CMock_Verify(); - CMock_Destroy(); - tearDown(); - CMock_Init(); - setUp(); -} - - -/*=======MAIN=====*/ -int main(void) -{ - UnityBegin("testdata/mocksample.c"); - RUN_TEST(test_TheFirstThingToTest, 21); - RUN_TEST(test_TheSecondThingToTest, 43); - - CMock_Guts_MemFreeFinal(); - return (UnityEnd()); -} diff --git a/tests/unity/test/expectdata/testsample_mock_run2.c b/tests/unity/test/expectdata/testsample_mock_run2.c deleted file mode 100644 index ee63cdc..0000000 --- a/tests/unity/test/expectdata/testsample_mock_run2.c +++ /dev/null @@ -1,89 +0,0 @@ -/* AUTOGENERATED FILE. DO NOT EDIT. */ - -/*=======Test Runner Used To Run Each Test Below=====*/ -#define RUN_TEST(TestFunc, TestLineNum) \ -{ \ - Unity.CurrentTestName = #TestFunc; \ - Unity.CurrentTestLineNumber = TestLineNum; \ - Unity.NumberOfTests++; \ - CMock_Init(); \ - UNITY_CLR_DETAILS(); \ - if (TEST_PROTECT()) \ - { \ - setUp(); \ - TestFunc(); \ - } \ - if (TEST_PROTECT() && !TEST_IS_IGNORED) \ - { \ - tearDown(); \ - CMock_Verify(); \ - } \ - CMock_Destroy(); \ - UnityConcludeTest(); \ -} - -/*=======Automagically Detected Files To Include=====*/ -#include "unity.h" -#include "cmock.h" -#include -#include -#include "funky.h" -#include -#include "Mockstanky.h" - -/*=======External Functions This Runner Calls=====*/ -extern void setUp(void); -extern void tearDown(void); -extern void test_TheFirstThingToTest(void); -extern void test_TheSecondThingToTest(void); - - -/*=======Mock Management=====*/ -static void CMock_Init(void) -{ - Mockstanky_Init(); -} -static void CMock_Verify(void) -{ - Mockstanky_Verify(); -} -static void CMock_Destroy(void) -{ - Mockstanky_Destroy(); -} - -/*=======Suite Setup=====*/ -static int suite_setup(void) -{ -a_custom_setup(); -} - -/*=======Suite Teardown=====*/ -static int suite_teardown(int num_failures) -{ -a_custom_teardown(); -} - -/*=======Test Reset Option=====*/ -void resetTest(void); -void resetTest(void) -{ - CMock_Verify(); - CMock_Destroy(); - tearDown(); - CMock_Init(); - setUp(); -} - - -/*=======MAIN=====*/ -int main(void) -{ - suite_setup(); - UnityBegin("testdata/mocksample.c"); - RUN_TEST(test_TheFirstThingToTest, 21); - RUN_TEST(test_TheSecondThingToTest, 43); - - CMock_Guts_MemFreeFinal(); - return suite_teardown(UnityEnd()); -} diff --git a/tests/unity/test/expectdata/testsample_mock_yaml.c b/tests/unity/test/expectdata/testsample_mock_yaml.c deleted file mode 100644 index a24bb5a..0000000 --- a/tests/unity/test/expectdata/testsample_mock_yaml.c +++ /dev/null @@ -1,90 +0,0 @@ -/* AUTOGENERATED FILE. DO NOT EDIT. */ - -/*=======Test Runner Used To Run Each Test Below=====*/ -#define RUN_TEST(TestFunc, TestLineNum) \ -{ \ - Unity.CurrentTestName = #TestFunc; \ - Unity.CurrentTestLineNumber = TestLineNum; \ - Unity.NumberOfTests++; \ - CMock_Init(); \ - UNITY_CLR_DETAILS(); \ - if (TEST_PROTECT()) \ - { \ - CEXCEPTION_T e; \ - Try { \ - setUp(); \ - TestFunc(); \ - } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ - } \ - if (TEST_PROTECT() && !TEST_IS_IGNORED) \ - { \ - tearDown(); \ - CMock_Verify(); \ - } \ - CMock_Destroy(); \ - UnityConcludeTest(); \ -} - -/*=======Automagically Detected Files To Include=====*/ -#include "unity.h" -#include "cmock.h" -#include -#include -#include "CException.h" -#include "two.h" -#include "three.h" -#include -#include "funky.h" -#include -#include "Mockstanky.h" - -/*=======External Functions This Runner Calls=====*/ -extern void setUp(void); -extern void tearDown(void); -extern void test_TheFirstThingToTest(void); -extern void test_TheSecondThingToTest(void); - - -/*=======Mock Management=====*/ -static void CMock_Init(void) -{ - Mockstanky_Init(); -} -static void CMock_Verify(void) -{ - Mockstanky_Verify(); -} -static void CMock_Destroy(void) -{ - Mockstanky_Destroy(); -} - -/*=======Suite Setup=====*/ -static int suite_setup(void) -{ -a_yaml_setup(); -} - -/*=======Test Reset Option=====*/ -void resetTest(void); -void resetTest(void) -{ - CMock_Verify(); - CMock_Destroy(); - tearDown(); - CMock_Init(); - setUp(); -} - - -/*=======MAIN=====*/ -int main(void) -{ - suite_setup(); - UnityBegin("testdata/mocksample.c"); - RUN_TEST(test_TheFirstThingToTest, 21); - RUN_TEST(test_TheSecondThingToTest, 43); - - CMock_Guts_MemFreeFinal(); - return (UnityEnd()); -} diff --git a/tests/unity/test/expectdata/testsample_new1.c b/tests/unity/test/expectdata/testsample_new1.c deleted file mode 100644 index 7dcd3fd..0000000 --- a/tests/unity/test/expectdata/testsample_new1.c +++ /dev/null @@ -1,67 +0,0 @@ -/* AUTOGENERATED FILE. DO NOT EDIT. */ - -/*=======Test Runner Used To Run Each Test Below=====*/ -#define RUN_TEST(TestFunc, TestLineNum) \ -{ \ - Unity.CurrentTestName = #TestFunc; \ - Unity.CurrentTestLineNumber = TestLineNum; \ - Unity.NumberOfTests++; \ - if (TEST_PROTECT()) \ - { \ - CEXCEPTION_T e; \ - Try { \ - setUp(); \ - TestFunc(); \ - } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ - } \ - if (TEST_PROTECT() && !TEST_IS_IGNORED) \ - { \ - tearDown(); \ - } \ - UnityConcludeTest(); \ -} - -/*=======Automagically Detected Files To Include=====*/ -#include "unity.h" -#include -#include -#include "CException.h" -#include "one.h" -#include "two.h" -#include "funky.h" -#include "stanky.h" -#include - -int GlobalExpectCount; -int GlobalVerifyOrder; -char* GlobalOrderError; - -/*=======External Functions This Runner Calls=====*/ -extern void setUp(void); -extern void tearDown(void); -extern void test_TheFirstThingToTest(void); -extern void test_TheSecondThingToTest(void); -extern void test_TheThirdThingToTest(void); -extern void test_TheFourthThingToTest(void); - - -/*=======Test Reset Option=====*/ -void resetTest(void); -void resetTest(void) -{ - tearDown(); - setUp(); -} - - -/*=======MAIN=====*/ -int main(void) -{ - UnityBegin("testdata/testsample.c"); - RUN_TEST(test_TheFirstThingToTest, 21); - RUN_TEST(test_TheSecondThingToTest, 43); - RUN_TEST(test_TheThirdThingToTest, 53); - RUN_TEST(test_TheFourthThingToTest, 58); - - return (UnityEnd()); -} diff --git a/tests/unity/test/expectdata/testsample_new2.c b/tests/unity/test/expectdata/testsample_new2.c deleted file mode 100644 index c98c697..0000000 --- a/tests/unity/test/expectdata/testsample_new2.c +++ /dev/null @@ -1,70 +0,0 @@ -/* AUTOGENERATED FILE. DO NOT EDIT. */ - -/*=======Test Runner Used To Run Each Test Below=====*/ -#define RUN_TEST(TestFunc, TestLineNum) \ -{ \ - Unity.CurrentTestName = #TestFunc; \ - Unity.CurrentTestLineNumber = TestLineNum; \ - Unity.NumberOfTests++; \ - if (TEST_PROTECT()) \ - { \ - setUp(); \ - TestFunc(); \ - } \ - if (TEST_PROTECT() && !TEST_IS_IGNORED) \ - { \ - tearDown(); \ - } \ - UnityConcludeTest(); \ -} - -/*=======Automagically Detected Files To Include=====*/ -#include "unity.h" -#include -#include -#include "funky.h" -#include "stanky.h" -#include - -/*=======External Functions This Runner Calls=====*/ -extern void setUp(void); -extern void tearDown(void); -extern void test_TheFirstThingToTest(void); -extern void test_TheSecondThingToTest(void); -extern void test_TheThirdThingToTest(void); -extern void test_TheFourthThingToTest(void); - - -/*=======Suite Setup=====*/ -static int suite_setup(void) -{ -a_custom_setup(); -} - -/*=======Suite Teardown=====*/ -static int suite_teardown(int num_failures) -{ -a_custom_teardown(); -} - -/*=======Test Reset Option=====*/ -void resetTest(void); -void resetTest(void) -{ - tearDown(); - setUp(); -} - - -/*=======MAIN=====*/ -int main(void) -{ - suite_setup(); - UnityBegin("testdata/testsample.c"); - RUN_TEST(test_TheFirstThingToTest, 21); - RUN_TEST(test_TheSecondThingToTest, 43); - RUN_TEST(test_TheThirdThingToTest, 53); - RUN_TEST(test_TheFourthThingToTest, 58); - - return suite_teardown(UnityEnd()); -} diff --git a/tests/unity/test/expectdata/testsample_param.c b/tests/unity/test/expectdata/testsample_param.c deleted file mode 100644 index adf6c26..0000000 --- a/tests/unity/test/expectdata/testsample_param.c +++ /dev/null @@ -1,58 +0,0 @@ -/* AUTOGENERATED FILE. DO NOT EDIT. */ - -/*=======Test Runner Used To Run Each Test Below=====*/ -#define RUN_TEST_NO_ARGS -#define RUN_TEST(TestFunc, TestLineNum, ...) \ -{ \ - Unity.CurrentTestName = #TestFunc "(" #__VA_ARGS__ ")"; \ - Unity.CurrentTestLineNumber = TestLineNum; \ - Unity.NumberOfTests++; \ - if (TEST_PROTECT()) \ - { \ - setUp(); \ - TestFunc(__VA_ARGS__); \ - } \ - if (TEST_PROTECT() && !TEST_IS_IGNORED) \ - { \ - tearDown(); \ - } \ - UnityConcludeTest(); \ -} - -/*=======Automagically Detected Files To Include=====*/ -#include "unity.h" -#include -#include -#include "funky.h" -#include "stanky.h" -#include - -/*=======External Functions This Runner Calls=====*/ -extern void setUp(void); -extern void tearDown(void); -extern void test_TheFirstThingToTest(void); -extern void test_TheSecondThingToTest(void); -extern void test_TheThirdThingToTest(void); -extern void test_TheFourthThingToTest(void); - - -/*=======Test Reset Option=====*/ -void resetTest(void); -void resetTest(void) -{ - tearDown(); - setUp(); -} - - -/*=======MAIN=====*/ -int main(void) -{ - UnityBegin("testdata/testsample.c"); - RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); - RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); - RUN_TEST(test_TheThirdThingToTest, 53, RUN_TEST_NO_ARGS); - RUN_TEST(test_TheFourthThingToTest, 58, RUN_TEST_NO_ARGS); - - return (UnityEnd()); -} diff --git a/tests/unity/test/expectdata/testsample_run1.c b/tests/unity/test/expectdata/testsample_run1.c deleted file mode 100644 index 7dcd3fd..0000000 --- a/tests/unity/test/expectdata/testsample_run1.c +++ /dev/null @@ -1,67 +0,0 @@ -/* AUTOGENERATED FILE. DO NOT EDIT. */ - -/*=======Test Runner Used To Run Each Test Below=====*/ -#define RUN_TEST(TestFunc, TestLineNum) \ -{ \ - Unity.CurrentTestName = #TestFunc; \ - Unity.CurrentTestLineNumber = TestLineNum; \ - Unity.NumberOfTests++; \ - if (TEST_PROTECT()) \ - { \ - CEXCEPTION_T e; \ - Try { \ - setUp(); \ - TestFunc(); \ - } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ - } \ - if (TEST_PROTECT() && !TEST_IS_IGNORED) \ - { \ - tearDown(); \ - } \ - UnityConcludeTest(); \ -} - -/*=======Automagically Detected Files To Include=====*/ -#include "unity.h" -#include -#include -#include "CException.h" -#include "one.h" -#include "two.h" -#include "funky.h" -#include "stanky.h" -#include - -int GlobalExpectCount; -int GlobalVerifyOrder; -char* GlobalOrderError; - -/*=======External Functions This Runner Calls=====*/ -extern void setUp(void); -extern void tearDown(void); -extern void test_TheFirstThingToTest(void); -extern void test_TheSecondThingToTest(void); -extern void test_TheThirdThingToTest(void); -extern void test_TheFourthThingToTest(void); - - -/*=======Test Reset Option=====*/ -void resetTest(void); -void resetTest(void) -{ - tearDown(); - setUp(); -} - - -/*=======MAIN=====*/ -int main(void) -{ - UnityBegin("testdata/testsample.c"); - RUN_TEST(test_TheFirstThingToTest, 21); - RUN_TEST(test_TheSecondThingToTest, 43); - RUN_TEST(test_TheThirdThingToTest, 53); - RUN_TEST(test_TheFourthThingToTest, 58); - - return (UnityEnd()); -} diff --git a/tests/unity/test/expectdata/testsample_run2.c b/tests/unity/test/expectdata/testsample_run2.c deleted file mode 100644 index c98c697..0000000 --- a/tests/unity/test/expectdata/testsample_run2.c +++ /dev/null @@ -1,70 +0,0 @@ -/* AUTOGENERATED FILE. DO NOT EDIT. */ - -/*=======Test Runner Used To Run Each Test Below=====*/ -#define RUN_TEST(TestFunc, TestLineNum) \ -{ \ - Unity.CurrentTestName = #TestFunc; \ - Unity.CurrentTestLineNumber = TestLineNum; \ - Unity.NumberOfTests++; \ - if (TEST_PROTECT()) \ - { \ - setUp(); \ - TestFunc(); \ - } \ - if (TEST_PROTECT() && !TEST_IS_IGNORED) \ - { \ - tearDown(); \ - } \ - UnityConcludeTest(); \ -} - -/*=======Automagically Detected Files To Include=====*/ -#include "unity.h" -#include -#include -#include "funky.h" -#include "stanky.h" -#include - -/*=======External Functions This Runner Calls=====*/ -extern void setUp(void); -extern void tearDown(void); -extern void test_TheFirstThingToTest(void); -extern void test_TheSecondThingToTest(void); -extern void test_TheThirdThingToTest(void); -extern void test_TheFourthThingToTest(void); - - -/*=======Suite Setup=====*/ -static int suite_setup(void) -{ -a_custom_setup(); -} - -/*=======Suite Teardown=====*/ -static int suite_teardown(int num_failures) -{ -a_custom_teardown(); -} - -/*=======Test Reset Option=====*/ -void resetTest(void); -void resetTest(void) -{ - tearDown(); - setUp(); -} - - -/*=======MAIN=====*/ -int main(void) -{ - suite_setup(); - UnityBegin("testdata/testsample.c"); - RUN_TEST(test_TheFirstThingToTest, 21); - RUN_TEST(test_TheSecondThingToTest, 43); - RUN_TEST(test_TheThirdThingToTest, 53); - RUN_TEST(test_TheFourthThingToTest, 58); - - return suite_teardown(UnityEnd()); -} diff --git a/tests/unity/test/expectdata/testsample_yaml.c b/tests/unity/test/expectdata/testsample_yaml.c deleted file mode 100644 index 3316024..0000000 --- a/tests/unity/test/expectdata/testsample_yaml.c +++ /dev/null @@ -1,71 +0,0 @@ -/* AUTOGENERATED FILE. DO NOT EDIT. */ - -/*=======Test Runner Used To Run Each Test Below=====*/ -#define RUN_TEST(TestFunc, TestLineNum) \ -{ \ - Unity.CurrentTestName = #TestFunc; \ - Unity.CurrentTestLineNumber = TestLineNum; \ - Unity.NumberOfTests++; \ - if (TEST_PROTECT()) \ - { \ - CEXCEPTION_T e; \ - Try { \ - setUp(); \ - TestFunc(); \ - } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ - } \ - if (TEST_PROTECT() && !TEST_IS_IGNORED) \ - { \ - tearDown(); \ - } \ - UnityConcludeTest(); \ -} - -/*=======Automagically Detected Files To Include=====*/ -#include "unity.h" -#include -#include -#include "CException.h" -#include "two.h" -#include "three.h" -#include -#include "funky.h" -#include "stanky.h" -#include - -/*=======External Functions This Runner Calls=====*/ -extern void setUp(void); -extern void tearDown(void); -extern void test_TheFirstThingToTest(void); -extern void test_TheSecondThingToTest(void); -extern void test_TheThirdThingToTest(void); -extern void test_TheFourthThingToTest(void); - - -/*=======Suite Setup=====*/ -static int suite_setup(void) -{ -a_yaml_setup(); -} - -/*=======Test Reset Option=====*/ -void resetTest(void); -void resetTest(void) -{ - tearDown(); - setUp(); -} - - -/*=======MAIN=====*/ -int main(void) -{ - suite_setup(); - UnityBegin("testdata/testsample.c"); - RUN_TEST(test_TheFirstThingToTest, 21); - RUN_TEST(test_TheSecondThingToTest, 43); - RUN_TEST(test_TheThirdThingToTest, 53); - RUN_TEST(test_TheFourthThingToTest, 58); - - return (UnityEnd()); -} diff --git a/tests/unity/test/rakefile b/tests/unity/test/rakefile deleted file mode 100644 index 4a2f3d2..0000000 --- a/tests/unity/test/rakefile +++ /dev/null @@ -1,125 +0,0 @@ -# ========================================== -# Unity Project - A Test Framework for C -# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams -# [Released under MIT License. Please refer to license.txt for details] -# ========================================== - -UNITY_ROOT = File.expand_path(File.dirname(__FILE__)) + '/' -$verbose = false - -require 'rake' -require 'rake/clean' -require UNITY_ROOT + 'rakefile_helper' -require 'rspec/core/rake_task' - -TEMP_DIRS = [ - File.join(UNITY_ROOT, 'build'), - File.join(UNITY_ROOT, 'sandbox') -] - -TEMP_DIRS.each do |dir| - directory(dir) - CLOBBER.include(dir) -end - -task :prepare_for_tests => TEMP_DIRS - -include RakefileHelpers - -# Load proper GCC as defult configuration -DEFAULT_CONFIG_FILE = 'gcc_auto_stdint.yml' -configure_toolchain(DEFAULT_CONFIG_FILE) - -desc "Test unity with its own unit tests" -task :unit => [:prepare_for_tests] do - run_tests unit_test_files -end - -desc "Test unity's helper scripts" -task :scripts => [:prepare_for_tests] do - Dir['tests/test_*.rb'].each do |scriptfile| - require "./"+scriptfile - end -end - -desc "Run all rspecs" -RSpec::Core::RakeTask.new(:spec) do |t| - t.pattern = 'spec/**/*_spec.rb' -end - -desc "Generate test summary" -task :summary do - report_summary -end - -desc "Build and test Unity" -task :all => [:clean, :prepare_for_tests, :scripts, :unit, :style, :summary] -task :default => [:clobber, :all] -task :ci => [:no_color, :default] -task :cruise => [:no_color, :default] - -desc "Load configuration" -task :config, :config_file do |t, args| - configure_toolchain(args[:config_file]) -end - -task :no_color do - $colour_output = false -end - -task :verbose do - $verbose = true -end - -namespace :style do - desc "Check style" - task :check do - report "\nVERIFYING RUBY STYLE" - report execute("rubocop ../auto ../examples ../extras --config .rubocop.yml", true) - report "Styling Ruby:PASS" - end - - namespace :check do - Dir['../**/*.rb'].each do |f| - filename = File.basename(f, '.rb') - desc "Check Style of #{filename}" - task filename.to_sym => ['style:clean'] do - report execute("rubocop #{f} --color --config .rubocop.yml", true) - report "Style Checked for #{f}" - end - end - end - - desc "Fix Style of all C Code" - task :c do - run_astyle("../src/*.* ../extras/fixture/src/*.*") - end - - namespace :c do - Dir['../{src,extras/**}/*.{c,h}'].each do |f| - filename = File.basename(f)[0..-3] - desc "Check Style of #{filename}" - task filename.to_sym do - run_astyle f - end - end - end - - desc "Attempt to Autocorrect style" - task :auto => ['style:clean'] do - execute("rubocop ../auto ../examples ../extras --auto-correct --config .rubocop.yml") - report "Autocorrected What We Could." - end - - desc "Update style todo list" - task :todo => ['style:clean'] do - execute("rubocop ../auto ../examples ../extras --auto-gen-config --config .rubocop.yml") - report "Updated Style TODO List." - end - - task :clean do - File.delete(".rubocop_todo.yml") if File.exists?(".rubocop_todo.yml") - end -end - -task :style => ['style:check'] diff --git a/tests/unity/test/rakefile_helper.rb b/tests/unity/test/rakefile_helper.rb deleted file mode 100644 index 1fd60c5..0000000 --- a/tests/unity/test/rakefile_helper.rb +++ /dev/null @@ -1,260 +0,0 @@ -# ========================================== -# Unity Project - A Test Framework for C -# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams -# [Released under MIT License. Please refer to license.txt for details] -# ========================================== - -require 'yaml' -require 'fileutils' -require UNITY_ROOT + '../auto/unity_test_summary' -require UNITY_ROOT + '../auto/generate_test_runner' -require UNITY_ROOT + '../auto/colour_reporter' - -module RakefileHelpers - C_EXTENSION = '.c'.freeze - def load_configuration(config_file) - return if $configured - - $cfg_file = "targets/#{config_file}" unless config_file =~ /[\\|\/]/ - $cfg = YAML.load(File.read($cfg_file)) - $colour_output = false unless $cfg['colour'] - $configured = true if config_file != DEFAULT_CONFIG_FILE - end - - def configure_clean - CLEAN.include($cfg['compiler']['build_path'] + '*.*') unless $cfg['compiler']['build_path'].nil? - end - - def configure_toolchain(config_file = DEFAULT_CONFIG_FILE) - config_file += '.yml' unless config_file =~ /\.yml$/ - config_file = config_file unless config_file =~ /[\\|\/]/ - load_configuration(config_file) - configure_clean - end - - def unit_test_files - path = $cfg['compiler']['unit_tests_path'] + 'test*' + C_EXTENSION - path.tr!('\\', '/') - FileList.new(path) - end - - def local_include_dirs - include_dirs = $cfg['compiler']['includes']['items'].dup - include_dirs.delete_if { |dir| dir.is_a?(Array) } - include_dirs - end - - def extract_headers(filename) - includes = [] - lines = File.readlines(filename) - lines.each do |line| - m = line.match(/^\s*#include\s+\"\s*(.+\.[hH])\s*\"/) - includes << m[1] unless m.nil? - end - includes - end - - def find_source_file(header, paths) - paths.each do |dir| - src_file = dir + header.ext(C_EXTENSION) - return src_file if File.exist?(src_file) - end - nil - end - - def tackit(strings) - result = if strings.is_a?(Array) - "\"#{strings.join}\"" - else - strings - end - result - end - - def squash(prefix, items) - result = '' - items.each { |item| result += " #{prefix}#{tackit(item)}" } - result - end - - def should(behave, &block) - if block - puts 'Should ' + behave - yield block - else - puts "UNIMPLEMENTED CASE: Should #{behave}" - end - end - - def build_compiler_fields(inject_defines) - command = tackit($cfg['compiler']['path']) - defines = if $cfg['compiler']['defines']['items'].nil? - '' - else - squash($cfg['compiler']['defines']['prefix'], $cfg['compiler']['defines']['items'] + ['UNITY_OUTPUT_CHAR=putcharSpy'] + ['UNITY_OUTPUT_CHAR_HEADER_DECLARATION=putcharSpy\(int\)'] + inject_defines) - end - options = squash('', $cfg['compiler']['options']) - includes = squash($cfg['compiler']['includes']['prefix'], $cfg['compiler']['includes']['items']) - includes = includes.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) - - { :command => command, :defines => defines, :options => options, :includes => includes } - end - - def compile(file, defines = []) - compiler = build_compiler_fields(defines) - cmd_str = "#{compiler[:command]}#{compiler[:defines]}#{compiler[:options]}#{compiler[:includes]} #{file} " \ - "#{$cfg['compiler']['object_files']['prefix']}#{$cfg['compiler']['object_files']['destination']}" - obj_file = "#{File.basename(file, C_EXTENSION)}#{$cfg['compiler']['object_files']['extension']}" - execute(cmd_str + obj_file) - - obj_file - end - - def build_linker_fields - command = tackit($cfg['linker']['path']) - options = if $cfg['linker']['options'].nil? - '' - else - squash('', $cfg['linker']['options']) - end - includes = if $cfg['linker']['includes'].nil? || $cfg['linker']['includes']['items'].nil? - '' - else - squash($cfg['linker']['includes']['prefix'], $cfg['linker']['includes']['items']) - end.gsub(/\\ /, ' ').gsub(/\\\"/, '"').gsub(/\\$/, '') # Remove trailing slashes (for IAR) - - { :command => command, :options => options, :includes => includes } - end - - def link_it(exe_name, obj_list) - linker = build_linker_fields - cmd_str = "#{linker[:command]}#{linker[:options]}#{linker[:includes]} " + - (obj_list.map { |obj| "#{$cfg['linker']['object_files']['path']}#{obj} " }).join + - $cfg['linker']['bin_files']['prefix'] + ' ' + - $cfg['linker']['bin_files']['destination'] + - exe_name + $cfg['linker']['bin_files']['extension'] - execute(cmd_str) - end - - def build_simulator_fields - return nil if $cfg['simulator'].nil? - command = if $cfg['simulator']['path'].nil? - '' - else - (tackit($cfg['simulator']['path']) + ' ') - end - pre_support = if $cfg['simulator']['pre_support'].nil? - '' - else - squash('', $cfg['simulator']['pre_support']) - end - post_support = if $cfg['simulator']['post_support'].nil? - '' - else - squash('', $cfg['simulator']['post_support']) - end - - { :command => command, :pre_support => pre_support, :post_support => post_support } - end - - def run_astyle(style_what) - report "Styling C Code..." - command = "AStyle " \ - "--style=allman --indent=spaces=4 --indent-switches --indent-preproc-define --indent-preproc-block " \ - "--pad-oper --pad-comma --unpad-paren --pad-header " \ - "--align-pointer=type --align-reference=name " \ - "--add-brackets --mode=c --suffix=none " \ - "#{style_what}" - execute(command, false) - report "Styling C:PASS" - end - - def execute(command_string, ok_to_fail = false) - report command_string if $verbose - output = `#{command_string}`.chomp - report(output) if $verbose && !output.nil? && !output.empty? - raise "Command failed. (Returned #{$?.exitstatus})" if !$?.exitstatus.zero? && !ok_to_fail - output - end - - def report_summary - summary = UnityTestSummary.new - summary.root = UNITY_ROOT - results_glob = "#{$cfg['compiler']['build_path']}*.test*" - results_glob.tr!('\\', '/') - results = Dir[results_glob] - summary.targets = results - report summary.run - end - - def run_tests(test_files) - report 'Running Unity system tests...' - - # Tack on TEST define for compiling unit tests - load_configuration($cfg_file) - test_defines = ['TEST'] - $cfg['compiler']['defines']['items'] ||= [] - $cfg['compiler']['defines']['items'] << 'TEST' - - include_dirs = local_include_dirs - - # Build and execute each unit test - test_files.each do |test| - obj_list = [] - - unless $cfg['compiler']['aux_sources'].nil? - $cfg['compiler']['aux_sources'].each do |aux| - obj_list << compile(aux, test_defines) - end - end - - # Detect dependencies and build required modules - extract_headers(test).each do |header| - # Compile corresponding source file if it exists - src_file = find_source_file(header, include_dirs) - - obj_list << compile(src_file, test_defines) unless src_file.nil? - end - - # Build the test runner (generate if configured to do so) - test_base = File.basename(test, C_EXTENSION) - - runner_name = test_base + '_Runner.c' - - runner_path = if $cfg['compiler']['runner_path'].nil? - $cfg['compiler']['build_path'] + runner_name - else - $cfg['compiler']['runner_path'] + runner_name - end - - options = $cfg[:unity] - options[:use_param_tests] = test =~ /parameterized/ ? true : false - UnityTestRunnerGenerator.new(options).run(test, runner_path) - obj_list << compile(runner_path, test_defines) - - # Build the test module - obj_list << compile(test, test_defines) - - # Link the test executable - link_it(test_base, obj_list) - - # Execute unit test and generate results file - simulator = build_simulator_fields - executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] - cmd_str = if simulator.nil? - executable - else - "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" - end - output = execute(cmd_str) - test_results = $cfg['compiler']['build_path'] + test_base - if output.match(/OK$/m).nil? - test_results += '.testfail' - else - report output unless $verbose # Verbose already prints this line, as does a failure - test_results += '.testpass' - end - File.open(test_results, 'w') { |f| f.print output } - end - end -end diff --git a/tests/unity/test/spec/generate_module_existing_file_spec.rb b/tests/unity/test/spec/generate_module_existing_file_spec.rb deleted file mode 100644 index 74e7fc8..0000000 --- a/tests/unity/test/spec/generate_module_existing_file_spec.rb +++ /dev/null @@ -1,158 +0,0 @@ - -require '../auto/generate_module.rb' -require 'fileutils' - -def touch_src(file) - FileUtils.touch "sandbox/src/#{file}" -end - -def touch_test(file) - FileUtils.touch "sandbox/test/#{file}" -end - -def create_src_with_known_content(file) - File.open("sandbox/src/#{file}", "w") {|f| f.write("the original #{file}")} -end - -def create_test_with_known_content(file) - File.open("sandbox/test/#{file}", "w") {|f| f.write("the original #{file}")} -end - -def expect_src_content_didnt_change(file) - expect(File.read("sandbox/src/#{file}")).to eq("the original #{file}") -end - -def expect_test_content_didnt_change(file) - expect(File.read("sandbox/test/#{file}")).to eq("the original #{file}") -end - -def expect_src_file_to_exist(file) - expect(File.exist?("sandbox/src/#{file}")).to be true -end - -def expect_test_file_to_exist(file) - expect(File.exist?("sandbox/test/#{file}")).to be true -end - -describe "UnityModuleGenerator" do - - before do - # clean sandbox and setup our "project" folders - FileUtils.rm_rf "sandbox" - FileUtils.mkdir_p "sandbox" - FileUtils.mkdir_p "sandbox/src" - FileUtils.mkdir_p "sandbox/test" - - @options = { - :path_src => "sandbox/src", - :path_tst => "sandbox/test", - } - end - - context "with src pattern" do - before do - @options[:pattern] = "src" - end - - it "fails when all files already exist" do - # create an existing triad of files - touch_src "meh.c" - touch_src "meh.h" - touch_test "Testmeh.c" - expect { - UnityModuleGenerator.new(@options).generate("meh") - }.to raise_error("ERROR: File meh already exists. Exiting.") - end - - it "creates the test file if the source and header files exist" do - # Create the existing files. - touch_src "meh.c" - touch_src "meh.h" - - UnityModuleGenerator.new(@options).generate("meh") - - expect_test_file_to_exist "Testmeh.c" - end - - it "does not alter existing files" do - # Create some files with known content. - create_src_with_known_content "meh.c" - create_src_with_known_content "meh.h" - - UnityModuleGenerator.new(@options).generate("meh") - - expect_src_content_didnt_change "meh.c" - expect_src_content_didnt_change "meh.c" - end - - it "does not alter existing test files" do - # Create some files with known content. - create_test_with_known_content "Testmeh.c" - - UnityModuleGenerator.new(@options).generate("meh") - - expect_test_content_didnt_change "Testmeh.c" - end - - end - - context "with mch pattern" do - before do - @options[:pattern] = "mch" - end - - it "fails when all files exist" do - touch_src "meh_model.c" - touch_src "meh_conductor.c" - touch_src "meh_hardware.c" - touch_src "meh_model.h" - touch_src "meh_conductor.h" - touch_src "meh_hardware.h" - touch_test "Testmeh_model.c" - touch_test "Testmeh_conductor.c" - touch_test "Testmeh_hardware.c" - expect { - UnityModuleGenerator.new(@options).generate("meh") - }.to raise_error("ERROR: File meh_model already exists. Exiting.") - end - - it "creates files that don't exist" do - touch_src "meh_model.c" - touch_src "meh_conductor.c" - touch_src "meh_hardware.c" - touch_src "meh_model.h" - touch_src "meh_conductor.h" - - UnityModuleGenerator.new(@options).generate("meh") - - expect_src_file_to_exist "meh_hardware.h" - expect_test_file_to_exist "Testmeh_model.c" - expect_test_file_to_exist "Testmeh_conductor.c" - expect_test_file_to_exist "Testmeh_hardware.c" - end - - it "does not alter existing source files" do - create_src_with_known_content "meh_model.c" - create_src_with_known_content "meh_model.c" - create_src_with_known_content "meh_model.c" - create_src_with_known_content "meh_model.h" - create_src_with_known_content "meh_model.c" - - UnityModuleGenerator.new(@options).generate("meh") - - expect_src_content_didnt_change "meh_model.c" - expect_src_content_didnt_change "meh_model.c" - expect_src_content_didnt_change "meh_model.c" - expect_src_content_didnt_change "meh_model.c" - end - - it "does not alter existing test files" do - create_test_with_known_content "Testmeh_model.c" - - UnityModuleGenerator.new(@options).generate("meh") - - expect_test_content_didnt_change "Testmeh_model.c" - end - - end -end diff --git a/tests/unity/test/targets/clang_file.yml b/tests/unity/test/targets/clang_file.yml deleted file mode 100644 index df1bd24..0000000 --- a/tests/unity/test/targets/clang_file.yml +++ /dev/null @@ -1,78 +0,0 @@ ---- -compiler: - path: clang - source_path: '../src/' - unit_tests_path: &unit_tests_path 'tests/' - build_path: &build_path 'build/' - options: - - '-c' - - '-Wall' - - '-Wextra' - - '-Werror' - - '-Wcast-qual' - - '-Wconversion' - - '-Wdisabled-optimization' - - '-Wformat=2' - - '-Winit-self' - - '-Winline' - - '-Winvalid-pch' - - '-Wmissing-include-dirs' - - '-Wnonnull' - - '-Wpacked' - - '-Wpointer-arith' - - '-Wswitch-default' - - '-Wstrict-aliasing' - - '-Wstrict-overflow=5' - - '-Wuninitialized' - - '-Wunused' -# - '-Wunreachable-code' - - '-Wreturn-type' - - '-Wshadow' - - '-Wundef' - - '-Wwrite-strings' - - '-Wno-nested-externs' - - '-Wno-unused-parameter' - - '-Wno-variadic-macros' - - '-Wbad-function-cast' - - '-fms-extensions' - - '-fno-omit-frame-pointer' - - '-ffloat-store' - - '-fno-common' - - '-fstrict-aliasing' - - '-std=gnu99' - - '-pedantic' - - '-O0' - includes: - prefix: '-I' - items: - - 'src/' - - '../src/' - - 'testdata/' - - *unit_tests_path - defines: - prefix: '-D' - items: - - UNITY_INCLUDE_DOUBLE - - UNITY_SUPPORT_64 - - UNITY_OUTPUT_RESULTS_FILE - object_files: - prefix: '-o' - extension: '.o' - destination: *build_path -linker: - path: clang - options: - - -lm - - '-m64' - includes: - prefix: '-I' - object_files: - path: *build_path - extension: '.o' - bin_files: - prefix: '-o' - extension: '.exe' - destination: *build_path -colour: true -:unity: - :plugins: [] diff --git a/tests/unity/test/targets/clang_strict.yml b/tests/unity/test/targets/clang_strict.yml deleted file mode 100644 index ee05b2a..0000000 --- a/tests/unity/test/targets/clang_strict.yml +++ /dev/null @@ -1,78 +0,0 @@ ---- -compiler: - path: clang - source_path: '../src/' - unit_tests_path: &unit_tests_path 'tests/' - build_path: &build_path 'build/' - options: - - '-c' - - '-Wall' - - '-Wextra' - - '-Werror' - - '-Wcast-qual' - - '-Wconversion' - - '-Wdisabled-optimization' - - '-Wformat=2' - - '-Winit-self' - - '-Winline' - - '-Winvalid-pch' - - '-Wmissing-include-dirs' - - '-Wnonnull' - - '-Wpacked' - - '-Wpointer-arith' - - '-Wswitch-default' - - '-Wstrict-aliasing' - - '-Wstrict-overflow=5' - - '-Wuninitialized' - - '-Wunused' -# - '-Wunreachable-code' - - '-Wreturn-type' - - '-Wshadow' - - '-Wundef' - - '-Wwrite-strings' - - '-Wno-nested-externs' - - '-Wno-unused-parameter' - - '-Wno-variadic-macros' - - '-Wbad-function-cast' - - '-fms-extensions' - - '-fno-omit-frame-pointer' - #- '-ffloat-store' - - '-fno-common' - - '-fstrict-aliasing' - - '-std=gnu99' - - '-pedantic' - - '-O0' - includes: - prefix: '-I' - items: - - 'src/' - - '../src/' - - 'testdata/' - - *unit_tests_path - defines: - prefix: '-D' - items: - - UNITY_INCLUDE_DOUBLE - - UNITY_SUPPORT_TEST_CASES - - UNITY_SUPPORT_64 - object_files: - prefix: '-o' - extension: '.o' - destination: *build_path -linker: - path: clang - options: - - -lm - - '-m64' - includes: - prefix: '-I' - object_files: - path: *build_path - extension: '.o' - bin_files: - prefix: '-o' - extension: '.exe' - destination: *build_path -colour: true -:unity: - :plugins: [] diff --git a/tests/unity/test/targets/gcc_32.yml b/tests/unity/test/targets/gcc_32.yml deleted file mode 100644 index ec1165d..0000000 --- a/tests/unity/test/targets/gcc_32.yml +++ /dev/null @@ -1,49 +0,0 @@ -compiler: - path: gcc - source_path: '../src/' - unit_tests_path: &unit_tests_path 'tests/' - build_path: &build_path 'build/' - options: - - '-c' - - '-m32' - - '-Wall' - - '-Wno-address' - - '-std=c99' - - '-pedantic' - includes: - prefix: '-I' - items: - - 'src/' - - '../src/' - - 'testdata/' - - *unit_tests_path - defines: - prefix: '-D' - items: - - UNITY_EXCLUDE_STDINT_H - - UNITY_EXCLUDE_LIMITS_H - - UNITY_INCLUDE_DOUBLE - - UNITY_SUPPORT_TEST_CASES - - UNITY_INT_WIDTH=32 - - UNITY_LONG_WIDTH=32 - object_files: - prefix: '-o' - extension: '.o' - destination: *build_path -linker: - path: gcc - options: - - -lm - - '-m32' - includes: - prefix: '-I' - object_files: - path: *build_path - extension: '.o' - bin_files: - prefix: '-o' - extension: '.exe' - destination: *build_path -colour: true -:unity: - :plugins: [] diff --git a/tests/unity/test/targets/gcc_64.yml b/tests/unity/test/targets/gcc_64.yml deleted file mode 100644 index 0e273de..0000000 --- a/tests/unity/test/targets/gcc_64.yml +++ /dev/null @@ -1,50 +0,0 @@ -compiler: - path: gcc - source_path: '../src/' - unit_tests_path: &unit_tests_path 'tests/' - build_path: &build_path 'build/' - options: - - '-c' - - '-m64' - - '-Wall' - - '-Wno-address' - - '-std=c99' - - '-pedantic' - includes: - prefix: '-I' - items: - - 'src/' - - '../src/' - - 'testdata/' - - *unit_tests_path - defines: - prefix: '-D' - items: - - UNITY_EXCLUDE_STDINT_H - - UNITY_EXCLUDE_LIMITS_H - - UNITY_INCLUDE_DOUBLE - - UNITY_SUPPORT_TEST_CASES - - UNITY_SUPPORT_64 - - UNITY_INT_WIDTH=32 - - UNITY_LONG_WIDTH=64 - object_files: - prefix: '-o' - extension: '.o' - destination: *build_path -linker: - path: gcc - options: - - -lm - - '-m64' - includes: - prefix: '-I' - object_files: - path: *build_path - extension: '.o' - bin_files: - prefix: '-o' - extension: '.exe' - destination: *build_path -colour: true -:unity: - :plugins: [] diff --git a/tests/unity/test/targets/gcc_auto_limits.yml b/tests/unity/test/targets/gcc_auto_limits.yml deleted file mode 100644 index 40088ac..0000000 --- a/tests/unity/test/targets/gcc_auto_limits.yml +++ /dev/null @@ -1,47 +0,0 @@ -compiler: - path: gcc - source_path: '../src/' - unit_tests_path: &unit_tests_path 'tests/' - build_path: &build_path 'build/' - options: - - '-c' - - '-m64' - - '-Wall' - - '-Wno-address' - - '-std=c99' - - '-pedantic' - includes: - prefix: '-I' - items: - - 'src/' - - '../src/' - - 'testdata/' - - *unit_tests_path - defines: - prefix: '-D' - items: - - UNITY_EXCLUDE_STDINT_H - - UNITY_INCLUDE_DOUBLE - - UNITY_SUPPORT_TEST_CASES - - UNITY_SUPPORT_64 - object_files: - prefix: '-o' - extension: '.o' - destination: *build_path -linker: - path: gcc - options: - - -lm - - '-m64' - includes: - prefix: '-I' - object_files: - path: *build_path - extension: '.o' - bin_files: - prefix: '-o' - extension: '.exe' - destination: *build_path -colour: true -:unity: - :plugins: [] diff --git a/tests/unity/test/targets/gcc_auto_stdint.yml b/tests/unity/test/targets/gcc_auto_stdint.yml deleted file mode 100644 index f12165c..0000000 --- a/tests/unity/test/targets/gcc_auto_stdint.yml +++ /dev/null @@ -1,59 +0,0 @@ -compiler: - path: gcc - source_path: '../src/' - unit_tests_path: &unit_tests_path 'tests/' - build_path: &build_path 'build/' - options: - - '-c' - - '-m64' - - '-Wall' - - '-Wno-address' - - '-std=c99' - - '-pedantic' - - '-Wextra' - - '-Werror' - - '-Wpointer-arith' - - '-Wcast-align' - - '-Wwrite-strings' - - '-Wswitch-default' - - '-Wunreachable-code' - - '-Winit-self' - - '-Wmissing-field-initializers' - - '-Wno-unknown-pragmas' - - '-Wstrict-prototypes' - - '-Wundef' - - '-Wold-style-definition' - includes: - prefix: '-I' - items: - - 'src/' - - '../src/' - - 'testdata/' - - *unit_tests_path - defines: - prefix: '-D' - items: - - UNITY_INCLUDE_DOUBLE - - UNITY_SUPPORT_TEST_CASES - - UNITY_SUPPORT_64 - object_files: - prefix: '-o' - extension: '.o' - destination: *build_path -linker: - path: gcc - options: - - -lm - - '-m64' - includes: - prefix: '-I' - object_files: - path: *build_path - extension: '.o' - bin_files: - prefix: '-o' - extension: '.exe' - destination: *build_path -colour: true -:unity: - :plugins: [] diff --git a/tests/unity/test/targets/gcc_manual_math.yml b/tests/unity/test/targets/gcc_manual_math.yml deleted file mode 100644 index b379e3f..0000000 --- a/tests/unity/test/targets/gcc_manual_math.yml +++ /dev/null @@ -1,47 +0,0 @@ -compiler: - path: gcc - source_path: '../src/' - unit_tests_path: &unit_tests_path 'tests/' - build_path: &build_path 'build/' - options: - - '-c' - - '-m64' - - '-Wall' - - '-Wno-address' - - '-std=c99' - - '-pedantic' - includes: - prefix: '-I' - items: - - 'src/' - - '../src/' - - 'testdata/' - - *unit_tests_path - defines: - prefix: '-D' - items: - - UNITY_EXCLUDE_MATH_H - - UNITY_INCLUDE_DOUBLE - - UNITY_SUPPORT_TEST_CASES - - UNITY_SUPPORT_64 - object_files: - prefix: '-o' - extension: '.o' - destination: *build_path -linker: - path: gcc - options: - - -lm - - '-m64' - includes: - prefix: '-I' - object_files: - path: *build_path - extension: '.o' - bin_files: - prefix: '-o' - extension: '.exe' - destination: *build_path -colour: true -:unity: - :plugins: [] diff --git a/tests/unity/test/targets/hitech_picc18.yml b/tests/unity/test/targets/hitech_picc18.yml deleted file mode 100644 index 2fd4aa3..0000000 --- a/tests/unity/test/targets/hitech_picc18.yml +++ /dev/null @@ -1,101 +0,0 @@ -# rumor has it that this yaml file works for the standard edition of the -# hitech PICC18 compiler, but not the pro version. -# -compiler: - path: cd build && picc18 - source_path: '..\src\' - unit_tests_path: &unit_tests_path 'tests\' - build_path: &build_path 'build\' - options: - - --chip=18F87J10 - - --ide=hitide - - --q #quiet please - - --asmlist - - --codeoffset=0 - - --emi=wordwrite # External memory interface protocol - - --warn=0 # allow all normal warning messages - - --errors=10 # Number of errors before aborting compile - - --char=unsigned - - -Bl # Large memory model - - -G # generate symbol file - - --cp=16 # 16-bit pointers - - --double=24 - - -N255 # 255-char symbol names - - --opt=none # Do not use any compiler optimziations - - -c # compile only - - -M - includes: - prefix: '-I' - items: - - 'c:/Projects/NexGen/Prototypes/CMockTest/src/' - - 'c:/Projects/NexGen/Prototypes/CMockTest/mocks/' - - 'c:/CMock/src/' - - 'c:/CMock/examples/src/' - - 'c:/CMock/vendor/unity/src/' - - 'c:/CMock/vendor/unity/examples/helper/' - - *unit_tests_path - defines: - prefix: '-D' - items: - - UNITY_INT_WIDTH=16 - - UNITY_POINTER_WIDTH=16 - - CMOCK_MEM_STATIC - - CMOCK_MEM_SIZE=3000 - - UNITY_SUPPORT_TEST_CASES - - _PICC18 - object_files: - # prefix: '-O' # Hi-Tech doesn't want a prefix. They key off of filename .extensions, instead - extension: '.obj' - destination: *build_path - -linker: - path: cd build && picc18 - options: - - --chip=18F87J10 - - --ide=hitide - - --cp=24 # 24-bit pointers. Is this needed for linker?? - - --double=24 # Is this needed for linker?? - - -Lw # Scan the pic87*w.lib in the lib/ of the compiler installation directory - - --summary=mem,file # info listing - - --summary=+psect - - --summary=+hex - - --output=+intel - - --output=+mcof - - --runtime=+init # Directs startup code to copy idata, ibigdata and ifardata psects from ROM to RAM. - - --runtime=+clear # Directs startup code to clear bss, bigbss, rbss and farbss psects - - --runtime=+clib # link in the c-runtime - - --runtime=+keep # Keep the generated startup src after its obj is linked - - -G # Generate src-level symbol file - - -MIWasTheLastToBuild.map - - --warn=0 # allow all normal warning messages - - -Bl # Large memory model (probably not needed for linking) - includes: - prefix: '-I' - object_files: - path: *build_path - extension: '.obj' - bin_files: - prefix: '-O' - extension: '.hex' - destination: *build_path - -simulator: - path: - pre_support: - - 'java -client -jar ' # note space - - ['C:\Program Files\HI-TECH Software\HI-TIDE\3.15\lib\', 'simpic18.jar'] - - 18F87J10 - post_support: - -:cmock: - :plugins: [] - :includes: - - Types.h - :suite_teardown: | - if (num_failures) - _FAILED_TEST(); - else - _PASSED_TESTS(); - return 0; - -colour: true diff --git a/tests/unity/test/targets/iar_arm_v4.yml b/tests/unity/test/targets/iar_arm_v4.yml deleted file mode 100644 index 2f9f881..0000000 --- a/tests/unity/test/targets/iar_arm_v4.yml +++ /dev/null @@ -1,90 +0,0 @@ -tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 4.0 Kickstart\' -compiler: - path: [*tools_root, 'arm\bin\iccarm.exe'] - source_path: '..\src\' - unit_tests_path: &unit_tests_path 'tests\' - build_path: &build_path 'build\' - options: - - --dlib_config - - [*tools_root, 'arm\lib\dl4tptinl8n.h'] - - -z3 - - --no_cse - - --no_unroll - - --no_inline - - --no_code_motion - - --no_tbaa - - --no_clustering - - --no_scheduling - - --debug - - --cpu_mode thumb - - --endian little - - --cpu ARM7TDMI - - --stack_align 4 - - --interwork - - -e - - --silent - - --warnings_are_errors - - --fpu None - - --diag_suppress Pa050 - includes: - prefix: '-I' - items: - - [*tools_root, 'arm\inc\'] - - 'src\' - - '..\src\' - - 'testdata/' - - *unit_tests_path - - 'vendor\unity\src\' - defines: - prefix: '-D' - items: - - UNITY_SUPPORT_64 - - 'UNITY_SUPPORT_TEST_CASES' - object_files: - prefix: '-o' - extension: '.r79' - destination: *build_path -linker: - path: [*tools_root, 'common\bin\xlink.exe'] - options: - - -rt - - [*tools_root, 'arm\lib\dl4tptinl8n.r79'] - - -D_L_EXTMEM_START=0 - - -D_L_EXTMEM_SIZE=0 - - -D_L_HEAP_SIZE=120 - - -D_L_STACK_SIZE=32 - - -e_small_write=_formatted_write - - -s - - __program_start - - -f - - [*tools_root, '\arm\config\lnkarm.xcl'] - includes: - prefix: '-I' - items: - - [*tools_root, 'arm\config\'] - - [*tools_root, 'arm\lib\'] - object_files: - path: *build_path - extension: '.r79' - bin_files: - prefix: '-o' - extension: '.d79' - destination: *build_path -simulator: - path: [*tools_root, 'common\bin\CSpyBat.exe'] - pre_support: - - --silent - - [*tools_root, 'arm\bin\armproc.dll'] - - [*tools_root, 'arm\bin\armsim.dll'] - post_support: - - --plugin - - [*tools_root, 'arm\bin\armbat.dll'] - - --backend - - -B - - -p - - [*tools_root, 'arm\config\ioat91sam7X256.ddf'] - - -d - - sim -colour: true -:unity: - :plugins: [] diff --git a/tests/unity/test/targets/iar_arm_v5.yml b/tests/unity/test/targets/iar_arm_v5.yml deleted file mode 100644 index 223f1a6..0000000 --- a/tests/unity/test/targets/iar_arm_v5.yml +++ /dev/null @@ -1,80 +0,0 @@ -tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' -compiler: - path: [*tools_root, 'arm\bin\iccarm.exe'] - source_path: '..\src\' - unit_tests_path: &unit_tests_path 'tests\' - build_path: &build_path 'build\' - options: - - --dlib_config - - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] - - --no_cse - - --no_unroll - - --no_inline - - --no_code_motion - - --no_tbaa - - --no_clustering - - --no_scheduling - - --debug - - --cpu_mode thumb - - --endian=little - - --cpu=ARM7TDMI - - --interwork - - --warnings_are_errors - - --fpu=None - - --diag_suppress=Pa050 - - --diag_suppress=Pe111 - - -e - - -On - includes: - prefix: '-I' - items: - - [*tools_root, 'arm\inc\'] - - 'src\' - - '..\src\' - - 'testdata/' - - *unit_tests_path - - 'vendor\unity\src\' - - 'iar\iar_v5\incIAR\' - defines: - prefix: '-D' - items: - - UNITY_SUPPORT_64 - - 'UNITY_SUPPORT_TEST_CASES' - object_files: - prefix: '-o' - extension: '.r79' - destination: *build_path -linker: - path: [*tools_root, 'arm\bin\ilinkarm.exe'] - options: - - --redirect _Printf=_PrintfLarge - - --redirect _Scanf=_ScanfSmall - - --semihosting - - --entry __iar_program_start - - --config - - [*tools_root, 'arm\config\generic.icf'] - object_files: - path: *build_path - extension: '.o' - bin_files: - prefix: '-o' - extension: '.out' - destination: *build_path -simulator: - path: [*tools_root, 'common\bin\CSpyBat.exe'] - pre_support: - - --silent - - [*tools_root, 'arm\bin\armproc.dll'] - - [*tools_root, 'arm\bin\armsim.dll'] - post_support: - - --plugin - - [*tools_root, 'arm\bin\armbat.dll'] - - --backend - - -B - - -p - - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] - - -d - - sim -colour: true -:unity: - :plugins: [] diff --git a/tests/unity/test/targets/iar_arm_v5_3.yml b/tests/unity/test/targets/iar_arm_v5_3.yml deleted file mode 100644 index 223f1a6..0000000 --- a/tests/unity/test/targets/iar_arm_v5_3.yml +++ /dev/null @@ -1,80 +0,0 @@ -tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3\' -compiler: - path: [*tools_root, 'arm\bin\iccarm.exe'] - source_path: '..\src\' - unit_tests_path: &unit_tests_path 'tests\' - build_path: &build_path 'build\' - options: - - --dlib_config - - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] - - --no_cse - - --no_unroll - - --no_inline - - --no_code_motion - - --no_tbaa - - --no_clustering - - --no_scheduling - - --debug - - --cpu_mode thumb - - --endian=little - - --cpu=ARM7TDMI - - --interwork - - --warnings_are_errors - - --fpu=None - - --diag_suppress=Pa050 - - --diag_suppress=Pe111 - - -e - - -On - includes: - prefix: '-I' - items: - - [*tools_root, 'arm\inc\'] - - 'src\' - - '..\src\' - - 'testdata/' - - *unit_tests_path - - 'vendor\unity\src\' - - 'iar\iar_v5\incIAR\' - defines: - prefix: '-D' - items: - - UNITY_SUPPORT_64 - - 'UNITY_SUPPORT_TEST_CASES' - object_files: - prefix: '-o' - extension: '.r79' - destination: *build_path -linker: - path: [*tools_root, 'arm\bin\ilinkarm.exe'] - options: - - --redirect _Printf=_PrintfLarge - - --redirect _Scanf=_ScanfSmall - - --semihosting - - --entry __iar_program_start - - --config - - [*tools_root, 'arm\config\generic.icf'] - object_files: - path: *build_path - extension: '.o' - bin_files: - prefix: '-o' - extension: '.out' - destination: *build_path -simulator: - path: [*tools_root, 'common\bin\CSpyBat.exe'] - pre_support: - - --silent - - [*tools_root, 'arm\bin\armproc.dll'] - - [*tools_root, 'arm\bin\armsim.dll'] - post_support: - - --plugin - - [*tools_root, 'arm\bin\armbat.dll'] - - --backend - - -B - - -p - - [*tools_root, 'arm\config\debugger\atmel\ioat91sam7X256.ddf'] - - -d - - sim -colour: true -:unity: - :plugins: [] diff --git a/tests/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml b/tests/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml deleted file mode 100644 index c79bacf..0000000 --- a/tests/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +++ /dev/null @@ -1,94 +0,0 @@ -#Default tool path for IAR 5.4 on Windows XP 64bit -tools_root: &tools_root 'C:\Program Files (x86)\IAR Systems\Embedded Workbench 5.4 Kickstart\' -compiler: - path: [*tools_root, 'arm\bin\iccarm.exe'] - source_path: '..\src\' - unit_tests_path: &unit_tests_path 'tests\' - build_path: &build_path 'build\' - options: - - --diag_suppress=Pa050 - #- --diag_suppress=Pe111 - - --debug - - --endian=little - - --cpu=Cortex-M3 - - --no_path_in_file_macros - - -e - - --fpu=None - - --dlib_config - - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] - #- --preinclude --preinclude C:\Vss\T2 Working\common\system.h - - --interwork - - --warnings_are_errors -# - Ohz - - -Oh -# - --no_cse -# - --no_unroll -# - --no_inline -# - --no_code_motion -# - --no_tbaa -# - --no_clustering -# - --no_scheduling - - includes: - prefix: '-I' - items: - - [*tools_root, 'arm\inc\'] - - 'src\' - - '..\src\' - - 'testdata/' - - *unit_tests_path - - 'vendor\unity\src\' - - 'iar\iar_v5\incIAR\' - defines: - prefix: '-D' - items: - - ewarm - - PART_LM3S9B92 - - TARGET_IS_TEMPEST_RB1 - - USE_ROM_DRIVERS - - UART_BUFFERED - - UNITY_SUPPORT_64 - object_files: - prefix: '-o' - extension: '.r79' - destination: *build_path -linker: - path: [*tools_root, 'arm\bin\ilinkarm.exe'] - options: - - --redirect _Printf=_PrintfLarge - - --redirect _Scanf=_ScanfSmall - - --semihosting - - --entry __iar_program_start - - --config - - [*tools_root, 'arm\config\generic.icf'] -# - ['C:\Temp\lm3s9b92.icf'] - object_files: - path: *build_path - extension: '.o' - bin_files: - prefix: '-o' - extension: '.out' - destination: *build_path -simulator: - path: [*tools_root, 'common\bin\CSpyBat.exe'] - pre_support: - #- --silent - - [*tools_root, 'arm\bin\armproc.dll'] - - [*tools_root, 'arm\bin\armsim2.dll'] - post_support: - - --plugin - - [*tools_root, 'arm\bin\armbat.dll'] - - --backend - - -B - - --endian=little - - --cpu=Cortex-M3 - - --fpu=None - - -p - - [*tools_root, 'arm\config\debugger\TexasInstruments\iolm3sxxxx.ddf'] - - --semihosting - - --device=LM3SxBxx - #- -d - #- sim -colour: true -:unity: - :plugins: [] diff --git a/tests/unity/test/targets/iar_cortexm3_v5.yml b/tests/unity/test/targets/iar_cortexm3_v5.yml deleted file mode 100644 index 973de94..0000000 --- a/tests/unity/test/targets/iar_cortexm3_v5.yml +++ /dev/null @@ -1,84 +0,0 @@ -# unit testing under iar compiler / simulator for STM32 Cortex-M3 - -tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.4\' -compiler: - path: [*tools_root, 'arm\bin\iccarm.exe'] - source_path: '..\src\' - unit_tests_path: &unit_tests_path 'tests\' - build_path: &build_path 'build\' - options: - - --dlib_config - - [*tools_root, 'arm\inc\DLib_Config_Normal.h'] - - --no_cse - - --no_unroll - - --no_inline - - --no_code_motion - - --no_tbaa - - --no_clustering - - --no_scheduling - - --debug - - --cpu_mode thumb - - --endian=little - - --cpu=Cortex-M3 - - --interwork - - --warnings_are_errors - - --fpu=None - - --diag_suppress=Pa050 - - --diag_suppress=Pe111 - - -e - - -On - includes: - prefix: '-I' - items: - - [*tools_root, 'arm\inc\'] - - 'src\' - - '..\src\' - - 'testdata/' - - *unit_tests_path - - 'vendor\unity\src\' - - 'iar\iar_v5\incIAR\' - defines: - prefix: '-D' - items: - - 'IAR' - - 'UNITY_SUPPORT_64' - - 'UNITY_SUPPORT_TEST_CASES' - object_files: - prefix: '-o' - extension: '.r79' - destination: *build_path -linker: - path: [*tools_root, 'arm\bin\ilinkarm.exe'] - options: - - --redirect _Printf=_PrintfLarge - - --redirect _Scanf=_ScanfSmall - - --semihosting - - --entry __iar_program_start - - --config - - [*tools_root, 'arm\config\generic_cortex.icf'] - object_files: - path: *build_path - extension: '.o' - bin_files: - prefix: '-o' - extension: '.out' - destination: *build_path -simulator: - path: [*tools_root, 'common\bin\CSpyBat.exe'] - pre_support: - - --silent - - [*tools_root, 'arm\bin\armproc.dll'] - - [*tools_root, 'arm\bin\armsim.dll'] - post_support: - - --plugin - - [*tools_root, 'arm\bin\armbat.dll'] - - --backend - - -B - - -p - - [*tools_root, 'arm\config\debugger\ST\iostm32f107xx.ddf'] - - --cpu=Cortex-M3 - - -d - - sim -colour: true -:unity: - :plugins: [] diff --git a/tests/unity/test/targets/iar_msp430.yml b/tests/unity/test/targets/iar_msp430.yml deleted file mode 100644 index 4563af9..0000000 --- a/tests/unity/test/targets/iar_msp430.yml +++ /dev/null @@ -1,95 +0,0 @@ -tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 5.3 MSP430\' -core_root: &core_root [*tools_root, '430\'] -core_bin: &core_bin [*core_root, 'bin\'] -core_config: &core_config [*core_root, 'config\'] -core_lib: &core_lib [*core_root, 'lib\'] -core_inc: &core_inc [*core_root, 'inc\'] -core_config: &core_config [*core_root, 'config\'] - -compiler: - path: [*core_bin, 'icc430.exe'] - source_path: '..\src\' - unit_tests_path: &unit_tests_path 'tests\' - build_path: &build_path 'build\' - options: - - --dlib_config - - [*core_lib, 'dlib\dl430fn.h'] - - --no_cse - - --no_unroll - - --no_inline - - --no_code_motion - - --no_tbaa - - --debug - - -e - - -Ol - - --multiplier=16 - - --double=32 - - --diag_suppress Pa050 - - --diag_suppress Pe111 - includes: - prefix: '-I' - items: - - *core_inc - - [*core_inc, 'dlib'] - - [*core_lib, 'dlib'] - - 'src\' - - '../src/' - - 'testdata/' - - *unit_tests_path - - 'vendor\unity\src' - defines: - prefix: '-D' - items: - - '__MSP430F149__' - - 'INT_WIDTH=16' - - 'UNITY_EXCLUDE_FLOAT' - - 'UNITY_SUPPORT_TEST_CASES' - object_files: - prefix: '-o' - extension: '.r43' - destination: *build_path -linker: - path: [*core_bin, 'xlink.exe'] - options: - - -rt - - [*core_lib, 'dlib\dl430fn.r43'] - - -e_PrintfTiny=_Printf - - -e_ScanfSmall=_Scanf - - -s __program_start - - -D_STACK_SIZE=50 - - -D_DATA16_HEAP_SIZE=50 - - -D_DATA20_HEAP_SIZE=50 - - -f - - [*core_config, 'lnk430f5438.xcl'] - - -f - - [*core_config, 'multiplier.xcl'] - includes: - prefix: '-I' - items: - - *core_config - - *core_lib - - [*core_lib, 'dlib'] - object_files: - path: *build_path - extension: '.r79' - bin_files: - prefix: '-o' - extension: '.d79' - destination: *build_path -simulator: - path: [*tools_root, 'common\bin\CSpyBat.exe'] - pre_support: - - --silent - - [*core_bin, '430proc.dll'] - - [*core_bin, '430sim.dll'] - post_support: - - --plugin - - [*core_bin, '430bat.dll'] - - --backend -B - - --cpu MSP430F5438 - - -p - - [*core_config, 'MSP430F5438.ddf'] - - -d sim -colour: true -:unity: - :plugins: [] diff --git a/tests/unity/test/targets/iar_sh2a_v6.yml b/tests/unity/test/targets/iar_sh2a_v6.yml deleted file mode 100644 index 27e6bee..0000000 --- a/tests/unity/test/targets/iar_sh2a_v6.yml +++ /dev/null @@ -1,86 +0,0 @@ -tools_root: &tools_root 'C:\Program Files\IAR Systems\Embedded Workbench 6.0\' -compiler: - path: [*tools_root, 'sh\bin\iccsh.exe'] - source_path: '..\src\' - unit_tests_path: &unit_tests_path 'tests\' - build_path: &build_path 'build\' - options: - - -e - - --char_is_signed - - -Ol - - --no_cse - - --no_unroll - - --no_inline - - --no_code_motion - - --no_tbaa - - --no_scheduling - - --no_clustering - - --debug - - --dlib_config - - [*tools_root, 'sh\inc\DLib_Product.h'] - - --double=32 - - --code_model=huge - - --data_model=huge - - --core=sh2afpu - - --warnings_affect_exit_code - - --warnings_are_errors - - --mfc - - --use_unix_directory_separators - - --diag_suppress=Pe161 - includes: - prefix: '-I' - items: - - [*tools_root, 'sh\inc\'] - - [*tools_root, 'sh\inc\c'] - - 'src\' - - '..\src\' - - 'testdata/' - - *unit_tests_path - - 'vendor\unity\src\' - defines: - prefix: '-D' - items: - - UNITY_SUPPORT_64 - - 'UNITY_SUPPORT_TEST_CASES' - object_files: - prefix: '-o' - extension: '.o' - destination: *build_path -linker: - path: [*tools_root, 'sh\bin\ilinksh.exe'] - options: - - --redirect __Printf=__PrintfSmall - - --redirect __Scanf=__ScanfSmall - - --config - - [*tools_root, 'sh\config\generic.icf'] - - --config_def _CSTACK_SIZE=0x800 - - --config_def _HEAP_SIZE=0x800 - - --config_def _INT_TABLE=0x10 - - --entry __iar_program_start - - --debug_lib - object_files: - path: *build_path - extension: '.o' - bin_files: - prefix: '-o' - extension: '.out' - destination: *build_path -simulator: - path: [*tools_root, 'common\bin\CSpyBat.exe'] - pre_support: - - --silent - - [*tools_root, 'sh\bin\shproc.dll'] - - [*tools_root, 'sh\bin\shsim.dll'] - post_support: - - --plugin - - [*tools_root, 'sh\bin\shbat.dll'] - - --backend - - -B - - --core sh2afpu - - -p - - [*tools_root, 'sh\config\debugger\io7264.ddf'] - - -d - - sim -colour: true -:unity: - :plugins: [] diff --git a/tests/unity/test/testdata/CException.h b/tests/unity/test/testdata/CException.h deleted file mode 100644 index 91ad3e1..0000000 --- a/tests/unity/test/testdata/CException.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef CEXCEPTION_H -#define CEXCEPTION_H - -#define CEXCEPTION_BEING_USED 1 - -#define CEXCEPTION_NONE 0 -#define CEXCEPTION_T int e = 1; (void) -#define Try if (e) -#define Catch(a) if (!a) - -#endif //CEXCEPTION_H diff --git a/tests/unity/test/testdata/Defs.h b/tests/unity/test/testdata/Defs.h deleted file mode 100644 index d3a90c0..0000000 --- a/tests/unity/test/testdata/Defs.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef DEF_H -#define DEF_H - -#define EXTERN_DECL - -extern int CounterSuiteSetup; - -#endif //DEF_H diff --git a/tests/unity/test/testdata/cmock.h b/tests/unity/test/testdata/cmock.h deleted file mode 100644 index c6149be..0000000 --- a/tests/unity/test/testdata/cmock.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef CMOCK_H -#define CMOCK_H - -int CMockMemFreeFinalCounter = 0; -int mockMock_Init_Counter = 0; -int mockMock_Verify_Counter = 0; -int mockMock_Destroy_Counter = 0; - -void CMock_Guts_MemFreeFinal(void) { CMockMemFreeFinalCounter++; } -void mockMock_Init(void) { mockMock_Init_Counter++; } -void mockMock_Verify(void) { mockMock_Verify_Counter++; } -void mockMock_Destroy(void) { mockMock_Destroy_Counter++; } - -#endif //CMOCK_H diff --git a/tests/unity/test/testdata/mockMock.h b/tests/unity/test/testdata/mockMock.h deleted file mode 100644 index 0a2c616..0000000 --- a/tests/unity/test/testdata/mockMock.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef MOCK_MOCK_H -#define MOCK_MOCK_H - -extern int mockMock_Init_Counter; -extern int mockMock_Verify_Counter; -extern int mockMock_Destroy_Counter; -extern int CMockMemFreeFinalCounter; - -void mockMock_Init(void); -void mockMock_Verify(void); -void mockMock_Destroy(void); - -#endif //MOCK_MOCK_H diff --git a/tests/unity/test/testdata/testRunnerGenerator.c b/tests/unity/test/testdata/testRunnerGenerator.c deleted file mode 100644 index e036dd9..0000000 --- a/tests/unity/test/testdata/testRunnerGenerator.c +++ /dev/null @@ -1,183 +0,0 @@ -/* This Test File Is Used To Verify Many Combinations Of Using the Generate Test Runner Script */ - -#include -#include "unity.h" -#include "Defs.h" - -#ifdef USE_CEXCEPTION -#include "CException.h" -#endif - -/* Notes about prefixes: - test - normal default prefix. these are "always run" tests for this procedure - spec - normal default prefix. required to run default setup/teardown calls. - should - normal default prefix. - qwiktest - custom prefix for when tests skip all setup/teardown calls. - custtest - custom prefix for when tests use custom setup/teardown calls. - paratest - custom prefix for when we want to verify parameterized tests. - extest - custom prefix only used during cexception - suitetest- custom prefix for when we want to use custom suite setup/teardown -*/ - -/* Support for Meta Test Rig */ -#define TEST_CASE(a) -void putcharSpy(int c) { (void)putchar(c);} // include passthrough for linking tests - -/* Global Variables Used During These Tests */ -int CounterSetup = 0; -int CounterTeardown = 0; -int CounterSuiteSetup = 0; - -void setUp(void) -{ - CounterSetup = 1; -} - -void tearDown(void) -{ - CounterTeardown = 1; -} - -void custom_setup(void) -{ - CounterSetup = 2; -} - -void custom_teardown(void) -{ - CounterTeardown = 2; -} - -/* -void test_OldSchoolCommentsShouldBeIgnored(void) -{ - TEST_ASSERT_FAIL("Old-School Comments Should Be Ignored"); -} -*/ - -void test_ThisTestAlwaysPasses(void) -{ - TEST_PASS(); -} - -void test_ThisTestAlwaysFails(void) -{ - TEST_FAIL_MESSAGE("This Test Should Fail"); -} - -void test_ThisTestAlwaysIgnored(void) -{ - TEST_IGNORE_MESSAGE("This Test Should Be Ignored"); -} - -void qwiktest_ThisTestPassesWhenNoSetupRan(void) -{ - TEST_ASSERT_EQUAL_MESSAGE(0, CounterSetup, "Setup Was Unexpectedly Run"); -} - -void qwiktest_ThisTestPassesWhenNoTeardownRan(void) -{ - TEST_ASSERT_EQUAL_MESSAGE(0, CounterTeardown, "Teardown Was Unexpectedly Run"); -} - -void spec_ThisTestPassesWhenNormalSuiteSetupAndTeardownRan(void) -{ - TEST_ASSERT_EQUAL_MESSAGE(0, CounterSuiteSetup, "Suite Setup Was Unexpectedly Run"); -} - -void spec_ThisTestPassesWhenNormalSetupRan(void) -{ - TEST_ASSERT_EQUAL_MESSAGE(1, CounterSetup, "Normal Setup Wasn't Run"); -} - -void spec_ThisTestPassesWhenNormalTeardownRan(void) -{ - TEST_ASSERT_EQUAL_MESSAGE(1, CounterTeardown, "Normal Teardown Wasn't Run"); -} - -void custtest_ThisTestPassesWhenCustomSetupRan(void) -{ - TEST_ASSERT_EQUAL_MESSAGE(2, CounterSetup, "Custom Setup Wasn't Run"); -} - -void custtest_ThisTestPassesWhenCustomTeardownRan(void) -{ - TEST_ASSERT_EQUAL_MESSAGE(2, CounterTeardown, "Custom Teardown Wasn't Run"); -} - -//void test_NewStyleCommentsShouldBeIgnored(void) -//{ -// TEST_ASSERT_FAIL("New Style Comments Should Be Ignored"); -//} - -void test_NotBeConfusedByLongComplicatedStrings(void) -{ - const char* crazyString = "GET / HTTP/1.1\r\nHost: 127.0.0.1:8081\r\nConnection: keep-alive\r\nCache-Control: no-cache\r\nUser-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36\r\nPostman-Token: 768c7149-c3fb-f704-71a2-63918d9195b2\r\nAccept: */*\r\nAccept-Encoding: gzip, deflate, sdch\r\nAccept-Language: en-GB,en-US;q=0.8,en;q=0.6\r\n\r\n"; - - TEST_ASSERT_EQUAL_STRING_MESSAGE(crazyString, crazyString, "These Strings Are The Same"); -} - -void test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings(void) -{ - TEST_ASSERT_TRUE_MESSAGE(1, "1 Should be True"); -} - -void test_StillNotBeConfusedByLongComplicatedStrings(void) -{ - const char* crazyString = "GET / HTTP/1.1\r\nHost: 127.0.0.1:8081\r\nConnection: keep-alive\r\nCache-Control: no-cache\r\nUser-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36\r\nPostman-Token: 768c7149-c3fb-f704-71a2-63918d9195b2\r\nAccept: */*\r\nAccept-Encoding: gzip, deflate, sdch\r\nAccept-Language: en-GB,en-US;q=0.8,en;q=0.6\r\n\r\n"; - - TEST_ASSERT_EQUAL_STRING_MESSAGE(crazyString, crazyString, "These Strings Are Still The Same"); -} - -void should_RunTestsStartingWithShouldByDefault(void) -{ - TEST_ASSERT_TRUE_MESSAGE(1, "1 Should be True"); -} - -TEST_CASE(25) -TEST_CASE(125) -TEST_CASE(5) -void paratest_ShouldHandleParameterizedTests(int Num) -{ - TEST_ASSERT_EQUAL_MESSAGE(0, (Num % 5), "All The Values Are Divisible By 5"); -} - -TEST_CASE(7) -void paratest_ShouldHandleParameterizedTests2(int Num) -{ - TEST_ASSERT_EQUAL_MESSAGE(7, Num, "The Only Call To This Passes"); -} - -void paratest_ShouldHandleNonParameterizedTestsWhenParameterizationValid(void) -{ - TEST_PASS(); -} - -TEST_CASE(17) -void paratest_ShouldHandleParameterizedTestsThatFail(int Num) -{ - TEST_ASSERT_EQUAL_MESSAGE(3, Num, "This call should fail"); -} - -#ifdef USE_CEXCEPTION -void extest_ShouldHandleCExceptionInTest(void) -{ - TEST_ASSERT_EQUAL_MESSAGE(1, CEXCEPTION_BEING_USED, "Should be pulling in CException"); -} -#endif - -#ifdef USE_ANOTHER_MAIN -int custom_main(void); - -int main(void) -{ - return custom_main(); -} -#endif - -void suitetest_ThisTestPassesWhenCustomSuiteSetupAndTeardownRan(void) -{ - TEST_ASSERT_EQUAL_MESSAGE(1, CounterSuiteSetup, "Suite Setup Should Have Run"); -} - - diff --git a/tests/unity/test/testdata/testRunnerGeneratorSmall.c b/tests/unity/test/testdata/testRunnerGeneratorSmall.c deleted file mode 100644 index c683749..0000000 --- a/tests/unity/test/testdata/testRunnerGeneratorSmall.c +++ /dev/null @@ -1,67 +0,0 @@ -/* This Test File Is Used To Verify Many Combinations Of Using the Generate Test Runner Script */ - -#include -#include "unity.h" -#include "Defs.h" - -TEST_FILE("some_file.c") - -/* Notes about prefixes: - test - normal default prefix. these are "always run" tests for this procedure - spec - normal default prefix. required to run default setup/teardown calls. -*/ - -/* Support for Meta Test Rig */ -#define TEST_CASE(a) -void putcharSpy(int c) { (void)putchar(c);} // include passthrough for linking tests - -/* Global Variables Used During These Tests */ -int CounterSetup = 0; -int CounterTeardown = 0; -int CounterSuiteSetup = 0; - -void setUp(void) -{ - CounterSetup = 1; -} - -void tearDown(void) -{ - CounterTeardown = 1; -} - -void custom_setup(void) -{ - CounterSetup = 2; -} - -void custom_teardown(void) -{ - CounterTeardown = 2; -} - -void test_ThisTestAlwaysPasses(void) -{ - TEST_PASS(); -} - -void test_ThisTestAlwaysFails(void) -{ - TEST_FAIL_MESSAGE("This Test Should Fail"); -} - -void test_ThisTestAlwaysIgnored(void) -{ - TEST_IGNORE_MESSAGE("This Test Should Be Ignored"); -} - -void spec_ThisTestPassesWhenNormalSetupRan(void) -{ - TEST_ASSERT_EQUAL_MESSAGE(1, CounterSetup, "Normal Setup Wasn't Run"); -} - -void spec_ThisTestPassesWhenNormalTeardownRan(void) -{ - TEST_ASSERT_EQUAL_MESSAGE(1, CounterTeardown, "Normal Teardown Wasn't Run"); -} - diff --git a/tests/unity/test/testdata/testRunnerGeneratorWithMocks.c b/tests/unity/test/testdata/testRunnerGeneratorWithMocks.c deleted file mode 100644 index 7eb0b67..0000000 --- a/tests/unity/test/testdata/testRunnerGeneratorWithMocks.c +++ /dev/null @@ -1,192 +0,0 @@ -/* This Test File Is Used To Verify Many Combinations Of Using the Generate Test Runner Script */ - -#include -#include "unity.h" -#include "Defs.h" -#include "mockMock.h" - -#ifdef USE_CEXCEPTION -#include "CException.h" -#endif - -/* Notes about prefixes: - test - normal default prefix. these are "always run" tests for this procedure - spec - normal default prefix. required to run default setup/teardown calls. - should - normal default prefix. - qwiktest - custom prefix for when tests skip all setup/teardown calls. - custtest - custom prefix for when tests use custom setup/teardown calls. - paratest - custom prefix for when we want to verify parameterized tests. - extest - custom prefix only used during cexception - suitetest- custom prefix for when we want to use custom suite setup/teardown -*/ - -/* Support for Meta Test Rig */ -#define TEST_CASE(a) -void putcharSpy(int c) { (void)putchar(c);} // include passthrough for linking tests - -/* Global Variables Used During These Tests */ -int CounterSetup = 0; -int CounterTeardown = 0; -int CounterSuiteSetup = 0; - -void setUp(void) -{ - CounterSetup = 1; -} - -void tearDown(void) -{ - CounterTeardown = 1; -} - -void custom_setup(void) -{ - CounterSetup = 2; -} - -void custom_teardown(void) -{ - CounterTeardown = 2; -} - -/* -void test_OldSchoolCommentsShouldBeIgnored(void) -{ - TEST_ASSERT_FAIL("Old-School Comments Should Be Ignored"); -} -*/ - -void test_ThisTestAlwaysPasses(void) -{ - TEST_PASS(); -} - -void test_ThisTestAlwaysFails(void) -{ - TEST_FAIL_MESSAGE("This Test Should Fail"); -} - -void test_ThisTestAlwaysIgnored(void) -{ - TEST_IGNORE_MESSAGE("This Test Should Be Ignored"); -} - -void qwiktest_ThisTestPassesWhenNoSetupRan(void) -{ - TEST_ASSERT_EQUAL_MESSAGE(0, CounterSetup, "Setup Was Unexpectedly Run"); -} - -void qwiktest_ThisTestPassesWhenNoTeardownRan(void) -{ - TEST_ASSERT_EQUAL_MESSAGE(0, CounterTeardown, "Teardown Was Unexpectedly Run"); -} - -void spec_ThisTestPassesWhenNormalSuiteSetupAndTeardownRan(void) -{ - TEST_ASSERT_EQUAL_MESSAGE(0, CounterSuiteSetup, "Suite Setup Was Unexpectedly Run"); -} - -void spec_ThisTestPassesWhenNormalSetupRan(void) -{ - TEST_ASSERT_EQUAL_MESSAGE(1, CounterSetup, "Normal Setup Wasn't Run"); -} - -void spec_ThisTestPassesWhenNormalTeardownRan(void) -{ - TEST_ASSERT_EQUAL_MESSAGE(1, CounterTeardown, "Normal Teardown Wasn't Run"); -} - -void custtest_ThisTestPassesWhenCustomSetupRan(void) -{ - TEST_ASSERT_EQUAL_MESSAGE(2, CounterSetup, "Custom Setup Wasn't Run"); -} - -void custtest_ThisTestPassesWhenCustomTeardownRan(void) -{ - TEST_ASSERT_EQUAL_MESSAGE(2, CounterTeardown, "Custom Teardown Wasn't Run"); -} - -//void test_NewStyleCommentsShouldBeIgnored(void) -//{ -// TEST_ASSERT_FAIL("New Style Comments Should Be Ignored"); -//} - -void test_NotBeConfusedByLongComplicatedStrings(void) -{ - const char* crazyString = "GET / HTTP/1.1\r\nHost: 127.0.0.1:8081\r\nConnection: keep-alive\r\nCache-Control: no-cache\r\nUser-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36\r\nPostman-Token: 768c7149-c3fb-f704-71a2-63918d9195b2\r\nAccept: */*\r\nAccept-Encoding: gzip, deflate, sdch\r\nAccept-Language: en-GB,en-US;q=0.8,en;q=0.6\r\n\r\n"; - - TEST_ASSERT_EQUAL_STRING_MESSAGE(crazyString, crazyString, "These Strings Are The Same"); -} - -void test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings(void) -{ - TEST_ASSERT_TRUE_MESSAGE(1, "1 Should be True"); -} - -void test_StillNotBeConfusedByLongComplicatedStrings(void) -{ - const char* crazyString = "GET / HTTP/1.1\r\nHost: 127.0.0.1:8081\r\nConnection: keep-alive\r\nCache-Control: no-cache\r\nUser-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.80 Safari/537.36\r\nPostman-Token: 768c7149-c3fb-f704-71a2-63918d9195b2\r\nAccept: */*\r\nAccept-Encoding: gzip, deflate, sdch\r\nAccept-Language: en-GB,en-US;q=0.8,en;q=0.6\r\n\r\n"; - - TEST_ASSERT_EQUAL_STRING_MESSAGE(crazyString, crazyString, "These Strings Are Still The Same"); -} - -void should_RunTestsStartingWithShouldByDefault(void) -{ - TEST_ASSERT_TRUE_MESSAGE(1, "1 Should be True"); -} - -TEST_CASE(25) -TEST_CASE(125) -TEST_CASE(5) -void paratest_ShouldHandleParameterizedTests(int Num) -{ - TEST_ASSERT_EQUAL_MESSAGE(0, (Num % 5), "All The Values Are Divisible By 5"); -} - -TEST_CASE(7) -void paratest_ShouldHandleParameterizedTests2(int Num) -{ - TEST_ASSERT_EQUAL_MESSAGE(7, Num, "The Only Call To This Passes"); -} - -void paratest_ShouldHandleNonParameterizedTestsWhenParameterizationValid(void) -{ - TEST_PASS(); -} - -TEST_CASE(17) -void paratest_ShouldHandleParameterizedTestsThatFail(int Num) -{ - TEST_ASSERT_EQUAL_MESSAGE(3, Num, "This call should fail"); -} - -#ifdef USE_CEXCEPTION -void extest_ShouldHandleCExceptionInTest(void) -{ - TEST_ASSERT_EQUAL_MESSAGE(1, CEXCEPTION_BEING_USED, "Should be pulling in CException"); -} -#endif - -#ifdef USE_ANOTHER_MAIN -int custom_main(void); - -int main(void) -{ - return custom_main(); -} -#endif - -void suitetest_ThisTestPassesWhenCustomSuiteSetupAndTeardownRan(void) -{ - TEST_ASSERT_EQUAL_MESSAGE(1, CounterSuiteSetup, "Suite Setup Should Have Run"); -} - -void test_ShouldCallMockInitAndVerifyFunctionsForEachTest(void) -{ - int passesOrIgnores = (int)(Unity.NumberOfTests - Unity.TestFailures); - TEST_ASSERT_EQUAL_MESSAGE(Unity.NumberOfTests, mockMock_Init_Counter, "Mock Init Should Be Called Once Per Test Started"); - TEST_ASSERT_EQUAL_MESSAGE(passesOrIgnores, mockMock_Verify_Counter, "Mock Verify Should Be Called Once Per Test Passed"); - TEST_ASSERT_EQUAL_MESSAGE(Unity.NumberOfTests - 1, mockMock_Destroy_Counter, "Mock Destroy Should Be Called Once Per Test Completed"); - TEST_ASSERT_EQUAL_MESSAGE(0, CMockMemFreeFinalCounter, "Mock MemFreeFinal Should Not Be Called Until End"); -} - diff --git a/tests/unity/test/tests/test_generate_test_runner.rb b/tests/unity/test/tests/test_generate_test_runner.rb deleted file mode 100644 index a3536d3..0000000 --- a/tests/unity/test/tests/test_generate_test_runner.rb +++ /dev/null @@ -1,1252 +0,0 @@ -# ========================================== -# CMock Project - Automatic Mock Generation for C -# Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams -# [Released under MIT License. Please refer to license.txt for details] -# ========================================== - -require '../auto/generate_test_runner.rb' - -$generate_test_runner_tests = 0 -$generate_test_runner_failures = 0 - -OUT_FILE = 'build/testsample_' - -RUNNER_TESTS = [ - { :name => 'DefaultsThroughOptions', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST'], - :options => nil, #defaults - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'spec_ThisTestPassesWhenNormalSetupRan', - 'spec_ThisTestPassesWhenNormalTeardownRan', - 'test_NotBeConfusedByLongComplicatedStrings', - 'test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings', - 'test_StillNotBeConfusedByLongComplicatedStrings', - 'should_RunTestsStartingWithShouldByDefault', - 'spec_ThisTestPassesWhenNormalSuiteSetupAndTeardownRan', - ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - { :name => 'DefaultsThroughCommandLine', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST'], - :cmdline => "", #defaults - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'spec_ThisTestPassesWhenNormalSetupRan', - 'spec_ThisTestPassesWhenNormalTeardownRan', - 'test_NotBeConfusedByLongComplicatedStrings', - 'test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings', - 'test_StillNotBeConfusedByLongComplicatedStrings', - 'should_RunTestsStartingWithShouldByDefault', - 'spec_ThisTestPassesWhenNormalSuiteSetupAndTeardownRan', - ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - { :name => 'DefaultsThroughYAMLFile', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST'], - :cmdline => "", #defaults - :yaml => {}, #defaults - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'spec_ThisTestPassesWhenNormalSetupRan', - 'spec_ThisTestPassesWhenNormalTeardownRan', - 'test_NotBeConfusedByLongComplicatedStrings', - 'test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings', - 'test_StillNotBeConfusedByLongComplicatedStrings', - 'should_RunTestsStartingWithShouldByDefault', - 'spec_ThisTestPassesWhenNormalSuiteSetupAndTeardownRan', - ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - { :name => 'ShorterFilterOfJustTest', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST'], - :options => { - :test_prefix => "test", - }, - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'test_NotBeConfusedByLongComplicatedStrings', - 'test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings', - 'test_StillNotBeConfusedByLongComplicatedStrings', - ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - { :name => 'ShorterFilterOfJustShould', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST'], - :options => { - :test_prefix => "should", - }, - :expected => { - :to_pass => [ 'should_RunTestsStartingWithShouldByDefault' ], - :to_fail => [ ], - :to_ignore => [ ], - } - }, - - { :name => 'ShorterFilterOfJustSpec', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST'], - :options => { - :test_prefix => "spec", - }, - :expected => { - :to_pass => [ 'spec_ThisTestPassesWhenNormalSetupRan', - 'spec_ThisTestPassesWhenNormalTeardownRan', - 'spec_ThisTestPassesWhenNormalSuiteSetupAndTeardownRan', - ], - :to_fail => [ ], - :to_ignore => [ ], - } - }, - - { :name => 'InjectIncludes', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST'], - :options => { - :includes => ['Defs.h'], - }, - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'spec_ThisTestPassesWhenNormalSetupRan', - 'spec_ThisTestPassesWhenNormalTeardownRan', - 'test_NotBeConfusedByLongComplicatedStrings', - 'test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings', - 'test_StillNotBeConfusedByLongComplicatedStrings', - 'should_RunTestsStartingWithShouldByDefault', - 'spec_ThisTestPassesWhenNormalSuiteSetupAndTeardownRan', - ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - { :name => 'ParameterizedThroughOptions', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST'], - :options => { - :test_prefix => "paratest", - :use_param_tests => true, - }, - :expected => { - :to_pass => [ 'paratest_ShouldHandleParameterizedTests\(25\)', - 'paratest_ShouldHandleParameterizedTests\(125\)', - 'paratest_ShouldHandleParameterizedTests\(5\)', - 'paratest_ShouldHandleParameterizedTests2\(7\)', - 'paratest_ShouldHandleNonParameterizedTestsWhenParameterizationValid\(RUN_TEST_NO_ARGS\)', - ], - :to_fail => [ 'paratest_ShouldHandleParameterizedTestsThatFail\(17\)' ], - :to_ignore => [ ], - } - }, - - { :name => 'ParameterizedThroughCommandLine', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST'], - :cmdline => " --test_prefix=\"paratest\" --use_param_tests=1", - :expected => { - :to_pass => [ 'paratest_ShouldHandleParameterizedTests\(25\)', - 'paratest_ShouldHandleParameterizedTests\(125\)', - 'paratest_ShouldHandleParameterizedTests\(5\)', - 'paratest_ShouldHandleParameterizedTests2\(7\)', - 'paratest_ShouldHandleNonParameterizedTestsWhenParameterizationValid\(RUN_TEST_NO_ARGS\)', - ], - :to_fail => [ 'paratest_ShouldHandleParameterizedTestsThatFail\(17\)' ], - :to_ignore => [ ], - } - }, - - { :name => 'ParameterizedThroughCommandLineAndYaml', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST'], - :cmdline => "--use_param_tests=1", - :yaml => { - :test_prefix => "paratest" - }, - :expected => { - :to_pass => [ 'paratest_ShouldHandleParameterizedTests\(25\)', - 'paratest_ShouldHandleParameterizedTests\(125\)', - 'paratest_ShouldHandleParameterizedTests\(5\)', - 'paratest_ShouldHandleParameterizedTests2\(7\)', - 'paratest_ShouldHandleNonParameterizedTestsWhenParameterizationValid\(RUN_TEST_NO_ARGS\)', - ], - :to_fail => [ 'paratest_ShouldHandleParameterizedTestsThatFail\(17\)' ], - :to_ignore => [ ], - } - }, - - { :name => 'CException', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST', 'USE_CEXCEPTION'], - :options => { - :test_prefix => "extest", - :plugins => [ :cexception ], - }, - :expected => { - :to_pass => [ 'extest_ShouldHandleCExceptionInTest' ], - :to_fail => [ ], - :to_ignore => [ ], - } - }, - - { :name => 'CustomSetupAndTeardownThroughOptions', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST'], - :options => { - :test_prefix => "custtest|test", - :setup_name => "custom_setup", - :teardown_name => "custom_teardown", - }, - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'test_NotBeConfusedByLongComplicatedStrings', - 'test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings', - 'test_StillNotBeConfusedByLongComplicatedStrings', - 'custtest_ThisTestPassesWhenCustomSetupRan', - 'custtest_ThisTestPassesWhenCustomTeardownRan', - ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - { :name => 'CustomSetupAndTeardownThroughCommandLine', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST'], - :cmdline => " --test_prefix=\"custtest|test\" --setup_name=\"custom_setup\" --teardown_name=\"custom_teardown\"", - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'test_NotBeConfusedByLongComplicatedStrings', - 'test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings', - 'test_StillNotBeConfusedByLongComplicatedStrings', - 'custtest_ThisTestPassesWhenCustomSetupRan', - 'custtest_ThisTestPassesWhenCustomTeardownRan', - ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - { :name => 'CustomSetupAndTeardownThroughYaml', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST'], - :cmdline => " --test_prefix=\"custtest|test\"", - :yaml => { - :setup_name => "custom_setup", - :teardown_name => "custom_teardown", - }, - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'test_NotBeConfusedByLongComplicatedStrings', - 'test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings', - 'test_StillNotBeConfusedByLongComplicatedStrings', - 'custtest_ThisTestPassesWhenCustomSetupRan', - 'custtest_ThisTestPassesWhenCustomTeardownRan', - ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - { :name => 'CustomMain', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST', "USE_ANOTHER_MAIN"], - :options => { - :main_name => "custom_main", - }, - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'spec_ThisTestPassesWhenNormalSetupRan', - 'spec_ThisTestPassesWhenNormalTeardownRan', - 'test_NotBeConfusedByLongComplicatedStrings', - 'test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings', - 'test_StillNotBeConfusedByLongComplicatedStrings', - 'should_RunTestsStartingWithShouldByDefault', - 'spec_ThisTestPassesWhenNormalSuiteSetupAndTeardownRan', - ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - { :name => 'CustomSuiteSetupAndTeardown', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST'], - :includes => ['Defs.h'], - :options => { - :test_prefix => "suitetest|test", - :suite_setup => " CounterSuiteSetup = 1;", - :suite_teardown => " return num_failures;", - }, - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'test_NotBeConfusedByLongComplicatedStrings', - 'test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings', - 'test_StillNotBeConfusedByLongComplicatedStrings', - 'suitetest_ThisTestPassesWhenCustomSuiteSetupAndTeardownRan', - ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - { :name => 'MainExternDeclaration', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST'], - :includes => ['Defs.h'], - :options => { - :main_export_decl => "EXTERN_DECL", - }, - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'spec_ThisTestPassesWhenNormalSetupRan', - 'spec_ThisTestPassesWhenNormalTeardownRan', - 'test_NotBeConfusedByLongComplicatedStrings', - 'test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings', - 'test_StillNotBeConfusedByLongComplicatedStrings', - 'should_RunTestsStartingWithShouldByDefault', - 'spec_ThisTestPassesWhenNormalSuiteSetupAndTeardownRan', - ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - - #### WITH MOCKS ########################################## - - { :name => 'DefaultsThroughOptions', - :testfile => 'testdata/testRunnerGeneratorWithMocks.c', - :testdefines => ['TEST'], - :options => nil, #defaults - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'spec_ThisTestPassesWhenNormalSetupRan', - 'spec_ThisTestPassesWhenNormalTeardownRan', - 'test_NotBeConfusedByLongComplicatedStrings', - 'test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings', - 'test_StillNotBeConfusedByLongComplicatedStrings', - 'should_RunTestsStartingWithShouldByDefault', - 'spec_ThisTestPassesWhenNormalSuiteSetupAndTeardownRan', - 'test_ShouldCallMockInitAndVerifyFunctionsForEachTest', - ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - { :name => 'DefaultsThroughCommandLine', - :testfile => 'testdata/testRunnerGeneratorWithMocks.c', - :testdefines => ['TEST'], - :cmdline => "", #defaults - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'spec_ThisTestPassesWhenNormalSetupRan', - 'spec_ThisTestPassesWhenNormalTeardownRan', - 'test_NotBeConfusedByLongComplicatedStrings', - 'test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings', - 'test_StillNotBeConfusedByLongComplicatedStrings', - 'should_RunTestsStartingWithShouldByDefault', - 'spec_ThisTestPassesWhenNormalSuiteSetupAndTeardownRan', - 'test_ShouldCallMockInitAndVerifyFunctionsForEachTest', - ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - { :name => 'DefaultsThroughYAMLFile', - :testfile => 'testdata/testRunnerGeneratorWithMocks.c', - :testdefines => ['TEST'], - :cmdline => "", #defaults - :yaml => {}, #defaults - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'spec_ThisTestPassesWhenNormalSetupRan', - 'spec_ThisTestPassesWhenNormalTeardownRan', - 'test_NotBeConfusedByLongComplicatedStrings', - 'test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings', - 'test_StillNotBeConfusedByLongComplicatedStrings', - 'should_RunTestsStartingWithShouldByDefault', - 'spec_ThisTestPassesWhenNormalSuiteSetupAndTeardownRan', - 'test_ShouldCallMockInitAndVerifyFunctionsForEachTest', - ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - { :name => 'ShorterFilterOfJustTest', - :testfile => 'testdata/testRunnerGeneratorWithMocks.c', - :testdefines => ['TEST'], - :options => { - :test_prefix => "test", - }, - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'test_NotBeConfusedByLongComplicatedStrings', - 'test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings', - 'test_StillNotBeConfusedByLongComplicatedStrings', - 'test_ShouldCallMockInitAndVerifyFunctionsForEachTest', - ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - { :name => 'ShorterFilterOfJustShould', - :testfile => 'testdata/testRunnerGeneratorWithMocks.c', - :testdefines => ['TEST'], - :options => { - :test_prefix => "should", - }, - :expected => { - :to_pass => [ 'should_RunTestsStartingWithShouldByDefault' ], - :to_fail => [ ], - :to_ignore => [ ], - } - }, - - { :name => 'ShorterFilterOfJustSpec', - :testfile => 'testdata/testRunnerGeneratorWithMocks.c', - :testdefines => ['TEST'], - :options => { - :test_prefix => "spec", - }, - :expected => { - :to_pass => [ 'spec_ThisTestPassesWhenNormalSetupRan', - 'spec_ThisTestPassesWhenNormalTeardownRan', - 'spec_ThisTestPassesWhenNormalSuiteSetupAndTeardownRan', - ], - :to_fail => [ ], - :to_ignore => [ ], - } - }, - - { :name => 'InjectIncludes', - :testfile => 'testdata/testRunnerGeneratorWithMocks.c', - :testdefines => ['TEST'], - :options => { - :includes => ['Defs.h'], - }, - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'spec_ThisTestPassesWhenNormalSetupRan', - 'spec_ThisTestPassesWhenNormalTeardownRan', - 'test_NotBeConfusedByLongComplicatedStrings', - 'test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings', - 'test_StillNotBeConfusedByLongComplicatedStrings', - 'should_RunTestsStartingWithShouldByDefault', - 'spec_ThisTestPassesWhenNormalSuiteSetupAndTeardownRan', - 'test_ShouldCallMockInitAndVerifyFunctionsForEachTest', - ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - { :name => 'ParameterizedThroughOptions', - :testfile => 'testdata/testRunnerGeneratorWithMocks.c', - :testdefines => ['TEST'], - :options => { - :test_prefix => "paratest", - :use_param_tests => true, - }, - :expected => { - :to_pass => [ 'paratest_ShouldHandleParameterizedTests\(25\)', - 'paratest_ShouldHandleParameterizedTests\(125\)', - 'paratest_ShouldHandleParameterizedTests\(5\)', - 'paratest_ShouldHandleParameterizedTests2\(7\)', - 'paratest_ShouldHandleNonParameterizedTestsWhenParameterizationValid\(RUN_TEST_NO_ARGS\)', - ], - :to_fail => [ 'paratest_ShouldHandleParameterizedTestsThatFail\(17\)' ], - :to_ignore => [ ], - } - }, - - { :name => 'ParameterizedThroughCommandLine', - :testfile => 'testdata/testRunnerGeneratorWithMocks.c', - :testdefines => ['TEST'], - :cmdline => " --test_prefix=\"paratest\" --use_param_tests=1", - :expected => { - :to_pass => [ 'paratest_ShouldHandleParameterizedTests\(25\)', - 'paratest_ShouldHandleParameterizedTests\(125\)', - 'paratest_ShouldHandleParameterizedTests\(5\)', - 'paratest_ShouldHandleParameterizedTests2\(7\)', - 'paratest_ShouldHandleNonParameterizedTestsWhenParameterizationValid\(RUN_TEST_NO_ARGS\)', - ], - :to_fail => [ 'paratest_ShouldHandleParameterizedTestsThatFail\(17\)' ], - :to_ignore => [ ], - } - }, - - { :name => 'ParameterizedThroughCommandLineAndYaml', - :testfile => 'testdata/testRunnerGeneratorWithMocks.c', - :testdefines => ['TEST'], - :cmdline => "--use_param_tests=1", - :yaml => { - :test_prefix => "paratest" - }, - :expected => { - :to_pass => [ 'paratest_ShouldHandleParameterizedTests\(25\)', - 'paratest_ShouldHandleParameterizedTests\(125\)', - 'paratest_ShouldHandleParameterizedTests\(5\)', - 'paratest_ShouldHandleParameterizedTests2\(7\)', - 'paratest_ShouldHandleNonParameterizedTestsWhenParameterizationValid\(RUN_TEST_NO_ARGS\)', - ], - :to_fail => [ 'paratest_ShouldHandleParameterizedTestsThatFail\(17\)' ], - :to_ignore => [ ], - } - }, - - { :name => 'CException', - :testfile => 'testdata/testRunnerGeneratorWithMocks.c', - :testdefines => ['TEST', 'USE_CEXCEPTION'], - :options => { - :test_prefix => "extest", - :plugins => [ :cexception ], - }, - :expected => { - :to_pass => [ 'extest_ShouldHandleCExceptionInTest' ], - :to_fail => [ ], - :to_ignore => [ ], - } - }, - - { :name => 'CustomSetupAndTeardownThroughOptions', - :testfile => 'testdata/testRunnerGeneratorWithMocks.c', - :testdefines => ['TEST'], - :options => { - :test_prefix => "custtest|test", - :setup_name => "custom_setup", - :teardown_name => "custom_teardown", - }, - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'test_NotBeConfusedByLongComplicatedStrings', - 'test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings', - 'test_StillNotBeConfusedByLongComplicatedStrings', - 'custtest_ThisTestPassesWhenCustomSetupRan', - 'custtest_ThisTestPassesWhenCustomTeardownRan', - 'test_ShouldCallMockInitAndVerifyFunctionsForEachTest', - ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - { :name => 'CustomSetupAndTeardownThroughCommandLine', - :testfile => 'testdata/testRunnerGeneratorWithMocks.c', - :testdefines => ['TEST'], - :cmdline => " --test_prefix=\"custtest|test\" --setup_name=\"custom_setup\" --teardown_name=\"custom_teardown\"", - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'test_NotBeConfusedByLongComplicatedStrings', - 'test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings', - 'test_StillNotBeConfusedByLongComplicatedStrings', - 'custtest_ThisTestPassesWhenCustomSetupRan', - 'custtest_ThisTestPassesWhenCustomTeardownRan', - 'test_ShouldCallMockInitAndVerifyFunctionsForEachTest', - ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - { :name => 'CustomSetupAndTeardownThroughYaml', - :testfile => 'testdata/testRunnerGeneratorWithMocks.c', - :testdefines => ['TEST'], - :cmdline => " --test_prefix=\"custtest|test\"", - :yaml => { - :setup_name => "custom_setup", - :teardown_name => "custom_teardown", - }, - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'test_NotBeConfusedByLongComplicatedStrings', - 'test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings', - 'test_StillNotBeConfusedByLongComplicatedStrings', - 'custtest_ThisTestPassesWhenCustomSetupRan', - 'custtest_ThisTestPassesWhenCustomTeardownRan', - 'test_ShouldCallMockInitAndVerifyFunctionsForEachTest', - ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - { :name => 'CustomMain', - :testfile => 'testdata/testRunnerGeneratorWithMocks.c', - :testdefines => ['TEST', "USE_ANOTHER_MAIN"], - :options => { - :main_name => "custom_main", - }, - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'spec_ThisTestPassesWhenNormalSetupRan', - 'spec_ThisTestPassesWhenNormalTeardownRan', - 'test_NotBeConfusedByLongComplicatedStrings', - 'test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings', - 'test_StillNotBeConfusedByLongComplicatedStrings', - 'should_RunTestsStartingWithShouldByDefault', - 'spec_ThisTestPassesWhenNormalSuiteSetupAndTeardownRan', - 'test_ShouldCallMockInitAndVerifyFunctionsForEachTest', - ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - { :name => 'CustomSuiteSetupAndTeardown', - :testfile => 'testdata/testRunnerGeneratorWithMocks.c', - :testdefines => ['TEST'], - :includes => ['Defs.h'], - :options => { - :test_prefix => "suitetest|test", - :suite_setup => " CounterSuiteSetup = 1;", - :suite_teardown => " return num_failures;", - }, - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'test_NotBeConfusedByLongComplicatedStrings', - 'test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings', - 'test_StillNotBeConfusedByLongComplicatedStrings', - 'suitetest_ThisTestPassesWhenCustomSuiteSetupAndTeardownRan', - 'test_ShouldCallMockInitAndVerifyFunctionsForEachTest', - ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - { :name => 'MainExternDeclaration', - :testfile => 'testdata/testRunnerGeneratorWithMocks.c', - :testdefines => ['TEST'], - :includes => ['Defs.h'], - :options => { - :main_export_decl => "EXTERN_DECL", - }, - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'spec_ThisTestPassesWhenNormalSetupRan', - 'spec_ThisTestPassesWhenNormalTeardownRan', - 'test_NotBeConfusedByLongComplicatedStrings', - 'test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings', - 'test_StillNotBeConfusedByLongComplicatedStrings', - 'should_RunTestsStartingWithShouldByDefault', - 'spec_ThisTestPassesWhenNormalSuiteSetupAndTeardownRan', - 'test_ShouldCallMockInitAndVerifyFunctionsForEachTest', - ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - - - #### WITH ARGS ########################################## - - { :name => 'ArgsThroughOptions', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST', 'UNITY_USE_COMMAND_LINE_ARGS'], - :options => { - :cmdline_args => true, - }, - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'spec_ThisTestPassesWhenNormalSetupRan', - 'spec_ThisTestPassesWhenNormalTeardownRan', - 'test_NotBeConfusedByLongComplicatedStrings', - 'test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings', - 'test_StillNotBeConfusedByLongComplicatedStrings', - 'should_RunTestsStartingWithShouldByDefault', - 'spec_ThisTestPassesWhenNormalSuiteSetupAndTeardownRan', - ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - { :name => 'ArgsThroughCommandLine', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST', 'UNITY_USE_COMMAND_LINE_ARGS'], - :cmdline => "--cmdline_args=1", - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'spec_ThisTestPassesWhenNormalSetupRan', - 'spec_ThisTestPassesWhenNormalTeardownRan', - 'test_NotBeConfusedByLongComplicatedStrings', - 'test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings', - 'test_StillNotBeConfusedByLongComplicatedStrings', - 'should_RunTestsStartingWithShouldByDefault', - 'spec_ThisTestPassesWhenNormalSuiteSetupAndTeardownRan', - ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - { :name => 'ArgsThroughYAMLFile', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST', 'UNITY_USE_COMMAND_LINE_ARGS'], - :cmdline => "", - :yaml => { - :cmdline_args => true, - }, - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'spec_ThisTestPassesWhenNormalSetupRan', - 'spec_ThisTestPassesWhenNormalTeardownRan', - 'test_NotBeConfusedByLongComplicatedStrings', - 'test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings', - 'test_StillNotBeConfusedByLongComplicatedStrings', - 'should_RunTestsStartingWithShouldByDefault', - 'spec_ThisTestPassesWhenNormalSuiteSetupAndTeardownRan', - ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - { :name => 'ArgsNameFilterJustTest', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST', 'UNITY_USE_COMMAND_LINE_ARGS'], - :options => { - :cmdline_args => true, - }, - :cmdline_args => "-n test_", - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'test_NotBeConfusedByLongComplicatedStrings', - 'test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings', - 'test_StillNotBeConfusedByLongComplicatedStrings', - ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - { :name => 'ArgsNameFilterJustShould', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST', 'UNITY_USE_COMMAND_LINE_ARGS'], - :options => { - :cmdline_args => true, - }, - :cmdline_args => "-n should_", - :expected => { - :to_pass => [ 'should_RunTestsStartingWithShouldByDefault' ], - :to_fail => [ ], - :to_ignore => [ ], - } - }, - - { :name => 'ArgsNameFilterTestAndShould', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST', 'UNITY_USE_COMMAND_LINE_ARGS'], - :options => { - :cmdline_args => true, - }, - :cmdline_args => "-n should_,test_", - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'test_NotBeConfusedByLongComplicatedStrings', - 'test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings', - 'test_StillNotBeConfusedByLongComplicatedStrings', - 'should_RunTestsStartingWithShouldByDefault' ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - { :name => 'ArgsNameFilterWithWildcardOnFile', - :testfile => 'testdata/testRunnerGeneratorSmall.c', - :testdefines => ['TEST', 'UNITY_USE_COMMAND_LINE_ARGS'], - :options => { - :cmdline_args => true, - }, - :cmdline_args => "-n testRunnerGeneratorSma*", - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'spec_ThisTestPassesWhenNormalSetupRan', - 'spec_ThisTestPassesWhenNormalTeardownRan' ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - { :name => 'ArgsNameFilterWithWildcardAsName', - :testfile => 'testdata/testRunnerGeneratorSmall.c', - :testdefines => ['TEST', 'UNITY_USE_COMMAND_LINE_ARGS'], - :options => { - :cmdline_args => true, - }, - :cmdline_args => "-n testRunnerGeneratorSmall:*", - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'spec_ThisTestPassesWhenNormalSetupRan', - 'spec_ThisTestPassesWhenNormalTeardownRan' ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - { :name => 'ArgsNameFilterWithWildcardOnName', - :testfile => 'testdata/testRunnerGeneratorSmall.c', - :testdefines => ['TEST', 'UNITY_USE_COMMAND_LINE_ARGS'], - :options => { - :cmdline_args => true, - }, - :cmdline_args => "-n testRunnerGeneratorSmall:test_*", - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses' ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - { :name => 'ArgsNameFilterWithWildcardAndShortName', - :testfile => 'testdata/testRunnerGeneratorSmall.c', - :testdefines => ['TEST', 'UNITY_USE_COMMAND_LINE_ARGS'], - :options => { - :cmdline_args => true, - }, - :cmdline_args => "-n testRunnerGeneratorSmall:te*", - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses' ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - { :name => 'ArgsNameFilterWithWildcardOnBoth', - :testfile => 'testdata/testRunnerGeneratorSmall.c', - :testdefines => ['TEST', 'UNITY_USE_COMMAND_LINE_ARGS'], - :options => { - :cmdline_args => true, - }, - :cmdline_args => "-n testRunnerGeneratorSm*:*", - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'spec_ThisTestPassesWhenNormalSetupRan', - 'spec_ThisTestPassesWhenNormalTeardownRan' ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - { :name => 'ArgsExcludeFilterJustTest', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST', 'UNITY_USE_COMMAND_LINE_ARGS'], - :options => { - :cmdline_args => true, - }, - :cmdline_args => "-x test_", - :expected => { - :to_pass => [ 'spec_ThisTestPassesWhenNormalSetupRan', - 'spec_ThisTestPassesWhenNormalTeardownRan', - 'spec_ThisTestPassesWhenNormalSuiteSetupAndTeardownRan', - 'should_RunTestsStartingWithShouldByDefault', - ], - :to_fail => [ ], - :to_ignore => [ ], - } - }, - - { :name => 'ArgsIncludeAndExcludeFilter', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST', 'UNITY_USE_COMMAND_LINE_ARGS'], - :options => { - :cmdline_args => true, - :includes => ['Defs.h'], - }, - :cmdline_args => "-n test_ -x Ignored", - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'test_NotBeConfusedByLongComplicatedStrings', - 'test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings', - 'test_StillNotBeConfusedByLongComplicatedStrings', - ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ ], - } - }, - - { :name => 'ArgsIncludeSingleTest', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST', 'UNITY_USE_COMMAND_LINE_ARGS'], - :options => { - :cmdline_args => true, - }, - :cmdline_args => "-n ThisTestAlwaysPasses", - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses' ], - :to_fail => [ ], - :to_ignore => [ ], - } - }, - - { :name => 'ArgsIncludeSingleTestInSpecificFile', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST', 'UNITY_USE_COMMAND_LINE_ARGS'], - :options => { - :cmdline_args => true, - }, - :cmdline_args => "-n testRunnerGenerator:ThisTestAlwaysPasses", - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses' ], - :to_fail => [ ], - :to_ignore => [ ], - } - }, - - { :name => 'ArgsIncludeTestFileWithExtension', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST', 'UNITY_USE_COMMAND_LINE_ARGS'], - :options => { - :cmdline_args => true, - }, - :cmdline_args => "-n testRunnerGenerator.c:ThisTestAlwaysPasses", - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses' ], - :to_fail => [ ], - :to_ignore => [ ], - } - }, - - { :name => 'ArgsIncludeDoubleQuotes', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST', 'UNITY_USE_COMMAND_LINE_ARGS'], - :options => { - :cmdline_args => true, - }, - :cmdline_args => "-n \"testRunnerGenerator:ThisTestAlwaysPasses,test_ThisTestAlwaysFails\"", - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses' ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ ], - } - }, - - { :name => 'ArgsIncludeSingleQuotes', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST', 'UNITY_USE_COMMAND_LINE_ARGS'], - :options => { - :cmdline_args => true, - }, - :cmdline_args => "-n 'testRunnerGenerator:ThisTestAlwaysPasses,test_ThisTestAlwaysFails'", - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses' ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ ], - } - }, - - { :name => 'ArgsIncludeAValidTestForADifferentFile', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST', 'UNITY_USE_COMMAND_LINE_ARGS'], - :options => { - :cmdline_args => true, - }, - :cmdline_args => "-n AnotherFile:ThisTestDoesNotExist", - :expected => { - :to_pass => [ ], - :to_fail => [ ], - :to_ignore => [ ], - } - }, - - { :name => 'ArgsIncludeNoTests', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST', 'UNITY_USE_COMMAND_LINE_ARGS'], - :options => { - :cmdline_args => true, - }, - :cmdline_args => "-n ThisTestDoesNotExist", - :expected => { - :to_pass => [ ], - :to_fail => [ ], - :to_ignore => [ ], - } - }, - - { :name => 'ArgsExcludeAllTests', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST', 'UNITY_USE_COMMAND_LINE_ARGS'], - :options => { - :cmdline_args => true, - }, - :cmdline_args => "-x _", - :expected => { - :to_pass => [ ], - :to_fail => [ ], - :to_ignore => [ ], - } - }, - - { :name => 'ArgsIncludeFullFile', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST', 'UNITY_USE_COMMAND_LINE_ARGS'], - :options => { - :cmdline_args => true, - }, - :cmdline_args => "-n testRunnerGenerator", - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses', - 'spec_ThisTestPassesWhenNormalSetupRan', - 'spec_ThisTestPassesWhenNormalTeardownRan', - 'test_NotBeConfusedByLongComplicatedStrings', - 'test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings', - 'test_StillNotBeConfusedByLongComplicatedStrings', - 'should_RunTestsStartingWithShouldByDefault', - 'spec_ThisTestPassesWhenNormalSuiteSetupAndTeardownRan', - ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ 'test_ThisTestAlwaysIgnored' ], - } - }, - - { :name => 'ArgsIncludeWithAlternateFlag', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST', 'UNITY_USE_COMMAND_LINE_ARGS'], - :options => { - :cmdline_args => true, - }, - :cmdline_args => "-f=\"testRunnerGenerator:ThisTestAlwaysPasses,test_ThisTestAlwaysFails\"", - :expected => { - :to_pass => [ 'test_ThisTestAlwaysPasses' ], - :to_fail => [ 'test_ThisTestAlwaysFails' ], - :to_ignore => [ ], - } - }, - - { :name => 'ArgsIncludeWithParameterized', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST', 'UNITY_USE_COMMAND_LINE_ARGS'], - :cmdline => "--use_param_tests=1", - :yaml => { - :cmdline_args => true, - :test_prefix => "paratest" - }, - :cmdline_args => "-n ShouldHandleParameterizedTests", - :expected => { - :to_pass => [ 'paratest_ShouldHandleParameterizedTests\(25\)', - 'paratest_ShouldHandleParameterizedTests\(125\)', - 'paratest_ShouldHandleParameterizedTests\(5\)', - 'paratest_ShouldHandleParameterizedTests2\(7\)', - ], - :to_fail => [ 'paratest_ShouldHandleParameterizedTestsThatFail\(17\)' ], - :to_ignore => [ ], - } - }, - - { :name => 'ArgsList', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST', 'UNITY_USE_COMMAND_LINE_ARGS'], - :options => { - :cmdline_args => true, - }, - :cmdline_args => "-l", - :expected => { - :to_pass => [ ], - :to_fail => [ ], - :to_ignore => [ ], - :text => [ "testRunnerGenerator", - "test_ThisTestAlwaysPasses", - "test_ThisTestAlwaysFails", - "test_ThisTestAlwaysIgnored", - "spec_ThisTestPassesWhenNormalSuiteSetupAndTeardownRan", - "spec_ThisTestPassesWhenNormalSetupRan", - "spec_ThisTestPassesWhenNormalTeardownRan", - "test_NotBeConfusedByLongComplicatedStrings", - "test_NotDisappearJustBecauseTheTestBeforeAndAfterHaveCrazyStrings", - "test_StillNotBeConfusedByLongComplicatedStrings", - "should_RunTestsStartingWithShouldByDefault" - ] - } - }, - - { :name => 'ArgsListParameterized', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST', 'UNITY_USE_COMMAND_LINE_ARGS'], - :options => { - :test_prefix => "paratest", - :use_param_tests => true, - :cmdline_args => true, - }, - :cmdline_args => "-l", - :expected => { - :to_pass => [ ], - :to_fail => [ ], - :to_ignore => [ ], - :text => [ "testRunnerGenerator", - 'paratest_ShouldHandleParameterizedTests\(25\)', - 'paratest_ShouldHandleParameterizedTests\(125\)', - 'paratest_ShouldHandleParameterizedTests\(5\)', - 'paratest_ShouldHandleParameterizedTests2\(7\)', - 'paratest_ShouldHandleNonParameterizedTestsWhenParameterizationValid\(RUN_TEST_NO_ARGS\)', - 'paratest_ShouldHandleParameterizedTestsThatFail\(17\)' - ], - } - }, - - { :name => 'ArgsIncompleteIncludeFlags', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST', 'UNITY_USE_COMMAND_LINE_ARGS'], - :options => { - :cmdline_args => true, - }, - :cmdline_args => "-n", - :expected => { - :to_pass => [ ], - :to_fail => [ ], - :to_ignore => [ ], - :text => [ "ERROR: No Test String to Include Matches For" ], - } - }, - - { :name => 'ArgsIncompleteExcludeFlags', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST', 'UNITY_USE_COMMAND_LINE_ARGS'], - :options => { - :cmdline_args => true, - }, - :cmdline_args => "-x", - :expected => { - :to_pass => [ ], - :to_fail => [ ], - :to_ignore => [ ], - :text => [ "ERROR: No Test String to Exclude Matches For" ], - } - }, - - { :name => 'ArgsIllegalFlags', - :testfile => 'testdata/testRunnerGenerator.c', - :testdefines => ['TEST', 'UNITY_USE_COMMAND_LINE_ARGS'], - :options => { - :cmdline_args => true, - }, - :cmdline_args => "-z", - :expected => { - :to_pass => [ ], - :to_fail => [ ], - :to_ignore => [ ], - :text => [ "ERROR: Unknown Option z" ], - } - }, -] - -def runner_test(test, runner, expected, test_defines, cmdline_args) - # Tack on TEST define for compiling unit tests - load_configuration($cfg_file) - - #compile objects - obj_list = [ - compile(runner, test_defines), - compile(test, test_defines), - compile('../src/unity.c', test_defines), - ] - - # Link the test executable - test_base = File.basename(test, C_EXTENSION) - link_it(test_base, obj_list) - - # Execute unit test and generate results file - simulator = build_simulator_fields - cmdline_args ||= "" - executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] + " #{cmdline_args}" - cmd_str = if simulator.nil? - executable - else - "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" - end - output = execute(cmd_str, true) - - #compare to the expected pass/fail - allgood = expected[:to_pass].inject(true) {|s,v| s && verify_match(/#{v}:PASS/, output) } - allgood = expected[:to_fail].inject(allgood) {|s,v| s && verify_match(/#{v}:FAIL/, output) } - allgood = expected[:to_ignore].inject(allgood) {|s,v| s && verify_match(/#{v}:IGNORE/, output) } - - #verify there weren't more pass/fail/etc than expected - allgood &&= verify_number( expected[:to_pass], /(:PASS)/, output) - allgood &&= verify_number( expected[:to_fail], /(:FAIL)/, output) - allgood &&= verify_number( expected[:to_ignore], /(:IGNORE)/, output) - - #if we care about any other text, check that too - if (expected[:text]) - allgood = expected[:text].inject(allgood) {|s,v| s && verify_match(/#{v}/, output) } - allgood &&= verify_number( expected[:text], /.+/, output ) - end - - report output if (!allgood && !$verbose) #report failures if not already reporting everything - return allgood -end - -def verify_match(expression, output) - if (expression =~ output) - return true - else - report " FAIL: No Match For /#{expression.to_s}/" - return false - end -end - -def verify_number(expected, expression, output) - exp = expected.length - act = output.scan(expression).length - if (exp == act) - return true - else - report " FAIL: Expected #{exp} Matches For /#{expression.to_s}/. Was #{act}" - return false - end -end - -RUNNER_TESTS.each do |testset| - basename = File.basename(testset[:testfile], C_EXTENSION) - testset_name = "Runner_#{basename}_#{testset[:name]}" - should testset_name do - runner_name = OUT_FILE + testset[:name] + '_runner.c' - - #create a yaml file first if required - yaml_option = "" - if (testset[:yaml]) - File.open("build/runner_options.yml",'w') {|f| f << { :unity => testset[:yaml] }.to_yaml } - yaml_option = "build/runner_options.yml" - end - - #run script via command line or through hash function call, as requested - if (testset[:cmdline]) - cmdstr = "ruby ../auto/generate_test_runner.rb #{yaml_option} #{testset[:cmdline]} \"#{testset[:testfile]}\" \"#{runner_name}\"" - `#{cmdstr}` - else - UnityTestRunnerGenerator.new(testset[:options]).run(testset[:testfile], runner_name) - end - - #test the script against the specified test file and check results - if (runner_test(testset[:testfile], runner_name, testset[:expected], testset[:testdefines], testset[:cmdline_args])) - report "#{testset_name}:PASS" - else - report "#{testset_name}:FAIL" - $generate_test_runner_failures += 1 - end - $generate_test_runner_tests += 1 - end -end - -raise "There were #{$generate_test_runner_failures.to_s} failures while testing generate_test_runner.rb" if ($generate_test_runner_failures > 0) diff --git a/tests/unity/test/tests/testparameterized.c b/tests/unity/test/tests/testparameterized.c deleted file mode 100644 index aa6d173..0000000 --- a/tests/unity/test/tests/testparameterized.c +++ /dev/null @@ -1,110 +0,0 @@ -/* ========================================== - Unity Project - A Test Framework for C - Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams - [Released under MIT License. Please refer to license.txt for details] -========================================== */ - -#include -#include -#include "unity.h" - -void putcharSpy(int c) { (void)putchar(c);} // include passthrough for linking tests - -#define TEST_CASE(...) - -#define EXPECT_ABORT_BEGIN \ - if (TEST_PROTECT()) \ - { - -#define VERIFY_FAILS_END \ - } \ - Unity.CurrentTestFailed = (Unity.CurrentTestFailed != 0) ? 0 : 1; \ - if (Unity.CurrentTestFailed == 1) { \ - SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ - UnityPrintNumberUnsigned(Unity.CurrentTestLineNumber); \ - UNITY_OUTPUT_CHAR(':'); \ - UnityPrint(Unity.CurrentTestName); \ - UnityPrint(":FAIL: [[[[ Test Should Have Failed But Did Not ]]]]"); \ - UNITY_OUTPUT_CHAR('\n'); \ - } - -#define VERIFY_IGNORES_END \ - } \ - Unity.CurrentTestFailed = (Unity.CurrentTestIgnored != 0) ? 0 : 1; \ - Unity.CurrentTestIgnored = 0; \ - if (Unity.CurrentTestFailed == 1) { \ - SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ - UnityPrintNumberUnsigned(Unity.CurrentTestLineNumber); \ - UNITY_OUTPUT_CHAR(':'); \ - UnityPrint(Unity.CurrentTestName); \ - UnityPrint(":FAIL: [[[[ Test Should Have Ignored But Did Not ]]]]"); \ - UNITY_OUTPUT_CHAR('\n'); \ - } - -int SetToOneToFailInTearDown; -int SetToOneMeanWeAlreadyCheckedThisGuy; - -void setUp(void) -{ - SetToOneToFailInTearDown = 0; - SetToOneMeanWeAlreadyCheckedThisGuy = 0; -} - -void tearDown(void) -{ - if (SetToOneToFailInTearDown == 1) - TEST_FAIL_MESSAGE("<= Failed in tearDown"); - if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) - { - UnityPrint(": [[[[ Test Should Have Passed But Did Not ]]]]"); - UNITY_OUTPUT_CHAR('\n'); - } -} - -TEST_CASE(0) -TEST_CASE(44) -TEST_CASE((90)+9) -void test_TheseShouldAllPass(int Num) -{ - TEST_ASSERT_TRUE(Num < 100); -} - -TEST_CASE(3) -TEST_CASE(77) -TEST_CASE( (99) + 1 - (1)) -void test_TheseShouldAllFail(int Num) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_TRUE(Num > 100); - VERIFY_FAILS_END -} - -TEST_CASE(1) -TEST_CASE(44) -TEST_CASE(99) -TEST_CASE(98) -void test_TheseAreEveryOther(int Num) -{ - if (Num & 1) - { - EXPECT_ABORT_BEGIN - TEST_ASSERT_TRUE(Num > 100); - VERIFY_FAILS_END - } - else - { - TEST_ASSERT_TRUE(Num < 100); - } -} - -void test_NormalPassesStillWork(void) -{ - TEST_ASSERT_TRUE(1); -} - -void test_NormalFailsStillWork(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_TRUE(0); - VERIFY_FAILS_END -} diff --git a/tests/unity/test/tests/testunity.c b/tests/unity/test/tests/testunity.c deleted file mode 100644 index af06647..0000000 --- a/tests/unity/test/tests/testunity.c +++ /dev/null @@ -1,5337 +0,0 @@ -/* ========================================== - Unity Project - A Test Framework for C - Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams - [Released under MIT License. Please refer to license.txt for details] -========================================== */ - -#include "unity.h" -#include -#include - -// Dividing by these constants produces +/- infinity. -// The rationale is given in UnityAssertFloatIsInf's body. -#ifndef UNITY_EXCLUDE_FLOAT -static const UNITY_FLOAT f_zero = 0.0f; -#endif - -#ifndef UNITY_EXCLUDE_DOUBLE -static const UNITY_DOUBLE d_zero = 0.0; -#endif - -#define EXPECT_ABORT_BEGIN \ - startPutcharSpy(); \ - if (TEST_PROTECT()) \ - { - -#define VERIFY_FAILS_END \ - } \ - endPutcharSpy(); /* start/end Spy to suppress output of failure message */ \ - Unity.CurrentTestFailed = (Unity.CurrentTestFailed == 1) ? 0 : 1; \ - if (Unity.CurrentTestFailed == 1) { \ - SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ - UnityPrintNumberUnsigned(Unity.CurrentTestLineNumber); \ - UNITY_OUTPUT_CHAR(':'); \ - UnityPrint(Unity.CurrentTestName); \ - UnityPrint(":FAIL: [[[[ Test Should Have Failed But Did Not ]]]]"); \ - UNITY_OUTPUT_CHAR('\n'); \ - } - -#define VERIFY_IGNORES_END \ - } \ - endPutcharSpy(); /* start/end Spy to suppress output of ignore message */ \ - Unity.CurrentTestFailed = (Unity.CurrentTestIgnored == 1) ? 0 : 1; \ - Unity.CurrentTestIgnored = 0; \ - if (Unity.CurrentTestFailed == 1) { \ - SetToOneMeanWeAlreadyCheckedThisGuy = 1; \ - UnityPrintNumberUnsigned(Unity.CurrentTestLineNumber); \ - UNITY_OUTPUT_CHAR(':'); \ - UnityPrint(Unity.CurrentTestName); \ - UnityPrint(":FAIL: [[[[ Test Should Have Ignored But Did Not ]]]]"); \ - UNITY_OUTPUT_CHAR('\n'); \ - } - -void startPutcharSpy(void); -void endPutcharSpy(void); -char* getBufferPutcharSpy(void); - -static int SetToOneToFailInTearDown; -static int SetToOneMeanWeAlreadyCheckedThisGuy; - -void setUp(void) -{ - SetToOneToFailInTearDown = 0; - SetToOneMeanWeAlreadyCheckedThisGuy = 0; -} - -void tearDown(void) -{ - endPutcharSpy(); /* Stop suppressing test output */ - if (SetToOneToFailInTearDown == 1) - { - /* These will be skipped internally if already failed/ignored */ - TEST_FAIL_MESSAGE("<= Failed in tearDown"); - TEST_IGNORE_MESSAGE("<= Ignored in tearDown"); - } - if ((SetToOneMeanWeAlreadyCheckedThisGuy == 0) && (Unity.CurrentTestFailed > 0)) - { - UnityPrint(": [[[[ Test Should Have Passed But Did Not ]]]]"); - UNITY_OUTPUT_CHAR('\n'); - } -} - -void testUnitySizeInitializationReminder(void) -{ - /* This test ensures that sizeof(struct UNITY_STORAGE_T) doesn't change. If this - * test breaks, go look at the initialization of the Unity global variable - * in unity.c and make sure we're filling in the proper fields. */ - const char* message = "Unexpected size for UNITY_STORAGE_T struct. Please check that " - "the initialization of the Unity symbol in unity.c is " - "still correct."; - - /* Define a structure with all the same fields as `struct UNITY_STORAGE_T`. */ -#ifdef UNITY_EXCLUDE_DETAILS - struct { - const char* TestFile; - const char* CurrentTestName; - UNITY_LINE_TYPE CurrentTestLineNumber; - UNITY_COUNTER_TYPE NumberOfTests; - UNITY_COUNTER_TYPE TestFailures; - UNITY_COUNTER_TYPE TestIgnores; - UNITY_COUNTER_TYPE CurrentTestFailed; - UNITY_COUNTER_TYPE CurrentTestIgnored; -#ifndef UNITY_EXCLUDE_SETJMP_H - jmp_buf AbortFrame; -#endif - } _Expected_Unity; -#else - struct { - const char* TestFile; - const char* CurrentTestName; - const char* CurrentDetails1; - const char* CurrentDetails2; - UNITY_LINE_TYPE CurrentTestLineNumber; - UNITY_COUNTER_TYPE NumberOfTests; - UNITY_COUNTER_TYPE TestFailures; - UNITY_COUNTER_TYPE TestIgnores; - UNITY_COUNTER_TYPE CurrentTestFailed; - UNITY_COUNTER_TYPE CurrentTestIgnored; -#ifndef UNITY_EXCLUDE_SETJMP_H - jmp_buf AbortFrame; -#endif - } _Expected_Unity; -#endif - - /* Compare our fake structure's size to the actual structure's size. They - * should be the same. - * - * This accounts for alignment, padding, and packing issues that might come - * up between different architectures. */ - TEST_ASSERT_EQUAL_MESSAGE(sizeof(_Expected_Unity), sizeof(Unity), message); -} - -void testPassShouldEndImmediatelyWithPass(void) -{ - TEST_PASS(); - TEST_FAIL_MESSAGE("We should have passed already and finished this test"); -} - -void testTrue(void) -{ - TEST_ASSERT(1); - - TEST_ASSERT_TRUE(1); -} - -void testFalse(void) -{ - TEST_ASSERT_FALSE(0); - - TEST_ASSERT_UNLESS(0); -} - -void testPreviousPass(void) -{ - TEST_ASSERT_EQUAL_INT(0U, Unity.TestFailures); -} - -void testNotVanilla(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT(0); - VERIFY_FAILS_END -} - -void testNotTrue(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_TRUE(0); - VERIFY_FAILS_END -} - -void testNotFalse(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_FALSE(1); - VERIFY_FAILS_END -} - -void testNotUnless(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_UNLESS(1); - VERIFY_FAILS_END -} - -void testNotNotEqual(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_NOT_EQUAL(10, 10); - VERIFY_FAILS_END -} - -void testFail(void) -{ - EXPECT_ABORT_BEGIN - TEST_FAIL_MESSAGE("Expected for testing"); - VERIFY_FAILS_END -} - -void testIsNull(void) -{ - char* ptr1 = NULL; - const char* ptr2 = "hello"; - - TEST_ASSERT_NULL(ptr1); - TEST_ASSERT_NOT_NULL(ptr2); -} - -void testIsNullShouldFailIfNot(void) -{ - const char* ptr1 = "hello"; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_NULL(ptr1); - VERIFY_FAILS_END -} - -void testNotNullShouldFailIfNULL(void) -{ - char* ptr1 = NULL; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_NOT_NULL(ptr1); - VERIFY_FAILS_END -} - -void testIgnore(void) -{ - EXPECT_ABORT_BEGIN - TEST_IGNORE(); - TEST_FAIL_MESSAGE("This should not be reached"); - VERIFY_IGNORES_END -} - -void testIgnoreMessage(void) -{ - EXPECT_ABORT_BEGIN - TEST_IGNORE_MESSAGE("This is an expected TEST_IGNORE_MESSAGE string!"); - TEST_FAIL_MESSAGE("This should not be reached"); - VERIFY_IGNORES_END -} - -void testNotEqualInts(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_INT(3982, 3983); - VERIFY_FAILS_END -} - -void testNotEqualInt8s(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_INT8(-127, -126); - VERIFY_FAILS_END -} - -void testNotEqualInt16s(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_INT16(-16383, -16382); - VERIFY_FAILS_END -} - -void testNotEqualInt32s(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_INT32(-2147483647, -2147483648); //use largest 32 bit negative to test printability - VERIFY_FAILS_END -} - -void testNotEqualBits(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_BITS(0xFF00, 0x5555, 0x5A55); - VERIFY_FAILS_END -} - -void testNotEqualUInts(void) -{ - UNITY_UINT16 v0, v1; - - v0 = 9000; - v1 = 9001; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_UINT(v0, v1); - VERIFY_FAILS_END -} - -void testNotEqualUInt8s(void) -{ - UNITY_UINT8 v0, v1; - - v0 = 254; - v1 = 255; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_UINT8(v0, v1); - VERIFY_FAILS_END -} - -void testNotEqualUInt16s(void) -{ - UNITY_UINT16 v0, v1; - - v0 = 65535; - v1 = 65534; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_UINT16(v0, v1); - VERIFY_FAILS_END -} - -void testNotEqualUInt32s(void) -{ - UNITY_UINT32 v0, v1; - - v0 = 4294967295; - v1 = 4294967294; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_UINT32(v0, v1); - VERIFY_FAILS_END -} - -void testNotEqualHex8s(void) -{ - UNITY_UINT8 v0, v1; - - v0 = 0x23; - v1 = 0x22; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_HEX8(v0, v1); - VERIFY_FAILS_END -} - -void testNotEqualHex8sIfSigned(void) -{ - UNITY_INT8 v0, v1; - - v0 = -2; - v1 = 2; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_HEX8(v0, v1); - VERIFY_FAILS_END -} - -void testNotEqualHex16s(void) -{ - UNITY_UINT16 v0, v1; - - v0 = 0x1234; - v1 = 0x1235; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_HEX16(v0, v1); - VERIFY_FAILS_END -} - -void testNotEqualHex16sIfSigned(void) -{ - UNITY_INT16 v0, v1; - - v0 = -1024; - v1 = -1028; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_HEX16(v0, v1); - VERIFY_FAILS_END -} - -void testNotEqualHex32s(void) -{ - UNITY_UINT32 v0, v1; - - v0 = 900000; - v1 = 900001; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_HEX32(v0, v1); - VERIFY_FAILS_END -} - -void testNotEqualHex32sIfSigned(void) -{ - UNITY_INT32 v0, v1; - - v0 = -900000; - v1 = 900001; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_HEX32(v0, v1); - VERIFY_FAILS_END -} - -void testEqualInts(void) -{ - int v0, v1; - int *p0, *p1; - - v0 = 19467; - v1 = 19467; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_EQUAL_INT(1837, 1837); - TEST_ASSERT_EQUAL_INT(-27365, -27365); - TEST_ASSERT_EQUAL_INT(v0, v1); - TEST_ASSERT_EQUAL_INT(19467, v1); - TEST_ASSERT_EQUAL_INT(v0, 19467); - TEST_ASSERT_EQUAL_INT(*p0, v1); - TEST_ASSERT_EQUAL_INT(*p0, *p1); - TEST_ASSERT_EQUAL_INT(*p0, 19467); -} - -void testEqualInt8s(void) -{ - UNITY_INT8 v0, v1; - UNITY_INT8 *p0, *p1; - - v0 = 0x22; - v1 = 0x22; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_EQUAL_INT8(0x22, 0x22); - TEST_ASSERT_EQUAL_INT8(v0, v1); - TEST_ASSERT_EQUAL_INT8(0x22, v1); - TEST_ASSERT_EQUAL_INT8(v0, 0x22); - TEST_ASSERT_EQUAL_INT8(*p0, v1); - TEST_ASSERT_EQUAL_INT8(*p0, *p1); - TEST_ASSERT_EQUAL_INT8(*p0, 0x22); -} - -void testEqualInt8sWhenThereAreDifferencesOutside8Bits(void) -{ - TEST_ASSERT_EQUAL_INT8(0x321,0x421); - TEST_ASSERT_EQUAL_INT8(0xFF21,0x0021); -} - -void testEqualInt16s(void) -{ - UNITY_INT16 v0, v1; - UNITY_INT16 *p0, *p1; - - v0 = 0x7876; - v1 = 0x7876; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_EQUAL_INT16(0x7876, 0x7876); - TEST_ASSERT_EQUAL_INT16(v0, v1); - TEST_ASSERT_EQUAL_INT16(0x7876, v1); - TEST_ASSERT_EQUAL_INT16(v0, 0x7876); - TEST_ASSERT_EQUAL_INT16(*p0, v1); - TEST_ASSERT_EQUAL_INT16(*p0, *p1); - TEST_ASSERT_EQUAL_INT16(*p0, 0x7876); -} - -void testEqualInt16sNegatives(void) -{ - UNITY_INT16 v0, v1; - UNITY_INT16 *p0, *p1; - - v0 = -7876; - v1 = -7876; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_EQUAL_INT16(-7876, -7876); - TEST_ASSERT_EQUAL_INT16(v0, v1); - TEST_ASSERT_EQUAL_INT16(-7876, v1); - TEST_ASSERT_EQUAL_INT16(v0, -7876); - TEST_ASSERT_EQUAL_INT16(*p0, v1); - TEST_ASSERT_EQUAL_INT16(*p0, *p1); - TEST_ASSERT_EQUAL_INT16(*p0, -7876); -} - -void testEqualInt16sWhenThereAreDifferencesOutside16Bits(void) -{ - TEST_ASSERT_EQUAL_INT16(0x54321,0x64321); - TEST_ASSERT_EQUAL_INT16(0xFFFF4321,0x00004321); -} - -void testEqualInt32s(void) -{ - UNITY_INT32 v0, v1; - UNITY_INT32 *p0, *p1; - - v0 = 0x78760000; - v1 = 0x78760000; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_EQUAL_INT32(0x78760000, 0x78760000); - TEST_ASSERT_EQUAL_INT32(v0, v1); - TEST_ASSERT_EQUAL_INT32(0x78760000, v1); - TEST_ASSERT_EQUAL_INT32(v0, 0x78760000); - TEST_ASSERT_EQUAL_INT32(*p0, v1); - TEST_ASSERT_EQUAL_INT32(*p0, *p1); - TEST_ASSERT_EQUAL_INT32(*p0, 0x78760000); -} - -void testEqualInt32sNegatives(void) -{ - UNITY_INT32 v0, v1; - UNITY_INT32 *p0, *p1; - - v0 = -123456789; - v1 = -123456789; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_EQUAL_INT32(-123456789, -123456789); - TEST_ASSERT_EQUAL_INT32(v0, v1); - TEST_ASSERT_EQUAL_INT32(-123456789, v1); - TEST_ASSERT_EQUAL_INT32(v0, -123456789); - TEST_ASSERT_EQUAL_INT32(*p0, v1); - TEST_ASSERT_EQUAL_INT32(*p0, *p1); - TEST_ASSERT_EQUAL_INT32(*p0, -123456789); -} - - -void testEqualUints(void) -{ - unsigned int v0, v1; - unsigned int *p0, *p1; - - v0 = 19467; - v1 = 19467; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_EQUAL_UINT(1837, 1837); - TEST_ASSERT_EQUAL_UINT(v0, v1); - TEST_ASSERT_EQUAL_UINT(19467, v1); - TEST_ASSERT_EQUAL_UINT(v0, 19467); - TEST_ASSERT_EQUAL_UINT(*p0, v1); - TEST_ASSERT_EQUAL_UINT(*p0, *p1); - TEST_ASSERT_EQUAL_UINT(*p0, 19467); - TEST_ASSERT_EQUAL_UINT(60872u, 60872u); -} - - -void testEqualUint8s(void) -{ - UNITY_UINT8 v0, v1; - UNITY_UINT8 *p0, *p1; - - v0 = 0x22; - v1 = 0x22; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_EQUAL_UINT8(0x22, 0x22); - TEST_ASSERT_EQUAL_UINT8(v0, v1); - TEST_ASSERT_EQUAL_UINT8(0x22, v1); - TEST_ASSERT_EQUAL_UINT8(v0, 0x22); - TEST_ASSERT_EQUAL_UINT8(*p0, v1); - TEST_ASSERT_EQUAL_UINT8(*p0, *p1); - TEST_ASSERT_EQUAL_UINT8(*p0, 0x22); -} - -void testEqualUint8sWhenThereAreDifferencesOutside8Bits(void) -{ - TEST_ASSERT_EQUAL_UINT8(0x321,0x421); - TEST_ASSERT_EQUAL_UINT8(0xFF21,0x0021); -} - -void testEqualUint16s(void) -{ - UNITY_UINT16 v0, v1; - UNITY_UINT16 *p0, *p1; - - v0 = 0x9876; - v1 = 0x9876; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_EQUAL_UINT16(0x9876, 0x9876); - TEST_ASSERT_EQUAL_UINT16(v0, v1); - TEST_ASSERT_EQUAL_UINT16(0x9876, v1); - TEST_ASSERT_EQUAL_UINT16(v0, 0x9876); - TEST_ASSERT_EQUAL_UINT16(*p0, v1); - TEST_ASSERT_EQUAL_UINT16(*p0, *p1); - TEST_ASSERT_EQUAL_UINT16(*p0, 0x9876); -} - -void testEqualUint16sWhenThereAreDifferencesOutside16Bits(void) -{ - TEST_ASSERT_EQUAL_UINT16(0x54321,0x64321); - TEST_ASSERT_EQUAL_UINT16(0xFFFF4321,0x00004321); -} - -void testEqualUint32s(void) -{ - UNITY_UINT32 v0, v1; - UNITY_UINT32 *p0, *p1; - - v0 = 0x98760000; - v1 = 0x98760000; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_EQUAL_UINT32(0x98760000, 0x98760000); - TEST_ASSERT_EQUAL_UINT32(v0, v1); - TEST_ASSERT_EQUAL_UINT32(0x98760000, v1); - TEST_ASSERT_EQUAL_UINT32(v0, 0x98760000); - TEST_ASSERT_EQUAL_UINT32(*p0, v1); - TEST_ASSERT_EQUAL_UINT32(*p0, *p1); - TEST_ASSERT_EQUAL_UINT32(*p0, 0x98760000); -} - -void testNotEqual(void) -{ - TEST_ASSERT_NOT_EQUAL(0, 1); - TEST_ASSERT_NOT_EQUAL(1, 0); - TEST_ASSERT_NOT_EQUAL(100, 101); - TEST_ASSERT_NOT_EQUAL(0, -1); - TEST_ASSERT_NOT_EQUAL(65535, -65535); - TEST_ASSERT_NOT_EQUAL(75, 900); - TEST_ASSERT_NOT_EQUAL(-100, -101); -} - -void testEqualHex8s(void) -{ - UNITY_UINT8 v0, v1; - UNITY_UINT8 *p0, *p1; - - v0 = 0x22; - v1 = 0x22; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_EQUAL_HEX8(0x22, 0x22); - TEST_ASSERT_EQUAL_HEX8(v0, v1); - TEST_ASSERT_EQUAL_HEX8(0x22, v1); - TEST_ASSERT_EQUAL_HEX8(v0, 0x22); - TEST_ASSERT_EQUAL_HEX8(*p0, v1); - TEST_ASSERT_EQUAL_HEX8(*p0, *p1); - TEST_ASSERT_EQUAL_HEX8(*p0, 0x22); -} - -void testEqualHex8sWhenThereAreDifferencesOutside8Bits(void) -{ - TEST_ASSERT_EQUAL_HEX8(0x321,0x421); - TEST_ASSERT_EQUAL_HEX8(0xFF21,0x0021); -} - -void testEqualHex8sNegatives(void) -{ - UNITY_UINT8 v0, v1; - UNITY_UINT8 *p0, *p1; - - v0 = 0xDD; - v1 = 0xDD; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_EQUAL_HEX8(0xDD, 0xDD); - TEST_ASSERT_EQUAL_HEX8(v0, v1); - TEST_ASSERT_EQUAL_HEX8(0xDD, v1); - TEST_ASSERT_EQUAL_HEX8(v0, 0xDD); - TEST_ASSERT_EQUAL_HEX8(*p0, v1); - TEST_ASSERT_EQUAL_HEX8(*p0, *p1); - TEST_ASSERT_EQUAL_HEX8(*p0, 0xDD); -} - -void testEqualHex16s(void) -{ - UNITY_UINT16 v0, v1; - UNITY_UINT16 *p0, *p1; - - v0 = 0x9876; - v1 = 0x9876; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_EQUAL_HEX16(0x9876, 0x9876); - TEST_ASSERT_EQUAL_HEX16(v0, v1); - TEST_ASSERT_EQUAL_HEX16(0x9876, v1); - TEST_ASSERT_EQUAL_HEX16(v0, 0x9876); - TEST_ASSERT_EQUAL_HEX16(*p0, v1); - TEST_ASSERT_EQUAL_HEX16(*p0, *p1); - TEST_ASSERT_EQUAL_HEX16(*p0, 0x9876); -} - -void testEqualHex16sWhenThereAreDifferencesOutside16Bits(void) -{ - TEST_ASSERT_EQUAL_HEX16(0x54321,0x64321); - TEST_ASSERT_EQUAL_HEX16(0xFFFF4321,0x00004321); -} - -void testEqualHex32s(void) -{ - UNITY_UINT32 v0, v1; - UNITY_UINT32 *p0, *p1; - - v0 = 0x98765432ul; - v1 = 0x98765432ul; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_EQUAL_HEX32(0x98765432ul, 0x98765432ul); - TEST_ASSERT_EQUAL_HEX32(v0, v1); - TEST_ASSERT_EQUAL_HEX32(0x98765432ul, v1); - TEST_ASSERT_EQUAL_HEX32(v0, 0x98765432ul); - TEST_ASSERT_EQUAL_HEX32(*p0, v1); - TEST_ASSERT_EQUAL_HEX32(*p0, *p1); - TEST_ASSERT_EQUAL_HEX32(*p0, 0x98765432ul); -} - -void testEqualBits(void) -{ - UNITY_UINT32 v0 = 0xFF55AA00; - UNITY_UINT32 v1 = 0x55550000; - - TEST_ASSERT_BITS(v1, v0, 0x55550000); - TEST_ASSERT_BITS(v1, v0, 0xFF55CC00); - TEST_ASSERT_BITS(0xFFFFFFFF, v0, 0xFF55AA00); - TEST_ASSERT_BITS(0xFFFFFFFF, v0, v0); - TEST_ASSERT_BITS(0xF0F0F0F0, v0, 0xFC5DAE0F); - TEST_ASSERT_BITS_HIGH(v1, v0); - TEST_ASSERT_BITS_LOW(0x000055FF, v0); - TEST_ASSERT_BIT_HIGH(30, v0); - TEST_ASSERT_BIT_LOW(5, v0); -} - -void testNotEqualBitHigh(void) -{ - UNITY_UINT32 v0 = 0x7F55AA00; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_BIT_HIGH(31, v0); - VERIFY_FAILS_END -} - -void testNotEqualBitLow(void) -{ - UNITY_UINT32 v0 = 0xFF55AA00; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_BIT_LOW(30, v0); - VERIFY_FAILS_END -} - -void testNotEqualBitsHigh(void) -{ - UNITY_UINT32 v0 = 0xFF55AA00; - UNITY_UINT32 v1 = 0x55550000; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_BITS_HIGH(v0, v1); - VERIFY_FAILS_END - -} - -void testNotEqualBitsLow(void) -{ - UNITY_UINT32 v0 = 0xFF55AA00; - UNITY_UINT32 v1 = 0x55550000; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_BITS_LOW(v0, v1); - VERIFY_FAILS_END -} - - -void testEqualShorts(void) -{ - short v0, v1; - short *p0, *p1; - - v0 = 19467; - v1 = 19467; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_EQUAL_INT(1837, 1837); - TEST_ASSERT_EQUAL_INT(-2987, -2987); - TEST_ASSERT_EQUAL_INT(v0, v1); - TEST_ASSERT_EQUAL_INT(19467, v1); - TEST_ASSERT_EQUAL_INT(v0, 19467); - TEST_ASSERT_EQUAL_INT(*p0, v1); - TEST_ASSERT_EQUAL_INT(*p0, *p1); - TEST_ASSERT_EQUAL_INT(*p0, 19467); -} - -void testEqualUShorts(void) -{ - unsigned short v0, v1; - unsigned short *p0, *p1; - - v0 = 19467; - v1 = 19467; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_EQUAL_UINT(1837, 1837); - TEST_ASSERT_EQUAL_UINT(2987, 2987); - TEST_ASSERT_EQUAL_UINT(v0, v1); - TEST_ASSERT_EQUAL_UINT(19467, v1); - TEST_ASSERT_EQUAL_UINT(v0, 19467); - TEST_ASSERT_EQUAL_UINT(*p0, v1); - TEST_ASSERT_EQUAL_UINT(*p0, *p1); - TEST_ASSERT_EQUAL_UINT(*p0, 19467); -} - -void testEqualChars(void) -{ - signed char v0, v1; - signed char *p0, *p1; - - v0 = 109; - v1 = 109; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_EQUAL_INT(42, 42); - TEST_ASSERT_EQUAL_INT(-116, -116); - TEST_ASSERT_EQUAL_INT(v0, v1); - TEST_ASSERT_EQUAL_INT(109, v1); - TEST_ASSERT_EQUAL_INT(v0, 109); - TEST_ASSERT_EQUAL_INT(*p0, v1); - TEST_ASSERT_EQUAL_INT(*p0, *p1); - TEST_ASSERT_EQUAL_INT(*p0, 109); -} - -void testEqualUChars(void) -{ - unsigned char v0, v1; - unsigned char *p0, *p1; - - v0 = 251; - v1 = 251; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_EQUAL_INT(42, 42); - TEST_ASSERT_EQUAL_INT(v0, v1); - TEST_ASSERT_EQUAL_INT(251, v1); - TEST_ASSERT_EQUAL_INT(v0, 251); - TEST_ASSERT_EQUAL_INT(*p0, v1); - TEST_ASSERT_EQUAL_INT(*p0, *p1); - TEST_ASSERT_EQUAL_INT(*p0, 251); -} - -void testEqualPointers(void) -{ - int v0, v1; - int *p0, *p1, *p2; - - v0 = 19467; - v1 = 18271; - p0 = &v0; - p1 = &v1; - p2 = &v1; - - TEST_ASSERT_EQUAL_PTR(p0, &v0); - TEST_ASSERT_EQUAL_PTR(&v1, p1); - TEST_ASSERT_EQUAL_PTR(p2, p1); - TEST_ASSERT_EQUAL_PTR(&v0, &v0); -} - -void testNotEqualPointers(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_PTR(0x12345678, 0x12345677); - VERIFY_FAILS_END -} - -void testIntsWithinDelta(void) -{ - TEST_ASSERT_INT_WITHIN(1, 5000, 5001); - TEST_ASSERT_INT_WITHIN(5, 5000, 4996); - TEST_ASSERT_INT_WITHIN(5, 5000, 5005); - TEST_ASSERT_INT_WITHIN(500, 50, -440); - - TEST_ASSERT_INT_WITHIN(2, -1, -1); - TEST_ASSERT_INT_WITHIN(5, 1, -1); - TEST_ASSERT_INT_WITHIN(5, -1, 1); -} - -void testIntsWithinDeltaAndCustomMessage(void) -{ - TEST_ASSERT_INT_WITHIN_MESSAGE(1, 5000, 5001, "Custom Message."); - TEST_ASSERT_INT_WITHIN_MESSAGE(5, 5000, 4996, "Custom Message."); - TEST_ASSERT_INT_WITHIN_MESSAGE(5, 5000, 5005, "Custom Message."); - TEST_ASSERT_INT_WITHIN_MESSAGE(500, 50, -440, "Custom Message."); - - TEST_ASSERT_INT_WITHIN_MESSAGE(2, -1, -1, "Custom Message."); - TEST_ASSERT_INT_WITHIN_MESSAGE(5, 1, -1, "Custom Message."); - TEST_ASSERT_INT_WITHIN_MESSAGE(5, -1, 1, "Custom Message."); -} - -void testIntsNotWithinDelta(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_INT_WITHIN(5, 5000, 5006); - VERIFY_FAILS_END -} - -void testIntsNotWithinDeltaAndCustomMessage(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_INT_WITHIN_MESSAGE(5, 5000, 5006, "Custom Message."); - VERIFY_FAILS_END -} - -void testUIntsWithinDelta(void) -{ - TEST_ASSERT_UINT_WITHIN(1, 5000, 5001); - TEST_ASSERT_UINT_WITHIN(5, 5000, 4996); - TEST_ASSERT_UINT_WITHIN(5, 5000, 5005); -} - -void testUIntsWithinDeltaAndCustomMessage(void) -{ - TEST_ASSERT_UINT_WITHIN_MESSAGE(1, 5000, 5001, "Custom Message."); - TEST_ASSERT_UINT_WITHIN_MESSAGE(5, 5000, 4996, "Custom Message."); - TEST_ASSERT_UINT_WITHIN_MESSAGE(5, 5000, 5005, "Custom Message."); -} - -void testUIntsNotWithinDelta(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_UINT_WITHIN(1, 2147483647u, 2147483649u); - VERIFY_FAILS_END -} - -void testUIntsNotWithinDeltaAndCustomMessage(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_UINT_WITHIN_MESSAGE(1, 2147483647u, 2147483649u, "Custom Message."); - VERIFY_FAILS_END -} - -void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassSmallFirst(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_UINT_WITHIN(5, 1, -1); - VERIFY_FAILS_END -} - -void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassSmallFirstAndCustomMessage(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_UINT_WITHIN_MESSAGE(5, 1, -1, "Custom Message."); - VERIFY_FAILS_END -} - -void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassBigFirst(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_UINT_WITHIN(5, -1, 1); - VERIFY_FAILS_END -} - -void testUIntsNotWithinDeltaEvenThoughASignedIntWouldPassBigFirstAndCustomMessage(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_UINT_WITHIN_MESSAGE(5, -1, 1, "Custom Message."); - VERIFY_FAILS_END -} - -void testHEX32sWithinDelta(void) -{ - TEST_ASSERT_HEX32_WITHIN(1, 5000, 5001); - TEST_ASSERT_HEX32_WITHIN(5, 5000, 4996); - TEST_ASSERT_HEX32_WITHIN(5, 5000, 5005); -} - -void testHEX32sWithinDeltaAndCustomMessage(void) -{ - TEST_ASSERT_HEX32_WITHIN_MESSAGE(1, 5000, 5001, "Custom Message."); - TEST_ASSERT_HEX32_WITHIN_MESSAGE(5, 5000, 4996, "Custom Message."); - TEST_ASSERT_HEX32_WITHIN_MESSAGE(5, 5000, 5005, "Custom Message."); -} - -void testHEX32sNotWithinDelta(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_HEX32_WITHIN(1, 2147483647u, 2147483649u); - VERIFY_FAILS_END -} - -void testHEX32sNotWithinDeltaAndCustomMessage(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_HEX32_WITHIN_MESSAGE(1, 2147483647u, 2147483649u, "Custom Message."); - VERIFY_FAILS_END -} - -void testHEX32sNotWithinDeltaEvenThoughASignedIntWouldPass(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_HEX32_WITHIN(5, 1, -1); - VERIFY_FAILS_END -} - -void testHEX32sNotWithinDeltaEvenThoughASignedIntWouldPassAndCustomMessage(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_HEX32_WITHIN_MESSAGE(5, 1, -1, "Custom Message."); - VERIFY_FAILS_END -} - -void testHEX16sWithinDelta(void) -{ - TEST_ASSERT_HEX16_WITHIN(1, 5000, 5001); - TEST_ASSERT_HEX16_WITHIN(5, 5000, 4996); - TEST_ASSERT_HEX16_WITHIN(5, 5000, 5005); -} - -void testHEX16sWithinDeltaAndCustomMessage(void) -{ - TEST_ASSERT_HEX16_WITHIN_MESSAGE(1, 5000, 5001, "Custom Message."); - TEST_ASSERT_HEX16_WITHIN_MESSAGE(5, 5000, 4996, "Custom Message."); - TEST_ASSERT_HEX16_WITHIN_MESSAGE(5, 5000, 5005, "Custom Message."); -} - -void testHEX16sWithinDeltaWhenThereAreDifferenceOutsideOf16Bits(void) -{ - TEST_ASSERT_HEX16_WITHIN(5, 0x54321, 0x44321); -} - -void testHEX16sWithinDeltaWhenThereAreDifferenceOutsideOf16BitsAndCustomMessage(void) -{ - TEST_ASSERT_HEX16_WITHIN_MESSAGE(5, 0x54321, 0x44321, "Custom Message."); -} - -void testHEX16sNotWithinDelta(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_HEX16_WITHIN(2, 65535, 0); - VERIFY_FAILS_END -} - -void testHEX16sNotWithinDeltaAndCustomMessage(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_HEX16_WITHIN_MESSAGE(2, 65535, 0, "Custom Message."); - VERIFY_FAILS_END -} - -void testHEX8sWithinDelta(void) -{ - TEST_ASSERT_HEX8_WITHIN(1, 254, 255); - TEST_ASSERT_HEX8_WITHIN(5, 251, 255); - TEST_ASSERT_HEX8_WITHIN(5, 1, 4); -} - -void testHEX8sWithinDeltaAndCustomMessage(void) -{ - TEST_ASSERT_HEX8_WITHIN_MESSAGE(1, 254, 255, "Custom Message."); - TEST_ASSERT_HEX8_WITHIN_MESSAGE(5, 251, 255, "Custom Message."); - TEST_ASSERT_HEX8_WITHIN_MESSAGE(5, 1, 4, "Custom Message."); -} - -void testHEX8sWithinDeltaWhenThereAreDifferenceOutsideOf8Bits(void) -{ - TEST_ASSERT_HEX8_WITHIN(5, 0x123, 0xF23); -} - -void testHEX8sWithinDeltaWhenThereAreDifferenceOutsideOf8BitsAndCustomMessage(void) -{ - TEST_ASSERT_HEX8_WITHIN_MESSAGE(5, 0x123, 0xF23, "Custom Message."); -} - -void testHEX8sNotWithinDelta(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_HEX8_WITHIN(2, 255, 0); - VERIFY_FAILS_END -} - -void testHEX8sNotWithinDeltaAndCustomMessage(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_HEX8_WITHIN_MESSAGE(2, 255, 0, "Custom Message."); - VERIFY_FAILS_END -} - -//----------------- - -void testUINT32sWithinDelta(void) -{ - TEST_ASSERT_UINT32_WITHIN(1, 5000, 5001); - TEST_ASSERT_UINT32_WITHIN(5, 5000, 4996); - TEST_ASSERT_UINT32_WITHIN(5, 5000, 5005); -} - -void testUINT32sWithinDeltaAndCustomMessage(void) -{ - TEST_ASSERT_UINT32_WITHIN_MESSAGE(1, 5000, 5001, "Custom Message."); - TEST_ASSERT_UINT32_WITHIN_MESSAGE(5, 5000, 4996, "Custom Message."); - TEST_ASSERT_UINT32_WITHIN_MESSAGE(5, 5000, 5005, "Custom Message."); -} - -void testUINT32sNotWithinDelta(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_UINT32_WITHIN(1, 2147483647u, 2147483649u); - VERIFY_FAILS_END -} - -void testUINT32sNotWithinDeltaAndCustomMessage(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_UINT32_WITHIN_MESSAGE(1, 2147483647u, 2147483649u, "Custom Message."); - VERIFY_FAILS_END -} - -void testUINT32sNotWithinDeltaEvenThoughASignedIntWouldPass(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_UINT32_WITHIN(5, 1, -1); - VERIFY_FAILS_END -} - -void testUINT32sNotWithinDeltaEvenThoughASignedIntWouldPassAndCustomMessage(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_UINT32_WITHIN_MESSAGE(5, 1, -1, "Custom Message."); - VERIFY_FAILS_END -} - -void testUINT16sWithinDelta(void) -{ - TEST_ASSERT_UINT16_WITHIN(1, 5000, 5001); - TEST_ASSERT_UINT16_WITHIN(5, 5000, 4996); - TEST_ASSERT_UINT16_WITHIN(5, 5000, 5005); -} - -void testUINT16sWithinDeltaAndCustomMessage(void) -{ - TEST_ASSERT_UINT16_WITHIN_MESSAGE(1, 5000, 5001, "Custom Message."); - TEST_ASSERT_UINT16_WITHIN_MESSAGE(5, 5000, 4996, "Custom Message."); - TEST_ASSERT_UINT16_WITHIN_MESSAGE(5, 5000, 5005, "Custom Message."); -} - -void testUINT16sWithinDeltaWhenThereAreDifferenceOutsideOf16Bits(void) -{ - TEST_ASSERT_UINT16_WITHIN(5, 0x54321, 0x44321); -} - -void testUINT16sWithinDeltaWhenThereAreDifferenceOutsideOf16BitsAndCustomMessage(void) -{ - TEST_ASSERT_UINT16_WITHIN_MESSAGE(5, 0x54321, 0x44321, "Custom Message."); -} - -void testUINT16sNotWithinDelta(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_UINT16_WITHIN(2, 65535, 0); - VERIFY_FAILS_END -} - -void testUINT16sNotWithinDeltaAndCustomMessage(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_UINT16_WITHIN_MESSAGE(2, 65535, 0, "Custom Message."); - VERIFY_FAILS_END -} - -void testUINT8sWithinDelta(void) -{ - TEST_ASSERT_UINT8_WITHIN(1, 254, 255); - TEST_ASSERT_UINT8_WITHIN(5, 251, 255); - TEST_ASSERT_UINT8_WITHIN(5, 1, 4); -} - -void testUINT8sWithinDeltaAndCustomMessage(void) -{ - TEST_ASSERT_UINT8_WITHIN_MESSAGE(1, 254, 255, "Custom Message."); - TEST_ASSERT_UINT8_WITHIN_MESSAGE(5, 251, 255, "Custom Message."); - TEST_ASSERT_UINT8_WITHIN_MESSAGE(5, 1, 4, "Custom Message."); -} - -void testUINT8sWithinDeltaWhenThereAreDifferenceOutsideOf8Bits(void) -{ - TEST_ASSERT_UINT8_WITHIN(5, 0x123, 0xF23); -} - -void testUINT8sWithinDeltaWhenThereAreDifferenceOutsideOf8BitsAndCustomMessage(void) -{ - TEST_ASSERT_UINT8_WITHIN_MESSAGE(5, 0x123, 0xF23, "Custom Message."); -} - -void testUINT8sNotWithinDelta(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_UINT8_WITHIN(2, 255, 0); - VERIFY_FAILS_END -} - -void testUINT8sNotWithinDeltaAndCustomMessage(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_UINT8_WITHIN_MESSAGE(2, 255, 0, "Custom Message."); - VERIFY_FAILS_END -} - -void testINT32sWithinDelta(void) -{ - TEST_ASSERT_INT32_WITHIN(1, 5000, 5001); - TEST_ASSERT_INT32_WITHIN(5, 1, -2); - TEST_ASSERT_INT32_WITHIN(5, -2, 1); -} - -void testINT32sWithinDeltaAndCustomMessage(void) -{ - TEST_ASSERT_INT32_WITHIN_MESSAGE(1, 5000, 5001, "Custom Message."); -} - -void testINT32sNotWithinDelta(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_INT32_WITHIN(1, -3, 1); - VERIFY_FAILS_END -} - -void testINT32sNotWithinDeltaAndDifferenceOverflows(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_INT32_WITHIN(1, -1, 0x7FFFFFFF); - VERIFY_FAILS_END -} -void testINT32sNotWithinDeltaAndCustomMessage(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_INT32_WITHIN_MESSAGE(1, -2, 1, "Custom Message."); - VERIFY_FAILS_END -} - -void testINT16sWithinDelta(void) -{ - TEST_ASSERT_INT16_WITHIN(1, 5000, 5001); - TEST_ASSERT_INT16_WITHIN(5, 2, -2); - TEST_ASSERT_INT16_WITHIN(5, -2, 2); -} - -void testINT16sWithinDeltaAndCustomMessage(void) -{ - TEST_ASSERT_INT16_WITHIN_MESSAGE(1, 5000, 5001, "Custom Message."); -} - -void testINT16sWithinDeltaWhenThereAreDifferenceOutsideOf16Bits(void) -{ - TEST_ASSERT_INT16_WITHIN(5, 0x54321, 0x44321); -} - -void testINT16sWithinDeltaWhenThereAreDifferenceOutsideOf16BitsAndCustomMessage(void) -{ - TEST_ASSERT_INT16_WITHIN_MESSAGE(5, 0x54321, 0x44321, "Custom Message."); -} - -void testINT16sNotWithinDelta(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_INT16_WITHIN(2, 4, -2); - VERIFY_FAILS_END -} - -void testINT16sNotWithinDeltaAndCustomMessage(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_INT16_WITHIN_MESSAGE(2, 3, 0, "Custom Message."); - VERIFY_FAILS_END -} - -void testINT8sWithinDelta(void) -{ - TEST_ASSERT_INT8_WITHIN(1, 127, 126); - TEST_ASSERT_INT8_WITHIN(5, -2, 2); - TEST_ASSERT_INT8_WITHIN(5, 2, -2); -} - -void testINT8sWithinDeltaAndCustomMessage(void) -{ - TEST_ASSERT_INT8_WITHIN_MESSAGE(5, 1, 4, "Custom Message."); -} - -void testINT8sWithinDeltaWhenThereAreDifferenceOutsideOf8Bits(void) -{ - TEST_ASSERT_INT8_WITHIN(5, 0x123, 0xF23); -} - -void testINT8sWithinDeltaWhenThereAreDifferenceOutsideOf8BitsAndCustomMessage(void) -{ - TEST_ASSERT_INT8_WITHIN_MESSAGE(5, 0x123, 0xF23, "Custom Message."); -} - -void testINT8sNotWithinDelta(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_INT8_WITHIN(2, -3, 0); - VERIFY_FAILS_END -} - -void testINT8sNotWithinDeltaAndCustomMessage(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_INT8_WITHIN_MESSAGE(2, -4, 0, "Custom Message."); - VERIFY_FAILS_END -} - - -//----------------- -void testGreaterThan(void) -{ - UNITY_INT v0, v1; - UNITY_INT *p0, *p1; - - v0 = 0; - v1 = 1; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_GREATER_THAN(v0, v1); - TEST_ASSERT_GREATER_THAN(*p0, v1); - TEST_ASSERT_GREATER_THAN(v0, *p1); - TEST_ASSERT_GREATER_THAN(*p0, *p1); -} - -void testGreaterThanINT(void) -{ - UNITY_INT v0, v1; - UNITY_INT *p0, *p1; - - v0 = 302; - v1 = 3334; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_GREATER_THAN_INT(v0, v1); - TEST_ASSERT_GREATER_THAN_INT(*p0, v1); - TEST_ASSERT_GREATER_THAN_INT(v0, *p1); - TEST_ASSERT_GREATER_THAN_INT(*p0, *p1); -} - - -void testGreaterThanINT8(void) -{ - UNITY_INT8 v0, v1; - UNITY_INT8 *p0, *p1; - - v0 = -128; - v1 = 127; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_GREATER_THAN_INT8(v0, v1); - TEST_ASSERT_GREATER_THAN_INT8(*p0, v1); - TEST_ASSERT_GREATER_THAN_INT8(v0, *p1); - TEST_ASSERT_GREATER_THAN_INT8(*p0, *p1); -} - -void testGreaterThanINT16(void) -{ - UNITY_INT16 v0, v1; - UNITY_INT16 *p0, *p1; - - v0 = -32768; - v1 = 32767; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_GREATER_THAN_INT16(v0, v1); - TEST_ASSERT_GREATER_THAN_INT16(*p0, v1); - TEST_ASSERT_GREATER_THAN_INT16(v0, *p1); - TEST_ASSERT_GREATER_THAN_INT16(*p0, *p1); -} - -void testGreaterThanINT32(void) -{ - UNITY_INT32 v0, v1; - UNITY_INT32 *p0, *p1; - - v0 = -214783648; - v1 = 214783647; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_GREATER_THAN_INT32(v0, v1); - TEST_ASSERT_GREATER_THAN_INT32(*p0, v1); - TEST_ASSERT_GREATER_THAN_INT32(v0, *p1); - TEST_ASSERT_GREATER_THAN_INT32(*p0, *p1); -} - -void testGreaterThanUINT(void) -{ - UNITY_UINT v0, v1; - UNITY_UINT *p0, *p1; - - v0 = 0; - v1 = 1; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_GREATER_THAN_UINT(v0, v1); - TEST_ASSERT_GREATER_THAN_UINT(*p0, v1); - TEST_ASSERT_GREATER_THAN_UINT(v0, *p1); - TEST_ASSERT_GREATER_THAN_UINT(*p0, *p1); -} - - -void testGreaterThanUINT8(void) -{ - UNITY_UINT8 v0, v1; - UNITY_UINT8 *p0, *p1; - - v0 = 0; - v1 = 255; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_GREATER_THAN_UINT8(v0, v1); - TEST_ASSERT_GREATER_THAN_UINT8(*p0, v1); - TEST_ASSERT_GREATER_THAN_UINT8(v0, *p1); - TEST_ASSERT_GREATER_THAN_UINT8(*p0, *p1); -} - -void testGreaterThanUINT16(void) -{ - UNITY_UINT16 v0, v1; - UNITY_UINT16 *p0, *p1; - - v0 = 0; - v1 = 65535; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_GREATER_THAN_UINT16(v0, v1); - TEST_ASSERT_GREATER_THAN_UINT16(*p0, v1); - TEST_ASSERT_GREATER_THAN_UINT16(v0, *p1); - TEST_ASSERT_GREATER_THAN_UINT16(*p0, *p1); -} - -void testGreaterThanUINT32(void) -{ - UNITY_UINT32 v0, v1; - UNITY_UINT32 *p0, *p1; - - v0 = 0; - v1 = 4294967295; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_GREATER_THAN_UINT32(v0, v1); - TEST_ASSERT_GREATER_THAN_UINT32(*p0, v1); - TEST_ASSERT_GREATER_THAN_UINT32(v0, *p1); - TEST_ASSERT_GREATER_THAN_UINT32(*p0, *p1); -} - -void testGreaterThanHEX8(void) -{ - UNITY_UINT8 v0, v1; - UNITY_UINT8 *p0, *p1; - - v0 = 0x00; - v1 = 0xFF; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_GREATER_THAN_HEX8(v0, v1); - TEST_ASSERT_GREATER_THAN_HEX8(*p0, v1); - TEST_ASSERT_GREATER_THAN_HEX8(v0, *p1); - TEST_ASSERT_GREATER_THAN_HEX8(*p0, *p1); -} - -void testGreaterThanHEX16(void) -{ - UNITY_UINT16 v0, v1; - UNITY_UINT16 *p0, *p1; - - v0 = 0x0000; - v1 = 0xFFFF; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_GREATER_THAN_HEX16(v0, v1); - TEST_ASSERT_GREATER_THAN_HEX16(*p0, v1); - TEST_ASSERT_GREATER_THAN_HEX16(v0, *p1); - TEST_ASSERT_GREATER_THAN_HEX16(*p0, *p1); -} - -void testGreaterThanHEX32(void) -{ - UNITY_UINT32 v0, v1; - UNITY_UINT32 *p0, *p1; - - v0 = 0x00000000; - v1 = 0xFFFFFFFF; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_GREATER_THAN_HEX32(v0, v1); - TEST_ASSERT_GREATER_THAN_HEX32(*p0, v1); - TEST_ASSERT_GREATER_THAN_HEX32(v0, *p1); - TEST_ASSERT_GREATER_THAN_HEX32(*p0, *p1); -} - - -void testNotGreaterThan(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_GREATER_THAN(0, -1); - VERIFY_FAILS_END -} - -void testLessThan(void) -{ - UNITY_INT v0, v1; - UNITY_INT *p0, *p1; - - v0 = 0; - v1 = -1; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_LESS_THAN(v0, v1); - TEST_ASSERT_LESS_THAN(*p0, v1); - TEST_ASSERT_LESS_THAN(v0, *p1); - TEST_ASSERT_LESS_THAN(*p0, *p1); -} - -void testLessThanINT(void) -{ - UNITY_INT v0, v1; - UNITY_INT *p0, *p1; - - v0 = 3334; - v1 = 302; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_LESS_THAN_INT(v0, v1); - TEST_ASSERT_LESS_THAN_INT(*p0, v1); - TEST_ASSERT_LESS_THAN_INT(v0, *p1); - TEST_ASSERT_LESS_THAN_INT(*p0, *p1); -} - - -void testLessThanINT8(void) -{ - UNITY_INT8 v0, v1; - UNITY_INT8 *p0, *p1; - - v0 = 127; - v1 = -128; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_LESS_THAN_INT8(v0, v1); - TEST_ASSERT_LESS_THAN_INT8(*p0, v1); - TEST_ASSERT_LESS_THAN_INT8(v0, *p1); - TEST_ASSERT_LESS_THAN_INT8(*p0, *p1); -} - -void testLessThanINT16(void) -{ - UNITY_INT16 v0, v1; - UNITY_INT16 *p0, *p1; - - v0 = 32767; - v1 = -32768; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_LESS_THAN_INT16(v0, v1); - TEST_ASSERT_LESS_THAN_INT16(*p0, v1); - TEST_ASSERT_LESS_THAN_INT16(v0, *p1); - TEST_ASSERT_LESS_THAN_INT16(*p0, *p1); -} - -void testLessThanINT32(void) -{ - UNITY_INT32 v0, v1; - UNITY_INT32 *p0, *p1; - - v0 = 214783647; - v1 = -214783648; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_LESS_THAN_INT32(v0, v1); - TEST_ASSERT_LESS_THAN_INT32(*p0, v1); - TEST_ASSERT_LESS_THAN_INT32(v0, *p1); - TEST_ASSERT_LESS_THAN_INT32(*p0, *p1); -} - -void testLessThanUINT(void) -{ - UNITY_UINT v0, v1; - UNITY_UINT *p0, *p1; - - v0 = 1; - v1 = 0; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_LESS_THAN_UINT(v0, v1); - TEST_ASSERT_LESS_THAN_UINT(*p0, v1); - TEST_ASSERT_LESS_THAN_UINT(v0, *p1); - TEST_ASSERT_LESS_THAN_UINT(*p0, *p1); -} - - -void testLessThanUINT8(void) -{ - UNITY_UINT8 v0, v1; - UNITY_UINT8 *p0, *p1; - - v0 = 255; - v1 = 0; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_LESS_THAN_UINT8(v0, v1); - TEST_ASSERT_LESS_THAN_UINT8(*p0, v1); - TEST_ASSERT_LESS_THAN_UINT8(v0, *p1); - TEST_ASSERT_LESS_THAN_UINT8(*p0, *p1); -} - -void testLessThanUINT16(void) -{ - UNITY_UINT16 v0, v1; - UNITY_UINT16 *p0, *p1; - - v0 = 65535; - v1 = 0; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_LESS_THAN_UINT16(v0, v1); - TEST_ASSERT_LESS_THAN_UINT16(*p0, v1); - TEST_ASSERT_LESS_THAN_UINT16(v0, *p1); - TEST_ASSERT_LESS_THAN_UINT16(*p0, *p1); -} - -void testLessThanUINT32(void) -{ - UNITY_UINT32 v0, v1; - UNITY_UINT32 *p0, *p1; - - v0 = 4294967295; - v1 = 0; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_LESS_THAN_UINT32(v0, v1); - TEST_ASSERT_LESS_THAN_UINT32(*p0, v1); - TEST_ASSERT_LESS_THAN_UINT32(v0, *p1); - TEST_ASSERT_LESS_THAN_UINT32(*p0, *p1); -} - -void testLessThanHEX8(void) -{ - UNITY_UINT8 v0, v1; - UNITY_UINT8 *p0, *p1; - - v0 = 0xFF; - v1 = 0x00; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_LESS_THAN_HEX8(v0, v1); - TEST_ASSERT_LESS_THAN_HEX8(*p0, v1); - TEST_ASSERT_LESS_THAN_HEX8(v0, *p1); - TEST_ASSERT_LESS_THAN_HEX8(*p0, *p1); -} - -void testLessThanHEX16(void) -{ - UNITY_UINT16 v0, v1; - UNITY_UINT16 *p0, *p1; - - v0 = 0xFFFF; - v1 = 0x0000; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_LESS_THAN_HEX16(v0, v1); - TEST_ASSERT_LESS_THAN_HEX16(*p0, v1); - TEST_ASSERT_LESS_THAN_HEX16(v0, *p1); - TEST_ASSERT_LESS_THAN_HEX16(*p0, *p1); -} - -void testLessThanHEX32(void) -{ - UNITY_UINT32 v0, v1; - UNITY_UINT32 *p0, *p1; - - v0 = 0xFFFFFFFF; - v1 = 0x00000000; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_LESS_THAN_HEX32(v0, v1); - TEST_ASSERT_LESS_THAN_HEX32(*p0, v1); - TEST_ASSERT_LESS_THAN_HEX32(v0, *p1); - TEST_ASSERT_LESS_THAN_HEX32(*p0, *p1); -} - - -void testNotLessThan(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_LESS_THAN(0, 1); - VERIFY_FAILS_END -} - - - -//----------------- -void testEqualStrings(void) -{ - const char *testString = "foo"; - - TEST_ASSERT_EQUAL_STRING(testString, testString); - TEST_ASSERT_EQUAL_STRING_MESSAGE("foo", "foo", "foo isn't foo"); - TEST_ASSERT_EQUAL_STRING("foo", testString); - TEST_ASSERT_EQUAL_STRING(testString, "foo"); - TEST_ASSERT_EQUAL_STRING("", ""); -} - -void testEqualStringsLen(void) -{ - const char *testString = "foobar"; - TEST_ASSERT_EQUAL_STRING_LEN(testString, testString, strlen(testString)); - TEST_ASSERT_EQUAL_STRING_LEN_MESSAGE("foobar", "foobaz", 5, "fooba isn't fooba"); - TEST_ASSERT_EQUAL_STRING_LEN("foo", testString, 3); - TEST_ASSERT_EQUAL_STRING_LEN(testString, "foo", 3); - TEST_ASSERT_EQUAL_STRING_LEN("", "", 3); -} - -void testEqualStringsWithCarriageReturnsAndLineFeeds(void) -{ - const char *testString = "foo\r\nbar"; - - TEST_ASSERT_EQUAL_STRING(testString, testString); - TEST_ASSERT_EQUAL_STRING("foo\r\nbar", "foo\r\nbar"); - TEST_ASSERT_EQUAL_STRING("foo\r\nbar", testString); - TEST_ASSERT_EQUAL_STRING(testString, "foo\r\nbar"); - TEST_ASSERT_EQUAL_STRING("", ""); -} - -void testNotEqualString1(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_STRING("foo", "bar"); - VERIFY_FAILS_END -} - -void testNotEqualStringLen1(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_STRING_LEN("foobar", "foobaz", 6); - VERIFY_FAILS_END -} - -void testNotEqualString2(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_STRING("foo", ""); - VERIFY_FAILS_END -} - -void testNotEqualStringLen2(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_STRING_LEN("foo", "", 3); - VERIFY_FAILS_END -} - -void testNotEqualString3(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_STRING("", "bar"); - VERIFY_FAILS_END -} - -void testNotEqualStringLen3(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_STRING_LEN("", "bar", 3); - VERIFY_FAILS_END -} - -void testNotEqualString4(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_STRING("bar\r", "bar\n"); - VERIFY_FAILS_END -} - -void testNotEqualStringLen4(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_STRING_LEN("ba\r\x16", "ba\r\n", 4); - VERIFY_FAILS_END -} - -void testNotEqualString5(void) -{ - const char str1[] = { 0x41, 0x42, 0x03, 0x00 }; - const char str2[] = { 0x41, 0x42, 0x04, 0x00 }; - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_STRING(str1, str2); - VERIFY_FAILS_END -} - -void testNotEqualString_ExpectedStringIsNull(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_STRING(NULL, "bar"); - VERIFY_FAILS_END -} - -void testNotEqualStringLen_ExpectedStringIsNull(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_STRING_LEN(NULL, "bar", 1); - VERIFY_FAILS_END -} - -void testNotEqualString_ActualStringIsNull(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_STRING("foo", NULL); - VERIFY_FAILS_END -} - -void testNotEqualStringLen_ActualStringIsNull(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_STRING_LEN("foo", NULL, 1); - VERIFY_FAILS_END -} - -void testEqualStringArrays(void) -{ - const char *testStrings[] = { "foo", "boo", "woo", "moo" }; - const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; - - TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, expStrings, 3); - TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 3); - TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 2); - TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 1); -} - -void testNotEqualStringArray1(void) -{ - const char *testStrings[] = { "foo", "boo", "woo", "moo" }; - const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); - VERIFY_FAILS_END -} - -void testNotEqualStringArray2(void) -{ - const char *testStrings[] = { "zoo", "boo", "woo", "moo" }; - const char *expStrings[] = { "foo", "boo", "woo", "moo" }; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); - VERIFY_FAILS_END -} - -void testNotEqualStringArray3(void) -{ - const char *testStrings[] = { "foo", "boo", "woo", NULL }; - const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); - VERIFY_FAILS_END -} - -void testNotEqualStringArray4(void) -{ - const char *testStrings[] = { "foo", "boo", "woo", "moo" }; - const char *expStrings[] = { "foo", NULL, "woo", "moo" }; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); - VERIFY_FAILS_END -} - -void testNotEqualStringArray5(void) -{ - const char **testStrings = NULL; - const char *expStrings[] = { "foo", "boo", "woo", "zoo" }; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); - VERIFY_FAILS_END -} - -void testNotEqualStringArray6(void) -{ - const char *testStrings[] = { "foo", "boo", "woo", "zoo" }; - const char **expStrings = NULL; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); - VERIFY_FAILS_END -} - -void testEqualStringArrayIfBothNulls(void) -{ - const char **testStrings = NULL; - const char **expStrings = NULL; - - TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 4); -} - -void testNotEqualStringArrayLengthZero(void) -{ - const char *testStrings[] = {NULL}; - const char **expStrings = NULL; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_STRING_ARRAY(expStrings, testStrings, 0); - VERIFY_FAILS_END -} - -void testEqualStringEachEqual(void) -{ - const char *testStrings1[] = { "foo", "foo", "foo", "foo" }; - const char *testStrings2[] = { "boo", "boo", "boo", "zoo" }; - const char *testStrings3[] = { "", "", "", "" }; - - TEST_ASSERT_EACH_EQUAL_STRING("foo", testStrings1, 4); - TEST_ASSERT_EACH_EQUAL_STRING("foo", testStrings1, 1); - TEST_ASSERT_EACH_EQUAL_STRING("boo", testStrings2, 3); - TEST_ASSERT_EACH_EQUAL_STRING("", testStrings3, 4); -} - -void testNotEqualStringEachEqual1(void) -{ - const char *testStrings[] = { "foo", "foo", "foo", "moo" }; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_STRING("foo", testStrings, 4); - VERIFY_FAILS_END -} - -void testNotEqualStringEachEqual2(void) -{ - const char *testStrings[] = { "boo", "foo", "foo", "foo" }; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_STRING("foo", testStrings, 4); - VERIFY_FAILS_END -} - -void testNotEqualStringEachEqual3(void) -{ - const char *testStrings[] = { "foo", "foo", "foo", NULL }; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_STRING("foo", testStrings, 4); - VERIFY_FAILS_END -} - -void testNotEqualStringEachEqual4(void) -{ - const char *testStrings[] = { "foo", "foo", "woo", "foo" }; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_STRING("foo", testStrings, 4); - VERIFY_FAILS_END -} - -void testNotEqualStringEachEqual5(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_STRING("foo", NULL, 1); - VERIFY_FAILS_END -} - -void testEqualMemory(void) -{ - const char *testString = "whatever"; - - TEST_ASSERT_EQUAL_MEMORY(testString, testString, 8); - TEST_ASSERT_EQUAL_MEMORY("whatever", "whatever", 8); - TEST_ASSERT_EQUAL_MEMORY("whatever", testString, 8); - TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 8); - TEST_ASSERT_EQUAL_MEMORY(testString, "whatever", 2); - TEST_ASSERT_EQUAL_MEMORY(NULL, NULL, 1); -} - -void testNotEqualMemory1(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_MEMORY("foo", "bar", 3); - VERIFY_FAILS_END -} - -void testNotEqualMemory2(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_MEMORY("fool", "food", 4); - VERIFY_FAILS_END -} - -void testNotEqualMemory3(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_MEMORY(NULL, "food", 4); - VERIFY_FAILS_END -} - -void testNotEqualMemory4(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_MEMORY("fool", NULL, 4); - VERIFY_FAILS_END -} - -void testNotEqualMemoryLengthZero(void) -{ - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_MEMORY(NULL, NULL, 0); - VERIFY_FAILS_END -} - -void testEqualIntArrays(void) -{ - int p0[] = {1, 8, 987, -2}; - int p1[] = {1, 8, 987, -2}; - int p2[] = {1, 8, 987, 2}; - int p3[] = {1, 500, 600, 700}; - - TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 1); - TEST_ASSERT_EQUAL_INT_ARRAY(p0, p0, 4); - TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); - TEST_ASSERT_EQUAL_INT_ARRAY(p0, p2, 3); - TEST_ASSERT_EQUAL_INT_ARRAY(p0, p3, 1); - TEST_ASSERT_EQUAL_INT_ARRAY(NULL, NULL, 1); -} - -void testNotEqualIntArraysNullExpected(void) -{ - int* p0 = NULL; - int p1[] = {1, 8, 987, 2}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testNotEqualIntArraysNullActual(void) -{ - int* p1 = NULL; - int p0[] = {1, 8, 987, 2}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testNotEqualIntArrays1(void) -{ - int p0[] = {1, 8, 987, -2}; - int p1[] = {1, 8, 987, 2}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testNotEqualIntArrays2(void) -{ - int p0[] = {1, 8, 987, -2}; - int p1[] = {2, 8, 987, -2}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testNotEqualIntArrays3(void) -{ - int p0[] = {1, 8, 987, -2}; - int p1[] = {1, 8, 986, -2}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testNotEqualIntArraysLengthZero(void) -{ - UNITY_UINT32 p0[1] = {1}; - UNITY_UINT32 p1[1] = {1}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_INT_ARRAY(p0, p1, 0); - VERIFY_FAILS_END -} - -void testEqualIntEachEqual(void) -{ - int p0[] = {1, 1, 1, 1}; - int p1[] = {987, 987, 987, 987}; - int p2[] = {-2, -2, -2, -3}; - int p3[] = {1, 5, 600, 700}; - - TEST_ASSERT_EACH_EQUAL_INT(1, p0, 1); - TEST_ASSERT_EACH_EQUAL_INT(1, p0, 4); - TEST_ASSERT_EACH_EQUAL_INT(987, p1, 4); - TEST_ASSERT_EACH_EQUAL_INT(-2, p2, 3); - TEST_ASSERT_EACH_EQUAL_INT(1, p3, 1); -} - -void testNotEqualIntEachEqualNullActual(void) -{ - int* p1 = NULL; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_INT(1, p1, 4); - VERIFY_FAILS_END -} - -void testNotEqualIntEachEqual1(void) -{ - int p0[] = {1, 1, 1, -2}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_INT(1, p0, 4); - VERIFY_FAILS_END -} - -void testNotEqualIntEachEqual2(void) -{ - int p0[] = {-5, -5, -1, -5}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_INT(-5, p0, 4); - VERIFY_FAILS_END -} - -void testNotEqualIntEachEqual3(void) -{ - int p0[] = {1, 88, 88, 88}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_INT(88, p0, 4); - VERIFY_FAILS_END -} - -void testNotEqualEachEqualLengthZero(void) -{ - UNITY_UINT32 p0[1] = {1}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_INT(0, p0, 0); - VERIFY_FAILS_END -} - -void testEqualPtrArrays(void) -{ - char A = 1; - char B = 2; - char C = 3; - char* p0[] = {&A, &B, &C}; - char* p1[] = {&A, &B, &C, &A}; - char* p2[] = {&A, &B}; - char* p3[] = {&A}; - - TEST_ASSERT_EQUAL_PTR_ARRAY(p0, p0, 1); - TEST_ASSERT_EQUAL_PTR_ARRAY(p0, p0, 3); - TEST_ASSERT_EQUAL_PTR_ARRAY(p0, p1, 3); - TEST_ASSERT_EQUAL_PTR_ARRAY(p1, p2, 2); - TEST_ASSERT_EQUAL_PTR_ARRAY(p3, p0, 1); -} - -void testNotEqualPtrArraysNullExpected(void) -{ - char A = 1; - char B = 2; - char** p0 = NULL; - char* p1[] = {&A, &B}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_PTR_ARRAY(p0, p1, 2); - VERIFY_FAILS_END -} - -void testNotEqualPtrArraysNullActual(void) -{ - char A = 1; - char B = 2; - char** p0 = NULL; - char* p1[] = {&A, &B}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_PTR_ARRAY(p1, p0, 2); - VERIFY_FAILS_END -} - -void testNotEqualPtrArrays1(void) -{ - char A = 1; - char B = 2; - char C = 3; - char* p0[] = {&A, &B, &C, &B}; - char* p1[] = {&A, &B, &C, &A}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_PTR_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testNotEqualPtrArrays2(void) -{ - char A = 1; - char B = 2; - char C = 3; - char* p0[] = {&B, &B, &C, &A}; - char* p1[] = {&A, &B, &C, &A}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_PTR_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testNotEqualPtrArrays3(void) -{ - char A = 1; - char B = 2; - char C = 3; - char* p0[] = {&A, &B, &B, &A}; - char* p1[] = {&A, &B, &C, &A}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_PTR_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testEqualPtrEachEqual(void) -{ - char A = 1; - char B = 2; - char C = 3; - char* p0[] = {&A, &A, &A}; - char* p1[] = {&A, &B, &C, &A}; - char* p2[] = {&B, &B}; - char* p3[] = {&C}; - - TEST_ASSERT_EACH_EQUAL_PTR(&A, p0, 1); - TEST_ASSERT_EACH_EQUAL_PTR(&A, p0, 3); - TEST_ASSERT_EACH_EQUAL_PTR(&A, p1, 1); - TEST_ASSERT_EACH_EQUAL_PTR(&B, p2, 2); - TEST_ASSERT_EACH_EQUAL_PTR(&C, p3, 1); -} - -void testNotEqualPtrEachEqualNullExpected(void) -{ - char A = 1; - char B = 1; - char* p0[] = {&A, &B}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_PTR(&A, p0, 2); - VERIFY_FAILS_END -} - -void testNotEqualPtrEachEqualNullActual(void) -{ - char A = 1; - char** p0 = NULL; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_PTR(&A, p0, 2); - VERIFY_FAILS_END -} - -void testNotEqualPtrEachEqual1(void) -{ - char A = 1; - char B = 1; - char* p0[] = {&A, &A, &A, &B}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_PTR(&A, p0, 4); - VERIFY_FAILS_END -} - -void testNotEqualPtrEachEqual2(void) -{ - char A = 1; - char B = 1; - char* p0[] = {&B, &B, &A, &B}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_PTR(&B, p0, 4); - VERIFY_FAILS_END -} - -void testNotEqualPtrEachEqual3(void) -{ - char A = 1; - char B = 1; - char* p0[] = {&A, &B, &B, &B}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_PTR(&B, p0, 4); - VERIFY_FAILS_END -} - -void testEqualInt8Arrays(void) -{ - UNITY_INT8 p0[] = {1, 8, 117, -2}; - UNITY_INT8 p1[] = {1, 8, 117, -2}; - UNITY_INT8 p2[] = {1, 8, 117, 2}; - UNITY_INT8 p3[] = {1, 50, 60, 70}; - - TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 1); - TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p0, 4); - TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); - TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p2, 3); - TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p3, 1); -} - -void testNotEqualInt8Arrays(void) -{ - UNITY_INT8 p0[] = {1, 8, 36, -2}; - UNITY_INT8 p1[] = {1, 8, 36, 2}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_INT8_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testEqualInt8EachEqual(void) -{ - UNITY_INT8 p0[] = {1, 1, 1, 1}; - UNITY_INT8 p1[] = {117, 117, 117, -2}; - UNITY_INT8 p2[] = {-1, -1, 117, 2}; - UNITY_INT8 p3[] = {1, 50, 60, 70}; - - TEST_ASSERT_EACH_EQUAL_INT8(1, p0, 1); - TEST_ASSERT_EACH_EQUAL_INT8(1, p0, 4); - TEST_ASSERT_EACH_EQUAL_INT8(117, p1, 3); - TEST_ASSERT_EACH_EQUAL_INT8(-1, p2, 2); - TEST_ASSERT_EACH_EQUAL_INT8(1, p3, 1); -} - -void testNotEqualInt8EachEqual(void) -{ - UNITY_INT8 p0[] = {1, 8, 36, -2}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_INT8(1, p0, 2); - VERIFY_FAILS_END -} - -void testEqualUIntArrays(void) -{ - unsigned int p0[] = {1, 8, 987, 65132u}; - unsigned int p1[] = {1, 8, 987, 65132u}; - unsigned int p2[] = {1, 8, 987, 2}; - unsigned int p3[] = {1, 500, 600, 700}; - - TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 1); - TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p0, 4); - TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); - TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p2, 3); - TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p3, 1); -} - -void testNotEqualUIntArrays1(void) -{ - unsigned int p0[] = {1, 8, 987, 65132u}; - unsigned int p1[] = {1, 8, 987, 65131u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testNotEqualUIntArrays2(void) -{ - unsigned int p0[] = {1, 8, 987, 65132u}; - unsigned int p1[] = {2, 8, 987, 65132u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testNotEqualUIntArrays3(void) -{ - unsigned int p0[] = {1, 8, 987, 65132u}; - unsigned int p1[] = {1, 8, 986, 65132u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_UINT_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testEqualUIntEachEqual(void) -{ - unsigned int p0[] = {1, 1, 1, 1}; - unsigned int p1[] = {65132u, 65132u, 65132u, 65132u}; - unsigned int p2[] = {8, 8, 987, 2}; - unsigned int p3[] = {1, 500, 600, 700}; - - TEST_ASSERT_EACH_EQUAL_UINT(1, p0, 1); - TEST_ASSERT_EACH_EQUAL_UINT(1, p0, 4); - TEST_ASSERT_EACH_EQUAL_UINT(65132u, p1, 4); - TEST_ASSERT_EACH_EQUAL_UINT(8, p2, 2); - TEST_ASSERT_EACH_EQUAL_UINT(1, p3, 1); -} - -void testNotEqualUIntEachEqual1(void) -{ - unsigned int p0[] = {1, 65132u, 65132u, 65132u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_UINT(65132u, p0, 4); - VERIFY_FAILS_END -} - -void testNotEqualUIntEachEqual2(void) -{ - unsigned int p0[] = {987, 8, 987, 987}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_UINT(987, p0, 4); - VERIFY_FAILS_END -} - -void testNotEqualUIntEachEqual3(void) -{ - unsigned int p0[] = {1, 1, 1, 65132u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_UINT(1, p0, 4); - VERIFY_FAILS_END -} - -void testEqualInt16Arrays(void) -{ - UNITY_INT16 p0[] = {1, 8, 117, 3}; - UNITY_INT16 p1[] = {1, 8, 117, 3}; - UNITY_INT16 p2[] = {1, 8, 117, 2}; - UNITY_INT16 p3[] = {1, 50, 60, 70}; - - TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 1); - TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p0, 4); - TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); - TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p2, 3); - TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p3, 1); -} - -void testNotEqualInt16Arrays(void) -{ - UNITY_INT16 p0[] = {1, 8, 127, 3}; - UNITY_INT16 p1[] = {1, 8, 127, 2}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_INT16_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testEqualInt16EachEqual(void) -{ - UNITY_INT16 p0[] = {1, 1, 1, 1}; - UNITY_INT16 p1[] = {32111, 32111, 32111, 3}; - UNITY_INT16 p2[] = {-1, -1, -1, 2}; - UNITY_INT16 p3[] = {1, 50, 60, 70}; - - TEST_ASSERT_EACH_EQUAL_INT16(1, p0, 1); - TEST_ASSERT_EACH_EQUAL_INT16(1, p0, 4); - TEST_ASSERT_EACH_EQUAL_INT16(32111, p1, 3); - TEST_ASSERT_EACH_EQUAL_INT16(-1, p2, 3); - TEST_ASSERT_EACH_EQUAL_INT16(1, p3, 1); -} - -void testNotEqualInt16EachEqual(void) -{ - UNITY_INT16 p0[] = {127, 127, 127, 3}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_INT16(127, p0, 4); - VERIFY_FAILS_END -} - -void testEqualInt32Arrays(void) -{ - UNITY_INT32 p0[] = {1, 8, 117, 3}; - UNITY_INT32 p1[] = {1, 8, 117, 3}; - UNITY_INT32 p2[] = {1, 8, 117, 2}; - UNITY_INT32 p3[] = {1, 50, 60, 70}; - - TEST_ASSERT_EQUAL_INT32_ARRAY(p0, p0, 1); - TEST_ASSERT_EQUAL_INT32_ARRAY(p0, p0, 4); - TEST_ASSERT_EQUAL_INT32_ARRAY(p0, p1, 4); - TEST_ASSERT_EQUAL_INT32_ARRAY(p0, p2, 3); - TEST_ASSERT_EQUAL_INT32_ARRAY(p0, p3, 1); -} - -void testNotEqualInt32Arrays(void) -{ - UNITY_INT32 p0[] = {1, 8, 127, 3}; - UNITY_INT32 p1[] = {1, 8, 127, 2}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_INT32_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testEqualInt32EachEqual(void) -{ - UNITY_INT32 p0[] = {8, 8, 8, 8}; - UNITY_INT32 p1[] = {65537, 65537, 65537, 65537}; - UNITY_INT32 p2[] = {-3, -3, -3, 2}; - UNITY_INT32 p3[] = {1, 50, 60, 70}; - - TEST_ASSERT_EACH_EQUAL_INT32(8, p0, 1); - TEST_ASSERT_EACH_EQUAL_INT32(8, p0, 4); - TEST_ASSERT_EACH_EQUAL_INT32(65537, p1, 4); - TEST_ASSERT_EACH_EQUAL_INT32(-3, p2, 3); - TEST_ASSERT_EACH_EQUAL_INT32(1, p3, 1); -} - -void testNotEqualInt32EachEqual(void) -{ - UNITY_INT32 p0[] = {127, 8, 127, 127}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_INT32(127, p0, 4); - VERIFY_FAILS_END -} - -void testEqualUINT8Arrays(void) -{ - UNITY_UINT8 p0[] = {1, 8, 100, 127}; - UNITY_UINT8 p1[] = {1, 8, 100, 127}; - UNITY_UINT8 p2[] = {1, 8, 100, 2}; - UNITY_UINT8 p3[] = {1, 50, 60, 70}; - - TEST_ASSERT_EQUAL_UINT8_ARRAY(p0, p0, 1); - TEST_ASSERT_EQUAL_UINT8_ARRAY(p0, p0, 4); - TEST_ASSERT_EQUAL_UINT8_ARRAY(p0, p1, 4); - TEST_ASSERT_EQUAL_UINT8_ARRAY(p0, p2, 3); - TEST_ASSERT_EQUAL_UINT8_ARRAY(p0, p3, 1); -} - -void testNotEqualUINT8Arrays1(void) -{ - unsigned char p0[] = {1, 8, 100, 127u}; - unsigned char p1[] = {1, 8, 100, 255u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_UINT8_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testNotEqualUINT8Arrays2(void) -{ - unsigned char p0[] = {1, 8, 100, 127u}; - unsigned char p1[] = {1, 8, 100, 255u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_UINT8_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testNotEqualUINT8Arrays3(void) -{ - unsigned char p0[] = {1, 8, 100, 127u}; - unsigned char p1[] = {1, 8, 100, 255u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_UINT8_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - - -void testEqualUINT16Arrays(void) -{ - unsigned short p0[] = {1, 8, 987, 65132u}; - unsigned short p1[] = {1, 8, 987, 65132u}; - unsigned short p2[] = {1, 8, 987, 2}; - unsigned short p3[] = {1, 500, 600, 700}; - - TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 1); - TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p0, 4); - TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); - TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p2, 3); - TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p3, 1); -} - -void testNotEqualUINT16Arrays1(void) -{ - unsigned short p0[] = {1, 8, 987, 65132u}; - unsigned short p1[] = {1, 8, 987, 65131u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testNotEqualUINT16Arrays2(void) -{ - unsigned short p0[] = {1, 8, 987, 65132u}; - unsigned short p1[] = {2, 8, 987, 65132u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testNotEqualUINT16Arrays3(void) -{ - unsigned short p0[] = {1, 8, 987, 65132u}; - unsigned short p1[] = {1, 8, 986, 65132u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_UINT16_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testEqualUINT32Arrays(void) -{ - UNITY_UINT32 p0[] = {1, 8, 987, 65132u}; - UNITY_UINT32 p1[] = {1, 8, 987, 65132u}; - UNITY_UINT32 p2[] = {1, 8, 987, 2}; - UNITY_UINT32 p3[] = {1, 500, 600, 700}; - - TEST_ASSERT_EQUAL_UINT32_ARRAY(p0, p0, 1); - TEST_ASSERT_EQUAL_UINT32_ARRAY(p0, p0, 4); - TEST_ASSERT_EQUAL_UINT32_ARRAY(p0, p1, 4); - TEST_ASSERT_EQUAL_UINT32_ARRAY(p0, p2, 3); - TEST_ASSERT_EQUAL_UINT32_ARRAY(p0, p3, 1); -} - -void testNotEqualUINT32Arrays1(void) -{ - UNITY_UINT32 p0[] = {1, 8, 987, 65132u}; - UNITY_UINT32 p1[] = {1, 8, 987, 65131u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_UINT32_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testNotEqualUINT32Arrays2(void) -{ - UNITY_UINT32 p0[] = {1, 8, 987, 65132u}; - UNITY_UINT32 p1[] = {2, 8, 987, 65132u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_UINT32_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testNotEqualUINT32Arrays3(void) -{ - UNITY_UINT32 p0[] = {1, 8, 987, 65132u}; - UNITY_UINT32 p1[] = {1, 8, 986, 65132u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_UINT32_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testEqualHEXArrays(void) -{ - UNITY_UINT32 p0[] = {1, 8, 987, 65132u}; - UNITY_UINT32 p1[] = {1, 8, 987, 65132u}; - UNITY_UINT32 p2[] = {1, 8, 987, 2}; - UNITY_UINT32 p3[] = {1, 500, 600, 700}; - - TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 1); - TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p0, 4); - TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); - TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p2, 3); - TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p3, 1); -} - -void testNotEqualHEXArrays1(void) -{ - UNITY_UINT32 p0[] = {1, 8, 987, 65132u}; - UNITY_UINT32 p1[] = {1, 8, 987, 65131u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testNotEqualHEXArrays2(void) -{ - UNITY_UINT32 p0[] = {1, 8, 987, 65132u}; - UNITY_UINT32 p1[] = {2, 8, 987, 65132u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testNotEqualHEXArrays3(void) -{ - UNITY_UINT32 p0[] = {1, 8, 987, 65132u}; - UNITY_UINT32 p1[] = {1, 8, 986, 65132u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_HEX_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testEqualHEX32Arrays(void) -{ - UNITY_UINT32 p0[] = {1, 8, 987, 65132u}; - UNITY_UINT32 p1[] = {1, 8, 987, 65132u}; - UNITY_UINT32 p2[] = {1, 8, 987, 2}; - UNITY_UINT32 p3[] = {1, 500, 600, 700}; - - TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p0, 1); - TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p0, 4); - TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); - TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p2, 3); - TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p3, 1); -} - -void testNotEqualHEX32Arrays1(void) -{ - UNITY_UINT32 p0[] = {1, 8, 987, 65132u}; - UNITY_UINT32 p1[] = {1, 8, 987, 65131u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testNotEqualHEX32Arrays2(void) -{ - UNITY_UINT32 p0[] = {1, 8, 987, 65132u}; - UNITY_UINT32 p1[] = {2, 8, 987, 65132u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testNotEqualHEX32Arrays3(void) -{ - UNITY_UINT32 p0[] = {1, 8, 987, 65132u}; - UNITY_UINT32 p1[] = {1, 8, 986, 65132u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_HEX32_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testEqualHEX16Arrays(void) -{ - unsigned short p0[] = {1, 8, 987, 65132u}; - unsigned short p1[] = {1, 8, 987, 65132u}; - unsigned short p2[] = {1, 8, 987, 2}; - unsigned short p3[] = {1, 500, 600, 700}; - - TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 1); - TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p0, 4); - TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); - TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p2, 3); - TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p3, 1); -} - -void testNotEqualHEX16Arrays1(void) -{ - unsigned short p0[] = {1, 8, 987, 65132u}; - unsigned short p1[] = {1, 8, 987, 65131u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testNotEqualHEX16Arrays2(void) -{ - unsigned short p0[] = {1, 8, 987, 65132u}; - unsigned short p1[] = {2, 8, 987, 65132u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testNotEqualHEX16Arrays3(void) -{ - unsigned short p0[] = {1, 8, 987, 65132u}; - unsigned short p1[] = {1, 8, 986, 65132u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_HEX16_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testEqualHEX8Arrays(void) -{ - unsigned char p0[] = {1, 8, 254u, 123}; - unsigned char p1[] = {1, 8, 254u, 123}; - unsigned char p2[] = {1, 8, 254u, 2}; - unsigned char p3[] = {1, 23, 25, 26}; - - TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 1); - TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p0, 4); - TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); - TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p2, 3); - TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p3, 1); -} - -void testNotEqualHEX8Arrays1(void) -{ - unsigned char p0[] = {1, 8, 254u, 253u}; - unsigned char p1[] = {1, 8, 254u, 252u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testNotEqualHEX8Arrays2(void) -{ - unsigned char p0[] = {1, 8, 254u, 253u}; - unsigned char p1[] = {2, 8, 254u, 253u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testNotEqualHEX8Arrays3(void) -{ - unsigned char p0[] = {1, 8, 254u, 253u}; - unsigned char p1[] = {1, 8, 255u, 253u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_HEX8_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -} - -void testEqualUINT8EachEqual(void) -{ - UNITY_UINT8 p0[] = {127u, 127u, 127u, 127u}; - UNITY_UINT8 p1[] = {1u, 1u, 1u, 1u}; - UNITY_UINT8 p2[] = {128u, 128u, 128u, 2u}; - UNITY_UINT8 p3[] = {1u, 50u, 60u, 70u}; - - TEST_ASSERT_EACH_EQUAL_UINT8(127u, p0, 1); - TEST_ASSERT_EACH_EQUAL_UINT8(127u, p0, 4); - TEST_ASSERT_EACH_EQUAL_UINT8(1u, p1, 4); - TEST_ASSERT_EACH_EQUAL_UINT8(128u, p2, 3); - TEST_ASSERT_EACH_EQUAL_UINT8(1u, p3, 1); -} - -void testNotEqualUINT8EachEqual1(void) -{ - unsigned char p0[] = {127u, 127u, 128u, 127u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_UINT8(127u, p0, 4); - VERIFY_FAILS_END -} - -void testNotEqualUINT8EachEqual2(void) -{ - unsigned char p0[] = {1, 1, 1, 127u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_UINT8(1, p0, 4); - VERIFY_FAILS_END -} - -void testNotEqualUINT8EachEqual3(void) -{ - unsigned char p0[] = {54u, 55u, 55u, 55u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_UINT8(55u, p0, 4); - VERIFY_FAILS_END -} - -void testEqualUINT16EachEqual(void) -{ - unsigned short p0[] = {65132u, 65132u, 65132u, 65132u}; - unsigned short p1[] = {987, 987, 987, 987}; - unsigned short p2[] = {1, 1, 1, 2}; - unsigned short p3[] = {1, 500, 600, 700}; - - TEST_ASSERT_EACH_EQUAL_UINT16(65132u, p0, 1); - TEST_ASSERT_EACH_EQUAL_UINT16(65132u, p0, 4); - TEST_ASSERT_EACH_EQUAL_UINT16(987, p1, 4); - TEST_ASSERT_EACH_EQUAL_UINT16(1, p2, 3); - TEST_ASSERT_EACH_EQUAL_UINT16(1, p3, 1); -} - -void testNotEqualUINT16EachEqual1(void) -{ - unsigned short p0[] = {1, 65132u, 65132u, 65132u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_UINT16(65132u, p0, 4); - VERIFY_FAILS_END -} - -void testNotEqualUINT16EachEqual2(void) -{ - unsigned short p0[] = {65132u, 65132u, 987, 65132u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_UINT16(65132u, p0, 4); - VERIFY_FAILS_END -} - -void testNotEqualUINT16EachEqual3(void) -{ - unsigned short p0[] = {65132u, 65132u, 65132u, 65133u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_UINT16(65132u, p0, 4); - VERIFY_FAILS_END -} - -void testEqualUINT32EachEqual(void) -{ - UNITY_UINT32 p0[] = {65132u, 65132u, 65132u, 65132u}; - UNITY_UINT32 p1[] = {987, 987, 987, 987}; - UNITY_UINT32 p2[] = {8, 8, 8, 2}; - UNITY_UINT32 p3[] = {1, 500, 600, 700}; - - TEST_ASSERT_EACH_EQUAL_UINT32(65132u, p0, 1); - TEST_ASSERT_EACH_EQUAL_UINT32(65132u, p0, 4); - TEST_ASSERT_EACH_EQUAL_UINT32(987, p1, 4); - TEST_ASSERT_EACH_EQUAL_UINT32(8, p2, 3); - TEST_ASSERT_EACH_EQUAL_UINT32(1, p3, 1); -} - -void testNotEqualUINT32EachEqual1(void) -{ - UNITY_UINT32 p0[] = {65132u, 65132u, 987, 65132u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_UINT32(65132u, p0, 4); - VERIFY_FAILS_END -} - -void testNotEqualUINT32EachEqual2(void) -{ - UNITY_UINT32 p0[] = {1, 987, 987, 987}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_UINT32(987, p0, 4); - VERIFY_FAILS_END -} - -void testNotEqualUINT32EachEqual3(void) -{ - UNITY_UINT32 p0[] = {1, 1, 1, 65132u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_UINT32(1, p0, 4); - VERIFY_FAILS_END -} - -void testEqualHEXEachEqual(void) -{ - UNITY_UINT32 p0[] = {65132u, 65132u, 65132u, 65132u}; - UNITY_UINT32 p1[] = {987, 987, 987, 987}; - UNITY_UINT32 p2[] = {8, 8, 8, 2}; - UNITY_UINT32 p3[] = {1, 500, 600, 700}; - - TEST_ASSERT_EACH_EQUAL_HEX(65132u, p0, 1); - TEST_ASSERT_EACH_EQUAL_HEX(65132u, p0, 4); - TEST_ASSERT_EACH_EQUAL_HEX(987, p1, 4); - TEST_ASSERT_EACH_EQUAL_HEX(8, p2, 3); - TEST_ASSERT_EACH_EQUAL_HEX(1, p3, 1); -} - -void testNotEqualHEXEachEqual1(void) -{ - UNITY_UINT32 p0[] = {1, 65132u, 65132u, 65132u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_HEX32(65132u, p0, 4); - VERIFY_FAILS_END -} - -void testNotEqualHEXEachEqual2(void) -{ - UNITY_UINT32 p0[] = {987, 987, 987, 65132u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_HEX32(987, p0, 4); - VERIFY_FAILS_END -} - -void testNotEqualHEXEachEqual3(void) -{ - UNITY_UINT32 p0[] = {8, 8, 987, 8}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_HEX(8, p0, 4); - VERIFY_FAILS_END -} - -void testEqualHEX32EachEqual(void) -{ - UNITY_UINT32 p0[] = {65132u, 65132u, 65132u, 65132u}; - UNITY_UINT32 p1[] = {987, 987, 987, 987}; - UNITY_UINT32 p2[] = {8, 8, 8, 2}; - UNITY_UINT32 p3[] = {1, 500, 600, 700}; - - TEST_ASSERT_EACH_EQUAL_HEX32(65132u, p0, 1); - TEST_ASSERT_EACH_EQUAL_HEX32(65132u, p0, 4); - TEST_ASSERT_EACH_EQUAL_HEX32(987, p1, 4); - TEST_ASSERT_EACH_EQUAL_HEX32(8, p2, 3); - TEST_ASSERT_EACH_EQUAL_HEX32(1, p3, 1); -} - -void testNotEqualHEX32EachEqual1(void) -{ - UNITY_UINT32 p0[] = {65132u, 8, 65132u, 65132u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_HEX32(65132u, p0, 4); - VERIFY_FAILS_END -} - -void testNotEqualHEX32EachEqual2(void) -{ - UNITY_UINT32 p0[] = {1, 987, 987, 987}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_HEX32(987, p0, 4); - VERIFY_FAILS_END -} - -void testNotEqualHEX32EachEqual3(void) -{ - UNITY_UINT32 p0[] = {8, 8, 8, 65132u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_HEX32(8, p0, 4); - VERIFY_FAILS_END -} - -void testEqualHEX16EachEqual(void) -{ - UNITY_UINT16 p0[] = {65132u, 65132u, 65132u, 65132u}; - UNITY_UINT16 p1[] = {987, 987, 987, 987}; - UNITY_UINT16 p2[] = {8, 8, 8, 2}; - UNITY_UINT16 p3[] = {1, 500, 600, 700}; - - TEST_ASSERT_EACH_EQUAL_HEX16(65132u, p0, 1); - TEST_ASSERT_EACH_EQUAL_HEX16(65132u, p0, 4); - TEST_ASSERT_EACH_EQUAL_HEX16(987, p1, 4); - TEST_ASSERT_EACH_EQUAL_HEX16(8, p2, 3); - TEST_ASSERT_EACH_EQUAL_HEX16(1, p3, 1); -} - -void testNotEqualHEX16EachEqual1(void) -{ - unsigned short p0[] = {65132u, 65132u, 987, 65132u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_HEX16(65132u, p0, 4); - VERIFY_FAILS_END -} - -void testNotEqualHEX16EachEqual2(void) -{ - unsigned short p0[] = {1, 987, 987, 987}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_HEX16(987, p0, 4); - VERIFY_FAILS_END -} - -void testNotEqualHEX16EachEqual3(void) -{ - unsigned short p0[] = {8, 8, 8, 65132u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_HEX16(8, p0, 4); - VERIFY_FAILS_END -} - -void testEqualHEX8EachEqual(void) -{ - unsigned char p0[] = {254u, 254u, 254u, 254u}; - unsigned char p1[] = {123, 123, 123, 123}; - unsigned char p2[] = {8, 8, 8, 2}; - unsigned char p3[] = {1, 23, 25, 26}; - - TEST_ASSERT_EACH_EQUAL_HEX8(254u, p0, 1); - TEST_ASSERT_EACH_EQUAL_HEX8(254u, p0, 4); - TEST_ASSERT_EACH_EQUAL_HEX8(123, p1, 4); - TEST_ASSERT_EACH_EQUAL_HEX8(8, p2, 3); - TEST_ASSERT_EACH_EQUAL_HEX8(1, p3, 1); -} - -void testNotEqualHEX8EachEqual1(void) -{ - unsigned char p0[] = {253u, 253u, 254u, 253u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_HEX8(253u, p0, 4); - VERIFY_FAILS_END -} - -void testNotEqualHEX8EachEqual2(void) -{ - unsigned char p0[] = {254u, 254u, 254u, 253u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_HEX8(254u, p0, 4); - VERIFY_FAILS_END -} - -void testNotEqualHEX8EachEqual3(void) -{ - unsigned char p0[] = {1, 8, 8, 8}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_HEX8(8, p0, 4); - VERIFY_FAILS_END -} - -void testEqualMemoryArrays(void) -{ - int p0[] = {1, 8, 987, -2}; - int p1[] = {1, 8, 987, -2}; - int p2[] = {1, 8, 987, 2}; - int p3[] = {1, 500, 600, 700}; - - TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, sizeof(int), 1); - TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p0, sizeof(int), 4); - TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, sizeof(int), 4); - TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p2, sizeof(int), 3); - TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p3, sizeof(int), 1); -} - -void testNotEqualMemoryArraysExpectedNull(void) -{ - int* p0 = NULL; - int p1[] = {1, 8, 987, 2}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, sizeof(int), 4); - VERIFY_FAILS_END -} - -void testNotEqualMemoryArraysActualNull(void) -{ - int p0[] = {1, 8, 987, -2}; - int* p1 = NULL; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, sizeof(int), 4); - VERIFY_FAILS_END -} - -void testNotEqualMemoryArrays1(void) -{ - int p0[] = {1, 8, 987, -2}; - int p1[] = {1, 8, 987, 2}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, sizeof(int), 4); - VERIFY_FAILS_END -} - -void testNotEqualMemoryArrays2(void) -{ - int p0[] = {1, 8, 987, -2}; - int p1[] = {2, 8, 987, -2}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, sizeof(int), 4); - VERIFY_FAILS_END -} - -void testNotEqualMemoryArrays3(void) -{ - int p0[] = {1, 8, 987, -2}; - int p1[] = {1, 8, 986, -2}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_MEMORY_ARRAY(p0, p1, sizeof(int), 4); - VERIFY_FAILS_END -} - -void testEqualMemoryEachEqual(void) -{ - int p0[] = {1, 8, 987, -2}; - int p1[] = {1, 8, 987, -2, 1, 8, 987, -2}; - int p2[] = {8, 8, 8, 2}; - int p3[] = {8, 500, 600, 700}; - int v = 8; - - TEST_ASSERT_EACH_EQUAL_MEMORY(p0, p0, sizeof(int)*4, 1); - TEST_ASSERT_EACH_EQUAL_MEMORY(p0, p1, sizeof(int)*4, 2); - TEST_ASSERT_EACH_EQUAL_MEMORY(p0, p1, sizeof(int)*4, 1); - TEST_ASSERT_EACH_EQUAL_MEMORY(&v, p2, sizeof(int), 3); - TEST_ASSERT_EACH_EQUAL_MEMORY(&v, p3, sizeof(int), 1); -} - -void testNotEqualMemoryEachEqualExpectedNull(void) -{ - int* p0 = NULL; - int p1[] = {1, 8, 987, 2}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_MEMORY(p0, p1, sizeof(int), 4); - VERIFY_FAILS_END -} - -void testNotEqualMemoryEachEqualActualNull(void) -{ - int p0[] = {1, 8, 987, -2}; - int* p1 = NULL; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_MEMORY(p0, p1, sizeof(int), 4); - VERIFY_FAILS_END -} - -void testNotEqualMemoryEachEqual1(void) -{ - int p0[] = {1, 8, 987, -2}; - int p1[] = {9, 8, 987, -2, 1, 8, 987, -2, 1, 8, 987, -2}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_MEMORY(p0, p1, sizeof(int)*4, 3); - VERIFY_FAILS_END -} - -void testNotEqualMemoryEachEqual2(void) -{ - int p0[] = {1, 8, 987, -2}; - int p1[] = {1, 8, 987, -2, 1, 8, 987, -2, 1, 8, 987, 9}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_MEMORY(p0, p1, sizeof(int)*4, 3); - VERIFY_FAILS_END -} - -void testNotEqualMemoryEachEqual3(void) -{ - int p0[] = {1, 8, 987, -2}; - int p1[] = {1, 8, 987, -2, 1, 9, 987, -2, 1, 8, 987, -2}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_MEMORY(p0, p1, sizeof(int)*4, 3); - VERIFY_FAILS_END -} - -void testProtection(void) -{ - volatile int mask = 0; - - if (TEST_PROTECT()) - { - mask |= 1; - TEST_ABORT(); - } - else - { - Unity.CurrentTestFailed = 0; - mask |= 2; - } - - TEST_ASSERT_EQUAL(3, mask); -} - -void testIgnoredAndThenFailInTearDown(void) -{ - SetToOneToFailInTearDown = 1; - TEST_IGNORE(); -} - -// Tricky series of macros to set USING_OUTPUT_SPY -#define USING_SPY_AS(a) EXPAND_AND_USE_2ND(ASSIGN_VALUE(a), 0) -#define ASSIGN_VALUE(a) VAL_##a -#define VAL_putcharSpy 0, 1 -#define EXPAND_AND_USE_2ND(a, b) SECOND_PARAM(a, b, throwaway) -#define SECOND_PARAM(a, b, ...) b -#if USING_SPY_AS(UNITY_OUTPUT_CHAR) - #define USING_OUTPUT_SPY // true only if UNITY_OUTPUT_CHAR = putcharSpy -#endif - -#ifdef USING_OUTPUT_SPY -#include -#define SPY_BUFFER_MAX 40 -static char putcharSpyBuffer[SPY_BUFFER_MAX]; -#endif -static int indexSpyBuffer; -static int putcharSpyEnabled; - -void startPutcharSpy(void) {indexSpyBuffer = 0; putcharSpyEnabled = 1;} - -void endPutcharSpy(void) {putcharSpyEnabled = 0;} - -char* getBufferPutcharSpy(void) -{ -#ifdef USING_OUTPUT_SPY - putcharSpyBuffer[indexSpyBuffer] = '\0'; - return putcharSpyBuffer; -#else - return NULL; -#endif -} - -void putcharSpy(int c) -{ -#ifdef USING_OUTPUT_SPY - if (putcharSpyEnabled) - { - if (indexSpyBuffer < SPY_BUFFER_MAX - 1) - putcharSpyBuffer[indexSpyBuffer++] = (char)c; - } else - putchar((char)c); -#endif -} - -void testFailureCountIncrementsAndIsReturnedAtEnd(void) -{ - UNITY_UINT savedFailures = Unity.TestFailures; - Unity.CurrentTestFailed = 1; - startPutcharSpy(); // Suppress output - UnityConcludeTest(); - endPutcharSpy(); - TEST_ASSERT_EQUAL(savedFailures + 1, Unity.TestFailures); - - startPutcharSpy(); // Suppress output - int failures = UnityEnd(); - Unity.TestFailures--; - endPutcharSpy(); - TEST_ASSERT_EQUAL(savedFailures + 1, failures); -} - -void testCstringsEscapeSequence(void) -{ -#ifndef USING_OUTPUT_SPY - TEST_IGNORE(); -#else - startPutcharSpy(); - UnityPrint("\x16\x10"); - endPutcharSpy(); - TEST_ASSERT_EQUAL_STRING("\\x16\\x10", getBufferPutcharSpy()); -#endif -} - -void testHexPrintsUpToMaxNumberOfNibbles(void) -{ -#ifndef USING_OUTPUT_SPY - TEST_IGNORE(); -#else - startPutcharSpy(); - UnityPrintNumberHex(0xBEE, 21); - endPutcharSpy(); - TEST_ASSERT_EQUAL_INT(sizeof(UNITY_INT)*2, strlen(getBufferPutcharSpy())); -#endif -} - -#define TEST_ASSERT_EQUAL_PRINT_NUMBERS(expected, actual) { \ - startPutcharSpy(); UnityPrintNumber((actual)); endPutcharSpy(); \ - TEST_ASSERT_EQUAL_STRING((expected), getBufferPutcharSpy()); \ - } - -#define TEST_ASSERT_EQUAL_PRINT_UNSIGNED_NUMBERS(expected, actual) { \ - startPutcharSpy(); UnityPrintNumberUnsigned((actual)); endPutcharSpy(); \ - TEST_ASSERT_EQUAL_STRING((expected), getBufferPutcharSpy()); \ - } - -void testPrintNumbers32(void) -{ -#ifndef USING_OUTPUT_SPY - TEST_IGNORE_MESSAGE("Compile with '-D UNITY_OUTPUT_CHAR=putcharSpy' to enable print testing"); -#else - TEST_ASSERT_EQUAL_PRINT_NUMBERS("0", 0); - TEST_ASSERT_EQUAL_PRINT_NUMBERS("1", 1); - TEST_ASSERT_EQUAL_PRINT_NUMBERS("-1", -1); - TEST_ASSERT_EQUAL_PRINT_NUMBERS("2000000000", 2000000000); - TEST_ASSERT_EQUAL_PRINT_NUMBERS("-2147483648", (UNITY_INT32)0x80000000); - TEST_ASSERT_EQUAL_PRINT_NUMBERS("-1", (UNITY_INT32)0xFFFFFFFF); -#endif -} - -void testPrintNumbersUnsigned32(void) -{ -#ifndef USING_OUTPUT_SPY - TEST_IGNORE(); -#else - TEST_ASSERT_EQUAL_PRINT_UNSIGNED_NUMBERS("0", 0); - TEST_ASSERT_EQUAL_PRINT_UNSIGNED_NUMBERS("1", 1); - TEST_ASSERT_EQUAL_PRINT_UNSIGNED_NUMBERS("1500000000", 1500000000); - TEST_ASSERT_EQUAL_PRINT_UNSIGNED_NUMBERS("2147483648", (UNITY_UINT32)0x80000000); - TEST_ASSERT_EQUAL_PRINT_UNSIGNED_NUMBERS("4294967295", (UNITY_UINT32)0xFFFFFFFF); -#endif -} - -// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES 64 BIT SUPPORT ================== - -void testPrintNumbersInt64(void) -{ -#ifndef UNITY_SUPPORT_64 - TEST_IGNORE(); -#else - #ifndef USING_OUTPUT_SPY - TEST_IGNORE(); - #else - TEST_ASSERT_EQUAL_PRINT_NUMBERS("0", 0); - TEST_ASSERT_EQUAL_PRINT_NUMBERS("10000000000", 10000000000); - TEST_ASSERT_EQUAL_PRINT_NUMBERS("-9223372036854775808", (UNITY_INT)0x8000000000000000); - TEST_ASSERT_EQUAL_PRINT_NUMBERS("-1", (UNITY_INT)0xFFFFFFFFFFFFFFFF); - #endif -#endif -} - -void testPrintNumbersUInt64(void) -{ -#ifndef UNITY_SUPPORT_64 - TEST_IGNORE(); -#else - #ifndef USING_OUTPUT_SPY - TEST_IGNORE(); - #else - TEST_ASSERT_EQUAL_PRINT_UNSIGNED_NUMBERS("0", 0); - TEST_ASSERT_EQUAL_PRINT_UNSIGNED_NUMBERS("70000000000", 70000000000); - TEST_ASSERT_EQUAL_PRINT_UNSIGNED_NUMBERS("9223372036854775808", (UNITY_UINT)0x8000000000000000); - TEST_ASSERT_EQUAL_PRINT_UNSIGNED_NUMBERS("18446744073709551615", (UNITY_UINT)0xFFFFFFFFFFFFFFFF); - #endif -#endif -} - -void testEqualHex64s(void) -{ -#ifndef UNITY_SUPPORT_64 - TEST_IGNORE(); -#else - UNITY_UINT64 v0, v1; - UNITY_UINT64 *p0, *p1; - - v0 = 0x9876543201234567; - v1 = 0x9876543201234567; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, 0x9876543201234567); - TEST_ASSERT_EQUAL_HEX64(v0, v1); - TEST_ASSERT_EQUAL_HEX64(0x9876543201234567, v1); - TEST_ASSERT_EQUAL_HEX64(v0, 0x9876543201234567); - TEST_ASSERT_EQUAL_HEX64(*p0, v1); - TEST_ASSERT_EQUAL_HEX64(*p0, *p1); - TEST_ASSERT_EQUAL_HEX64(*p0, 0x9876543201234567); -#endif -} - -void testEqualUint64s(void) -{ -#ifndef UNITY_SUPPORT_64 - TEST_IGNORE(); -#else - UNITY_UINT64 v0, v1; - UNITY_UINT64 *p0, *p1; - - v0 = 0x9876543201234567; - v1 = 0x9876543201234567; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_EQUAL_UINT64(0x9876543201234567, 0x9876543201234567); - TEST_ASSERT_EQUAL_UINT64(v0, v1); - TEST_ASSERT_EQUAL_UINT64(0x9876543201234567, v1); - TEST_ASSERT_EQUAL_UINT64(v0, 0x9876543201234567); - TEST_ASSERT_EQUAL_UINT64(*p0, v1); - TEST_ASSERT_EQUAL_UINT64(*p0, *p1); - TEST_ASSERT_EQUAL_UINT64(*p0, 0x9876543201234567); -#endif -} - -void testEqualInt64s(void) -{ -#ifndef UNITY_SUPPORT_64 - TEST_IGNORE(); -#else - UNITY_INT64 v0, v1; - UNITY_INT64 *p0, *p1; - - v0 = (UNITY_INT64)0x9876543201234567; - v1 = (UNITY_INT64)0x9876543201234567; - p0 = &v0; - p1 = &v1; - - TEST_ASSERT_EQUAL_INT64(0x9876543201234567, 0x9876543201234567); - TEST_ASSERT_EQUAL_INT64(v0, v1); - TEST_ASSERT_EQUAL_INT64(0x9876543201234567, v1); - TEST_ASSERT_EQUAL_INT64(v0, 0x9876543201234567); - TEST_ASSERT_EQUAL_INT64(*p0, v1); - TEST_ASSERT_EQUAL_INT64(*p0, *p1); - TEST_ASSERT_EQUAL_INT64(*p0, 0x9876543201234567); -#endif -} - - -void testNotEqualHex64s(void) -{ -#ifndef UNITY_SUPPORT_64 - TEST_IGNORE(); -#else - UNITY_UINT64 v0, v1; - - v0 = 9000000000; - v1 = 9100000000; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_HEX64(v0, v1); - VERIFY_FAILS_END -#endif -} - -void testNotEqualUint64s(void) -{ -#ifndef UNITY_SUPPORT_64 - TEST_IGNORE(); -#else - UNITY_UINT64 v0, v1; - - v0 = 9000000000; - v1 = 9100000000; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_UINT64(v0, v1); - VERIFY_FAILS_END -#endif -} - -void testNotEqualInt64s(void) -{ -#ifndef UNITY_SUPPORT_64 - TEST_IGNORE(); -#else - UNITY_INT64 v0, v1; - - v0 = -9000000000; - v1 = 9100000000; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_INT64(v0, v1); - VERIFY_FAILS_END -#endif -} - -void testNotEqualHex64sIfSigned(void) -{ -#ifndef UNITY_SUPPORT_64 - TEST_IGNORE(); -#else - UNITY_INT64 v0, v1; - - v0 = -9000000000; - v1 = 9000000000; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_HEX64(v0, v1); - VERIFY_FAILS_END -#endif -} - -void testHEX64sWithinDelta(void) -{ -#ifndef UNITY_SUPPORT_64 - TEST_IGNORE(); -#else - TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF,0x7FFFFFFFFFFFFFFE); - TEST_ASSERT_HEX64_WITHIN(5, 5000, 4996); - TEST_ASSERT_HEX64_WITHIN(5, 5000, 5005); -#endif -} - -void testHEX64sNotWithinDelta(void) -{ -#ifndef UNITY_SUPPORT_64 - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_HEX64_WITHIN(1, 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFC); - VERIFY_FAILS_END -#endif -} - -void testHEX64sNotWithinDeltaEvenThoughASignedIntWouldPass(void) -{ -#ifndef UNITY_SUPPORT_64 - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_HEX64_WITHIN(5, 1, -1); - VERIFY_FAILS_END -#endif -} - -void testUINT64sWithinDelta(void) -{ -#ifndef UNITY_SUPPORT_64 - TEST_IGNORE(); -#else - TEST_ASSERT_UINT64_WITHIN(1, 0x7FFFFFFFFFFFFFFF,0x7FFFFFFFFFFFFFFE); - TEST_ASSERT_UINT64_WITHIN(5, 5000, 4996); - TEST_ASSERT_UINT64_WITHIN(5, 5000, 5005); -#endif -} - -void testUINT64sNotWithinDelta(void) -{ -#ifndef UNITY_SUPPORT_64 - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_UINT64_WITHIN(1, 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFC); - VERIFY_FAILS_END -#endif -} - -void testUINT64sNotWithinDeltaEvenThoughASignedIntWouldPass(void) -{ -#ifndef UNITY_SUPPORT_64 - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_UINT64_WITHIN(5, 1, -1); - VERIFY_FAILS_END -#endif -} - -void testINT64sWithinDelta(void) -{ -#ifndef UNITY_SUPPORT_64 - TEST_IGNORE(); -#else - TEST_ASSERT_INT64_WITHIN(1, 0x7FFFFFFFFFFFFFFF,0x7FFFFFFFFFFFFFFE); - TEST_ASSERT_INT64_WITHIN(5, 5000, 4996); - TEST_ASSERT_INT64_WITHIN(5, 5000, 5005); -#endif -} - -void testINT64sNotWithinDelta(void) -{ -#ifndef UNITY_SUPPORT_64 - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_INT64_WITHIN(1, 0x7FFFFFFFFFFFFFFF, 0x7FFFFFFFFFFFFFFC); - VERIFY_FAILS_END -#endif -} - -void testINT64sNotWithinDeltaAndDifferenceOverflows(void) -{ -#ifndef UNITY_SUPPORT_64 - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_INT64_WITHIN(1, 0x8000000000000000, 0x7FFFFFFFFFFFFFFF); - VERIFY_FAILS_END -#endif -} - -void testEqualHEX64Arrays(void) -{ -#ifndef UNITY_SUPPORT_64 - TEST_IGNORE(); -#else - UNITY_UINT64 p0[] = {1, 8, 987, 65132u}; - UNITY_UINT64 p1[] = {1, 8, 987, 65132u}; - UNITY_UINT64 p2[] = {1, 8, 987, 2}; - UNITY_UINT64 p3[] = {1, 500, 600, 700}; - - TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 1); - TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p0, 4); - TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); - TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p2, 3); - TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p3, 1); -#endif -} - -void testEqualUint64Arrays(void) -{ -#ifndef UNITY_SUPPORT_64 - TEST_IGNORE(); -#else - UNITY_UINT64 p0[] = {1, 8, 987, 65132u}; - UNITY_UINT64 p1[] = {1, 8, 987, 65132u}; - UNITY_UINT64 p2[] = {1, 8, 987, 2}; - UNITY_UINT64 p3[] = {1, 500, 600, 700}; - - TEST_ASSERT_EQUAL_UINT64_ARRAY(p0, p0, 1); - TEST_ASSERT_EQUAL_UINT64_ARRAY(p0, p0, 4); - TEST_ASSERT_EQUAL_UINT64_ARRAY(p0, p1, 4); - TEST_ASSERT_EQUAL_UINT64_ARRAY(p0, p2, 3); - TEST_ASSERT_EQUAL_UINT64_ARRAY(p0, p3, 1); -#endif -} - -void testEqualInt64Arrays(void) -{ -#ifndef UNITY_SUPPORT_64 - TEST_IGNORE(); -#else - UNITY_INT64 p0[] = {1, 8, 987, -65132}; - UNITY_INT64 p1[] = {1, 8, 987, -65132}; - UNITY_INT64 p2[] = {1, 8, 987, -2}; - UNITY_INT64 p3[] = {1, 500, 600, 700}; - - TEST_ASSERT_EQUAL_INT64_ARRAY(p0, p0, 1); - TEST_ASSERT_EQUAL_INT64_ARRAY(p0, p0, 4); - TEST_ASSERT_EQUAL_INT64_ARRAY(p0, p1, 4); - TEST_ASSERT_EQUAL_INT64_ARRAY(p0, p2, 3); - TEST_ASSERT_EQUAL_INT64_ARRAY(p0, p3, 1); -#endif -} - - -void testNotEqualHEX64Arrays1(void) -{ -#ifndef UNITY_SUPPORT_64 - TEST_IGNORE(); -#else - UNITY_UINT64 p0[] = {1, 8, 987, 65132u}; - UNITY_UINT64 p1[] = {1, 8, 987, 65131u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -#endif -} - -void testNotEqualHEX64Arrays2(void) -{ -#ifndef UNITY_SUPPORT_64 - TEST_IGNORE(); -#else - UNITY_UINT64 p0[] = {1, 8, 987, 65132u}; - UNITY_UINT64 p1[] = {2, 8, 987, 65132u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_HEX64_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -#endif -} - -void testNotEqualUint64Arrays(void) -{ -#ifndef UNITY_SUPPORT_64 - TEST_IGNORE(); -#else - UNITY_UINT64 p0[] = {1, 8, 987, 65132u}; - UNITY_UINT64 p1[] = {1, 8, 987, 65131u}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_UINT64_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -#endif -} - -void testNotEqualInt64Arrays(void) -{ -#ifndef UNITY_SUPPORT_64 - TEST_IGNORE(); -#else - UNITY_INT64 p0[] = {1, 8, 987, -65132}; - UNITY_INT64 p1[] = {1, 8, 987, -65131}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_INT64_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -#endif -} -// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES FLOAT SUPPORT ================== - -void testFloatsWithinDelta(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - TEST_ASSERT_FLOAT_WITHIN(0.00003f, 187245.03485f, 187245.03488f); - TEST_ASSERT_FLOAT_WITHIN(1.0f, 187245.0f, 187246.0f); - TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2549f, 9273.2049f); - TEST_ASSERT_FLOAT_WITHIN(0.007f, -726.93724f, -726.94424f); -#endif -} - -void testFloatsNotWithinDelta(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_FLOAT_WITHIN(0.05f, 9273.2649f, 9273.2049f); - VERIFY_FAILS_END -#endif -} - -void testFloatsEqual(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - TEST_ASSERT_EQUAL_FLOAT(187245.0f, 187246.0f); - TEST_ASSERT_EQUAL_FLOAT(18724.5f, 18724.6f); - TEST_ASSERT_EQUAL_FLOAT(9273.2549f, 9273.2599f); - TEST_ASSERT_EQUAL_FLOAT(-726.93724f, -726.9374f); -#endif -} - -void testFloatsNotEqual(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_FLOAT(9273.9649f, 9273.0049f); - VERIFY_FAILS_END -#endif -} - -void testFloatsNotEqualNegative1(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_FLOAT(-9273.9649f, -9273.0049f); - VERIFY_FAILS_END -#endif -} - -void testFloatsNotEqualNegative2(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_FLOAT(-9273.0049f, -9273.9649f); - VERIFY_FAILS_END -#endif -} - -void testFloatsNotEqualActualNaN(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_FLOAT(85.963f, 0.0f / f_zero); - VERIFY_FAILS_END -#endif -} - -void testFloatsNotEqualExpectedNaN(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_FLOAT(0.0f / f_zero, 85.963f); - VERIFY_FAILS_END -#endif -} - -void testFloatsEqualBothNaN(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - TEST_ASSERT_EQUAL_FLOAT(0.0f / f_zero, 0.0f / f_zero); -#endif -} - -void testFloatsNotEqualInfNaN(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_FLOAT(1.0f / f_zero, 0.0f / f_zero); - VERIFY_FAILS_END -#endif -} - -void testFloatsNotEqualNaNInf(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_FLOAT(0.0f / f_zero, 1.0f / f_zero); - VERIFY_FAILS_END -#endif -} - -void testFloatsNotEqualActualInf(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_FLOAT(321.642f, 1.0f / f_zero); - VERIFY_FAILS_END -#endif -} - -void testFloatsNotEqualExpectedInf(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_FLOAT(1.0f / f_zero, 321.642f); - VERIFY_FAILS_END -#endif -} - -void testFloatsEqualBothInf(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - TEST_ASSERT_EQUAL_FLOAT(1.0f / f_zero, 1.0f / f_zero); -#endif -} - -void testFloatsNotEqualPlusMinusInf(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_FLOAT(1.0f / f_zero, -1.0f / f_zero); - VERIFY_FAILS_END -#endif -} - -void testFloatIsPosInf1(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - TEST_ASSERT_FLOAT_IS_INF(2.0f / f_zero); -#endif -} - -void testFloatIsPosInf2(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_FLOAT_IS_NOT_INF(2.0f / f_zero); - VERIFY_FAILS_END -#endif -} - -void testFloatIsNegInf1(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - TEST_ASSERT_FLOAT_IS_NEG_INF(-3.0f / f_zero); -#endif -} - -void testFloatIsNegInf2(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_FLOAT_IS_NOT_NEG_INF(-3.0f / f_zero); - VERIFY_FAILS_END -#endif -} - -void testFloatIsNotPosInf1(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_FLOAT_IS_INF(2.0f); - VERIFY_FAILS_END -#endif -} - -void testFloatIsNotPosInf2(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - TEST_ASSERT_FLOAT_IS_NOT_INF(2.0f); -#endif -} - -void testFloatIsNotNegInf(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_FLOAT_IS_NEG_INF(-999.876f); - VERIFY_FAILS_END -#endif -} - -void testFloatIsNan1(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - TEST_ASSERT_FLOAT_IS_NAN(0.0f / f_zero); -#endif -} - -void testFloatIsNan2(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_FLOAT_IS_NOT_NAN(0.0f / f_zero); - VERIFY_FAILS_END -#endif -} - -void testFloatIsNotNan1(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_FLOAT_IS_NAN(234.9f); - VERIFY_FAILS_END -#endif -} - -void testFloatIsNotNan2(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - TEST_ASSERT_FLOAT_IS_NOT_NAN(234.9f); -#endif -} - -void testFloatInfIsNotNan(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_FLOAT_IS_NAN(1.0f / f_zero); - VERIFY_FAILS_END -#endif -} - -void testFloatNanIsNotInf(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_FLOAT_IS_INF(0.0f / f_zero); - VERIFY_FAILS_END -#endif -} - -void testFloatIsDeterminate1(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - TEST_ASSERT_FLOAT_IS_DETERMINATE(0.0f); - TEST_ASSERT_FLOAT_IS_DETERMINATE(123.3f); - TEST_ASSERT_FLOAT_IS_DETERMINATE(-88.3f); -#endif -} - -void testFloatIsDeterminate2(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE(-88.3f); - VERIFY_FAILS_END -#endif -} - -void testFloatIsNotDeterminate1(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE(1.0f / f_zero); - TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE(-1.0f / f_zero); - TEST_ASSERT_FLOAT_IS_NOT_DETERMINATE(0.0f / f_zero); -#endif -} - -void testFloatIsNotDeterminate2(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_FLOAT_IS_DETERMINATE(-1.0f / f_zero); - VERIFY_FAILS_END -#endif -} - -void testFloatTraitFailsOnInvalidTrait(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - UnityAssertFloatSpecial(1.0f, NULL, __LINE__, UNITY_FLOAT_INVALID_TRAIT); - VERIFY_FAILS_END -#endif -} - - -void testEqualFloatArrays(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - float p0[] = {1.0f, -8.0f, 25.4f, -0.123f}; - float p1[] = {1.0f, -8.0f, 25.4f, -0.123f}; - float p2[] = {1.0f, -8.0f, 25.4f, -0.2f}; - float p3[] = {1.0f, -23.0f, 25.0f, -0.26f}; - - TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 1); - TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p0, 4); - TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); - TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p2, 3); - TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p3, 1); - TEST_ASSERT_EQUAL_FLOAT_ARRAY(NULL, NULL, 1); -#endif -} - -void testNotEqualFloatArraysExpectedNull(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - float* p0 = NULL; - float p1[] = {1.0f, 8.0f, 25.4f, 0.252f}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -#endif -} - -void testNotEqualFloatArraysActualNull(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - float p0[] = {1.0f, 8.0f, 25.4f, 0.253f}; - float* p1 = NULL; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -#endif -} - -void testNotEqualFloatArrays1(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - float p0[] = {1.0f, 8.0f, 25.4f, 0.253f}; - float p1[] = {1.0f, 8.0f, 25.4f, 0.252f}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -#endif -} - -void testNotEqualFloatArrays2(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - float p0[] = {1.0f, 8.0f, 25.4f, 0.253f}; - float p1[] = {2.0f, 8.0f, 25.4f, 0.253f}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -#endif -} - -void testNotEqualFloatArrays3(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - float p0[] = {1.0f, 8.0f, 25.4f, 0.253f}; - float p1[] = {1.0f, 8.0f, 25.5f, 0.253f}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -#endif -} - -void testNotEqualFloatArraysNegative1(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - float p0[] = {-1.0f, -8.0f, -25.4f, -0.253f}; - float p1[] = {-1.0f, -8.0f, -25.4f, -0.252f}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -#endif -} - -void testNotEqualFloatArraysNegative2(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - float p0[] = {-1.0f, -8.0f, -25.4f, -0.253f}; - float p1[] = {-2.0f, -8.0f, -25.4f, -0.253f}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -#endif -} - -void testNotEqualFloatArraysNegative3(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - float p0[] = {-1.0f, -8.0f, -25.4f, -0.253f}; - float p1[] = {-1.0f, -8.0f, -25.5f, -0.253f}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -#endif -} - -void testEqualFloatArraysNaN(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - float p0[] = {1.0f, 0.0f / f_zero, 25.4f, 0.253f}; - float p1[] = {1.0f, 0.0f / f_zero, 25.4f, 0.253f}; - - TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); -#endif -} - -void testEqualFloatArraysInf(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - float p0[] = {1.0f, 1.0f / f_zero, 25.4f, 0.253f}; - float p1[] = {1.0f, 1.0f / f_zero, 25.4f, 0.253f}; - - TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 4); -#endif -} - -void testNotEqualFloatArraysLengthZero(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - float p0[1] = {0.0f}; - float p1[1] = {0.0f}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_FLOAT_ARRAY(p0, p1, 0); - VERIFY_FAILS_END -#endif -} - -void testEqualFloatEachEqual(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - float p0[] = {1.0f, 1.0f, 1.0f, 1.0f}; - float p1[] = {-0.123f, -0.123f, -0.123f, -0.123f}; - float p2[] = {25.4f, 25.4f, 25.4f, -0.2f}; - float p3[] = {1.0f, -23.0f, 25.0f, -0.26f}; - - TEST_ASSERT_EACH_EQUAL_FLOAT(1.0f, p0, 1); - TEST_ASSERT_EACH_EQUAL_FLOAT(1.0f, p0, 4); - TEST_ASSERT_EACH_EQUAL_FLOAT(-0.123f, p1, 4); - TEST_ASSERT_EACH_EQUAL_FLOAT(25.4f, p2, 3); - TEST_ASSERT_EACH_EQUAL_FLOAT(1.0f, p3, 1); -#endif -} - -void testNotEqualFloatEachEqualActualNull(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - float* p0 = NULL; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_FLOAT(5, p0, 4); - VERIFY_FAILS_END -#endif -} - -void testNotEqualFloatEachEqual1(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - float p0[] = {0.253f, 8.0f, 0.253f, 0.253f}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_FLOAT(0.253f, p0, 4); - VERIFY_FAILS_END -#endif -} - -void testNotEqualFloatEachEqual2(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - float p0[] = {8.0f, 8.0f, 8.0f, 0.253f}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_FLOAT(8.0f, p0, 4); - VERIFY_FAILS_END -#endif -} - -void testNotEqualFloatEachEqual3(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - float p0[] = {1.0f, 1.0f, 1.0f, 0.253f}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_FLOAT(1.0f, p0, 4); - VERIFY_FAILS_END -#endif -} - -void testNotEqualFloatEachEqualNegative1(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - float p0[] = {-1.0f, -0.253f, -0.253f, -0.253f}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_FLOAT(-0.253f, p0, 4); - VERIFY_FAILS_END -#endif -} - -void testNotEqualFloatEachEqualNegative2(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - float p0[] = {-25.4f, -8.0f, -25.4f, -25.4f}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_FLOAT(-25.4f, p0, 4); - VERIFY_FAILS_END -#endif -} - -void testNotEqualFloatEachEqualNegative3(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - float p0[] = {-8.0f, -8.0f, -8.0f, -0.253f}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_FLOAT(-8.0f, p0, 4); - VERIFY_FAILS_END -#endif -} - -void testEqualFloatEachEqualNaN(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - float p0[] = {0.0f / f_zero, 0.0f / f_zero, 0.0f / f_zero, 0.0f / f_zero}; - - TEST_ASSERT_EACH_EQUAL_FLOAT(0.0f / f_zero, p0, 4); -#endif -} - -void testEqualFloatEachEqualInf(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - float p0[] = {1.0f / f_zero, 1.0f / f_zero, 25.4f, 0.253f}; - - TEST_ASSERT_EACH_EQUAL_FLOAT(1.0f / f_zero, p0, 2); -#endif -} - -void testNotEqualFloatEachEqualLengthZero(void) -{ -#ifdef UNITY_EXCLUDE_FLOAT - TEST_IGNORE(); -#else - float p0[1] = {0.0f}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_FLOAT(0.0f, p0, 0); - VERIFY_FAILS_END -#endif -} - -#define TEST_ASSERT_EQUAL_PRINT_FLOATING(expected, actual) { \ - startPutcharSpy(); UnityPrintFloat((actual)); endPutcharSpy(); \ - TEST_ASSERT_EQUAL_STRING((expected), getBufferPutcharSpy()); \ - } - -void testFloatPrinting(void) -{ -#if defined(UNITY_EXCLUDE_FLOAT_PRINT) || !defined(USING_OUTPUT_SPY) - TEST_IGNORE(); -#else - TEST_ASSERT_EQUAL_PRINT_FLOATING("0", 0.0f); - TEST_ASSERT_EQUAL_PRINT_FLOATING("4.99e-07", 0.000000499f); - TEST_ASSERT_EQUAL_PRINT_FLOATING("5e-07", 0.00000050000005f); - TEST_ASSERT_EQUAL_PRINT_FLOATING("0.100469", 0.100469499f); - TEST_ASSERT_EQUAL_PRINT_FLOATING("1", 0.9999995f); /*Rounding to int place*/ - TEST_ASSERT_EQUAL_PRINT_FLOATING("1", 1.0f); - TEST_ASSERT_EQUAL_PRINT_FLOATING("1.25", 1.25f); - TEST_ASSERT_EQUAL_PRINT_FLOATING("7.99999", 7.99999f); /*Not rounding*/ - TEST_ASSERT_EQUAL_PRINT_FLOATING("16.0002", 16.0002f); - TEST_ASSERT_EQUAL_PRINT_FLOATING("16.0004", 16.0004f); - TEST_ASSERT_EQUAL_PRINT_FLOATING("16.0006", 16.0006f); - TEST_ASSERT_EQUAL_PRINT_FLOATING("999999", 999999.0f); /*Last full print integer*/ - - TEST_ASSERT_EQUAL_PRINT_FLOATING("-0", -0.0f); - TEST_ASSERT_EQUAL_PRINT_FLOATING("-4.99e-07", -0.000000499f); - TEST_ASSERT_EQUAL_PRINT_FLOATING("-5e-07", -0.00000050000005f); - TEST_ASSERT_EQUAL_PRINT_FLOATING("-0.100469", -0.100469499f); - TEST_ASSERT_EQUAL_PRINT_FLOATING("-1", -0.9999995f); /*Rounding to int place*/ - TEST_ASSERT_EQUAL_PRINT_FLOATING("-1", -1.0f); - TEST_ASSERT_EQUAL_PRINT_FLOATING("-1.25", -1.25f); - TEST_ASSERT_EQUAL_PRINT_FLOATING("-7.99999", -7.99999f); /*Not rounding*/ - TEST_ASSERT_EQUAL_PRINT_FLOATING("-16.0002", -16.0002f); - TEST_ASSERT_EQUAL_PRINT_FLOATING("-16.0004", -16.0004f); - TEST_ASSERT_EQUAL_PRINT_FLOATING("-16.0006", -16.0006f); - TEST_ASSERT_EQUAL_PRINT_FLOATING("-999999", -999999.0f); /*Last full print integer*/ - - TEST_ASSERT_EQUAL_PRINT_FLOATING("4.29497e+09", 4294967296.0f); - TEST_ASSERT_EQUAL_PRINT_FLOATING("5e+09", 5000000000.0f); - TEST_ASSERT_EQUAL_PRINT_FLOATING("8e+09", 8.0e+09f); - TEST_ASSERT_EQUAL_PRINT_FLOATING("8.31e+09", 8309999104.0f); - TEST_ASSERT_EQUAL_PRINT_FLOATING("1e+10", 1.0e+10f); - TEST_ASSERT_EQUAL_PRINT_FLOATING("1e+10", 10000000000.0f); - /* Some compilers have trouble with inexact float constants, a float cast works generally */ - TEST_ASSERT_EQUAL_PRINT_FLOATING("1.00005e+10", (float)1.000054e+10f); - TEST_ASSERT_EQUAL_PRINT_FLOATING("1.1e+38", (float)1.10000005e+38f); - TEST_ASSERT_EQUAL_PRINT_FLOATING("1.6353e+10", 1.63529943e+10f); - TEST_ASSERT_EQUAL_PRINT_FLOATING("3.40282e+38", 3.40282346638e38f); - - TEST_ASSERT_EQUAL_PRINT_FLOATING("-1e+10", -1.0e+10f); - TEST_ASSERT_EQUAL_PRINT_FLOATING("-3.40282e+38", -3.40282346638e38f); -#endif -} - -void testFloatPrintingInfinityAndNaN(void) -{ -#if defined(UNITY_EXCLUDE_FLOAT_PRINT) || !defined(USING_OUTPUT_SPY) - TEST_IGNORE(); -#else - TEST_ASSERT_EQUAL_PRINT_FLOATING("inf", 1.0f / f_zero); - TEST_ASSERT_EQUAL_PRINT_FLOATING("-inf", -1.0f / f_zero); - - TEST_ASSERT_EQUAL_PRINT_FLOATING("nan", 0.0f / f_zero); -#endif -} - -#if defined(UNITY_TEST_ALL_FLOATS_PRINT_OK) && defined(USING_OUTPUT_SPY) -static void printFloatValue(float f) -{ - char expected[18]; - char expected_lower[18]; - char expected_higher[18]; - - startPutcharSpy(); - - UnityPrintFloat(f); - - sprintf(expected, "%.6g", f); - - /* We print all NaN's as "nan", not "-nan" */ - if(strcmp(expected, "-nan") == 0) strcpy(expected, "nan"); - - /* Allow for rounding differences in last digit */ - double lower = (double)f * 0.9999995; - double higher = (double)f * 1.0000005; - - if (isfinite(lower)) sprintf(expected_lower, "%.6g", lower); else strcpy(expected_lower, expected); - if (isfinite(higher)) sprintf(expected_higher, "%.6g", higher); else strcpy(expected_higher, expected); - - if (strcmp(expected, getBufferPutcharSpy()) != 0 && - strcmp(expected_lower, getBufferPutcharSpy()) != 0 && - strcmp(expected_higher, getBufferPutcharSpy()) != 0) - { - /* Fail with diagnostic printing */ - TEST_ASSERT_EQUAL_PRINT_FLOATING(expected, f); - } -} -#endif - -void testFloatPrintingRandomSamples(void) -{ -#if !defined(UNITY_TEST_ALL_FLOATS_PRINT_OK) || !defined(USING_OUTPUT_SPY) - TEST_IGNORE(); -#else - union { float f_value; uint32_t int_value; } u; - - /* These values are not covered by the MINSTD generator */ - u.int_value = 0x00000000; printFloatValue(u.f_value); - u.int_value = 0x80000000; printFloatValue(u.f_value); - u.int_value = 0x7fffffff; printFloatValue(u.f_value); - u.int_value = 0xffffffff; printFloatValue(u.f_value); - - uint32_t a = 1; - for(int num_tested = 0; num_tested < 1000000; num_tested++) - { - /* MINSTD pseudo-random number generator */ - a = (uint32_t)(((uint64_t)a * 48271u) % 2147483647u); - - /* MINSTD does not set the highest bit; test both possibilities */ - u.int_value = a; printFloatValue(u.f_value); - u.int_value = a | 0x80000000; printFloatValue(u.f_value); - } -#endif -} - -// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES DOUBLE SUPPORT ================== - -void testDoublesWithinDelta(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - TEST_ASSERT_DOUBLE_WITHIN(0.00003, 187245.03485, 187245.03488); - TEST_ASSERT_DOUBLE_WITHIN(1.0, 187245.0, 187246.0); - TEST_ASSERT_DOUBLE_WITHIN(0.05, 9273.2549, 9273.2049); - TEST_ASSERT_DOUBLE_WITHIN(0.007, -726.93725, -726.94424); -#endif -} - -void testDoublesNotWithinDelta(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_DOUBLE_WITHIN(0.05, 9273.2649, 9273.2049); - VERIFY_FAILS_END -#endif -} - - -void testDoublesEqual(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - TEST_ASSERT_EQUAL_DOUBLE(187245123456.0, 187245123456.0); - TEST_ASSERT_EQUAL_DOUBLE(187241234567.5, 187241234567.6); - TEST_ASSERT_EQUAL_DOUBLE(9273.2512345649, 9273.25123455699); - TEST_ASSERT_EQUAL_DOUBLE(-726.12345693724, -726.1234569374); -#endif -} - -void testDoublesNotEqual(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_DOUBLE(9273.9649, 9273.0049); - VERIFY_FAILS_END -#endif -} - -void testDoublesNotEqualNegative1(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_DOUBLE(-9273.9649, -9273.0049); - VERIFY_FAILS_END -#endif -} - -void testDoublesNotEqualNegative2(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_DOUBLE(-9273.0049, -9273.9649); - VERIFY_FAILS_END -#endif -} - -void testDoublesNotEqualActualNaN(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_DOUBLE(85.963, 0.0 / d_zero); - VERIFY_FAILS_END -#endif -} - -void testDoublesNotEqualExpectedNaN(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_DOUBLE(0.0 / d_zero, 85.963); - VERIFY_FAILS_END -#endif -} - -void testDoublesEqualBothNaN(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - TEST_ASSERT_EQUAL_DOUBLE(0.0 / d_zero, 0.0 / d_zero); -#endif -} - -void testDoublesNotEqualInfNaN(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_DOUBLE(1.0 / d_zero, 0.0 / d_zero); - VERIFY_FAILS_END -#endif -} - -void testDoublesNotEqualNaNInf(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_DOUBLE(0.0 / d_zero, 1.0 / d_zero); - VERIFY_FAILS_END -#endif -} - -void testDoublesNotEqualActualInf(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_DOUBLE(321.642, 1.0 / d_zero); - VERIFY_FAILS_END -#endif -} - -void testDoublesNotEqualExpectedInf(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_DOUBLE(1.0 / d_zero, 321.642); - VERIFY_FAILS_END -#endif -} - -void testDoublesEqualBothInf(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - TEST_ASSERT_EQUAL_DOUBLE(1.0 / d_zero, 1.0 / d_zero); -#endif -} - -void testDoublesNotEqualPlusMinusInf(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_DOUBLE(1.0 / d_zero, -1.0 / d_zero); - VERIFY_FAILS_END -#endif -} - -void testDoubleIsPosInf1(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - TEST_ASSERT_DOUBLE_IS_INF(2.0 / d_zero); -#endif -} - -void testDoubleIsPosInf2(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_DOUBLE_IS_NOT_INF(2.0 / d_zero); - VERIFY_FAILS_END -#endif -} - -void testDoubleIsNegInf1(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - TEST_ASSERT_DOUBLE_IS_NEG_INF(-3.0 / d_zero); -#endif -} - -void testDoubleIsNegInf2(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_DOUBLE_IS_NOT_NEG_INF(-3.0 / d_zero); - VERIFY_FAILS_END -#endif -} - -void testDoubleIsNotPosInf1(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_DOUBLE_IS_INF(2.0); - VERIFY_FAILS_END -#endif -} - -void testDoubleIsNotPosInf2(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - TEST_ASSERT_DOUBLE_IS_NOT_INF(2.0); -#endif -} - -void testDoubleIsNotNegInf(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_DOUBLE_IS_NEG_INF(-999.876); - VERIFY_FAILS_END -#endif -} - -void testDoubleIsNan1(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - TEST_ASSERT_DOUBLE_IS_NAN(0.0 / d_zero); -#endif -} - -void testDoubleIsNan2(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_DOUBLE_IS_NOT_NAN(0.0 / d_zero); - VERIFY_FAILS_END -#endif -} - -void testDoubleIsNotNan1(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_DOUBLE_IS_NAN(234.9); - VERIFY_FAILS_END -#endif -} - -void testDoubleIsNotNan2(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - TEST_ASSERT_DOUBLE_IS_NOT_NAN(234.9); -#endif -} - -void testDoubleInfIsNotNan(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_DOUBLE_IS_NAN(1.0 / d_zero); - VERIFY_FAILS_END -#endif -} - -void testDoubleNanIsNotInf(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_DOUBLE_IS_INF(0.0 / d_zero); - VERIFY_FAILS_END -#endif -} - -void testDoubleIsDeterminate1(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - TEST_ASSERT_DOUBLE_IS_DETERMINATE(0.0); - TEST_ASSERT_DOUBLE_IS_DETERMINATE(123.3); - TEST_ASSERT_DOUBLE_IS_DETERMINATE(-88.3); -#endif -} - -void testDoubleIsDeterminate2(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(-88.3); - VERIFY_FAILS_END -#endif -} - -void testDoubleIsNotDeterminate1(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(1.0 / d_zero); - TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(-1.0 / d_zero); - TEST_ASSERT_DOUBLE_IS_NOT_DETERMINATE(0.0 / d_zero); -#endif -} - -void testDoubleIsNotDeterminate2(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - TEST_ASSERT_DOUBLE_IS_DETERMINATE(-1.0 / d_zero); - VERIFY_FAILS_END -#endif -} - -void testDoubleTraitFailsOnInvalidTrait(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - EXPECT_ABORT_BEGIN - UnityAssertDoubleSpecial(1.0, NULL, __LINE__, UNITY_FLOAT_INVALID_TRAIT); - VERIFY_FAILS_END -#endif -} - -void testEqualDoubleArrays(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - double p0[] = {1.0, -8.0, 25.4, -0.123}; - double p1[] = {1.0, -8.0, 25.4, -0.123}; - double p2[] = {1.0, -8.0, 25.4, -0.2}; - double p3[] = {1.0, -23.0, 25.0, -0.26}; - - TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p0, 1); - TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p0, 4); - TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); - TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p2, 3); - TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p3, 1); - TEST_ASSERT_EQUAL_DOUBLE_ARRAY(NULL, NULL, 1); -#endif -} - -void testNotEqualDoubleArraysExpectedNull(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - double* p0 = NULL; - double p1[] = {1.0, 8.0, 25.4, 0.252}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -#endif -} - -void testNotEqualDoubleArraysActualNull(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - double p0[] = {1.0, 8.0, 25.4, 0.253}; - double* p1 = NULL; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -#endif -} - -void testNotEqualDoubleArrays1(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - double p0[] = {1.0, 8.0, 25.4, 0.25666666667}; - double p1[] = {1.0, 8.0, 25.4, 0.25666666666}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -#endif -} - -void testNotEqualDoubleArrays2(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - double p0[] = {1.0, 8.0, 25.4, 0.253}; - double p1[] = {2.0, 8.0, 25.4, 0.253}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -#endif -} - -void testNotEqualDoubleArrays3(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - double p0[] = {1.0, 8.0, 25.4, 0.253}; - double p1[] = {1.0, 8.0, 25.5, 0.253}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -#endif -} - -void testNotEqualDoubleArraysNegative1(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - double p0[] = {-1.0, -8.0, -25.4, -0.2566666667}; - double p1[] = {-1.0, -8.0, -25.4, -0.2566666666}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -#endif -} - -void testNotEqualDoubleArraysNegative2(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - double p0[] = {-1.0, -8.0, -25.4, -0.253}; - double p1[] = {-2.0, -8.0, -25.4, -0.253}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -#endif -} - -void testNotEqualDoubleArraysNegative3(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - double p0[] = {-1.0, -8.0, -25.4, -0.253}; - double p1[] = {-1.0, -8.0, -25.5, -0.253}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); - VERIFY_FAILS_END -#endif -} - -void testEqualDoubleArraysNaN(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - double p0[] = {1.0, 0.0 / d_zero, 25.4, 0.253}; - double p1[] = {1.0, 0.0 / d_zero, 25.4, 0.253}; - - TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); -#endif -} - -void testEqualDoubleArraysInf(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - double p0[] = {1.0, 1.0 / d_zero, 25.4, 0.253}; - double p1[] = {1.0, 1.0 / d_zero, 25.4, 0.253}; - - TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 4); -#endif -} - -void testNotEqualDoubleArraysLengthZero(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - double p0[1] = {0.0}; - double p1[1] = {0.0}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_DOUBLE_ARRAY(p0, p1, 0); - VERIFY_FAILS_END -#endif -} - -void testEqualDoubleEachEqual(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - double p0[] = {1.0, 1.0, 1.0, 1.0}; - double p1[] = {-0.123, -0.123, -0.123, -0.123}; - double p2[] = {25.4, 25.4, 25.4, -0.2}; - double p3[] = {1.0, -23.0, 25.0, -0.26}; - - TEST_ASSERT_EACH_EQUAL_DOUBLE(1.0, p0, 1); - TEST_ASSERT_EACH_EQUAL_DOUBLE(1.0, p0, 4); - TEST_ASSERT_EACH_EQUAL_DOUBLE(-0.123, p1, 4); - TEST_ASSERT_EACH_EQUAL_DOUBLE(25.4, p2, 3); - TEST_ASSERT_EACH_EQUAL_DOUBLE(1.0, p3, 1); -#endif -} - -void testNotEqualDoubleEachEqualActualNull(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - double* p0 = NULL; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_DOUBLE(5, p0, 4); - VERIFY_FAILS_END -#endif -} - -void testNotEqualDoubleEachEqual1(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - double p0[] = {0.253, 8.0, 0.253, 0.253}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_DOUBLE(0.253, p0, 4); - VERIFY_FAILS_END -#endif -} - -void testNotEqualDoubleEachEqual2(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - double p0[] = {8.0, 8.0, 8.0, 0.253}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_DOUBLE(8.0, p0, 4); - VERIFY_FAILS_END -#endif -} - -void testNotEqualDoubleEachEqual3(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - double p0[] = {1.0, 1.0, 1.0, 0.253}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_DOUBLE(1.0, p0, 4); - VERIFY_FAILS_END -#endif -} - -void testNotEqualDoubleEachEqualNegative1(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - double p0[] = {-1.0, -0.253, -0.253, -0.253}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_DOUBLE(-0.253, p0, 4); - VERIFY_FAILS_END -#endif -} - -void testNotEqualDoubleEachEqualNegative2(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - double p0[] = {-25.4, -8.0, -25.4, -25.4}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_DOUBLE(-25.4, p0, 4); - VERIFY_FAILS_END -#endif -} - -void testNotEqualDoubleEachEqualNegative3(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - double p0[] = {-8.0, -8.0, -8.0, -0.253}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_DOUBLE(-8.0, p0, 4); - VERIFY_FAILS_END -#endif -} - -void testEqualDoubleEachEqualNaN(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - double p0[] = {0.0 / d_zero, 0.0 / d_zero, 0.0 / d_zero, 0.0 / d_zero}; - - TEST_ASSERT_EACH_EQUAL_DOUBLE(0.0 / d_zero, p0, 4); -#endif -} - -void testEqualDoubleEachEqualInf(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - double p0[] = {1.0 / d_zero, 1.0 / d_zero, 25.4, 0.253}; - - TEST_ASSERT_EACH_EQUAL_DOUBLE(1.0 / d_zero, p0, 2); -#endif -} - -void testNotEqualDoubleEachEqualLengthZero(void) -{ -#ifdef UNITY_EXCLUDE_DOUBLE - TEST_IGNORE(); -#else - double p0[1] = {0.0}; - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EACH_EQUAL_DOUBLE(0.0, p0, 0); - VERIFY_FAILS_END -#endif -} - -void testDoublePrinting(void) -{ -#if defined(UNITY_EXCLUDE_FLOAT_PRINT) || defined(UNITY_EXCLUDE_DOUBLE) || !defined(USING_OUTPUT_SPY) - TEST_IGNORE(); -#else - TEST_ASSERT_EQUAL_PRINT_FLOATING("0.100469", 0.10046949999999999); - TEST_ASSERT_EQUAL_PRINT_FLOATING("4.29497e+09", 4294967295.999999); - TEST_ASSERT_EQUAL_PRINT_FLOATING("4.29497e+09", 4294967295.9999995); - TEST_ASSERT_EQUAL_PRINT_FLOATING("4.29497e+09", 4294967296.0); - TEST_ASSERT_EQUAL_PRINT_FLOATING("1e+10", 9999999995.0); - TEST_ASSERT_EQUAL_PRINT_FLOATING("9.0072e+15", 9007199254740990.0); - TEST_ASSERT_EQUAL_PRINT_FLOATING("7e+100", 7.0e+100); - TEST_ASSERT_EQUAL_PRINT_FLOATING("3e+200", 3.0e+200); - TEST_ASSERT_EQUAL_PRINT_FLOATING("9.23457e+300", 9.23456789e+300); - - TEST_ASSERT_EQUAL_PRINT_FLOATING("-0.100469", -0.10046949999999999); - TEST_ASSERT_EQUAL_PRINT_FLOATING("-4.29497e+09", -4294967295.999999); - TEST_ASSERT_EQUAL_PRINT_FLOATING("-4.29497e+09", -4294967295.9999995); - TEST_ASSERT_EQUAL_PRINT_FLOATING("-7e+100", -7.0e+100); -#endif -} - -void testDoublePrintingInfinityAndNaN(void) -{ -#if defined(UNITY_EXCLUDE_FLOAT_PRINT) || defined(UNITY_EXCLUDE_DOUBLE) || !defined(USING_OUTPUT_SPY) - TEST_IGNORE(); -#else - TEST_ASSERT_EQUAL_PRINT_FLOATING("inf", 1.0 / d_zero); - TEST_ASSERT_EQUAL_PRINT_FLOATING("-inf", -1.0 / d_zero); - - TEST_ASSERT_EQUAL_PRINT_FLOATING("nan", 0.0 / d_zero); -#endif -} - -// ===================== THESE TEST WILL RUN IF YOUR CONFIG INCLUDES DETAIL SUPPORT ================== - -void testThatDetailsCanBeHandleOneDetail(void) -{ -#ifdef UNITY_EXCLUDE_DETAILS - TEST_IGNORE(); -#else - UNITY_SET_DETAIL("Detail1"); - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_INT_MESSAGE(5, 6, "Should Fail And Say Detail1"); - VERIFY_FAILS_END -#endif -} - -void testThatDetailsCanHandleTestFail(void) -{ -#ifdef UNITY_EXCLUDE_DETAILS - TEST_IGNORE(); -#else - UNITY_SET_DETAILS("Detail1","Detail2"); - - EXPECT_ABORT_BEGIN - TEST_FAIL_MESSAGE("Should Fail And Say Detail1 and Detail2"); - VERIFY_FAILS_END -#endif -} - -void testThatDetailsCanBeHandleTwoDetails(void) -{ -#ifdef UNITY_EXCLUDE_DETAILS - TEST_IGNORE(); -#else - UNITY_SET_DETAILS("Detail1","Detail2"); - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_HEX8_MESSAGE(7, 8, "Should Fail And Say Detail1 and Detail2"); - VERIFY_FAILS_END -#endif -} - -void testThatDetailsCanBeHandleSingleDetailClearingTwoDetails(void) -{ -#ifdef UNITY_EXCLUDE_DETAILS - TEST_IGNORE(); -#else - UNITY_SET_DETAILS("Detail1","Detail2"); - UNITY_SET_DETAIL("DetailNew"); - - EXPECT_ABORT_BEGIN - TEST_ASSERT_EQUAL_STRING_MESSAGE("MEH", "GUH", "Should Fail And Say DetailNew"); - VERIFY_FAILS_END -#endif -} diff --git a/tests/unity_setup.c b/tests/unity_setup.c old mode 100644 new mode 100755 diff --git a/valgrind.supp b/valgrind.supp old mode 100644 new mode 100755 -- GitLab