Blame gl/tests/test-locale.c

Packit aea12f
/* Test of <locale.h> substitute.
Packit Service 991b93
   Copyright (C) 2007, 2009-2020 Free Software Foundation, Inc.
Packit aea12f
Packit aea12f
   This program is free software: you can redistribute it and/or modify
Packit aea12f
   it under the terms of the GNU General Public License as published by
Packit aea12f
   the Free Software Foundation; either version 3 of the License, or
Packit aea12f
   (at your option) any later version.
Packit aea12f
Packit aea12f
   This program is distributed in the hope that it will be useful,
Packit aea12f
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit aea12f
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit aea12f
   GNU General Public License for more details.
Packit aea12f
Packit aea12f
   You should have received a copy of the GNU General Public License
Packit aea12f
   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
Packit aea12f
Packit aea12f
/* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
Packit aea12f
Packit aea12f
#include <config.h>
Packit aea12f
Packit aea12f
#include <locale.h>
Packit aea12f
Packit aea12f
#include "verify.h"
Packit aea12f
Packit aea12f
int a[] =
Packit aea12f
  {
Packit aea12f
    LC_ALL,
Packit aea12f
    LC_COLLATE,
Packit aea12f
    LC_CTYPE,
Packit aea12f
    LC_MESSAGES,
Packit aea12f
    LC_MONETARY,
Packit aea12f
    LC_NUMERIC,
Packit aea12f
    LC_TIME
Packit aea12f
  };
Packit aea12f
Packit aea12f
/* Check that the 'struct lconv' type is defined.  */
Packit aea12f
struct lconv l;
Packit aea12f
int ls;
Packit aea12f
Packit aea12f
/* Check that NULL can be passed through varargs as a pointer type,
Packit aea12f
   per POSIX 2008.  */
Packit aea12f
verify (sizeof NULL == sizeof (void *));
Packit aea12f
Packit aea12f
int
Packit aea12f
main ()
Packit aea12f
{
Packit Service 991b93
#if HAVE_WORKING_NEWLOCALE
Packit aea12f
  /* Check that the locale_t type and the LC_GLOBAL_LOCALE macro are defined.  */
Packit aea12f
  locale_t b = LC_GLOBAL_LOCALE;
Packit aea12f
  (void) b;
Packit aea12f
#endif
Packit aea12f
Packit aea12f
  /* Check that 'struct lconv' has the ISO C and POSIX specified members.  */
Packit aea12f
  ls += sizeof (*l.decimal_point);
Packit aea12f
  ls += sizeof (*l.thousands_sep);
Packit aea12f
  ls += sizeof (*l.grouping);
Packit aea12f
  ls += sizeof (*l.mon_decimal_point);
Packit aea12f
  ls += sizeof (*l.mon_thousands_sep);
Packit aea12f
  ls += sizeof (*l.mon_grouping);
Packit aea12f
  ls += sizeof (*l.positive_sign);
Packit aea12f
  ls += sizeof (*l.negative_sign);
Packit aea12f
  ls += sizeof (*l.currency_symbol);
Packit aea12f
  ls += sizeof (l.frac_digits);
Packit aea12f
  ls += sizeof (l.p_cs_precedes);
Packit aea12f
  ls += sizeof (l.p_sign_posn);
Packit aea12f
  ls += sizeof (l.p_sep_by_space);
Packit aea12f
  ls += sizeof (l.n_cs_precedes);
Packit aea12f
  ls += sizeof (l.n_sign_posn);
Packit aea12f
  ls += sizeof (l.n_sep_by_space);
Packit aea12f
  ls += sizeof (*l.int_curr_symbol);
Packit aea12f
  ls += sizeof (l.int_frac_digits);
Packit aea12f
  ls += sizeof (l.int_p_cs_precedes);
Packit aea12f
  ls += sizeof (l.int_p_sign_posn);
Packit aea12f
  ls += sizeof (l.int_p_sep_by_space);
Packit aea12f
  ls += sizeof (l.int_n_cs_precedes);
Packit aea12f
  ls += sizeof (l.int_n_sign_posn);
Packit aea12f
  ls += sizeof (l.int_n_sep_by_space);
Packit aea12f
Packit aea12f
  return 0;
Packit aea12f
}