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