comparison tests/test-rawmemchr.c @ 12496:a48d3d749ca5

Refactor common macros used in tests.
author Bruno Haible <bruno@clisp.org>
date Thu, 24 Dec 2009 21:01:42 +0100
parents 33ab12a7cea2
children 442a82a053da
comparison
equal deleted inserted replaced
12495:16a0ada3a101 12496:a48d3d749ca5
20 #include <string.h> 20 #include <string.h>
21 21
22 #include "signature.h" 22 #include "signature.h"
23 SIGNATURE_CHECK (rawmemchr, void *, (void const *, int)); 23 SIGNATURE_CHECK (rawmemchr, void *, (void const *, int));
24 24
25 #include <stdio.h>
26 #include <stdlib.h> 25 #include <stdlib.h>
27 26
28 #define ASSERT(expr) \ 27 #include "macros.h"
29 do \
30 { \
31 if (!(expr)) \
32 { \
33 fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
34 fflush (stderr); \
35 abort (); \
36 } \
37 } \
38 while (0)
39 28
40 /* Calculating void * + int is not portable, so this wrapper converts 29 /* Calculating void * + int is not portable, so this wrapper converts
41 to char * to make the tests easier to write. */ 30 to char * to make the tests easier to write. */
42 #define RAWMEMCHR (char *) rawmemchr 31 #define RAWMEMCHR (char *) rawmemchr
43 32