summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2007-04-29 09:15:13 +0000
committerBruno Haible <bruno@clisp.org>2007-04-29 09:15:13 +0000
commit75d146361fe980e1e1bbb9639edc6fbed5345e82 (patch)
tree0b0ae95b2c7882d40722dce902aa699790edaa12 /tests
parent17fecfc4d6363d6d4127a97b42f0acbbcbd60a44 (diff)
downloadgnulib-75d146361fe980e1e1bbb9639edc6fbed5345e82.tar.gz
Better ASSERT macro.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-argmatch.c12
-rw-r--r--tests/test-array_list.c12
-rw-r--r--tests/test-array_oset.c12
-rw-r--r--tests/test-avltree_list.c12
-rw-r--r--tests/test-avltree_oset.c12
-rw-r--r--tests/test-avltreehash_list.c12
-rw-r--r--tests/test-binary-io.c11
-rw-r--r--tests/test-byteswap.c12
-rw-r--r--tests/test-c-ctype.c14
-rw-r--r--tests/test-c-strcasecmp.c12
-rw-r--r--tests/test-c-strcasestr.c12
-rw-r--r--tests/test-c-strncasecmp.c12
-rw-r--r--tests/test-c-strstr.c12
-rw-r--r--tests/test-canonicalize-lgpl.c12
-rw-r--r--tests/test-carray_list.c12
-rw-r--r--tests/test-fbufmode.c12
-rw-r--r--tests/test-fprintf-posix.c12
-rw-r--r--tests/test-fpurge.c12
-rw-r--r--tests/test-freadable.c12
-rw-r--r--tests/test-freading.c12
-rw-r--r--tests/test-frexp.c12
-rw-r--r--tests/test-frexpl.c12
-rw-r--r--tests/test-fwritable.c12
-rw-r--r--tests/test-fwriting.c12
-rw-r--r--tests/test-iconv.c12
-rw-r--r--tests/test-isnan.c12
-rw-r--r--tests/test-isnanf.c12
-rw-r--r--tests/test-isnanl.h12
-rw-r--r--tests/test-ldexpl.c12
-rw-r--r--tests/test-linked_list.c12
-rw-r--r--tests/test-linkedhash_list.c12
-rw-r--r--tests/test-mbscasecmp.c12
-rw-r--r--tests/test-mbscasestr1.c12
-rw-r--r--tests/test-mbscasestr2.c12
-rw-r--r--tests/test-mbscasestr3.c12
-rw-r--r--tests/test-mbscasestr4.c12
-rw-r--r--tests/test-mbschr.c12
-rw-r--r--tests/test-mbscspn.c12
-rw-r--r--tests/test-mbsncasecmp.c12
-rw-r--r--tests/test-mbspbrk.c12
-rw-r--r--tests/test-mbspcasecmp.c12
-rw-r--r--tests/test-mbsrchr.c12
-rw-r--r--tests/test-mbsspn.c12
-rw-r--r--tests/test-mbsstr1.c12
-rw-r--r--tests/test-mbsstr2.c12
-rw-r--r--tests/test-mbsstr3.c12
-rw-r--r--tests/test-printf-frexp.c12
-rw-r--r--tests/test-printf-frexpl.c12
-rw-r--r--tests/test-printf-posix.c12
-rw-r--r--tests/test-rbtree_list.c12
-rw-r--r--tests/test-rbtree_oset.c12
-rw-r--r--tests/test-rbtreehash_list.c12
-rw-r--r--tests/test-signbit.c12
-rw-r--r--tests/test-snprintf-posix.c12
-rw-r--r--tests/test-snprintf.c11
-rw-r--r--tests/test-sprintf-posix.c12
-rw-r--r--tests/test-stat-time.c11
-rw-r--r--tests/test-strcasestr.c12
-rw-r--r--tests/test-striconv.c12
-rw-r--r--tests/test-striconveh.c12
-rw-r--r--tests/test-striconveha.c12
-rw-r--r--tests/test-vasnprintf-posix.c12
-rw-r--r--tests/test-vasnprintf-posix2.c12
-rw-r--r--tests/test-vasnprintf.c12
-rw-r--r--tests/test-vasprintf-posix.c12
-rw-r--r--tests/test-vasprintf.c11
-rw-r--r--tests/test-vfprintf-posix.c12
-rw-r--r--tests/test-vprintf-posix.c12
-rw-r--r--tests/test-vsnprintf-posix.c12
-rw-r--r--tests/test-vsnprintf.c11
-rw-r--r--tests/test-vsprintf-posix.c12
-rw-r--r--tests/test-xvasprintf.c12
-rw-r--r--tests/uniconv/test-u16-conv-from-enc.c12
-rw-r--r--tests/uniconv/test-u16-strconv-from-enc.c12
-rw-r--r--tests/uniconv/test-u16-strconv-to-enc.c12
-rw-r--r--tests/uniconv/test-u32-conv-from-enc.c12
-rw-r--r--tests/uniconv/test-u32-strconv-from-enc.c12
-rw-r--r--tests/uniconv/test-u32-strconv-to-enc.c12
-rw-r--r--tests/uniconv/test-u8-conv-from-enc.c12
-rw-r--r--tests/uniconv/test-u8-strconv-from-enc.c12
-rw-r--r--tests/uniconv/test-u8-strconv-to-enc.c12
81 files changed, 887 insertions, 82 deletions
diff --git a/tests/test-argmatch.c b/tests/test-argmatch.c
index c37fc5dc69..e61b88fcce 100644
--- a/tests/test-argmatch.c
+++ b/tests/test-argmatch.c
@@ -24,11 +24,21 @@
#include "argmatch.h"
+#include <stdio.h>
#include <stdlib.h>
#include "progname.h"
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
enum backup_type
{
diff --git a/tests/test-array_list.c b/tests/test-array_list.c
index b9de7cef0d..1d831f9a35 100644
--- a/tests/test-array_list.c
+++ b/tests/test-array_list.c
@@ -22,6 +22,7 @@
#include "gl_array_list.h"
+#include <stdio.h>
#include <stdlib.h>
#include "progname.h"
@@ -32,7 +33,16 @@ static const char *objects[15] =
};
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
-#define ASSERT(condition) if (!(condition)) abort ()
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
#define RANDOM(n) (rand () % (n))
#define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))]
diff --git a/tests/test-array_oset.c b/tests/test-array_oset.c
index 646e90842a..a7d1f001da 100644
--- a/tests/test-array_oset.c
+++ b/tests/test-array_oset.c
@@ -22,6 +22,7 @@
#include "gl_array_oset.h"
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -35,7 +36,16 @@ static const char *objects[30] =
};
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
-#define ASSERT(condition) if (!(condition)) abort ()
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
#define RANDOM(n) (rand () % (n))
#define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))]
diff --git a/tests/test-avltree_list.c b/tests/test-avltree_list.c
index af608cef8e..8105c8ee4b 100644
--- a/tests/test-avltree_list.c
+++ b/tests/test-avltree_list.c
@@ -22,6 +22,7 @@
#include "gl_avltree_list.h"
+#include <stdio.h>
#include <stdlib.h>
#include "gl_array_list.h"
@@ -35,7 +36,16 @@ static const char *objects[15] =
};
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
-#define ASSERT(condition) if (!(condition)) abort ()
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
#define RANDOM(n) (rand () % (n))
#define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))]
diff --git a/tests/test-avltree_oset.c b/tests/test-avltree_oset.c
index c7991359d2..e901774504 100644
--- a/tests/test-avltree_oset.c
+++ b/tests/test-avltree_oset.c
@@ -22,6 +22,7 @@
#include "gl_avltree_oset.h"
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -37,7 +38,16 @@ static const char *objects[30] =
};
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
-#define ASSERT(condition) if (!(condition)) abort ()
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
#define RANDOM(n) (rand () % (n))
#define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))]
diff --git a/tests/test-avltreehash_list.c b/tests/test-avltreehash_list.c
index f5ea129901..65ab49a999 100644
--- a/tests/test-avltreehash_list.c
+++ b/tests/test-avltreehash_list.c
@@ -23,6 +23,7 @@
#include "gl_avltreehash_list.h"
#include <limits.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -62,7 +63,16 @@ string_hash (const void *x)
}
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
-#define ASSERT(condition) if (!(condition)) abort ()
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
#define RANDOM(n) (rand () % (n))
#define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))]
diff --git a/tests/test-binary-io.c b/tests/test-binary-io.c
index 718a66e54f..677db703ea 100644
--- a/tests/test-binary-io.c
+++ b/tests/test-binary-io.c
@@ -30,7 +30,16 @@
#include <stdlib.h>
#include <unistd.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main ()
diff --git a/tests/test-byteswap.c b/tests/test-byteswap.c
index 5f9a5a3710..97c7c5ebb4 100644
--- a/tests/test-byteswap.c
+++ b/tests/test-byteswap.c
@@ -21,9 +21,19 @@
#include <byteswap.h>
+#include <stdio.h>
#include <stdlib.h>
-#define ASSERT(condition) if (!(condition)) abort ()
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main ()
diff --git a/tests/test-c-ctype.c b/tests/test-c-ctype.c
index c8318329a5..e691ba2e69 100644
--- a/tests/test-c-ctype.c
+++ b/tests/test-c-ctype.c
@@ -1,5 +1,5 @@
/* Test of character handling in C locale.
- Copyright (C) 2005 Free Software Foundation, Inc.
+ Copyright (C) 2005, 2007 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -24,9 +24,19 @@
#include "c-ctype.h"
#include <locale.h>
+#include <stdio.h>
#include <stdlib.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
static void
test_all (void)
diff --git a/tests/test-c-strcasecmp.c b/tests/test-c-strcasecmp.c
index 5c153c9afd..2fa0f5981d 100644
--- a/tests/test-c-strcasecmp.c
+++ b/tests/test-c-strcasecmp.c
@@ -24,10 +24,20 @@
#include "c-strcase.h"
#include <locale.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main (int argc, char *argv[])
diff --git a/tests/test-c-strcasestr.c b/tests/test-c-strcasestr.c
index a457e5d8c4..427653b54a 100644
--- a/tests/test-c-strcasestr.c
+++ b/tests/test-c-strcasestr.c
@@ -23,10 +23,20 @@
#include "c-strcasestr.h"
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main ()
diff --git a/tests/test-c-strncasecmp.c b/tests/test-c-strncasecmp.c
index 24b00a86e4..76a003e815 100644
--- a/tests/test-c-strncasecmp.c
+++ b/tests/test-c-strncasecmp.c
@@ -24,10 +24,20 @@
#include "c-strcase.h"
#include <locale.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main (int argc, char *argv[])
diff --git a/tests/test-c-strstr.c b/tests/test-c-strstr.c
index 98138bab85..204e0a5fed 100644
--- a/tests/test-c-strstr.c
+++ b/tests/test-c-strstr.c
@@ -23,10 +23,20 @@
#include "c-strstr.h"
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main ()
diff --git a/tests/test-canonicalize-lgpl.c b/tests/test-canonicalize-lgpl.c
index c5eee8db4d..738482b2bc 100644
--- a/tests/test-canonicalize-lgpl.c
+++ b/tests/test-canonicalize-lgpl.c
@@ -23,10 +23,20 @@
#include "canonicalize.h"
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main ()
diff --git a/tests/test-carray_list.c b/tests/test-carray_list.c
index 4aeece9329..3234baf3f6 100644
--- a/tests/test-carray_list.c
+++ b/tests/test-carray_list.c
@@ -22,6 +22,7 @@
#include "gl_carray_list.h"
+#include <stdio.h>
#include <stdlib.h>
#include "gl_array_list.h"
@@ -33,7 +34,16 @@ static const char *objects[15] =
};
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
-#define ASSERT(condition) if (!(condition)) abort ()
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
#define RANDOM(n) (rand () % (n))
#define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))]
diff --git a/tests/test-fbufmode.c b/tests/test-fbufmode.c
index cbdf29d7fe..044d872b36 100644
--- a/tests/test-fbufmode.c
+++ b/tests/test-fbufmode.c
@@ -21,9 +21,19 @@
#include "fbufmode.h"
+#include <stdio.h>
#include <stdlib.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
#define TESTFILE "t-fbufmode.tmp"
diff --git a/tests/test-fprintf-posix.c b/tests/test-fprintf-posix.c
index 00402f6db0..eaf093104d 100644
--- a/tests/test-fprintf-posix.c
+++ b/tests/test-fprintf-posix.c
@@ -25,11 +25,21 @@
#include <stdarg.h>
#include <stddef.h>
+#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
#include "test-fprintf-posix.h"
diff --git a/tests/test-fpurge.c b/tests/test-fpurge.c
index b7bac0b6a2..4aadf7f4bf 100644
--- a/tests/test-fpurge.c
+++ b/tests/test-fpurge.c
@@ -21,10 +21,20 @@
#include "fpurge.h"
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
#define TESTFILE "t-fpurge.tmp"
diff --git a/tests/test-freadable.c b/tests/test-freadable.c
index 6d15583ca7..5fb9f3ba29 100644
--- a/tests/test-freadable.c
+++ b/tests/test-freadable.c
@@ -21,9 +21,19 @@
#include "freadable.h"
+#include <stdio.h>
#include <stdlib.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
#define TESTFILE "t-freadable.tmp"
diff --git a/tests/test-freading.c b/tests/test-freading.c
index b2f6fc7b07..1a38b9e44e 100644
--- a/tests/test-freading.c
+++ b/tests/test-freading.c
@@ -21,9 +21,19 @@
#include "freading.h"
+#include <stdio.h>
#include <stdlib.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
#define TESTFILE "t-freading.tmp"
diff --git a/tests/test-frexp.c b/tests/test-frexp.c
index 7d2a2758ee..9ce989b06d 100644
--- a/tests/test-frexp.c
+++ b/tests/test-frexp.c
@@ -22,11 +22,21 @@
#include <math.h>
#include <float.h>
+#include <stdio.h>
#include <stdlib.h>
#include "isnan.h"
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */
#ifdef __DECC
diff --git a/tests/test-frexpl.c b/tests/test-frexpl.c
index fd2c7e0792..93cfa14434 100644
--- a/tests/test-frexpl.c
+++ b/tests/test-frexpl.c
@@ -22,12 +22,22 @@
#include <math.h>
#include <float.h>
+#include <stdio.h>
#include <stdlib.h>
#include "fpucw.h"
#include "isnanl-nolibm.h"
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
/* On MIPS IRIX machines, LDBL_MIN_EXP is -1021, but the smallest reliable
exponent for 'long double' is -964. For exponents below that, the
diff --git a/tests/test-fwritable.c b/tests/test-fwritable.c
index c3b71ecf3b..29bcee942f 100644
--- a/tests/test-fwritable.c
+++ b/tests/test-fwritable.c
@@ -21,9 +21,19 @@
#include "fwritable.h"
+#include <stdio.h>
#include <stdlib.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
#define TESTFILE "t-fwritable.tmp"
diff --git a/tests/test-fwriting.c b/tests/test-fwriting.c
index 0f97df5ccf..a162130463 100644
--- a/tests/test-fwriting.c
+++ b/tests/test-fwriting.c
@@ -21,9 +21,19 @@
#include "fwriting.h"
+#include <stdio.h>
#include <stdlib.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
#define TESTFILE "t-fwriting.tmp"
diff --git a/tests/test-iconv.c b/tests/test-iconv.c
index 00157dad13..520b96b5a3 100644
--- a/tests/test-iconv.c
+++ b/tests/test-iconv.c
@@ -26,10 +26,20 @@
#endif
#include <errno.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main ()
diff --git a/tests/test-isnan.c b/tests/test-isnan.c
index 0897a55b32..c23b377a22 100644
--- a/tests/test-isnan.c
+++ b/tests/test-isnan.c
@@ -22,9 +22,19 @@
#include "isnan.h"
#include <limits.h>
+#include <stdio.h>
#include <stdlib.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */
#ifdef __DECC
diff --git a/tests/test-isnanf.c b/tests/test-isnanf.c
index 0fafeade10..428c237729 100644
--- a/tests/test-isnanf.c
+++ b/tests/test-isnanf.c
@@ -22,9 +22,19 @@
#include "isnanf.h"
#include <limits.h>
+#include <stdio.h>
#include <stdlib.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */
#ifdef __DECC
diff --git a/tests/test-isnanl.h b/tests/test-isnanl.h
index 0dab89908a..0b3e2f84a3 100644
--- a/tests/test-isnanl.h
+++ b/tests/test-isnanl.h
@@ -18,9 +18,19 @@
/* Written by Bruno Haible <bruno@clisp.org>, 2007. */
#include <limits.h>
+#include <stdio.h>
#include <stdlib.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main ()
diff --git a/tests/test-ldexpl.c b/tests/test-ldexpl.c
index c4f35811ab..97bac54f54 100644
--- a/tests/test-ldexpl.c
+++ b/tests/test-ldexpl.c
@@ -22,12 +22,22 @@
#include <math.h>
#include <float.h>
+#include <stdio.h>
#include <stdlib.h>
#include "fpucw.h"
#include "isnanl-nolibm.h"
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main ()
diff --git a/tests/test-linked_list.c b/tests/test-linked_list.c
index 059b2eef6e..71d96c164e 100644
--- a/tests/test-linked_list.c
+++ b/tests/test-linked_list.c
@@ -22,6 +22,7 @@
#include "gl_linked_list.h"
+#include <stdio.h>
#include <stdlib.h>
#include "gl_array_list.h"
@@ -33,7 +34,16 @@ static const char *objects[15] =
};
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
-#define ASSERT(condition) if (!(condition)) abort ()
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
#define RANDOM(n) (rand () % (n))
#define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))]
diff --git a/tests/test-linkedhash_list.c b/tests/test-linkedhash_list.c
index 22b67b330e..765811ac7f 100644
--- a/tests/test-linkedhash_list.c
+++ b/tests/test-linkedhash_list.c
@@ -23,6 +23,7 @@
#include "gl_linkedhash_list.h"
#include <limits.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -60,7 +61,16 @@ string_hash (const void *x)
}
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
-#define ASSERT(condition) if (!(condition)) abort ()
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
#define RANDOM(n) (rand () % (n))
#define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))]
diff --git a/tests/test-mbscasecmp.c b/tests/test-mbscasecmp.c
index 5fd1127147..f4d8e859c9 100644
--- a/tests/test-mbscasecmp.c
+++ b/tests/test-mbscasecmp.c
@@ -24,9 +24,19 @@
#include <string.h>
#include <locale.h>
+#include <stdio.h>
#include <stdlib.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main ()
diff --git a/tests/test-mbscasestr1.c b/tests/test-mbscasestr1.c
index 87f2605c0f..1e65856770 100644
--- a/tests/test-mbscasestr1.c
+++ b/tests/test-mbscasestr1.c
@@ -23,9 +23,19 @@
#include <string.h>
+#include <stdio.h>
#include <stdlib.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main ()
diff --git a/tests/test-mbscasestr2.c b/tests/test-mbscasestr2.c
index fc7dca6e84..548818756b 100644
--- a/tests/test-mbscasestr2.c
+++ b/tests/test-mbscasestr2.c
@@ -24,9 +24,19 @@
#include <string.h>
#include <locale.h>
+#include <stdio.h>
#include <stdlib.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main ()
diff --git a/tests/test-mbscasestr3.c b/tests/test-mbscasestr3.c
index 935e457528..24ace449b1 100644
--- a/tests/test-mbscasestr3.c
+++ b/tests/test-mbscasestr3.c
@@ -24,9 +24,19 @@
#include <string.h>
#include <locale.h>
+#include <stdio.h>
#include <stdlib.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main ()
diff --git a/tests/test-mbscasestr4.c b/tests/test-mbscasestr4.c
index ef0c26d410..146b3fe5c4 100644
--- a/tests/test-mbscasestr4.c
+++ b/tests/test-mbscasestr4.c
@@ -24,9 +24,19 @@
#include <string.h>
#include <locale.h>
+#include <stdio.h>
#include <stdlib.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main ()
diff --git a/tests/test-mbschr.c b/tests/test-mbschr.c
index 33f4612738..bf29ee8cbc 100644
--- a/tests/test-mbschr.c
+++ b/tests/test-mbschr.c
@@ -24,9 +24,19 @@
#include <string.h>
#include <locale.h>
+#include <stdio.h>
#include <stdlib.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main ()
diff --git a/tests/test-mbscspn.c b/tests/test-mbscspn.c
index 62a29e30a5..4403927a7f 100644
--- a/tests/test-mbscspn.c
+++ b/tests/test-mbscspn.c
@@ -24,9 +24,19 @@
#include <string.h>
#include <locale.h>
+#include <stdio.h>
#include <stdlib.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main ()
diff --git a/tests/test-mbsncasecmp.c b/tests/test-mbsncasecmp.c
index 2a6ffdfda8..6170dffc66 100644
--- a/tests/test-mbsncasecmp.c
+++ b/tests/test-mbsncasecmp.c
@@ -24,9 +24,19 @@
#include <string.h>
#include <locale.h>
+#include <stdio.h>
#include <stdlib.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main ()
diff --git a/tests/test-mbspbrk.c b/tests/test-mbspbrk.c
index fb6be26428..a6a1404da8 100644
--- a/tests/test-mbspbrk.c
+++ b/tests/test-mbspbrk.c
@@ -24,9 +24,19 @@
#include <string.h>
#include <locale.h>
+#include <stdio.h>
#include <stdlib.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main ()
diff --git a/tests/test-mbspcasecmp.c b/tests/test-mbspcasecmp.c
index ad9e575844..5000dfce07 100644
--- a/tests/test-mbspcasecmp.c
+++ b/tests/test-mbspcasecmp.c
@@ -24,9 +24,19 @@
#include <string.h>
#include <locale.h>
+#include <stdio.h>
#include <stdlib.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main ()
diff --git a/tests/test-mbsrchr.c b/tests/test-mbsrchr.c
index 58cd6763f2..35b865c6cb 100644
--- a/tests/test-mbsrchr.c
+++ b/tests/test-mbsrchr.c
@@ -24,9 +24,19 @@
#include <string.h>
#include <locale.h>
+#include <stdio.h>
#include <stdlib.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main ()
diff --git a/tests/test-mbsspn.c b/tests/test-mbsspn.c
index cbd4da5a49..3170a6a941 100644
--- a/tests/test-mbsspn.c
+++ b/tests/test-mbsspn.c
@@ -24,9 +24,19 @@
#include <string.h>
#include <locale.h>
+#include <stdio.h>
#include <stdlib.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main ()
diff --git a/tests/test-mbsstr1.c b/tests/test-mbsstr1.c
index 549121206e..d1b079a712 100644
--- a/tests/test-mbsstr1.c
+++ b/tests/test-mbsstr1.c
@@ -23,9 +23,19 @@
#include <string.h>
+#include <stdio.h>
#include <stdlib.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main ()
diff --git a/tests/test-mbsstr2.c b/tests/test-mbsstr2.c
index 6aebf56af3..8ce3be7128 100644
--- a/tests/test-mbsstr2.c
+++ b/tests/test-mbsstr2.c
@@ -24,9 +24,19 @@
#include <string.h>
#include <locale.h>
+#include <stdio.h>
#include <stdlib.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main ()
diff --git a/tests/test-mbsstr3.c b/tests/test-mbsstr3.c
index 5461196b92..9f65520cd6 100644
--- a/tests/test-mbsstr3.c
+++ b/tests/test-mbsstr3.c
@@ -24,9 +24,19 @@
#include <string.h>
#include <locale.h>
+#include <stdio.h>
#include <stdlib.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main ()
diff --git a/tests/test-printf-frexp.c b/tests/test-printf-frexp.c
index b821e4613d..6940ceb965 100644
--- a/tests/test-printf-frexp.c
+++ b/tests/test-printf-frexp.c
@@ -22,9 +22,19 @@
#include "printf-frexp.h"
#include <float.h>
+#include <stdio.h>
#include <stdlib.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
static double
my_ldexp (double x, int d)
diff --git a/tests/test-printf-frexpl.c b/tests/test-printf-frexpl.c
index c57d2f81ae..fe481eec85 100644
--- a/tests/test-printf-frexpl.c
+++ b/tests/test-printf-frexpl.c
@@ -22,11 +22,21 @@
#include "printf-frexpl.h"
#include <float.h>
+#include <stdio.h>
#include <stdlib.h>
#include "fpucw.h"
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
/* On MIPS IRIX machines, LDBL_MIN_EXP is -1021, but the smallest reliable
exponent for 'long double' is -964. For exponents below that, the
diff --git a/tests/test-printf-posix.c b/tests/test-printf-posix.c
index d8e728a27b..e4d5e874d6 100644
--- a/tests/test-printf-posix.c
+++ b/tests/test-printf-posix.c
@@ -24,11 +24,21 @@
#include <stdio.h>
#include <stddef.h>
+#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
#include "test-printf-posix.h"
diff --git a/tests/test-rbtree_list.c b/tests/test-rbtree_list.c
index d6080c05e5..c8cd526aae 100644
--- a/tests/test-rbtree_list.c
+++ b/tests/test-rbtree_list.c
@@ -22,6 +22,7 @@
#include "gl_rbtree_list.h"
+#include <stdio.h>
#include <stdlib.h>
#include "gl_array_list.h"
@@ -35,7 +36,16 @@ static const char *objects[15] =
};
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
-#define ASSERT(condition) if (!(condition)) abort ()
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
#define RANDOM(n) (rand () % (n))
#define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))]
diff --git a/tests/test-rbtree_oset.c b/tests/test-rbtree_oset.c
index dd778bb02c..2ecb81f4a5 100644
--- a/tests/test-rbtree_oset.c
+++ b/tests/test-rbtree_oset.c
@@ -22,6 +22,7 @@
#include "gl_rbtree_oset.h"
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -37,7 +38,16 @@ static const char *objects[30] =
};
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
-#define ASSERT(condition) if (!(condition)) abort ()
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
#define RANDOM(n) (rand () % (n))
#define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))]
diff --git a/tests/test-rbtreehash_list.c b/tests/test-rbtreehash_list.c
index 7a0cf9665c..deb9cdef58 100644
--- a/tests/test-rbtreehash_list.c
+++ b/tests/test-rbtreehash_list.c
@@ -23,6 +23,7 @@
#include "gl_rbtreehash_list.h"
#include <limits.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -62,7 +63,16 @@ string_hash (const void *x)
}
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
-#define ASSERT(condition) if (!(condition)) abort ()
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
#define RANDOM(n) (rand () % (n))
#define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))]
diff --git a/tests/test-signbit.c b/tests/test-signbit.c
index 3a87c6489d..63b84eb7dc 100644
--- a/tests/test-signbit.c
+++ b/tests/test-signbit.c
@@ -22,9 +22,19 @@
#include <math.h>
#include <limits.h>
+#include <stdio.h>
#include <stdlib.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
float zerof = 0.0f;
double zerod = 0.0;
diff --git a/tests/test-snprintf-posix.c b/tests/test-snprintf-posix.c
index 3913515e48..bbdf3e351c 100644
--- a/tests/test-snprintf-posix.c
+++ b/tests/test-snprintf-posix.c
@@ -24,11 +24,21 @@
#include <stdio.h>
#include <stddef.h>
+#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
#include "test-snprintf-posix.h"
diff --git a/tests/test-snprintf.c b/tests/test-snprintf.c
index 7b3e9b49e8..c1235ef03c 100644
--- a/tests/test-snprintf.c
+++ b/tests/test-snprintf.c
@@ -26,7 +26,16 @@
#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main (int argc, char *argv[])
diff --git a/tests/test-sprintf-posix.c b/tests/test-sprintf-posix.c
index bca3b1c6d2..54e7117a7d 100644
--- a/tests/test-sprintf-posix.c
+++ b/tests/test-sprintf-posix.c
@@ -24,11 +24,21 @@
#include <stdio.h>
#include <stddef.h>
+#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
#include "test-sprintf-posix.h"
diff --git a/tests/test-stat-time.c b/tests/test-stat-time.c
index bf3e8dfe36..907ba4b909 100644
--- a/tests/test-stat-time.c
+++ b/tests/test-stat-time.c
@@ -28,7 +28,16 @@
#include <sys/stat.h>
#include <unistd.h>
-#define ASSERT(condition) if (!(condition)) abort ()
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
enum { NFILES = 4 };
diff --git a/tests/test-strcasestr.c b/tests/test-strcasestr.c
index 5ea0f4e792..3d18c06d37 100644
--- a/tests/test-strcasestr.c
+++ b/tests/test-strcasestr.c
@@ -23,9 +23,19 @@
#include <string.h>
+#include <stdio.h>
#include <stdlib.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main ()
diff --git a/tests/test-striconv.c b/tests/test-striconv.c
index 8fb662c808..90c2ed38de 100644
--- a/tests/test-striconv.c
+++ b/tests/test-striconv.c
@@ -28,10 +28,20 @@
#endif
#include <errno.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main ()
diff --git a/tests/test-striconveh.c b/tests/test-striconveh.c
index bb72662eaa..8810dfe3ed 100644
--- a/tests/test-striconveh.c
+++ b/tests/test-striconveh.c
@@ -28,11 +28,21 @@
#endif
#include <errno.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
/* Magic number for detecting bounds violations. */
#define MAGIC 0x1983EFF1
diff --git a/tests/test-striconveha.c b/tests/test-striconveha.c
index 3d833ac169..e3d120cc42 100644
--- a/tests/test-striconveha.c
+++ b/tests/test-striconveha.c
@@ -28,11 +28,21 @@
#endif
#include <errno.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
/* Magic number for detecting bounds violations. */
#define MAGIC 0x1983EFF1
diff --git a/tests/test-vasnprintf-posix.c b/tests/test-vasnprintf-posix.c
index a818655875..f08e1ad99f 100644
--- a/tests/test-vasnprintf-posix.c
+++ b/tests/test-vasnprintf-posix.c
@@ -25,11 +25,21 @@
#include <stdarg.h>
#include <stddef.h>
+#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */
#ifdef __DECC
diff --git a/tests/test-vasnprintf-posix2.c b/tests/test-vasnprintf-posix2.c
index eaa95b2114..aa68216cda 100644
--- a/tests/test-vasnprintf-posix2.c
+++ b/tests/test-vasnprintf-posix2.c
@@ -24,10 +24,20 @@
#include "vasnprintf.h"
#include <locale.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main (int argc, char *argv[])
diff --git a/tests/test-vasnprintf.c b/tests/test-vasnprintf.c
index cd901a9505..80a2543bbb 100644
--- a/tests/test-vasnprintf.c
+++ b/tests/test-vasnprintf.c
@@ -24,10 +24,20 @@
#include "vasnprintf.h"
#include <stdarg.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
static char *
my_asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...)
diff --git a/tests/test-vasprintf-posix.c b/tests/test-vasprintf-posix.c
index dad45d1437..40798ea2bb 100644
--- a/tests/test-vasprintf-posix.c
+++ b/tests/test-vasprintf-posix.c
@@ -25,11 +25,21 @@
#include <stdarg.h>
#include <stddef.h>
+#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
/* The Compaq (ex-DEC) C 6.4 compiler chokes on the expression 0.0 / 0.0. */
#ifdef __DECC
diff --git a/tests/test-vasprintf.c b/tests/test-vasprintf.c
index cae32d6ec4..70fca148ae 100644
--- a/tests/test-vasprintf.c
+++ b/tests/test-vasprintf.c
@@ -27,7 +27,16 @@
#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
static int
my_asprintf (char **result, const char *format, ...)
diff --git a/tests/test-vfprintf-posix.c b/tests/test-vfprintf-posix.c
index 67e50bcf80..95c3017f64 100644
--- a/tests/test-vfprintf-posix.c
+++ b/tests/test-vfprintf-posix.c
@@ -25,11 +25,21 @@
#include <stdarg.h>
#include <stddef.h>
+#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
static int
my_fprintf (FILE *fp, const char *format, ...)
diff --git a/tests/test-vprintf-posix.c b/tests/test-vprintf-posix.c
index 6f7f141d10..57b6740161 100644
--- a/tests/test-vprintf-posix.c
+++ b/tests/test-vprintf-posix.c
@@ -25,11 +25,21 @@
#include <stdarg.h>
#include <stddef.h>
+#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
static int
my_printf (const char *format, ...)
diff --git a/tests/test-vsnprintf-posix.c b/tests/test-vsnprintf-posix.c
index 052cd72666..097872f939 100644
--- a/tests/test-vsnprintf-posix.c
+++ b/tests/test-vsnprintf-posix.c
@@ -25,11 +25,21 @@
#include <stdarg.h>
#include <stddef.h>
+#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
static int
my_snprintf (char *str, size_t size, const char *format, ...)
diff --git a/tests/test-vsnprintf.c b/tests/test-vsnprintf.c
index ccc9e5a703..a8ed6ec7c7 100644
--- a/tests/test-vsnprintf.c
+++ b/tests/test-vsnprintf.c
@@ -27,7 +27,16 @@
#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
static int
my_snprintf (char *buf, int size, const char *format, ...)
diff --git a/tests/test-vsprintf-posix.c b/tests/test-vsprintf-posix.c
index 43c7196bf7..20cc4b2a0f 100644
--- a/tests/test-vsprintf-posix.c
+++ b/tests/test-vsprintf-posix.c
@@ -25,11 +25,21 @@
#include <stdarg.h>
#include <stddef.h>
+#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
static int
my_sprintf (char *str, const char *format, ...)
diff --git a/tests/test-xvasprintf.c b/tests/test-xvasprintf.c
index a07864c707..41e22e47b2 100644
--- a/tests/test-xvasprintf.c
+++ b/tests/test-xvasprintf.c
@@ -24,12 +24,22 @@
#include "xvasprintf.h"
#include <stdarg.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "progname.h"
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
static char *
my_xasprintf (const char *format, ...)
diff --git a/tests/uniconv/test-u16-conv-from-enc.c b/tests/uniconv/test-u16-conv-from-enc.c
index 506af0ec70..02ce137207 100644
--- a/tests/uniconv/test-u16-conv-from-enc.c
+++ b/tests/uniconv/test-u16-conv-from-enc.c
@@ -23,13 +23,23 @@
#include "uniconv.h"
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "unistr.h"
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
/* Magic number for detecting bounds violations. */
#define MAGIC 0x1983EFF1
diff --git a/tests/uniconv/test-u16-strconv-from-enc.c b/tests/uniconv/test-u16-strconv-from-enc.c
index ea805d67b7..32e482b8d5 100644
--- a/tests/uniconv/test-u16-strconv-from-enc.c
+++ b/tests/uniconv/test-u16-strconv-from-enc.c
@@ -23,12 +23,22 @@
#include "uniconv.h"
+#include <stdio.h>
#include <stdlib.h>
#include "unistr.h"
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main ()
diff --git a/tests/uniconv/test-u16-strconv-to-enc.c b/tests/uniconv/test-u16-strconv-to-enc.c
index c8b9df0aac..35a8eb7b96 100644
--- a/tests/uniconv/test-u16-strconv-to-enc.c
+++ b/tests/uniconv/test-u16-strconv-to-enc.c
@@ -24,11 +24,21 @@
#include "uniconv.h"
#include <errno.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main ()
diff --git a/tests/uniconv/test-u32-conv-from-enc.c b/tests/uniconv/test-u32-conv-from-enc.c
index 3226767ba2..5bf5e14e6c 100644
--- a/tests/uniconv/test-u32-conv-from-enc.c
+++ b/tests/uniconv/test-u32-conv-from-enc.c
@@ -23,13 +23,23 @@
#include "uniconv.h"
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "unistr.h"
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
/* Magic number for detecting bounds violations. */
#define MAGIC 0x1983EFF1
diff --git a/tests/uniconv/test-u32-strconv-from-enc.c b/tests/uniconv/test-u32-strconv-from-enc.c
index ab8b86c147..b7c02d826e 100644
--- a/tests/uniconv/test-u32-strconv-from-enc.c
+++ b/tests/uniconv/test-u32-strconv-from-enc.c
@@ -23,12 +23,22 @@
#include "uniconv.h"
+#include <stdio.h>
#include <stdlib.h>
#include "unistr.h"
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main ()
diff --git a/tests/uniconv/test-u32-strconv-to-enc.c b/tests/uniconv/test-u32-strconv-to-enc.c
index 6d65886724..0173370ce0 100644
--- a/tests/uniconv/test-u32-strconv-to-enc.c
+++ b/tests/uniconv/test-u32-strconv-to-enc.c
@@ -24,11 +24,21 @@
#include "uniconv.h"
#include <errno.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main ()
diff --git a/tests/uniconv/test-u8-conv-from-enc.c b/tests/uniconv/test-u8-conv-from-enc.c
index e74bc5893d..95cd1003d9 100644
--- a/tests/uniconv/test-u8-conv-from-enc.c
+++ b/tests/uniconv/test-u8-conv-from-enc.c
@@ -23,13 +23,23 @@
#include "uniconv.h"
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "unistr.h"
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
/* Magic number for detecting bounds violations. */
#define MAGIC 0x1983EFF1
diff --git a/tests/uniconv/test-u8-strconv-from-enc.c b/tests/uniconv/test-u8-strconv-from-enc.c
index 2d640992e0..2a937cc485 100644
--- a/tests/uniconv/test-u8-strconv-from-enc.c
+++ b/tests/uniconv/test-u8-strconv-from-enc.c
@@ -23,12 +23,22 @@
#include "uniconv.h"
+#include <stdio.h>
#include <stdlib.h>
#include "unistr.h"
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main ()
diff --git a/tests/uniconv/test-u8-strconv-to-enc.c b/tests/uniconv/test-u8-strconv-to-enc.c
index e03582fb7b..86550f5c22 100644
--- a/tests/uniconv/test-u8-strconv-to-enc.c
+++ b/tests/uniconv/test-u8-strconv-to-enc.c
@@ -24,11 +24,21 @@
#include "uniconv.h"
#include <errno.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define SIZEOF(array) (sizeof (array) / sizeof (array[0]))
-#define ASSERT(expr) if (!(expr)) abort ();
+#define ASSERT(expr) \
+ do \
+ { \
+ if (!(expr)) \
+ { \
+ fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \
+ abort (); \
+ } \
+ } \
+ while (0)
int
main ()