]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/regex/test/unicode/unicode_iterator_test.cpp
243ef742fc5757ab199127a68c24a8797eb1044f
[ceph.git] / ceph / src / boost / libs / regex / test / unicode / unicode_iterator_test.cpp
1 /*
2 *
3 * Copyright (c) 2004
4 * John Maddock
5 *
6 * Use, modification and distribution are subject to the
7 * Boost Software License, Version 1.0. (See accompanying file
8 * LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
9 *
10 */
11
12 /*
13 * LOCATION: see http://www.boost.org for most recent version.
14 * FILE unicode_iterator_test.cpp
15 * VERSION see <boost/version.hpp>
16 * DESCRIPTION: Simple test suite for Unicode interconversions.
17 */
18
19 #include <boost/regex/pending/unicode_iterator.hpp>
20 #include <boost/detail/lightweight_main.hpp>
21 #include "../test_macros.hpp"
22 #include <vector>
23 #include <iterator>
24 #include <algorithm>
25 #include <iostream>
26 #include <iomanip>
27 #include <cstring>
28
29 #if !defined(TEST_UTF8) && !defined(TEST_UTF16)
30 # define TEST_UTF8
31 # define TEST_UTF16
32 #endif
33
34 template <class I>
35 typename I::value_type iterate_over(I a, I b)
36 {
37 typedef typename I::value_type value_type;
38 value_type v = 0;
39 while(a != b)
40 {
41 v ^= *a;
42 ++a;
43 }
44 return v;
45 }
46
47 void spot_checks()
48 {
49 // test specific values ripped straight out of the Unicode standard
50 // to verify that our encoding is the same as theirs, as well as
51 // self-consistent:
52 ::boost::uint32_t spot16[] = { 0x10302u, };
53 typedef boost::u32_to_u16_iterator<const ::boost::uint32_t*> u32to16type;
54
55 u32to16type it(spot16);
56 BOOST_CHECK_EQUAL(*it++, 0xD800u);
57 BOOST_CHECK_EQUAL(*it++, 0xDF02u);
58 BOOST_CHECK_EQUAL(*--it, 0xDF02u);
59 BOOST_CHECK_EQUAL(*--it, 0xD800u);
60
61 ::boost::uint32_t spot8[] = { 0x004Du, 0x0430u, 0x4E8Cu, 0x10302u, };
62 typedef boost::u32_to_u8_iterator<const ::boost::uint32_t*> u32to8type;
63
64 u32to8type it8(spot8);
65 BOOST_CHECK_EQUAL(*it8++, 0x4Du);
66 BOOST_CHECK_EQUAL(*it8++, 0xD0u);
67 BOOST_CHECK_EQUAL(*it8++, 0xB0u);
68 BOOST_CHECK_EQUAL(*it8++, 0xE4u);
69 BOOST_CHECK_EQUAL(*it8++, 0xBAu);
70 BOOST_CHECK_EQUAL(*it8++, 0x8Cu);
71 BOOST_CHECK_EQUAL(*it8++, 0xF0u);
72 BOOST_CHECK_EQUAL(*it8++, 0x90u);
73 BOOST_CHECK_EQUAL(*it8++, 0x8Cu);
74 BOOST_CHECK_EQUAL(*it8++, 0x82u);
75
76 BOOST_CHECK_EQUAL(*--it8, 0x82u);
77 BOOST_CHECK_EQUAL(*--it8, 0x8Cu);
78 BOOST_CHECK_EQUAL(*--it8, 0x90u);
79 BOOST_CHECK_EQUAL(*--it8, 0xF0u);
80 BOOST_CHECK_EQUAL(*--it8, 0x8Cu);
81 BOOST_CHECK_EQUAL(*--it8, 0xBAu);
82 BOOST_CHECK_EQUAL(*--it8, 0xE4u);
83 BOOST_CHECK_EQUAL(*--it8, 0xB0u);
84 BOOST_CHECK_EQUAL(*--it8, 0xD0u);
85 BOOST_CHECK_EQUAL(*--it8, 0x4Du);
86 //
87 // Test some bad sequences and verify that our iterators will catch them:
88 //
89 boost::uint8_t bad_seq[10] = { 0x4Du, 0xD0u, 0xB0u, 0xE4u, 0xBAu, 0x8Cu, 0xF0u, 0x90u, 0x8Cu, 0x82u };
90 BOOST_CHECK_EQUAL(
91 iterate_over(
92 boost::u8_to_u32_iterator<const boost::uint8_t*>(bad_seq, bad_seq, bad_seq + 10),
93 boost::u8_to_u32_iterator<const boost::uint8_t*>(bad_seq+10, bad_seq, bad_seq + 10)),
94 0x000149f3u);
95 BOOST_CHECK_THROW(boost::u8_to_u32_iterator<const boost::uint8_t*>(bad_seq, bad_seq, bad_seq + 9), std::out_of_range);
96 BOOST_CHECK_THROW(boost::u8_to_u32_iterator<const boost::uint8_t*>(bad_seq, bad_seq, bad_seq + 8), std::out_of_range);
97 BOOST_CHECK_THROW(boost::u8_to_u32_iterator<const boost::uint8_t*>(bad_seq, bad_seq, bad_seq + 7), std::out_of_range);
98 BOOST_CHECK_THROW(boost::u8_to_u32_iterator<const boost::uint8_t*>(bad_seq + 2, bad_seq, bad_seq + 10), std::out_of_range);
99 BOOST_CHECK_THROW(boost::u8_to_u32_iterator<const boost::uint8_t*>(bad_seq + 2, bad_seq + 2, bad_seq + 10), std::out_of_range);
100
101 boost::uint16_t bad_seq2[6] = { 0xD800, 0xDF02, 0xD800, 0xDF02, 0xD800, 0xDF02 };
102 BOOST_CHECK_EQUAL(
103 iterate_over(
104 boost::u16_to_u32_iterator<const boost::uint16_t*>(bad_seq2, bad_seq2, bad_seq2 + 6),
105 boost::u16_to_u32_iterator<const boost::uint16_t*>(bad_seq2+6, bad_seq2, bad_seq2 + 6)),
106 66306u);
107 BOOST_CHECK_THROW(boost::u16_to_u32_iterator<const boost::uint16_t*>(bad_seq2, bad_seq2, bad_seq2 + 5), std::out_of_range);
108 BOOST_CHECK_THROW(boost::u16_to_u32_iterator<const boost::uint16_t*>(bad_seq2 + 1, bad_seq2 + 1, bad_seq2 + 6), std::out_of_range);
109 BOOST_CHECK_THROW(boost::u16_to_u32_iterator<const boost::uint16_t*>(bad_seq2 + 1, bad_seq2, bad_seq2 + 6), std::out_of_range);
110
111 boost::uint8_t bad_seq3[5] = { '.', '*', 0xe4, '.', '*' };
112 BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const boost::uint8_t*>(bad_seq3, bad_seq3, bad_seq3 + 5), boost::u8_to_u32_iterator<const boost::uint8_t*>(bad_seq3 + 5, bad_seq3, bad_seq3 + 5)), std::out_of_range);
113 boost::uint8_t bad_seq4[5] = { '.', '*', 0xf6, '.', '*' };
114 BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const boost::uint8_t*>(bad_seq4, bad_seq4, bad_seq4 + 5), boost::u8_to_u32_iterator<const boost::uint8_t*>(bad_seq4 + 5, bad_seq4, bad_seq4 + 5)), std::out_of_range);
115
116 // Invalid sequences containing surrogate pairs:
117 const char* invalid_pseq = "\xed\xa0\x80"; // single lowest lead surrogate U+D800
118 BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
119 invalid_pseq = "\xed\xb0\x80"; // single lowest trail surrogate U+DC00
120 BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
121 invalid_pseq = "\xed\xb0\x80"; // single lowest trail surrogate U+DC00
122 BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
123 invalid_pseq = "\xed\xbf\xbf"; // single highest trail surrogate U+DFFF
124 BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
125
126 // overlong encodings (created by left-padding with zero bits)
127 invalid_pseq = "\xc0\x80"; // illegal 2-byte encoding of 1-byte character U+0000
128 BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
129 invalid_pseq = "\xe0\x80\x80"; // illegal 3-byte encoding of 1-byte character U+0000
130 BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
131 invalid_pseq = "\xf0\x80\x80\x80"; // illegal 4-byte encoding of 1-byte character U+0000
132 BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
133
134 invalid_pseq = "\xc1\xbf"; // illegal 2-byte encoding of 1-byte character U+007F
135 BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
136 invalid_pseq = "\xe0\x81\xbf"; // illegal 3-byte encoding of 1-byte character U+007F
137 BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
138 invalid_pseq = "\xf0\x80\x81\xbf"; // illegal 4-byte encoding of 1-byte character U+007F
139 BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
140
141 invalid_pseq = "\xe0\x82\x80"; // illegal 3-byte encoding of 2-byte character U+0080
142 BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
143 invalid_pseq = "\xf0\x80\x82\x80"; // illegal 4-byte encoding of 2-byte character U+0080
144 BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
145
146 invalid_pseq = "\xe0\x9f\xbf"; // illegal 3-byte encoding of 2-byte character U+07FF
147 BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
148 invalid_pseq = "\xf0\x80\x9f\xbf"; // illegal 4-byte encoding of 2-byte character U+07FF
149 BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
150
151 invalid_pseq = "\xf0\x80\xa0\x80"; // illegal 4-byte encoding of 3-byte character U+0800
152 BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
153 invalid_pseq = "\xf0\x8f\xbf\xbf"; // illegal 4-byte encoding of 3-byte character U+FFFF
154 BOOST_CHECK_THROW(iterate_over(boost::u8_to_u32_iterator<const char*>(invalid_pseq, invalid_pseq, invalid_pseq + std::strlen(invalid_pseq)), boost::u8_to_u32_iterator<const char*>(invalid_pseq + std::strlen(invalid_pseq), invalid_pseq, invalid_pseq + std::strlen(invalid_pseq))), std::out_of_range);
155 }
156
157 void test(const std::vector< ::boost::uint32_t>& v)
158 {
159 typedef std::vector< ::boost::uint32_t> vector32_type;
160 typedef std::vector< ::boost::uint16_t> vector16_type;
161 typedef std::vector< ::boost::uint8_t> vector8_type;
162 typedef boost::u32_to_u16_iterator<vector32_type::const_iterator, ::boost::uint16_t> u32to16type;
163 typedef boost::u16_to_u32_iterator<vector16_type::const_iterator, ::boost::uint32_t> u16to32type;
164 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_STD_ITERATOR) && !defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
165 typedef std::reverse_iterator<u32to16type> ru32to16type;
166 typedef std::reverse_iterator<u16to32type> ru16to32type;
167 #endif
168 typedef boost::u32_to_u8_iterator<vector32_type::const_iterator, ::boost::uint8_t> u32to8type;
169 typedef boost::u8_to_u32_iterator<vector8_type::const_iterator, ::boost::uint32_t> u8to32type;
170 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_STD_ITERATOR) && !defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
171 typedef std::reverse_iterator<u32to8type> ru32to8type;
172 typedef std::reverse_iterator<u8to32type> ru8to32type;
173 #endif
174 vector8_type v8;
175 vector16_type v16;
176 vector32_type v32;
177 vector32_type::const_iterator i, j, k;
178
179 #ifdef TEST_UTF16
180 //
181 // begin by testing forward iteration, of 32-16 bit interconversions:
182 //
183 #if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
184 v16.assign(u32to16type(v.begin()), u32to16type(v.end()));
185 #else
186 v16.clear();
187 std::copy(u32to16type(v.begin()), u32to16type(v.end()), std::back_inserter(v16));
188 #endif
189 #ifndef BOOST_NO_STD_DISTANCE
190 BOOST_CHECK_EQUAL((std::size_t)std::distance(u32to16type(v.begin()), u32to16type(v.end())), v16.size());
191 #endif
192 #if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
193 v32.assign(u16to32type(v16.begin(), v16.begin(), v16.end()), u16to32type(v16.end(), v16.begin(), v16.end()));
194 #else
195 v32.clear();
196 std::copy(u16to32type(v16.begin(), v16.begin(), v16.end()), u16to32type(v16.end(), v16.begin(), v16.end()), std::back_inserter(v32));
197 #endif
198 #ifndef BOOST_NO_STD_DISTANCE
199 BOOST_CHECK_EQUAL((std::size_t)std::distance(u16to32type(v16.begin(), v16.begin(), v16.end()), u16to32type(v16.end(), v16.begin(), v16.end())), v32.size());
200 #endif
201 BOOST_CHECK_EQUAL(v.size(), v32.size());
202 i = v.begin();
203 j = i;
204 std::advance(j, (std::min)(v.size(), v32.size()));
205 k = v32.begin();
206 BOOST_CHECK_EQUAL_COLLECTIONS(v.begin(), v.end(), v32.begin(), v32.end());
207 //
208 // test backward iteration, of 32-16 bit interconversions:
209 //
210 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_STD_ITERATOR) && !defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
211 v16.assign(ru32to16type(u32to16type(v.end())), ru32to16type(u32to16type(v.begin())));
212 #ifndef BOOST_NO_STD_DISTANCE
213 BOOST_CHECK_EQUAL((std::size_t)std::distance(ru32to16type(u32to16type(v.end())), ru32to16type(u32to16type(v.begin()))), v16.size());
214 #endif
215 std::reverse(v16.begin(), v16.end());
216 v32.assign(ru16to32type(u16to32type(v16.end(), v16.begin(), v16.end())), ru16to32type(u16to32type(v16.begin(), v16.begin(), v16.end())));
217 #ifndef BOOST_NO_STD_DISTANCE
218 BOOST_CHECK_EQUAL((std::size_t)std::distance(ru16to32type(u16to32type(v16.end(), v16.begin(), v16.end())), ru16to32type(u16to32type(v16.begin(), v16.begin(), v16.end()))), v32.size());
219 #endif
220 BOOST_CHECK_EQUAL(v.size(), v32.size());
221 std::reverse(v32.begin(), v32.end());
222 i = v.begin();
223 j = i;
224 std::advance(j, (std::min)(v.size(), v32.size()));
225 k = v32.begin();
226 BOOST_CHECK_EQUAL_COLLECTIONS(v.begin(), v.end(), v32.begin(), v32.end());
227 #endif
228 #endif // TEST_UTF16
229
230 #ifdef TEST_UTF8
231 //
232 // Test forward iteration, of 32-8 bit interconversions:
233 //
234 #if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
235 v8.assign(u32to8type(v.begin()), u32to8type(v.end()));
236 #else
237 v8.clear();
238 std::copy(u32to8type(v.begin()), u32to8type(v.end()), std::back_inserter(v8));
239 #endif
240 #ifndef BOOST_NO_STD_DISTANCE
241 BOOST_CHECK_EQUAL((std::size_t)std::distance(u32to8type(v.begin()), u32to8type(v.end())), v8.size());
242 #endif
243 #if !defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
244 v32.assign(u8to32type(v8.begin(), v8.begin(), v8.end()), u8to32type(v8.end(), v8.begin(), v8.end()));
245 #else
246 v32.clear();
247 std::copy(u8to32type(v8.begin(), v8.begin(), v8.end()), u8to32type(v8.end(), v8.begin(), v8.end()), std::back_inserter(v32));
248 #endif
249 #ifndef BOOST_NO_STD_DISTANCE
250 BOOST_CHECK_EQUAL((std::size_t)std::distance(u8to32type(v8.begin(), v8.begin(), v8.end()), u8to32type(v8.end(), v8.begin(), v8.end())), v32.size());
251 #endif
252 BOOST_CHECK_EQUAL(v.size(), v32.size());
253 i = v.begin();
254 j = i;
255 std::advance(j, (std::min)(v.size(), v32.size()));
256 k = v32.begin();
257 BOOST_CHECK_EQUAL_COLLECTIONS(v.begin(), v.end(), v32.begin(), v32.end());
258 //
259 // test backward iteration, of 32-8 bit interconversions:
260 //
261 #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_NO_STD_ITERATOR) && !defined(_RWSTD_NO_CLASS_PARTIAL_SPEC)
262 v8.assign(ru32to8type(u32to8type(v.end())), ru32to8type(u32to8type(v.begin())));
263 #ifndef BOOST_NO_STD_DISTANCE
264 BOOST_CHECK_EQUAL((std::size_t)std::distance(ru32to8type(u32to8type(v.end())), ru32to8type(u32to8type(v.begin()))), v8.size());
265 #endif
266 std::reverse(v8.begin(), v8.end());
267 v32.assign(ru8to32type(u8to32type(v8.end(), v8.begin(), v8.end())), ru8to32type(u8to32type(v8.begin(), v8.begin(), v8.end())));
268 #ifndef BOOST_NO_STD_DISTANCE
269 BOOST_CHECK_EQUAL((std::size_t)std::distance(ru8to32type(u8to32type(v8.end(), v8.begin(), v8.end())), ru8to32type(u8to32type(v8.begin(), v8.begin(), v8.end()))), v32.size());
270 #endif
271 BOOST_CHECK_EQUAL(v.size(), v32.size());
272 std::reverse(v32.begin(), v32.end());
273 i = v.begin();
274 j = i;
275 std::advance(j, (std::min)(v.size(), v32.size()));
276 k = v32.begin();
277 BOOST_CHECK_EQUAL_COLLECTIONS(v.begin(), v.end(), v32.begin(), v32.end());
278 #endif
279 #endif // TEST_UTF8
280 //
281 // Test checked construction of UTF-8/16 iterators at each location in the sequences:
282 //
283 #ifdef TEST_UTF8
284 for(u8to32type v8p(v8.begin(), v8.begin(), v8.end()), v8e(v8.end(), v8.begin(), v8.end()); v8p != v8e; ++v8p)
285 {
286 u8to32type pos(v8p.base(), v8p.base(), v8.end());
287 BOOST_CHECK(pos == v8p);
288 BOOST_CHECK(*pos == *v8p);
289 }
290 #endif
291 #ifdef TEST_UTF16
292 for(u16to32type v16p(v16.begin(), v16.begin(), v16.end()), v16e(v16.end(), v16.begin(), v16.end()); v16p != v16e; ++v16p)
293 {
294 u16to32type pos(v16p.base(), v16p.base(), v16.end());
295 BOOST_CHECK(pos == v16p);
296 BOOST_CHECK(*pos == *v16p);
297 }
298 #endif
299 }
300
301 int cpp_main( int, char* [] )
302 {
303 // test specific value points from the standard:
304 spot_checks();
305 // now test a bunch of values for self-consistency and round-tripping:
306 std::vector< ::boost::uint32_t> v;
307 for(unsigned i = 0; i < 0xD800; ++i)
308 v.push_back(i);
309 for(unsigned i = 0xDFFF + 1; i < 0x10FFFF; ++i)
310 v.push_back(i);
311 test(v);
312 return 0;
313 }
314