glob: Declare variables at the very start of their scope.
[gnulib/ericb.git] / tests / test-strncat.c
blobdec215d1e4ef34fb435fafb6e015c6a58e18744b
1 /* Test of strncat() function.
2 Copyright (C) 2010-2017 Free Software Foundation, Inc.
4 This program is free software: you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 3 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>. */
17 /* Written by Bruno Haible <bruno@clisp.org>, 2010. */
19 #include <config.h>
21 #include <string.h>
23 #include "signature.h"
24 SIGNATURE_CHECK (strncat, char *, (char *, const char *, size_t));
26 #include <stdlib.h>
28 #include "zerosize-ptr.h"
29 #include "macros.h"
31 #define UNIT char
32 #define U_STRNCAT strncat
33 #define MAGIC ((char) 0xBA)
34 #include "unistr/test-strncat.h"
36 int
37 main ()
39 /* Simple string. */
40 { /* "Grüß Gott. Здравствуйте! x=(-b±sqrt(b²-4ac))/(2a) 日本語,中文,한글"
41 in UTF-8 encoding. */
42 static const char input[] =
43 { 'G', 'r', (char) 0xC3, (char) 0xBC, (char) 0xC3, (char) 0x9F, ' ',
44 'G', 'o', 't', 't', '.', ' ', (char) 0xD0, (char) 0x97, (char) 0xD0,
45 (char) 0xB4, (char) 0xD1, (char) 0x80, (char) 0xD0, (char) 0xB0,
46 (char) 0xD0, (char) 0xB2, (char) 0xD1, (char) 0x81, (char) 0xD1,
47 (char) 0x82, (char) 0xD0, (char) 0xB2, (char) 0xD1, (char) 0x83,
48 (char) 0xD0, (char) 0xB9, (char) 0xD1, (char) 0x82, (char) 0xD0,
49 (char) 0xB5, '!', ' ', 'x', '=', '(', '-', 'b', (char) 0xC2,
50 (char) 0xB1, 's', 'q', 'r', 't', '(', 'b', (char) 0xC2, (char) 0xB2,
51 '-', '4', 'a', 'c', ')', ')', '/', '(', '2', 'a', ')', ' ', ' ',
52 (char) 0xE6, (char) 0x97, (char) 0xA5, (char) 0xE6, (char) 0x9C,
53 (char) 0xAC, (char) 0xE8, (char) 0xAA, (char) 0x9E, ',', (char) 0xE4,
54 (char) 0xB8, (char) 0xAD, (char) 0xE6, (char) 0x96, (char) 0x87, ',',
55 (char) 0xED, (char) 0x95, (char) 0x9C, (char) 0xEA, (char) 0xB8,
56 (char) 0x80, '\0'
58 check (input, SIZEOF (input));
61 return 0;