stdio: Remove __libc_message alloca usage
[glibc.git] / stdio-common / tst-scanf-to_inpunct.c
blob32236ac2dc1b050d544f3abc475ec28e34494a57
1 /* Test scanf for languages with mapping pairs of alternate digits and
2 separators.
3 Copyright (C) 2023 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 <https://www.gnu.org/licenses/>. */
20 #include <array_length.h>
21 #include <stdio.h>
22 #include <support/support.h>
23 #include <support/check.h>
25 /* fa_IR defines to_inpunct for numbers. */
26 static const struct
28 int n;
29 const char *str;
30 } inputs[] =
32 { 1, "\xdb\xb1" },
33 { 2, "\xdb\xb2" },
34 { 3, "\xdb\xb3" },
35 { 4, "\xdb\xb4" },
36 { 5, "\xdb\xb5" },
37 { 6, "\xdb\xb6" },
38 { 7, "\xdb\xb7" },
39 { 8, "\xdb\xb8" },
40 { 9, "\xdb\xb9" },
41 { 10, "\xdb\xb1\xdb\xb0" },
42 { 11, "\xdb\xb1\xdb\xb1" },
43 { 12, "\xdb\xb1\xdb\xb2" },
44 { 13, "\xdb\xb1\xdb\xb3" },
45 { 14, "\xdb\xb1\xdb\xb4" },
46 { 15, "\xdb\xb1\xdb\xb5" },
47 { 16, "\xdb\xb1\xdb\xb6" },
48 { 17, "\xdb\xb1\xdb\xb7" },
49 { 18, "\xdb\xb1\xdb\xb8" },
50 { 19, "\xdb\xb1\xdb\xb9" },
51 { 20, "\xdb\xb2\xdb\xb0" },
52 { 30, "\xdb\xb3\xdb\xb0" },
53 { 40, "\xdb\xb4\xdb\xb0" },
54 { 50, "\xdb\xb5\xdb\xb0" },
55 { 60, "\xdb\xb6\xdb\xb0" },
56 { 70, "\xdb\xb7\xdb\xb0" },
57 { 80, "\xdb\xb8\xdb\xb0" },
58 { 90, "\xdb\xb9\xdb\xb0" },
59 { 100, "\xdb\xb1\xdb\xb0\xdb\xb0" },
60 { 1000, "\xdb\xb1\xdb\xb0\xdb\xb0\xdb\xb0" },
63 static int
64 do_test (void)
66 xsetlocale (LC_ALL, "fa_IR.UTF-8");
68 for (int i = 0; i < array_length (inputs); i++)
70 int n;
71 sscanf (inputs[i].str, "%Id", &n);
72 TEST_COMPARE (n, inputs[i].n);
75 return 0;
78 #include <support/test-driver.c>