X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;ds=sidebyside;f=tests%2Ftest-base64.c;h=b1979b4e7ea93cc17c27a223251cd775df39ca48;hb=395f9e6a19b504609aa8b0bd7f8cc55d4547d8dd;hp=2a2a4f522f1efa507104515056f1abd28b9ca873;hpb=3e2d7ac6c75ad7c92d25f59d11bd455d37ba4e37;p=gnulib.git diff --git a/tests/test-base64.c b/tests/test-base64.c index 2a2a4f522..b1979b4e7 100644 --- a/tests/test-base64.c +++ b/tests/test-base64.c @@ -1,5 +1,5 @@ /* Self tests for base64. - Copyright (C) 2004, 2008, 2009 Free Software Foundation, Inc. + Copyright (C) 2004, 2008-2011 Free Software Foundation, Inc. Written by Simon Josefsson. This program is free software: you can redistribute it and/or modify @@ -20,23 +20,12 @@ #include "base64.h" #include -#include #include #include #include #include -#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) @@ -50,7 +39,7 @@ main (void) memset (out, 0x42, sizeof (out)); base64_encode (in, 0, out, 0); - ASSERT(out[0] == '\x42'); + ASSERT (out[0] == '\x42'); memset (out, 0x42, sizeof (out)); base64_encode (in, 1, out, 1); @@ -195,9 +184,8 @@ main (void) ok = base64_decode_alloc_ctx (&ctx, "hp", 2, &p, &len); ASSERT (ok); - ASSERT (len == 2); - /* Actually this looks buggy. Shouldn't output be 'ghi'? */ - ASSERT (memcmp (p, "gh", len) == 0); + ASSERT (len == 3); + ASSERT (memcmp (p, "ghi", len) == 0); ok = base64_decode_alloc_ctx (&ctx, "", 0, &p, &len); ASSERT (ok); }