1 /* Copyright (C) 2003-2017 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
3 Contributed by Ulrich Drepper <drepper@cygnus.com>, 2003.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
28 const wchar_t src
[] = L
"0";
30 wmemset (dest
, L
'\0', 10);
31 wchar_t *endp
= wcpncpy (dest
, src
, 2);
32 if (wcscmp (dest
, src
) != 0)
35 puts ("L\"0\" string test failed");
40 puts ("return value of L\"0\" string call incorrect");
43 const wchar_t src2
[] = L
"abc";
44 endp
= wcpncpy (dest
, src2
, 2);
48 puts ("return value of limited call incorrect");
51 const wchar_t src3
[] = L
"";
52 endp
= wcpncpy (dest
, src3
, 2);
56 puts ("return value of empty string call incorrect");
59 const wchar_t src4
[] = L
"abcdefghijklmnopqrstuvwxyz";
60 endp
= wcpncpy (dest
, src4
, 2);
64 puts ("return value of long string call incorrect");
67 const wchar_t src5
[] = L
"ab";
68 endp
= wcpncpy (dest
, src5
, 20);
72 puts ("return value of large limit call incorrect");
78 #define TEST_FUNCTION do_test ()
79 #include "../test-skeleton.c"