usleep tests: Avoid failure due to known Cygwin 3.5.3 bug.
[gnulib.git] / tests / test-uchar.c
blobdfb368e052435f59124f038b3e37987aa1d77278
1 /* Test of <uchar.h> substitute.
2 Copyright (C) 2019-2024 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 /* Check that the types are defined. */
24 mbstate_t a = { 0 };
25 size_t b = 5;
26 char8_t c = 'x';
27 char16_t d = 'y';
28 char32_t e = 'z';
30 /* Check that char8_t, char16_t, and char32_t are unsigned types. */
31 static_assert ((char8_t)(-1) >= 0);
32 static_assert ((char16_t)(-1) >= 0);
33 #if !defined __HP_cc
34 static_assert ((char32_t)(-1) >= 0);
35 #endif
37 /* Check that char8_t is at least 8 bits wide. */
38 static_assert ((char8_t)0xFF != (char8_t)0x7F);
40 /* Check that char16_t is at least 16 bits wide. */
41 static_assert ((char16_t)0xFFFF != (char16_t)0x7FFF);
43 /* Check that char32_t is at least 31 bits wide. */
44 static_assert ((char32_t)0x7FFFFFFF != (char32_t)0x3FFFFFFF);
46 /* Check that _GL_SMALL_WCHAR_T is correctly defined. */
47 #if _GL_SMALL_WCHAR_T
48 static_assert (sizeof (wchar_t) < sizeof (char32_t));
49 #else
50 static_assert (sizeof (wchar_t) == sizeof (char32_t));
51 #endif
53 int
54 main (void)
56 return 0;