Blame gnulib-tests/test-locale.c

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