summaryrefslogtreecommitdiff
path: root/support/regression/tests/escape.c
blob: 224730c3ac5aa7783c8aa802f1c04600512359f7 (plain) (blame)
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
34
35
36
37
38
39
40
/* Tests escape sequences
 */
#include <testfwk.h>

#ifdef __SDCC
#pragma std_c11
#endif

#include <stddef.h> // For wchar_t
#ifndef PORT_HOST // Too many old host compilers out there
#include <uchar.h> // For char16_t, char32_t
#endif

void
testEscape(void)
{
  volatile char c;
#ifndef PORT_HOST // Too many old host compilers out there
  volatile char16_t u;
#endif

  ASSERT ('\x55' == 0x55);
  c = '\x55';
  ASSERT (c == 0x55);

#ifndef PORT_HOST // Too many old host compilers out there
  ASSERT (u'\777' == 0777);
  u = u'\777';
  ASSERT (u == 0777);

  ASSERT (u'\x55aa' == 0x55aau);
  u = u'\x55aa';
  ASSERT (u == 0x55aau);

  ASSERT (u'\u55aa' == 0x55aau);
  u = u'\u55aa';
  ASSERT (u == 0x55aau);
#endif
}