This source file includes following definitions.
- main
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 #include <config.h>
20
21 #include "unistr.h"
22
23 #include "macros.h"
24
25 int
26 main ()
27 {
28 ucs4_t uc;
29 const uint8_t *ret;
30
31
32 {
33 static const uint8_t input[] = "";
34 uc = 0xBADFACE;
35 ret = u8_next (&uc, input);
36 ASSERT (ret == NULL);
37 ASSERT (uc == 0);
38 }
39
40
41 {
42 ucs4_t c;
43 uint8_t buf[2];
44
45 for (c = 1; c < 0x80; c++)
46 {
47 buf[0] = c;
48 buf[1] = 0;
49 uc = 0xBADFACE;
50 ret = u8_next (&uc, buf);
51 ASSERT (ret == buf + 1);
52 ASSERT (uc == c);
53 }
54 }
55
56
57 {
58 static const uint8_t input[] = { 0xC3, 0x97, 0 };
59 uc = 0xBADFACE;
60 ret = u8_next (&uc, input);
61 ASSERT (ret == input + 2);
62 ASSERT (uc == 0x00D7);
63 }
64
65
66 {
67 static const uint8_t input[] = { 0xE2, 0x82, 0xAC, 0 };
68 uc = 0xBADFACE;
69 ret = u8_next (&uc, input);
70 ASSERT (ret == input + 3);
71 ASSERT (uc == 0x20AC);
72 }
73
74
75 {
76 static const uint8_t input[] = { 0xF4, 0x8F, 0xBF, 0xBD, 0 };
77 uc = 0xBADFACE;
78 ret = u8_next (&uc, input);
79 ASSERT (ret == input + 4);
80 ASSERT (uc == 0x10FFFD);
81 }
82
83
84 {
85 static const uint8_t input[] = { 0xC1, 0 };
86 uc = 0xBADFACE;
87 ret = u8_next (&uc, input);
88 ASSERT (ret == NULL);
89 ASSERT (uc == 0xFFFD);
90 }
91 {
92 static const uint8_t input[] = { 0xC3, 0 };
93 uc = 0xBADFACE;
94 ret = u8_next (&uc, input);
95 ASSERT (ret == NULL);
96 ASSERT (uc == 0xFFFD);
97 }
98 {
99 static const uint8_t input[] = { 0xE2, 0 };
100 uc = 0xBADFACE;
101 ret = u8_next (&uc, input);
102 ASSERT (ret == NULL);
103 ASSERT (uc == 0xFFFD);
104 }
105 {
106 static const uint8_t input[] = { 0xF4, 0 };
107 uc = 0xBADFACE;
108 ret = u8_next (&uc, input);
109 ASSERT (ret == NULL);
110 ASSERT (uc == 0xFFFD);
111 }
112 {
113 static const uint8_t input[] = { 0xFE, 0 };
114 uc = 0xBADFACE;
115 ret = u8_next (&uc, input);
116 ASSERT (ret == NULL);
117 ASSERT (uc == 0xFFFD);
118 }
119
120
121 {
122 static const uint8_t input[] = { 0xE0, 0x9F, 0 };
123 uc = 0xBADFACE;
124 ret = u8_next (&uc, input);
125 ASSERT (ret == NULL);
126 ASSERT (uc == 0xFFFD);
127 }
128 {
129 static const uint8_t input[] = { 0xE2, 0x82, 0 };
130 uc = 0xBADFACE;
131 ret = u8_next (&uc, input);
132 ASSERT (ret == NULL);
133 ASSERT (uc == 0xFFFD);
134 }
135 {
136 static const uint8_t input[] = { 0xE2, 0xD0, 0 };
137 uc = 0xBADFACE;
138 ret = u8_next (&uc, input);
139 ASSERT (ret == NULL);
140 ASSERT (uc == 0xFFFD);
141 }
142 {
143 static const uint8_t input[] = { 0xF0, 0x8F, 0 };
144 uc = 0xBADFACE;
145 ret = u8_next (&uc, input);
146 ASSERT (ret == NULL);
147 ASSERT (uc == 0xFFFD);
148 }
149 {
150 static const uint8_t input[] = { 0xF3, 0x8F, 0 };
151 uc = 0xBADFACE;
152 ret = u8_next (&uc, input);
153 ASSERT (ret == NULL);
154 ASSERT (uc == 0xFFFD);
155 }
156 {
157 static const uint8_t input[] = { 0xF3, 0xD0, 0 };
158 uc = 0xBADFACE;
159 ret = u8_next (&uc, input);
160 ASSERT (ret == NULL);
161 ASSERT (uc == 0xFFFD);
162 }
163
164
165 {
166 static const uint8_t input[] = { 0xF3, 0x8F, 0xBF, 0 };
167 uc = 0xBADFACE;
168 ret = u8_next (&uc, input);
169 ASSERT (ret == NULL);
170 ASSERT (uc == 0xFFFD);
171 }
172 {
173 static const uint8_t input[] = { 0xF3, 0xD0, 0xBF, 0 };
174 uc = 0xBADFACE;
175 ret = u8_next (&uc, input);
176 ASSERT (ret == NULL);
177 ASSERT (uc == 0xFFFD);
178 }
179 {
180 static const uint8_t input[] = { 0xF3, 0x8F, 0xD0, 0 };
181 uc = 0xBADFACE;
182 ret = u8_next (&uc, input);
183 ASSERT (ret == NULL);
184 ASSERT (uc == 0xFFFD);
185 }
186
187 return 0;
188 }