strtoumax: fix typo in previous commit.
[gnulib.git] / tests / test-memrchr.c
index 962fc90..426228e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008-2009 Free Software Foundation
+ * Copyright (C) 2008-2013 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 (memrchr, void *, (void const *, int, size_t));
+
 #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.  */
@@ -76,7 +67,7 @@ main (void)
     size_t repeat = 10000;
     for (; repeat > 0; repeat--)
       {
-       ASSERT (MEMRCHR (input, 'c', n) == input + n - 3);
+        ASSERT (MEMRCHR (input, 'c', n) == input + n - 3);
       }
   }
 
@@ -85,12 +76,12 @@ main (void)
     int i, j;
     for (i = 0; i < 32; i++)
       {
-       for (j = 0; j < 256; j++)
-         input[i + j] = j;
-       for (j = 0; j < 256; j++)
-         {
-           ASSERT (MEMRCHR (input + i, j, 256) == input + i + j);
-         }
+        for (j = 0; j < 256; j++)
+          input[i + j] = j;
+        for (j = 0; j < 256; j++)
+          {
+            ASSERT (MEMRCHR (input + i, j, 256) == input + i + j);
+          }
       }
   }