|
11 | 11 | #include "CurrentTest.h"
|
12 | 12 | #include "ReportAssertImpl.h"
|
13 | 13 |
|
14 |
| -#ifdef CHECK |
15 |
| - #error UnitTest++ redefines CHECK |
16 |
| -#endif |
17 |
| - |
18 |
| -#ifdef CHECK_EQUAL |
19 |
| - #error UnitTest++ redefines CHECK_EQUAL |
20 |
| -#endif |
21 |
| - |
22 |
| -#ifdef CHECK_CLOSE |
23 |
| - #error UnitTest++ redefines CHECK_CLOSE |
24 |
| -#endif |
25 |
| - |
26 |
| -#ifdef CHECK_ARRAY_EQUAL |
27 |
| - #error UnitTest++ redefines CHECK_ARRAY_EQUAL |
28 |
| -#endif |
29 |
| - |
30 |
| -#ifdef CHECK_ARRAY_CLOSE |
31 |
| - #error UnitTest++ redefines CHECK_ARRAY_CLOSE |
32 |
| -#endif |
33 |
| - |
34 |
| -#ifdef CHECK_ARRAY2D_CLOSE |
35 |
| - #error UnitTest++ redefines CHECK_ARRAY2D_CLOSE |
36 |
| -#endif |
37 |
| - |
38 |
| -#define CHECK(value) \ |
| 14 | +#define UNITTEST_CHECK(value) \ |
39 | 15 | UNITTEST_MULTILINE_MACRO_BEGIN \
|
40 | 16 | UT_TRY \
|
41 | 17 | ({ \
|
|
57 | 33 | }) \
|
58 | 34 | UNITTEST_MULTILINE_MACRO_END
|
59 | 35 |
|
60 |
| -#define CHECK_EQUAL(expected, actual) \ |
| 36 | +#define UNITTEST_CHECK_EQUAL(expected, actual) \ |
61 | 37 | UNITTEST_MULTILINE_MACRO_BEGIN \
|
62 | 38 | UT_TRY \
|
63 | 39 | ({ \
|
|
78 | 54 | }) \
|
79 | 55 | UNITTEST_MULTILINE_MACRO_END
|
80 | 56 |
|
81 |
| -#define CHECK_CLOSE(expected, actual, tolerance) \ |
| 57 | +#define UNITTEST_CHECK_CLOSE(expected, actual, tolerance) \ |
82 | 58 | UNITTEST_MULTILINE_MACRO_BEGIN \
|
83 | 59 | UT_TRY \
|
84 | 60 | ({ \
|
|
99 | 75 | }) \
|
100 | 76 | UNITTEST_MULTILINE_MACRO_END
|
101 | 77 |
|
102 |
| -#define CHECK_ARRAY_EQUAL(expected, actual, count) \ |
| 78 | +#define UNITTEST_CHECK_ARRAY_EQUAL(expected, actual, count) \ |
103 | 79 | UNITTEST_MULTILINE_MACRO_BEGIN \
|
104 | 80 | UT_TRY \
|
105 | 81 | ({ \
|
|
120 | 96 | }) \
|
121 | 97 | UNITTEST_MULTILINE_MACRO_END
|
122 | 98 |
|
123 |
| -#define CHECK_ARRAY_CLOSE(expected, actual, count, tolerance) \ |
| 99 | +#define UNITTEST_CHECK_ARRAY_CLOSE(expected, actual, count, tolerance) \ |
124 | 100 | UNITTEST_MULTILINE_MACRO_BEGIN \
|
125 | 101 | UT_TRY \
|
126 | 102 | ({ \
|
|
141 | 117 | }) \
|
142 | 118 | UNITTEST_MULTILINE_MACRO_END
|
143 | 119 |
|
144 |
| -#define CHECK_ARRAY2D_CLOSE(expected, actual, rows, columns, tolerance) \ |
| 120 | +#define UNITTEST_CHECK_ARRAY2D_CLOSE(expected, actual, rows, columns, tolerance) \ |
145 | 121 | UNITTEST_MULTILINE_MACRO_BEGIN \
|
146 | 122 | UT_TRY \
|
147 | 123 | ({ \
|
|
162 | 138 | }) \
|
163 | 139 | UNITTEST_MULTILINE_MACRO_END
|
164 | 140 |
|
| 141 | +#if UNITTEST_ENABLE_SHORT_MACROS |
| 142 | + #ifdef CHECK |
| 143 | + #error CHECK already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_CHECK instead |
| 144 | + #else |
| 145 | + #define CHECK UNITTEST_CHECK |
| 146 | + #endif |
| 147 | + |
| 148 | + #ifdef CHECK_EQUAL |
| 149 | + #error CHECK_EQUAL already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_CHECK_EQUAL instead |
| 150 | + #else |
| 151 | + #define CHECK_EQUAL UNITTEST_CHECK_EQUAL |
| 152 | + #endif |
| 153 | + |
| 154 | + #ifdef CHECK_CLOSE |
| 155 | + #error CHECK_CLOSE already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_CHECK_CLOSE instead |
| 156 | + #else |
| 157 | + #define CHECK_CLOSE UNITTEST_CHECK_CLOSE |
| 158 | + #endif |
<
67E6
/code> | 159 | + |
| 160 | + #ifdef CHECK_ARRAY_EQUAL |
| 161 | + #error CHECK_ARRAY_EQUAL already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_CHECK_ARRAY_EQUAL instead |
| 162 | + #else |
| 163 | + #define CHECK_ARRAY_EQUAL UNITTEST_CHECK_ARRAY_EQUAL |
| 164 | + #endif |
| 165 | + |
| 166 | + #ifdef CHECK_ARRAY_CLOSE |
| 167 | + #error CHECK_ARRAY_CLOSE already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_CHECK_ARRAY_CLOSE instead |
| 168 | + #else |
| 169 | + #define CHECK_ARRAY_CLOSE UNITTEST_CHECK_ARRAY_CLOSE |
| 170 | + #endif |
| 171 | + |
| 172 | + #ifdef CHECK_ARRAY2D_CLOSE |
| 173 | + #error CHECK_ARRAY2D_CLOSE already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_CHECK_ARRAY2D_CLOSE instead |
| 174 | + #else |
| 175 | + #define CHECK_ARRAY2D_CLOSE UNITTEST_CHECK_ARRAY2D_CLOSE |
| 176 | + #endif |
| 1
A3E2
77 | +#endif |
165 | 178 |
|
166 | 179 | // CHECK_THROW and CHECK_ASSERT only exist when UNITTEST_NO_EXCEPTIONS isn't defined (see config.h)
|
167 | 180 | #ifndef UNITTEST_NO_EXCEPTIONS
|
168 | 181 |
|
169 |
| -#define CHECK_THROW(expression, ExpectedExceptionType) \ |
| 182 | +#define UNITTEST_CHECK_THROW(expression, ExpectedExceptionType) \ |
170 | 183 | UNITTEST_MULTILINE_MACRO_BEGIN \
|
171 | 184 | bool caught_ = false; \
|
172 | 185 | try { expression; } \
|
|
177 | 190 | UNITTEST_MULTILINE_MACRO_END
|
178 | 191 |
|
179 | 192 |
|
180 |
| -#define CHECK_ASSERT(expression) \ |
| 193 | +#define UNITTEST_CHECK_ASSERT(expression) \ |
181 | 194 | UNITTEST_MULTILINE_MACRO_BEGIN \
|
182 | 195 | UnitTest::Detail::ExpectAssert(true); \
|
183 | 196 | CHECK_THROW(expression, UnitTest::AssertException); \
|
184 | 197 | UnitTest::Detail::ExpectAssert(false); \
|
185 | 198 | UNITTEST_MULTILINE_MACRO_END
|
186 | 199 | #endif
|
187 | 200 |
|
| 201 | +#if UNITTEST_ENABLE_SHORT_MACROS |
| 202 | + #ifdef CHECK_THROW |
| 203 | + #error CHECK_THROW already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_CHECK_THROW instead |
| 204 | + #else |
| 205 | + #define CHECK_THROW UNITTEST_CHECK_THROW |
| 206 | + #endif |
| 207 | + |
| 208 | + #ifdef CHECK_ASSERT |
| 209 | + #error CHECK_ASSERT already defined, re-configure with UNITTEST_ENABLE_SHORT_MACROS set to 0 and use UNITTEST_CHECK_ASSERT instead |
| 210 | + #else |
| 211 | + #define CHECK_ASSERT UNITTEST_CHECK_ASSERT |
| 212 | + #endif |
| 213 | +#endif |
| 214 | + |
188 | 215 | #endif
|
| 216 | + |
0 commit comments