Debian Codegraph @

gcc/testsuite/g++.dg/ext/utf16-1.C

raw
1 /* Contributed by Kris Van Hees <[email protected]> */
2 /* Test the support for char16_t character constants. */
3 /* { dg-do run { target c++11 } } */
4 /* { dg-options "-Wall -Werror" } */
5
6 extern "C" void abort (void);
7
8 const static char16_t c0 = u'a';
9 const static char16_t c1 = u'\0';
10 const static char16_t c2 = u'\u0024';
11 const static char16_t c3 = u'\u2029';
12 const static char16_t c4 = u'\u8010';
13
14 const static char16_t c5 = 'a';
15 const static char16_t c6 = U'a';
16 const static char16_t c7 = U'\u2029';
17 const static char16_t c8 = U'\u8010';
18 const static char16_t c9 = L'a';
19 const static char16_t ca = L'\u2029';
20 const static char16_t cb = L'\u8010';
21
22 #define A 0x0061
23 #define D 0x0024
24 #define X 0x2029
25 #define Y 0x8010
26
27 int main ()
28 {
29 if (sizeof (u'a') != sizeof (char16_t))
30 abort ();
31 if (sizeof (u'\0') != sizeof (char16_t))
32 abort ();
33 if (sizeof (u'\u0024') != sizeof (char16_t))
34 abort ();
35 if (sizeof (u'\u2029') != sizeof (char16_t))
36 abort ();
37 if (sizeof (u'\u8010') != sizeof (char16_t))
38 abort ();
39
40 if (c0 != A)
41 abort ();
42 if (c1 != 0x0000)
43 abort ();
44 if (c2 != D)
45 abort ();
46 if (c3 != X)
47 abort ();
48 if (c4 != Y)
49 abort ();
50
51 if (c5 != A)
52 abort ();
53 if (c6 != A)
54 abort ();
55 if (c7 != X)
56 abort ();
57 if (c8 != Y)
58 abort ();
59 if (c9 != A)
60 abort ();
61 if (ca != X)
62 abort ();
63 if (cb != Y)
64 abort ();
65 }