Skip to content

Commit e4085eb

Browse files
author
Alex Overchenko
committed
Using default macro for TEST_CASEs define.
Improving docs about manual definition.
1 parent 4d5ed3d commit e4085eb

3 files changed

Lines changed: 15 additions & 11 deletions

File tree

docs/UnityConfigurationGuide.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -438,26 +438,32 @@ This will rarely be necessary. Most often, Unity will automatically detect if th
438438
In the event that the compiler supports variadic macros, but is primarily C89 (ANSI), defining this option will allow you to use them.
439439
This option is also not necessary when using Ceedling or the test runner generator script.
440440

441-
#### `UNITY_INCLUDE_PARAM_TESTING_MACRO`
441+
#### `UNITY_SUPPORT_TEST_CASES`
442442

443443
Unity can automatically define all supported parameterized tests macros.
444-
To enable that feature, use the following example:
444+
That feature is disabled by default.
445+
To enable it, use the following example:
445446

446447
```C
447-
#define UNITY_INCLUDE_PARAM_TESTING_MACRO
448+
#define UNITY_SUPPORT_TEST_CASES
448449
```
449450

450451
You can manually provide required `TEST_CASE` or `TEST_RANGE` macro definitions
451452
before including `unity.h`, and they won't be redefined.
452453
If you provide one of the following macros, some of default definitions will not be
453454
defined:
454-
| User defines macro | Unity will __not__ define following macro |
455+
| User defines macro | Unity will _not_ define following macro |
455456
|---|---|
456-
| `UNITY_NOT_DEFINE_TEST_CASE` | `TEST_CASE` |
457-
| `UNITY_NOT_DEFINE_TEST_RANGE` | `TEST_RANGE` |
457+
| `UNITY_EXCLUDE_TEST_CASE` | `TEST_CASE` |
458+
| `UNITY_EXCLUDE_TEST_RANGE` | `TEST_RANGE` |
458459
| `TEST_CASE` | `TEST_CASE` |
459460
| `TEST_RANGE` | `TEST_RANGE` |
460461

462+
`UNITY_EXCLUDE_TEST_*` defines is not processed by test runner generator script.
463+
If you exclude one of them from definition, you should provide your own definition
464+
for them or avoid using undefined `TEST_*` macro as a test generator.
465+
Otherwise, compiler cannot build source code file with provided call.
466+
461467
_Note:_
462468
That feature requires variadic macro support by compiler. If required feature
463469
is not detected, it will not be enabled, even though preprocessor macro is defined.

src/unity_internals.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -783,12 +783,12 @@ extern const char UnityStrErrShorthand[];
783783
#endif
784784

785785
/* Enable default macros for masking param tests test cases */
786-
#ifdef UNITY_INCLUDE_PARAM_TESTING_MACRO
786+
#ifdef UNITY_SUPPORT_TEST_CASES
787787
#ifdef UNITY_SUPPORT_VARIADIC_MACROS
788-
#if !defined(TEST_CASE) && !defined(UNITY_NOT_DEFINE_TEST_CASE)
788+
#if !defined(TEST_CASE) && !defined(UNITY_EXCLUDE_TEST_CASE)
789789
#define TEST_CASE(...)
790790
#endif
791-
#if !defined(TEST_RANGE) && !defined(UNITY_NOT_DEFINE_TEST_RANGE)
791+
#if !defined(TEST_RANGE) && !defined(UNITY_EXCLUDE_TEST_RANGE)
792792
#define TEST_RANGE(...)
793793
#endif
794794
#endif

test/tests/test_unity_parameterized.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
[Released under MIT License. Please refer to license.txt for details]
55
========================================== */
66

7-
#define UNITY_INCLUDE_PARAM_TESTING_MACRO
8-
97
#include <setjmp.h>
108
#include <stdio.h>
119
#include "unity.h"

0 commit comments

Comments
 (0)