More pmccabe fixes.
[gnulib.git] / tests / test-wctype.c
1 /* Test of <wctype.h> substitute.
2    Copyright (C) 2007-2010 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 <http://www.gnu.org/licenses/>.  */
16
17 /* Written by Bruno Haible <bruno@clisp.org>, 2007.  */
18
19 #include <config.h>
20
21 #include <wctype.h>
22
23 #include "macros.h"
24
25 /* Check that the type wint_t is defined.  */
26 wint_t a = 'x';
27 /* Check that WEOF is defined.  */
28 wint_t e = WEOF;
29
30 int
31 main (void)
32 {
33   /* Check that the isw* functions exist as functions or as macros.  */
34   (void) iswalnum (0);
35   (void) iswalpha (0);
36   (void) iswblank (0);
37   (void) iswcntrl (0);
38   (void) iswdigit (0);
39   (void) iswgraph (0);
40   (void) iswlower (0);
41   (void) iswprint (0);
42   (void) iswpunct (0);
43   (void) iswspace (0);
44   (void) iswupper (0);
45   (void) iswxdigit (0);
46
47   /* Check that the isw* functions map WEOF to 0.  */
48   ASSERT (!iswalnum (e));
49   ASSERT (!iswalpha (e));
50   ASSERT (!iswblank (e));
51   ASSERT (!iswcntrl (e));
52   ASSERT (!iswdigit (e));
53   ASSERT (!iswgraph (e));
54   ASSERT (!iswlower (e));
55   ASSERT (!iswprint (e));
56   ASSERT (!iswpunct (e));
57   ASSERT (!iswspace (e));
58   ASSERT (!iswupper (e));
59   ASSERT (!iswxdigit (e));
60
61   /* Check that the tow* functions exist as functions or as macros.  */
62   (void) towlower (0);
63   (void) towupper (0);
64
65   /* Check that the tow* functions map WEOF to WEOF.  */
66   ASSERT (towlower (e) == e);
67   ASSERT (towupper (e) == e);
68
69   return 0;
70 }