diff options
author | Bruno Haible <bruno@clisp.org> | 2009-12-24 21:01:42 +0100 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2009-12-24 21:01:42 +0100 |
commit | 987e5651e8d1c5aa933c9ce88562806af4093702 (patch) | |
tree | 4a7d023ba4f5f6c20bc5a1b68ab678e934afc4b0 /tests | |
parent | effbadc5cdd5c424f97367d66297e0e2aa057d63 (diff) | |
download | gnulib-987e5651e8d1c5aa933c9ce88562806af4093702.tar.gz |
Refactor common macros used in tests.
Diffstat (limited to 'tests')
377 files changed, 568 insertions, 5093 deletions
diff --git a/tests/macros.h b/tests/macros.h new file mode 100644 index 0000000000..dc55fbe02e --- /dev/null +++ b/tests/macros.h @@ -0,0 +1,56 @@ +/* Common macros used by gnulib tests. + Copyright (C) 2006-2009 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 + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. */ + + +/* This file contains macros that are used by many gnulib tests. + Put here only frequently used macros, say, used by 10 tests or more. */ + +#include <stdio.h> +#include <stdlib.h> + +/* ASSERT (condition); + verifies that the specified condition is fulfilled. If not, a message + is printed to stderr and the program is terminated with an error code. + + This macro has the following properties: + - The programmer specifies the expected condition, not the failure + condition. This simplifies thinking. + - The condition is tested always, regardless of compilation flags. + (Unlike the macro from <assert.h>.) + - On Unix platforms, the tester can debug the test program with a + debugger (provided core dumps are enabled: "ulimit -c unlimited"). + - For the sake of platforms where no debugger is available (such as + some mingw systems), an error message is printed on stderr that + includes the source location of the ASSERT invocation. + */ +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + fflush (stderr); \ + abort (); \ + } \ + } \ + while (0) + +/* SIZEOF (array) + returns the number of elements of an array. It works for arrays that are + declared outside functions and for local variables of array type. It does + *not* work for function parameters of array type, because they are actually + parameters of pointer type. */ +#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) diff --git a/tests/test-areadlink-with-size.c b/tests/test-areadlink-with-size.c index ff50f89d68..8b7ff63ec5 100644 --- a/tests/test-areadlink-with-size.c +++ b/tests/test-areadlink-with-size.c @@ -29,17 +29,7 @@ #include <sys/stat.h> #include <unistd.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-areadlink-with-size.t" diff --git a/tests/test-areadlink.c b/tests/test-areadlink.c index 9a3692714a..2e8aaa5fb7 100644 --- a/tests/test-areadlink.c +++ b/tests/test-areadlink.c @@ -29,17 +29,7 @@ #include <sys/stat.h> #include <unistd.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-areadlink.t" diff --git a/tests/test-areadlinkat-with-size.c b/tests/test-areadlinkat-with-size.c index 55ab78e6e9..67252a7fc0 100644 --- a/tests/test-areadlinkat-with-size.c +++ b/tests/test-areadlinkat-with-size.c @@ -29,17 +29,7 @@ #include <sys/stat.h> #include <unistd.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-areadlinkat-with-size.t" diff --git a/tests/test-areadlinkat.c b/tests/test-areadlinkat.c index f5deb7073d..54e0745c78 100644 --- a/tests/test-areadlinkat.c +++ b/tests/test-areadlinkat.c @@ -29,17 +29,7 @@ #include <sys/stat.h> #include <unistd.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-areadlinkat.t" diff --git a/tests/test-argmatch.c b/tests/test-argmatch.c index c7f157fdb4..5851842a5a 100644 --- a/tests/test-argmatch.c +++ b/tests/test-argmatch.c @@ -1,5 +1,5 @@ /* Test of exact or abbreviated match search. - Copyright (C) 1990, 1998-1999, 2001-2008 Free Software Foundation, Inc. + Copyright (C) 1990, 1998-1999, 2001-2009 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 @@ -21,22 +21,10 @@ #include "argmatch.h" -#include <stdio.h> #include <stdlib.h> #include "progname.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Some packages define ARGMATCH_DIE and ARGMATCH_DIE_DECL in <config.h>, and thus must link with a definition of that function. Provide it here. */ diff --git a/tests/test-argv-iter.c b/tests/test-argv-iter.c index fffa425c7f..10159ac6b4 100644 --- a/tests/test-argv-iter.c +++ b/tests/test-argv-iter.c @@ -20,23 +20,13 @@ #include "argv-iter.h" -#include <stdlib.h> #include <stdio.h> #include <string.h> +#include "macros.h" + #define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array)) #define STREQ(s1, s2) (strcmp (s1, s2) == 0) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) static FILE * write_nul_delimited_argv (char **argv) diff --git a/tests/test-array-mergesort.c b/tests/test-array-mergesort.c index 684231d238..fccd8f1c66 100644 --- a/tests/test-array-mergesort.c +++ b/tests/test-array-mergesort.c @@ -24,20 +24,9 @@ struct foo { double x; double index; }; #define STATIC static #include "array-mergesort.h" -#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define NMAX 257 static const struct foo data[NMAX] = diff --git a/tests/test-array_list.c b/tests/test-array_list.c index 2f33d4c573..3a8fad0d14 100644 --- a/tests/test-array_list.c +++ b/tests/test-array_list.c @@ -19,28 +19,16 @@ #include "gl_array_list.h" -#include <stdio.h> #include <stdlib.h> #include "progname.h" +#include "macros.h" static const char *objects[15] = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o" }; -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - 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 f79d1620bb..15cec4182e 100644 --- a/tests/test-array_oset.c +++ b/tests/test-array_oset.c @@ -19,13 +19,13 @@ #include "gl_array_oset.h" -#include <stdio.h> #include <stdlib.h> #include <string.h> #include "gl_xlist.h" #include "gl_array_list.h" #include "progname.h" +#include "macros.h" static const char *objects[30] = { @@ -33,18 +33,6 @@ static const char *objects[30] = "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "<", ">", "[", "]" }; -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - 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 4047ff64ac..6cd78f147c 100644 --- a/tests/test-avltree_list.c +++ b/tests/test-avltree_list.c @@ -19,11 +19,11 @@ #include "gl_avltree_list.h" -#include <stdio.h> #include <stdlib.h> #include "gl_array_list.h" #include "progname.h" +#include "macros.h" extern void gl_avltree_list_check_invariants (gl_list_t list); @@ -32,18 +32,6 @@ static const char *objects[15] = "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o" }; -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - 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 c07281ae4a..a37b3329e7 100644 --- a/tests/test-avltree_oset.c +++ b/tests/test-avltree_oset.c @@ -19,12 +19,12 @@ #include "gl_avltree_oset.h" -#include <stdio.h> #include <stdlib.h> #include <string.h> #include "gl_array_oset.h" #include "progname.h" +#include "macros.h" extern void gl_avltree_oset_check_invariants (gl_oset_t set); @@ -34,18 +34,6 @@ static const char *objects[30] = "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "<", ">", "[", "]" }; -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - 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 12a716ade6..4306040a26 100644 --- a/tests/test-avltreehash_list.c +++ b/tests/test-avltreehash_list.c @@ -20,12 +20,12 @@ #include "gl_avltreehash_list.h" #include <limits.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> #include "gl_array_list.h" #include "progname.h" +#include "macros.h" extern void gl_avltreehash_list_check_invariants (gl_list_t list); @@ -59,18 +59,6 @@ string_hash (const void *x) return h; } -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) #define RANDOM(n) (rand () % (n)) #define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))] diff --git a/tests/test-base64.c b/tests/test-base64.c index 2a2a4f522f..251b042de0 100644 --- a/tests/test-base64.c +++ b/tests/test-base64.c @@ -20,23 +20,12 @@ #include "base64.h" #include <stddef.h> -#include <stdio.h> #include <stdbool.h> #include <stdlib.h> #include <string.h> #include <stdint.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (void) diff --git a/tests/test-binary-io.c b/tests/test-binary-io.c index 335989fc03..5410b41f7f 100644 --- a/tests/test-binary-io.c +++ b/tests/test-binary-io.c @@ -1,5 +1,5 @@ /* Test of binary mode I/O. - Copyright (C) 2005, 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2005, 2007-2009 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 @@ -27,17 +27,7 @@ #include <stdlib.h> #include <unistd.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/test-bitrotate.c b/tests/test-bitrotate.c index db26ef827c..0838a38436 100644 --- a/tests/test-bitrotate.c +++ b/tests/test-bitrotate.c @@ -20,21 +20,7 @@ #include "bitrotate.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", \ - __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (void) diff --git a/tests/test-btowc.c b/tests/test-btowc.c index 4a19553310..eb959ae46b 100644 --- a/tests/test-btowc.c +++ b/tests/test-btowc.c @@ -25,19 +25,8 @@ SIGNATURE_CHECK (btowc, wint_t, (int)); #include <locale.h> #include <stdio.h> -#include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char *argv[]) diff --git a/tests/test-byteswap.c b/tests/test-byteswap.c index 55de36bf0d..6f93b6d7d7 100644 --- a/tests/test-byteswap.c +++ b/tests/test-byteswap.c @@ -1,5 +1,5 @@ /* Test of <byteswap.h> substitute. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -20,20 +20,7 @@ #include <byteswap.h> -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/test-c-ctype.c b/tests/test-c-ctype.c index e04de2ef9c..9580966192 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, 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2005, 2007-2009 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 @@ -21,20 +21,8 @@ #include "c-ctype.h" #include <locale.h> -#include <stdio.h> -#include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void test_all (void) diff --git a/tests/test-c-stack.c b/tests/test-c-stack.c index b5ff6be650..56b2c16c18 100644 --- a/tests/test-c-stack.c +++ b/tests/test-c-stack.c @@ -1,5 +1,5 @@ /* Test of c-stack module. - Copyright (C) 2002, 2004, 2006, 2008 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2006, 2008-2009 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 @@ -20,7 +20,6 @@ #include "exitfail.h" #include <stdio.h> -#include <stdlib.h> #if HAVE_SETRLIMIT /* At least FreeBSD 5.0 needs extra headers before <sys/resource.h> will compile. */ @@ -29,17 +28,7 @@ # include <sys/resource.h> #endif -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" char *program_name; diff --git a/tests/test-c-strcasecmp.c b/tests/test-c-strcasecmp.c index e0c23685d4..cfa5e127bd 100644 --- a/tests/test-c-strcasecmp.c +++ b/tests/test-c-strcasecmp.c @@ -1,5 +1,5 @@ /* Test of case-insensitive string comparison function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -21,21 +21,9 @@ #include "c-strcase.h" #include <locale.h> -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char *argv[]) diff --git a/tests/test-c-strcasestr.c b/tests/test-c-strcasestr.c index 0c8a40db5e..905d546e95 100644 --- a/tests/test-c-strcasestr.c +++ b/tests/test-c-strcasestr.c @@ -1,5 +1,5 @@ /* Test of case-insensitive searching in a string. - Copyright (C) 2007, 2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -20,21 +20,10 @@ #include "c-strcasestr.h" -#include <stdio.h> #include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/test-c-strncasecmp.c b/tests/test-c-strncasecmp.c index fb5f220035..b993cf9831 100644 --- a/tests/test-c-strncasecmp.c +++ b/tests/test-c-strncasecmp.c @@ -1,5 +1,5 @@ /* Test of case-insensitive string comparison function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -21,21 +21,9 @@ #include "c-strcase.h" #include <locale.h> -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char *argv[]) diff --git a/tests/test-c-strstr.c b/tests/test-c-strstr.c index 2b2ebf91cc..b5dbb55a26 100644 --- a/tests/test-c-strstr.c +++ b/tests/test-c-strstr.c @@ -1,5 +1,5 @@ /* Test of searching in a string. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -20,21 +20,10 @@ #include "c-strstr.h" -#include <stdio.h> #include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/test-canonicalize-lgpl.c b/tests/test-canonicalize-lgpl.c index 4f4fca18b4..e35d921bbd 100644 --- a/tests/test-canonicalize-lgpl.c +++ b/tests/test-canonicalize-lgpl.c @@ -32,18 +32,7 @@ SIGNATURE_CHECK (canonicalize_file_name, char *, (const char *)); #include <unistd.h> #include "same-inode.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "t-can-lgpl.tmp" diff --git a/tests/test-canonicalize.c b/tests/test-canonicalize.c index 70b6341de9..583026744f 100644 --- a/tests/test-canonicalize.c +++ b/tests/test-canonicalize.c @@ -29,18 +29,7 @@ #include <unistd.h> #include "same-inode.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "t-can.tmp" diff --git a/tests/test-carray_list.c b/tests/test-carray_list.c index def7c5539d..e75bc1801b 100644 --- a/tests/test-carray_list.c +++ b/tests/test-carray_list.c @@ -19,29 +19,17 @@ #include "gl_carray_list.h" -#include <stdio.h> #include <stdlib.h> #include "gl_array_list.h" #include "progname.h" +#include "macros.h" static const char *objects[15] = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o" }; -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) #define RANDOM(n) (rand () % (n)) #define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))] diff --git a/tests/test-ceilf1.c b/tests/test-ceilf1.c index e180e95f8a..e37c14e618 100644 --- a/tests/test-ceilf1.c +++ b/tests/test-ceilf1.c @@ -23,23 +23,9 @@ #include "signature.h" SIGNATURE_CHECK (ceilf, float, (float)); -#include <stdio.h> -#include <stdlib.h> - #include "isnanf-nolibm.h" #include "nan.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0f. So we use -zero instead. */ diff --git a/tests/test-ceilf2.c b/tests/test-ceilf2.c index ec0f608493..a7c4b5e318 100644 --- a/tests/test-ceilf2.c +++ b/tests/test-ceilf2.c @@ -1,5 +1,5 @@ /* Test of rounding towards positive infinity. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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,21 +24,9 @@ #include <stdbool.h> #include <stdint.h> #include <stdio.h> -#include <stdlib.h> #include "isnanf-nolibm.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* The reference implementation, taken from lib/ceil.c. */ diff --git a/tests/test-ceill.c b/tests/test-ceill.c index 2ed0053311..a7dfe20c6e 100644 --- a/tests/test-ceill.c +++ b/tests/test-ceill.c @@ -24,24 +24,11 @@ SIGNATURE_CHECK (ceill, long double, (long double)); #include <float.h> -#include <stdio.h> -#include <stdlib.h> #include "fpucw.h" #include "isnanl-nolibm.h" #include "nan.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. So we use minus_zero instead. diff --git a/tests/test-chown.c b/tests/test-chown.c index e7660707ea..39749039ed 100644 --- a/tests/test-chown.c +++ b/tests/test-chown.c @@ -32,18 +32,7 @@ SIGNATURE_CHECK (chown, int, (char const *, uid_t, gid_t)); #include "mgetgroups.h" #include "stat-time.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-chown.t" diff --git a/tests/test-cloexec.c b/tests/test-cloexec.c index 1f43014972..56e26d1860 100644 --- a/tests/test-cloexec.c +++ b/tests/test-cloexec.c @@ -22,8 +22,6 @@ #include <errno.h> #include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> #include <unistd.h> #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ @@ -33,18 +31,7 @@ #endif #include "binary-io.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Return non-zero if FD is open and inheritable across exec/spawn. */ static int diff --git a/tests/test-copy-acl.c b/tests/test-copy-acl.c index 198d59d808..5da63bc065 100644 --- a/tests/test-copy-acl.c +++ b/tests/test-copy-acl.c @@ -1,5 +1,5 @@ /* Test of copying of files. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2009 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 @@ -28,18 +28,7 @@ #include <sys/stat.h> #include "progname.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char *argv[]) diff --git a/tests/test-copy-file.c b/tests/test-copy-file.c index a2bb421f1b..e845e11d99 100644 --- a/tests/test-copy-file.c +++ b/tests/test-copy-file.c @@ -1,5 +1,5 @@ /* Test of copying of files. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2009 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 @@ -20,22 +20,8 @@ #include "copy-file.h" -#include <stdio.h> -#include <stdlib.h> - #include "progname.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char *argv[]) diff --git a/tests/test-count-one-bits.c b/tests/test-count-one-bits.c index 5757bbd22e..aec49e1586 100644 --- a/tests/test-count-one-bits.c +++ b/tests/test-count-one-bits.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2008 Free Software Foundation + * Copyright (C) 2007-2009 Free Software Foundation * * 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 @@ -22,20 +22,8 @@ #include <limits.h> #include <stdio.h> -#include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion \"%s\" failed\n", \ - __FILE__, __LINE__, #expr); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UINT_BIT (sizeof (unsigned int) * CHAR_BIT) #define ULONG_BIT (sizeof (unsigned long int) * CHAR_BIT) diff --git a/tests/test-dprintf-posix.c b/tests/test-dprintf-posix.c index 9cedc1c62a..341ece2f58 100644 --- a/tests/test-dprintf-posix.c +++ b/tests/test-dprintf-posix.c @@ -25,20 +25,9 @@ SIGNATURE_CHECK (dprintf, int, (int, const char *, ...)); #include <stddef.h> #include <stdint.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void test_function (int (*my_dprintf) (int, const char *, ...)) diff --git a/tests/test-dup2.c b/tests/test-dup2.c index a4aca82dfb..d3751f5c44 100644 --- a/tests/test-dup2.c +++ b/tests/test-dup2.c @@ -25,8 +25,6 @@ SIGNATURE_CHECK (dup2, int, (int, int)); #include <errno.h> #include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> #include "binary-io.h" #include "cloexec.h" @@ -37,17 +35,7 @@ SIGNATURE_CHECK (dup2, int, (int, int)); # include <windows.h> #endif -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Return non-zero if FD is open. */ static int diff --git a/tests/test-dup3.c b/tests/test-dup3.c index 9133b7bf4b..184d780922 100644 --- a/tests/test-dup3.c +++ b/tests/test-dup3.c @@ -27,8 +27,6 @@ SIGNATURE_CHECK (dup3, int, (int, int, int)); #include <errno.h> #include <fcntl.h> #include <stdbool.h> -#include <stdio.h> -#include <stdlib.h> #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ /* Get declarations of the Win32 API functions. */ @@ -37,18 +35,7 @@ SIGNATURE_CHECK (dup3, int, (int, int, int)); #endif #include "binary-io.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Return true if FD is open. */ static bool diff --git a/tests/test-duplocale.c b/tests/test-duplocale.c index a368c07428..e0930d61db 100644 --- a/tests/test-duplocale.c +++ b/tests/test-duplocale.c @@ -28,20 +28,9 @@ SIGNATURE_CHECK (duplocale, locale_t, (locale_t)); #include <langinfo.h> #include <monetary.h> #include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" struct locale_dependent_values { diff --git a/tests/test-fbufmode.c b/tests/test-fbufmode.c index 3f83864a1b..5675e44fe0 100644 --- a/tests/test-fbufmode.c +++ b/tests/test-fbufmode.c @@ -1,5 +1,5 @@ /* Test of fbufmode() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -21,19 +21,8 @@ #include "fbufmode.h" #include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) + +#include "macros.h" #define TESTFILE "t-fbufmode.tmp" diff --git a/tests/test-fchdir.c b/tests/test-fchdir.c index 7ec675e7da..f5cce49d6c 100644 --- a/tests/test-fchdir.c +++ b/tests/test-fchdir.c @@ -25,23 +25,11 @@ SIGNATURE_CHECK (fchdir, int, (int)); #include <errno.h> #include <fcntl.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> #include "cloexec.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (void) diff --git a/tests/test-fchownat.c b/tests/test-fchownat.c index c084ddf83c..a6d177d36a 100644 --- a/tests/test-fchownat.c +++ b/tests/test-fchownat.c @@ -33,18 +33,7 @@ SIGNATURE_CHECK (fchownat, int, (int, char const *, uid_t, gid_t, int)); #include "mgetgroups.h" #include "openat.h" #include "stat-time.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-fchownat.t" diff --git a/tests/test-fcntl-safer.c b/tests/test-fcntl-safer.c index 15f6e2ca6c..c3e77fa825 100644 --- a/tests/test-fcntl-safer.c +++ b/tests/test-fcntl-safer.c @@ -23,20 +23,9 @@ #include <errno.h> #include <stdbool.h> #include <stdio.h> -#include <stdlib.h> #include <unistd.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-fcntl-safer.t" diff --git a/tests/test-fcntl.c b/tests/test-fcntl.c index 77ac87006e..b14e00a032 100644 --- a/tests/test-fcntl.c +++ b/tests/test-fcntl.c @@ -28,8 +28,6 @@ SIGNATURE_CHECK (fcntl, int, (int, int, ...)); #include <errno.h> #include <stdarg.h> #include <stdbool.h> -#include <stdio.h> -#include <stdlib.h> #include <unistd.h> #if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__ @@ -39,6 +37,7 @@ SIGNATURE_CHECK (fcntl, int, (int, int, ...)); #endif #include "binary-io.h" +#include "macros.h" /* Use O_CLOEXEC if available, but test works without it. */ #ifndef O_CLOEXEC @@ -50,18 +49,6 @@ SIGNATURE_CHECK (fcntl, int, (int, int, ...)); static int zero (void) { return 0; } #endif -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) - /* Return true if FD is open. */ static bool is_open (int fd) diff --git a/tests/test-fdopendir.c b/tests/test-fdopendir.c index f6006d0b8e..943b8d1206 100644 --- a/tests/test-fdopendir.c +++ b/tests/test-fdopendir.c @@ -25,21 +25,9 @@ SIGNATURE_CHECK (fdopendir, DIR *, (int)); #include <errno.h> #include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> #include <unistd.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (void) diff --git a/tests/test-fdutimensat.c b/tests/test-fdutimensat.c index 00729d8e68..ad0eca94b8 100644 --- a/tests/test-fdutimensat.c +++ b/tests/test-fdutimensat.c @@ -25,17 +25,7 @@ #include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-fdutimensat.t" diff --git a/tests/test-fflush2.c b/tests/test-fflush2.c index da0a760c22..e2e82b0594 100644 --- a/tests/test-fflush2.c +++ b/tests/test-fflush2.c @@ -18,21 +18,8 @@ #include <stdio.h> -#include <stdlib.h> - #include "binary-io.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char **argv) diff --git a/tests/test-file-has-acl.c b/tests/test-file-has-acl.c index 3e069ee411..4727ed174b 100644 --- a/tests/test-file-has-acl.c +++ b/tests/test-file-has-acl.c @@ -27,17 +27,7 @@ #include <sys/types.h> #include <sys/stat.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char *argv[]) diff --git a/tests/test-filevercmp.c b/tests/test-filevercmp.c index 4c29d0c8d9..624794b5a8 100644 --- a/tests/test-filevercmp.c +++ b/tests/test-filevercmp.c @@ -19,20 +19,9 @@ #include "filevercmp.h" -#include <stdio.h> -#include <stdlib.h> +#include <stddef.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* set of well sorted examples */ static const char *const examples[] = diff --git a/tests/test-flock.c b/tests/test-flock.c index a8a615e9a6..beae8c8175 100644 --- a/tests/test-flock.c +++ b/tests/test-flock.c @@ -22,23 +22,10 @@ SIGNATURE_CHECK (flock, int, (int, int)); #include <fcntl.h> -#include <stdio.h> -#include <stdlib.h> #include <unistd.h> #include <errno.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed, errno = %d\n", \ - __FILE__, __LINE__, errno); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void test_shared (const char *file, int fd) diff --git a/tests/test-floorf1.c b/tests/test-floorf1.c index e156732392..025ea9bd4e 100644 --- a/tests/test-floorf1.c +++ b/tests/test-floorf1.c @@ -23,23 +23,9 @@ #include "signature.h" SIGNATURE_CHECK (floorf, float, (float)); -#include <stdio.h> -#include <stdlib.h> - #include "isnanf-nolibm.h" #include "nan.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0f. So we use -zero instead. */ diff --git a/tests/test-floorf2.c b/tests/test-floorf2.c index d668487e52..d6a22ee25a 100644 --- a/tests/test-floorf2.c +++ b/tests/test-floorf2.c @@ -1,5 +1,5 @@ /* Test of rounding towards negative infinity. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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,21 +24,9 @@ #include <stdbool.h> #include <stdint.h> #include <stdio.h> -#include <stdlib.h> #include "isnanf-nolibm.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* The reference implementation, taken from lib/floor.c. */ diff --git a/tests/test-floorl.c b/tests/test-floorl.c index a8080e58b0..cbef77a00b 100644 --- a/tests/test-floorl.c +++ b/tests/test-floorl.c @@ -24,24 +24,11 @@ SIGNATURE_CHECK (floorl, long double, (long double)); #include <float.h> -#include <stdio.h> -#include <stdlib.h> #include "fpucw.h" #include "isnanl-nolibm.h" #include "nan.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. So we use minus_zero instead. diff --git a/tests/test-fnmatch.c b/tests/test-fnmatch.c index f9485afcf1..6cd2d8a577 100644 --- a/tests/test-fnmatch.c +++ b/tests/test-fnmatch.c @@ -23,21 +23,7 @@ #include "signature.h" SIGNATURE_CHECK (fnmatch, int, (char const *, char const *, int)); -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", \ - __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/test-fopen.h b/tests/test-fopen.h index 6ba923b3ba..106f4910d1 100644 --- a/tests/test-fopen.h +++ b/tests/test-fopen.h @@ -19,20 +19,9 @@ /* Include <config.h> and a form of <stdio.h> first. */ #include <errno.h> -#include <stdlib.h> #include <unistd.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Test fopen. Assumes BASE is defined. */ diff --git a/tests/test-fpending.c b/tests/test-fpending.c index 44b6f66dd0..09b7bfab9e 100644 --- a/tests/test-fpending.c +++ b/tests/test-fpending.c @@ -24,17 +24,7 @@ #include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (void) diff --git a/tests/test-fprintf-posix.c b/tests/test-fprintf-posix.c index 21c626ee09..46e5fd61a9 100644 --- a/tests/test-fprintf-posix.c +++ b/tests/test-fprintf-posix.c @@ -26,20 +26,9 @@ SIGNATURE_CHECK (fprintf, int, (FILE *, char const *, ...)); #include <stdarg.h> #include <stddef.h> #include <stdint.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-fprintf-posix.h" diff --git a/tests/test-fpurge.c b/tests/test-fpurge.c index 9bf2378868..ad77fa9cb5 100644 --- a/tests/test-fpurge.c +++ b/tests/test-fpurge.c @@ -20,27 +20,16 @@ #include <stdio.h> -#include <stdlib.h> #include <string.h> +#include "macros.h" + /* None of the files accessed by this test are large, so disable the fseek link warning if we are not using the gnulib fseek module. */ #if !GNULIB_FSEEK # undef fseek #endif -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) - #define TESTFILE "t-fpurge.tmp" int diff --git a/tests/test-freadable.c b/tests/test-freadable.c index becad342ca..0582ffd245 100644 --- a/tests/test-freadable.c +++ b/tests/test-freadable.c @@ -21,7 +21,8 @@ #include "freadable.h" #include <stdio.h> -#include <stdlib.h> + +#include "macros.h" /* None of the files accessed by this test are large, so disable the fseek link warning if we are not using the gnulib fseek module. */ @@ -29,18 +30,6 @@ # undef fseek #endif -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) - #define TESTFILE "t-freadable.tmp" int diff --git a/tests/test-freadahead.c b/tests/test-freadahead.c index c216231aa4..bea6eeda22 100644 --- a/tests/test-freadahead.c +++ b/tests/test-freadahead.c @@ -1,5 +1,5 @@ /* Test of freadahead() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -20,21 +20,10 @@ #include "freadahead.h" -#include <stdio.h> #include <stdlib.h> #include <unistd.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char **argv) diff --git a/tests/test-freading.c b/tests/test-freading.c index eb5699d35c..1f9af7fbdf 100644 --- a/tests/test-freading.c +++ b/tests/test-freading.c @@ -21,7 +21,8 @@ #include "freading.h" #include <stdio.h> -#include <stdlib.h> + +#include "macros.h" /* None of the files accessed by this test are large, so disable the fseek link warning if we are not using the gnulib fseek module. */ @@ -29,18 +30,6 @@ # undef fseek #endif -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) - #define TESTFILE "t-freading.tmp" int diff --git a/tests/test-freadptr.c b/tests/test-freadptr.c index 65334b8bc5..df1259cf1b 100644 --- a/tests/test-freadptr.c +++ b/tests/test-freadptr.c @@ -1,5 +1,5 @@ /* Test of freadptr() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -20,22 +20,11 @@ #include "freadptr.h" -#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char **argv) diff --git a/tests/test-freadptr2.c b/tests/test-freadptr2.c index e6f534834e..0a570ec617 100644 --- a/tests/test-freadptr2.c +++ b/tests/test-freadptr2.c @@ -1,5 +1,5 @@ /* Test of freadptr() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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,17 +24,7 @@ #include <stdlib.h> #include <unistd.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int freadptrbufsize (FILE *fp) diff --git a/tests/test-freadseek.c b/tests/test-freadseek.c index 2bd9ab6ffd..ca7aaa460e 100644 --- a/tests/test-freadseek.c +++ b/tests/test-freadseek.c @@ -25,17 +25,7 @@ #include <string.h> #include <unistd.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char **argv) diff --git a/tests/test-freopen.c b/tests/test-freopen.c index bdb5de0fe9..48487088a5 100644 --- a/tests/test-freopen.c +++ b/tests/test-freopen.c @@ -23,19 +23,7 @@ #include "signature.h" SIGNATURE_CHECK (freopen, FILE *, (char const *, char const *, FILE *)); -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/test-frexp.c b/tests/test-frexp.c index 6b285c9a94..9b6f464921 100644 --- a/tests/test-frexp.c +++ b/tests/test-frexp.c @@ -24,29 +24,16 @@ SIGNATURE_CHECK (frexp, double, (double, int *)); #include <float.h> -#include <stdio.h> -#include <stdlib.h> #include "isnand-nolibm.h" #include "nan.h" +#include "macros.h" /* Avoid some warnings from "gcc -Wshadow". This file doesn't use the exp() function. */ #undef exp #define exp exponent -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) - /* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0. So we use -zero instead. */ double zero = 0.0; diff --git a/tests/test-frexpl.c b/tests/test-frexpl.c index 7b7ec53941..f67319426c 100644 --- a/tests/test-frexpl.c +++ b/tests/test-frexpl.c @@ -24,30 +24,17 @@ SIGNATURE_CHECK (frexpl, long double, (long double, int *)); #include <float.h> -#include <stdio.h> -#include <stdlib.h> #include "fpucw.h" #include "isnanl-nolibm.h" #include "nan.h" +#include "macros.h" /* Avoid some warnings from "gcc -Wshadow". This file doesn't use the exp() function. */ #undef exp #define exp exponent -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) - /* On MIPS IRIX machines, LDBL_MIN_EXP is -1021, but the smallest reliable exponent for 'long double' is -964. Similarly, on PowerPC machines, LDBL_MIN_EXP is -1021, but the smallest reliable exponent for 'long double' diff --git a/tests/test-fseek.c b/tests/test-fseek.c index 4447a9b6f7..00ded3e12e 100644 --- a/tests/test-fseek.c +++ b/tests/test-fseek.c @@ -23,19 +23,7 @@ #include "signature.h" SIGNATURE_CHECK (fseek, int, (FILE *, long, int)); -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #ifndef FUNC_UNGETC_BROKEN # define FUNC_UNGETC_BROKEN 0 diff --git a/tests/test-fseeko.c b/tests/test-fseeko.c index 0d2f32199f..6a8a1c0a08 100644 --- a/tests/test-fseeko.c +++ b/tests/test-fseeko.c @@ -30,19 +30,8 @@ #include "signature.h" SIGNATURE_CHECK (fseeko, int, (FILE *, off_t, int)); -#include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #ifndef FUNC_UNGETC_BROKEN # define FUNC_UNGETC_BROKEN 0 diff --git a/tests/test-fstatat.c b/tests/test-fstatat.c index 552bf45f31..e6abe38e26 100644 --- a/tests/test-fstatat.c +++ b/tests/test-fstatat.c @@ -33,18 +33,7 @@ SIGNATURE_CHECK (fstatat, int, (int, char const *, struct stat *, int)); #include "openat.h" #include "pathmax.h" #include "same-inode.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-fstatat.t" diff --git a/tests/test-fstrcmp.c b/tests/test-fstrcmp.c index a2d250527c..e72fef052e 100644 --- a/tests/test-fstrcmp.c +++ b/tests/test-fstrcmp.c @@ -21,22 +21,9 @@ #include "fstrcmp.h" #include <stdbool.h> -#include <stdio.h> -#include <stdlib.h> #include "progname.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static bool check_fstrcmp (const char *string1, const char *string2, double expected) diff --git a/tests/test-fsync.c b/tests/test-fsync.c index bf789a2aa6..12a56b2ce9 100644 --- a/tests/test-fsync.c +++ b/tests/test-fsync.c @@ -22,20 +22,9 @@ SIGNATURE_CHECK (fsync, int, (int)); #include <errno.h> -#include <stdio.h> #include <fcntl.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (void) diff --git a/tests/test-ftell.c b/tests/test-ftell.c index d9723f593b..0f35da44fc 100644 --- a/tests/test-ftell.c +++ b/tests/test-ftell.c @@ -23,9 +23,8 @@ #include "signature.h" SIGNATURE_CHECK (ftell, long, (FILE *)); -#include <stdlib.h> - #include "binary-io.h" +#include "macros.h" /* None of the files accessed by this test are large, so disable the fseek link warning if we are not using the gnulib fseek module. */ @@ -33,18 +32,6 @@ SIGNATURE_CHECK (ftell, long, (FILE *)); # undef fseek #endif -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) - #ifndef FUNC_UNGETC_BROKEN # define FUNC_UNGETC_BROKEN 0 #endif diff --git a/tests/test-ftello.c b/tests/test-ftello.c index 2af43f2bc9..bde4e067e2 100644 --- a/tests/test-ftello.c +++ b/tests/test-ftello.c @@ -23,9 +23,8 @@ #include "signature.h" SIGNATURE_CHECK (ftello, off_t, (FILE *)); -#include <stdlib.h> - #include "binary-io.h" +#include "macros.h" /* None of the files accessed by this test are large, so disable the fseek link warning if we are not using the gnulib fseek module. */ @@ -33,18 +32,6 @@ SIGNATURE_CHECK (ftello, off_t, (FILE *)); # undef fseek #endif -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) - #ifndef FUNC_UNGETC_BROKEN # define FUNC_UNGETC_BROKEN 0 #endif diff --git a/tests/test-func.c b/tests/test-func.c index 7679ef0474..88d5f2c9ac 100644 --- a/tests/test-func.c +++ b/tests/test-func.c @@ -19,20 +19,8 @@ #include <config.h> #include <string.h> -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) + +#include "macros.h" int main () diff --git a/tests/test-futimens.c b/tests/test-futimens.c index 5753c6b209..0ee1fe05ed 100644 --- a/tests/test-futimens.c +++ b/tests/test-futimens.c @@ -34,18 +34,7 @@ SIGNATURE_CHECK (futimens, int, (int, struct timespec const[2])); #include "stat-time.h" #include "timespec.h" #include "utimecmp.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-futimens.t" diff --git a/tests/test-fwritable.c b/tests/test-fwritable.c index 34f2427089..f4c40824b3 100644 --- a/tests/test-fwritable.c +++ b/tests/test-fwritable.c @@ -21,7 +21,8 @@ #include "fwritable.h" #include <stdio.h> -#include <stdlib.h> + +#include "macros.h" /* None of the files accessed by this test are large, so disable the fseek link warning if we are not using the gnulib fseek module. */ @@ -29,18 +30,6 @@ # undef fseek #endif -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) - #define TESTFILE "t-fwritable.tmp" int diff --git a/tests/test-fwriting.c b/tests/test-fwriting.c index ee23eecf88..61c4f80bec 100644 --- a/tests/test-fwriting.c +++ b/tests/test-fwriting.c @@ -21,7 +21,8 @@ #include "fwriting.h" #include <stdio.h> -#include <stdlib.h> + +#include "macros.h" /* None of the files accessed by this test are large, so disable the fseek link warning if we are not using the gnulib fseek module. */ @@ -29,18 +30,6 @@ # undef fseek #endif -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) - #define TESTFILE "t-fwriting.tmp" int diff --git a/tests/test-getcwd.c b/tests/test-getcwd.c index 7570180859..1f6306d0a2 100644 --- a/tests/test-getcwd.c +++ b/tests/test-getcwd.c @@ -25,17 +25,7 @@ SIGNATURE_CHECK (getcwd, char *, (char *, size_t)); #include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char **argv) diff --git a/tests/test-getdate.c b/tests/test-getdate.c index b30ef82c48..09b1b54abb 100644 --- a/tests/test-getdate.c +++ b/tests/test-getdate.c @@ -26,19 +26,7 @@ #include <string.h> #include "progname.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", \ - __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #ifdef DEBUG #define LOG(str, now, res) \ diff --git a/tests/test-getdelim.c b/tests/test-getdelim.c index dc40bddebd..dbb44a6b6c 100644 --- a/tests/test-getdelim.c +++ b/tests/test-getdelim.c @@ -27,17 +27,7 @@ SIGNATURE_CHECK (getdelim, ssize_t, (char **, size_t *, int, FILE *)); #include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (void) diff --git a/tests/test-getdtablesize.c b/tests/test-getdtablesize.c index e587aa13de..a86ba4ba0b 100644 --- a/tests/test-getdtablesize.c +++ b/tests/test-getdtablesize.c @@ -23,20 +23,7 @@ #include "signature.h" SIGNATURE_CHECK (getdtablesize, int, (void)); -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char *argv[]) diff --git a/tests/test-getgroups.c b/tests/test-getgroups.c index 1d3ca98e3a..14f49f7ee7 100644 --- a/tests/test-getgroups.c +++ b/tests/test-getgroups.c @@ -28,17 +28,7 @@ SIGNATURE_CHECK (getgroups, int, (int, gid_t[])); #include <stdlib.h> #include <stdint.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char **argv _GL_UNUSED) diff --git a/tests/test-getline.c b/tests/test-getline.c index 7564ece159..bab99b370c 100644 --- a/tests/test-getline.c +++ b/tests/test-getline.c @@ -27,17 +27,7 @@ SIGNATURE_CHECK (getline, ssize_t, (char **, size_t *, FILE *)); #include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (void) diff --git a/tests/test-getndelim2.c b/tests/test-getndelim2.c index ff641bd518..e276adb02e 100644 --- a/tests/test-getndelim2.c +++ b/tests/test-getndelim2.c @@ -25,17 +25,7 @@ #include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (void) diff --git a/tests/test-glob.c b/tests/test-glob.c index d7a17dc035..f8d132e728 100644 --- a/tests/test-glob.c +++ b/tests/test-glob.c @@ -25,22 +25,9 @@ SIGNATURE_CHECK (glob, int, (char const *, int, int (*) (char const *, int), glob_t *)); SIGNATURE_CHECK (globfree, void, (glob_t *)); -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", \ - __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define GL_NO_SUCH_FILE "/gnulib-magic-does-not-exist" diff --git a/tests/test-hash.c b/tests/test-hash.c index 2e7c550af1..0ee24ec8b1 100644 --- a/tests/test-hash.c +++ b/tests/test-hash.c @@ -28,21 +28,11 @@ #include <string.h> #include <unistd.h> +#include "macros.h" + #define STREQ(a, b) (strcmp (a, b) == 0) #define ARRAY_CARDINALITY(Array) (sizeof (Array) / sizeof *(Array)) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) - static bool hash_compare_strings (void const *x, void const *y) { diff --git a/tests/test-i-ring.c b/tests/test-i-ring.c index d53123efd0..56c480ce54 100644 --- a/tests/test-i-ring.c +++ b/tests/test-i-ring.c @@ -20,20 +20,7 @@ #include "i-ring.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (void) diff --git a/tests/test-iconv-utf.c b/tests/test-iconv-utf.c index 116477435a..7f57d91dd3 100644 --- a/tests/test-iconv-utf.c +++ b/tests/test-iconv-utf.c @@ -1,5 +1,5 @@ /* Test of character set conversion. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -23,21 +23,9 @@ #endif #include <errno.h> -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/test-iconv.c b/tests/test-iconv.c index 566ddee62f..66db9182c5 100644 --- a/tests/test-iconv.c +++ b/tests/test-iconv.c @@ -34,21 +34,9 @@ SIGNATURE_CHECK (iconv_open, iconv_t, (char const *, char const *)); #endif #include <errno.h> -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/test-idpriv-drop.c b/tests/test-idpriv-drop.c index 5dbc8e2888..7157ef3c1f 100644 --- a/tests/test-idpriv-drop.c +++ b/tests/test-idpriv-drop.c @@ -24,17 +24,7 @@ #include <string.h> #include <unistd.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void show_uids () diff --git a/tests/test-idpriv-droptemp.c b/tests/test-idpriv-droptemp.c index 3dc36c9a65..53c9ac003d 100644 --- a/tests/test-idpriv-droptemp.c +++ b/tests/test-idpriv-droptemp.c @@ -24,17 +24,7 @@ #include <string.h> #include <unistd.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void show_uids () diff --git a/tests/test-inet_ntop.c b/tests/test-inet_ntop.c index 8495620344..d424b72bd1 100644 --- a/tests/test-inet_ntop.c +++ b/tests/test-inet_ntop.c @@ -26,21 +26,9 @@ SIGNATURE_CHECK (inet_ntop, char const *, (int, void const *, char *, #include <netinet/in.h> #include <sys/socket.h> -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (void) diff --git a/tests/test-inet_pton.c b/tests/test-inet_pton.c index b1dbb052bb..deaf30a183 100644 --- a/tests/test-inet_pton.c +++ b/tests/test-inet_pton.c @@ -25,20 +25,8 @@ SIGNATURE_CHECK (inet_pton, int, (int, const char *, void *)); #include <netinet/in.h> #include <sys/socket.h> -#include <stdio.h> -#include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (void) diff --git a/tests/test-isblank.c b/tests/test-isblank.c index d29fc63338..be370cb12d 100644 --- a/tests/test-isblank.c +++ b/tests/test-isblank.c @@ -25,19 +25,8 @@ SIGNATURE_CHECK (isblank, int, (int)); #include <limits.h> #include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) + +#include "macros.h" int main (int argc, char *argv[]) diff --git a/tests/test-isfinite.c b/tests/test-isfinite.c index fc2f23c0d9..de08e30e88 100644 --- a/tests/test-isfinite.c +++ b/tests/test-isfinite.c @@ -28,20 +28,8 @@ #include <float.h> #include <limits.h> -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) + +#include "macros.h" float zerof = 0.0f; double zerod = 0.0; diff --git a/tests/test-isinf.c b/tests/test-isinf.c index d81ee7afc6..678b0fe352 100644 --- a/tests/test-isinf.c +++ b/tests/test-isinf.c @@ -28,20 +28,8 @@ #include <float.h> #include <limits.h> -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) + +#include "macros.h" float zerof = 0.0f; double zerod = 0.0; diff --git a/tests/test-isnan.c b/tests/test-isnan.c index 74bb9d981f..a5787c2664 100644 --- a/tests/test-isnan.c +++ b/tests/test-isnan.c @@ -28,22 +28,9 @@ #include <float.h> #include <limits.h> -#include <stdio.h> -#include <stdlib.h> #include "nan.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0f. So we use -zero instead. */ diff --git a/tests/test-isnand.h b/tests/test-isnand.h index 215e18a6d2..c5dc549afe 100644 --- a/tests/test-isnand.h +++ b/tests/test-isnand.h @@ -1,5 +1,5 @@ /* Test of isnand() substitute. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -17,22 +17,9 @@ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <limits.h> -#include <stdio.h> -#include <stdlib.h> #include "nan.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0. So we use -zero instead. */ diff --git a/tests/test-isnanf.h b/tests/test-isnanf.h index 2444c6d233..b0d99fdd1a 100644 --- a/tests/test-isnanf.h +++ b/tests/test-isnanf.h @@ -1,5 +1,5 @@ /* Test of isnanf() substitute. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -17,22 +17,9 @@ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <limits.h> -#include <stdio.h> -#include <stdlib.h> #include "nan.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0f. So we use -zero instead. */ diff --git a/tests/test-isnanl.h b/tests/test-isnanl.h index 8638f064b6..13a92efb7e 100644 --- a/tests/test-isnanl.h +++ b/tests/test-isnanl.h @@ -18,22 +18,9 @@ #include <float.h> #include <limits.h> -#include <stdio.h> -#include <stdlib.h> #include "nan.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. So we use minus_zero instead. diff --git a/tests/test-lchown.c b/tests/test-lchown.c index b9091028d3..24b7ece95a 100644 --- a/tests/test-lchown.c +++ b/tests/test-lchown.c @@ -32,18 +32,7 @@ SIGNATURE_CHECK (lchown, int, (char const *, uid_t, gid_t)); #include "mgetgroups.h" #include "stat-time.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-lchown.t" diff --git a/tests/test-ldexpl.c b/tests/test-ldexpl.c index 0fe4f8619c..510841cf40 100644 --- a/tests/test-ldexpl.c +++ b/tests/test-ldexpl.c @@ -24,24 +24,11 @@ SIGNATURE_CHECK (ldexpl, long double, (long double, int)); #include <float.h> -#include <stdio.h> -#include <stdlib.h> #include "fpucw.h" #include "isnanl-nolibm.h" #include "nan.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. So we use minus_zero instead. diff --git a/tests/test-link.c b/tests/test-link.c index d2ff679d22..817c464b7a 100644 --- a/tests/test-link.c +++ b/tests/test-link.c @@ -30,17 +30,7 @@ SIGNATURE_CHECK (link, int, (char const *, char const *)); #include <sys/stat.h> #include <unistd.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-link.t" diff --git a/tests/test-linkat.c b/tests/test-linkat.c index c827a27d96..98165c0153 100644 --- a/tests/test-linkat.c +++ b/tests/test-linkat.c @@ -34,18 +34,7 @@ SIGNATURE_CHECK (linkat, int, (int, char const *, int, char const *, int)); #include "filenamecat.h" #include "same-inode.h" #include "xgetcwd.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-linkat.t" diff --git a/tests/test-linked_list.c b/tests/test-linked_list.c index 5511c89cbb..45b3ae8f74 100644 --- a/tests/test-linked_list.c +++ b/tests/test-linked_list.c @@ -19,29 +19,17 @@ #include "gl_linked_list.h" -#include <stdio.h> #include <stdlib.h> #include "gl_array_list.h" #include "progname.h" +#include "macros.h" static const char *objects[15] = { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o" }; -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - 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 98913c5742..1abd65b469 100644 --- a/tests/test-linkedhash_list.c +++ b/tests/test-linkedhash_list.c @@ -20,12 +20,12 @@ #include "gl_linkedhash_list.h" #include <limits.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> #include "gl_array_list.h" #include "progname.h" +#include "macros.h" static const char *objects[15] = { @@ -57,18 +57,6 @@ string_hash (const void *x) return h; } -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) #define RANDOM(n) (rand () % (n)) #define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))] diff --git a/tests/test-localename.c b/tests/test-localename.c index c7e0673c16..553cafc4d8 100644 --- a/tests/test-localename.c +++ b/tests/test-localename.c @@ -21,22 +21,10 @@ #include "localename.h" #include <locale.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static struct { int cat; int mask; const char *string; } const categories[] = { diff --git a/tests/test-lseek.c b/tests/test-lseek.c index a57443db22..fa0505daf8 100644 --- a/tests/test-lseek.c +++ b/tests/test-lseek.c @@ -24,19 +24,8 @@ SIGNATURE_CHECK (lseek, off_t, (int, off_t, int)); #include <errno.h> -#include <stdio.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* ARGC must be 2; *ARGV[1] is '0' if stdin and stdout are files, '1' if they are pipes, and '2' if they are closed. Check for proper diff --git a/tests/test-lstat.c b/tests/test-lstat.c index 74a4fd2acf..1940a2158b 100644 --- a/tests/test-lstat.c +++ b/tests/test-lstat.c @@ -35,18 +35,7 @@ SIGNATURE_CHECK (lstat, int, (char const *, struct stat *)); #include <unistd.h> #include "same-inode.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-lstat.t" diff --git a/tests/test-mbmemcasecmp.c b/tests/test-mbmemcasecmp.c index 3fb7e0a8fb..0adf80c654 100644 --- a/tests/test-mbmemcasecmp.c +++ b/tests/test-mbmemcasecmp.c @@ -22,22 +22,9 @@ #include <locale.h> #include <stdbool.h> -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-mbmemcasecmp.h" diff --git a/tests/test-mbmemcasecoll.c b/tests/test-mbmemcasecoll.c index b127296042..fd30df733f 100644 --- a/tests/test-mbmemcasecoll.c +++ b/tests/test-mbmemcasecoll.c @@ -22,22 +22,9 @@ #include <locale.h> #include <stdbool.h> -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-mbmemcasecmp.h" diff --git a/tests/test-mbrtowc.c b/tests/test-mbrtowc.c index 916427308f..d84bafe434 100644 --- a/tests/test-mbrtowc.c +++ b/tests/test-mbrtowc.c @@ -26,20 +26,9 @@ SIGNATURE_CHECK (mbrtowc, size_t, (wchar_t *, char const *, size_t, #include <locale.h> #include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char *argv[]) diff --git a/tests/test-mbscasecmp.c b/tests/test-mbscasecmp.c index 6e4757c7f0..17b278eb61 100644 --- a/tests/test-mbscasecmp.c +++ b/tests/test-mbscasecmp.c @@ -1,5 +1,5 @@ /* Test of case-insensitive string comparison function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -21,20 +21,8 @@ #include <string.h> #include <locale.h> -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) + +#include "macros.h" int main () diff --git a/tests/test-mbscasestr1.c b/tests/test-mbscasestr1.c index b174f15133..94b6ade02b 100644 --- a/tests/test-mbscasestr1.c +++ b/tests/test-mbscasestr1.c @@ -1,5 +1,5 @@ /* Test of case-insensitive searching in a string. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -20,20 +20,9 @@ #include <string.h> -#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/test-mbscasestr2.c b/tests/test-mbscasestr2.c index c9b4f98582..42f2bfc83c 100644 --- a/tests/test-mbscasestr2.c +++ b/tests/test-mbscasestr2.c @@ -1,5 +1,5 @@ /* Test of searching in a string. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -21,20 +21,9 @@ #include <string.h> #include <locale.h> -#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/test-mbscasestr3.c b/tests/test-mbscasestr3.c index a636eba98d..a1b5d5b413 100644 --- a/tests/test-mbscasestr3.c +++ b/tests/test-mbscasestr3.c @@ -1,5 +1,5 @@ /* Test of case-insensitive searching in a string. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -21,20 +21,8 @@ #include <string.h> #include <locale.h> -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) + +#include "macros.h" int main () diff --git a/tests/test-mbscasestr4.c b/tests/test-mbscasestr4.c index 9763f151b3..f6337634ed 100644 --- a/tests/test-mbscasestr4.c +++ b/tests/test-mbscasestr4.c @@ -1,5 +1,5 @@ /* Test of case-insensitive searching in a string. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -21,20 +21,8 @@ #include <string.h> #include <locale.h> -#include <stdio.h> -#include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/test-mbschr.c b/tests/test-mbschr.c index 2028decf75..f087150d4d 100644 --- a/tests/test-mbschr.c +++ b/tests/test-mbschr.c @@ -1,5 +1,5 @@ /* Test of searching a string for a character. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -21,20 +21,8 @@ #include <string.h> #include <locale.h> -#include <stdio.h> -#include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/test-mbscspn.c b/tests/test-mbscspn.c index f2dae51c86..d65db4ebc7 100644 --- a/tests/test-mbscspn.c +++ b/tests/test-mbscspn.c @@ -1,5 +1,5 @@ /* Test of searching a string for a character among a given set of characters. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -21,20 +21,8 @@ #include <string.h> #include <locale.h> -#include <stdio.h> -#include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/test-mbsinit.c b/tests/test-mbsinit.c index 2732693bc2..e72086d57e 100644 --- a/tests/test-mbsinit.c +++ b/tests/test-mbsinit.c @@ -24,20 +24,8 @@ SIGNATURE_CHECK (mbsinit, int, (const mbstate_t *)); #include <locale.h> -#include <stdio.h> -#include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char *argv[]) diff --git a/tests/test-mbsncasecmp.c b/tests/test-mbsncasecmp.c index 2db03bab52..3f0d689d02 100644 --- a/tests/test-mbsncasecmp.c +++ b/tests/test-mbsncasecmp.c @@ -1,5 +1,5 @@ /* Test of case-insensitive string comparison function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -21,20 +21,8 @@ #include <string.h> #include <locale.h> -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) + +#include "macros.h" int main () diff --git a/tests/test-mbsnrtowcs.c b/tests/test-mbsnrtowcs.c index 471c17b8b6..315b3fabe3 100644 --- a/tests/test-mbsnrtowcs.c +++ b/tests/test-mbsnrtowcs.c @@ -26,20 +26,9 @@ SIGNATURE_CHECK (mbsnrtowcs, size_t, (wchar_t *, char const **, size_t, size_t, #include <locale.h> #include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char *argv[]) diff --git a/tests/test-mbspbrk.c b/tests/test-mbspbrk.c index c5b386f81b..521456784a 100644 --- a/tests/test-mbspbrk.c +++ b/tests/test-mbspbrk.c @@ -1,5 +1,5 @@ /* Test of searching a string for a character among a given set of characters. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -21,20 +21,8 @@ #include <string.h> #include <locale.h> -#include <stdio.h> -#include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/test-mbspcasecmp.c b/tests/test-mbspcasecmp.c index 912eb85772..c337c23ce8 100644 --- a/tests/test-mbspcasecmp.c +++ b/tests/test-mbspcasecmp.c @@ -1,5 +1,5 @@ /* Test of case-insensitive string comparison function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -21,20 +21,8 @@ #include <string.h> #include <locale.h> -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) + +#include "macros.h" int main () diff --git a/tests/test-mbsrchr.c b/tests/test-mbsrchr.c index 160148ac3c..0c435aeead 100644 --- a/tests/test-mbsrchr.c +++ b/tests/test-mbsrchr.c @@ -1,5 +1,5 @@ /* Test of searching a string for the last occurrence of a character. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -21,20 +21,8 @@ #include <string.h> #include <locale.h> -#include <stdio.h> -#include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/test-mbsrtowcs.c b/tests/test-mbsrtowcs.c index 4a01d4a59a..4447f2c5da 100644 --- a/tests/test-mbsrtowcs.c +++ b/tests/test-mbsrtowcs.c @@ -26,20 +26,9 @@ SIGNATURE_CHECK (mbsrtowcs, size_t, (wchar_t *, char const **, size_t, #include <locale.h> #include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char *argv[]) diff --git a/tests/test-mbsspn.c b/tests/test-mbsspn.c index f8798dbfb6..5e27dfc9e9 100644 --- a/tests/test-mbsspn.c +++ b/tests/test-mbsspn.c @@ -1,5 +1,5 @@ /* Test of searching a string for a character outside a given set of characters. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -21,20 +21,8 @@ #include <string.h> #include <locale.h> -#include <stdio.h> -#include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/test-mbsstr1.c b/tests/test-mbsstr1.c index 23e1dbec09..97ef60d0ea 100644 --- a/tests/test-mbsstr1.c +++ b/tests/test-mbsstr1.c @@ -1,5 +1,5 @@ /* Test of searching in a string. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -20,20 +20,9 @@ #include <string.h> -#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/test-mbsstr2.c b/tests/test-mbsstr2.c index 667390f4c4..2e4c538e25 100644 --- a/tests/test-mbsstr2.c +++ b/tests/test-mbsstr2.c @@ -1,5 +1,5 @@ /* Test of searching in a string. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -21,20 +21,9 @@ #include <string.h> #include <locale.h> -#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/test-mbsstr3.c b/tests/test-mbsstr3.c index a948a03785..6d0b5d627d 100644 --- a/tests/test-mbsstr3.c +++ b/tests/test-mbsstr3.c @@ -1,5 +1,5 @@ /* Test of searching in a string. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -21,20 +21,8 @@ #include <string.h> #include <locale.h> -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) + +#include "macros.h" int main () diff --git a/tests/test-memchr.c b/tests/test-memchr.c index 2ec37b65af..5d31e76f27 100644 --- a/tests/test-memchr.c +++ b/tests/test-memchr.c @@ -22,22 +22,10 @@ #include "signature.h" SIGNATURE_CHECK (memchr, void *, (void const *, int, size_t)); -#include <stdio.h> #include <stdlib.h> #include "zerosize-ptr.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Calculating void * + int is not portable, so this wrapper converts to char * to make the tests easier to write. */ diff --git a/tests/test-memchr2.c b/tests/test-memchr2.c index ef0a713303..a992fb5c08 100644 --- a/tests/test-memchr2.c +++ b/tests/test-memchr2.c @@ -19,23 +19,11 @@ #include "memchr2.h" -#include <stdio.h> #include <stdlib.h> #include <string.h> #include "zerosize-ptr.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Calculating void * + int is not portable, so this wrapper converts to char * to make the tests easier to write. */ diff --git a/tests/test-memcmp.c b/tests/test-memcmp.c index 463ca0c988..48cf40df5b 100644 --- a/tests/test-memcmp.c +++ b/tests/test-memcmp.c @@ -22,22 +22,8 @@ #include "signature.h" SIGNATURE_CHECK (memcmp, int, (void const *, void const *, size_t)); -#include <stdio.h> -#include <stdlib.h> - #include "zerosize-ptr.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (void) diff --git a/tests/test-memmem.c b/tests/test-memmem.c index 3c71a2e269..babf6810cb 100644 --- a/tests/test-memmem.c +++ b/tests/test-memmem.c @@ -23,23 +23,11 @@ SIGNATURE_CHECK (memmem, void *, (void const *, size_t, void const *, size_t)); #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "zerosize-ptr.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void * null_ptr (void) diff --git a/tests/test-memrchr.c b/tests/test-memrchr.c index d9128e76e4..e768daf2cf 100644 --- a/tests/test-memrchr.c +++ b/tests/test-memrchr.c @@ -22,22 +22,10 @@ #include "signature.h" SIGNATURE_CHECK (memrchr, void *, (void const *, int, size_t)); -#include <stdio.h> #include <stdlib.h> #include "zerosize-ptr.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Calculating void * + int is not portable, so this wrapper converts to char * to make the tests easier to write. */ diff --git a/tests/test-mkdir.c b/tests/test-mkdir.c index 1531e25c50..379e90c5a3 100644 --- a/tests/test-mkdir.c +++ b/tests/test-mkdir.c @@ -30,17 +30,7 @@ SIGNATURE_CHECK (mkdir, int, (char const *, mode_t)); #include <stdlib.h> #include <unistd.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-mkdir.t" diff --git a/tests/test-mkdirat.c b/tests/test-mkdirat.c index c11b1654df..d3180e6d56 100644 --- a/tests/test-mkdirat.c +++ b/tests/test-mkdirat.c @@ -30,17 +30,7 @@ SIGNATURE_CHECK (mkdirat, int, (int, char const *, mode_t)); #include <stdlib.h> #include <unistd.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-mkdirat.t" diff --git a/tests/test-mkfifo.c b/tests/test-mkfifo.c index df002ed74c..4b4c93b53d 100644 --- a/tests/test-mkfifo.c +++ b/tests/test-mkfifo.c @@ -30,17 +30,7 @@ SIGNATURE_CHECK (mkfifo, int, (char const *, mode_t)); #include <stdlib.h> #include <unistd.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-mkfifo.t" diff --git a/tests/test-mkfifoat.c b/tests/test-mkfifoat.c index 1c6656e147..ef3e817c8d 100644 --- a/tests/test-mkfifoat.c +++ b/tests/test-mkfifoat.c @@ -32,17 +32,7 @@ SIGNATURE_CHECK (mknodat, int, (int, char const *, mode_t, dev_t)); #include <string.h> #include <unistd.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-mkfifoat.t" diff --git a/tests/test-mknod.c b/tests/test-mknod.c index b00cd28425..a62df6d112 100644 --- a/tests/test-mknod.c +++ b/tests/test-mknod.c @@ -30,17 +30,7 @@ SIGNATURE_CHECK (mknod, int, (char const *, mode_t, dev_t)); #include <stdlib.h> #include <unistd.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-mknod.t" diff --git a/tests/test-nanosleep.c b/tests/test-nanosleep.c index 797c8beb7e..09aff7a815 100644 --- a/tests/test-nanosleep.c +++ b/tests/test-nanosleep.c @@ -25,23 +25,10 @@ SIGNATURE_CHECK (nanosleep, int, (struct timespec const *, struct timespec *)); #include <errno.h> #include <signal.h> -#include <stdio.h> -#include <stdlib.h> #include <unistd.h> #include "intprops.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #if HAVE_DECL_ALARM static void diff --git a/tests/test-nl_langinfo.c b/tests/test-nl_langinfo.c index a2f5f68257..4a79b50219 100644 --- a/tests/test-nl_langinfo.c +++ b/tests/test-nl_langinfo.c @@ -24,23 +24,11 @@ SIGNATURE_CHECK (nl_langinfo, char *, (nl_item)); #include <locale.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> #include "c-strcase.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char *argv[]) diff --git a/tests/test-obstack-printf.c b/tests/test-obstack-printf.c index ca07f47524..fe2689c1c0 100644 --- a/tests/test-obstack-printf.c +++ b/tests/test-obstack-printf.c @@ -33,18 +33,7 @@ SIGNATURE_CHECK (obstack_vprintf, int, (struct obstack *, char const *, #include <string.h> #include "progname.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define obstack_chunk_alloc xmalloc #define obstack_chunk_free free diff --git a/tests/test-open.c b/tests/test-open.c index 4bdf31431f..a5fb46181d 100644 --- a/tests/test-open.c +++ b/tests/test-open.c @@ -26,20 +26,9 @@ SIGNATURE_CHECK (open, int, (char const *, int, ...)); #include <errno.h> #include <stdbool.h> #include <stdio.h> -#include <stdlib.h> #include <unistd.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-open.t" diff --git a/tests/test-openat.c b/tests/test-openat.c index 5eb9deb276..36bbdb562c 100644 --- a/tests/test-openat.c +++ b/tests/test-openat.c @@ -27,20 +27,9 @@ SIGNATURE_CHECK (openat, int, (int, char const *, int, ...)); #include <stdarg.h> #include <stdbool.h> #include <stdio.h> -#include <stdlib.h> #include <unistd.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-openat.t" diff --git a/tests/test-pipe-filter-gi1.c b/tests/test-pipe-filter-gi1.c index 228419874d..1d5aff09ad 100644 --- a/tests/test-pipe-filter-gi1.c +++ b/tests/test-pipe-filter-gi1.c @@ -19,25 +19,11 @@ #include "pipe-filter.h" -#include <stdio.h> -#include <stdlib.h> - #include "binary-io.h" #include "c-ctype.h" #include "read-file.h" #include "progname.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Pipe a text file through 'tr a-z A-Z', which converts ASCII characters from diff --git a/tests/test-pipe-filter-gi2-main.c b/tests/test-pipe-filter-gi2-main.c index 5cf8984aa7..5732445770 100644 --- a/tests/test-pipe-filter-gi2-main.c +++ b/tests/test-pipe-filter-gi2-main.c @@ -28,18 +28,7 @@ #include "full-write.h" #include "progname.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* 0.1 sec pause */ static void diff --git a/tests/test-pipe-filter-ii1.c b/tests/test-pipe-filter-ii1.c index 310a7bba7d..eb196860b9 100644 --- a/tests/test-pipe-filter-ii1.c +++ b/tests/test-pipe-filter-ii1.c @@ -19,25 +19,11 @@ #include "pipe-filter.h" -#include <stdio.h> -#include <stdlib.h> - #include "binary-io.h" #include "c-ctype.h" #include "read-file.h" #include "progname.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Pipe a text file through 'tr a-z A-Z', which converts ASCII characters from diff --git a/tests/test-pipe-filter-ii2-main.c b/tests/test-pipe-filter-ii2-main.c index 909634f399..96d70db969 100644 --- a/tests/test-pipe-filter-ii2-main.c +++ b/tests/test-pipe-filter-ii2-main.c @@ -28,18 +28,7 @@ #include "full-write.h" #include "progname.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" struct locals { diff --git a/tests/test-pipe2.c b/tests/test-pipe2.c index 5eb5ec3287..e1fbe29b12 100644 --- a/tests/test-pipe2.c +++ b/tests/test-pipe2.c @@ -32,18 +32,7 @@ SIGNATURE_CHECK (pipe2, int, (int[2], int)); #endif #include "binary-io.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Return true if FD is open. */ static bool diff --git a/tests/test-popen.h b/tests/test-popen.h index b0d2e6fefa..d7011827d0 100644 --- a/tests/test-popen.h +++ b/tests/test-popen.h @@ -24,17 +24,7 @@ #include <sys/wait.h> #include <unistd.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char **argv) diff --git a/tests/test-posixtm.c b/tests/test-posixtm.c index e1a87a0a83..9c94262b38 100644 --- a/tests/test-posixtm.c +++ b/tests/test-posixtm.c @@ -27,18 +27,7 @@ #include <time.h> #include "intprops.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" struct posixtm_test { diff --git a/tests/test-pread.c b/tests/test-pread.c index d5a86ad2a7..b8b133bba7 100644 --- a/tests/test-pread.c +++ b/tests/test-pread.c @@ -23,23 +23,11 @@ #include "signature.h" SIGNATURE_CHECK (pread, ssize_t, (int, void *, size_t, off_t)); -#include <stdio.h> -#include <stdlib.h> #include <sys/types.h> #include <fcntl.h> #include <errno.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define N (sizeof buf - 1) diff --git a/tests/test-printf-frexp.c b/tests/test-printf-frexp.c index a194132bde..38cfd2f564 100644 --- a/tests/test-printf-frexp.c +++ b/tests/test-printf-frexp.c @@ -1,5 +1,5 @@ /* Test of splitting a double into fraction and mantissa. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -21,20 +21,8 @@ #include "printf-frexp.h" #include <float.h> -#include <stdio.h> -#include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static double my_ldexp (double x, int d) diff --git a/tests/test-printf-frexpl.c b/tests/test-printf-frexpl.c index 50f8aaf6b0..7ec690918a 100644 --- a/tests/test-printf-frexpl.c +++ b/tests/test-printf-frexpl.c @@ -1,5 +1,5 @@ /* Test of splitting a 'long double' into fraction and mantissa. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -21,22 +21,9 @@ #include "printf-frexpl.h" #include <float.h> -#include <stdio.h> -#include <stdlib.h> #include "fpucw.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* On MIPS IRIX machines, LDBL_MIN_EXP is -1021, but the smallest reliable exponent for 'long double' is -964. Similarly, on PowerPC machines, diff --git a/tests/test-printf-posix.c b/tests/test-printf-posix.c index c09b1883fd..cfa502f79b 100644 --- a/tests/test-printf-posix.c +++ b/tests/test-printf-posix.c @@ -25,20 +25,9 @@ SIGNATURE_CHECK (printf, int, (char const *, ...)); #include <stddef.h> #include <stdint.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-printf-posix.h" diff --git a/tests/test-priv-set.c b/tests/test-priv-set.c index 8b50a7e143..9a650ad447 100644 --- a/tests/test-priv-set.c +++ b/tests/test-priv-set.c @@ -24,22 +24,10 @@ # include <priv.h> #endif #include <unistd.h> -#include <stdio.h> -#include <stdlib.h> #include <errno.h> #include <sys/types.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (void) diff --git a/tests/test-quotearg.c b/tests/test-quotearg.c index cb5a73b097..10269934be 100644 --- a/tests/test-quotearg.c +++ b/tests/test-quotearg.c @@ -25,24 +25,12 @@ #include <locale.h> #include <stdbool.h> #include <stdint.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> #include "progname.h" #include "gettext.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" struct result_strings { char const *str1; /* Translation of "". */ diff --git a/tests/test-random_r.c b/tests/test-random_r.c index 391d98c6cd..4c1e2428dc 100644 --- a/tests/test-random_r.c +++ b/tests/test-random_r.c @@ -25,20 +25,9 @@ SIGNATURE_CHECK (initstate_r, int, (unsigned int, char *, size_t, SIGNATURE_CHECK (setstate_r, int, (char *, struct random_data *)); SIGNATURE_CHECK (random_r, int, (struct random_data *, int32_t *)); -#include <stdio.h> #include <time.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/test-rawmemchr.c b/tests/test-rawmemchr.c index f1eef2c278..180c2b08ae 100644 --- a/tests/test-rawmemchr.c +++ b/tests/test-rawmemchr.c @@ -22,20 +22,9 @@ #include "signature.h" SIGNATURE_CHECK (rawmemchr, void *, (void const *, int)); -#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Calculating void * + int is not portable, so this wrapper converts to char * to make the tests easier to write. */ diff --git a/tests/test-rbtree_list.c b/tests/test-rbtree_list.c index 1f91492eb5..ecb647dbdf 100644 --- a/tests/test-rbtree_list.c +++ b/tests/test-rbtree_list.c @@ -19,11 +19,11 @@ #include "gl_rbtree_list.h" -#include <stdio.h> #include <stdlib.h> #include "gl_array_list.h" #include "progname.h" +#include "macros.h" extern void gl_rbtree_list_check_invariants (gl_list_t list); @@ -32,18 +32,6 @@ static const char *objects[15] = "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o" }; -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - 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 79bcc89a02..72f350903c 100644 --- a/tests/test-rbtree_oset.c +++ b/tests/test-rbtree_oset.c @@ -19,12 +19,12 @@ #include "gl_rbtree_oset.h" -#include <stdio.h> #include <stdlib.h> #include <string.h> #include "gl_array_oset.h" #include "progname.h" +#include "macros.h" extern void gl_rbtree_oset_check_invariants (gl_oset_t set); @@ -34,18 +34,6 @@ static const char *objects[30] = "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "<", ">", "[", "]" }; -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - 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 7ec8f1ef1a..ec67550141 100644 --- a/tests/test-rbtreehash_list.c +++ b/tests/test-rbtreehash_list.c @@ -20,12 +20,12 @@ #include "gl_rbtreehash_list.h" #include <limits.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> #include "gl_array_list.h" #include "progname.h" +#include "macros.h" extern void gl_rbtreehash_list_check_invariants (gl_list_t list); @@ -59,18 +59,6 @@ string_hash (const void *x) return h; } -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) #define RANDOM(n) (rand () % (n)) #define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))] diff --git a/tests/test-readlink.c b/tests/test-readlink.c index 61f8f6bb78..4ec0fcdf73 100644 --- a/tests/test-readlink.c +++ b/tests/test-readlink.c @@ -31,17 +31,7 @@ SIGNATURE_CHECK (readlink, ssize_t, (char const *, char *, size_t)); #include <string.h> #include <sys/stat.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-readlink.t" diff --git a/tests/test-remove.c b/tests/test-remove.c index 1a92f6c0d1..4bcc2ec2dd 100644 --- a/tests/test-remove.c +++ b/tests/test-remove.c @@ -30,17 +30,7 @@ SIGNATURE_CHECK (remove, int, (char const *)); #include <sys/stat.h> #include <unistd.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-remove.t" diff --git a/tests/test-rename.c b/tests/test-rename.c index 1cd2e8fc0c..797cc940df 100644 --- a/tests/test-rename.c +++ b/tests/test-rename.c @@ -29,17 +29,7 @@ SIGNATURE_CHECK (rename, int, (char const *, char const *)); #include <sys/stat.h> #include <unistd.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-rename.t" diff --git a/tests/test-renameat.c b/tests/test-renameat.c index 3293d52c34..de84fa6764 100644 --- a/tests/test-renameat.c +++ b/tests/test-renameat.c @@ -32,18 +32,7 @@ SIGNATURE_CHECK (renameat, int, (int, char const *, int, char const *)); #include "filenamecat.h" #include "xgetcwd.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-renameat.t" diff --git a/tests/test-rmdir.c b/tests/test-rmdir.c index 44f5d7204f..9ca88e2abd 100644 --- a/tests/test-rmdir.c +++ b/tests/test-rmdir.c @@ -30,17 +30,7 @@ SIGNATURE_CHECK (rmdir, int, (char const *)); #include <stdlib.h> #include <sys/stat.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-rmdir.t" diff --git a/tests/test-round1.c b/tests/test-round1.c index 6f2795ecd2..c20059b14b 100644 --- a/tests/test-round1.c +++ b/tests/test-round1.c @@ -25,23 +25,9 @@ #include "signature.h" SIGNATURE_CHECK (round, double, (double)); -#include <stdio.h> -#include <stdlib.h> - #include "isnand-nolibm.h" #include "nan.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0. So we use -zero instead. */ diff --git a/tests/test-roundf1.c b/tests/test-roundf1.c index 98edc4a7e1..ce603bb7e1 100644 --- a/tests/test-roundf1.c +++ b/tests/test-roundf1.c @@ -25,23 +25,9 @@ #include "signature.h" SIGNATURE_CHECK (roundf, float, (float)); -#include <stdio.h> -#include <stdlib.h> - #include "isnanf-nolibm.h" #include "nan.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0f. So we use -zero instead. */ diff --git a/tests/test-roundl.c b/tests/test-roundl.c index 048aa8b9f3..7b3e2002a2 100644 --- a/tests/test-roundl.c +++ b/tests/test-roundl.c @@ -26,24 +26,11 @@ SIGNATURE_CHECK (roundl, long double, (long double)); #include <float.h> -#include <stdio.h> -#include <stdlib.h> #include "fpucw.h" #include "isnanl-nolibm.h" #include "nan.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. So we use minus_zero instead. diff --git a/tests/test-safe-alloc.c b/tests/test-safe-alloc.c index fc68ae7700..96a1285d3f 100644 --- a/tests/test-safe-alloc.c +++ b/tests/test-safe-alloc.c @@ -24,20 +24,7 @@ #include "safe-alloc.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/test-sameacls.c b/tests/test-sameacls.c index 939b9c17c0..27df564e3f 100644 --- a/tests/test-sameacls.c +++ b/tests/test-sameacls.c @@ -1,5 +1,5 @@ /* Test whether two files have the same ACLs. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2009 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 @@ -32,18 +32,7 @@ #include "progname.h" #include "read-file.h" #include "xalloc.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char *argv[]) diff --git a/tests/test-set-mode-acl.c b/tests/test-set-mode-acl.c index 1cc1503e7b..78e837ab0f 100644 --- a/tests/test-set-mode-acl.c +++ b/tests/test-set-mode-acl.c @@ -1,5 +1,5 @@ /* Test of setting an ACL equivalent to a mode. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2009 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 @@ -20,22 +20,10 @@ #include "acl.h" -#include <stdio.h> #include <stdlib.h> #include "progname.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char *argv[]) diff --git a/tests/test-setenv.c b/tests/test-setenv.c index b23d296e39..e565851bd4 100644 --- a/tests/test-setenv.c +++ b/tests/test-setenv.c @@ -24,21 +24,10 @@ SIGNATURE_CHECK (setenv, int, (char const *, char const *, int)); #include <errno.h> -#include <stdio.h> #include <string.h> #include <unistd.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (void) diff --git a/tests/test-sigaction.c b/tests/test-sigaction.c index 63dfd7ad41..d219f02f2a 100644 --- a/tests/test-sigaction.c +++ b/tests/test-sigaction.c @@ -24,21 +24,9 @@ SIGNATURE_CHECK (sigaction, int, (int, struct sigaction const *, struct sigaction *)); -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - signal (SIGABRT, SIG_DFL); \ - abort (); \ - } \ - } \ - while (0) +#include <stddef.h> + +#include "macros.h" #ifndef SA_NOCLDSTOP # define SA_NOCLDSTOP 0 diff --git a/tests/test-signbit.c b/tests/test-signbit.c index 4acb045460..9add258c85 100644 --- a/tests/test-signbit.c +++ b/tests/test-signbit.c @@ -27,20 +27,8 @@ #include <float.h> #include <limits.h> -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) + +#include "macros.h" float zerof = 0.0f; double zerod = 0.0; diff --git a/tests/test-sleep.c b/tests/test-sleep.c index 4abca334ce..3bb2de6c94 100644 --- a/tests/test-sleep.c +++ b/tests/test-sleep.c @@ -24,20 +24,8 @@ SIGNATURE_CHECK (sleep, unsigned int, (unsigned int)); #include <signal.h> -#include <stdio.h> -#include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #if HAVE_DECL_ALARM static void diff --git a/tests/test-snprintf-posix.c b/tests/test-snprintf-posix.c index dbbef8cb10..01662a6d7f 100644 --- a/tests/test-snprintf-posix.c +++ b/tests/test-snprintf-posix.c @@ -1,5 +1,5 @@ /* Test of POSIX compatible snprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -26,18 +26,7 @@ #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-snprintf-posix.h" diff --git a/tests/test-snprintf.c b/tests/test-snprintf.c index 6f1e34ceca..3780786876 100644 --- a/tests/test-snprintf.c +++ b/tests/test-snprintf.c @@ -23,20 +23,9 @@ #include "signature.h" SIGNATURE_CHECK (snprintf, int, (char *, size_t, char const *, ...)); -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char *argv[]) diff --git a/tests/test-sprintf-posix.c b/tests/test-sprintf-posix.c index 47bbaa08cc..854d1545d3 100644 --- a/tests/test-sprintf-posix.c +++ b/tests/test-sprintf-posix.c @@ -29,18 +29,7 @@ SIGNATURE_CHECK (sprintf, int, (char *, char const *, ...)); #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-sprintf-posix.h" diff --git a/tests/test-stat-time.c b/tests/test-stat-time.c index 85ada87737..6e329c8fbc 100644 --- a/tests/test-stat-time.c +++ b/tests/test-stat-time.c @@ -22,22 +22,10 @@ #include <fcntl.h> #include <signal.h> -#include <stdio.h> -#include <stdlib.h> #include <sys/stat.h> #include <unistd.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" enum { NFILES = 4 }; diff --git a/tests/test-stat.c b/tests/test-stat.c index 9e52a4a7ad..c9fd32785c 100644 --- a/tests/test-stat.c +++ b/tests/test-stat.c @@ -31,23 +31,11 @@ SIGNATURE_CHECK (stat, int, (char const *, struct stat *)); #include <errno.h> #include <stdbool.h> #include <stdio.h> -#include <stdlib.h> #include <unistd.h> #include "pathmax.h" #include "same-inode.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-stat.t" diff --git a/tests/test-strcasestr.c b/tests/test-strcasestr.c index 7c2832abe4..ac68507309 100644 --- a/tests/test-strcasestr.c +++ b/tests/test-strcasestr.c @@ -24,21 +24,10 @@ SIGNATURE_CHECK (strcasestr, char *, (char const *, char const *)); #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/test-strchrnul.c b/tests/test-strchrnul.c index f2f341f6bd..329394f6ed 100644 --- a/tests/test-strchrnul.c +++ b/tests/test-strchrnul.c @@ -22,20 +22,9 @@ #include "signature.h" SIGNATURE_CHECK (strchrnul, char *, (char const *, int)); -#include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (void) diff --git a/tests/test-strerror.c b/tests/test-strerror.c index 986f75aa62..99c3c5f5f4 100644 --- a/tests/test-strerror.c +++ b/tests/test-strerror.c @@ -25,20 +25,8 @@ SIGNATURE_CHECK (strerror, char *, (int)); #include <errno.h> -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) + +#include "macros.h" int main (void) diff --git a/tests/test-striconv.c b/tests/test-striconv.c index 0dc044955f..884737bfb4 100644 --- a/tests/test-striconv.c +++ b/tests/test-striconv.c @@ -1,5 +1,5 @@ /* Test of character set conversion. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -25,21 +25,10 @@ #endif #include <errno.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/test-striconveh.c b/tests/test-striconveh.c index bd2579ee1e..6ab021846d 100644 --- a/tests/test-striconveh.c +++ b/tests/test-striconveh.c @@ -25,22 +25,10 @@ #endif #include <errno.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Magic number for detecting bounds violations. */ #define MAGIC 0x1983EFF1 diff --git a/tests/test-striconveha.c b/tests/test-striconveha.c index 96660b2607..b2fd823c99 100644 --- a/tests/test-striconveha.c +++ b/tests/test-striconveha.c @@ -1,5 +1,5 @@ /* Test of character set conversion with error handling and autodetection. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -25,22 +25,10 @@ #endif #include <errno.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Magic number for detecting bounds violations. */ #define MAGIC 0x1983EFF1 diff --git a/tests/test-strsignal.c b/tests/test-strsignal.c index bf97dc683c..e3690d8472 100644 --- a/tests/test-strsignal.c +++ b/tests/test-strsignal.c @@ -25,20 +25,8 @@ SIGNATURE_CHECK (strsignal, char *, (int)); #include <signal.h> -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) + +#include "macros.h" #if HAVE_DECL_SYS_SIGLIST # define ASSERT_DESCRIPTION(got, expect) diff --git a/tests/test-strstr.c b/tests/test-strstr.c index 6bffc13242..b20d6446bc 100644 --- a/tests/test-strstr.c +++ b/tests/test-strstr.c @@ -23,23 +23,11 @@ SIGNATURE_CHECK (strstr, char *, (char const *, char const *)); #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "zerosize-ptr.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char *argv[]) diff --git a/tests/test-strtod.c b/tests/test-strtod.c index affd52cd5e..e0f2eebd6c 100644 --- a/tests/test-strtod.c +++ b/tests/test-strtod.c @@ -25,22 +25,10 @@ SIGNATURE_CHECK (strtod, double, (char const *, char **)); #include <errno.h> #include <float.h> #include <math.h> -#include <stdio.h> #include <string.h> #include "isnand-nolibm.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - /* FIXME abort ();*/status = 1; \ - } \ - } \ - while (0) +#include "macros.h" /* Avoid requiring -lm just for fabs. */ #define FABS(d) ((d) < 0.0 ? -(d) : (d)) diff --git a/tests/test-strverscmp.c b/tests/test-strverscmp.c index 72b574d0fc..8e9cc035aa 100644 --- a/tests/test-strverscmp.c +++ b/tests/test-strverscmp.c @@ -24,20 +24,7 @@ #include "signature.h" SIGNATURE_CHECK (strverscmp, int, (const char *, const char *)); -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (void) diff --git a/tests/test-symlink.c b/tests/test-symlink.c index c84e0064b2..c84b2bc7f1 100644 --- a/tests/test-symlink.c +++ b/tests/test-symlink.c @@ -30,17 +30,7 @@ SIGNATURE_CHECK (symlink, int, (char const *, char const *)); #include <stdlib.h> #include <sys/stat.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-symlink.t" diff --git a/tests/test-symlinkat.c b/tests/test-symlinkat.c index 67f0adf668..714dd98932 100644 --- a/tests/test-symlinkat.c +++ b/tests/test-symlinkat.c @@ -32,22 +32,12 @@ SIGNATURE_CHECK (readlinkat, ssize_t, (int, char const *, char *, size_t)); #include <string.h> #include <sys/stat.h> +#include "macros.h" + #ifndef HAVE_SYMLINK # define HAVE_SYMLINK 0 #endif -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) - #define BASE "test-symlinkat.t" #include "test-readlink.h" diff --git a/tests/test-trunc1.c b/tests/test-trunc1.c index 0c92cc6e2c..cd5a57ee1d 100644 --- a/tests/test-trunc1.c +++ b/tests/test-trunc1.c @@ -23,23 +23,9 @@ #include "signature.h" SIGNATURE_CHECK (trunc, double, (double)); -#include <stdio.h> -#include <stdlib.h> - #include "isnand-nolibm.h" #include "nan.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0. So we use -zero instead. */ diff --git a/tests/test-trunc2.c b/tests/test-trunc2.c index f704bcb1ee..d0da5519cc 100644 --- a/tests/test-trunc2.c +++ b/tests/test-trunc2.c @@ -1,5 +1,5 @@ /* Test of rounding towards zero. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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,21 +24,9 @@ #include <stdbool.h> #include <stdint.h> #include <stdio.h> -#include <stdlib.h> #include "isnand-nolibm.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* The reference implementation, taken from lib/trunc.c. */ diff --git a/tests/test-truncf1.c b/tests/test-truncf1.c index 44fd8c11fa..dc49645f9f 100644 --- a/tests/test-truncf1.c +++ b/tests/test-truncf1.c @@ -23,23 +23,9 @@ #include "signature.h" SIGNATURE_CHECK (truncf, float, (float)); -#include <stdio.h> -#include <stdlib.h> - #include "isnanf-nolibm.h" #include "nan.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* HP cc on HP-UX 10.20 has a bug with the constant expression -0.0f. So we use -zero instead. */ diff --git a/tests/test-truncf2.c b/tests/test-truncf2.c index 91ebb74aff..8d02e21986 100644 --- a/tests/test-truncf2.c +++ b/tests/test-truncf2.c @@ -1,5 +1,5 @@ /* Test of rounding towards zero. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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,21 +24,9 @@ #include <stdbool.h> #include <stdint.h> #include <stdio.h> -#include <stdlib.h> #include "isnanf-nolibm.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* The reference implementation, taken from lib/trunc.c. */ diff --git a/tests/test-truncl.c b/tests/test-truncl.c index 3b36ea7c46..4b76cc8c88 100644 --- a/tests/test-truncl.c +++ b/tests/test-truncl.c @@ -24,24 +24,11 @@ SIGNATURE_CHECK (truncl, long double, (long double)); #include <float.h> -#include <stdio.h> -#include <stdlib.h> #include "fpucw.h" #include "isnanl-nolibm.h" #include "nan.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* On HP-UX 10.20, negating 0.0L does not yield -0.0L. So we use minus_zero instead. diff --git a/tests/test-uname.c b/tests/test-uname.c index b37ae9b4d7..2a4fe1313b 100644 --- a/tests/test-uname.c +++ b/tests/test-uname.c @@ -24,20 +24,9 @@ SIGNATURE_CHECK (uname, int, (struct utsname *)); #include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* This program can be called with no arguments, then it performs a unit diff --git a/tests/test-unlink.c b/tests/test-unlink.c index ffc360da04..15258028a5 100644 --- a/tests/test-unlink.c +++ b/tests/test-unlink.c @@ -32,18 +32,7 @@ SIGNATURE_CHECK (unlink, int, (char const *)); #include <sys/stat.h> #include "unlinkdir.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-unlink.t" diff --git a/tests/test-unlinkat.c b/tests/test-unlinkat.c index 313cf1ebf2..3d7f118410 100644 --- a/tests/test-unlinkat.c +++ b/tests/test-unlinkat.c @@ -31,18 +31,7 @@ SIGNATURE_CHECK (unlinkat, int, (int, char const *, int)); #include <sys/stat.h> #include "unlinkdir.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-unlinkat.t" diff --git a/tests/test-unsetenv.c b/tests/test-unsetenv.c index 6f80751788..a8346be677 100644 --- a/tests/test-unsetenv.c +++ b/tests/test-unsetenv.c @@ -24,21 +24,10 @@ SIGNATURE_CHECK (unsetenv, int, (char const *)); #include <errno.h> -#include <stdio.h> #include <string.h> #include <unistd.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (void) diff --git a/tests/test-usleep.c b/tests/test-usleep.c index a792188333..c7b6f75563 100644 --- a/tests/test-usleep.c +++ b/tests/test-usleep.c @@ -23,21 +23,9 @@ #include "signature.h" SIGNATURE_CHECK (usleep, int, (useconds_t)); -#include <stdio.h> -#include <stdlib.h> #include <time.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main(void) diff --git a/tests/test-utimens.c b/tests/test-utimens.c index a36f0428f5..618d941b0a 100644 --- a/tests/test-utimens.c +++ b/tests/test-utimens.c @@ -24,17 +24,7 @@ #include <stdio.h> #include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-utimens.t" diff --git a/tests/test-utimensat.c b/tests/test-utimensat.c index b1dc940125..ba4c22d6ed 100644 --- a/tests/test-utimensat.c +++ b/tests/test-utimensat.c @@ -35,18 +35,7 @@ SIGNATURE_CHECK (utimensat, int, (int, char const *, struct timespec const[2], #include "stat-time.h" #include "timespec.h" #include "utimecmp.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define BASE "test-utimensat.t" diff --git a/tests/test-vasnprintf-posix.c b/tests/test-vasnprintf-posix.c index 0c20a60443..df4f377315 100644 --- a/tests/test-vasnprintf-posix.c +++ b/tests/test-vasnprintf-posix.c @@ -23,26 +23,13 @@ #include <float.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> +#include "macros.h" #include "nan.h" -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) - /* The SGI MIPS floating-point format does not distinguish 0.0 and -0.0. */ static int have_minus_zero () diff --git a/tests/test-vasnprintf-posix2.c b/tests/test-vasnprintf-posix2.c index c2b5f437fd..06c356988b 100644 --- a/tests/test-vasnprintf-posix2.c +++ b/tests/test-vasnprintf-posix2.c @@ -1,5 +1,5 @@ /* Test of POSIX compatible vasnprintf() and asnprintf() functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -21,21 +21,10 @@ #include "vasnprintf.h" #include <locale.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char *argv[]) diff --git a/tests/test-vasnprintf.c b/tests/test-vasnprintf.c index 280e1f47f2..2f7f0dbed4 100644 --- a/tests/test-vasnprintf.c +++ b/tests/test-vasnprintf.c @@ -1,5 +1,5 @@ /* Test of vasnprintf() and asnprintf() functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -21,21 +21,10 @@ #include "vasnprintf.h" #include <stdarg.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" 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 9f3c4b5683..f8341782dd 100644 --- a/tests/test-vasprintf-posix.c +++ b/tests/test-vasprintf-posix.c @@ -27,21 +27,9 @@ #include <stdlib.h> #include <string.h> +#include "macros.h" #include "nan.h" -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) - /* The SGI MIPS floating-point format does not distinguish 0.0 and -0.0. */ static int have_minus_zero () diff --git a/tests/test-vasprintf.c b/tests/test-vasprintf.c index 46483e4586..654ddfb51a 100644 --- a/tests/test-vasprintf.c +++ b/tests/test-vasprintf.c @@ -28,17 +28,7 @@ SIGNATURE_CHECK (vasprintf, int, (char **, char const *, va_list)); #include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int my_asprintf (char **result, const char *format, ...) diff --git a/tests/test-vdprintf-posix.c b/tests/test-vdprintf-posix.c index 932d289bb7..387a7f45da 100644 --- a/tests/test-vdprintf-posix.c +++ b/tests/test-vdprintf-posix.c @@ -26,20 +26,9 @@ SIGNATURE_CHECK (vdprintf, int, (int, char const *, va_list)); #include <stdarg.h> #include <stddef.h> #include <stdint.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-fprintf-posix.h" diff --git a/tests/test-vfprintf-posix.c b/tests/test-vfprintf-posix.c index 94c8ceab78..bac6aad4ce 100644 --- a/tests/test-vfprintf-posix.c +++ b/tests/test-vfprintf-posix.c @@ -26,20 +26,9 @@ SIGNATURE_CHECK (vfprintf, int, (FILE *, char const *, va_list)); #include <stdarg.h> #include <stddef.h> #include <stdint.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-fprintf-posix.h" diff --git a/tests/test-vprintf-posix.c b/tests/test-vprintf-posix.c index ec6368481e..d08a0e588a 100644 --- a/tests/test-vprintf-posix.c +++ b/tests/test-vprintf-posix.c @@ -26,20 +26,9 @@ SIGNATURE_CHECK (vprintf, int, (char const *, va_list)); #include <stdarg.h> #include <stddef.h> #include <stdint.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-printf-posix.h" diff --git a/tests/test-vsnprintf-posix.c b/tests/test-vsnprintf-posix.c index 7e152c2e88..a409b12429 100644 --- a/tests/test-vsnprintf-posix.c +++ b/tests/test-vsnprintf-posix.c @@ -1,5 +1,5 @@ /* Test of POSIX compatible vsnprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -27,18 +27,7 @@ #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-snprintf-posix.h" diff --git a/tests/test-vsnprintf.c b/tests/test-vsnprintf.c index baaae6f287..717c3e2c37 100644 --- a/tests/test-vsnprintf.c +++ b/tests/test-vsnprintf.c @@ -24,20 +24,9 @@ SIGNATURE_CHECK (vsnprintf, int, (char *, size_t, char const *, va_list)); #include <stdarg.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" 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 49a134781b..d716cb1fd8 100644 --- a/tests/test-vsprintf-posix.c +++ b/tests/test-vsprintf-posix.c @@ -30,18 +30,7 @@ SIGNATURE_CHECK (vsprintf, int, (char *, char const *, va_list)); #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-sprintf-posix.h" diff --git a/tests/test-wcrtomb.c b/tests/test-wcrtomb.c index 3ac33e0f4b..198e09b3be 100644 --- a/tests/test-wcrtomb.c +++ b/tests/test-wcrtomb.c @@ -24,21 +24,10 @@ SIGNATURE_CHECK (wcrtomb, size_t, (char *, wchar_t, mbstate_t *)); #include <locale.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Check the multibyte character s[0..n-1]. */ static void diff --git a/tests/test-wcsnrtombs.c b/tests/test-wcsnrtombs.c index f16dafe407..f108c12e14 100644 --- a/tests/test-wcsnrtombs.c +++ b/tests/test-wcsnrtombs.c @@ -25,21 +25,10 @@ SIGNATURE_CHECK (wcsnrtombs, size_t, (char *, wchar_t const **, size_t, size_t, mbstate_t *)); #include <locale.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char *argv[]) diff --git a/tests/test-wcsrtombs.c b/tests/test-wcsrtombs.c index 4fad01fa17..3139d63022 100644 --- a/tests/test-wcsrtombs.c +++ b/tests/test-wcsrtombs.c @@ -25,21 +25,10 @@ SIGNATURE_CHECK (wcsrtombs, size_t, (char *, wchar_t const **, size_t, mbstate_t *)); #include <locale.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char *argv[]) diff --git a/tests/test-wctype.c b/tests/test-wctype.c index bc28b157f0..fd801d11b7 100644 --- a/tests/test-wctype.c +++ b/tests/test-wctype.c @@ -20,20 +20,7 @@ #include <wctype.h> -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Check that the type wint_t is defined. */ wint_t a = 'x'; diff --git a/tests/test-wcwidth.c b/tests/test-wcwidth.c index f1a89d1440..f95c2c785c 100644 --- a/tests/test-wcwidth.c +++ b/tests/test-wcwidth.c @@ -24,23 +24,10 @@ SIGNATURE_CHECK (wcwidth, int, (wchar_t)); #include <locale.h> -#include <stdio.h> -#include <stdlib.h> #include <string.h> #include "localcharset.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/test-xfprintf-posix.c b/tests/test-xfprintf-posix.c index b7adf76a4c..1db113c211 100644 --- a/tests/test-xfprintf-posix.c +++ b/tests/test-xfprintf-posix.c @@ -22,24 +22,11 @@ #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> -#include <stdlib.h> #include <string.h> #include "progname.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-fprintf-posix.h" diff --git a/tests/test-xmemdup0.c b/tests/test-xmemdup0.c index 2c2e9d27cb..f78203dea6 100644 --- a/tests/test-xmemdup0.c +++ b/tests/test-xmemdup0.c @@ -21,23 +21,11 @@ #include "xmemdup0.h" -#include <stdio.h> #include <stdlib.h> #include <string.h> #include "progname.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char **argv) diff --git a/tests/test-xprintf-posix.c b/tests/test-xprintf-posix.c index 501f04ad50..c8ec895903 100644 --- a/tests/test-xprintf-posix.c +++ b/tests/test-xprintf-posix.c @@ -21,24 +21,11 @@ #include "xprintf.h" #include <stddef.h> -#include <stdio.h> #include <stdint.h> -#include <stdlib.h> #include <string.h> #include "progname.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-printf-posix.h" diff --git a/tests/test-xvasprintf.c b/tests/test-xvasprintf.c index eb230dbb26..9aff3692e4 100644 --- a/tests/test-xvasprintf.c +++ b/tests/test-xvasprintf.c @@ -21,23 +21,11 @@ #include "xvasprintf.h" #include <stdarg.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> #include "progname.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static char * my_xasprintf (const char *format, ...) diff --git a/tests/unicase/test-locale-language.c b/tests/unicase/test-locale-language.c index d6a820d8be..bf6b16d6c6 100644 --- a/tests/unicase/test-locale-language.c +++ b/tests/unicase/test-locale-language.c @@ -21,21 +21,9 @@ #include "unicase.h" #include <locale.h> -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main (int argc, char *argv[]) diff --git a/tests/unicase/test-mapping-part1.h b/tests/unicase/test-mapping-part1.h index ce546e0f6c..eb5e1bc4ce 100644 --- a/tests/unicase/test-mapping-part1.h +++ b/tests/unicase/test-mapping-part1.h @@ -18,23 +18,9 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed for c = 0x%04X\n", \ - __FILE__, __LINE__, c); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) -#define SIZEOF(a) (sizeof(a) / sizeof(a[0])) +#include "macros.h" /* Pair of Unicode characters. */ typedef struct { ucs4_t ch; ucs4_t value; } pair_t; diff --git a/tests/unicase/test-predicate-part1.h b/tests/unicase/test-predicate-part1.h index 1be7960b0f..c47dea09c9 100644 --- a/tests/unicase/test-predicate-part1.h +++ b/tests/unicase/test-predicate-part1.h @@ -18,23 +18,9 @@ #include "unicase/caseprop.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed for c = 0x%04X\n", \ - __FILE__, __LINE__, c); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) -#define SIZEOF(a) (sizeof(a) / sizeof(a[0])) +#include "macros.h" /* Interval of Unicode characters. */ typedef struct { ucs4_t start; ucs4_t end; } interval_t; diff --git a/tests/unicase/test-u16-casecmp.c b/tests/unicase/test-u16-casecmp.c index e758b99206..804b518c1e 100644 --- a/tests/unicase/test-u16-casecmp.c +++ b/tests/unicase/test-u16-casecmp.c @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint16_t #include "test-casecmp.h" diff --git a/tests/unicase/test-u16-casecoll.c b/tests/unicase/test-u16-casecoll.c index d5691c6cae..4384c22768 100644 --- a/tests/unicase/test-u16-casecoll.c +++ b/tests/unicase/test-u16-casecoll.c @@ -21,23 +21,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint16_t #include "test-casecmp.h" diff --git a/tests/unicase/test-u16-casefold.c b/tests/unicase/test-u16-casefold.c index d378b56964..39a1c85d17 100644 --- a/tests/unicase/test-u16-casefold.c +++ b/tests/unicase/test-u16-casefold.c @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint16_t *input, size_t input_length, diff --git a/tests/unicase/test-u16-is-cased.c b/tests/unicase/test-u16-is-cased.c index 722765b046..8c05033aa4 100644 --- a/tests/unicase/test-u16-is-cased.c +++ b/tests/unicase/test-u16-is-cased.c @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint16_t #include "test-is-cased.h" diff --git a/tests/unicase/test-u16-is-casefolded.c b/tests/unicase/test-u16-is-casefolded.c index 77920e956e..3380d1b036 100644 --- a/tests/unicase/test-u16-is-casefolded.c +++ b/tests/unicase/test-u16-is-casefolded.c @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint16_t #include "test-is-casefolded.h" diff --git a/tests/unicase/test-u16-is-lowercase.c b/tests/unicase/test-u16-is-lowercase.c index 7d36094b6f..9d7ba40837 100644 --- a/tests/unicase/test-u16-is-lowercase.c +++ b/tests/unicase/test-u16-is-lowercase.c @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint16_t #include "test-is-lowercase.h" diff --git a/tests/unicase/test-u16-is-titlecase.c b/tests/unicase/test-u16-is-titlecase.c index 1612954137..69732a8081 100644 --- a/tests/unicase/test-u16-is-titlecase.c +++ b/tests/unicase/test-u16-is-titlecase.c @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint16_t #include "test-is-titlecase.h" diff --git a/tests/unicase/test-u16-is-uppercase.c b/tests/unicase/test-u16-is-uppercase.c index 76dcf6c365..d0df07440a 100644 --- a/tests/unicase/test-u16-is-uppercase.c +++ b/tests/unicase/test-u16-is-uppercase.c @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint16_t #include "test-is-uppercase.h" diff --git a/tests/unicase/test-u16-tolower.c b/tests/unicase/test-u16-tolower.c index 97dba74ca2..200cf72090 100644 --- a/tests/unicase/test-u16-tolower.c +++ b/tests/unicase/test-u16-tolower.c @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint16_t *input, size_t input_length, diff --git a/tests/unicase/test-u16-totitle.c b/tests/unicase/test-u16-totitle.c index ae03d3b60a..628dcd4f66 100644 --- a/tests/unicase/test-u16-totitle.c +++ b/tests/unicase/test-u16-totitle.c @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint16_t *input, size_t input_length, diff --git a/tests/unicase/test-u16-toupper.c b/tests/unicase/test-u16-toupper.c index 0831365784..a4dc1fa20d 100644 --- a/tests/unicase/test-u16-toupper.c +++ b/tests/unicase/test-u16-toupper.c @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint16_t *input, size_t input_length, diff --git a/tests/unicase/test-u32-casecmp.c b/tests/unicase/test-u32-casecmp.c index 4f7204b6f8..941b7bd53b 100644 --- a/tests/unicase/test-u32-casecmp.c +++ b/tests/unicase/test-u32-casecmp.c @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint32_t #include "test-casecmp.h" diff --git a/tests/unicase/test-u32-casecoll.c b/tests/unicase/test-u32-casecoll.c index 97a4e0565b..23e4e2fc1b 100644 --- a/tests/unicase/test-u32-casecoll.c +++ b/tests/unicase/test-u32-casecoll.c @@ -21,23 +21,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint32_t #include "test-casecmp.h" diff --git a/tests/unicase/test-u32-casefold.c b/tests/unicase/test-u32-casefold.c index a1ff4a204c..47905794be 100644 --- a/tests/unicase/test-u32-casefold.c +++ b/tests/unicase/test-u32-casefold.c @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint32_t *input, size_t input_length, diff --git a/tests/unicase/test-u32-is-cased.c b/tests/unicase/test-u32-is-cased.c index 020a7a2df8..0a55d612b7 100644 --- a/tests/unicase/test-u32-is-cased.c +++ b/tests/unicase/test-u32-is-cased.c @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint32_t #include "test-is-cased.h" diff --git a/tests/unicase/test-u32-is-casefolded.c b/tests/unicase/test-u32-is-casefolded.c index acfaf255ff..7544eedf02 100644 --- a/tests/unicase/test-u32-is-casefolded.c +++ b/tests/unicase/test-u32-is-casefolded.c @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint32_t #include "test-is-casefolded.h" diff --git a/tests/unicase/test-u32-is-lowercase.c b/tests/unicase/test-u32-is-lowercase.c index ee41ac0054..71959ae032 100644 --- a/tests/unicase/test-u32-is-lowercase.c +++ b/tests/unicase/test-u32-is-lowercase.c @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint32_t #include "test-is-lowercase.h" diff --git a/tests/unicase/test-u32-is-titlecase.c b/tests/unicase/test-u32-is-titlecase.c index b564182455..3cae1470ce 100644 --- a/tests/unicase/test-u32-is-titlecase.c +++ b/tests/unicase/test-u32-is-titlecase.c @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint32_t #include "test-is-titlecase.h" diff --git a/tests/unicase/test-u32-is-uppercase.c b/tests/unicase/test-u32-is-uppercase.c index b67703b741..f7f9e54f07 100644 --- a/tests/unicase/test-u32-is-uppercase.c +++ b/tests/unicase/test-u32-is-uppercase.c @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint32_t #include "test-is-uppercase.h" diff --git a/tests/unicase/test-u32-tolower.c b/tests/unicase/test-u32-tolower.c index cbe1a2b13f..4db01bbf40 100644 --- a/tests/unicase/test-u32-tolower.c +++ b/tests/unicase/test-u32-tolower.c @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint32_t *input, size_t input_length, diff --git a/tests/unicase/test-u32-totitle.c b/tests/unicase/test-u32-totitle.c index ea7ab9a811..6f9bf1b14c 100644 --- a/tests/unicase/test-u32-totitle.c +++ b/tests/unicase/test-u32-totitle.c @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint32_t *input, size_t input_length, diff --git a/tests/unicase/test-u32-toupper.c b/tests/unicase/test-u32-toupper.c index c431b3d52f..631d4dbe6e 100644 --- a/tests/unicase/test-u32-toupper.c +++ b/tests/unicase/test-u32-toupper.c @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint32_t *input, size_t input_length, diff --git a/tests/unicase/test-u8-casecmp.c b/tests/unicase/test-u8-casecmp.c index c1f3746156..af15fddfb3 100644 --- a/tests/unicase/test-u8-casecmp.c +++ b/tests/unicase/test-u8-casecmp.c @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint8_t #include "test-casecmp.h" diff --git a/tests/unicase/test-u8-casecoll.c b/tests/unicase/test-u8-casecoll.c index 5e4d69eae9..9be6ee60e4 100644 --- a/tests/unicase/test-u8-casecoll.c +++ b/tests/unicase/test-u8-casecoll.c @@ -21,23 +21,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint8_t #include "test-casecmp.h" diff --git a/tests/unicase/test-u8-casefold.c b/tests/unicase/test-u8-casefold.c index 5bf87bc84a..2bffde4247 100644 --- a/tests/unicase/test-u8-casefold.c +++ b/tests/unicase/test-u8-casefold.c @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint8_t *input, size_t input_length, diff --git a/tests/unicase/test-u8-is-cased.c b/tests/unicase/test-u8-is-cased.c index 202eeea1c4..ae454fd4de 100644 --- a/tests/unicase/test-u8-is-cased.c +++ b/tests/unicase/test-u8-is-cased.c @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint8_t #include "test-is-cased.h" diff --git a/tests/unicase/test-u8-is-casefolded.c b/tests/unicase/test-u8-is-casefolded.c index a17626ca96..31006ae38f 100644 --- a/tests/unicase/test-u8-is-casefolded.c +++ b/tests/unicase/test-u8-is-casefolded.c @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint8_t #include "test-is-casefolded.h" diff --git a/tests/unicase/test-u8-is-lowercase.c b/tests/unicase/test-u8-is-lowercase.c index 7c3491db67..b778d652c4 100644 --- a/tests/unicase/test-u8-is-lowercase.c +++ b/tests/unicase/test-u8-is-lowercase.c @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint8_t #include "test-is-lowercase.h" diff --git a/tests/unicase/test-u8-is-titlecase.c b/tests/unicase/test-u8-is-titlecase.c index 05bb644f0d..47467a1707 100644 --- a/tests/unicase/test-u8-is-titlecase.c +++ b/tests/unicase/test-u8-is-titlecase.c @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint8_t #include "test-is-titlecase.h" diff --git a/tests/unicase/test-u8-is-uppercase.c b/tests/unicase/test-u8-is-uppercase.c index 77d37032f0..094fce7b2b 100644 --- a/tests/unicase/test-u8-is-uppercase.c +++ b/tests/unicase/test-u8-is-uppercase.c @@ -20,23 +20,8 @@ #include "unicase.h" -#include <stdio.h> -#include <stdlib.h> - #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT uint8_t #include "test-is-uppercase.h" diff --git a/tests/unicase/test-u8-tolower.c b/tests/unicase/test-u8-tolower.c index bd07aceb62..21acdaeade 100644 --- a/tests/unicase/test-u8-tolower.c +++ b/tests/unicase/test-u8-tolower.c @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint8_t *input, size_t input_length, diff --git a/tests/unicase/test-u8-totitle.c b/tests/unicase/test-u8-totitle.c index ddf1bea184..927897cb56 100644 --- a/tests/unicase/test-u8-totitle.c +++ b/tests/unicase/test-u8-totitle.c @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint8_t *input, size_t input_length, diff --git a/tests/unicase/test-u8-toupper.c b/tests/unicase/test-u8-toupper.c index 605fd737c5..edf863ccfd 100644 --- a/tests/unicase/test-u8-toupper.c +++ b/tests/unicase/test-u8-toupper.c @@ -20,24 +20,11 @@ #include "unicase.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint8_t *input, size_t input_length, diff --git a/tests/unicase/test-ulc-casecmp.c b/tests/unicase/test-ulc-casecmp.c index f1400ef384..89427d3e90 100644 --- a/tests/unicase/test-ulc-casecmp.c +++ b/tests/unicase/test-ulc-casecmp.c @@ -21,21 +21,7 @@ #include "unicase.h" #include <locale.h> -#include <stdio.h> -#include <stdlib.h> - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT char #include "test-casecmp.h" diff --git a/tests/unicase/test-ulc-casecoll.c b/tests/unicase/test-ulc-casecoll.c index d669fde2c6..d247fef4dc 100644 --- a/tests/unicase/test-ulc-casecoll.c +++ b/tests/unicase/test-ulc-casecoll.c @@ -22,23 +22,9 @@ #include "unicase.h" #include <locale.h> -#include <stdio.h> -#include <stdlib.h> #include "uninorm.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define UNIT char #include "test-casecmp.h" diff --git a/tests/uniconv/test-u16-conv-from-enc.c b/tests/uniconv/test-u16-conv-from-enc.c index e4ec6a639f..2791f1c604 100644 --- a/tests/uniconv/test-u16-conv-from-enc.c +++ b/tests/uniconv/test-u16-conv-from-enc.c @@ -20,24 +20,11 @@ #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) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Magic number for detecting bounds violations. */ #define MAGIC 0x1983EFF1 diff --git a/tests/uniconv/test-u16-conv-to-enc.c b/tests/uniconv/test-u16-conv-to-enc.c index 2bdf1b1e37..03f40e639f 100644 --- a/tests/uniconv/test-u16-conv-to-enc.c +++ b/tests/uniconv/test-u16-conv-to-enc.c @@ -21,22 +21,10 @@ #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) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* 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 da2bc87ad7..323f633a93 100644 --- a/tests/uniconv/test-u16-strconv-from-enc.c +++ b/tests/uniconv/test-u16-strconv-from-enc.c @@ -20,23 +20,10 @@ #include "uniconv.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uniconv/test-u16-strconv-to-enc.c b/tests/uniconv/test-u16-strconv-to-enc.c index 512b16cedd..2bc35c0889 100644 --- a/tests/uniconv/test-u16-strconv-to-enc.c +++ b/tests/uniconv/test-u16-strconv-to-enc.c @@ -1,5 +1,5 @@ /* Test of conversion from UTF-16 to legacy encodings. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -21,22 +21,10 @@ #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) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uniconv/test-u32-conv-from-enc.c b/tests/uniconv/test-u32-conv-from-enc.c index 1b62159361..c88789b7b9 100644 --- a/tests/uniconv/test-u32-conv-from-enc.c +++ b/tests/uniconv/test-u32-conv-from-enc.c @@ -20,24 +20,11 @@ #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) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Magic number for detecting bounds violations. */ #define MAGIC 0x1983EFF1 diff --git a/tests/uniconv/test-u32-conv-to-enc.c b/tests/uniconv/test-u32-conv-to-enc.c index 603d920151..ec442255b7 100644 --- a/tests/uniconv/test-u32-conv-to-enc.c +++ b/tests/uniconv/test-u32-conv-to-enc.c @@ -21,22 +21,10 @@ #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) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* 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 3203c4f147..beb9f8234f 100644 --- a/tests/uniconv/test-u32-strconv-from-enc.c +++ b/tests/uniconv/test-u32-strconv-from-enc.c @@ -20,23 +20,10 @@ #include "uniconv.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uniconv/test-u32-strconv-to-enc.c b/tests/uniconv/test-u32-strconv-to-enc.c index ce4537af30..a92679e434 100644 --- a/tests/uniconv/test-u32-strconv-to-enc.c +++ b/tests/uniconv/test-u32-strconv-to-enc.c @@ -1,5 +1,5 @@ /* Test of conversion from UTF-32 to legacy encodings. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -21,22 +21,9 @@ #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) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uniconv/test-u8-conv-from-enc.c b/tests/uniconv/test-u8-conv-from-enc.c index 29722a185d..73ac275cc2 100644 --- a/tests/uniconv/test-u8-conv-from-enc.c +++ b/tests/uniconv/test-u8-conv-from-enc.c @@ -20,24 +20,11 @@ #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) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* Magic number for detecting bounds violations. */ #define MAGIC 0x1983EFF1 diff --git a/tests/uniconv/test-u8-conv-to-enc.c b/tests/uniconv/test-u8-conv-to-enc.c index 080896fbfc..3fee61b9cf 100644 --- a/tests/uniconv/test-u8-conv-to-enc.c +++ b/tests/uniconv/test-u8-conv-to-enc.c @@ -21,24 +21,11 @@ #include "uniconv.h" #include <errno.h> -#include <stdio.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* 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 89c48d33fb..e733f73eba 100644 --- a/tests/uniconv/test-u8-strconv-from-enc.c +++ b/tests/uniconv/test-u8-strconv-from-enc.c @@ -20,23 +20,10 @@ #include "uniconv.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uniconv/test-u8-strconv-to-enc.c b/tests/uniconv/test-u8-strconv-to-enc.c index f19aa4f0f6..0ee4ff28b6 100644 --- a/tests/uniconv/test-u8-strconv-to-enc.c +++ b/tests/uniconv/test-u8-strconv-to-enc.c @@ -1,5 +1,5 @@ /* Test of conversion from UTF-8 to legacy encodings. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -21,22 +21,10 @@ #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) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-bidi_byname.c b/tests/unictype/test-bidi_byname.c index c3a72d6b02..9032794906 100644 --- a/tests/unictype/test-bidi_byname.c +++ b/tests/unictype/test-bidi_byname.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-bidi_name.c b/tests/unictype/test-bidi_name.c index 300e98405c..1a4ef0bab4 100644 --- a/tests/unictype/test-bidi_name.c +++ b/tests/unictype/test-bidi_name.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-bidi_of.c b/tests/unictype/test-bidi_of.c index e06af1938a..91fda1533a 100644 --- a/tests/unictype/test-bidi_of.c +++ b/tests/unictype/test-bidi_of.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-bidi_test.c b/tests/unictype/test-bidi_test.c index 468a4021f5..c9e7b39f89 100644 --- a/tests/unictype/test-bidi_test.c +++ b/tests/unictype/test-bidi_test.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-block_list.c b/tests/unictype/test-block_list.c index 3b37ae6e9e..d475546494 100644 --- a/tests/unictype/test-block_list.c +++ b/tests/unictype/test-block_list.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-block_of.c b/tests/unictype/test-block_of.c index 93206bdf7f..230fa87d44 100644 --- a/tests/unictype/test-block_of.c +++ b/tests/unictype/test-block_of.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-block_test.c b/tests/unictype/test-block_test.c index d901ef1ce7..8971a39953 100644 --- a/tests/unictype/test-block_test.c +++ b/tests/unictype/test-block_test.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-categ_and.c b/tests/unictype/test-categ_and.c index 301daafd67..70d28cc0af 100644 --- a/tests/unictype/test-categ_and.c +++ b/tests/unictype/test-categ_and.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-categ_and_not.c b/tests/unictype/test-categ_and_not.c index 4c4990f18d..72afe83f27 100644 --- a/tests/unictype/test-categ_and_not.c +++ b/tests/unictype/test-categ_and_not.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-categ_byname.c b/tests/unictype/test-categ_byname.c index 9eceeea0ba..a639f6ee17 100644 --- a/tests/unictype/test-categ_byname.c +++ b/tests/unictype/test-categ_byname.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-categ_name.c b/tests/unictype/test-categ_name.c index df088c47b9..bef6600718 100644 --- a/tests/unictype/test-categ_name.c +++ b/tests/unictype/test-categ_name.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-categ_none.c b/tests/unictype/test-categ_none.c index 606b10eccd..bc0a9a7b4e 100644 --- a/tests/unictype/test-categ_none.c +++ b/tests/unictype/test-categ_none.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-categ_of.c b/tests/unictype/test-categ_of.c index dc17c52661..26d04634b7 100644 --- a/tests/unictype/test-categ_of.c +++ b/tests/unictype/test-categ_of.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-categ_or.c b/tests/unictype/test-categ_or.c index 5865eb04c2..7973eb003d 100644 --- a/tests/unictype/test-categ_or.c +++ b/tests/unictype/test-categ_or.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-categ_test_withtable.c b/tests/unictype/test-categ_test_withtable.c index a1ee7d5e26..8e52a370c9 100644 --- a/tests/unictype/test-categ_test_withtable.c +++ b/tests/unictype/test-categ_test_withtable.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-combining.c b/tests/unictype/test-combining.c index fec2a13ad3..d890f1d4c5 100644 --- a/tests/unictype/test-combining.c +++ b/tests/unictype/test-combining.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-decdigit.c b/tests/unictype/test-decdigit.c index 04064ef9de..f94605ef2e 100644 --- a/tests/unictype/test-decdigit.c +++ b/tests/unictype/test-decdigit.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -18,22 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) -#define SIZEOF(a) (sizeof(a) / sizeof(a[0])) +#include "macros.h" static const struct { unsigned int ch; int value; } mapping[] = { diff --git a/tests/unictype/test-digit.c b/tests/unictype/test-digit.c index fbcf502096..e87f3f7570 100644 --- a/tests/unictype/test-digit.c +++ b/tests/unictype/test-digit.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -18,22 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) -#define SIZEOF(a) (sizeof(a) / sizeof(a[0])) +#include "macros.h" static const struct { unsigned int ch; int value; } mapping[] = { diff --git a/tests/unictype/test-mirror.c b/tests/unictype/test-mirror.c index 443ee3e5e4..457c502b45 100644 --- a/tests/unictype/test-mirror.c +++ b/tests/unictype/test-mirror.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-numeric.c b/tests/unictype/test-numeric.c index dfd90be0a9..d602383170 100644 --- a/tests/unictype/test-numeric.c +++ b/tests/unictype/test-numeric.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -18,22 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) -#define SIZEOF(a) (sizeof(a) / sizeof(a[0])) +#include "macros.h" static const struct { unsigned int ch; int numerator; int denominator; } mapping[] = diff --git a/tests/unictype/test-pr_byname.c b/tests/unictype/test-pr_byname.c index 056f3e8892..aa2676f09f 100644 --- a/tests/unictype/test-pr_byname.c +++ b/tests/unictype/test-pr_byname.c @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-pr_test.c b/tests/unictype/test-pr_test.c index 424dc1c60c..6bacc078a1 100644 --- a/tests/unictype/test-pr_test.c +++ b/tests/unictype/test-pr_test.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-predicate-part1.h b/tests/unictype/test-predicate-part1.h index 6278d50458..1031856d64 100644 --- a/tests/unictype/test-predicate-part1.h +++ b/tests/unictype/test-predicate-part1.h @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -18,23 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed for c = 0x%04X\n", \ - __FILE__, __LINE__, c); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) -#define SIZEOF(a) (sizeof(a) / sizeof(a[0])) +#include "macros.h" /* Interval of Unicode characters. */ typedef struct { ucs4_t start; ucs4_t end; } interval_t; diff --git a/tests/unictype/test-scripts.c b/tests/unictype/test-scripts.c index 5c16cc5a0f..610b47331a 100644 --- a/tests/unictype/test-scripts.c +++ b/tests/unictype/test-scripts.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-sy_c_ident.c b/tests/unictype/test-sy_c_ident.c index 2182b26ed4..026db18198 100644 --- a/tests/unictype/test-sy_c_ident.c +++ b/tests/unictype/test-sy_c_ident.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unictype/test-sy_java_ident.c b/tests/unictype/test-sy_java_ident.c index 214e3120de..ed9ddeb9a3 100644 --- a/tests/unictype/test-sy_java_ident.c +++ b/tests/unictype/test-sy_java_ident.c @@ -1,5 +1,5 @@ /* Test the Unicode character type functions. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -18,21 +18,9 @@ #include "unictype.h" -#include <stdio.h> -#include <stdlib.h> #include <string.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unilbrk/test-u16-possible-linebreaks.c b/tests/unilbrk/test-u16-possible-linebreaks.c index a374d55121..5cdee3fe95 100644 --- a/tests/unilbrk/test-u16-possible-linebreaks.c +++ b/tests/unilbrk/test-u16-possible-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of UTF-16 strings. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2009 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 @@ -20,21 +20,9 @@ #include "unilbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unilbrk/test-u16-width-linebreaks.c b/tests/unilbrk/test-u16-width-linebreaks.c index e55c46a1ae..6deab7030e 100644 --- a/tests/unilbrk/test-u16-width-linebreaks.c +++ b/tests/unilbrk/test-u16-width-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of UTF-16 strings. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2009 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 @@ -20,21 +20,9 @@ #include "unilbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unilbrk/test-u32-possible-linebreaks.c b/tests/unilbrk/test-u32-possible-linebreaks.c index b9696bb81c..fb27f0847a 100644 --- a/tests/unilbrk/test-u32-possible-linebreaks.c +++ b/tests/unilbrk/test-u32-possible-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of UTF-32 strings. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2009 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 @@ -20,21 +20,9 @@ #include "unilbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unilbrk/test-u32-width-linebreaks.c b/tests/unilbrk/test-u32-width-linebreaks.c index 5a103cca36..57c96967ab 100644 --- a/tests/unilbrk/test-u32-width-linebreaks.c +++ b/tests/unilbrk/test-u32-width-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of UTF-32 strings. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2009 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 @@ -20,21 +20,9 @@ #include "unilbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unilbrk/test-u8-possible-linebreaks.c b/tests/unilbrk/test-u8-possible-linebreaks.c index c8450f7825..7e9daa686f 100644 --- a/tests/unilbrk/test-u8-possible-linebreaks.c +++ b/tests/unilbrk/test-u8-possible-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of UTF-8 strings. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2009 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 @@ -20,21 +20,9 @@ #include "unilbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unilbrk/test-u8-width-linebreaks.c b/tests/unilbrk/test-u8-width-linebreaks.c index 3502d8c707..5ba5effd74 100644 --- a/tests/unilbrk/test-u8-width-linebreaks.c +++ b/tests/unilbrk/test-u8-width-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of UTF-8 strings. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2009 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 @@ -20,21 +20,9 @@ #include "unilbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unilbrk/test-ulc-possible-linebreaks.c b/tests/unilbrk/test-ulc-possible-linebreaks.c index 2179a34d82..52e8da645d 100644 --- a/tests/unilbrk/test-ulc-possible-linebreaks.c +++ b/tests/unilbrk/test-ulc-possible-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of strings. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2009 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 @@ -20,21 +20,9 @@ #include "unilbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/unilbrk/test-ulc-width-linebreaks.c b/tests/unilbrk/test-ulc-width-linebreaks.c index 4661978811..9ff7147db6 100644 --- a/tests/unilbrk/test-ulc-width-linebreaks.c +++ b/tests/unilbrk/test-ulc-width-linebreaks.c @@ -1,5 +1,5 @@ /* Test of line breaking of strings. - Copyright (C) 2008 Free Software Foundation, Inc. + Copyright (C) 2008-2009 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 @@ -20,21 +20,9 @@ #include "unilbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uninorm/test-canonical-decomposition.c b/tests/uninorm/test-canonical-decomposition.c index 5d3db60bf3..af01740fa4 100644 --- a/tests/uninorm/test-canonical-decomposition.c +++ b/tests/uninorm/test-canonical-decomposition.c @@ -20,20 +20,7 @@ #include "uninorm.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uninorm/test-compat-decomposition.c b/tests/uninorm/test-compat-decomposition.c index 766cd40c09..21bbb68189 100644 --- a/tests/uninorm/test-compat-decomposition.c +++ b/tests/uninorm/test-compat-decomposition.c @@ -20,22 +20,8 @@ #include "uninorm/decompose-internal.h" -#include <stdio.h> -#include <stdlib.h> - #include "uninorm.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uninorm/test-composition.c b/tests/uninorm/test-composition.c index 5519050240..c499f6557a 100644 --- a/tests/uninorm/test-composition.c +++ b/tests/uninorm/test-composition.c @@ -20,20 +20,7 @@ #include "uninorm.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uninorm/test-decomposing-form.c b/tests/uninorm/test-decomposing-form.c index c9444b7342..707462c0cd 100644 --- a/tests/uninorm/test-decomposing-form.c +++ b/tests/uninorm/test-decomposing-form.c @@ -20,20 +20,7 @@ #include "uninorm.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uninorm/test-decomposition.c b/tests/uninorm/test-decomposition.c index c7fa6c23ce..1afc852efd 100644 --- a/tests/uninorm/test-decomposition.c +++ b/tests/uninorm/test-decomposition.c @@ -20,20 +20,7 @@ #include "uninorm.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uninorm/test-u16-nfc.c b/tests/uninorm/test-u16-nfc.c index 73523e0f7a..b2a6e772e4 100644 --- a/tests/uninorm/test-u16-nfc.c +++ b/tests/uninorm/test-u16-nfc.c @@ -23,24 +23,11 @@ #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint16_t *input, size_t input_length, diff --git a/tests/uninorm/test-u16-nfd.c b/tests/uninorm/test-u16-nfd.c index 8d35bac3f6..cfb0dac925 100644 --- a/tests/uninorm/test-u16-nfd.c +++ b/tests/uninorm/test-u16-nfd.c @@ -23,24 +23,11 @@ #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint16_t *input, size_t input_length, diff --git a/tests/uninorm/test-u16-nfkc.c b/tests/uninorm/test-u16-nfkc.c index 362bc5b353..37a7cd740c 100644 --- a/tests/uninorm/test-u16-nfkc.c +++ b/tests/uninorm/test-u16-nfkc.c @@ -23,24 +23,11 @@ #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint16_t *input, size_t input_length, diff --git a/tests/uninorm/test-u16-nfkd.c b/tests/uninorm/test-u16-nfkd.c index 8e38f08ef8..1373e2b42a 100644 --- a/tests/uninorm/test-u16-nfkd.c +++ b/tests/uninorm/test-u16-nfkd.c @@ -23,24 +23,11 @@ #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint16_t *input, size_t input_length, diff --git a/tests/uninorm/test-u16-normcmp.c b/tests/uninorm/test-u16-normcmp.c index 6fa42c39b1..42a040d445 100644 --- a/tests/uninorm/test-u16-normcmp.c +++ b/tests/uninorm/test-u16-normcmp.c @@ -20,21 +20,7 @@ #include "uninorm.h" -#include <stdio.h> -#include <stdlib.h> - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u16-normcmp.h" diff --git a/tests/uninorm/test-u16-normcoll.c b/tests/uninorm/test-u16-normcoll.c index 550e31de0b..311a0949bd 100644 --- a/tests/uninorm/test-u16-normcoll.c +++ b/tests/uninorm/test-u16-normcoll.c @@ -21,21 +21,7 @@ #include "uninorm.h" -#include <stdio.h> -#include <stdlib.h> - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u16-normcmp.h" int diff --git a/tests/uninorm/test-u32-nfc.c b/tests/uninorm/test-u32-nfc.c index eda22023bf..19b86fd2eb 100644 --- a/tests/uninorm/test-u32-nfc.c +++ b/tests/uninorm/test-u32-nfc.c @@ -23,24 +23,11 @@ #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint32_t *input, size_t input_length, diff --git a/tests/uninorm/test-u32-nfd.c b/tests/uninorm/test-u32-nfd.c index 21776ece2f..187eac1a2c 100644 --- a/tests/uninorm/test-u32-nfd.c +++ b/tests/uninorm/test-u32-nfd.c @@ -23,24 +23,11 @@ #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint32_t *input, size_t input_length, diff --git a/tests/uninorm/test-u32-nfkc.c b/tests/uninorm/test-u32-nfkc.c index 6aa68fa9ce..50c634c56b 100644 --- a/tests/uninorm/test-u32-nfkc.c +++ b/tests/uninorm/test-u32-nfkc.c @@ -23,24 +23,11 @@ #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint32_t *input, size_t input_length, diff --git a/tests/uninorm/test-u32-nfkd.c b/tests/uninorm/test-u32-nfkd.c index b932ae24b5..2150a4ecc4 100644 --- a/tests/uninorm/test-u32-nfkd.c +++ b/tests/uninorm/test-u32-nfkd.c @@ -23,24 +23,11 @@ #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint32_t *input, size_t input_length, diff --git a/tests/uninorm/test-u32-normalize-big.c b/tests/uninorm/test-u32-normalize-big.c index 5cf60a6e4c..831066b3f9 100644 --- a/tests/uninorm/test-u32-normalize-big.c +++ b/tests/uninorm/test-u32-normalize-big.c @@ -28,18 +28,7 @@ #include "xalloc.h" #include "unistr.h" - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #define ASSERT_WITH_LINE(expr, file, line) \ do \ diff --git a/tests/uninorm/test-u32-normcmp.c b/tests/uninorm/test-u32-normcmp.c index 3edeffd61a..40253d8246 100644 --- a/tests/uninorm/test-u32-normcmp.c +++ b/tests/uninorm/test-u32-normcmp.c @@ -20,21 +20,7 @@ #include "uninorm.h" -#include <stdio.h> -#include <stdlib.h> - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u32-normcmp.h" diff --git a/tests/uninorm/test-u32-normcoll.c b/tests/uninorm/test-u32-normcoll.c index 0019770b59..2efee6cf83 100644 --- a/tests/uninorm/test-u32-normcoll.c +++ b/tests/uninorm/test-u32-normcoll.c @@ -21,21 +21,7 @@ #include "uninorm.h" -#include <stdio.h> -#include <stdlib.h> - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u32-normcmp.h" int diff --git a/tests/uninorm/test-u8-nfc.c b/tests/uninorm/test-u8-nfc.c index 3eb71a47dd..675730fbac 100644 --- a/tests/uninorm/test-u8-nfc.c +++ b/tests/uninorm/test-u8-nfc.c @@ -23,24 +23,11 @@ #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint8_t *input, size_t input_length, diff --git a/tests/uninorm/test-u8-nfd.c b/tests/uninorm/test-u8-nfd.c index 93bf297bcd..1ccd668c41 100644 --- a/tests/uninorm/test-u8-nfd.c +++ b/tests/uninorm/test-u8-nfd.c @@ -23,24 +23,11 @@ #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint8_t *input, size_t input_length, diff --git a/tests/uninorm/test-u8-nfkc.c b/tests/uninorm/test-u8-nfkc.c index fcc50a34c3..b93ba7a69e 100644 --- a/tests/uninorm/test-u8-nfkc.c +++ b/tests/uninorm/test-u8-nfkc.c @@ -23,24 +23,11 @@ #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint8_t *input, size_t input_length, diff --git a/tests/uninorm/test-u8-nfkd.c b/tests/uninorm/test-u8-nfkd.c index f1246d80c2..34c31ea8bb 100644 --- a/tests/uninorm/test-u8-nfkd.c +++ b/tests/uninorm/test-u8-nfkd.c @@ -23,24 +23,11 @@ #include "uninorm.h" #include <signal.h> -#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static int check (const uint8_t *input, size_t input_length, diff --git a/tests/uninorm/test-u8-normcmp.c b/tests/uninorm/test-u8-normcmp.c index 643dd3e071..487442ff1a 100644 --- a/tests/uninorm/test-u8-normcmp.c +++ b/tests/uninorm/test-u8-normcmp.c @@ -20,21 +20,7 @@ #include "uninorm.h" -#include <stdio.h> -#include <stdlib.h> - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u8-normcmp.h" diff --git a/tests/uninorm/test-u8-normcoll.c b/tests/uninorm/test-u8-normcoll.c index 4f907308f5..c86458a9fb 100644 --- a/tests/uninorm/test-u8-normcoll.c +++ b/tests/uninorm/test-u8-normcoll.c @@ -21,21 +21,7 @@ #include "uninorm.h" -#include <stdio.h> -#include <stdlib.h> - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u8-normcmp.h" int diff --git a/tests/uninorm/test-uninorm-filter-nfc.c b/tests/uninorm/test-uninorm-filter-nfc.c index 1dd040301c..7e6851917e 100644 --- a/tests/uninorm/test-uninorm-filter-nfc.c +++ b/tests/uninorm/test-uninorm-filter-nfc.c @@ -20,23 +20,10 @@ #include "uninorm.h" -#include <stdio.h> #include <stdlib.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* A stream of Unicode characters that simply accumulates the contents. */ diff --git a/tests/unistdio/test-u16-asnprintf1.c b/tests/unistdio/test-u16-asnprintf1.c index f2d2f706b6..e4ead6eb0b 100644 --- a/tests/unistdio/test-u16-asnprintf1.c +++ b/tests/unistdio/test-u16-asnprintf1.c @@ -1,5 +1,5 @@ /* Test of u16_asnprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -23,25 +23,12 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u16-asnprintf1.h" diff --git a/tests/unistdio/test-u16-vasnprintf1.c b/tests/unistdio/test-u16-vasnprintf1.c index 7907168c05..7d729e8d60 100644 --- a/tests/unistdio/test-u16-vasnprintf1.c +++ b/tests/unistdio/test-u16-vasnprintf1.c @@ -1,5 +1,5 @@ /* Test of u16_vasnprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -23,25 +23,12 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u16-asnprintf1.h" #include "test-u16-printf1.h" diff --git a/tests/unistdio/test-u16-vasnprintf2.c b/tests/unistdio/test-u16-vasnprintf2.c index 8f1d48cab1..397adbec92 100644 --- a/tests/unistdio/test-u16-vasnprintf2.c +++ b/tests/unistdio/test-u16-vasnprintf2.c @@ -1,5 +1,5 @@ /* Test of u16_vasnprintf() function in an ISO-8859-1 locale. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -22,25 +22,12 @@ #include <locale.h> #include <stdarg.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void test_function (uint16_t * (*my_asnprintf) (uint16_t *, size_t *, const char *, ...)) diff --git a/tests/unistdio/test-u16-vasnprintf3.c b/tests/unistdio/test-u16-vasnprintf3.c index b758f73942..26f425032f 100644 --- a/tests/unistdio/test-u16-vasnprintf3.c +++ b/tests/unistdio/test-u16-vasnprintf3.c @@ -1,5 +1,5 @@ /* Test of u16_vasnprintf() function in an UTF-8 locale. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -22,25 +22,12 @@ #include <locale.h> #include <stdarg.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void test_function (uint16_t * (*my_asnprintf) (uint16_t *, size_t *, const char *, ...)) diff --git a/tests/unistdio/test-u16-vasprintf1.c b/tests/unistdio/test-u16-vasprintf1.c index b534dfe047..69917ac562 100644 --- a/tests/unistdio/test-u16-vasprintf1.c +++ b/tests/unistdio/test-u16-vasprintf1.c @@ -1,5 +1,5 @@ /* Test of u16_vasprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -23,25 +23,12 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u16-printf1.h" diff --git a/tests/unistdio/test-u16-vsnprintf1.c b/tests/unistdio/test-u16-vsnprintf1.c index 37420f7511..cc0b7e17ba 100644 --- a/tests/unistdio/test-u16-vsnprintf1.c +++ b/tests/unistdio/test-u16-vsnprintf1.c @@ -23,7 +23,6 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> @@ -31,19 +30,7 @@ #include "unistr.h" #include "xalloc.h" #include "progname.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u16-printf1.h" diff --git a/tests/unistdio/test-u16-vsprintf1.c b/tests/unistdio/test-u16-vsprintf1.c index 179c4a36e0..fd9e088745 100644 --- a/tests/unistdio/test-u16-vsprintf1.c +++ b/tests/unistdio/test-u16-vsprintf1.c @@ -23,7 +23,6 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> @@ -31,19 +30,7 @@ #include "unistr.h" #include "xalloc.h" #include "progname.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u16-printf1.h" diff --git a/tests/unistdio/test-u32-asnprintf1.c b/tests/unistdio/test-u32-asnprintf1.c index a470cbf5bc..957ba19f88 100644 --- a/tests/unistdio/test-u32-asnprintf1.c +++ b/tests/unistdio/test-u32-asnprintf1.c @@ -1,5 +1,5 @@ /* Test of u32_asnprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -23,25 +23,12 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u32-asnprintf1.h" diff --git a/tests/unistdio/test-u32-vasnprintf1.c b/tests/unistdio/test-u32-vasnprintf1.c index d068c27130..2bca986fc6 100644 --- a/tests/unistdio/test-u32-vasnprintf1.c +++ b/tests/unistdio/test-u32-vasnprintf1.c @@ -1,5 +1,5 @@ /* Test of u32_vasnprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -23,25 +23,12 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u32-asnprintf1.h" #include "test-u32-printf1.h" diff --git a/tests/unistdio/test-u32-vasnprintf2.c b/tests/unistdio/test-u32-vasnprintf2.c index ec5b46dad2..33535a6919 100644 --- a/tests/unistdio/test-u32-vasnprintf2.c +++ b/tests/unistdio/test-u32-vasnprintf2.c @@ -1,5 +1,5 @@ /* Test of u32_vasnprintf() function in an ISO-8859-1 locale. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -22,25 +22,12 @@ #include <locale.h> #include <stdarg.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void test_function (uint32_t * (*my_asnprintf) (uint32_t *, size_t *, const char *, ...)) diff --git a/tests/unistdio/test-u32-vasnprintf3.c b/tests/unistdio/test-u32-vasnprintf3.c index 78608ffa9c..dce3d6ef2d 100644 --- a/tests/unistdio/test-u32-vasnprintf3.c +++ b/tests/unistdio/test-u32-vasnprintf3.c @@ -1,5 +1,5 @@ /* Test of u32_vasnprintf() function in an UTF-8 locale. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -22,25 +22,12 @@ #include <locale.h> #include <stdarg.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void test_function (uint32_t * (*my_asnprintf) (uint32_t *, size_t *, const char *, ...)) diff --git a/tests/unistdio/test-u32-vasprintf1.c b/tests/unistdio/test-u32-vasprintf1.c index 901424c30c..a33617c824 100644 --- a/tests/unistdio/test-u32-vasprintf1.c +++ b/tests/unistdio/test-u32-vasprintf1.c @@ -1,5 +1,5 @@ /* Test of u32_vasprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -23,25 +23,12 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u32-printf1.h" diff --git a/tests/unistdio/test-u32-vsnprintf1.c b/tests/unistdio/test-u32-vsnprintf1.c index af52a7b34b..8a25e0ed18 100644 --- a/tests/unistdio/test-u32-vsnprintf1.c +++ b/tests/unistdio/test-u32-vsnprintf1.c @@ -23,7 +23,6 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> @@ -31,19 +30,7 @@ #include "unistr.h" #include "xalloc.h" #include "progname.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u32-printf1.h" diff --git a/tests/unistdio/test-u32-vsprintf1.c b/tests/unistdio/test-u32-vsprintf1.c index 6f23d83bf7..0e3188c00d 100644 --- a/tests/unistdio/test-u32-vsprintf1.c +++ b/tests/unistdio/test-u32-vsprintf1.c @@ -23,7 +23,6 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> @@ -31,19 +30,7 @@ #include "unistr.h" #include "xalloc.h" #include "progname.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u32-printf1.h" diff --git a/tests/unistdio/test-u8-asnprintf1.c b/tests/unistdio/test-u8-asnprintf1.c index 820e5e1aff..e85dd67b99 100644 --- a/tests/unistdio/test-u8-asnprintf1.c +++ b/tests/unistdio/test-u8-asnprintf1.c @@ -1,5 +1,5 @@ /* Test of u8_asnprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -23,25 +23,12 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u8-asnprintf1.h" diff --git a/tests/unistdio/test-u8-vasnprintf1.c b/tests/unistdio/test-u8-vasnprintf1.c index 9e597b8f3b..0a121c67be 100644 --- a/tests/unistdio/test-u8-vasnprintf1.c +++ b/tests/unistdio/test-u8-vasnprintf1.c @@ -1,5 +1,5 @@ /* Test of u8_vasnprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -23,25 +23,12 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u8-asnprintf1.h" #include "test-u8-printf1.h" diff --git a/tests/unistdio/test-u8-vasnprintf2.c b/tests/unistdio/test-u8-vasnprintf2.c index df59f40e37..22ae15f832 100644 --- a/tests/unistdio/test-u8-vasnprintf2.c +++ b/tests/unistdio/test-u8-vasnprintf2.c @@ -1,5 +1,5 @@ /* Test of u8_vasnprintf() function in an ISO-8859-1 locale. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -22,25 +22,12 @@ #include <locale.h> #include <stdarg.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void test_function (uint8_t * (*my_asnprintf) (uint8_t *, size_t *, const char *, ...)) diff --git a/tests/unistdio/test-u8-vasnprintf3.c b/tests/unistdio/test-u8-vasnprintf3.c index d35d64787c..8f5d943015 100644 --- a/tests/unistdio/test-u8-vasnprintf3.c +++ b/tests/unistdio/test-u8-vasnprintf3.c @@ -1,5 +1,5 @@ /* Test of u8_vasnprintf() function in an UTF-8 locale. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -22,25 +22,12 @@ #include <locale.h> #include <stdarg.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void test_function (uint8_t * (*my_asnprintf) (uint8_t *, size_t *, const char *, ...)) diff --git a/tests/unistdio/test-u8-vasprintf1.c b/tests/unistdio/test-u8-vasprintf1.c index dc9afb4389..c8aa2f78d9 100644 --- a/tests/unistdio/test-u8-vasprintf1.c +++ b/tests/unistdio/test-u8-vasprintf1.c @@ -1,5 +1,5 @@ /* Test of u8_vasprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -23,25 +23,12 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "unistr.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u8-printf1.h" diff --git a/tests/unistdio/test-u8-vsnprintf1.c b/tests/unistdio/test-u8-vsnprintf1.c index c494c6d61a..1f4f196ec5 100644 --- a/tests/unistdio/test-u8-vsnprintf1.c +++ b/tests/unistdio/test-u8-vsnprintf1.c @@ -23,7 +23,6 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> @@ -31,19 +30,7 @@ #include "unistr.h" #include "xalloc.h" #include "progname.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u8-printf1.h" diff --git a/tests/unistdio/test-u8-vsprintf1.c b/tests/unistdio/test-u8-vsprintf1.c index a607a7f9c8..7f89366d1b 100644 --- a/tests/unistdio/test-u8-vsprintf1.c +++ b/tests/unistdio/test-u8-vsprintf1.c @@ -23,7 +23,6 @@ #include <errno.h> #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> @@ -31,19 +30,7 @@ #include "unistr.h" #include "xalloc.h" #include "progname.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-u8-printf1.h" diff --git a/tests/unistdio/test-ulc-asnprintf1.c b/tests/unistdio/test-ulc-asnprintf1.c index 8ad1906b1d..d700641de3 100644 --- a/tests/unistdio/test-ulc-asnprintf1.c +++ b/tests/unistdio/test-ulc-asnprintf1.c @@ -1,5 +1,5 @@ /* Test of ulc_asnprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -22,23 +22,11 @@ #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-ulc-asnprintf1.h" diff --git a/tests/unistdio/test-ulc-vasnprintf1.c b/tests/unistdio/test-ulc-vasnprintf1.c index a9af5637b6..a7f1454e2d 100644 --- a/tests/unistdio/test-ulc-vasnprintf1.c +++ b/tests/unistdio/test-ulc-vasnprintf1.c @@ -1,5 +1,5 @@ /* Test of ulc_vasnprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -22,23 +22,11 @@ #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-ulc-asnprintf1.h" #include "test-ulc-printf1.h" diff --git a/tests/unistdio/test-ulc-vasnprintf2.c b/tests/unistdio/test-ulc-vasnprintf2.c index d1c035ede6..bc8ccad006 100644 --- a/tests/unistdio/test-ulc-vasnprintf2.c +++ b/tests/unistdio/test-ulc-vasnprintf2.c @@ -1,5 +1,5 @@ /* Test of ulc_vasnprintf() function in an ISO-8859-1 locale. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -22,23 +22,11 @@ #include <locale.h> #include <stdarg.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) diff --git a/tests/unistdio/test-ulc-vasnprintf3.c b/tests/unistdio/test-ulc-vasnprintf3.c index b1268c9c66..a4c1843e9f 100644 --- a/tests/unistdio/test-ulc-vasnprintf3.c +++ b/tests/unistdio/test-ulc-vasnprintf3.c @@ -1,5 +1,5 @@ /* Test of ulc_vasnprintf() function in an UTF-8 locale. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -22,23 +22,11 @@ #include <locale.h> #include <stdarg.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" static void test_function (char * (*my_asnprintf) (char *, size_t *, const char *, ...)) diff --git a/tests/unistdio/test-ulc-vasprintf1.c b/tests/unistdio/test-ulc-vasprintf1.c index cd18758698..4e8d3d34da 100644 --- a/tests/unistdio/test-ulc-vasprintf1.c +++ b/tests/unistdio/test-ulc-vasprintf1.c @@ -1,5 +1,5 @@ /* Test of ulc_vasprintf() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -22,23 +22,11 @@ #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-ulc-printf1.h" diff --git a/tests/unistdio/test-ulc-vsnprintf1.c b/tests/unistdio/test-ulc-vsnprintf1.c index 0a2b43fe97..f3d98be5b2 100644 --- a/tests/unistdio/test-ulc-vsnprintf1.c +++ b/tests/unistdio/test-ulc-vsnprintf1.c @@ -22,26 +22,13 @@ #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "xalloc.h" #include "progname.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-ulc-printf1.h" diff --git a/tests/unistdio/test-ulc-vsprintf1.c b/tests/unistdio/test-ulc-vsprintf1.c index 2b1586b910..662ca0f8e3 100644 --- a/tests/unistdio/test-ulc-vsprintf1.c +++ b/tests/unistdio/test-ulc-vsprintf1.c @@ -22,26 +22,13 @@ #include <stdarg.h> #include <stddef.h> -#include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> #include "xalloc.h" #include "progname.h" - -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" #include "test-ulc-printf1.h" diff --git a/tests/uniwbrk/test-u16-wordbreaks.c b/tests/uniwbrk/test-u16-wordbreaks.c index e3a66c7e6d..d4a9066018 100644 --- a/tests/uniwbrk/test-u16-wordbreaks.c +++ b/tests/uniwbrk/test-u16-wordbreaks.c @@ -20,21 +20,9 @@ #include "uniwbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uniwbrk/test-u32-wordbreaks.c b/tests/uniwbrk/test-u32-wordbreaks.c index 1dbdea50e0..5f4ce9e39b 100644 --- a/tests/uniwbrk/test-u32-wordbreaks.c +++ b/tests/uniwbrk/test-u32-wordbreaks.c @@ -20,21 +20,9 @@ #include "uniwbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uniwbrk/test-u8-wordbreaks.c b/tests/uniwbrk/test-u8-wordbreaks.c index e7d15d1fad..fd7398133f 100644 --- a/tests/uniwbrk/test-u8-wordbreaks.c +++ b/tests/uniwbrk/test-u8-wordbreaks.c @@ -20,21 +20,9 @@ #include "uniwbrk.h" -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uniwbrk/test-ulc-wordbreaks.c b/tests/uniwbrk/test-ulc-wordbreaks.c index 1727432396..0322b66a0b 100644 --- a/tests/uniwbrk/test-ulc-wordbreaks.c +++ b/tests/uniwbrk/test-ulc-wordbreaks.c @@ -21,21 +21,9 @@ #include "uniwbrk.h" #include <locale.h> -#include <stdio.h> #include <stdlib.h> -#define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uniwidth/test-u16-strwidth.c b/tests/uniwidth/test-u16-strwidth.c index 9794c3ff9c..749ae0ab3f 100644 --- a/tests/uniwidth/test-u16-strwidth.c +++ b/tests/uniwidth/test-u16-strwidth.c @@ -1,5 +1,5 @@ /* Test of u16_strwidth() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -20,20 +20,7 @@ #include "uniwidth.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uniwidth/test-u16-width.c b/tests/uniwidth/test-u16-width.c index 440a4fbdbd..62e7bc2b33 100644 --- a/tests/uniwidth/test-u16-width.c +++ b/tests/uniwidth/test-u16-width.c @@ -1,5 +1,5 @@ /* Test of u16_width() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -20,20 +20,7 @@ #include "uniwidth.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uniwidth/test-u32-strwidth.c b/tests/uniwidth/test-u32-strwidth.c index 77ca68e8ff..2035f4ccc8 100644 --- a/tests/uniwidth/test-u32-strwidth.c +++ b/tests/uniwidth/test-u32-strwidth.c @@ -1,5 +1,5 @@ /* Test of u32_strwidth() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -20,20 +20,7 @@ #include "uniwidth.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uniwidth/test-u32-width.c b/tests/uniwidth/test-u32-width.c index a55c6a8f58..7d0695b5a7 100644 --- a/tests/uniwidth/test-u32-width.c +++ b/tests/uniwidth/test-u32-width.c @@ -1,5 +1,5 @@ /* Test of u32_width() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -20,20 +20,7 @@ #include "uniwidth.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uniwidth/test-u8-strwidth.c b/tests/uniwidth/test-u8-strwidth.c index b6254418c1..f4dccf9e87 100644 --- a/tests/uniwidth/test-u8-strwidth.c +++ b/tests/uniwidth/test-u8-strwidth.c @@ -1,5 +1,5 @@ /* Test of u8_strwidth() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -20,20 +20,7 @@ #include "uniwidth.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uniwidth/test-u8-width.c b/tests/uniwidth/test-u8-width.c index b421e45685..0d971e8800 100644 --- a/tests/uniwidth/test-u8-width.c +++ b/tests/uniwidth/test-u8-width.c @@ -1,5 +1,5 @@ /* Test of u8_width() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -20,20 +20,7 @@ #include "uniwidth.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uniwidth/test-uc_width.c b/tests/uniwidth/test-uc_width.c index 8303c08efa..f8237629e1 100644 --- a/tests/uniwidth/test-uc_width.c +++ b/tests/uniwidth/test-uc_width.c @@ -1,5 +1,5 @@ /* Test of uc_width() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -20,20 +20,7 @@ #include "uniwidth.h" -#include <stdio.h> -#include <stdlib.h> - -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" int main () diff --git a/tests/uniwidth/test-uc_width2.c b/tests/uniwidth/test-uc_width2.c index 78f71e0eb1..dc080f0df1 100644 --- a/tests/uniwidth/test-uc_width2.c +++ b/tests/uniwidth/test-uc_width2.c @@ -1,5 +1,5 @@ /* Test of uc_width() function. - Copyright (C) 2007-2008 Free Software Foundation, Inc. + Copyright (C) 2007-2009 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 @@ -21,19 +21,8 @@ #include "uniwidth.h" #include <stdio.h> -#include <stdlib.h> -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "macros.h" /* One of 0, '0', '1', 'A', '2'. */ static char current_width; |