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 int ret;
29
30
31 {
32 static const uint8_t input[] = "";
33 ret = u8_mblen (input, 0);
34 ASSERT (ret == -1);
35 }
36
37
38 {
39 static const uint8_t input[] = "";
40 ret = u8_mblen (input, 1);
41 ASSERT (ret == 0);
42 }
43
44
45 {
46 ucs4_t c;
47 uint8_t buf[1];
48
49 for (c = 1; c < 0x80; c++)
50 {
51 buf[0] = c;
52 ret = u8_mblen (buf, 1);
53 ASSERT (ret == 1);
54 }
55 }
56
57
58 {
59 static const uint8_t input[] = { 0xC3, 0x97 };
60 ret = u8_mblen (input, 2);
61 ASSERT (ret == 2);
62 }
63
64
65 {
66 static const uint8_t input[] = { 0xE2, 0x82, 0xAC };
67 ret = u8_mblen (input, 3);
68 ASSERT (ret == 3);
69 }
70
71
72 {
73 static const uint8_t input[] = { 0xF4, 0x8F, 0xBF, 0xBD };
74 ret = u8_mblen (input, 4);
75 ASSERT (ret == 4);
76 }
77
78
79 {
80 static const uint8_t input[] = { 0xC1 };
81 ret = u8_mblen (input, 1);
82 ASSERT (ret == -1);
83 }
84 {
85 static const uint8_t input[] = { 0xC3 };
86 ret = u8_mblen (input, 1);
87 ASSERT (ret == -1);
88 }
89 {
90 static const uint8_t input[] = { 0xE2 };
91 ret = u8_mblen (input, 1);
92 ASSERT (ret == -1);
93 }
94 {
95 static const uint8_t input[] = { 0xF4 };
96 ret = u8_mblen (input, 1);
97 ASSERT (ret == -1);
98 }
99 {
100 static const uint8_t input[] = { 0xFE };
101 ret = u8_mblen (input, 1);
102 ASSERT (ret == -1);
103 }
104
105
106 {
107 static const uint8_t input[] = { 0xE0, 0x9F };
108 ret = u8_mblen (input, 2);
109 ASSERT (ret == -1);
110 }
111 {
112 static const uint8_t input[] = { 0xE2, 0x82 };
113 ret = u8_mblen (input, 2);
114 ASSERT (ret == -1);
115 }
116 {
117 static const uint8_t input[] = { 0xE2, 0xD0 };
118 ret = u8_mblen (input, 2);
119 ASSERT (ret == -1);
120 }
121 {
122 static const uint8_t input[] = { 0xF0, 0x8F };
123 ret = u8_mblen (input, 2);
124 ASSERT (ret == -1);
125 }
126 {
127 static const uint8_t input[] = { 0xF3, 0x8F };
128 ret = u8_mblen (input, 2);
129 ASSERT (ret == -1);
130 }
131 {
132 static const uint8_t input[] = { 0xF3, 0xD0 };
133 ret = u8_mblen (input, 2);
134 ASSERT (ret == -1);
135 }
136
137
138 {
139 static const uint8_t input[] = { 0xF3, 0x8F, 0xBF };
140 ret = u8_mblen (input, 3);
141 ASSERT (ret == -1);
142 }
143 {
144 static const uint8_t input[] = { 0xF3, 0xD0, 0xBF };
145 ret = u8_mblen (input, 3);
146 ASSERT (ret == -1);
147 }
148 {
149 static const uint8_t input[] = { 0xF3, 0x8F, 0xD0 };
150 ret = u8_mblen (input, 3);
151 ASSERT (ret == -1);
152 }
153
154 return 0;
155 }