uchar C++ tests: Fix build error on FreeBSD 12.
[gnulib.git] / tests / test-uchar.c
blob020d82d58c2afb1862a09931c4f34f806d640591
1 /* Test of <uchar.h> substitute.
2 Copyright (C) 2019-2020 Free Software Foundation, Inc.
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.
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.
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/>. */
17 /* Written by Bruno Haible <bruno@clisp.org>, 2019. */
19 #include <config.h>
21 #include <uchar.h>
23 #include "verify.h"
25 /* Check that the types are defined. */
26 mbstate_t a = { 0 };
27 size_t b = 5;
28 char16_t c = 'x';
29 char32_t d = 'y';
31 /* Check that char16_t and char32_t are unsigned types. */
32 verify ((char16_t)(-1) >= 0);
33 #if !defined __HP_cc
34 verify ((char32_t)(-1) >= 0);
35 #endif
37 /* Check that char32_t is at least 31 bits wide. */
38 verify ((char32_t)0x7FFFFFFF != (char32_t)0x3FFFFFFF);
40 /* Check that _GL_LARGE_CHAR32_T is correctly defined. */
41 #if _GL_LARGE_CHAR32_T
42 verify (sizeof (char32_t) > sizeof (wchar_t));
43 #else
44 verify (sizeof (char32_t) == sizeof (wchar_t));
45 #endif
47 int
48 main (void)
50 return 0;