Remove CDS_RVALUE_SUPPORT, CDS_MOVE_SEMANTICS_SUPPORT macros and emulating code
[libcds.git] / tests / test-hdr / set / hdr_striped_set.h
1 //$$CDS-header$$
2
3 #ifndef __CDSTEST_HDR_STRIPED_SET_H
4 #define __CDSTEST_HDR_STRIPED_SET_H
5
6 #include "cppunit/cppunit_proxy.h"
7 #include "size_check.h"
8
9 #include <cds/opt/hash.h>
10 #include <cds/os/timer.h>
11 #include <cds/ref.h>
12 #include <algorithm>    // random_shuffle
13
14 // forward namespace declaration
15 namespace cds {
16     namespace container {}
17     namespace opt {}
18 }
19
20 namespace set {
21     using misc::check_size;
22
23     namespace cc = cds::container;
24     namespace co = cds::opt;
25
26
27     class StripedSetHdrTest: public CppUnitMini::TestCase
28     {
29     public:
30         struct stat
31         {
32             unsigned int nFindCount     ;   // count of find-functor calling
33             unsigned int nEnsureNewCount;
34             unsigned int nEnsureCount;
35
36             stat()
37             {
38                 memset( this, 0, sizeof(*this));
39             }
40
41             void copy( stat const& s )
42             {
43                 nFindCount = s.nFindCount;
44                 nEnsureCount = s.nEnsureCount;
45                 nEnsureNewCount = s.nEnsureNewCount;
46             }
47         };
48
49         struct item: public stat
50         {
51             int nKey;
52             int nVal;
53
54             item()
55             {}
56
57             item( int key )
58                 : nKey( key )
59                 , nVal( key )
60             {}
61
62             item (int key, int val )
63                 : nKey(key)
64                 , nVal( val )
65             {}
66
67             item( std::pair<int,int> const& p )
68                 : nKey( p.first )
69                 , nVal( p.second )
70             {}
71
72             item( item const& i )
73                 : nKey( i.nKey )
74                 , nVal( i.nVal )
75             {}
76
77             item& operator=(item const& i)
78             {
79                 nKey = i.nKey;
80                 nVal = i.nVal;
81                 stat::copy(i);
82
83                 return *this;
84             }
85
86             item( item&& i )
87                 : nKey( i.nKey )
88                 , nVal( i.nVal )
89             {}
90
91             //item& operator=(item&& i)
92             //{
93             //    nKey = i.nKey;
94             //    nVal = i.nVal;
95             //    return *this;
96             //}
97
98             int key() const
99             {
100                 return nKey;
101             }
102
103             int val() const
104             {
105                 return nVal;
106             }
107         };
108
109         struct hash_int {
110             size_t operator()( int i ) const
111             {
112                 return co::v::hash<int>()( i );
113             }
114
115             size_t operator()( std::pair<int,int> const& i ) const
116             {
117                 return co::v::hash<int>()( i.first );
118             }
119
120             template <typename Item>
121             size_t operator()( Item const& i ) const
122             {
123                 return (*this)( i.key() );
124             }
125         };
126
127         struct simple_item_counter {
128             size_t  m_nCount;
129
130             simple_item_counter()
131                 : m_nCount(0)
132             {}
133
134             size_t operator ++()
135             {
136                 return ++m_nCount;
137             }
138
139             size_t operator --()
140             {
141                 return --m_nCount;
142             }
143
144             void reset()
145             {
146                 m_nCount = 0;
147             }
148
149             operator size_t() const
150             {
151                 return m_nCount;
152             }
153         };
154
155         template <typename T>
156         struct less
157         {
158             bool operator ()(const T& v1, const T& v2 ) const
159             {
160                 return v1.key() < v2.key();
161             }
162
163             template <typename Q>
164             bool operator ()(const T& v1, const Q& v2 ) const
165             {
166                 return v1.key() < v2;
167             }
168
169             template <typename Q>
170             bool operator ()(const Q& v1, const T& v2 ) const
171             {
172                 return v1 < v2.key();
173             }
174
175             bool operator ()( std::pair<int, int> const& v1, const T& v2 ) const
176             {
177                 return v1.first < v2.key();
178             }
179
180             bool operator ()(const T& v1, std::pair<int, int> const& v2 ) const
181             {
182                 return v1.key() < v2.first;
183             }
184         };
185
186         template <typename T>
187         struct cmp {
188             int operator ()(const T& v1, const T& v2 ) const
189             {
190                 if ( v1.key() < v2.key() )
191                     return -1;
192                 return v1.key() > v2.key() ? 1 : 0;
193             }
194
195             template <typename Q>
196             int operator ()(const T& v1, const Q& v2 ) const
197             {
198                 if ( v1.key() < v2 )
199                     return -1;
200                 return v1.key() > v2 ? 1 : 0;
201             }
202
203             template <typename Q>
204             int operator ()(const Q& v1, const T& v2 ) const
205             {
206                 if ( v1 < v2.key() )
207                     return -1;
208                 return v1 > v2.key() ? 1 : 0;
209             }
210
211             int operator()( std::pair<int,int> const& v1, T const& v2 ) const
212             {
213                 if ( v1.first < v2.key() )
214                     return -1;
215                 return v1.first > v2.key() ? 1 : 0;
216             }
217
218             int operator()( T const& v1, std::pair<int,int> const& v2 ) const
219             {
220                 if ( v1.key() < v2.first )
221                     return -1;
222                 return v1.key() > v2.first ? 1 : 0;
223             }
224         };
225
226         template <typename T>
227         struct equal
228         {
229             bool operator ()(const T& v1, const T& v2 ) const
230             {
231                 return v1.key() == v2.key();
232             }
233
234             template <typename Q>
235             bool operator ()(const T& v1, const Q& v2 ) const
236             {
237                 return v1.key() == v2;
238             }
239
240             template <typename Q>
241             bool operator ()(const Q& v1, const T& v2 ) const
242             {
243                 return v1 == v2.key();
244             }
245
246             bool operator ()( std::pair<int, int> const& v1, const T& v2 ) const
247             {
248                 return v1.first == v2.key();
249             }
250
251             bool operator ()(const T& v1, std::pair<int, int> const& v2 ) const
252             {
253                 return v1.key() == v2.first;
254             }
255         };
256
257         struct find_functor
258         {
259             template <typename Item, typename T>
260             void operator()( Item& i, T& val )
261             {
262                 ++i.nFindCount;
263             }
264             template <typename Item, typename T>
265             void operator()( Item& i, T const& val )
266             {
267                 ++i.nFindCount;
268             }
269         };
270
271         template <typename Item>
272         struct copy_found
273         {
274             Item    m_found;
275
276             template <typename T>
277             void operator()( Item& i, T& /*val*/ )
278             {
279                 m_found = i;
280             }
281
282             void operator()( Item const& i )
283             {
284                 m_found = i;
285             }
286         };
287
288         struct insert_functor
289         {
290             template <typename Item>
291             void operator()(Item& i )
292             {
293                 i.nVal = i.nKey * 100;
294             }
295         };
296
297         template <typename Item, typename Q>
298         static void ensure_func( bool bNew, Item& i, Q& /*val*/ )
299         {
300             if ( bNew )
301                 ++i.nEnsureNewCount;
302             else
303                 ++i.nEnsureCount;
304         }
305
306         struct ensure_functor
307         {
308             template <typename Item, typename Q>
309             void operator()( bool bNew, Item& i, Q& val )
310             {
311                 ensure_func( bNew, i, val );
312             }
313         };
314
315     public:
316         template <class Set>
317         void test_striped()
318         {
319             Set s( 30 );
320             CPPUNIT_ASSERT( s.bucket_count() == 32 );
321             CPPUNIT_ASSERT( s.lock_count() == 32 );
322
323             test_striped_with( s );
324         }
325
326         template <class Set>
327         void test_striped_with( Set& s )
328         {
329             cds::OS::Timer    timer;
330
331             test_int_with( s );
332
333             // Resizing test
334             for ( int i = 0; i < 10000; i++ ) {
335                 s.insert( i );
336             }
337
338             CPPUNIT_MSG( "   Duration=" << timer.duration() );
339         }
340
341         template <class Set>
342         void test_int_with( Set& s)
343         {
344             typedef typename Set::value_type    value_type;
345
346             item itm;
347             int key;
348
349             // insert/find test
350             CPPUNIT_ASSERT( !s.find( 10 ) );
351             CPPUNIT_ASSERT( s.insert( 10 ));
352             CPPUNIT_ASSERT( !s.empty() );
353             CPPUNIT_ASSERT( check_size( s, 1 ));
354             CPPUNIT_ASSERT( s.find( 10 ) );
355
356             CPPUNIT_ASSERT( !s.insert( 10 ));
357             CPPUNIT_ASSERT( !s.empty() );
358             CPPUNIT_ASSERT( check_size( s, 1 ));
359
360             CPPUNIT_ASSERT( !s.find( 20 ) );
361             CPPUNIT_ASSERT( s.insert( std::make_pair(20, 25) ));
362             CPPUNIT_ASSERT( !s.empty() );
363             CPPUNIT_ASSERT( check_size( s, 2 ));
364             CPPUNIT_ASSERT( s.find( 10 ) );
365             CPPUNIT_ASSERT( s.find( key = 20 ) );
366             CPPUNIT_ASSERT( s.find( key, find_functor() ) );
367             {
368                 copy_found<item> f;
369                 key = 20;
370                 CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
371                 CPPUNIT_ASSERT( f.m_found.nKey == 20 );
372                 CPPUNIT_ASSERT( f.m_found.nVal == 25 );
373                 CPPUNIT_ASSERT( f.m_found.nFindCount == 1 );
374             }
375             {
376                 copy_found<item> f;
377                 key = 20;
378                 CPPUNIT_ASSERT( s.find( key, find_functor() ) );
379                 CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
380                 CPPUNIT_ASSERT( f.m_found.nKey == 20 );
381                 CPPUNIT_ASSERT( f.m_found.nVal == 25 );
382                 CPPUNIT_ASSERT( f.m_found.nFindCount == 2 );
383             }
384             CPPUNIT_ASSERT( !s.empty() );
385             CPPUNIT_ASSERT( check_size( s, 2 ));
386
387             CPPUNIT_ASSERT( !s.find( 25 ) );
388             CPPUNIT_ASSERT( s.insert( std::make_pair(25, -1), insert_functor() ));
389             CPPUNIT_ASSERT( !s.empty() );
390             CPPUNIT_ASSERT( check_size( s, 3 ));
391             {
392                 copy_found<item> f;
393                 key = 25;
394                 CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
395                 CPPUNIT_ASSERT( f.m_found.nKey == 25 );
396                 CPPUNIT_ASSERT( f.m_found.nVal == 2500 );
397             }
398
399             // ensure test
400             key = 10;
401             {
402                 copy_found<item> f;
403                 CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
404                 CPPUNIT_ASSERT( f.m_found.nKey == 10 );
405                 CPPUNIT_ASSERT( f.m_found.nVal == 10 );
406                 CPPUNIT_ASSERT( f.m_found.nEnsureCount == 0 );
407                 CPPUNIT_ASSERT( f.m_found.nEnsureNewCount == 0 );
408             }
409             std::pair<bool, bool> ensureResult = s.ensure( key, ensure_functor() );
410             CPPUNIT_ASSERT( ensureResult.first && !ensureResult.second );
411             CPPUNIT_ASSERT( !s.empty() );
412             CPPUNIT_ASSERT( check_size( s, 3 ));
413             {
414                 copy_found<item> f;
415                 CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
416                 CPPUNIT_ASSERT( f.m_found.nKey == 10 );
417                 CPPUNIT_ASSERT( f.m_found.nVal == 10 );
418                 CPPUNIT_ASSERT( f.m_found.nEnsureCount == 1 );
419                 CPPUNIT_ASSERT( f.m_found.nEnsureNewCount == 0 );
420             }
421
422             ensureResult = s.ensure( std::make_pair(13, 1300), ensure_functor() );
423             CPPUNIT_ASSERT( ensureResult.first && ensureResult.second );
424             CPPUNIT_ASSERT( !s.empty() );
425             CPPUNIT_ASSERT( check_size( s, 4 ));
426             {
427                 copy_found<item> f;
428                 key = 13;
429                 CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
430                 CPPUNIT_ASSERT( f.m_found.nKey == 13 );
431                 CPPUNIT_ASSERT( f.m_found.nVal == 1300 );
432                 CPPUNIT_ASSERT( f.m_found.nEnsureCount == 0 );
433                 CPPUNIT_ASSERT( f.m_found.nEnsureNewCount == 1 );
434             }
435
436             // erase test
437             CPPUNIT_ASSERT( s.erase(13) );
438             CPPUNIT_ASSERT( !s.find( 13 ));
439             CPPUNIT_ASSERT( !s.empty() );
440             CPPUNIT_ASSERT( check_size( s, 3 ));
441             CPPUNIT_ASSERT( !s.erase(13) );
442             CPPUNIT_ASSERT( !s.empty() );
443             CPPUNIT_ASSERT( check_size( s, 3 ));
444
445             CPPUNIT_ASSERT( s.find( 10 ));
446             CPPUNIT_ASSERT( s.erase( 10 ));
447             CPPUNIT_ASSERT( !s.find( 10 ));
448             CPPUNIT_ASSERT( !s.empty() );
449             CPPUNIT_ASSERT( check_size( s, 2 ));
450             CPPUNIT_ASSERT( !s.erase(10) );
451             CPPUNIT_ASSERT( !s.empty() );
452             CPPUNIT_ASSERT( check_size( s, 2 ));
453
454             CPPUNIT_ASSERT( s.find(20) );
455             {
456                 copy_found<item> f;
457                 CPPUNIT_ASSERT( s.erase( 20, boost::ref(f) ));
458                 CPPUNIT_ASSERT( f.m_found.nKey == 20 );
459                 CPPUNIT_ASSERT( f.m_found.nVal == 25 );
460
461                 CPPUNIT_ASSERT( s.insert(235))
462                     CPPUNIT_ASSERT( s.erase( 235, boost::ref(f) ));
463                 CPPUNIT_ASSERT( f.m_found.nKey == 235 );
464                 CPPUNIT_ASSERT( f.m_found.nVal == 235 );
465             }
466             CPPUNIT_ASSERT( !s.find( 20 ));
467             CPPUNIT_ASSERT( !s.empty() );
468             CPPUNIT_ASSERT( check_size( s, 1 ));
469
470             s.clear();
471             CPPUNIT_ASSERT( s.empty() );
472             CPPUNIT_ASSERT( check_size( s, 0 ));
473
474 #       ifdef CDS_EMPLACE_SUPPORT
475             // emplace test
476             CPPUNIT_ASSERT( s.emplace( 151 )) ;  // key = 151,  val = 151
477             CPPUNIT_ASSERT( s.emplace( 174, 471 )) ;    // key = 174, val = 471
478             CPPUNIT_ASSERT( s.emplace( std::make_pair( 190, 91 ) )) ; // key == 190, val = 91
479             CPPUNIT_ASSERT( !s.empty() );
480             CPPUNIT_ASSERT( check_size( s, 3 ));
481
482             CPPUNIT_ASSERT( s.find(151));
483             CPPUNIT_ASSERT( s.find(174));
484             CPPUNIT_ASSERT( s.find(190));
485
486             {
487                 copy_found<item> f;
488                 key = 151;
489                 CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
490                 CPPUNIT_ASSERT( f.m_found.nKey == 151 );
491                 CPPUNIT_ASSERT( f.m_found.nVal == 151 );
492
493                 key = 174;
494                 CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
495                 CPPUNIT_ASSERT( f.m_found.nKey == 174 );
496                 CPPUNIT_ASSERT( f.m_found.nVal == 471 );
497
498                 key = 190;
499                 CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
500                 CPPUNIT_ASSERT( f.m_found.nKey == 190 );
501                 CPPUNIT_ASSERT( f.m_found.nVal == 91 );
502             }
503
504             s.clear();
505             CPPUNIT_ASSERT( s.empty() );
506             CPPUNIT_ASSERT( check_size( s, 0 ));
507 #       endif
508         }
509
510         template <class Set>
511         void test_striped2()
512         {
513             Set s( 30 );
514             CPPUNIT_ASSERT( s.bucket_count() == 32 );
515             CPPUNIT_ASSERT( s.lock_count() == 32 );
516
517             test_striped_with2( s );
518         }
519
520         template <class Set>
521         void test_striped_with2( Set& s )
522         {
523             cds::OS::Timer    timer;
524
525             test_int_with2( s );
526
527             // Resizing test
528             for ( int i = 0; i < 10000; i++ ) {
529                 s.insert( i );
530             }
531
532             CPPUNIT_MSG( "   Duration=" << timer.duration() );
533         }
534
535         template <class Set>
536         void test_int_with2( Set& s)
537         {
538             typedef typename Set::value_type    value_type;
539
540             item itm;
541             int key;
542
543             // insert/find test
544             CPPUNIT_ASSERT( !s.find( 10 ) );
545             CPPUNIT_ASSERT( s.insert( 10 ));
546             CPPUNIT_ASSERT( !s.empty() );
547             CPPUNIT_ASSERT( check_size( s, 1 ));
548             CPPUNIT_ASSERT( s.find( 10 ) );
549
550             CPPUNIT_ASSERT( !s.insert( 10 ));
551             CPPUNIT_ASSERT( !s.empty() );
552             CPPUNIT_ASSERT( check_size( s, 1 ));
553
554             CPPUNIT_ASSERT( !s.find_with( 20, less<value_type>() ) );
555             CPPUNIT_ASSERT( s.insert( std::make_pair(20, 25) ));
556             CPPUNIT_ASSERT( !s.empty() );
557             CPPUNIT_ASSERT( check_size( s, 2 ));
558             CPPUNIT_ASSERT( s.find( 10 ) );
559             CPPUNIT_ASSERT( s.find_with( key = 20, less<value_type>() ) );
560             CPPUNIT_ASSERT( s.find_with( key, less<value_type>(), find_functor() ) );
561             {
562                 copy_found<item> f;
563                 key = 20;
564                 CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
565                 CPPUNIT_ASSERT( f.m_found.nKey == 20 );
566                 CPPUNIT_ASSERT( f.m_found.nVal == 25 );
567                 CPPUNIT_ASSERT( f.m_found.nFindCount == 1 );
568             }
569             {
570                 copy_found<item> f;
571                 key = 20;
572                 CPPUNIT_ASSERT( s.find_with( 20, less<value_type>(), find_functor() ) );
573                 CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
574                 CPPUNIT_ASSERT( f.m_found.nKey == 20 );
575                 CPPUNIT_ASSERT( f.m_found.nVal == 25 );
576                 CPPUNIT_ASSERT( f.m_found.nFindCount == 2 );
577             }
578             CPPUNIT_ASSERT( !s.empty() );
579             CPPUNIT_ASSERT( check_size( s, 2 ));
580
581             CPPUNIT_ASSERT( !s.find( 25 ) );
582             CPPUNIT_ASSERT( s.insert( std::make_pair(25, -1), insert_functor() ));
583             CPPUNIT_ASSERT( !s.empty() );
584             CPPUNIT_ASSERT( check_size( s, 3 ));
585             {
586                 copy_found<item> f;
587                 key = 25;
588                 CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
589                 CPPUNIT_ASSERT( f.m_found.nKey == 25 );
590                 CPPUNIT_ASSERT( f.m_found.nVal == 2500 );
591             }
592
593             // ensure test
594             key = 10;
595             {
596                 copy_found<item> f;
597                 CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
598                 CPPUNIT_ASSERT( f.m_found.nKey == 10 );
599                 CPPUNIT_ASSERT( f.m_found.nVal == 10 );
600                 CPPUNIT_ASSERT( f.m_found.nEnsureCount == 0 );
601                 CPPUNIT_ASSERT( f.m_found.nEnsureNewCount == 0 );
602             }
603             std::pair<bool, bool> ensureResult = s.ensure( key, ensure_functor() );
604             CPPUNIT_ASSERT( ensureResult.first && !ensureResult.second );
605             CPPUNIT_ASSERT( !s.empty() );
606             CPPUNIT_ASSERT( check_size( s, 3 ));
607             {
608                 copy_found<item> f;
609                 CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
610                 CPPUNIT_ASSERT( f.m_found.nKey == 10 );
611                 CPPUNIT_ASSERT( f.m_found.nVal == 10 );
612                 CPPUNIT_ASSERT( f.m_found.nEnsureCount == 1 );
613                 CPPUNIT_ASSERT( f.m_found.nEnsureNewCount == 0 );
614             }
615
616             ensureResult = s.ensure( std::make_pair(13, 1300), ensure_functor() );
617             CPPUNIT_ASSERT( ensureResult.first && ensureResult.second );
618             CPPUNIT_ASSERT( !s.empty() );
619             CPPUNIT_ASSERT( check_size( s, 4 ));
620             {
621                 copy_found<item> f;
622                 key = 13;
623                 CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
624                 CPPUNIT_ASSERT( f.m_found.nKey == 13 );
625                 CPPUNIT_ASSERT( f.m_found.nVal == 1300 );
626                 CPPUNIT_ASSERT( f.m_found.nEnsureCount == 0 );
627                 CPPUNIT_ASSERT( f.m_found.nEnsureNewCount == 1 );
628             }
629
630             // erase test
631             CPPUNIT_ASSERT( s.erase(13) );
632             CPPUNIT_ASSERT( !s.find( 13 ));
633             CPPUNIT_ASSERT( !s.empty() );
634             CPPUNIT_ASSERT( check_size( s, 3 ));
635             CPPUNIT_ASSERT( !s.erase(13) );
636             CPPUNIT_ASSERT( !s.empty() );
637             CPPUNIT_ASSERT( check_size( s, 3 ));
638
639             CPPUNIT_ASSERT( s.find( 10 ));
640             CPPUNIT_ASSERT( s.erase_with( 10, less<value_type>() ));
641             CPPUNIT_ASSERT( !s.find( 10 ));
642             CPPUNIT_ASSERT( !s.empty() );
643             CPPUNIT_ASSERT( check_size( s, 2 ));
644             CPPUNIT_ASSERT( !s.erase_with( 10, less<value_type>() ) );
645             CPPUNIT_ASSERT( !s.empty() );
646             CPPUNIT_ASSERT( check_size( s, 2 ));
647
648             CPPUNIT_ASSERT( s.find(20) );
649             {
650                 copy_found<item> f;
651                 CPPUNIT_ASSERT( s.erase( 20, boost::ref(f) ));
652                 CPPUNIT_ASSERT( f.m_found.nKey == 20 );
653                 CPPUNIT_ASSERT( f.m_found.nVal == 25 );
654
655                 CPPUNIT_ASSERT( s.insert(235))
656                 CPPUNIT_ASSERT( s.erase_with( 235, less<value_type>(), boost::ref(f) ));
657                 CPPUNIT_ASSERT( f.m_found.nKey == 235 );
658                 CPPUNIT_ASSERT( f.m_found.nVal == 235 );
659             }
660             CPPUNIT_ASSERT( !s.find( 20 ));
661             CPPUNIT_ASSERT( !s.empty() );
662             CPPUNIT_ASSERT( check_size( s, 1 ));
663
664             s.clear();
665             CPPUNIT_ASSERT( s.empty() );
666             CPPUNIT_ASSERT( check_size( s, 0 ));
667
668 #       ifdef CDS_EMPLACE_SUPPORT
669             // emplace test
670             CPPUNIT_ASSERT( s.emplace( 151 )) ;  // key = 151,  val = 151
671             CPPUNIT_ASSERT( s.emplace( 174, 471 )) ;    // key = 174, val = 471
672             CPPUNIT_ASSERT( s.emplace( std::make_pair( 190, 91 ) )) ; // key == 190, val = 91
673             CPPUNIT_ASSERT( !s.empty() );
674             CPPUNIT_ASSERT( check_size( s, 3 ));
675
676             CPPUNIT_ASSERT( s.find(151));
677             CPPUNIT_ASSERT( s.find(174));
678             CPPUNIT_ASSERT( s.find(190));
679
680             {
681                 copy_found<item> f;
682                 key = 151;
683                 CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
684                 CPPUNIT_ASSERT( f.m_found.nKey == 151 );
685                 CPPUNIT_ASSERT( f.m_found.nVal == 151 );
686
687                 key = 174;
688                 CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
689                 CPPUNIT_ASSERT( f.m_found.nKey == 174 );
690                 CPPUNIT_ASSERT( f.m_found.nVal == 471 );
691
692                 key = 190;
693                 CPPUNIT_ASSERT( s.find( key, boost::ref(f) ) );
694                 CPPUNIT_ASSERT( f.m_found.nKey == 190 );
695                 CPPUNIT_ASSERT( f.m_found.nVal == 91 );
696             }
697
698             s.clear();
699             CPPUNIT_ASSERT( s.empty() );
700             CPPUNIT_ASSERT( check_size( s, 0 ));
701 #       endif
702         }
703
704         void Striped_list();
705         void Striped_vector();
706         void Striped_set();
707         void Striped_hashset();
708         void Striped_slist();
709         void Striped_boost_list();
710         void Striped_boost_vector();
711         void Striped_boost_stable_vector();
712         void Striped_boost_flat_set();
713         void Striped_boost_set();
714         void Striped_boost_unordered_set();
715
716         void Refinable_list();
717         void Refinable_vector();
718         void Refinable_set();
719         void Refinable_hashset();
720         void Refinable_slist();
721         void Refinable_boost_list();
722         void Refinable_boost_vector();
723         void Refinable_boost_stable_vector();
724         void Refinable_boost_flat_set();
725         void Refinable_boost_set();
726         void Refinable_boost_unordered_set();
727
728         CPPUNIT_TEST_SUITE(StripedSetHdrTest)
729             CPPUNIT_TEST(Striped_list)
730             CPPUNIT_TEST(Striped_vector)
731             CPPUNIT_TEST(Striped_set)
732             CPPUNIT_TEST(Striped_hashset)
733             CPPUNIT_TEST(Striped_slist)
734             CPPUNIT_TEST(Striped_boost_list)
735             CPPUNIT_TEST(Striped_boost_vector)
736             CPPUNIT_TEST(Striped_boost_stable_vector)
737             CPPUNIT_TEST(Striped_boost_flat_set)
738             CPPUNIT_TEST(Striped_boost_set)
739             CPPUNIT_TEST(Striped_boost_unordered_set)
740
741             CPPUNIT_TEST(Refinable_list)
742             CPPUNIT_TEST(Refinable_vector)
743             CPPUNIT_TEST(Refinable_set)
744             CPPUNIT_TEST(Refinable_hashset)
745             CPPUNIT_TEST(Refinable_slist)
746             CPPUNIT_TEST(Refinable_boost_list)
747             CPPUNIT_TEST(Refinable_boost_vector)
748             CPPUNIT_TEST(Refinable_boost_stable_vector)
749             CPPUNIT_TEST(Refinable_boost_flat_set)
750             CPPUNIT_TEST(Refinable_boost_set)
751             CPPUNIT_TEST(Refinable_boost_unordered_set)
752
753         CPPUNIT_TEST_SUITE_END()
754     };
755 } // namespace set
756
757 #endif // #ifndef __CDSTEST_HDR_STRIPED_SET_H