X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-memcmp.c;h=479017940971ff3dab0cc8bc41d65e781af048d9;hb=54c55a69f206e114d2bf294363314b226373f445;hp=5c2ac29d884d560fe82b6b0bb9bfbf61817f5048;hpb=6731a9abc1604f940a7e12e81084ceb8fddccce2;p=gnulib.git diff --git a/tests/test-memcmp.c b/tests/test-memcmp.c index 5c2ac29d8..479017940 100644 --- a/tests/test-memcmp.c +++ b/tests/test-memcmp.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Free Software Foundation + * Copyright (C) 2008-2011 Free Software Foundation, Inc. * Written by Simon Josefsson * * This program is free software: you can redistribute it and/or modify @@ -19,26 +19,17 @@ #include -#include -#include +#include "signature.h" +SIGNATURE_CHECK (memcmp, int, (void const *, void const *, size_t)); -#define ASSERT(expr) \ - do \ - { \ - if (!(expr)) \ - { \ - fprintf (stderr, "%s:%d: assertion failed\n", __FILE__, __LINE__); \ - fflush (stderr); \ - abort (); \ - } \ - } \ - while (0) +#include "zerosize-ptr.h" +#include "macros.h" int main (void) { /* Test equal / not equal distinction. */ - ASSERT (memcmp (NULL, NULL, 0) == 0); + ASSERT (memcmp (zerosize_ptr (), zerosize_ptr (), 0) == 0); ASSERT (memcmp ("foo", "foobar", 2) == 0); ASSERT (memcmp ("foo", "foobar", 3) == 0); ASSERT (memcmp ("foo", "foobar", 4) != 0); @@ -68,11 +59,11 @@ main (void) int i; for (i = 0; i < 4; i++) { - char *a = foo + i; - char *b = bar + i; - strcpy (a, "--------01111111"); - strcpy (b, "--------10000000"); - ASSERT (memcmp (a, b, 16) < 0); + char *a = foo + i; + char *b = bar + i; + strcpy (a, "--------01111111"); + strcpy (b, "--------10000000"); + ASSERT (memcmp (a, b, 16) < 0); } }