1 /* Test driver for nl_langinfo[_l] functions.
2 Copyright (C) 2000-2018 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
4 Contributed by Ulrich Drepper <drepper@cygnus.com>.
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/>. */
32 #define VAL(name) { #name, name }
67 VAL (CURRENCY_SYMBOL
),
85 VAL (INT_CURR_SYMBOL
),
86 VAL (INT_FRAC_DIGITS
),
99 VAL (MON_DECIMAL_POINT
),
101 VAL (MON_THOUSANDS_SEP
),
106 VAL (N_SEP_BY_SPACE
),
111 VAL (P_SEP_BY_SPACE
),
124 map_paramstr (const char *str
)
127 int high
= sizeof (map
) / sizeof (map
[0]);
131 int med
= (low
+ high
) / 2;
134 cmpres
= strcmp (str
, map
[med
].str
);
148 # define REASON(str) printf ("\"%s\" ignored: %s\n", buf, str)
158 while (! feof (stdin
))
167 if (fgets (buf
, sizeof (buf
), stdin
) == NULL
)
170 /* Split the fields. There are three is them:
172 2. langinfo() parameter
173 3. expected result; this can be a string with white space etc.
176 while (*rp
== ' ' || *rp
== '\t')
181 /* It's a comment line. Ignore it. */
187 while (*rp
!= '\0' && *rp
!= ' ' && *rp
!= '\t' && *rp
!= '\n')
189 if (*rp
== '\0' || *rp
== '\n')
191 /* Incomplete line. */
192 REASON ("incomplete line");
197 while (*rp
== ' ' || *rp
== '\t')
201 while (*rp
!= '\0' && *rp
!= ' ' && *rp
!= '\t' && *rp
!= '\n')
203 if (*rp
== '\0' || *rp
== '\n')
205 /* Incomplete line. */
206 REASON ("incomplete line");
211 while (*rp
== ' ' || *rp
== '\t')
218 expected
= wp
= ++rp
;
219 while (*rp
!= '"' && *rp
!= '\n' && *rp
!= '\0')
226 if (*rp
>= '0' && *rp
<= '9')
229 if (rp
[1] >= '0' && rp
[1] <= '9')
234 if (rp
[1] >= '0' && rp
[1] <= '9')
249 REASON ("missing '\"'");
258 while (*rp
!= '\0' && *rp
!= '\n')
263 param
= map_paramstr (paramstr
);
266 /* Invalid parameter. */
267 REASON ("invalid parameter");
271 result
= test_locale (locale
, paramstr
, param
, expected
);
277 #define TEST_FUNCTION do_test ()
278 #include "../test-skeleton.c"