1 /* Copyright (C) 2009, 2011 Free Software Foundation, Inc.
2 This file is part of the GNU LIBICONV Library.
4 The GNU LIBICONV Library is free software; you can redistribute it
5 and/or modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
9 The GNU LIBICONV Library is distributed in the hope that it will be
10 useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU LIBICONV Library; see the file COPYING.LIB.
16 If not, see <http://www.gnu.org/licenses/>. */
24 /* This test checks that the conversion to wchar_t stops correctly when
25 the input is incomplete. Based on a bug report from
26 Tristan Gingold <gingold@adacore.com>. */
30 iconv_t cd
= iconv_open ("wchar_t", "UTF-8");
31 if (cd
== (iconv_t
)(-1)) {
32 /* Skip the test on platforms without wchar_t
33 (Solaris 2.6, HP-UX 11.00). */
35 char inbuf
[2] = { 0xc2, 0xa0 };
39 size_t inbytesleft
= 1;
40 char *outptr
= (char *) outbuf
;
41 size_t outbytesleft
= sizeof (outbuf
);
43 (ICONV_CONST
char **) &inptr
, &inbytesleft
,
44 &outptr
, &outbytesleft
);
46 if (!(r
== (size_t)(-1) && errno
== EINVAL
))