blob: 5431c0820a3184cf2a79d301717007884bbd6056 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
/* Tests character constants.
*/
#include <testfwk.h>
#ifdef __SDCC
#pragma std_c11
#endif
#include <stddef.h> // For wchar_t
#if defined(__SDCC) || defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L && !defined(__APPLE__) && !defined(__OpenBSD__) // As of 2023, macOS and OpenBSD are still not fully C11-compliant: they lack uchar.h.
#include <uchar.h> // For char16_t, char32_t
char16_t uc = u'c';
char32_t Uc = U'c';
#endif
char c = 'c';
wchar_t wc = L'c';
void
testCharConst(void)
{
#if defined(__SDCC) || defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L
ASSERT (_Generic('c', default: 1, int: 0) == 0);
ASSERT (_Generic(L'c', default: 1, wchar_t: 0) == 0);
#if !defined(__APPLE__) && !defined(__OpenBSD__) // As of 2023, macOS and OpenBSD are still not C11-compliant: they lack uchar.h.
ASSERT (_Generic(u'c', default: 1, char16_t: 0) == 0);
ASSERT (_Generic(U'c', default: 1, char32_t: 0) == 0);
#endif
#endif
}
|