ceedling 0.28.2 → 0.28.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/assets/ceedling +3 -0
- data/assets/ceedling.cmd +1 -0
- data/assets/default_gitignore +5 -0
- data/assets/project_with_guts.yml +1 -0
- data/assets/project_with_guts_gcov.yml +3 -0
- data/assets/test_example_file_verbose.c +12 -0
- data/bin/ceedling +30 -6
- data/docs/CeedlingPacket.md +135 -23
- data/docs/CeedlingPacket.odt +0 -0
- data/examples/blinky/rakefile.rb +2 -1
- data/lib/ceedling/configurator.rb +7 -5
- data/lib/ceedling/configurator_builder.rb +10 -7
- data/lib/ceedling/configurator_plugins.rb +29 -24
- data/lib/ceedling/configurator_setup.rb +0 -1
- data/lib/ceedling/defaults.rb +7 -2
- data/lib/ceedling/dependinator.rb +10 -2
- data/lib/ceedling/file_finder.rb +57 -49
- data/lib/ceedling/file_path_utils.rb +12 -4
- data/lib/ceedling/file_wrapper.rb +4 -0
- data/lib/ceedling/generator.rb +4 -3
- data/lib/ceedling/generator_test_results.rb +15 -13
- data/lib/ceedling/plugin_manager.rb +18 -18
- data/lib/ceedling/plugin_reportinator.rb +3 -2
- data/lib/ceedling/plugin_reportinator_helper.rb +2 -3
- data/lib/ceedling/preprocessinator_extractor.rb +2 -2
- data/lib/ceedling/preprocessinator_includes_handler.rb +5 -0
- data/lib/ceedling/rakefile.rb +1 -0
- data/lib/ceedling/release_invoker_helper.rb +5 -2
- data/lib/ceedling/rules_release.rake +2 -1
- data/lib/ceedling/rules_tests.rake +18 -9
- data/lib/ceedling/rules_tests_deep_dependencies.rake +2 -2
- data/lib/ceedling/task_invoker.rb +15 -3
- data/lib/ceedling/tasks_vendor.rake +3 -3
- data/lib/ceedling/test_invoker.rb +39 -12
- data/lib/ceedling/test_invoker_helper.rb +5 -1
- data/lib/ceedling/tool_executor.rb +8 -4
- data/lib/ceedling/version.rb +1 -1
- data/out.fail +21 -0
- data/plugins/beep/README.md +22 -0
- data/plugins/beep/lib/beep.rb +40 -0
- data/plugins/bullseye/bullseye.rake +43 -36
- data/plugins/bullseye/config/defaults.yml +4 -0
- data/plugins/bullseye/lib/bullseye.rb +27 -5
- data/plugins/command_hooks/lib/command_hooks.rb +3 -0
- data/plugins/gcov/README.md +34 -1
- data/plugins/gcov/config/defaults.yml +3 -3
- data/plugins/gcov/gcov.rake +7 -5
- data/plugins/gcov/lib/gcov.rb +3 -1
- data/plugins/gcov/lib/gcov_constants.rb +2 -0
- data/plugins/junit_tests_report/lib/junit_tests_report.rb +12 -9
- data/plugins/module_generator/lib/module_generator.rb +14 -1
- data/plugins/module_generator/module_generator.rake +21 -4
- data/plugins/raw_output_report/lib/raw_output_report.rb +41 -0
- data/spec/gcov/gcov_deployment_spec.rb +1 -1
- data/spec/gcov/gcov_test_cases_spec.rb +2 -2
- data/spec/generator_test_results_spec.rb +5 -0
- data/spec/preprocessinator_includes_handler_spec.rb +1 -0
- data/spec/spec_system_helper.rb +178 -4
- data/spec/support/test_example.fail +1 -0
- data/spec/support/test_example.pass +1 -0
- data/spec/support/test_example_empty.pass +1 -0
- data/spec/support/test_example_ignore.pass +1 -0
- data/spec/support/test_example_mangled.pass +1 -0
- data/spec/support/test_example_with_time.pass +22 -0
- data/spec/system/deployment_spec.rb +33 -0
- data/vendor/cmock/README.md +4 -3
- data/vendor/cmock/docs/CMock_Summary.md +1 -1
- data/vendor/cmock/lib/cmock_config.rb +4 -0
- data/vendor/cmock/lib/cmock_generator.rb +5 -2
- data/vendor/cmock/lib/cmock_generator_plugin_array.rb +4 -4
- data/vendor/cmock/lib/cmock_generator_plugin_callback.rb +9 -11
- data/vendor/cmock/lib/cmock_generator_plugin_cexception.rb +0 -1
- data/vendor/cmock/lib/cmock_generator_plugin_ignore.rb +2 -3
- data/vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb +2 -4
- data/vendor/cmock/lib/cmock_generator_plugin_return_thru_ptr.rb +0 -2
- data/vendor/cmock/lib/cmock_generator_utils.rb +16 -3
- data/vendor/cmock/lib/cmock_header_parser.rb +59 -34
- data/vendor/cmock/release/build.info +1 -1
- data/vendor/cmock/release/version.info +1 -1
- data/vendor/cmock/scripts/create_makefile.rb +17 -2
- data/vendor/cmock/src/cmock.c +13 -7
- data/vendor/cmock/test/test_helper.rb +11 -10
- data/vendor/cmock/test/unit/cmock_config_test.rb +4 -2
- data/vendor/cmock/test/unit/cmock_generator_main_test.rb +10 -4
- data/vendor/cmock/test/unit/cmock_generator_plugin_array_test.rb +20 -12
- data/vendor/cmock/test/unit/cmock_generator_plugin_expect_a_test.rb +2 -2
- data/vendor/cmock/test/unit/cmock_generator_plugin_expect_b_test.rb +2 -2
- data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_arg_test.rb +3 -3
- data/vendor/cmock/test/unit/cmock_generator_plugin_return_thru_ptr_test.rb +8 -6
- data/vendor/cmock/test/unit/cmock_generator_utils_test.rb +27 -10
- data/vendor/cmock/test/unit/cmock_header_parser_test.rb +108 -20
- data/vendor/cmock/vendor/c_exception/Gemfile +4 -0
- data/vendor/cmock/vendor/c_exception/Gemfile.lock +12 -0
- data/vendor/cmock/vendor/c_exception/LICENSE.txt +30 -0
- data/vendor/cmock/vendor/c_exception/README.md +162 -0
- data/vendor/cmock/vendor/c_exception/Rakefile +42 -0
- data/vendor/cmock/vendor/c_exception/docs/CException.md +292 -0
- data/vendor/cmock/vendor/c_exception/docs/ThrowTheSwitchCodingStandard.md +207 -0
- data/vendor/cmock/vendor/c_exception/lib/CException.c +46 -0
- data/vendor/cmock/vendor/c_exception/lib/CException.h +110 -0
- data/vendor/cmock/vendor/c_exception/makefile +24 -0
- data/vendor/cmock/vendor/c_exception/release/build.info +2 -0
- data/vendor/cmock/vendor/c_exception/release/version.info +2 -0
- data/vendor/cmock/vendor/c_exception/test/CExceptionConfig.h +46 -0
- data/vendor/cmock/vendor/c_exception/test/TestException.c +391 -0
- data/vendor/cmock/vendor/c_exception/test/TestException_Runner.c +67 -0
- data/vendor/cmock/vendor/unity/README.md +231 -0
- data/vendor/cmock/vendor/unity/auto/colour_prompt.rb +118 -0
- data/vendor/cmock/vendor/unity/auto/colour_reporter.rb +39 -0
- data/vendor/cmock/vendor/unity/auto/generate_config.yml +36 -0
- data/vendor/cmock/vendor/unity/auto/generate_module.rb +308 -0
- data/vendor/cmock/vendor/unity/auto/generate_test_runner.rb +457 -0
- data/vendor/cmock/vendor/unity/auto/parse_output.rb +323 -0
- data/vendor/cmock/vendor/unity/auto/stylize_as_junit.rb +252 -0
- data/vendor/cmock/vendor/unity/auto/test_file_filter.rb +25 -0
- data/vendor/cmock/vendor/unity/auto/type_sanitizer.rb +6 -0
- data/vendor/cmock/vendor/unity/auto/unity_test_summary.py +139 -0
- data/vendor/cmock/vendor/unity/auto/unity_test_summary.rb +136 -0
- data/vendor/cmock/vendor/unity/auto/unity_to_junit.py +146 -0
- data/vendor/cmock/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +206 -0
- data/vendor/cmock/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
- data/vendor/cmock/vendor/unity/docs/UnityAssertionsReference.md +779 -0
- data/vendor/cmock/vendor/unity/docs/UnityConfigurationGuide.md +433 -0
- data/vendor/cmock/vendor/unity/docs/UnityGettingStartedGuide.md +192 -0
- data/vendor/cmock/vendor/unity/docs/UnityHelperScriptsGuide.md +260 -0
- data/vendor/cmock/vendor/unity/docs/license.txt +21 -0
- data/vendor/cmock/vendor/unity/examples/example_1/makefile +71 -0
- data/vendor/cmock/vendor/unity/examples/example_1/readme.txt +5 -0
- data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode.c +24 -0
- data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode.h +3 -0
- data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode2.c +11 -0
- data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode2.h +2 -0
- data/vendor/cmock/vendor/unity/examples/example_1/test/TestProductionCode.c +62 -0
- data/vendor/cmock/vendor/unity/examples/example_1/test/TestProductionCode2.c +31 -0
- data/vendor/cmock/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +53 -0
- data/vendor/cmock/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +57 -0
- data/vendor/cmock/vendor/unity/examples/example_2/makefile +70 -0
- data/vendor/cmock/vendor/unity/examples/example_2/readme.txt +5 -0
- data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode.c +24 -0
- data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode.h +3 -0
- data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode2.c +11 -0
- data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode2.h +2 -0
- data/vendor/cmock/vendor/unity/examples/example_2/test/TestProductionCode.c +64 -0
- data/vendor/cmock/vendor/unity/examples/example_2/test/TestProductionCode2.c +33 -0
- data/vendor/cmock/vendor/unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c +9 -0
- data/vendor/cmock/vendor/unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c +11 -0
- data/vendor/cmock/vendor/unity/examples/example_2/test/test_runners/all_tests.c +12 -0
- data/vendor/cmock/vendor/unity/examples/example_3/helper/UnityHelper.c +10 -0
- data/vendor/cmock/vendor/unity/examples/example_3/helper/UnityHelper.h +12 -0
- data/vendor/cmock/vendor/unity/examples/example_3/rakefile.rb +43 -0
- data/vendor/cmock/vendor/unity/examples/example_3/rakefile_helper.rb +249 -0
- data/vendor/cmock/vendor/unity/examples/example_3/readme.txt +13 -0
- data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode.c +24 -0
- data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode.h +3 -0
- data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode2.c +11 -0
- data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode2.h +2 -0
- data/vendor/cmock/vendor/unity/examples/example_3/target_gcc_32.yml +46 -0
- data/vendor/cmock/vendor/unity/examples/example_3/test/TestProductionCode.c +62 -0
- data/vendor/cmock/vendor/unity/examples/example_3/test/TestProductionCode2.c +31 -0
- data/vendor/cmock/vendor/unity/examples/unity_config.h +247 -0
- data/vendor/cmock/vendor/unity/extras/eclipse/error_parsers.txt +26 -0
- data/vendor/cmock/vendor/unity/extras/fixture/rakefile.rb +48 -0
- data/vendor/cmock/vendor/unity/extras/fixture/rakefile_helper.rb +178 -0
- data/vendor/cmock/vendor/unity/extras/fixture/readme.txt +9 -0
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c +436 -0
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h +83 -0
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h +51 -0
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +47 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/Makefile +75 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/main/AllTests.c +22 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/template_fixture_tests.c +39 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c +543 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +57 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.c +57 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.h +17 -0
- data/vendor/cmock/vendor/unity/release/build.info +2 -0
- data/vendor/cmock/vendor/unity/release/version.info +2 -0
- data/vendor/cmock/vendor/unity/src/unity.c +1572 -0
- data/vendor/cmock/vendor/unity/src/unity.h +503 -0
- data/vendor/cmock/vendor/unity/src/unity_internals.h +924 -0
- data/vendor/cmock/vendor/unity/test/Makefile +68 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_cmd.c +61 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_def.c +57 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_head1.c +55 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_head1.h +15 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_cmd.c +80 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_def.c +76 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_head1.c +75 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_head1.h +13 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new1.c +89 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new2.c +89 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_param.c +77 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run1.c +89 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run2.c +89 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_yaml.c +90 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_new1.c +67 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_new2.c +70 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_param.c +58 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_run1.c +67 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_run2.c +70 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_yaml.c +71 -0
- data/vendor/cmock/vendor/unity/test/rakefile +125 -0
- data/vendor/cmock/vendor/unity/test/rakefile_helper.rb +260 -0
- data/vendor/cmock/vendor/unity/test/spec/generate_module_existing_file_spec.rb +158 -0
- data/vendor/cmock/vendor/unity/test/targets/clang_file.yml +78 -0
- data/vendor/cmock/vendor/unity/test/targets/clang_strict.yml +78 -0
- data/vendor/cmock/vendor/unity/test/targets/gcc_32.yml +49 -0
- data/vendor/cmock/vendor/unity/test/targets/gcc_64.yml +50 -0
- data/vendor/cmock/vendor/unity/test/targets/gcc_auto_limits.yml +47 -0
- data/vendor/cmock/vendor/unity/test/targets/gcc_auto_stdint.yml +59 -0
- data/vendor/cmock/vendor/unity/test/targets/gcc_manual_math.yml +47 -0
- data/vendor/cmock/vendor/unity/test/targets/hitech_picc18.yml +101 -0
- data/vendor/cmock/vendor/unity/test/targets/iar_arm_v4.yml +90 -0
- data/vendor/cmock/vendor/unity/test/targets/iar_arm_v5.yml +80 -0
- data/vendor/cmock/vendor/unity/test/targets/iar_arm_v5_3.yml +80 -0
- data/vendor/cmock/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +94 -0
- data/vendor/cmock/vendor/unity/test/targets/iar_cortexm3_v5.yml +84 -0
- data/vendor/cmock/vendor/unity/test/targets/iar_msp430.yml +95 -0
- data/vendor/cmock/vendor/unity/test/targets/iar_sh2a_v6.yml +86 -0
- data/vendor/cmock/vendor/unity/test/testdata/CException.h +11 -0
- data/vendor/cmock/vendor/unity/test/testdata/Defs.h +8 -0
- data/vendor/cmock/vendor/unity/test/testdata/cmock.h +14 -0
- data/vendor/cmock/vendor/unity/test/testdata/mockMock.h +13 -0
- data/vendor/cmock/vendor/unity/test/testdata/testRunnerGenerator.c +186 -0
- data/vendor/cmock/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +70 -0
- data/vendor/cmock/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +195 -0
- data/vendor/cmock/vendor/unity/test/tests/test_generate_test_runner.rb +1252 -0
- data/vendor/cmock/vendor/unity/test/tests/testparameterized.c +113 -0
- data/vendor/cmock/vendor/unity/test/tests/testunity.c +5371 -0
- data/vendor/unity/auto/generate_test_runner.rb +30 -10
- data/vendor/unity/auto/parse_output.rb +212 -109
- data/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +9 -10
- data/vendor/unity/docs/UnityAssertionsReference.md +11 -2
- data/vendor/unity/docs/UnityConfigurationGuide.md +90 -55
- data/vendor/unity/docs/UnityGettingStartedGuide.md +6 -5
- data/vendor/unity/docs/UnityHelperScriptsGuide.md +23 -5
- data/vendor/unity/examples/unity_config.h +8 -0
- data/vendor/unity/extras/fixture/src/unity_fixture.c +4 -0
- data/vendor/unity/extras/fixture/src/unity_fixture.h +1 -1
- data/vendor/unity/extras/fixture/src/unity_fixture_internals.h +2 -2
- data/vendor/unity/release/build.info +1 -1
- data/vendor/unity/release/version.info +1 -1
- data/vendor/unity/src/unity.c +64 -57
- data/vendor/unity/src/unity.h +111 -7
- data/vendor/unity/src/unity_internals.h +173 -73
- data/vendor/unity/test/Makefile +5 -1
- data/vendor/unity/test/testdata/testRunnerGenerator.c +4 -1
- data/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +4 -1
- data/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +4 -1
- data/vendor/unity/test/tests/testparameterized.c +5 -2
- data/vendor/unity/test/tests/testunity.c +34 -0
- metadata +150 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# ThrowTheSwitch.org Coding Standard
|
|
1
|
+
# ThrowTheSwitch.org Coding Standard
|
|
2
2
|
|
|
3
3
|
Hi. Welcome to the coding standard for ThrowTheSwitch.org. For the most part,
|
|
4
4
|
we try to follow these standards to unify our contributors' code into a cohesive
|
|
@@ -11,7 +11,7 @@ and we'll try to be polite when we notice yours.
|
|
|
11
11
|
|
|
12
12
|
## Why Have A Coding Standard?
|
|
13
13
|
|
|
14
|
-
Being consistent makes code easier to understand. We've
|
|
14
|
+
Being consistent makes code easier to understand. We've tried to keep
|
|
15
15
|
our standard simple because we also believe that we can only expect someone to
|
|
16
16
|
follow something that is understandable. Please do your best.
|
|
17
17
|
|
|
@@ -51,11 +51,11 @@ much as they can, but give the user the power to override it when it's wrong.
|
|
|
51
51
|
|
|
52
52
|
Let's talk about naming things. Programming is all about naming things. We name
|
|
53
53
|
files, functions, variables, and so much more. While we're not always going to
|
|
54
|
-
find the best name for something, we actually put
|
|
54
|
+
find the best name for something, we actually put a bit of effort into
|
|
55
55
|
finding *What Something WANTS to be Called*™.
|
|
56
56
|
|
|
57
|
-
When naming things, we
|
|
58
|
-
most important to us (but we do all four
|
|
57
|
+
When naming things, we follow this hierarchy, the first being the
|
|
58
|
+
most important to us (but we do all four when possible):
|
|
59
59
|
1. Readable
|
|
60
60
|
2. Descriptive
|
|
61
61
|
3. Consistent
|
|
@@ -74,7 +74,7 @@ abbreviations (sticking to ones we feel are common).
|
|
|
74
74
|
We like descriptive names for things, especially functions and variables.
|
|
75
75
|
Finding the right name for something is an important endeavor. You might notice
|
|
76
76
|
from poking around our code that this often results in names that are a little
|
|
77
|
-
longer than the average. Guilty. We're okay with a
|
|
77
|
+
longer than the average. Guilty. We're okay with a bit more typing if it
|
|
78
78
|
means our code is easier to understand.
|
|
79
79
|
|
|
80
80
|
There are two exceptions to this rule that we also stick to as religiously as
|
|
@@ -82,8 +82,7 @@ possible:
|
|
|
82
82
|
|
|
83
83
|
First, while we realize hungarian notation (and similar systems for encoding
|
|
84
84
|
type information into variable names) is providing a more descriptive name, we
|
|
85
|
-
feel that (for the average developer) it takes away from readability and
|
|
86
|
-
therefore is to be avoided.
|
|
85
|
+
feel that (for the average developer) it takes away from readability and is to be avoided.
|
|
87
86
|
|
|
88
87
|
Second, loop counters and other local throw-away variables often have a purpose
|
|
89
88
|
which is obvious. There's no need, therefore, to get carried away with complex
|
|
@@ -128,7 +127,7 @@ the same. It will only hurt a little. We promise.
|
|
|
128
127
|
#### Whitespace
|
|
129
128
|
|
|
130
129
|
Our C-style is to use spaces and to use 4 of them per indent level. It's a nice
|
|
131
|
-
power-of-2 number that looks decent on a wide
|
|
130
|
+
power-of-2 number that looks decent on a wide-screen. We have no more reason
|
|
132
131
|
than that. We break that rule when we have lines that wrap (macros or function
|
|
133
132
|
arguments or whatnot). When that happens, we like to indent further to line
|
|
134
133
|
things up in nice tidy columns.
|
|
@@ -200,7 +199,7 @@ that happens, we like to indent further to line things up in nice tidy columns.
|
|
|
200
199
|
|
|
201
200
|
## Documentation
|
|
202
201
|
|
|
203
|
-
Egad. Really? We use
|
|
202
|
+
Egad. Really? We use mark down and we like pdf files because they can be made to
|
|
204
203
|
look nice while still being portable. Good enough?
|
|
205
204
|
|
|
206
205
|
|
|
@@ -80,7 +80,7 @@ marked as an optional parameter because some assertions only need a single
|
|
|
80
80
|
"actual" parameter (e.g. null check).
|
|
81
81
|
"Size/count" refers to string lengths, number of array elements, etc.
|
|
82
82
|
|
|
83
|
-
Many of Unity's assertions are
|
|
83
|
+
Many of Unity's assertions are clear duplications in that the same data type
|
|
84
84
|
is handled by several assertions. The differences among these are in how failure
|
|
85
85
|
messages are presented. For instance, a `_HEX` variant of an assertion prints
|
|
86
86
|
the expected and actual values of that assertion formatted as hexadecimal.
|
|
@@ -104,6 +104,15 @@ becomes messageified like thus...
|
|
|
104
104
|
|
|
105
105
|
TEST_ASSERT_X_MESSAGE( {modifiers}, {expected}, actual, {size/count}, message )
|
|
106
106
|
|
|
107
|
+
Notes:
|
|
108
|
+
- The `_MESSAGE` variants intentionally do not support `printf` style formatting
|
|
109
|
+
since many embedded projects don't support or avoid `printf` for various reasons.
|
|
110
|
+
It is possible to use `sprintf` before the assertion to assemble a complex fail
|
|
111
|
+
message, if necessary.
|
|
112
|
+
- If you want to output a counter value within an assertion fail message (e.g. from
|
|
113
|
+
a loop) , building up an array of results and then using one of the `_ARRAY`
|
|
114
|
+
assertions (see below) might be a handy alternative to `sprintf`.
|
|
115
|
+
|
|
107
116
|
|
|
108
117
|
#### TEST_ASSERT_X_ARRAY Variants
|
|
109
118
|
|
|
@@ -694,7 +703,7 @@ point value.
|
|
|
694
703
|
|
|
695
704
|
So what happens when it's zero? Zero - even more than other floating point
|
|
696
705
|
values - can be represented many different ways. It doesn't matter if you have
|
|
697
|
-
0 x
|
|
706
|
+
0 x 20 or 0 x 263.It's still zero, right? Luckily, if you
|
|
698
707
|
subtract these values from each other, they will always produce a difference of
|
|
699
708
|
zero, which will still fall between 0 plus or minus a delta of 0. So it still
|
|
700
709
|
works!
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Unity Configuration Guide
|
|
1
|
+
# Unity Configuration Guide
|
|
2
2
|
|
|
3
3
|
## C Standards, Compilers and Microcontrollers
|
|
4
4
|
|
|
@@ -19,7 +19,7 @@ definitions. A couple are macros with arguments. They live inside the
|
|
|
19
19
|
unity_internals.h header file. We don't necessarily recommend opening that file
|
|
20
20
|
unless you really need to. That file is proof that a cross-platform library is
|
|
21
21
|
challenging to build. From a more positive perspective, it is also proof that a
|
|
22
|
-
great deal of complexity can be centralized primarily to one place
|
|
22
|
+
great deal of complexity can be centralized primarily to one place to
|
|
23
23
|
provide a more consistent and simple experience elsewhere.
|
|
24
24
|
|
|
25
25
|
|
|
@@ -58,7 +58,7 @@ sizes. It starts off by trying to do it automatically.
|
|
|
58
58
|
##### `UNITY_EXCLUDE_STDINT_H`
|
|
59
59
|
|
|
60
60
|
The first thing that Unity does to guess your types is check `stdint.h`.
|
|
61
|
-
This file includes defines like `UINT_MAX` that Unity can
|
|
61
|
+
This file includes defines like `UINT_MAX` that Unity can use to
|
|
62
62
|
learn a lot about your system. It's possible you don't want it to do this
|
|
63
63
|
(um. why not?) or (more likely) it's possible that your system doesn't
|
|
64
64
|
support `stdint.h`. If that's the case, you're going to want to define this.
|
|
@@ -79,18 +79,7 @@ _Example:_
|
|
|
79
79
|
#define UNITY_EXCLUDE_LIMITS_H
|
|
80
80
|
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
The third and final attempt to guess your types is to use the `sizeof()`
|
|
85
|
-
operator. Even if the first two options don't work, this one covers most cases.
|
|
86
|
-
There _is_ a rare compiler or two out there that doesn't support sizeof() in the
|
|
87
|
-
preprocessing stage, though. For these, you have the ability to disable this
|
|
88
|
-
feature as well.
|
|
89
|
-
|
|
90
|
-
_Example:_
|
|
91
|
-
#define UNITY_EXCLUDE_SIZEOF
|
|
92
|
-
|
|
93
|
-
If you've disabled all of the automatic options above, you're going to have to
|
|
82
|
+
If you've disabled both of the automatic options above, you're going to have to
|
|
94
83
|
do the configuration yourself. Don't worry. Even this isn't too bad... there are
|
|
95
84
|
just a handful of defines that you are going to specify if you don't like the
|
|
96
85
|
defaults.
|
|
@@ -127,7 +116,7 @@ _Example:_
|
|
|
127
116
|
#define UNITY_POINTER_WIDTH 64
|
|
128
117
|
|
|
129
118
|
|
|
130
|
-
##### `
|
|
119
|
+
##### `UNITY_SUPPORT_64`
|
|
131
120
|
|
|
132
121
|
Unity will automatically include 64-bit support if it auto-detects it, or if
|
|
133
122
|
your `int`, `long`, or pointer widths are greater than 32-bits. Define this to
|
|
@@ -136,7 +125,7 @@ can be a significant size and speed impact to enabling 64-bit support on small
|
|
|
136
125
|
targets, so don't define it if you don't need it.
|
|
137
126
|
|
|
138
127
|
_Example:_
|
|
139
|
-
#define
|
|
128
|
+
#define UNITY_SUPPORT_64
|
|
140
129
|
|
|
141
130
|
|
|
142
131
|
### Floating Point Types
|
|
@@ -170,24 +159,20 @@ _Example:_
|
|
|
170
159
|
#define UNITY_INCLUDE_DOUBLE
|
|
171
160
|
|
|
172
161
|
|
|
173
|
-
##### `
|
|
174
|
-
|
|
175
|
-
##### `UNITY_DOUBLE_VERBOSE`
|
|
162
|
+
##### `UNITY_EXCLUDE_FLOAT_PRINT`
|
|
176
163
|
|
|
177
164
|
Unity aims for as small of a footprint as possible and avoids most standard
|
|
178
|
-
library calls (some embedded platforms don
|
|
165
|
+
library calls (some embedded platforms don’t have a standard library!). Because
|
|
179
166
|
of this, its routines for printing integer values are minimalist and hand-coded.
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
failure
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
messages (e.g. `"Expected 4.56 Was 4.68"`). Note that this feature requires the
|
|
187
|
-
use of `sprintf` so might not be desirable in all cases.
|
|
167
|
+
Therefore, the display of floating point values during a failure are optional.
|
|
168
|
+
By default, Unity will print the actual results of floating point assertion
|
|
169
|
+
failure (e.g. ”Expected 4.56 Was 4.68”). To not include this extra support, you
|
|
170
|
+
can use this define to instead respond to a failed assertion with a message like
|
|
171
|
+
”Values Not Within Delta”. If you would like verbose failure messages for floating
|
|
172
|
+
point assertions, use these options to give more explicit failure messages.
|
|
188
173
|
|
|
189
174
|
_Example:_
|
|
190
|
-
#define
|
|
175
|
+
#define UNITY_EXCLUDE_FLOAT_PRINT
|
|
191
176
|
|
|
192
177
|
|
|
193
178
|
##### `UNITY_FLOAT_TYPE`
|
|
@@ -237,7 +222,7 @@ In addition to the options listed above, there are a number of other options
|
|
|
237
222
|
which will come in handy to customize Unity's behavior for your specific
|
|
238
223
|
toolchain. It is possible that you may not need to touch any of these... but
|
|
239
224
|
certain platforms, particularly those running in simulators, may need to jump
|
|
240
|
-
through extra hoops to
|
|
225
|
+
through extra hoops to run properly. These macros will help in those
|
|
241
226
|
situations.
|
|
242
227
|
|
|
243
228
|
|
|
@@ -263,7 +248,8 @@ _Example:_
|
|
|
263
248
|
Say you are forced to run your test suite on an embedded processor with no
|
|
264
249
|
`stdout` option. You decide to route your test result output to a custom serial
|
|
265
250
|
`RS232_putc()` function you wrote like thus:
|
|
266
|
-
|
|
251
|
+
#include "RS232_header.h"
|
|
252
|
+
...
|
|
267
253
|
#define UNITY_OUTPUT_CHAR(a) RS232_putc(a)
|
|
268
254
|
#define UNITY_OUTPUT_START() RS232_config(115200,1,8,0)
|
|
269
255
|
#define UNITY_OUTPUT_FLUSH() RS232_flush()
|
|
@@ -271,31 +257,35 @@ Say you are forced to run your test suite on an embedded processor with no
|
|
|
271
257
|
|
|
272
258
|
_Note:_
|
|
273
259
|
`UNITY_OUTPUT_FLUSH()` can be set to the standard out flush function simply by
|
|
274
|
-
specifying `UNITY_USE_FLUSH_STDOUT`. No other defines are required.
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
260
|
+
specifying `UNITY_USE_FLUSH_STDOUT`. No other defines are required.
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
##### `UNITY_WEAK_ATTRIBUTE`
|
|
264
|
+
|
|
265
|
+
##### `UNITY_WEAK_PRAGMA`
|
|
266
|
+
|
|
267
|
+
##### `UNITY_NO_WEAK`
|
|
268
|
+
|
|
269
|
+
For some targets, Unity can make the otherwise required setUp() and tearDown()
|
|
270
|
+
functions optional. This is a nice convenience for test writers since setUp and
|
|
271
|
+
tearDown don’t often actually do anything. If you’re using gcc or clang, this
|
|
272
|
+
option is automatically defined for you. Other compilers can also support this
|
|
273
|
+
behavior, if they support a C feature called weak functions. A weak function is
|
|
274
|
+
a function that is compiled into your executable unless a non-weak version of
|
|
275
|
+
the same function is defined elsewhere. If a non-weak version is found, the weak
|
|
276
|
+
version is ignored as if it never existed. If your compiler supports this feature,
|
|
277
|
+
you can let Unity know by defining UNITY_WEAK_ATTRIBUTE or UNITY_WEAK_PRAGMA as
|
|
278
|
+
the function attributes that would need to be applied to identify a function as
|
|
279
|
+
weak. If your compiler lacks support for weak functions, you will always need to
|
|
280
|
+
define setUp and tearDown functions (though they can be and often will be just
|
|
281
|
+
empty). You can also force Unity to NOT use weak functions by defining
|
|
282
|
+
UNITY_NO_WEAK. The most common options for this feature are:
|
|
295
283
|
|
|
296
284
|
_Example:_
|
|
297
|
-
#define
|
|
298
|
-
#define
|
|
285
|
+
#define UNITY_WEAK_ATTRIBUTE weak
|
|
286
|
+
#define UNITY_WEAK_ATTRIBUTE __attribute__((weak))
|
|
287
|
+
#define UNITY_WEAK_PRAGMA
|
|
288
|
+
#define UNITY_NO_WEAK
|
|
299
289
|
|
|
300
290
|
|
|
301
291
|
##### `UNITY_PTR_ATTRIBUTE`
|
|
@@ -309,6 +299,51 @@ _Example:_
|
|
|
309
299
|
#define UNITY_PTR_ATTRIBUTE near
|
|
310
300
|
|
|
311
301
|
|
|
302
|
+
##### `UNITY_PRINT_EOL`
|
|
303
|
+
|
|
304
|
+
By default, Unity outputs \n at the end of each line of output. This is easy
|
|
305
|
+
to parse by the scripts, by Ceedling, etc, but it might not be ideal for YOUR
|
|
306
|
+
system. Feel free to override this and to make it whatever you wish.
|
|
307
|
+
|
|
308
|
+
_Example:_
|
|
309
|
+
#define UNITY_PRINT_EOL { UNITY_OUTPUT_CHAR('\r'); UNITY_OUTPUT_CHAR('\n') }
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
|
|
313
|
+
##### `UNITY_EXCLUDE_DETAILS`
|
|
314
|
+
|
|
315
|
+
This is an option for if you absolutely must squeeze every byte of memory out of
|
|
316
|
+
your system. Unity stores a set of internal scratchpads which are used to pass
|
|
317
|
+
extra detail information around. It's used by systems like CMock in order to
|
|
318
|
+
report which function or argument flagged an error. If you're not using CMock and
|
|
319
|
+
you're not using these details for other things, then you can exclude them.
|
|
320
|
+
|
|
321
|
+
_Example:_
|
|
322
|
+
#define UNITY_EXCLUDE_DETAILS
|
|
323
|
+
|
|
324
|
+
|
|
325
|
+
|
|
326
|
+
##### `UNITY_EXCLUDE_SETJMP`
|
|
327
|
+
|
|
328
|
+
If your embedded system doesn't support the standard library setjmp, you can
|
|
329
|
+
exclude Unity's reliance on this by using this define. This dropped dependence
|
|
330
|
+
comes at a price, though. You will be unable to use custom helper functions for
|
|
331
|
+
your tests, and you will be unable to use tools like CMock. Very likely, if your
|
|
332
|
+
compiler doesn't support setjmp, you wouldn't have had the memory space for those
|
|
333
|
+
things anyway, though... so this option exists for those situations.
|
|
334
|
+
|
|
335
|
+
_Example:_
|
|
336
|
+
#define UNITY_EXCLUDE_SETJMP
|
|
337
|
+
|
|
338
|
+
##### `UNITY_OUTPUT_COLOR`
|
|
339
|
+
|
|
340
|
+
If you want to add color using ANSI escape codes you can use this define.
|
|
341
|
+
t
|
|
342
|
+
_Example:_
|
|
343
|
+
#define UNITY_OUTPUT_COLOR
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
|
|
312
347
|
## Getting Into The Guts
|
|
313
348
|
|
|
314
349
|
There will be cases where the options above aren't quite going to get everything
|
|
@@ -11,7 +11,7 @@ functional. The core Unity test framework is three files: a single C file and a
|
|
|
11
11
|
couple header files. These team up to provide functions and macros to make
|
|
12
12
|
testing easier.
|
|
13
13
|
|
|
14
|
-
Unity was designed to be cross
|
|
14
|
+
Unity was designed to be cross-platform. It works hard to stick with C standards
|
|
15
15
|
while still providing support for the many embedded C compilers that bend the
|
|
16
16
|
rules. Unity has been used with many compilers, including GCC, IAR, Clang,
|
|
17
17
|
Green Hills, Microchip, and MS Visual Studio. It's not much work to get it to
|
|
@@ -100,10 +100,11 @@ find setUp or tearDown when it links, you'll know you need to at least include
|
|
|
100
100
|
an empty function for these.
|
|
101
101
|
|
|
102
102
|
The majority of the file will be a series of test functions. Test functions
|
|
103
|
-
follow the convention of starting with the word "
|
|
103
|
+
follow the convention of starting with the word "test_" or "spec_". You don't HAVE
|
|
104
104
|
to name them this way, but it makes it clear what functions are tests for other
|
|
105
|
-
developers.
|
|
106
|
-
|
|
105
|
+
developers. Also, the automated scripts that come with Unity or Ceedling will default
|
|
106
|
+
to looking for test functions to be prefixed this way. Test functions take no arguments
|
|
107
|
+
and return nothing. All test accounting is handled internally in Unity.
|
|
107
108
|
|
|
108
109
|
Finally, at the bottom of your test file, you will write a `main()` function.
|
|
109
110
|
This function will call `UNITY_BEGIN()`, then `RUN_TEST` for each test, and
|
|
@@ -148,7 +149,7 @@ int main(void) {
|
|
|
148
149
|
}
|
|
149
150
|
```
|
|
150
151
|
|
|
151
|
-
It's possible that you will
|
|
152
|
+
It's possible that you will need more customization than this, eventually.
|
|
152
153
|
For that sort of thing, you're going to want to look at the configuration guide.
|
|
153
154
|
This should be enough to get you going, though.
|
|
154
155
|
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
## With a Little Help From Our Friends
|
|
4
4
|
|
|
5
5
|
Sometimes what it takes to be a really efficient C programmer is a little non-C.
|
|
6
|
-
The Unity project includes a couple Ruby scripts for making your life just a tad
|
|
6
|
+
The Unity project includes a couple of Ruby scripts for making your life just a tad
|
|
7
7
|
easier. They are completely optional. If you choose to use them, you'll need a
|
|
8
8
|
copy of Ruby, of course. Just install whatever the latest version is, and it is
|
|
9
9
|
likely to work. You can find Ruby at [ruby-lang.org](https://ruby-labg.org/).
|
|
@@ -105,7 +105,7 @@ UnityTestRunnerGenerator.new.run(testfile, runner_name, options)
|
|
|
105
105
|
|
|
106
106
|
If you have multiple files to generate in a build script (such as a Rakefile),
|
|
107
107
|
you might want to instantiate a generator object with your options and call it
|
|
108
|
-
to generate each runner
|
|
108
|
+
to generate each runner afterwards. Like thus:
|
|
109
109
|
|
|
110
110
|
```Ruby
|
|
111
111
|
gen = UnityTestRunnerGenerator.new(options)
|
|
@@ -124,7 +124,7 @@ demonstrates using a Ruby hash.
|
|
|
124
124
|
|
|
125
125
|
##### `:includes`
|
|
126
126
|
|
|
127
|
-
This option specifies an array of file names to be
|
|
127
|
+
This option specifies an array of file names to be `#include`'d at the top of
|
|
128
128
|
your runner C file. You might use it to reference custom types or anything else
|
|
129
129
|
universally needed in your generated runners.
|
|
130
130
|
|
|
@@ -133,11 +133,23 @@ universally needed in your generated runners.
|
|
|
133
133
|
|
|
134
134
|
Define this option with C code to be executed _before any_ test cases are run.
|
|
135
135
|
|
|
136
|
+
Alternatively, if your C compiler supports weak symbols, you can leave this
|
|
137
|
+
option unset and instead provide a `void suiteSetUp(void)` function in your test
|
|
138
|
+
suite. The linker will look for this symbol and fall back to a Unity-provided
|
|
139
|
+
stub if it is not found.
|
|
140
|
+
|
|
136
141
|
|
|
137
142
|
##### `:suite_teardown`
|
|
138
143
|
|
|
139
|
-
Define this option with C code to be executed
|
|
140
|
-
finished.
|
|
144
|
+
Define this option with C code to be executed _after all_ test cases have
|
|
145
|
+
finished. An integer variable `num_failures` is available for diagnostics.
|
|
146
|
+
The code should end with a `return` statement; the value returned will become
|
|
147
|
+
the exit code of `main`. You can normally just return `num_failures`.
|
|
148
|
+
|
|
149
|
+
Alternatively, if your C compiler supports weak symbols, you can leave this
|
|
150
|
+
option unset and instead provide a `int suiteTearDown(int num_failures)`
|
|
151
|
+
function in your test suite. The linker will look for this symbol and fall
|
|
152
|
+
back to a Unity-provided stub if it is not found.
|
|
141
153
|
|
|
142
154
|
|
|
143
155
|
##### `:enforce_strict_ordering`
|
|
@@ -147,6 +159,12 @@ CMock (see CMock documentation). This generates extra variables required for
|
|
|
147
159
|
everything to run smoothly. If you provide the same YAML to the generator as
|
|
148
160
|
used in CMock's configuration, you've already configured the generator properly.
|
|
149
161
|
|
|
162
|
+
##### `:mock_prefix` and `:mock_suffix`
|
|
163
|
+
|
|
164
|
+
Unity automatically generates calls to Init, Verify and Destroy for every file
|
|
165
|
+
included in the main test file that starts with the given mock prefix and ends
|
|
166
|
+
with the given mock suffix, file extension not included. By default, Unity
|
|
167
|
+
assumes a `Mock` prefix and no suffix.
|
|
150
168
|
|
|
151
169
|
##### `:plugins`
|
|
152
170
|
|
|
@@ -236,4 +236,12 @@
|
|
|
236
236
|
/* #define UNITY_PTR_ATTRIBUTE __attribute__((far)) */
|
|
237
237
|
/* #define UNITY_PTR_ATTRIBUTE near */
|
|
238
238
|
|
|
239
|
+
/* Print execution time of each test when executed in verbose mode
|
|
240
|
+
*
|
|
241
|
+
* Example:
|
|
242
|
+
*
|
|
243
|
+
* TEST - PASS (10 ms)
|
|
244
|
+
*/
|
|
245
|
+
/* #define UNITY_INCLUDE_EXEC_TIME */
|
|
246
|
+
|
|
239
247
|
#endif /* UNITY_CONFIG_H */
|
|
@@ -93,6 +93,8 @@ void UnityTestRunner(unityfunction* setup,
|
|
|
93
93
|
UnityMalloc_StartTest();
|
|
94
94
|
UnityPointer_Init();
|
|
95
95
|
|
|
96
|
+
UNITY_EXEC_TIME_START();
|
|
97
|
+
|
|
96
98
|
if (TEST_PROTECT())
|
|
97
99
|
{
|
|
98
100
|
setup();
|
|
@@ -418,6 +420,8 @@ void UnityConcludeFixtureTest(void)
|
|
|
418
420
|
if (UnityFixture.Verbose)
|
|
419
421
|
{
|
|
420
422
|
UnityPrint(" PASS");
|
|
423
|
+
UNITY_EXEC_TIME_STOP();
|
|
424
|
+
UNITY_PRINT_EXEC_TIME();
|
|
421
425
|
UNITY_PRINT_EOL();
|
|
422
426
|
}
|
|
423
427
|
}
|
|
@@ -78,6 +78,6 @@ int UnityMain(int argc, const char* argv[], void (*runAllTests)(void));
|
|
|
78
78
|
#endif
|
|
79
79
|
|
|
80
80
|
/* You must compile with malloc replacement, as defined in unity_fixture_malloc_overrides.h */
|
|
81
|
-
void UnityMalloc_MakeMallocFailAfterCount(int
|
|
81
|
+
void UnityMalloc_MakeMallocFailAfterCount(int countdown);
|
|
82
82
|
|
|
83
83
|
#endif /* UNITY_FIXTURE_H_ */
|