| 1 |
/* Test of localeconv() function. |
| 2 |
Copyright (C) 2012-2025 Free Software Foundation, Inc. |
| 3 |
|
| 4 |
This program is free software: you can redistribute it and/or modify |
| 5 |
it under the terms of the GNU General Public License as published by |
| 6 |
the Free Software Foundation, either version 3 of the License, or |
| 7 |
(at your option) any later version. |
| 8 |
|
| 9 |
This program is distributed in the hope that it will be useful, |
| 10 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 |
GNU General Public License for more details. |
| 13 |
|
| 14 |
You should have received a copy of the GNU General Public License |
| 15 |
along with this program. If not, see <https://www.gnu.org/licenses/>. */ |
| 16 |
|
| 17 |
/* Written by Bruno Haible <[email protected]>, 2012. */ |
| 18 |
|
| 19 |
#include <config.h> |
| 20 |
|
| 21 |
#include <locale.h> |
| 22 |
|
| 23 |
#include "signature.h" |
| 24 |
SIGNATURE_CHECK (localeconv, struct lconv *, (void)); |
| 25 |
|
| 26 |
#include <limits.h> |
| 27 |
#include <string.h> |
| 28 |
|
| 29 |
#include "macros.h" |
| 30 |
|
| 31 |
int |
| 32 |
main () |
| 33 |
{ |
| 34 |
/* Test localeconv() result in the "C" locale. */ |
| 35 |
{ |
| 36 |
struct lconv *l = localeconv (); |
| 37 |
|
| 38 |
ASSERT (STREQ (l->decimal_point, ".")); |
| 39 |
ASSERT (STREQ (l->thousands_sep, "")); |
| 40 |
#if !((defined __FreeBSD__ || defined __DragonFly__) || defined __sun || defined __CYGWIN__) |
| 41 |
ASSERT (STREQ (l->grouping, "")); |
| 42 |
#endif |
| 43 |
|
| 44 |
ASSERT (STREQ (l->mon_decimal_point, "")); |
| 45 |
ASSERT (STREQ (l->mon_thousands_sep, "")); |
| 46 |
#if !((defined __FreeBSD__ || defined __DragonFly__) || defined __sun || defined __CYGWIN__) |
| 47 |
ASSERT (STREQ (l->mon_grouping, "")); |
| 48 |
#endif |
| 49 |
ASSERT (STREQ (l->positive_sign, "")); |
| 50 |
ASSERT (STREQ (l->negative_sign, "")); |
| 51 |
|
| 52 |
ASSERT (STREQ (l->currency_symbol, "")); |
| 53 |
ASSERT (l->frac_digits == CHAR_MAX); |
| 54 |
ASSERT (l->p_cs_precedes == CHAR_MAX); |
| 55 |
ASSERT (l->p_sign_posn == CHAR_MAX); |
| 56 |
ASSERT (l->p_sep_by_space == CHAR_MAX); |
| 57 |
ASSERT (l->n_cs_precedes == CHAR_MAX); |
| 58 |
ASSERT (l->n_sign_posn == CHAR_MAX); |
| 59 |
ASSERT (l->n_sep_by_space == CHAR_MAX); |
| 60 |
|
| 61 |
ASSERT (STREQ (l->int_curr_symbol, "")); |
| 62 |
ASSERT (l->int_frac_digits == CHAR_MAX); |
| 63 |
ASSERT (l->int_p_cs_precedes == CHAR_MAX); |
| 64 |
ASSERT (l->int_p_sign_posn == CHAR_MAX); |
| 65 |
ASSERT (l->int_p_sep_by_space == CHAR_MAX); |
| 66 |
ASSERT (l->int_n_cs_precedes == CHAR_MAX); |
| 67 |
ASSERT (l->int_n_sign_posn == CHAR_MAX); |
| 68 |
ASSERT (l->int_n_sep_by_space == CHAR_MAX); |
| 69 |
} |
| 70 |
|
| 71 |
return test_exit_status; |
| 72 |
} |