1 /* Test driver for nl_langinfo[_l] functions.
2 Copyright (C) 2000-2024 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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 <https://www.gnu.org/licenses/>. */
31 #define VAL(name) { #name, name }
66 VAL (CURRENCY_SYMBOL
),
84 VAL (INT_CURR_SYMBOL
),
85 VAL (INT_FRAC_DIGITS
),
98 VAL (MON_DECIMAL_POINT
),
100 VAL (MON_THOUSANDS_SEP
),
105 VAL (N_SEP_BY_SPACE
),
110 VAL (P_SEP_BY_SPACE
),
123 map_paramstr (const char *str
)
126 int high
= sizeof (map
) / sizeof (map
[0]);
130 int med
= (low
+ high
) / 2;
133 cmpres
= strcmp (str
, map
[med
].str
);
147 # define REASON(str) printf ("\"%s\" ignored: %s\n", buf, str)
157 while (! feof (stdin
))
166 if (fgets (buf
, sizeof (buf
), stdin
) == NULL
)
169 /* Split the fields. There are three is them:
171 2. langinfo() parameter
172 3. expected result; this can be a string with white space etc.
175 while (*rp
== ' ' || *rp
== '\t')
180 /* It's a comment line. Ignore it. */
186 while (*rp
!= '\0' && *rp
!= ' ' && *rp
!= '\t' && *rp
!= '\n')
188 if (*rp
== '\0' || *rp
== '\n')
190 /* Incomplete line. */
191 REASON ("incomplete line");
196 while (*rp
== ' ' || *rp
== '\t')
200 while (*rp
!= '\0' && *rp
!= ' ' && *rp
!= '\t' && *rp
!= '\n')
202 if (*rp
== '\0' || *rp
== '\n')
204 /* Incomplete line. */
205 REASON ("incomplete line");
210 while (*rp
== ' ' || *rp
== '\t')
217 expected
= wp
= ++rp
;
218 while (*rp
!= '"' && *rp
!= '\n' && *rp
!= '\0')
225 if (*rp
>= '0' && *rp
<= '9')
228 if (rp
[1] >= '0' && rp
[1] <= '9')
233 if (rp
[1] >= '0' && rp
[1] <= '9')
248 REASON ("missing '\"'");
257 while (*rp
!= '\0' && *rp
!= '\n')
262 param
= map_paramstr (paramstr
);
265 /* Invalid parameter. */
266 REASON ("invalid parameter");
270 result
= test_locale (locale
, paramstr
, param
, expected
);
276 #define TEST_FUNCTION do_test ()
277 #include "../test-skeleton.c"