maint: update copyright
[gnulib.git] / tests / test-strchrnul.c
index fb26535..c8ee66f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008 Free Software Foundation
+ * Copyright (C) 2008-2014 Free Software Foundation, Inc.
  * Written by Eric Blake and Bruno Haible
  *
  * This program is free software: you can redistribute it and/or modify
 
 #include <string.h>
 
-#include <stdio.h>
+#include "signature.h"
+SIGNATURE_CHECK (strchrnul, char *, (char const *, 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"
 
 int
-main ()
+main (void)
 {
   size_t n = 0x100000;
   char *input = malloc (n + 1);
@@ -67,7 +59,7 @@ main ()
     size_t repeat = 10000;
     for (; repeat > 0; repeat--)
       {
-       ASSERT (strchrnul (input, 'c') == input + 2);
+        ASSERT (strchrnul (input, 'c') == input + 2);
       }
   }
 
@@ -76,15 +68,15 @@ main ()
     int i, j;
     for (i = 0; i < 32; i++)
       {
-       for (j = 0; j < 256; j++)
-         input[i + j] = (j + 1) & 0xff;
-       for (j = 1; j < 256; j++)
-         {
-           ASSERT (strchrnul (input + i, j) == input + i + j - 1);
-           input[i + j - 1] = (j == 1 ? 2 : 1);
-           ASSERT (strchrnul (input + i, j) == input + i + 255);
-           input[i + j - 1] = j;
-         }
+        for (j = 0; j < 256; j++)
+          input[i + j] = (j + 1) & 0xff;
+        for (j = 1; j < 256; j++)
+          {
+            ASSERT (strchrnul (input + i, j) == input + i + j - 1);
+            input[i + j - 1] = (j == 1 ? 2 : 1);
+            ASSERT (strchrnul (input + i, j) == input + i + 255);
+            input[i + j - 1] = j;
+          }
       }
   }