1 /* Test strtol functions work with all ASCII letters in Turkish
3 Copyright (C) 2015-2016 Free Software Foundation, Inc.
4 This file is part of the GNU C Library.
6 The GNU C Library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
11 The GNU C Library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
26 #define STR(X) STR_(X)
27 #define FNPFXS STR (FNPFX)
28 #define CONCAT_(X, Y) X ## Y
29 #define CONCAT(X, Y) CONCAT_ (X, Y)
30 #define FNX(FN) CONCAT (FNPFX, FN)
32 #define TEST(LOC, STR, EXP_VAL, FN, TYPE, FMT) \
36 TYPE val = FNX (FN) (STR, &ep, 36); \
37 printf ("%s: " FNPFXS #FN " (" SFMT ") == " FMT "\n", LOC, STR, val); \
38 if (val == (TYPE) (EXP_VAL) && *ep == 0) \
39 printf ("PASS: %s: " FNPFXS #FN " (" SFMT ")\n", LOC, STR); \
42 printf ("FAIL: %s: " FNPFXS #FN " (" SFMT ")\n", LOC, STR); \
49 test_one_locale (const char *loc
)
51 if (setlocale (LC_ALL
, loc
) == NULL
)
53 printf ("setlocale (LC_ALL, \"%s\") failed\n", loc
);
57 for (int i
= 10; i
< 36; i
++)
60 s
[0] = L_('A') + i
- 10;
62 TEST (loc
, s
, i
, l
, long int, "%ld");
63 TEST (loc
, s
, i
, ul
, unsigned long int, "%lu");
64 TEST (loc
, s
, i
, ll
, long long int, "%lld");
65 TEST (loc
, s
, i
, ull
, unsigned long long int, "%llu");
66 s
[0] = L_('a') + i
- 10;
68 TEST (loc
, s
, i
, l
, long int, "%ld");
69 TEST (loc
, s
, i
, ul
, unsigned long int, "%lu");
70 TEST (loc
, s
, i
, ll
, long long int, "%lld");
71 TEST (loc
, s
, i
, ull
, unsigned long long int, "%llu");
80 result
|= test_one_locale ("C");
81 result
|= test_one_locale ("tr_TR.UTF-8");
82 result
|= test_one_locale ("tr_TR.ISO-8859-9");
86 #define TEST_FUNCTION do_test ()
87 #include "../test-skeleton.c"