e495698778a0de84e880006c0e728e379db73561
[libdai.git] / tests / unit / smallset_test.cpp
1 /* This file is part of libDAI - http://www.libdai.org/
2 *
3 * Copyright (c) 2006-2011, The libDAI authors. All rights reserved.
4 *
5 * Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
6 */
7
8
9 #include <dai/smallset.h>
10 #include <vector>
11
12
13 using namespace dai;
14
15
16 #define BOOST_TEST_MODULE SmallSetTest
17
18
19 #include <boost/test/unit_test.hpp>
20
21
22 BOOST_AUTO_TEST_CASE( ConstructorsTest ) {
23 // check constructors
24 SmallSet<int> x;
25 BOOST_CHECK( x.empty() );
26 BOOST_CHECK_EQUAL( x.size(), 0 );
27 BOOST_CHECK( !x.contains( 5 ) );
28
29 SmallSet<int> y( 1 );
30 BOOST_CHECK( !y.empty() );
31 BOOST_CHECK_EQUAL( y.size(), 1 );
32 BOOST_CHECK( !y.contains( 5 ) );
33 BOOST_CHECK( y.contains( 1 ) );
34
35 SmallSet<size_t> u( 0, 1 );
36 BOOST_CHECK( !u.empty() );
37 BOOST_CHECK_EQUAL( u.size(), 2 );
38 BOOST_CHECK( !u.contains( 2 ) );
39 BOOST_CHECK( u.contains( 1 ) );
40 BOOST_CHECK( u.contains( 0 ) );
41
42 SmallSet<double> z( 1.0, 2.0 );
43 BOOST_CHECK_EQUAL( z.size(), 2 );
44 BOOST_CHECK( !z.contains( 5.0 ) );
45 BOOST_CHECK( z.contains( 1.0 ) );
46 BOOST_CHECK( z.contains( 2.0 ) );
47
48 SmallSet<char> v( 'a', 'a' );
49 BOOST_CHECK_EQUAL( v.size(), 1 );
50 BOOST_CHECK( v.contains( 'a' ) );
51 BOOST_CHECK( !v.contains( 'b' ) );
52
53 std::vector<int> a;
54 a.push_back( 1 );
55 a.push_back( 3 );
56 a.push_back( 4 );
57 a.push_back( 3 );
58 a.push_back( 2 );
59 SmallSet<double> w( a.begin(), a.end(), a.size() );
60 BOOST_CHECK_EQUAL( w.size(), 4 );
61 BOOST_CHECK( w.contains( 1 ) );
62 BOOST_CHECK( w.contains( 2 ) );
63 BOOST_CHECK( w.contains( 3 ) );
64 BOOST_CHECK( w.contains( 4 ) );
65 BOOST_CHECK( !w.contains( 0 ) );
66
67 x = y;
68 BOOST_CHECK( x == y );
69 }
70
71
72 BOOST_AUTO_TEST_CASE( ComparisonTest ) {
73 // check comparison operators
74 SmallSet<int> x, y;
75 BOOST_CHECK( x == y );
76 BOOST_CHECK( !(x != y) );
77
78 SmallSet<int> z( 1 );
79 BOOST_CHECK( x != z );
80 BOOST_CHECK( !(x == z) );
81
82 BOOST_CHECK( x < z );
83
84 SmallSet<int> u( 2 );
85 BOOST_CHECK( x < u );
86 BOOST_CHECK( z < u );
87 BOOST_CHECK( !(u < z) );
88
89 SmallSet<int> v( 2, 1 );
90 BOOST_CHECK( x < v );
91 BOOST_CHECK( z < v );
92 BOOST_CHECK( !(v < z) );
93 BOOST_CHECK( v < u );
94 BOOST_CHECK( !(u < v) );
95
96 SmallSet<int> w( 1, 3 );
97 BOOST_CHECK( x < w );
98 BOOST_CHECK( v < w );
99 BOOST_CHECK( z < w );
100 BOOST_CHECK( w < u );
101 BOOST_CHECK( !(w < x) );
102 BOOST_CHECK( !(w < v) );
103 BOOST_CHECK( !(w < z) );
104 BOOST_CHECK( !(u < w) );
105 }
106
107
108 BOOST_AUTO_TEST_CASE( IteratorTest ) {
109 // check iterator interface
110 std::vector<int> v;
111 v.push_back( 3 );
112 v.push_back( 2 );
113 v.push_back( 2 );
114 v.push_back( 1 );
115 v.push_back( 3 );
116 SmallSet<int> x( v.begin(), v.end(), v.size() );
117
118 BOOST_CHECK( x.begin() != x.end() );
119 BOOST_CHECK( x.rbegin() != x.rend() );
120
121 BOOST_CHECK_EQUAL( x.front(), 1 );
122 BOOST_CHECK_EQUAL( x.back(), 3 );
123
124 SmallSet<int>::const_iterator j = x.begin();
125 SmallSet<int>::iterator k = x.begin();
126 for( size_t i = 1; i < 4; i++, j++, k++ ) {
127 BOOST_CHECK_EQUAL( i, *j );
128 BOOST_CHECK_EQUAL( i, *k );
129 }
130 BOOST_CHECK( j == x.end() );
131 BOOST_CHECK( k == x.end() );
132
133 SmallSet<int>::const_reverse_iterator rj = x.rbegin();
134 SmallSet<int>::reverse_iterator rk = x.rbegin();
135 for( size_t i = 3; i > 0; i--, rj++, rk++ ) {
136 BOOST_CHECK_EQUAL( i, *rj );
137 BOOST_CHECK_EQUAL( i, *rk );
138 }
139
140 BOOST_CHECK( rj == static_cast<SmallSet<int>::const_reverse_iterator>(x.rend()) );
141 BOOST_CHECK( rk == x.rend() );
142 }
143
144
145 BOOST_AUTO_TEST_CASE( QueriesTest ) {
146 // check queries
147 SmallSet<int> x( 2, 1 );
148 SmallSet<int> y( 2, 3 );
149 SmallSet<int> z( 4, 3 );
150
151 BOOST_CHECK( x.intersects( y ) );
152 BOOST_CHECK( !x.intersects( z ) );
153 BOOST_CHECK( y.intersects( x ) );
154 BOOST_CHECK( y.intersects( z ) );
155 BOOST_CHECK( !z.intersects( x ) );
156 BOOST_CHECK( z.intersects( y ) );
157
158 BOOST_CHECK( x.contains( 1 ) );
159 BOOST_CHECK( x.contains( 2 ) );
160 BOOST_CHECK( !x.contains( 3 ) );
161 BOOST_CHECK( !x.contains( 4 ) );
162 BOOST_CHECK( !y.contains( 1 ) );
163 BOOST_CHECK( y.contains( 2 ) );
164 BOOST_CHECK( y.contains( 3 ) );
165 BOOST_CHECK( !y.contains( 4 ) );
166 BOOST_CHECK( !z.contains( 1 ) );
167 BOOST_CHECK( !z.contains( 2 ) );
168 BOOST_CHECK( z.contains( 3 ) );
169 BOOST_CHECK( z.contains( 4 ) );
170
171 BOOST_CHECK_EQUAL( x.size(), 2 );
172
173 BOOST_CHECK( !x.empty() );
174
175 x.elements()[0] = 3;
176 x.elements()[1] = 4;
177 std::vector<int> v;
178 v.push_back( 3 );
179 v.push_back( 4 );
180 BOOST_CHECK( x.elements() == v );
181 }
182
183
184 BOOST_AUTO_TEST_CASE( OperatorTest ) {
185 // check operators
186 SmallSet<int> x;
187 SmallSet<int> x1( 1 );
188 SmallSet<int> x2( 2 );
189 SmallSet<int> x3( 3 );
190 SmallSet<int> x12( 2, 1 );
191 SmallSet<int> x23( 2, 3 );
192 SmallSet<int> x13( 1, 3 );
193 SmallSet<int> x123 = x12 | 3;
194 SmallSet<int> y;
195
196 // check operator/
197 BOOST_CHECK_EQUAL( x / x, x );
198 BOOST_CHECK_EQUAL( x / x1, x );
199 BOOST_CHECK_EQUAL( x / x2, x );
200 BOOST_CHECK_EQUAL( x / x3, x );
201 BOOST_CHECK_EQUAL( x / x12, x );
202 BOOST_CHECK_EQUAL( x / x23, x );
203 BOOST_CHECK_EQUAL( x / x13, x );
204 BOOST_CHECK_EQUAL( x / x123, x );
205 BOOST_CHECK_EQUAL( x1 / x, x1 );
206 BOOST_CHECK_EQUAL( x1 / x1, x );
207 BOOST_CHECK_EQUAL( x1 / x2, x1 );
208 BOOST_CHECK_EQUAL( x1 / x3, x1 );
209 BOOST_CHECK_EQUAL( x1 / x12, x );
210 BOOST_CHECK_EQUAL( x1 / x23, x1 );
211 BOOST_CHECK_EQUAL( x1 / x13, x );
212 BOOST_CHECK_EQUAL( x1 / x123, x );
213 BOOST_CHECK_EQUAL( x2 / x, x2 );
214 BOOST_CHECK_EQUAL( x2 / x1, x2 );
215 BOOST_CHECK_EQUAL( x2 / x2, x );
216 BOOST_CHECK_EQUAL( x2 / x3, x2 );
217 BOOST_CHECK_EQUAL( x2 / x12, x );
218 BOOST_CHECK_EQUAL( x2 / x23, x );
219 BOOST_CHECK_EQUAL( x2 / x13, x2 );
220 BOOST_CHECK_EQUAL( x2 / x123, x );
221 BOOST_CHECK_EQUAL( x3 / x, x3 );
222 BOOST_CHECK_EQUAL( x3 / x1, x3 );
223 BOOST_CHECK_EQUAL( x3 / x2, x3 );
224 BOOST_CHECK_EQUAL( x3 / x3, x );
225 BOOST_CHECK_EQUAL( x3 / x12, x3 );
226 BOOST_CHECK_EQUAL( x3 / x23, x );
227 BOOST_CHECK_EQUAL( x3 / x13, x );
228 BOOST_CHECK_EQUAL( x3 / x123, x );
229 BOOST_CHECK_EQUAL( x12 / x, x12 );
230 BOOST_CHECK_EQUAL( x12 / x1, x2 );
231 BOOST_CHECK_EQUAL( x12 / x2, x1 );
232 BOOST_CHECK_EQUAL( x12 / x3, x12 );
233 BOOST_CHECK_EQUAL( x12 / x12, x );
234 BOOST_CHECK_EQUAL( x12 / x23, x1 );
235 BOOST_CHECK_EQUAL( x12 / x13, x2 );
236 BOOST_CHECK_EQUAL( x12 / x123, x );
237 BOOST_CHECK_EQUAL( x23 / x, x23 );
238 BOOST_CHECK_EQUAL( x23 / x1, x23 );
239 BOOST_CHECK_EQUAL( x23 / x2, x3 );
240 BOOST_CHECK_EQUAL( x23 / x3, x2 );
241 BOOST_CHECK_EQUAL( x23 / x12, x3 );
242 BOOST_CHECK_EQUAL( x23 / x23, x );
243 BOOST_CHECK_EQUAL( x23 / x13, x2 );
244 BOOST_CHECK_EQUAL( x23 / x123, x );
245 BOOST_CHECK_EQUAL( x13 / x, x13 );
246 BOOST_CHECK_EQUAL( x13 / x1, x3 );
247 BOOST_CHECK_EQUAL( x13 / x2, x13 );
248 BOOST_CHECK_EQUAL( x13 / x3, x1 );
249 BOOST_CHECK_EQUAL( x13 / x12, x3 );
250 BOOST_CHECK_EQUAL( x13 / x23, x1 );
251 BOOST_CHECK_EQUAL( x13 / x13, x );
252 BOOST_CHECK_EQUAL( x13 / x123, x );
253 BOOST_CHECK_EQUAL( x123 / x, x123 );
254 BOOST_CHECK_EQUAL( x123 / x1, x23 );
255 BOOST_CHECK_EQUAL( x123 / x2, x13 );
256 BOOST_CHECK_EQUAL( x123 / x3, x12 );
257 BOOST_CHECK_EQUAL( x123 / x12, x3 );
258 BOOST_CHECK_EQUAL( x123 / x23, x1 );
259 BOOST_CHECK_EQUAL( x123 / x13, x2 );
260 BOOST_CHECK_EQUAL( x123 / x123, x );
261
262 // check operator|
263 BOOST_CHECK_EQUAL( x | x, x );
264 BOOST_CHECK_EQUAL( x | x1, x1 );
265 BOOST_CHECK_EQUAL( x | x2, x2 );
266 BOOST_CHECK_EQUAL( x | x3, x3 );
267 BOOST_CHECK_EQUAL( x | x12, x12 );
268 BOOST_CHECK_EQUAL( x | x23, x23 );
269 BOOST_CHECK_EQUAL( x | x13, x13 );
270 BOOST_CHECK_EQUAL( x | x123, x123 );
271 BOOST_CHECK_EQUAL( x1 | x, x1 );
272 BOOST_CHECK_EQUAL( x1 | x1, x1 );
273 BOOST_CHECK_EQUAL( x1 | x2, x12 );
274 BOOST_CHECK_EQUAL( x1 | x3, x13 );
275 BOOST_CHECK_EQUAL( x1 | x12, x12 );
276 BOOST_CHECK_EQUAL( x1 | x23, x123 );
277 BOOST_CHECK_EQUAL( x1 | x13, x13 );
278 BOOST_CHECK_EQUAL( x1 | x123, x123 );
279 BOOST_CHECK_EQUAL( x2 | x, x2 );
280 BOOST_CHECK_EQUAL( x2 | x1, x12 );
281 BOOST_CHECK_EQUAL( x2 | x2, x2 );
282 BOOST_CHECK_EQUAL( x2 | x3, x23 );
283 BOOST_CHECK_EQUAL( x2 | x12, x12 );
284 BOOST_CHECK_EQUAL( x2 | x23, x23 );
285 BOOST_CHECK_EQUAL( x2 | x13, x123 );
286 BOOST_CHECK_EQUAL( x2 | x123, x123 );
287 BOOST_CHECK_EQUAL( x3 | x, x3 );
288 BOOST_CHECK_EQUAL( x3 | x1, x13 );
289 BOOST_CHECK_EQUAL( x3 | x2, x23 );
290 BOOST_CHECK_EQUAL( x3 | x3, x3 );
291 BOOST_CHECK_EQUAL( x3 | x12, x123 );
292 BOOST_CHECK_EQUAL( x3 | x23, x23 );
293 BOOST_CHECK_EQUAL( x3 | x13, x13 );
294 BOOST_CHECK_EQUAL( x3 | x123, x123 );
295 BOOST_CHECK_EQUAL( x12 | x, x12 );
296 BOOST_CHECK_EQUAL( x12 | x1, x12 );
297 BOOST_CHECK_EQUAL( x12 | x2, x12 );
298 BOOST_CHECK_EQUAL( x12 | x3, x123 );
299 BOOST_CHECK_EQUAL( x12 | x12, x12 );
300 BOOST_CHECK_EQUAL( x12 | x23, x123 );
301 BOOST_CHECK_EQUAL( x12 | x13, x123 );
302 BOOST_CHECK_EQUAL( x12 | x123, x123 );
303 BOOST_CHECK_EQUAL( x23 | x, x23 );
304 BOOST_CHECK_EQUAL( x23 | x1, x123 );
305 BOOST_CHECK_EQUAL( x23 | x2, x23 );
306 BOOST_CHECK_EQUAL( x23 | x3, x23 );
307 BOOST_CHECK_EQUAL( x23 | x12, x123 );
308 BOOST_CHECK_EQUAL( x23 | x23, x23 );
309 BOOST_CHECK_EQUAL( x23 | x13, x123 );
310 BOOST_CHECK_EQUAL( x23 | x123, x123 );
311 BOOST_CHECK_EQUAL( x13 | x, x13 );
312 BOOST_CHECK_EQUAL( x13 | x1, x13 );
313 BOOST_CHECK_EQUAL( x13 | x2, x123 );
314 BOOST_CHECK_EQUAL( x13 | x3, x13 );
315 BOOST_CHECK_EQUAL( x13 | x12, x123 );
316 BOOST_CHECK_EQUAL( x13 | x23, x123 );
317 BOOST_CHECK_EQUAL( x13 | x13, x13 );
318 BOOST_CHECK_EQUAL( x13 | x123, x123 );
319 BOOST_CHECK_EQUAL( x123 | x, x123 );
320 BOOST_CHECK_EQUAL( x123 | x1, x123 );
321 BOOST_CHECK_EQUAL( x123 | x2, x123 );
322 BOOST_CHECK_EQUAL( x123 | x3, x123 );
323 BOOST_CHECK_EQUAL( x123 | x12, x123 );
324 BOOST_CHECK_EQUAL( x123 | x23, x123 );
325 BOOST_CHECK_EQUAL( x123 | x13, x123 );
326 BOOST_CHECK_EQUAL( x123 | x123, x123 );
327
328 // check operator&
329 BOOST_CHECK_EQUAL( x & x, x );
330 BOOST_CHECK_EQUAL( x & x1, x );
331 BOOST_CHECK_EQUAL( x & x2, x );
332 BOOST_CHECK_EQUAL( x & x3, x );
333 BOOST_CHECK_EQUAL( x & x12, x );
334 BOOST_CHECK_EQUAL( x & x23, x );
335 BOOST_CHECK_EQUAL( x & x13, x );
336 BOOST_CHECK_EQUAL( x & x123, x );
337 BOOST_CHECK_EQUAL( x1 & x, x );
338 BOOST_CHECK_EQUAL( x1 & x1, x1 );
339 BOOST_CHECK_EQUAL( x1 & x2, x );
340 BOOST_CHECK_EQUAL( x1 & x3, x );
341 BOOST_CHECK_EQUAL( x1 & x12, x1 );
342 BOOST_CHECK_EQUAL( x1 & x23, x );
343 BOOST_CHECK_EQUAL( x1 & x13, x1 );
344 BOOST_CHECK_EQUAL( x1 & x123, x1 );
345 BOOST_CHECK_EQUAL( x2 & x, x );
346 BOOST_CHECK_EQUAL( x2 & x1, x );
347 BOOST_CHECK_EQUAL( x2 & x2, x2 );
348 BOOST_CHECK_EQUAL( x2 & x3, x );
349 BOOST_CHECK_EQUAL( x2 & x12, x2 );
350 BOOST_CHECK_EQUAL( x2 & x23, x2 );
351 BOOST_CHECK_EQUAL( x2 & x13, x );
352 BOOST_CHECK_EQUAL( x2 & x123, x2 );
353 BOOST_CHECK_EQUAL( x3 & x, x );
354 BOOST_CHECK_EQUAL( x3 & x1, x );
355 BOOST_CHECK_EQUAL( x3 & x2, x );
356 BOOST_CHECK_EQUAL( x3 & x3, x3 );
357 BOOST_CHECK_EQUAL( x3 & x12, x );
358 BOOST_CHECK_EQUAL( x3 & x23, x3 );
359 BOOST_CHECK_EQUAL( x3 & x13, x3 );
360 BOOST_CHECK_EQUAL( x3 & x123, x3 );
361 BOOST_CHECK_EQUAL( x12 & x, x );
362 BOOST_CHECK_EQUAL( x12 & x1, x1 );
363 BOOST_CHECK_EQUAL( x12 & x2, x2 );
364 BOOST_CHECK_EQUAL( x12 & x3, x );
365 BOOST_CHECK_EQUAL( x12 & x12, x12 );
366 BOOST_CHECK_EQUAL( x12 & x23, x2 );
367 BOOST_CHECK_EQUAL( x12 & x13, x1 );
368 BOOST_CHECK_EQUAL( x12 & x123, x12 );
369 BOOST_CHECK_EQUAL( x23 & x, x );
370 BOOST_CHECK_EQUAL( x23 & x1, x );
371 BOOST_CHECK_EQUAL( x23 & x2, x2 );
372 BOOST_CHECK_EQUAL( x23 & x3, x3 );
373 BOOST_CHECK_EQUAL( x23 & x12, x2 );
374 BOOST_CHECK_EQUAL( x23 & x23, x23 );
375 BOOST_CHECK_EQUAL( x23 & x13, x3 );
376 BOOST_CHECK_EQUAL( x23 & x123, x23 );
377 BOOST_CHECK_EQUAL( x13 & x, x );
378 BOOST_CHECK_EQUAL( x13 & x1, x1 );
379 BOOST_CHECK_EQUAL( x13 & x2, x );
380 BOOST_CHECK_EQUAL( x13 & x3, x3 );
381 BOOST_CHECK_EQUAL( x13 & x12, x1 );
382 BOOST_CHECK_EQUAL( x13 & x23, x3 );
383 BOOST_CHECK_EQUAL( x13 & x13, x13 );
384 BOOST_CHECK_EQUAL( x13 & x123, x13 );
385 BOOST_CHECK_EQUAL( x123 & x, x );
386 BOOST_CHECK_EQUAL( x123 & x1, x1 );
387 BOOST_CHECK_EQUAL( x123 & x2, x2 );
388 BOOST_CHECK_EQUAL( x123 & x3, x3 );
389 BOOST_CHECK_EQUAL( x123 & x12, x12 );
390 BOOST_CHECK_EQUAL( x123 & x23, x23 );
391 BOOST_CHECK_EQUAL( x123 & x13, x13 );
392 BOOST_CHECK_EQUAL( x123 & x123, x123 );
393
394 // check operator/=
395 y = x ; y /= x; BOOST_CHECK_EQUAL( y, x );
396 y = x ; y /= x1; BOOST_CHECK_EQUAL( y, x );
397 y = x ; y /= x2; BOOST_CHECK_EQUAL( y, x );
398 y = x ; y /= x3; BOOST_CHECK_EQUAL( y, x );
399 y = x ; y /= x12; BOOST_CHECK_EQUAL( y, x );
400 y = x ; y /= x23; BOOST_CHECK_EQUAL( y, x );
401 y = x ; y /= x13; BOOST_CHECK_EQUAL( y, x );
402 y = x ; y /= x123; BOOST_CHECK_EQUAL( y, x );
403 y = x1 ; y /= x; BOOST_CHECK_EQUAL( y, x1 );
404 y = x1 ; y /= x1; BOOST_CHECK_EQUAL( y, x );
405 y = x1 ; y /= x2; BOOST_CHECK_EQUAL( y, x1 );
406 y = x1 ; y /= x3; BOOST_CHECK_EQUAL( y, x1 );
407 y = x1 ; y /= x12; BOOST_CHECK_EQUAL( y, x );
408 y = x1 ; y /= x23; BOOST_CHECK_EQUAL( y, x1 );
409 y = x1 ; y /= x13; BOOST_CHECK_EQUAL( y, x );
410 y = x1 ; y /= x123; BOOST_CHECK_EQUAL( y, x );
411 y = x2 ; y /= x; BOOST_CHECK_EQUAL( y, x2 );
412 y = x2 ; y /= x1; BOOST_CHECK_EQUAL( y, x2 );
413 y = x2 ; y /= x2; BOOST_CHECK_EQUAL( y, x );
414 y = x2 ; y /= x3; BOOST_CHECK_EQUAL( y, x2 );
415 y = x2 ; y /= x12; BOOST_CHECK_EQUAL( y, x );
416 y = x2 ; y /= x23; BOOST_CHECK_EQUAL( y, x );
417 y = x2 ; y /= x13; BOOST_CHECK_EQUAL( y, x2 );
418 y = x2 ; y /= x123; BOOST_CHECK_EQUAL( y, x );
419 y = x3 ; y /= x; BOOST_CHECK_EQUAL( y, x3 );
420 y = x3 ; y /= x1; BOOST_CHECK_EQUAL( y, x3 );
421 y = x3 ; y /= x2; BOOST_CHECK_EQUAL( y, x3 );
422 y = x3 ; y /= x3; BOOST_CHECK_EQUAL( y, x );
423 y = x3 ; y /= x12; BOOST_CHECK_EQUAL( y, x3 );
424 y = x3 ; y /= x23; BOOST_CHECK_EQUAL( y, x );
425 y = x3 ; y /= x13; BOOST_CHECK_EQUAL( y, x );
426 y = x3 ; y /= x123; BOOST_CHECK_EQUAL( y, x );
427 y = x12 ; y /= x; BOOST_CHECK_EQUAL( y, x12 );
428 y = x12 ; y /= x1; BOOST_CHECK_EQUAL( y, x2 );
429 y = x12 ; y /= x2; BOOST_CHECK_EQUAL( y, x1 );
430 y = x12 ; y /= x3; BOOST_CHECK_EQUAL( y, x12 );
431 y = x12 ; y /= x12; BOOST_CHECK_EQUAL( y, x );
432 y = x12 ; y /= x23; BOOST_CHECK_EQUAL( y, x1 );
433 y = x12 ; y /= x13; BOOST_CHECK_EQUAL( y, x2 );
434 y = x12 ; y /= x123; BOOST_CHECK_EQUAL( y, x );
435 y = x23 ; y /= x; BOOST_CHECK_EQUAL( y, x23 );
436 y = x23 ; y /= x1; BOOST_CHECK_EQUAL( y, x23 );
437 y = x23 ; y /= x2; BOOST_CHECK_EQUAL( y, x3 );
438 y = x23 ; y /= x3; BOOST_CHECK_EQUAL( y, x2 );
439 y = x23 ; y /= x12; BOOST_CHECK_EQUAL( y, x3 );
440 y = x23 ; y /= x23; BOOST_CHECK_EQUAL( y, x );
441 y = x23 ; y /= x13; BOOST_CHECK_EQUAL( y, x2 );
442 y = x23 ; y /= x123; BOOST_CHECK_EQUAL( y, x );
443 y = x13 ; y /= x; BOOST_CHECK_EQUAL( y, x13 );
444 y = x13 ; y /= x1; BOOST_CHECK_EQUAL( y, x3 );
445 y = x13 ; y /= x2; BOOST_CHECK_EQUAL( y, x13 );
446 y = x13 ; y /= x3; BOOST_CHECK_EQUAL( y, x1 );
447 y = x13 ; y /= x12; BOOST_CHECK_EQUAL( y, x3 );
448 y = x13 ; y /= x23; BOOST_CHECK_EQUAL( y, x1 );
449 y = x13 ; y /= x13; BOOST_CHECK_EQUAL( y, x );
450 y = x13 ; y /= x123; BOOST_CHECK_EQUAL( y, x );
451 y = x123; y /= x; BOOST_CHECK_EQUAL( y, x123 );
452 y = x123; y /= x1; BOOST_CHECK_EQUAL( y, x23 );
453 y = x123; y /= x2; BOOST_CHECK_EQUAL( y, x13 );
454 y = x123; y /= x3; BOOST_CHECK_EQUAL( y, x12 );
455 y = x123; y /= x12; BOOST_CHECK_EQUAL( y, x3 );
456 y = x123; y /= x23; BOOST_CHECK_EQUAL( y, x1 );
457 y = x123; y /= x13; BOOST_CHECK_EQUAL( y, x2 );
458 y = x123; y /= x123; BOOST_CHECK_EQUAL( y, x );
459
460 // check insert
461 y = x ; y.insert( 1 ); BOOST_CHECK_EQUAL( y, x1 );
462 y = x ; y.insert( 2 ); BOOST_CHECK_EQUAL( y, x2 );
463 y = x ; y.insert( 3 ); BOOST_CHECK_EQUAL( y, x3 );
464 y = x1 ; y.insert( 1 ); BOOST_CHECK_EQUAL( y, x1 );
465 y = x1 ; y.insert( 2 ); BOOST_CHECK_EQUAL( y, x12 );
466 y = x1 ; y.insert( 3 ); BOOST_CHECK_EQUAL( y, x13 );
467 y = x2 ; y.insert( 1 ); BOOST_CHECK_EQUAL( y, x12 );
468 y = x2 ; y.insert( 2 ); BOOST_CHECK_EQUAL( y, x2 );
469 y = x2 ; y.insert( 3 ); BOOST_CHECK_EQUAL( y, x23 );
470 y = x3 ; y.insert( 1 ); BOOST_CHECK_EQUAL( y, x13 );
471 y = x3 ; y.insert( 2 ); BOOST_CHECK_EQUAL( y, x23 );
472 y = x3 ; y.insert( 3 ); BOOST_CHECK_EQUAL( y, x3 );
473 y = x12 ; y.insert( 1 ); BOOST_CHECK_EQUAL( y, x12 );
474 y = x12 ; y.insert( 2 ); BOOST_CHECK_EQUAL( y, x12 );
475 y = x12 ; y.insert( 3 ); BOOST_CHECK_EQUAL( y, x123 );
476 y = x23 ; y.insert( 1 ); BOOST_CHECK_EQUAL( y, x123 );
477 y = x23 ; y.insert( 2 ); BOOST_CHECK_EQUAL( y, x23 );
478 y = x23 ; y.insert( 3 ); BOOST_CHECK_EQUAL( y, x23 );
479 y = x13 ; y.insert( 1 ); BOOST_CHECK_EQUAL( y, x13 );
480 y = x13 ; y.insert( 2 ); BOOST_CHECK_EQUAL( y, x123 );
481 y = x13 ; y.insert( 3 ); BOOST_CHECK_EQUAL( y, x13 );
482 y = x123; y.insert( 1 ); BOOST_CHECK_EQUAL( y, x123 );
483 y = x123; y.insert( 2 ); BOOST_CHECK_EQUAL( y, x123 );
484 y = x123; y.insert( 3 ); BOOST_CHECK_EQUAL( y, x123 );
485
486 // check erase
487 y = x ; y.erase( 1 ); BOOST_CHECK_EQUAL( y, x );
488 y = x ; y.erase( 2 ); BOOST_CHECK_EQUAL( y, x );
489 y = x ; y.erase( 3 ); BOOST_CHECK_EQUAL( y, x );
490 y = x1 ; y.erase( 1 ); BOOST_CHECK_EQUAL( y, x );
491 y = x1 ; y.erase( 2 ); BOOST_CHECK_EQUAL( y, x1 );
492 y = x1 ; y.erase( 3 ); BOOST_CHECK_EQUAL( y, x1 );
493 y = x2 ; y.erase( 1 ); BOOST_CHECK_EQUAL( y, x2 );
494 y = x2 ; y.erase( 2 ); BOOST_CHECK_EQUAL( y, x );
495 y = x2 ; y.erase( 3 ); BOOST_CHECK_EQUAL( y, x2 );
496 y = x3 ; y.erase( 1 ); BOOST_CHECK_EQUAL( y, x3 );
497 y = x3 ; y.erase( 2 ); BOOST_CHECK_EQUAL( y, x3 );
498 y = x3 ; y.erase( 3 ); BOOST_CHECK_EQUAL( y, x );
499 y = x12 ; y.erase( 1 ); BOOST_CHECK_EQUAL( y, x2 );
500 y = x12 ; y.erase( 2 ); BOOST_CHECK_EQUAL( y, x1 );
501 y = x12 ; y.erase( 3 ); BOOST_CHECK_EQUAL( y, x12 );
502 y = x13 ; y.erase( 1 ); BOOST_CHECK_EQUAL( y, x3 );
503 y = x13 ; y.erase( 2 ); BOOST_CHECK_EQUAL( y, x13 );
504 y = x13 ; y.erase( 3 ); BOOST_CHECK_EQUAL( y, x1 );
505 y = x23 ; y.erase( 1 ); BOOST_CHECK_EQUAL( y, x23 );
506 y = x23 ; y.erase( 2 ); BOOST_CHECK_EQUAL( y, x3 );
507 y = x23 ; y.erase( 3 ); BOOST_CHECK_EQUAL( y, x2 );
508 y = x123; y.erase( 1 ); BOOST_CHECK_EQUAL( y, x23 );
509 y = x123; y.erase( 2 ); BOOST_CHECK_EQUAL( y, x13 );
510 y = x123; y.erase( 3 ); BOOST_CHECK_EQUAL( y, x12 );
511
512 // check operator|=
513 y = x ; y |= x; BOOST_CHECK_EQUAL( y, x );
514 y = x ; y |= x1; BOOST_CHECK_EQUAL( y, x1 );
515 y = x ; y |= x2; BOOST_CHECK_EQUAL( y, x2 );
516 y = x ; y |= x3; BOOST_CHECK_EQUAL( y, x3 );
517 y = x ; y |= x12; BOOST_CHECK_EQUAL( y, x12 );
518 y = x ; y |= x23; BOOST_CHECK_EQUAL( y, x23 );
519 y = x ; y |= x13; BOOST_CHECK_EQUAL( y, x13 );
520 y = x ; y |= x123; BOOST_CHECK_EQUAL( y, x123 );
521 y = x1 ; y |= x; BOOST_CHECK_EQUAL( y, x1 );
522 y = x1 ; y |= x1; BOOST_CHECK_EQUAL( y, x1 );
523 y = x1 ; y |= x2; BOOST_CHECK_EQUAL( y, x12 );
524 y = x1 ; y |= x3; BOOST_CHECK_EQUAL( y, x13 );
525 y = x1 ; y |= x12; BOOST_CHECK_EQUAL( y, x12 );
526 y = x1 ; y |= x23; BOOST_CHECK_EQUAL( y, x123 );
527 y = x1 ; y |= x13; BOOST_CHECK_EQUAL( y, x13 );
528 y = x1 ; y |= x123; BOOST_CHECK_EQUAL( y, x123 );
529 y = x2 ; y |= x; BOOST_CHECK_EQUAL( y, x2 );
530 y = x2 ; y |= x1; BOOST_CHECK_EQUAL( y, x12 );
531 y = x2 ; y |= x2; BOOST_CHECK_EQUAL( y, x2 );
532 y = x2 ; y |= x3; BOOST_CHECK_EQUAL( y, x23 );
533 y = x2 ; y |= x12; BOOST_CHECK_EQUAL( y, x12 );
534 y = x2 ; y |= x23; BOOST_CHECK_EQUAL( y, x23 );
535 y = x2 ; y |= x13; BOOST_CHECK_EQUAL( y, x123 );
536 y = x2 ; y |= x123; BOOST_CHECK_EQUAL( y, x123 );
537 y = x3 ; y |= x; BOOST_CHECK_EQUAL( y, x3 );
538 y = x3 ; y |= x1; BOOST_CHECK_EQUAL( y, x13 );
539 y = x3 ; y |= x2; BOOST_CHECK_EQUAL( y, x23 );
540 y = x3 ; y |= x3; BOOST_CHECK_EQUAL( y, x3 );
541 y = x3 ; y |= x12; BOOST_CHECK_EQUAL( y, x123 );
542 y = x3 ; y |= x23; BOOST_CHECK_EQUAL( y, x23 );
543 y = x3 ; y |= x13; BOOST_CHECK_EQUAL( y, x13 );
544 y = x3 ; y |= x123; BOOST_CHECK_EQUAL( y, x123 );
545 y = x12 ; y |= x; BOOST_CHECK_EQUAL( y, x12 );
546 y = x12 ; y |= x1; BOOST_CHECK_EQUAL( y, x12 );
547 y = x12 ; y |= x2; BOOST_CHECK_EQUAL( y, x12 );
548 y = x12 ; y |= x3; BOOST_CHECK_EQUAL( y, x123 );
549 y = x12 ; y |= x12; BOOST_CHECK_EQUAL( y, x12 );
550 y = x12 ; y |= x23; BOOST_CHECK_EQUAL( y, x123 );
551 y = x12 ; y |= x13; BOOST_CHECK_EQUAL( y, x123 );
552 y = x12 ; y |= x123; BOOST_CHECK_EQUAL( y, x123 );
553 y = x23 ; y |= x; BOOST_CHECK_EQUAL( y, x23 );
554 y = x23 ; y |= x1; BOOST_CHECK_EQUAL( y, x123 );
555 y = x23 ; y |= x2; BOOST_CHECK_EQUAL( y, x23 );
556 y = x23 ; y |= x3; BOOST_CHECK_EQUAL( y, x23 );
557 y = x23 ; y |= x12; BOOST_CHECK_EQUAL( y, x123 );
558 y = x23 ; y |= x23; BOOST_CHECK_EQUAL( y, x23 );
559 y = x23 ; y |= x13; BOOST_CHECK_EQUAL( y, x123 );
560 y = x23 ; y |= x123; BOOST_CHECK_EQUAL( y, x123 );
561 y = x13 ; y |= x; BOOST_CHECK_EQUAL( y, x13 );
562 y = x13 ; y |= x1; BOOST_CHECK_EQUAL( y, x13 );
563 y = x13 ; y |= x2; BOOST_CHECK_EQUAL( y, x123 );
564 y = x13 ; y |= x3; BOOST_CHECK_EQUAL( y, x13 );
565 y = x13 ; y |= x12; BOOST_CHECK_EQUAL( y, x123 );
566 y = x13 ; y |= x23; BOOST_CHECK_EQUAL( y, x123 );
567 y = x13 ; y |= x13; BOOST_CHECK_EQUAL( y, x13 );
568 y = x13 ; y |= x123; BOOST_CHECK_EQUAL( y, x123 );
569 y = x123; y |= x; BOOST_CHECK_EQUAL( y, x123 );
570 y = x123; y |= x1; BOOST_CHECK_EQUAL( y, x123 );
571 y = x123; y |= x2; BOOST_CHECK_EQUAL( y, x123 );
572 y = x123; y |= x3; BOOST_CHECK_EQUAL( y, x123 );
573 y = x123; y |= x12; BOOST_CHECK_EQUAL( y, x123 );
574 y = x123; y |= x23; BOOST_CHECK_EQUAL( y, x123 );
575 y = x123; y |= x13; BOOST_CHECK_EQUAL( y, x123 );
576 y = x123; y |= x123; BOOST_CHECK_EQUAL( y, x123 );
577
578 // check operator&=
579 y = x ; y &= x; BOOST_CHECK_EQUAL( y, x );
580 y = x ; y &= x1; BOOST_CHECK_EQUAL( y, x );
581 y = x ; y &= x2; BOOST_CHECK_EQUAL( y, x );
582 y = x ; y &= x3; BOOST_CHECK_EQUAL( y, x );
583 y = x ; y &= x12; BOOST_CHECK_EQUAL( y, x );
584 y = x ; y &= x23; BOOST_CHECK_EQUAL( y, x );
585 y = x ; y &= x13; BOOST_CHECK_EQUAL( y, x );
586 y = x ; y &= x123; BOOST_CHECK_EQUAL( y, x );
587 y = x1 ; y &= x; BOOST_CHECK_EQUAL( y, x );
588 y = x1 ; y &= x1; BOOST_CHECK_EQUAL( y, x1 );
589 y = x1 ; y &= x2; BOOST_CHECK_EQUAL( y, x );
590 y = x1 ; y &= x3; BOOST_CHECK_EQUAL( y, x );
591 y = x1 ; y &= x12; BOOST_CHECK_EQUAL( y, x1 );
592 y = x1 ; y &= x23; BOOST_CHECK_EQUAL( y, x );
593 y = x1 ; y &= x13; BOOST_CHECK_EQUAL( y, x1 );
594 y = x1 ; y &= x123; BOOST_CHECK_EQUAL( y, x1 );
595 y = x2 ; y &= x; BOOST_CHECK_EQUAL( y, x );
596 y = x2 ; y &= x1; BOOST_CHECK_EQUAL( y, x );
597 y = x2 ; y &= x2; BOOST_CHECK_EQUAL( y, x2 );
598 y = x2 ; y &= x3; BOOST_CHECK_EQUAL( y, x );
599 y = x2 ; y &= x12; BOOST_CHECK_EQUAL( y, x2 );
600 y = x2 ; y &= x23; BOOST_CHECK_EQUAL( y, x2 );
601 y = x2 ; y &= x13; BOOST_CHECK_EQUAL( y, x );
602 y = x2 ; y &= x123; BOOST_CHECK_EQUAL( y, x2 );
603 y = x3 ; y &= x; BOOST_CHECK_EQUAL( y, x );
604 y = x3 ; y &= x1; BOOST_CHECK_EQUAL( y, x );
605 y = x3 ; y &= x2; BOOST_CHECK_EQUAL( y, x );
606 y = x3 ; y &= x3; BOOST_CHECK_EQUAL( y, x3 );
607 y = x3 ; y &= x12; BOOST_CHECK_EQUAL( y, x );
608 y = x3 ; y &= x23; BOOST_CHECK_EQUAL( y, x3 );
609 y = x3 ; y &= x13; BOOST_CHECK_EQUAL( y, x3 );
610 y = x3 ; y &= x123; BOOST_CHECK_EQUAL( y, x3 );
611 y = x12 ; y &= x; BOOST_CHECK_EQUAL( y, x );
612 y = x12 ; y &= x1; BOOST_CHECK_EQUAL( y, x1 );
613 y = x12 ; y &= x2; BOOST_CHECK_EQUAL( y, x2 );
614 y = x12 ; y &= x3; BOOST_CHECK_EQUAL( y, x );
615 y = x12 ; y &= x12; BOOST_CHECK_EQUAL( y, x12 );
616 y = x12 ; y &= x23; BOOST_CHECK_EQUAL( y, x2 );
617 y = x12 ; y &= x13; BOOST_CHECK_EQUAL( y, x1 );
618 y = x12 ; y &= x123; BOOST_CHECK_EQUAL( y, x12 );
619 y = x23 ; y &= x; BOOST_CHECK_EQUAL( y, x );
620 y = x23 ; y &= x1; BOOST_CHECK_EQUAL( y, x );
621 y = x23 ; y &= x2; BOOST_CHECK_EQUAL( y, x2 );
622 y = x23 ; y &= x3; BOOST_CHECK_EQUAL( y, x3 );
623 y = x23 ; y &= x12; BOOST_CHECK_EQUAL( y, x2 );
624 y = x23 ; y &= x23; BOOST_CHECK_EQUAL( y, x23 );
625 y = x23 ; y &= x13; BOOST_CHECK_EQUAL( y, x3 );
626 y = x23 ; y &= x123; BOOST_CHECK_EQUAL( y, x23 );
627 y = x13 ; y &= x; BOOST_CHECK_EQUAL( y, x );
628 y = x13 ; y &= x1; BOOST_CHECK_EQUAL( y, x1 );
629 y = x13 ; y &= x2; BOOST_CHECK_EQUAL( y, x );
630 y = x13 ; y &= x3; BOOST_CHECK_EQUAL( y, x3 );
631 y = x13 ; y &= x12; BOOST_CHECK_EQUAL( y, x1 );
632 y = x13 ; y &= x23; BOOST_CHECK_EQUAL( y, x3 );
633 y = x13 ; y &= x13; BOOST_CHECK_EQUAL( y, x13 );
634 y = x13 ; y &= x123; BOOST_CHECK_EQUAL( y, x13 );
635 y = x123; y &= x; BOOST_CHECK_EQUAL( y, x );
636 y = x123; y &= x1; BOOST_CHECK_EQUAL( y, x1 );
637 y = x123; y &= x2; BOOST_CHECK_EQUAL( y, x2 );
638 y = x123; y &= x3; BOOST_CHECK_EQUAL( y, x3 );
639 y = x123; y &= x12; BOOST_CHECK_EQUAL( y, x12 );
640 y = x123; y &= x23; BOOST_CHECK_EQUAL( y, x23 );
641 y = x123; y &= x13; BOOST_CHECK_EQUAL( y, x13 );
642 y = x123; y &= x123; BOOST_CHECK_EQUAL( y, x123 );
643
644 // check operator/=
645 y = x ; y /= 1; BOOST_CHECK_EQUAL( y, x );
646 y = x ; y /= 2; BOOST_CHECK_EQUAL( y, x );
647 y = x ; y /= 3; BOOST_CHECK_EQUAL( y, x );
648 y = x1 ; y /= 1; BOOST_CHECK_EQUAL( y, x );
649 y = x1 ; y /= 2; BOOST_CHECK_EQUAL( y, x1 );
650 y = x1 ; y /= 3; BOOST_CHECK_EQUAL( y, x1 );
651 y = x2 ; y /= 1; BOOST_CHECK_EQUAL( y, x2 );
652 y = x2 ; y /= 2; BOOST_CHECK_EQUAL( y, x );
653 y = x2 ; y /= 3; BOOST_CHECK_EQUAL( y, x2 );
654 y = x3 ; y /= 1; BOOST_CHECK_EQUAL( y, x3 );
655 y = x3 ; y /= 2; BOOST_CHECK_EQUAL( y, x3 );
656 y = x3 ; y /= 3; BOOST_CHECK_EQUAL( y, x );
657 y = x12 ; y /= 1; BOOST_CHECK_EQUAL( y, x2 );
658 y = x12 ; y /= 2; BOOST_CHECK_EQUAL( y, x1 );
659 y = x12 ; y /= 3; BOOST_CHECK_EQUAL( y, x12 );
660 y = x13 ; y /= 1; BOOST_CHECK_EQUAL( y, x3 );
661 y = x13 ; y /= 2; BOOST_CHECK_EQUAL( y, x13 );
662 y = x13 ; y /= 3; BOOST_CHECK_EQUAL( y, x1 );
663 y = x23 ; y /= 1; BOOST_CHECK_EQUAL( y, x23 );
664 y = x23 ; y /= 2; BOOST_CHECK_EQUAL( y, x3 );
665 y = x23 ; y /= 3; BOOST_CHECK_EQUAL( y, x2 );
666 y = x123; y /= 1; BOOST_CHECK_EQUAL( y, x23 );
667 y = x123; y /= 2; BOOST_CHECK_EQUAL( y, x13 );
668 y = x123; y /= 3; BOOST_CHECK_EQUAL( y, x12 );
669
670 // check operator|=
671 y = x ; y |= 1; BOOST_CHECK_EQUAL( y, x1 );
672 y = x ; y |= 2; BOOST_CHECK_EQUAL( y, x2 );
673 y = x ; y |= 3; BOOST_CHECK_EQUAL( y, x3 );
674 y = x1 ; y |= 1; BOOST_CHECK_EQUAL( y, x1 );
675 y = x1 ; y |= 2; BOOST_CHECK_EQUAL( y, x12 );
676 y = x1 ; y |= 3; BOOST_CHECK_EQUAL( y, x13 );
677 y = x2 ; y |= 1; BOOST_CHECK_EQUAL( y, x12 );
678 y = x2 ; y |= 2; BOOST_CHECK_EQUAL( y, x2 );
679 y = x2 ; y |= 3; BOOST_CHECK_EQUAL( y, x23 );
680 y = x3 ; y |= 1; BOOST_CHECK_EQUAL( y, x13 );
681 y = x3 ; y |= 2; BOOST_CHECK_EQUAL( y, x23 );
682 y = x3 ; y |= 3; BOOST_CHECK_EQUAL( y, x3 );
683 y = x12 ; y |= 1; BOOST_CHECK_EQUAL( y, x12 );
684 y = x12 ; y |= 2; BOOST_CHECK_EQUAL( y, x12 );
685 y = x12 ; y |= 3; BOOST_CHECK_EQUAL( y, x123 );
686 y = x13 ; y |= 1; BOOST_CHECK_EQUAL( y, x13 );
687 y = x13 ; y |= 2; BOOST_CHECK_EQUAL( y, x123 );
688 y = x13 ; y |= 3; BOOST_CHECK_EQUAL( y, x13 );
689 y = x23 ; y |= 1; BOOST_CHECK_EQUAL( y, x123 );
690 y = x23 ; y |= 2; BOOST_CHECK_EQUAL( y, x23 );
691 y = x23 ; y |= 3; BOOST_CHECK_EQUAL( y, x23 );
692 y = x123; y |= 1; BOOST_CHECK_EQUAL( y, x123 );
693 y = x123; y |= 2; BOOST_CHECK_EQUAL( y, x123 );
694 y = x123; y |= 3; BOOST_CHECK_EQUAL( y, x123 );
695
696 // check operator<<
697 BOOST_CHECK( (x << x ) );
698 BOOST_CHECK( (x << x1 ) );
699 BOOST_CHECK( (x << x2 ) );
700 BOOST_CHECK( (x << x3 ) );
701 BOOST_CHECK( (x << x12 ) );
702 BOOST_CHECK( (x << x13 ) );
703 BOOST_CHECK( (x << x23 ) );
704 BOOST_CHECK( (x << x123) );
705 BOOST_CHECK( !(x1 << x ) );
706 BOOST_CHECK( (x1 << x1 ) );
707 BOOST_CHECK( !(x1 << x2 ) );
708 BOOST_CHECK( !(x1 << x3 ) );
709 BOOST_CHECK( (x1 << x12 ) );
710 BOOST_CHECK( (x1 << x13 ) );
711 BOOST_CHECK( !(x1 << x23 ) );
712 BOOST_CHECK( (x1 << x123) );
713 BOOST_CHECK( !(x2 << x ) );
714 BOOST_CHECK( !(x2 << x1 ) );
715 BOOST_CHECK( (x2 << x2 ) );
716 BOOST_CHECK( !(x2 << x3 ) );
717 BOOST_CHECK( (x2 << x12 ) );
718 BOOST_CHECK( !(x2 << x13 ) );
719 BOOST_CHECK( (x2 << x23 ) );
720 BOOST_CHECK( (x2 << x123) );
721 BOOST_CHECK( !(x3 << x ) );
722 BOOST_CHECK( !(x3 << x1 ) );
723 BOOST_CHECK( !(x3 << x2 ) );
724 BOOST_CHECK( (x3 << x3 ) );
725 BOOST_CHECK( !(x3 << x12 ) );
726 BOOST_CHECK( (x3 << x13 ) );
727 BOOST_CHECK( (x3 << x23 ) );
728 BOOST_CHECK( (x3 << x123) );
729 BOOST_CHECK( !(x12 << x ) );
730 BOOST_CHECK( !(x12 << x1 ) );
731 BOOST_CHECK( !(x12 << x2 ) );
732 BOOST_CHECK( !(x12 << x3 ) );
733 BOOST_CHECK( (x12 << x12 ) );
734 BOOST_CHECK( !(x12 << x13 ) );
735 BOOST_CHECK( !(x12 << x23 ) );
736 BOOST_CHECK( (x12 << x123) );
737 BOOST_CHECK( !(x13 << x ) );
738 BOOST_CHECK( !(x13 << x1 ) );
739 BOOST_CHECK( !(x13 << x2 ) );
740 BOOST_CHECK( !(x13 << x3 ) );
741 BOOST_CHECK( !(x13 << x12 ) );
742 BOOST_CHECK( (x13 << x13 ) );
743 BOOST_CHECK( !(x13 << x23 ) );
744 BOOST_CHECK( (x13 << x123) );
745 BOOST_CHECK( !(x23 << x ) );
746 BOOST_CHECK( !(x23 << x1 ) );
747 BOOST_CHECK( !(x23 << x2 ) );
748 BOOST_CHECK( !(x23 << x3 ) );
749 BOOST_CHECK( !(x23 << x12 ) );
750 BOOST_CHECK( !(x23 << x13 ) );
751 BOOST_CHECK( (x23 << x23 ) );
752 BOOST_CHECK( (x23 << x123) );
753 BOOST_CHECK( !(x123 << x ) );
754 BOOST_CHECK( !(x123 << x1 ) );
755 BOOST_CHECK( !(x123 << x2 ) );
756 BOOST_CHECK( !(x123 << x3 ) );
757 BOOST_CHECK( !(x123 << x12 ) );
758 BOOST_CHECK( !(x123 << x13 ) );
759 BOOST_CHECK( !(x123 << x23 ) );
760 BOOST_CHECK( (x123 << x123) );
761
762 // check operator>>
763 BOOST_CHECK( (x >> x ) );
764 BOOST_CHECK( !(x >> x1 ) );
765 BOOST_CHECK( !(x >> x2 ) );
766 BOOST_CHECK( !(x >> x3 ) );
767 BOOST_CHECK( !(x >> x12 ) );
768 BOOST_CHECK( !(x >> x13 ) );
769 BOOST_CHECK( !(x >> x23 ) );
770 BOOST_CHECK( !(x >> x123) );
771 BOOST_CHECK( (x1 >> x ) );
772 BOOST_CHECK( (x1 >> x1 ) );
773 BOOST_CHECK( !(x1 >> x2 ) );
774 BOOST_CHECK( !(x1 >> x3 ) );
775 BOOST_CHECK( !(x1 >> x12 ) );
776 BOOST_CHECK( !(x1 >> x13 ) );
777 BOOST_CHECK( !(x1 >> x23 ) );
778 BOOST_CHECK( !(x1 >> x123) );
779 BOOST_CHECK( (x2 >> x ) );
780 BOOST_CHECK( !(x2 >> x1 ) );
781 BOOST_CHECK( (x2 >> x2 ) );
782 BOOST_CHECK( !(x2 >> x3 ) );
783 BOOST_CHECK( !(x2 >> x12 ) );
784 BOOST_CHECK( !(x2 >> x13 ) );
785 BOOST_CHECK( !(x2 >> x23 ) );
786 BOOST_CHECK( !(x2 >> x123) );
787 BOOST_CHECK( (x3 >> x ) );
788 BOOST_CHECK( !(x3 >> x1 ) );
789 BOOST_CHECK( !(x3 >> x2 ) );
790 BOOST_CHECK( (x3 >> x3 ) );
791 BOOST_CHECK( !(x3 >> x12 ) );
792 BOOST_CHECK( !(x3 >> x13 ) );
793 BOOST_CHECK( !(x3 >> x23 ) );
794 BOOST_CHECK( !(x3 >> x123) );
795 BOOST_CHECK( (x12 >> x ) );
796 BOOST_CHECK( (x12 >> x1 ) );
797 BOOST_CHECK( (x12 >> x2 ) );
798 BOOST_CHECK( !(x12 >> x3 ) );
799 BOOST_CHECK( (x12 >> x12 ) );
800 BOOST_CHECK( !(x12 >> x13 ) );
801 BOOST_CHECK( !(x12 >> x23 ) );
802 BOOST_CHECK( !(x12 >> x123) );
803 BOOST_CHECK( (x13 >> x ) );
804 BOOST_CHECK( (x13 >> x1 ) );
805 BOOST_CHECK( !(x13 >> x2 ) );
806 BOOST_CHECK( (x13 >> x3 ) );
807 BOOST_CHECK( !(x13 >> x12 ) );
808 BOOST_CHECK( (x13 >> x13 ) );
809 BOOST_CHECK( !(x13 >> x23 ) );
810 BOOST_CHECK( !(x13 >> x123) );
811 BOOST_CHECK( (x23 >> x ) );
812 BOOST_CHECK( !(x23 >> x1 ) );
813 BOOST_CHECK( (x23 >> x2 ) );
814 BOOST_CHECK( (x23 >> x3 ) );
815 BOOST_CHECK( !(x23 >> x12 ) );
816 BOOST_CHECK( !(x23 >> x13 ) );
817 BOOST_CHECK( (x23 >> x23 ) );
818 BOOST_CHECK( !(x23 >> x123) );
819 BOOST_CHECK( (x123 >> x ) );
820 BOOST_CHECK( (x123 >> x1 ) );
821 BOOST_CHECK( (x123 >> x2 ) );
822 BOOST_CHECK( (x123 >> x3 ) );
823 BOOST_CHECK( (x123 >> x12 ) );
824 BOOST_CHECK( (x123 >> x13 ) );
825 BOOST_CHECK( (x123 >> x23 ) );
826 BOOST_CHECK( (x123 >> x123) );
827 }