1 /* Test scanf for languages with mapping pairs of alternate digits and
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>
22 #include <support/support.h>
23 #include <support/check.h>
25 /* fa_IR defines to_inpunct for numbers. */
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" },
66 xsetlocale (LC_ALL
, "fa_IR.UTF-8");
68 for (int i
= 0; i
< array_length (inputs
); i
++)
71 sscanf (inputs
[i
].str
, "%Id", &n
);
72 TEST_COMPARE (n
, inputs
[i
].n
);
78 #include <support/test-driver.c>