|
Packit Service |
a2ae7a |
/* Test of nl_langinfo replacement.
|
|
Packit Service |
a2ae7a |
Copyright (C) 2009-2019 Free Software Foundation, Inc.
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
This program is free software: you can redistribute it and/or modify
|
|
Packit Service |
a2ae7a |
it under the terms of the GNU General Public License as published by
|
|
Packit Service |
a2ae7a |
the Free Software Foundation; either version 3 of the License, or
|
|
Packit Service |
a2ae7a |
(at your option) any later version.
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
This program is distributed in the hope that it will be useful,
|
|
Packit Service |
a2ae7a |
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
a2ae7a |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
Packit Service |
a2ae7a |
GNU General Public License for more details.
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
You should have received a copy of the GNU General Public License
|
|
Packit Service |
a2ae7a |
along with this program. If not, see <https://www.gnu.org/licenses/>. */
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
/* Written by Bruno Haible <bruno@clisp.org>, 2009. */
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
#include <config.h>
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
#include <langinfo.h>
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
#include "signature.h"
|
|
Packit Service |
a2ae7a |
SIGNATURE_CHECK (nl_langinfo, char *, (nl_item));
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
#include <locale.h>
|
|
Packit Service |
a2ae7a |
#include <stdlib.h>
|
|
Packit Service |
a2ae7a |
#include <string.h>
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
#include "c-strcase.h"
|
|
Packit Service |
a2ae7a |
#include "macros.h"
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
/* For GCC >= 4.3, silence the warnings
|
|
Packit Service |
a2ae7a |
"comparison of unsigned expression >= 0 is always true"
|
|
Packit Service |
a2ae7a |
in this file. */
|
|
Packit Service |
a2ae7a |
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)
|
|
Packit Service |
a2ae7a |
# pragma GCC diagnostic ignored "-Wtype-limits"
|
|
Packit Service |
a2ae7a |
#endif
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
int
|
|
Packit Service |
a2ae7a |
main (int argc, char *argv[])
|
|
Packit Service |
a2ae7a |
{
|
|
Packit Service |
a2ae7a |
int pass = atoi (argv[1]);
|
|
Packit Service |
a2ae7a |
/* pass locale
|
|
Packit Service |
a2ae7a |
0 C
|
|
Packit Service |
a2ae7a |
1 traditional French locale
|
|
Packit Service |
a2ae7a |
2 French UTF-8 locale
|
|
Packit Service |
a2ae7a |
*/
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
setlocale (LC_ALL, "");
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
/* nl_langinfo items of the LC_CTYPE category */
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (CODESET)) > 0);
|
|
Packit Service |
a2ae7a |
if (pass == 2)
|
|
Packit Service |
a2ae7a |
{
|
|
Packit Service |
a2ae7a |
const char *codeset = nl_langinfo (CODESET);
|
|
Packit Service |
a2ae7a |
ASSERT (c_strcasecmp (codeset, "UTF-8") == 0 || c_strcasecmp (codeset, "UTF8") == 0);
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
/* nl_langinfo items of the LC_NUMERIC category */
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (RADIXCHAR)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (THOUSEP)) >= 0);
|
|
Packit Service |
a2ae7a |
/* nl_langinfo items of the LC_TIME category */
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (D_T_FMT)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (D_FMT)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (T_FMT)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (T_FMT_AMPM)) >= (pass == 0 ? 1 : 0));
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (AM_STR)) >= (pass == 0 ? 1 : 0));
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (PM_STR)) >= (pass == 0 ? 1 : 0));
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (DAY_1)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (DAY_2)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (DAY_3)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (DAY_4)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (DAY_5)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (DAY_6)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (DAY_7)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ABDAY_1)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ABDAY_2)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ABDAY_3)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ABDAY_4)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ABDAY_5)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ABDAY_6)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ABDAY_7)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (MON_1)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (MON_2)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (MON_3)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (MON_4)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (MON_5)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (MON_6)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (MON_7)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (MON_8)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (MON_9)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (MON_10)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (MON_11)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (MON_12)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ALTMON_1)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ALTMON_2)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ALTMON_3)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ALTMON_4)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ALTMON_5)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ALTMON_6)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ALTMON_7)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ALTMON_8)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ALTMON_9)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ALTMON_10)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ALTMON_11)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ALTMON_12)) > 0);
|
|
Packit Service |
a2ae7a |
/* In the tested locales, alternate month names and month names ought to be
|
|
Packit Service |
a2ae7a |
the same. */
|
|
Packit Service |
a2ae7a |
ASSERT (strcmp (nl_langinfo (ALTMON_1), nl_langinfo (MON_1)) == 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strcmp (nl_langinfo (ALTMON_2), nl_langinfo (MON_2)) == 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strcmp (nl_langinfo (ALTMON_3), nl_langinfo (MON_3)) == 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strcmp (nl_langinfo (ALTMON_4), nl_langinfo (MON_4)) == 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strcmp (nl_langinfo (ALTMON_5), nl_langinfo (MON_5)) == 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strcmp (nl_langinfo (ALTMON_6), nl_langinfo (MON_6)) == 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strcmp (nl_langinfo (ALTMON_7), nl_langinfo (MON_7)) == 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strcmp (nl_langinfo (ALTMON_8), nl_langinfo (MON_8)) == 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strcmp (nl_langinfo (ALTMON_9), nl_langinfo (MON_9)) == 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strcmp (nl_langinfo (ALTMON_10), nl_langinfo (MON_10)) == 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strcmp (nl_langinfo (ALTMON_11), nl_langinfo (MON_11)) == 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strcmp (nl_langinfo (ALTMON_12), nl_langinfo (MON_12)) == 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ABMON_1)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ABMON_2)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ABMON_3)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ABMON_4)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ABMON_5)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ABMON_6)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ABMON_7)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ABMON_8)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ABMON_9)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ABMON_10)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ABMON_11)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ABMON_12)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ERA)) >= 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ERA_D_FMT)) >= 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ERA_D_T_FMT)) >= 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (ERA_T_FMT)) >= 0);
|
|
Packit Service |
a2ae7a |
ASSERT (nl_langinfo (ALT_DIGITS) != NULL);
|
|
Packit Service |
a2ae7a |
/* nl_langinfo items of the LC_MONETARY category */
|
|
Packit Service |
a2ae7a |
{
|
|
Packit Service |
a2ae7a |
const char *currency = nl_langinfo (CRNCYSTR);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (currency) >= 0);
|
|
Packit Service |
a2ae7a |
#if !defined __NetBSD__
|
|
Packit Service |
a2ae7a |
if (pass > 0)
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (currency) >= 1);
|
|
Packit Service |
a2ae7a |
#endif
|
|
Packit Service |
a2ae7a |
}
|
|
Packit Service |
a2ae7a |
/* nl_langinfo items of the LC_MESSAGES category */
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (YESEXPR)) > 0);
|
|
Packit Service |
a2ae7a |
ASSERT (strlen (nl_langinfo (NOEXPR)) > 0);
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
return 0;
|
|
Packit Service |
a2ae7a |
}
|