X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-mbrtowc.c;h=02b784153dccd2be93285c8971062b4dcf8a7d34;hb=025f7741264a170d2a87c30370bc4b96b256f3b4;hp=916427308f8d4a5a97c09ffa82dc0d76425bc3e8;hpb=89ae4589dd58d12e7cbcf0e92c1d828c1e430f97;p=gnulib.git diff --git a/tests/test-mbrtowc.c b/tests/test-mbrtowc.c index 916427308..02b784153 100644 --- a/tests/test-mbrtowc.c +++ b/tests/test-mbrtowc.c @@ -1,5 +1,5 @@ /* Test of conversion of multibyte character to wide character. - Copyright (C) 2008, 2009 Free Software Foundation, Inc. + Copyright (C) 2008-2012 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -26,20 +26,9 @@ SIGNATURE_CHECK (mbrtowc, size_t, (wchar_t *, char const *, size_t, #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 (int argc, char *argv[]) @@ -154,6 +143,11 @@ main (int argc, char *argv[]) ASSERT (mbsinit (&state)); input[1] = '\0'; + /* Test support of NULL first argument. */ + ret = mbrtowc (NULL, input + 2, 3, &state); + ASSERT (ret == 1); + ASSERT (mbsinit (&state)); + wc = (wchar_t) 0xBADFACE; ret = mbrtowc (&wc, input + 2, 3, &state); ASSERT (ret == 1); @@ -203,6 +197,11 @@ main (int argc, char *argv[]) ASSERT (mbsinit (&state)); input[2] = '\0'; + /* Test support of NULL first argument. */ + ret = mbrtowc (NULL, input + 3, 4, &state); + ASSERT (ret == 2); + ASSERT (mbsinit (&state)); + wc = (wchar_t) 0xBADFACE; ret = mbrtowc (&wc, input + 3, 4, &state); ASSERT (ret == 2); @@ -261,6 +260,11 @@ main (int argc, char *argv[]) ASSERT (mbsinit (&state)); input[4] = '\0'; + /* Test support of NULL first argument. */ + ret = mbrtowc (NULL, input + 5, 3, &state); + ASSERT (ret == 2); + ASSERT (mbsinit (&state)); + wc = (wchar_t) 0xBADFACE; ret = mbrtowc (&wc, input + 5, 3, &state); ASSERT (ret == 2); @@ -304,6 +308,11 @@ main (int argc, char *argv[]) ASSERT (mbsinit (&state)); input[2] = '\0'; + /* Test support of NULL first argument. */ + ret = mbrtowc (NULL, input + 3, 6, &state); + ASSERT (ret == 4); + ASSERT (mbsinit (&state)); + wc = (wchar_t) 0xBADFACE; ret = mbrtowc (&wc, input + 3, 6, &state); ASSERT (ret == 4);