X-Git-Url: https://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-array_list.c;h=1d831f9a3527401c95dc6ba99f047f3602f3f536;hb=8e74296348d2d5197a301ebf8c8b1e4342088ad3;hp=c043c83a64c546e1f89710d940c870baf79122cf;hpb=d49bbc37101c003a0c0c3349ae64e4f6c9d315ab;p=gnulib.git diff --git a/tests/test-array_list.c b/tests/test-array_list.c index c043c83a6..1d831f9a3 100644 --- a/tests/test-array_list.c +++ b/tests/test-array_list.c @@ -20,9 +20,12 @@ # include #endif +#include "gl_array_list.h" + +#include #include -#include "gl_array_list.h" +#include "progname.h" static const char *objects[15] = { @@ -30,7 +33,16 @@ static const char *objects[15] = }; #define SIZEOF(array) (sizeof (array) / sizeof (array[0])) -#define ASSERT(condition) if (!(condition)) abort () +#define ASSERT(expr) \ + do \ + { \ + if (!(expr)) \ + { \ + fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ + abort (); \ + } \ + } \ + while (0) #define RANDOM(n) (rand () % (n)) #define RANDOM_OBJECT() objects[RANDOM (SIZEOF (objects))] @@ -52,6 +64,8 @@ main (int argc, char *argv[]) { gl_list_t list1, list2; + set_program_name (argv[0]); + /* Allow the user to provide a non-default random seed on the command line. */ if (argc > 1) srand (atoi (argv[1])); @@ -67,10 +81,10 @@ main (int argc, char *argv[]) contents[i] = RANDOM_OBJECT (); /* Create list1. */ - list1 = gl_list_create (GL_ARRAY_LIST, NULL, NULL, true, + list1 = gl_list_create (GL_ARRAY_LIST, NULL, NULL, NULL, true, initial_size, contents); /* Create list2. */ - list2 = gl_list_create_empty (GL_ARRAY_LIST, NULL, NULL, true); + list2 = gl_list_create_empty (GL_ARRAY_LIST, NULL, NULL, NULL, true); for (i = 0; i < initial_size; i++) gl_list_add_last (list2, contents[i]);