X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-mbrtowc.c;h=02b784153dccd2be93285c8971062b4dcf8a7d34;hb=refs%2Ftags%2Fstable%2F20120404;hp=d84bafe434e1f7e5bd3d0f4e8bfd1e213a4c9b2f;hpb=987e5651e8d1c5aa933c9ce88562806af4093702;p=gnulib.git diff --git a/tests/test-mbrtowc.c b/tests/test-mbrtowc.c index d84bafe43..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 @@ -143,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); @@ -192,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); @@ -250,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); @@ -293,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);