mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2025-05-20 17:07:32 +08:00
Using default macro for TEST_CASEs define.
Improving docs about manual definition.
This commit is contained in:
@ -438,26 +438,32 @@ This will rarely be necessary. Most often, Unity will automatically detect if th
|
||||
In the event that the compiler supports variadic macros, but is primarily C89 (ANSI), defining this option will allow you to use them.
|
||||
This option is also not necessary when using Ceedling or the test runner generator script.
|
||||
|
||||
#### `UNITY_INCLUDE_PARAM_TESTING_MACRO`
|
||||
#### `UNITY_SUPPORT_TEST_CASES`
|
||||
|
||||
Unity can automatically define all supported parameterized tests macros.
|
||||
To enable that feature, use the following example:
|
||||
That feature is disabled by default.
|
||||
To enable it, use the following example:
|
||||
|
||||
```C
|
||||
#define UNITY_INCLUDE_PARAM_TESTING_MACRO
|
||||
#define UNITY_SUPPORT_TEST_CASES
|
||||
```
|
||||
|
||||
You can manually provide required `TEST_CASE` or `TEST_RANGE` macro definitions
|
||||
before including `unity.h`, and they won't be redefined.
|
||||
If you provide one of the following macros, some of default definitions will not be
|
||||
defined:
|
||||
| User defines macro | Unity will __not__ define following macro |
|
||||
| User defines macro | Unity will _not_ define following macro |
|
||||
|---|---|
|
||||
| `UNITY_NOT_DEFINE_TEST_CASE` | `TEST_CASE` |
|
||||
| `UNITY_NOT_DEFINE_TEST_RANGE` | `TEST_RANGE` |
|
||||
| `UNITY_EXCLUDE_TEST_CASE` | `TEST_CASE` |
|
||||
| `UNITY_EXCLUDE_TEST_RANGE` | `TEST_RANGE` |
|
||||
| `TEST_CASE` | `TEST_CASE` |
|
||||
| `TEST_RANGE` | `TEST_RANGE` |
|
||||
|
||||
`UNITY_EXCLUDE_TEST_*` defines is not processed by test runner generator script.
|
||||
If you exclude one of them from definition, you should provide your own definition
|
||||
for them or avoid using undefined `TEST_*` macro as a test generator.
|
||||
Otherwise, compiler cannot build source code file with provided call.
|
||||
|
||||
_Note:_
|
||||
That feature requires variadic macro support by compiler. If required feature
|
||||
is not detected, it will not be enabled, even though preprocessor macro is defined.
|
||||
|
@ -783,12 +783,12 @@ extern const char UnityStrErrShorthand[];
|
||||
#endif
|
||||
|
||||
/* Enable default macros for masking param tests test cases */
|
||||
#ifdef UNITY_INCLUDE_PARAM_TESTING_MACRO
|
||||
#ifdef UNITY_SUPPORT_TEST_CASES
|
||||
#ifdef UNITY_SUPPORT_VARIADIC_MACROS
|
||||
#if !defined(TEST_CASE) && !defined(UNITY_NOT_DEFINE_TEST_CASE)
|
||||
#if !defined(TEST_CASE) && !defined(UNITY_EXCLUDE_TEST_CASE)
|
||||
#define TEST_CASE(...)
|
||||
#endif
|
||||
#if !defined(TEST_RANGE) && !defined(UNITY_NOT_DEFINE_TEST_RANGE)
|
||||
#if !defined(TEST_RANGE) && !defined(UNITY_EXCLUDE_TEST_RANGE)
|
||||
#define TEST_RANGE(...)
|
||||
#endif
|
||||
#endif
|
||||
|
@ -4,8 +4,6 @@
|
||||
[Released under MIT License. Please refer to license.txt for details]
|
||||
========================================== */
|
||||
|
||||
#define UNITY_INCLUDE_PARAM_TESTING_MACRO
|
||||
|
||||
#include <setjmp.h>
|
||||
#include <stdio.h>
|
||||
#include "unity.h"
|
||||
|
Reference in New Issue
Block a user