1 |
/* |
2 |
* CUnit - A Unit testing framework library for C. |
3 |
* Copyright (C) 2001 Anil Kumar |
4 |
* Copyright (C) 2004, 2005 Anil Kumar, Jerry St.Clair |
5 |
* |
6 |
* This library is free software; you can redistribute it and/or |
7 |
* modify it under the terms of the GNU Library General Public |
8 |
* License as published by the Free Software Foundation; either |
9 |
* version 2 of the License, or (at your option) any later version. |
10 |
* |
11 |
* This library is distributed in the hope that it will be useful, |
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 |
* Library General Public License for more details. |
15 |
* |
16 |
* You should have received a copy of the GNU Library General Public |
17 |
* License along with this library; if not, write to the Free Software |
18 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 |
*/ |
20 |
|
21 |
/* |
22 |
* Contains ASSERT Macro definitions |
23 |
* |
24 |
* Created By : Anil Kumar on ...(in month of Aug 2001) |
25 |
* Modified : 09/Aug/2001 |
26 |
* Comment : ASSERT definition |
27 |
* EMail : aksaharan@yahoo.com |
28 |
* |
29 |
* Modified : 12/Mar/2003 |
30 |
* Comment : New Assert definitions |
31 |
* EMail : aksaharan@yahoo.com |
32 |
* |
33 |
* Modified : 27/Jul/2003 |
34 |
* Comment : Modified ASSERT_XXX Macro definitions |
35 |
* EMail : aksaharan@yahoo.com |
36 |
* |
37 |
* Modified : 15-Jul-2004 (JDS) |
38 |
* Comment : New interface, changed action on assert failure to |
39 |
* not return, provided _FATAL versions of assertions |
40 |
* to return from test function on failure. |
41 |
* EMail : jds2@users.sourceforge.net |
42 |
* |
43 |
* Modified : 1-Sep-2004 (JDS) |
44 |
* Comment : Modified assertions for setjmp/longjmp mechanism of aborting |
45 |
* test runs, added CU_FAIL and CU_PASS macros. |
46 |
* EMail : jds2@users.sourceforge.net |
47 |
* |
48 |
* Modified : 7-May-2005 (JDS) |
49 |
* Comment : Added CU_ prefix to remaining CUnit defines |
50 |
* (BOOL, TRUE, FALSE, MAX_...). Added |
51 |
* CU_UNREFERENCED_PARAMETER() define. |
52 |
* EMail : jds2@users.sourceforge.net |
53 |
*/ |
54 |
|
55 |
/** @file |
56 |
* Basic CUnit include file for user and system code. |
57 |
* Defines macros for assertions for use in user test cases. |
58 |
* Basic system macro definitions also appear here. |
59 |
*/ |
60 |
/** @addtogroup Framework |
61 |
* @{ |
62 |
*/ |
63 |
|
64 |
#ifndef CUNIT_CUNIT_H_SEEN |
65 |
#define CUNIT_CUNIT_H_SEEN |
66 |
|
67 |
#include <string.h> |
68 |
#include <math.h> |
69 |
|
70 |
/** CUnit version number. */ |
71 |
#define CU_VERSION "2.0-3" |
72 |
|
73 |
/* Max string lengths for names (includes terminating NULL. */ |
74 |
/** Maximum length of a test name string. */ |
75 |
#define CU_MAX_TEST_NAME_LENGTH 256 |
76 |
/** Maximim length of a suite name string. */ |
77 |
#define CU_MAX_SUITE_NAME_LENGTH 256 |
78 |
|
79 |
/* Global type Definitions to be used for boolean operators. */ |
80 |
#ifndef CU_BOOL |
81 |
/** Boolean type for CUnit use. */ |
82 |
#define CU_BOOL int |
83 |
#endif |
84 |
|
85 |
#ifndef CU_TRUE |
86 |
/** Boolean TRUE for CUnit use. */ |
87 |
#define CU_TRUE 1 |
88 |
#endif |
89 |
|
90 |
#ifndef CU_FALSE |
91 |
/** Boolean FALSE for CUnit use. */ |
92 |
#define CU_FALSE 0 |
93 |
#endif |
94 |
|
95 |
#ifndef CU_UNREFERENCED_PARAMETER |
96 |
/** Consistent approach to referencing unused parameters. */ |
97 |
#define CU_UNREFERENCED_PARAMETER(x) /*@i1@*/ (void)x |
98 |
#endif |
99 |
|
100 |
#ifdef WIN32 |
101 |
# ifdef CU_DLL |
102 |
# ifdef CU_BUILD_DLL |
103 |
# define CU_EXPORT __declspec(dllexport) |
104 |
# else |
105 |
# define CU_EXPORT __declspec(dllimport) |
106 |
# endif |
107 |
# else |
108 |
# define CU_EXPORT |
109 |
# endif |
110 |
#else |
111 |
# define CU_EXPORT |
112 |
#endif |
113 |
|
114 |
#include "CUError.h" |
115 |
#include "TestDB.h" /* not needed here - included for user convenience */ |
116 |
#include "TestRun.h" /* not needed here - include (after BOOL define) for user convenience */ |
117 |
|
118 |
/** Record a pass condition without performing a logical test. */ |
119 |
#define CU_PASS(msg) \ |
120 |
{ CU_assertImplementation(CU_TRUE, __LINE__, ("CU_PASS(" #msg ")"), __FILE__, "", CU_FALSE); } |
121 |
|
122 |
/** Simple assertion. |
123 |
* Reports failure with no other action. |
124 |
*/ |
125 |
#define CU_ASSERT(value) \ |
126 |
{ CU_assertImplementation((value), __LINE__, #value, __FILE__, "", CU_FALSE); } |
127 |
|
128 |
/** Simple assertion. |
129 |
* Reports failure and causes test to abort. |
130 |
*/ |
131 |
#define CU_ASSERT_FATAL(value) \ |
132 |
{ CU_assertImplementation((value), __LINE__, #value, __FILE__, "", CU_TRUE); } |
133 |
|
134 |
/** Simple assertion. |
135 |
* Reports failure with no other action. |
136 |
*/ |
137 |
#define CU_TEST(value) \ |
138 |
{ CU_assertImplementation((value), __LINE__, #value, __FILE__, "", CU_FALSE); } |
139 |
|
140 |
/** Simple assertion. |
141 |
* Reports failure and causes test to abort. |
142 |
*/ |
143 |
#define CU_TEST_FATAL(value) \ |
144 |
{ CU_assertImplementation((value), __LINE__, #value, __FILE__, "", CU_TRUE); } |
145 |
|
146 |
/** Record a failure without performing a logical test. */ |
147 |
#define CU_FAIL(msg) \ |
148 |
{ CU_assertImplementation(CU_FALSE, __LINE__, (msg), __FILE__, "", CU_FALSE); } |
149 |
|
150 |
/** Record a failure without performing a logical test, and abort test. */ |
151 |
#define CU_FAIL_FATAL(msg) \ |
152 |
{ CU_assertImplementation(CU_FALSE, __LINE__, (msg), __FILE__, "", CU_TRUE); } |
153 |
|
154 |
/** Asserts that value is CU_TRUE. |
155 |
* Reports failure with no other action. |
156 |
*/ |
157 |
#define CU_ASSERT_TRUE(value) \ |
158 |
{ CU_assertImplementation((value), __LINE__, ("CU_ASSERT_TRUE(" #value ")"), __FILE__, "", CU_FALSE); } |
159 |
|
160 |
/** Asserts that value is CU_TRUE. |
161 |
* Reports failure and causes test to abort. |
162 |
*/ |
163 |
#define CU_ASSERT_TRUE_FATAL(value) \ |
164 |
{ CU_assertImplementation((value), __LINE__, ("CU_ASSERT_TRUE_FATAL(" #value ")"), __FILE__, "", CU_TRUE); } |
165 |
|
166 |
/** Asserts that value is CU_FALSE. |
167 |
* Reports failure with no other action. |
168 |
*/ |
169 |
#define CU_ASSERT_FALSE(value) \ |
170 |
{ CU_assertImplementation(!(value), __LINE__, ("CU_ASSERT_FALSE(" #value ")"), __FILE__, "", CU_FALSE); } |
171 |
|
172 |
/** Asserts that value is CU_FALSE. |
173 |
* Reports failure and causes test to abort. |
174 |
*/ |
175 |
#define CU_ASSERT_FALSE_FATAL(value) \ |
176 |
{ CU_assertImplementation(!(value), __LINE__, ("CU_ASSERT_FALSE_FATAL(" #value ")"), __FILE__, "", CU_TRUE); } |
177 |
|
178 |
/** Asserts that actual == expected. |
179 |
* Reports failure with no other action. |
180 |
*/ |
181 |
#define CU_ASSERT_EQUAL(actual, expected) \ |
182 |
{ CU_assertImplementation(((actual) == (expected)), __LINE__, ("CU_ASSERT_EQUAL(" #actual "," #expected ")"), __FILE__, "", CU_FALSE); } |
183 |
|
184 |
/** Asserts that actual == expected. |
185 |
* Reports failure and causes test to abort. |
186 |
*/ |
187 |
#define CU_ASSERT_EQUAL_FATAL(actual, expected) \ |
188 |
{ CU_assertImplementation(((actual) == (expected)), __LINE__, ("CU_ASSERT_EQUAL_FATAL(" #actual "," #expected ")"), __FILE__, "", CU_TRUE); } |
189 |
|
190 |
/** Asserts that actual != expected. |
191 |
* Reports failure with no other action. |
192 |
*/ |
193 |
#define CU_ASSERT_NOT_EQUAL(actual, expected) \ |
194 |
{ CU_assertImplementation(((actual) != (expected)), __LINE__, ("CU_ASSERT_NOT_EQUAL(" #actual "," #expected ")"), __FILE__, "", CU_FALSE); } |
195 |
|
196 |
/** Asserts that actual != expected. |
197 |
* Reports failure and causes test to abort. |
198 |
*/ |
199 |
#define CU_ASSERT_NOT_EQUAL_FATAL(actual, expected) \ |
200 |
{ CU_assertImplementation(((actual) != (expected)), __LINE__, ("CU_ASSERT_NOT_EQUAL_FATAL(" #actual "," #expected ")"), __FILE__, "", CU_TRUE); } |
201 |
|
202 |
/** Asserts that pointers actual == expected. |
203 |
* Reports failure with no other action. |
204 |
*/ |
205 |
#define CU_ASSERT_PTR_EQUAL(actual, expected) \ |
206 |
{ CU_assertImplementation(((void*)(actual) == (void*)(expected)), __LINE__, ("CU_ASSERT_PTR_EQUAL(" #actual "," #expected ")"), __FILE__, "", CU_FALSE); } |
207 |
|
208 |
/** Asserts that pointers actual == expected. |
209 |
* Reports failure and causes test to abort. |
210 |
*/ |
211 |
#define CU_ASSERT_PTR_EQUAL_FATAL(actual, expected) \ |
212 |
{ CU_assertImplementation(((void*)(actual) == (void*)(expected)), __LINE__, ("CU_ASSERT_PTR_EQUAL_FATAL(" #actual "," #expected ")"), __FILE__, "", CU_TRUE); } |
213 |
|
214 |
/** Asserts that pointers actual != expected. |
215 |
* Reports failure with no other action. |
216 |
*/ |
217 |
#define CU_ASSERT_PTR_NOT_EQUAL(actual, expected) \ |
218 |
{ CU_assertImplementation(((void*)(actual) != (void*)(expected)), __LINE__, ("CU_ASSERT_PTR_NOT_EQUAL(" #actual "," #expected ")"), __FILE__, "", CU_FALSE); } |
219 |
|
220 |
/** Asserts that pointers actual != expected. |
221 |
* Reports failure and causes test to abort. |
222 |
*/ |
223 |
#define CU_ASSERT_PTR_NOT_EQUAL_FATAL(actual, expected) \ |
224 |
{ CU_assertImplementation(((void*)(actual) != (void*)(expected)), __LINE__, ("CU_ASSERT_PTR_NOT_EQUAL_FATAL(" #actual "," #expected ")"), __FILE__, "", CU_TRUE); } |
225 |
|
226 |
/** Asserts that pointer value is NULL. |
227 |
* Reports failure with no other action. |
228 |
*/ |
229 |
#define CU_ASSERT_PTR_NULL(value) \ |
230 |
{ CU_assertImplementation((NULL == (void*)(value)), __LINE__, ("CU_ASSERT_PTR_NULL(" #value")"), __FILE__, "", CU_FALSE); } |
231 |
|
232 |
/** Asserts that pointer value is NULL. |
233 |
* Reports failure and causes test to abort. |
234 |
*/ |
235 |
#define CU_ASSERT_PTR_NULL_FATAL(value) \ |
236 |
{ CU_assertImplementation((NULL == (void*)(value)), __LINE__, ("CU_ASSERT_PTR_NULL_FATAL(" #value")"), __FILE__, "", CU_TRUE); } |
237 |
|
238 |
/** Asserts that pointer value is not NULL. |
239 |
* Reports failure with no other action. |
240 |
*/ |
241 |
#define CU_ASSERT_PTR_NOT_NULL(value) \ |
242 |
{ CU_assertImplementation((NULL != (void*)(value)), __LINE__, ("CU_ASSERT_PTR_NOT_NULL(" #value")"), __FILE__, "", CU_FALSE); } |
243 |
|
244 |
/** Asserts that pointer value is not NULL. |
245 |
* Reports failure and causes test to abort. |
246 |
*/ |
247 |
#define CU_ASSERT_PTR_NOT_NULL_FATAL(value) \ |
248 |
{ CU_assertImplementation((NULL != (void*)(value)), __LINE__, ("CU_ASSERT_PTR_NOT_NULL_FATAL(" #value")"), __FILE__, "", CU_TRUE); } |
249 |
|
250 |
/** Asserts that string actual == expected. |
251 |
* Reports failure with no other action. |
252 |
*/ |
253 |
#define CU_ASSERT_STRING_EQUAL(actual, expected) \ |
254 |
{ CU_assertImplementation(!(strcmp((const char*)(actual), (const char*)(expected))), __LINE__, ("CU_ASSERT_STRING_EQUAL(" #actual "," #expected ")"), __FILE__, "", CU_FALSE); } |
255 |
|
256 |
/** Asserts that string actual == expected. |
257 |
* Reports failure and causes test to abort. |
258 |
*/ |
259 |
#define CU_ASSERT_STRING_EQUAL_FATAL(actual, expected) \ |
260 |
{ CU_assertImplementation(!(strcmp((const char*)(actual), (const char*)(expected))), __LINE__, ("CU_ASSERT_STRING_EQUAL_FATAL(" #actual "," #expected ")"), __FILE__, "", CU_TRUE); } |
261 |
|
262 |
/** Asserts that string actual != expected. |
263 |
* Reports failure with no other action. |
264 |
*/ |
265 |
#define CU_ASSERT_STRING_NOT_EQUAL(actual, expected) \ |
266 |
{ CU_assertImplementation((strcmp((const char*)(actual), (const char*)(expected))), __LINE__, ("CU_ASSERT_STRING_NOT_EQUAL(" #actual "," #expected ")"), __FILE__, "", CU_FALSE); } |
267 |
|
268 |
/** Asserts that string actual != expected. |
269 |
* Reports failure and causes test to abort. |
270 |
*/ |
271 |
#define CU_ASSERT_STRING_NOT_EQUAL_FATAL(actual, expected) \ |
272 |
{ CU_assertImplementation((strcmp((const char*)(actual), (const char*)(expected))), __LINE__, ("CU_ASSERT_STRING_NOT_EQUAL_FATAL(" #actual "," #expected ")"), __FILE__, "", CU_TRUE); } |
273 |
|
274 |
/** Asserts that string actual == expected with length specified. |
275 |
* The comparison is limited to count characters. |
276 |
* Reports failure with no other action. |
277 |
*/ |
278 |
#define CU_ASSERT_NSTRING_EQUAL(actual, expected, count) \ |
279 |
{ CU_assertImplementation(!(strncmp((const char*)(actual), (const char*)(expected), (size_t)(count))), __LINE__, ("CU_ASSERT_NSTRING_EQUAL(" #actual "," #expected "," #count ")"), __FILE__, "", CU_FALSE); } |
280 |
|
281 |
/** Asserts that string actual == expected with length specified. |
282 |
* The comparison is limited to count characters. |
283 |
* Reports failure and causes test to abort. |
284 |
*/ |
285 |
#define CU_ASSERT_NSTRING_EQUAL_FATAL(actual, expected, count) \ |
286 |
{ CU_assertImplementation(!(strncmp((const char*)(actual), (const char*)(expected), (size_t)(count))), __LINE__, ("CU_ASSERT_NSTRING_EQUAL_FATAL(" #actual "," #expected "," #count ")"), __FILE__, "", CU_TRUE); } |
287 |
|
288 |
/** Asserts that string actual != expected with length specified. |
289 |
* The comparison is limited to count characters. |
290 |
* Reports failure with no other action. |
291 |
*/ |
292 |
#define CU_ASSERT_NSTRING_NOT_EQUAL(actual, expected, count) \ |
293 |
{ CU_assertImplementation((strncmp((const char*)(actual), (const char*)(expected), (size_t)(count))), __LINE__, ("CU_ASSERT_NSTRING_NOT_EQUAL(" #actual "," #expected "," #count ")"), __FILE__, "", CU_FALSE); } |
294 |
|
295 |
/** Asserts that string actual != expected with length specified. |
296 |
* The comparison is limited to count characters. |
297 |
* Reports failure and causes test to abort. |
298 |
*/ |
299 |
#define CU_ASSERT_NSTRING_NOT_EQUAL_FATAL(actual, expected, count) \ |
300 |
{ CU_assertImplementation((strncmp((const char*)(actual), (const char*)(expected), (size_t)(count))), __LINE__, ("CU_ASSERT_NSTRING_NOT_EQUAL_FATAL(" #actual "," #expected "," #count ")"), __FILE__, "", CU_TRUE); } |
301 |
|
302 |
/** Asserts that double actual == expected within the specified tolerance. |
303 |
* If actual is within granularity of expected, the assertion passes. |
304 |
* Reports failure with no other action. |
305 |
*/ |
306 |
#define CU_ASSERT_DOUBLE_EQUAL(actual, expected, granularity) \ |
307 |
{ CU_assertImplementation(((fabs((double)(actual) - (expected)) <= fabs((double)(granularity)))), __LINE__, ("CU_ASSERT_DOUBLE_EQUAL(" #actual "," #expected "," #granularity ")"), __FILE__, "", CU_FALSE); } |
308 |
|
309 |
/** Asserts that double actual == expected within the specified tolerance. |
310 |
* If actual is within granularity of expected, the assertion passes. |
311 |
* Reports failure and causes test to abort. |
312 |
*/ |
313 |
#define CU_ASSERT_DOUBLE_EQUAL_FATAL(actual, expected, granularity) \ |
314 |
{ CU_assertImplementation(((fabs((double)(actual) - (expected)) <= fabs((double)(granularity)))), __LINE__, ("CU_ASSERT_DOUBLE_EQUAL_FATAL(" #actual "," #expected "," #granularity ")"), __FILE__, "", CU_TRUE); } |
315 |
|
316 |
/** Asserts that double actual != expected within the specified tolerance. |
317 |
* If actual is within granularity of expected, the assertion fails. |
318 |
* Reports failure with no other action. |
319 |
*/ |
320 |
#define CU_ASSERT_DOUBLE_NOT_EQUAL(actual, expected, granularity) \ |
321 |
{ CU_assertImplementation(((fabs((double)(actual) - (expected)) > fabs((double)(granularity)))), __LINE__, ("CU_ASSERT_DOUBLE_NOT_EQUAL(" #actual "," #expected "," #granularity ")"), __FILE__, "", CU_FALSE); } |
322 |
|
323 |
/** Asserts that double actual != expected within the specified tolerance. |
324 |
* If actual is within granularity of expected, the assertion fails. |
325 |
* Reports failure and causes test to abort. |
326 |
*/ |
327 |
#define CU_ASSERT_DOUBLE_NOT_EQUAL_FATAL(actual, expected, granularity) \ |
328 |
{ CU_assertImplementation(((fabs((double)(actual) - (expected)) > fabs((double)(granularity)))), __LINE__, ("CU_ASSERT_DOUBLE_NOT_EQUAL_FATAL(" #actual "," #expected "," #granularity ")"), __FILE__, "", CU_TRUE); } |
329 |
|
330 |
#ifdef USE_DEPRECATED_CUNIT_NAMES |
331 |
|
332 |
#ifndef BOOL |
333 |
/** Deprecated (version 2.0-2). @deprecated Use CU_BOOL. */ |
334 |
#define BOOL int |
335 |
#endif |
336 |
|
337 |
#ifndef TRUE |
338 |
/** Deprecated (version 2.0-2). @deprecated Use CU_TRUE. */ |
339 |
#define TRUE 1 |
340 |
#endif |
341 |
|
342 |
#ifndef FALSE |
343 |
/** Deprecated (version 2.0-2). @deprecated Use CU_FALSE. */ |
344 |
#define FALSE 0 |
345 |
#endif |
346 |
|
347 |
/** Deprecated (version 2.0-2). @deprecated Use CU_MAX_TEST_NAME_LENGTH. */ |
348 |
#define MAX_TEST_NAME_LENGTH 256 |
349 |
/** Deprecated (version 2.0-2). @deprecated Use CU_MAX_SUITE_NAME_LENGTH. */ |
350 |
#define MAX_SUITE_NAME_LENGTH 256 |
351 |
|
352 |
/** Deprecated (version 1). @deprecated Use CU_ASSERT_FATAL. */ |
353 |
#define ASSERT(value) { if (FALSE == (int)(value)) { CU_assertImplementation((BOOL)value, __LINE__, #value, __FILE__, "", FALSE); return; }} |
354 |
/** Deprecated (version 1). @deprecated Use CU_ASSERT_TRUE_FATAL. */ |
355 |
#define ASSERT_TRUE(value) { if (FALSE == (value)) { CU_assertImplementation(FALSE, __LINE__, ("ASSERT_TRUE(" #value ")"), __FILE__, "", FALSE); return; }} |
356 |
/** Deprecated (version 1). @deprecated Use CU_ASSERT_FALSE_FATAL. */ |
357 |
#define ASSERT_FALSE(value) { if (FALSE != (value)) { CU_assertImplementation(FALSE, __LINE__, ("ASSERT_FALSE(" #value ")"), __FILE__, "", FALSE); return; }} |
358 |
/** Deprecated (version 1). @deprecated Use CU_ASSERT_EQUAL_FATAL. */ |
359 |
#define ASSERT_EQUAL(actual, expected) { if ((actual) != (expected)) { CU_assertImplementation(FALSE, __LINE__, ("ASSERT_EQUAL(" #actual "," #expected ")"), __FILE__, "", FALSE); return; }} |
360 |
/** Deprecated (version 1). @deprecated Use CU_ASSERT_NOT_EQUAL_FATAL. */ |
361 |
#define ASSERT_NOT_EQUAL(actual, expected) { if ((void*)(actual) == (void*)(expected)) { CU_assertImplementation(FALSE, __LINE__, ("ASSERT_NOT_EQUAL(" #actual "," #expected ")"), __FILE__, "", FALSE); return; }} |
362 |
/** Deprecated (version 1). @deprecated Use CU_ASSERT_PTR_EQUAL_FATAL. */ |
363 |
#define ASSERT_PTR_EQUAL(actual, expected) { if ((void*)(actual) != (void*)(expected)) { CU_assertImplementation(FALSE, __LINE__, ("ASSERT_PTR_EQUAL(" #actual "," #expected ")"), __FILE__, "", FALSE); return; }} |
364 |
/** Deprecated (version 1). @deprecated Use CU_ASSERT_PTR_NOT_EQUAL_FATAL. */ |
365 |
#define ASSERT_PTR_NOT_EQUAL(actual, expected) { if ((void*)(actual) == (void*)(expected)) { CU_assertImplementation(FALSE, __LINE__, ("ASSERT_PTR_NOT_EQUAL(" #actual "," #expected ")"), __FILE__, "", FALSE); return; }} |
366 |
/** Deprecated (version 1). @deprecated Use CU_ASSERT_PTR_NULL_FATAL. */ |
367 |
#define ASSERT_PTR_NULL(value) { if (NULL != (void*)(value)) { CU_assertImplementation(FALSE, __LINE__, ("ASSERT_PTR_NULL(" #value")"), __FILE__, "", FALSE); return; }} |
368 |
/** Deprecated (version 1). @deprecated Use CU_ASSERT_PTR_NOT_NULL_FATAL. */ |
369 |
#define ASSERT_PTR_NOT_NULL(value) { if (NULL == (void*)(value)) { CU_assertImplementation(FALSE, __LINE__, ("ASSERT_PTR_NOT_NULL(" #value")"), __FILE__, "", FALSE); return; }} |
370 |
/** Deprecated (version 1). @deprecated Use CU_ASSERT_STRING_EQUAL_FATAL. */ |
371 |
#define ASSERT_STRING_EQUAL(actual, expected) { if (strcmp((const char*)actual, (const char*)expected)) { CU_assertImplementation(FALSE, __LINE__, ("ASSERT_STRING_EQUAL(" #actual "," #expected ")"), __FILE__, "", FALSE); return; }} |
372 |
/** Deprecated (version 1). @deprecated Use CU_ASSERT_STRING_NOT_EQUAL_FATAL. */ |
373 |
#define ASSERT_STRING_NOT_EQUAL(actual, expected) { if (!strcmp((const char*)actual, (const char*)expected)) { CU_assertImplementation(TRUE, __LINE__, ("ASSERT_STRING_NOT_EQUAL(" #actual "," #expected ")"), __FILE__, "", FALSE); return; }} |
374 |
/** Deprecated (version 1). @deprecated Use CU_ASSERT_NSTRING_EQUAL_FATAL. */ |
375 |
#define ASSERT_NSTRING_EQUAL(actual, expected, count) { if (strncmp((const char*)actual, (const char*)expected, (size_t)count)) { CU_assertImplementation(FALSE, __LINE__, ("ASSERT_NSTRING_EQUAL(" #actual "," #expected "," #count ")"), __FILE__, "", FALSE); return; }} |
376 |
/** Deprecated (version 1). @deprecated Use CU_ASSERT_NSTRING_NOT_EQUAL_FATAL. */ |
377 |
#define ASSERT_NSTRING_NOT_EQUAL(actual, expected, count) { if (!strncmp((const char*)actual, (const char*)expected, (size_t)count)) { CU_assertImplementation(TRUE, __LINE__, ("ASSERT_NSTRING_NOT_EQUAL(" #actual "," #expected "," #count ")"), __FILE__, "", FALSE); return; }} |
378 |
/** Deprecated (version 1). @deprecated Use CU_ASSERT_DOUBLE_EQUAL_FATAL. */ |
379 |
#define ASSERT_DOUBLE_EQUAL(actual, expected, granularity) { if ((fabs((double)actual - expected) > fabs((double)granularity))) { CU_assertImplementation(FALSE, __LINE__, ("ASSERT_DOUBLE_EQUAL(" #actual "," #expected "," #granularity ")"), __FILE__, "", FALSE); return; }} |
380 |
/** Deprecated (version 1). @deprecated Use CU_ASSERT_DOUBLE_NOT_EQUAL_FATAL. */ |
381 |
#define ASSERT_DOUBLE_NOT_EQUAL(actual, expected, granularity) { if ((fabs((double)actual - expected) <= fabs((double)granularity))) { CU_assertImplementation(TRUE, __LINE__, ("ASSERT_DOUBLE_NOT_EQUAL(" #actual "," #expected "," #granularity ")"), __FILE__, "", FALSE); return; }} |
382 |
#endif /* USE_DEPRECATED_CUNIT_NAMES */ |
383 |
|
384 |
#endif /* CUNIT_CUNIT_H_SEEN */ |
385 |
|
386 |
/** @} */ |