3 #include "cppunit/cppunit_proxy.h"
4 #include <cds/intrusive/details/lazy_list_base.h>
7 namespace ci = cds::intrusive;
8 namespace co = cds::opt;
10 class IntrusiveLazyListHeaderTest: public CppUnitMini::TestCase
16 int nEnsureExistsCall;
23 , nEnsureExistsCall(0)
34 stat& operator =(const stat& s)
36 memcpy( this, &s, sizeof(s));
41 template <typename GC>
42 struct base_int_item: public ci::lazy_list::node< GC >
52 base_int_item(int key, int val)
58 base_int_item(const base_int_item& v )
64 const int& key() const
70 template <typename GC>
71 struct member_int_item
76 ci::lazy_list::node< GC > hMember;
83 member_int_item(int key, int val)
89 member_int_item(const member_int_item& v )
95 const int& key() const
101 template <typename T>
104 bool operator ()(const T& v1, const T& v2 ) const
106 return v1.key() < v2.key();
109 template <typename Q>
110 bool operator ()(const T& v1, const Q& v2 ) const
112 return v1.key() < v2;
115 template <typename Q>
116 bool operator ()(const Q& v1, const T& v2 ) const
118 return v1 < v2.key();
122 template <typename T>
124 int operator ()(const T& v1, const T& v2 ) const
126 if ( v1.key() < v2.key() )
128 return v1.key() > v2.key() ? 1 : 0;
131 template <typename Q>
132 int operator ()(const T& v1, const Q& v2 ) const
136 return v1.key() > v2 ? 1 : 0;
139 template <typename Q>
140 int operator ()(const Q& v1, const T& v2 ) const
144 return v1 > v2.key() ? 1 : 0;
157 template <typename T, typename Q>
158 bool operator()( T const& i1, Q const& i2) const
160 return i1.nKey < i2.nKey;
164 struct faked_disposer
166 template <typename T>
167 void operator ()( T * p )
169 ++p->s.nDisposeCount;
173 struct ensure_functor
175 template <typename T>
176 void operator ()(bool bNew, T& item, T& /*val*/ )
179 ++item.s.nEnsureNewCall;
181 ++item.s.nEnsureExistsCall;
187 template <typename T, typename Q>
188 void operator ()( T& item, Q& /*val*/ )
196 template <typename T>
197 void operator()( T const& item )
203 template <class OrdList>
204 void test_int_common()
206 typedef typename OrdList::value_type value_type;
208 value_type v1( 10, 50 );
209 value_type v2( 5, 25 );
210 value_type v3( 20, 100 );
213 CPPUNIT_ASSERT( l.empty() );
215 CPPUNIT_ASSERT( l.insert( v1 )) ; // true
216 CPPUNIT_ASSERT( l.find( v1.key() ));
218 CPPUNIT_ASSERT( v1.s.nFindCall == 0 );
219 CPPUNIT_ASSERT( l.find( v1.key(), find_functor() ));
220 CPPUNIT_ASSERT( v1.s.nFindCall == 1 );
222 CPPUNIT_ASSERT( !l.find_with( v2.key(), less<value_type>() ));
223 CPPUNIT_ASSERT( !l.find( v3.key(), find_functor() ));
224 CPPUNIT_ASSERT( !l.empty() );
226 //CPPUNIT_ASSERT( !l.insert( v1 )) ; // assertion "is_empty" is raised
230 CPPUNIT_ASSERT( !l.insert( v )) ; // false
233 std::pair<bool, bool> ret = l.ensure( v2, ensure_functor() );
234 CPPUNIT_ASSERT( ret.first );
235 CPPUNIT_ASSERT( ret.second );
236 CPPUNIT_ASSERT( v2.s.nEnsureNewCall == 1 );
237 CPPUNIT_ASSERT( v2.s.nEnsureExistsCall == 0 );
239 //CPPUNIT_ASSERT( !l.insert( v2 )) ; // assertion "is_empty"
241 CPPUNIT_ASSERT( l.find( v1.key() )) ; // true
243 CPPUNIT_ASSERT( v1.s.nFindCall == 1 );
244 CPPUNIT_ASSERT( l.find( v1.key(), find_functor() ));
245 CPPUNIT_ASSERT( v1.s.nFindCall == 2 );
247 CPPUNIT_ASSERT( l.find( v2.key() ));
249 CPPUNIT_ASSERT( v2.s.nFindCall == 0 );
250 CPPUNIT_ASSERT( l.find_with( v2.key(), less<value_type>(), find_functor() ));
251 CPPUNIT_ASSERT( v2.s.nFindCall == 1 );
253 CPPUNIT_ASSERT( !l.find( v3.key() ));
256 CPPUNIT_ASSERT( v2.s.nEnsureExistsCall == 0 );
257 CPPUNIT_ASSERT( v2.s.nEnsureNewCall == 1 );
260 ret = l.ensure( v, ensure_functor() );
262 CPPUNIT_ASSERT( ret.first );
263 CPPUNIT_ASSERT( !ret.second );
264 CPPUNIT_ASSERT( v2.s.nEnsureExistsCall == 1 );
265 CPPUNIT_ASSERT( v2.s.nEnsureNewCall == 1 );
266 CPPUNIT_ASSERT( v.s.nEnsureExistsCall == 0 );
267 CPPUNIT_ASSERT( v.s.nEnsureNewCall == 0 );
270 CPPUNIT_ASSERT( !l.empty() );
272 CPPUNIT_ASSERT( l.insert( v3 )) ; // true
273 CPPUNIT_ASSERT( l.find( v3.key() ));
275 CPPUNIT_ASSERT( v3.s.nFindCall == 0 );
276 CPPUNIT_ASSERT( l.find( v3.key(), find_functor() ));
277 CPPUNIT_ASSERT( v3.s.nFindCall == 1 );
279 CPPUNIT_ASSERT( l.unlink( v2 ) );
280 CPPUNIT_ASSERT( l.find( v1.key() )) ; // true
281 CPPUNIT_ASSERT( !l.find( v2.key() )) ; // true
282 CPPUNIT_ASSERT( l.find( v3.key() )) ; // true
283 CPPUNIT_ASSERT( !l.empty() );
284 CPPUNIT_ASSERT( !l.unlink( v2 ) );
287 // v1 key is in the list but v NODE is not in the list
289 CPPUNIT_ASSERT( !l.unlink( v ) );
292 CPPUNIT_ASSERT( l.unlink( v1 ) );
293 CPPUNIT_ASSERT( !l.unlink( v1 ) );
294 CPPUNIT_ASSERT( !l.find( v1.key() ));
295 CPPUNIT_ASSERT( !l.find( v2.key() ));
296 CPPUNIT_ASSERT( l.find( v3.key() ));
297 CPPUNIT_ASSERT( !l.empty() );
298 CPPUNIT_ASSERT( !l.unlink( v1 ) );
299 CPPUNIT_ASSERT( !l.unlink( v2 ) );
301 CPPUNIT_ASSERT( l.unlink( v3 ) );
302 CPPUNIT_ASSERT( !l.find( v1.key() ));
303 CPPUNIT_ASSERT( !l.find_with( v2.key(), less<value_type>() ));
304 CPPUNIT_ASSERT( !l.find( v3.key() ));
305 CPPUNIT_ASSERT( l.empty() );
306 CPPUNIT_ASSERT( !l.unlink( v1 ) );
307 CPPUNIT_ASSERT( !l.unlink( v2 ) );
308 CPPUNIT_ASSERT( !l.unlink( v3 ) );
310 // Apply retired pointer to clean links
311 OrdList::gc::force_dispose();
314 ret = l.ensure( v3, ensure_functor() );
315 CPPUNIT_ASSERT( ret.first );
316 CPPUNIT_ASSERT( ret.second );
317 CPPUNIT_ASSERT( v3.s.nEnsureNewCall == s.nEnsureNewCall + 1);
318 CPPUNIT_ASSERT( v3.s.nEnsureExistsCall == s.nEnsureExistsCall );
319 CPPUNIT_ASSERT( !l.empty() );
322 ret = l.ensure( v2, ensure_functor() );
323 CPPUNIT_ASSERT( ret.first );
324 CPPUNIT_ASSERT( ret.second );
325 CPPUNIT_ASSERT( v2.s.nEnsureNewCall == s.nEnsureNewCall + 1);
326 CPPUNIT_ASSERT( v2.s.nEnsureExistsCall == s.nEnsureExistsCall );
327 CPPUNIT_ASSERT( !l.empty() );
330 ret = l.ensure( v1, ensure_functor() );
331 CPPUNIT_ASSERT( ret.first );
332 CPPUNIT_ASSERT( ret.second );
333 CPPUNIT_ASSERT( v1.s.nEnsureNewCall == s.nEnsureNewCall + 1);
334 CPPUNIT_ASSERT( v1.s.nEnsureExistsCall == s.nEnsureExistsCall );
335 CPPUNIT_ASSERT( !l.empty() );
338 CPPUNIT_ASSERT( l.erase( v1.key()) );
339 //CPPUNIT_ASSERT( v1.s.nDisposeCount == 0 );
340 CPPUNIT_ASSERT( !l.empty() );
342 CPPUNIT_ASSERT( v2.s.nEraseCall == 0 );
343 CPPUNIT_ASSERT( l.erase_with( v2.key(), less<value_type>(), erase_functor()) );
344 CPPUNIT_ASSERT( v2.s.nEraseCall == 1 );
345 CPPUNIT_ASSERT( !l.erase_with( v2.key(), less<value_type>()));
346 CPPUNIT_ASSERT( v2.s.nEraseCall == 1 );
347 //CPPUNIT_ASSERT( v2.s.nDisposeCount == 0 );
348 CPPUNIT_ASSERT( !l.empty() );
350 CPPUNIT_ASSERT( !l.erase( v2 ));
351 CPPUNIT_ASSERT( !l.erase( v1 ));
352 //CPPUNIT_ASSERT( v2.s.nDisposeCount == 0 );
353 CPPUNIT_ASSERT( !l.empty() );
355 CPPUNIT_ASSERT( v3.s.nEraseCall == 0 );
356 CPPUNIT_ASSERT( l.erase( v3, erase_functor() ));
357 CPPUNIT_ASSERT( v3.s.nEraseCall == 1 );
358 //CPPUNIT_ASSERT( v3.s.nDisposeCount == 0 );
359 CPPUNIT_ASSERT( l.empty() );
361 // Apply retired pointer to clean links
362 OrdList::gc::force_dispose();
365 CPPUNIT_ASSERT( l.insert( v1 ));
366 CPPUNIT_ASSERT( l.insert( v3 ));
367 CPPUNIT_ASSERT( !l.empty() );
368 CPPUNIT_ASSERT( !l.unlink( v2 ));
369 CPPUNIT_ASSERT( l.unlink( v1 ));
370 CPPUNIT_ASSERT( !l.unlink( v1 ));
371 CPPUNIT_ASSERT( l.unlink( v3 ));
372 CPPUNIT_ASSERT( !l.unlink( v3 ));
373 CPPUNIT_ASSERT( l.empty() );
375 // Apply retired pointer
376 OrdList::gc::force_dispose();
377 CPPUNIT_ASSERT( v1.s.nDisposeCount == 3 );
378 CPPUNIT_ASSERT( v2.s.nDisposeCount == 2 );
379 CPPUNIT_ASSERT( v3.s.nDisposeCount == 3 );
381 // Destructor test (call disposer)
382 CPPUNIT_ASSERT( l.insert( v1 ));
383 CPPUNIT_ASSERT( l.insert( v3 ));
384 CPPUNIT_ASSERT( l.insert( v2 ));
388 typename OrdList::iterator it = l.begin();
389 typename OrdList::const_iterator cit = l.cbegin();
390 CPPUNIT_ASSERT( it != l.end() );
391 CPPUNIT_ASSERT( it != l.cend() );
392 CPPUNIT_ASSERT( cit != l.end() );
393 CPPUNIT_ASSERT( cit != l.cend() );
394 CPPUNIT_ASSERT( cit == it );
396 CPPUNIT_ASSERT( it->nKey == v2.nKey );
397 CPPUNIT_ASSERT( it->nVal == v2.nVal );
398 CPPUNIT_ASSERT( ++it != l.end() );
399 CPPUNIT_ASSERT( it->nKey == v1.nKey );
400 CPPUNIT_ASSERT( it->nVal == v1.nVal );
401 CPPUNIT_ASSERT( ++it != l.end() );
402 CPPUNIT_ASSERT( it->nKey == v3.nKey );
403 CPPUNIT_ASSERT( it->nVal == v3.nVal );
404 CPPUNIT_ASSERT( ++it == l.end() );
408 OrdList const & lref = l;
409 typename OrdList::const_iterator it = lref.begin();
410 CPPUNIT_ASSERT( it != l.end() );
411 CPPUNIT_ASSERT( it->nKey == v2.nKey );
412 CPPUNIT_ASSERT( it->nVal == v2.nVal );
413 CPPUNIT_ASSERT( ++it != lref.end() );
414 CPPUNIT_ASSERT( it->nKey == v1.nKey );
415 CPPUNIT_ASSERT( it->nVal == v1.nVal );
416 CPPUNIT_ASSERT( ++it != l.end() );
417 CPPUNIT_ASSERT( it->nKey == v3.nKey );
418 CPPUNIT_ASSERT( it->nVal == v3.nVal );
419 CPPUNIT_ASSERT( ++it == l.end() );
423 // Apply retired pointer
424 OrdList::gc::force_dispose();
426 CPPUNIT_ASSERT( v1.s.nDisposeCount == 4 );
427 CPPUNIT_ASSERT( v2.s.nDisposeCount == 3 );
428 CPPUNIT_ASSERT( v3.s.nDisposeCount == 4 );
431 template <class OrdList>
434 test_int_common<OrdList>();
437 typename OrdList::guarded_ptr gp;
439 static int const nLimit = 20;
440 typename OrdList::value_type arrItem[nLimit];
444 for (int i = 0; i < nLimit; ++i)
446 std::random_shuffle( a, a + nLimit );
448 for (int i = 0; i < nLimit; ++i) {
449 arrItem[i].nKey = a[i];
450 arrItem[i].nVal = a[i] * 2;
454 for ( int i = 0; i < nLimit; ++i )
455 CPPUNIT_ASSERT( l.insert( arrItem[i] ) );
457 for ( int i=0; i < nLimit; ++i ) {
458 gp = l.get( arrItem[i].nKey );
459 CPPUNIT_ASSERT( gp );
460 CPPUNIT_ASSERT( !gp.empty());
461 CPPUNIT_ASSERT( gp->nKey == arrItem[i].nKey );
462 CPPUNIT_ASSERT( gp->nVal == arrItem[i].nVal );
464 gp = l.extract( arrItem[i].nKey );
465 CPPUNIT_ASSERT( gp );
466 CPPUNIT_ASSERT( !gp.empty());
467 CPPUNIT_ASSERT( gp->nKey == arrItem[i].nKey );
468 CPPUNIT_ASSERT( gp->nVal == arrItem[i].nVal );
470 gp = l.get( arrItem[i].nKey );
471 CPPUNIT_ASSERT( !gp );
472 CPPUNIT_ASSERT( gp.empty());
473 CPPUNIT_ASSERT( !l.extract( arrItem[i].nKey ));
474 CPPUNIT_ASSERT( gp.empty());
476 CPPUNIT_ASSERT( l.empty() );
477 CPPUNIT_ASSERT( !l.get( nLimit/2 ));
478 CPPUNIT_ASSERT( !l.extract( nLimit/2 ));
480 // Apply retired pointer
481 OrdList::gc::force_dispose();
483 // extract_with/get_with
484 for ( int i = 0; i < nLimit; ++i )
485 CPPUNIT_ASSERT( l.insert( arrItem[i] ) );
487 for ( int i=0; i < nLimit; ++i ) {
488 other_item itm( arrItem[i].nKey );
489 gp = l.get_with( itm, other_less() );
490 CPPUNIT_ASSERT( gp );
491 CPPUNIT_ASSERT( !gp.empty());
492 CPPUNIT_ASSERT( gp->nKey == arrItem[i].nKey );
493 CPPUNIT_ASSERT( gp->nVal == arrItem[i].nVal );
495 gp = l.extract_with( itm, other_less() );
496 CPPUNIT_ASSERT( gp );
497 CPPUNIT_ASSERT( !gp.empty());
498 CPPUNIT_ASSERT( gp->nKey == arrItem[i].nKey );
499 CPPUNIT_ASSERT( gp->nVal == arrItem[i].nVal );
501 gp = l.get_with( itm, other_less() );
502 CPPUNIT_ASSERT( !gp );
503 CPPUNIT_ASSERT( gp.empty());
504 CPPUNIT_ASSERT( !l.extract_with( itm, other_less() ));
505 CPPUNIT_ASSERT( gp.empty());
507 CPPUNIT_ASSERT( l.empty() );
508 CPPUNIT_ASSERT( !l.get_with( other_item(nLimit/2), other_less() ));
509 CPPUNIT_ASSERT( gp.empty());
510 CPPUNIT_ASSERT( !l.extract_with( other_item(nLimit/2), other_less() ));
511 CPPUNIT_ASSERT( gp.empty());
513 // Apply retired pointer
514 OrdList::gc::force_dispose();
516 for ( int i=0; i < nLimit; i++ ) {
517 CPPUNIT_ASSERT( arrItem[i].s.nDisposeCount == 2 );
522 template <class OrdList>
525 test_int_common<OrdList>();
528 static int const nLimit = 20;
529 typename OrdList::value_type arrItem[nLimit];
531 typedef typename OrdList::rcu_lock rcu_lock;
532 typedef typename OrdList::value_type value_type;
533 typedef typename OrdList::gc rcu_type;
537 for (int i = 0; i < nLimit; ++i)
539 std::random_shuffle( a, a + nLimit );
541 for (int i = 0; i < nLimit; ++i) {
542 arrItem[i].nKey = a[i];
543 arrItem[i].nVal = a[i] * 2;
546 typename OrdList::exempt_ptr ep;
549 for ( int i = 0; i < nLimit; ++i )
550 CPPUNIT_ASSERT( l.insert( arrItem[i] ) );
552 for ( int i = 0; i < nLimit; ++i ) {
555 value_type * pGet = l.get( a[i] );
556 CPPUNIT_ASSERT( pGet != nullptr );
557 CPPUNIT_CHECK( pGet->nKey == a[i] );
558 CPPUNIT_CHECK( pGet->nVal == a[i] * 2 );
560 ep = l.extract( a[i] );
561 CPPUNIT_ASSERT( ep );
562 CPPUNIT_ASSERT( !ep.empty() );
563 CPPUNIT_CHECK( ep->nKey == a[i] );
564 CPPUNIT_CHECK( (*ep).nVal == a[i] * 2 );
569 CPPUNIT_CHECK( l.get( a[i] ) == nullptr );
570 CPPUNIT_CHECK( !l.extract( a[i] ) );
571 CPPUNIT_CHECK( ep.empty() );
574 CPPUNIT_ASSERT( l.empty() );
578 CPPUNIT_CHECK( l.get( a[0] ) == nullptr );
579 ep = l.extract( a[0] );
580 CPPUNIT_CHECK( !ep );
581 CPPUNIT_CHECK( ep.empty() );
583 // Apply retired pointer
584 OrdList::gc::force_dispose();
586 // extract_with/get_with
587 for ( int i = 0; i < nLimit; ++i ) {
588 CPPUNIT_ASSERT( l.insert( arrItem[i] ) );
591 for ( int i = 0; i < nLimit; ++i ) {
592 other_item itm( a[i] );
595 value_type * pGet = l.get_with( itm, other_less() );
596 CPPUNIT_ASSERT( pGet != nullptr );
597 CPPUNIT_CHECK( pGet->nKey == a[i] );
598 CPPUNIT_CHECK( pGet->nVal == a[i] * 2 );
600 ep = l.extract_with( itm, other_less() );
601 CPPUNIT_ASSERT( ep );
602 CPPUNIT_ASSERT( !ep.empty() );
603 CPPUNIT_CHECK( ep->nKey == a[i] );
604 CPPUNIT_CHECK( ep->nVal == a[i] * 2 );
609 CPPUNIT_CHECK( l.get_with( itm, other_less() ) == nullptr );
610 ep = l.extract_with( itm, other_less() );
611 CPPUNIT_CHECK( !ep );
612 CPPUNIT_CHECK( ep.empty() );
615 CPPUNIT_ASSERT( l.empty() );
619 CPPUNIT_CHECK( l.get_with( other_item( 0 ), other_less() ) == nullptr );
620 CPPUNIT_CHECK( !l.extract_with( other_item(0), other_less() ));
621 CPPUNIT_CHECK( ep.empty() );
623 // Apply retired pointer
624 OrdList::gc::force_dispose();
628 template <class OrdList>
631 typedef typename OrdList::value_type value_type;
633 value_type v1( 10, 50 );
634 value_type v2( 5, 25 );
635 value_type v3( 20, 100 );
638 CPPUNIT_ASSERT( l.empty() );
640 CPPUNIT_ASSERT( l.insert( v1 )) ; // true
641 CPPUNIT_ASSERT( l.find( v1.key() ) == &v1 );
643 CPPUNIT_ASSERT( v1.s.nFindCall == 0 );
644 CPPUNIT_ASSERT( l.find( v1.key(), find_functor() ));
645 CPPUNIT_ASSERT( v1.s.nFindCall == 1 );
647 CPPUNIT_ASSERT( l.find_with( v2.key(), less<value_type>() ) == nullptr );
648 CPPUNIT_ASSERT( l.find( v3.key() ) == nullptr );
649 CPPUNIT_ASSERT( !l.empty() );
651 //CPPUNIT_ASSERT( !l.insert( v1 )) ; // assertion "is_empty" is raised
655 CPPUNIT_ASSERT( !l.insert( v )) ; // false
658 std::pair<bool, bool> ret = l.ensure( v2, ensure_functor() );
659 CPPUNIT_ASSERT( ret.first );
660 CPPUNIT_ASSERT( ret.second );
661 CPPUNIT_ASSERT( v2.s.nEnsureNewCall == 1 );
662 CPPUNIT_ASSERT( v2.s.nEnsureExistsCall == 0 );
664 //CPPUNIT_ASSERT( !l.insert( v2 )) ; // assertion "is_empty"
666 CPPUNIT_ASSERT( l.find( v1.key() ) == &v1 ) ; // true
668 CPPUNIT_ASSERT( v1.s.nFindCall == 1 );
669 CPPUNIT_ASSERT( l.find( v1.key(), find_functor() ));
670 CPPUNIT_ASSERT( v1.s.nFindCall == 2 );
672 CPPUNIT_ASSERT( l.find_with( v2.key(), less<value_type>() ) == &v2 );
674 CPPUNIT_ASSERT( v2.s.nFindCall == 0 );
675 CPPUNIT_ASSERT( l.find_with( v2.key(), less<value_type>(), find_functor() ));
676 CPPUNIT_ASSERT( v2.s.nFindCall == 1 );
678 CPPUNIT_ASSERT( !l.find( v3.key() ));
682 ret = l.ensure( v, ensure_functor() );
684 CPPUNIT_ASSERT( ret.first );
685 CPPUNIT_ASSERT( !ret.second );
686 CPPUNIT_ASSERT( v2.s.nEnsureExistsCall == 1 );
687 CPPUNIT_ASSERT( v.s.nEnsureExistsCall == 0 && v.s.nEnsureNewCall == 0 );
690 CPPUNIT_ASSERT( !l.empty() );
692 CPPUNIT_ASSERT( l.insert( v3 )) ; // true
693 CPPUNIT_ASSERT( l.find( v3.key() ) == &v3 );
695 CPPUNIT_ASSERT( v3.s.nFindCall == 0 );
696 CPPUNIT_ASSERT( l.find( v3.key(), find_functor() ));
697 CPPUNIT_ASSERT( v3.s.nFindCall == 1 );
700 typename OrdList::iterator it = l.begin();
701 typename OrdList::const_iterator cit = l.cbegin();
702 CPPUNIT_ASSERT( it != l.end() );
703 CPPUNIT_ASSERT( it != l.cend() );
704 CPPUNIT_ASSERT( cit != l.end() );
705 CPPUNIT_ASSERT( cit != l.cend() );
706 CPPUNIT_ASSERT( cit == it );
708 CPPUNIT_ASSERT( it->nKey == v2.nKey );
709 CPPUNIT_ASSERT( it->nVal == v2.nVal );
710 CPPUNIT_ASSERT( ++it != l.end() );
711 CPPUNIT_ASSERT( it->nKey == v1.nKey );
712 CPPUNIT_ASSERT( it->nVal == v1.nVal );
713 CPPUNIT_ASSERT( it++ != l.end() );
714 CPPUNIT_ASSERT( it->nKey == v3.nKey );
715 CPPUNIT_ASSERT( it->nVal == v3.nVal );
716 CPPUNIT_ASSERT( it++ != l.end() );
717 CPPUNIT_ASSERT( it == l.end() );
721 OrdList const & lref = l;
722 typename OrdList::const_iterator it = lref.begin();
723 CPPUNIT_ASSERT( it != l.end() );
724 CPPUNIT_ASSERT( it->nKey == v2.nKey );
725 CPPUNIT_ASSERT( it->nVal == v2.nVal );
726 CPPUNIT_ASSERT( ++it != lref.end() );
727 CPPUNIT_ASSERT( it->nKey == v1.nKey );
728 CPPUNIT_ASSERT( it->nVal == v1.nVal );
729 CPPUNIT_ASSERT( it++ != l.end() );
730 CPPUNIT_ASSERT( it->nKey == v3.nKey );
731 CPPUNIT_ASSERT( it->nVal == v3.nVal );
732 CPPUNIT_ASSERT( it++ != lref.end() );
733 CPPUNIT_ASSERT( it == l.end() );
737 // Disposer called on list destruction
738 CPPUNIT_ASSERT( v1.s.nDisposeCount == 1 );
739 CPPUNIT_ASSERT( v2.s.nDisposeCount == 1 );
740 CPPUNIT_ASSERT( v3.s.nDisposeCount == 1 );
746 void HP_base_cmpmix();
748 void HP_member_cmp();
749 void HP_member_less();
750 void HP_member_cmpmix();
754 void DHP_base_less();
755 void DHP_base_cmpmix();
757 void DHP_member_cmp();
758 void DHP_member_less();
759 void DHP_member_cmpmix();
760 void DHP_member_ic();
762 void RCU_GPI_base_cmp();
763 void RCU_GPI_base_less();
764 void RCU_GPI_base_cmpmix();
765 void RCU_GPI_base_ic();
766 void RCU_GPI_member_cmp();
767 void RCU_GPI_member_less();
768 void RCU_GPI_member_cmpmix();
769 void RCU_GPI_member_ic();
771 void RCU_GPB_base_cmp();
772 void RCU_GPB_base_less();
773 void RCU_GPB_base_cmpmix();
774 void RCU_GPB_base_ic();
775 void RCU_GPB_member_cmp();
776 void RCU_GPB_member_less();
777 void RCU_GPB_member_cmpmix();
778 void RCU_GPB_member_ic();
780 void RCU_GPT_base_cmp();
781 void RCU_GPT_base_less();
782 void RCU_GPT_base_cmpmix();
783 void RCU_GPT_base_ic();
784 void RCU_GPT_member_cmp();
785 void RCU_GPT_member_less();
786 void RCU_GPT_member_cmpmix();
787 void RCU_GPT_member_ic();
789 void RCU_SHB_base_cmp();
790 void RCU_SHB_base_less();
791 void RCU_SHB_base_cmpmix();
792 void RCU_SHB_base_ic();
793 void RCU_SHB_member_cmp();
794 void RCU_SHB_member_less();
795 void RCU_SHB_member_cmpmix();
796 void RCU_SHB_member_ic();
798 void RCU_SHT_base_cmp();
799 void RCU_SHT_base_less();
800 void RCU_SHT_base_cmpmix();
801 void RCU_SHT_base_ic();
802 void RCU_SHT_member_cmp();
803 void RCU_SHT_member_less();
804 void RCU_SHT_member_cmpmix();
805 void RCU_SHT_member_ic();
807 void nogc_base_cmp();
808 void nogc_base_less();
809 void nogc_base_cmpmix();
811 void nogc_member_cmp();
812 void nogc_member_less();
813 void nogc_member_cmpmix();
814 void nogc_member_ic();
817 CPPUNIT_TEST_SUITE(IntrusiveLazyListHeaderTest)
818 CPPUNIT_TEST(HP_base_cmp)
819 CPPUNIT_TEST(HP_base_less)
820 CPPUNIT_TEST(HP_base_cmpmix)
821 CPPUNIT_TEST(HP_base_ic)
822 CPPUNIT_TEST(HP_member_cmp)
823 CPPUNIT_TEST(HP_member_less)
824 CPPUNIT_TEST(HP_member_cmpmix)
825 CPPUNIT_TEST(HP_member_ic)
827 CPPUNIT_TEST(DHP_base_cmp)
828 CPPUNIT_TEST(DHP_base_less)
829 CPPUNIT_TEST(DHP_base_cmpmix)
830 CPPUNIT_TEST(DHP_base_ic)
831 CPPUNIT_TEST(DHP_member_cmp)
832 CPPUNIT_TEST(DHP_member_less)
833 CPPUNIT_TEST(DHP_member_cmpmix)
834 CPPUNIT_TEST(DHP_member_ic)
836 CPPUNIT_TEST(RCU_GPI_base_cmp)
837 CPPUNIT_TEST(RCU_GPI_base_less)
838 CPPUNIT_TEST(RCU_GPI_base_cmpmix)
839 CPPUNIT_TEST(RCU_GPI_base_ic)
840 CPPUNIT_TEST(RCU_GPI_member_cmp)
841 CPPUNIT_TEST(RCU_GPI_member_less)
842 CPPUNIT_TEST(RCU_GPI_member_cmpmix)
843 CPPUNIT_TEST(RCU_GPI_member_ic)
845 CPPUNIT_TEST(RCU_GPB_base_cmp)
846 CPPUNIT_TEST(RCU_GPB_base_less)
847 CPPUNIT_TEST(RCU_GPB_base_cmpmix)
848 CPPUNIT_TEST(RCU_GPB_base_ic)
849 CPPUNIT_TEST(RCU_GPB_member_cmp)
850 CPPUNIT_TEST(RCU_GPB_member_less)
851 CPPUNIT_TEST(RCU_GPB_member_cmpmix)
852 CPPUNIT_TEST(RCU_GPB_member_ic)
854 CPPUNIT_TEST(RCU_GPT_base_cmp)
855 CPPUNIT_TEST(RCU_GPT_base_less)
856 CPPUNIT_TEST(RCU_GPT_base_cmpmix)
857 CPPUNIT_TEST(RCU_GPT_base_ic)
858 CPPUNIT_TEST(RCU_GPT_member_cmp)
859 CPPUNIT_TEST(RCU_GPT_member_less)
860 CPPUNIT_TEST(RCU_GPT_member_cmpmix)
861 CPPUNIT_TEST(RCU_GPT_member_ic)
863 CPPUNIT_TEST(RCU_SHB_base_cmp)
864 CPPUNIT_TEST(RCU_SHB_base_less)
865 CPPUNIT_TEST(RCU_SHB_base_cmpmix)
866 CPPUNIT_TEST(RCU_SHB_base_ic)
867 CPPUNIT_TEST(RCU_SHB_member_cmp)
868 CPPUNIT_TEST(RCU_SHB_member_less)
869 CPPUNIT_TEST(RCU_SHB_member_cmpmix)
870 CPPUNIT_TEST(RCU_SHB_member_ic)
872 CPPUNIT_TEST(RCU_SHT_base_cmp)
873 CPPUNIT_TEST(RCU_SHT_base_less)
874 CPPUNIT_TEST(RCU_SHT_base_cmpmix)
875 CPPUNIT_TEST(RCU_SHT_base_ic)
876 CPPUNIT_TEST(RCU_SHT_member_cmp)
877 CPPUNIT_TEST(RCU_SHT_member_less)
878 CPPUNIT_TEST(RCU_SHT_member_cmpmix)
879 CPPUNIT_TEST(RCU_SHT_member_ic)
881 CPPUNIT_TEST(nogc_base_cmp)
882 CPPUNIT_TEST(nogc_base_less)
883 CPPUNIT_TEST(nogc_base_cmpmix)
884 CPPUNIT_TEST(nogc_base_ic)
885 CPPUNIT_TEST(nogc_member_cmp)
886 CPPUNIT_TEST(nogc_member_less)
887 CPPUNIT_TEST(nogc_member_cmpmix)
888 CPPUNIT_TEST(nogc_member_ic)
890 CPPUNIT_TEST_SUITE_END()
892 } // namespace ordlist