Convert 113 more function definitions to prototype style (files with assertions).
[glibc.git] / wcsmbs / tst-wcpncpy.c
blobfe708073657440c5f373855a19a2882681f830e8
1 /* Copyright (C) 2003-2015 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/>. */
19 #include <stdio.h>
20 #include <wchar.h>
23 static int
24 do_test (void)
26 int result = 0;
28 const wchar_t src[] = L"0";
29 wchar_t dest[21];
30 wmemset (dest, L'\0', 10);
31 wchar_t *endp = wcpncpy (dest, src, 2);
32 if (wcscmp (dest, src) != 0)
34 result = 1;
35 puts ("L\"0\" string test failed");
37 if (endp != dest + 1)
39 result = 1;
40 puts ("return value of L\"0\" string call incorrect");
43 const wchar_t src2[] = L"abc";
44 endp = wcpncpy (dest, src2, 2);
45 if (endp != dest + 2)
47 result = 1;
48 puts ("return value of limited call incorrect");
51 const wchar_t src3[] = L"";
52 endp = wcpncpy (dest, src3, 2);
53 if (endp != dest)
55 result = 1;
56 puts ("return value of empty string call incorrect");
59 const wchar_t src4[] = L"abcdefghijklmnopqrstuvwxyz";
60 endp = wcpncpy (dest, src4, 2);
61 if (endp != dest + 2)
63 result = 1;
64 puts ("return value of long string call incorrect");
67 const wchar_t src5[] = L"ab";
68 endp = wcpncpy (dest, src5, 20);
69 if (endp != dest + 2)
71 result = 1;
72 puts ("return value of large limit call incorrect");
75 return result;
78 #define TEST_FUNCTION do_test ()
79 #include "../test-skeleton.c"