issue#11: tests/test-hdr: changed .h file guard prefix to CDSTEST_xxx
[libcds.git] / tests / test-hdr / set / hdr_intrusive_set.h
index e58bbd61764133254b16fc7682c228a9b9b0cf28..48ed8c98c638f8a850235fd6e5c64f35d0f2a6ab 100644 (file)
@@ -1,5 +1,8 @@
 //$$CDS-header$$
 
+#ifndef CDSTEST_HDR_INTRUSIVE_SET_H
+#define CDSTEST_HDR_INTRUSIVE_SET_H
+
 #include "cppunit/cppunit_proxy.h"
 #include "size_check.h"
 
@@ -51,7 +54,8 @@ namespace set {
             {}
 
             base_int_item(const base_int_item& v )
-                : stat()
+                : Node()
+                , stat()
                 , nKey( v.nKey )
                 , nVal( v.nVal )
             {}
@@ -193,7 +197,7 @@ namespace set {
         struct find_functor
         {
             template <typename Item, typename T>
-            void operator()( Item& item, T& val )
+            void operator()( Item& item, T& /*val*/ )
             {
                 ++item.nFindCount;
             }
@@ -211,7 +215,7 @@ namespace set {
         struct ensure_functor
         {
             template <typename Item>
-            void operator()( bool bNew, Item& item, Item& val )
+            void operator()( bool bNew, Item& item, Item& /*val*/ )
             {
                 if ( bNew )
                     ++item.nEnsureNewCount;
@@ -503,43 +507,51 @@ namespace set {
                 guarded_ptr gp;
                 for ( size_t i = 0; i < nLimit; i += 2 ) {
                     int nKey = arr[i];
-                    CPPUNIT_ASSERT( s.get( gp, nKey ));
+                    gp = s.get( nKey );
+                    CPPUNIT_ASSERT( gp );
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->nKey == nKey );
                     CPPUNIT_CHECK( gp->nVal == nKey * 2 );
+                    gp.release();
 
-                    CPPUNIT_ASSERT( s.extract( gp, nKey ));
+                    gp = s.extract( nKey );
+                    CPPUNIT_ASSERT( gp );
                     CPPUNIT_ASSERT( !gp.empty() );
                     CPPUNIT_CHECK( gp->nKey == nKey );
                     CPPUNIT_CHECK( gp->nVal == nKey * 2 );
                     gp.release();
 
-                    CPPUNIT_CHECK( !s.get( gp, nKey ));
+                    gp = s.get( nKey );
+                    CPPUNIT_CHECK( !gp );
                     CPPUNIT_ASSERT( gp.empty() );
-                    CPPUNIT_CHECK( !s.extract( gp, nKey ));
+                    CPPUNIT_CHECK( !s.extract( nKey ));
                     CPPUNIT_CHECK( gp.empty() );
 
                     nKey = arr[i+1];
-                    CPPUNIT_ASSERT( s.get_with( gp, nKey, less<value_type>() ));
+                    gp = s.get_with( nKey, less<value_type>() );
+                    CPPUNIT_ASSERT( gp );
                     CPPUNIT_CHECK( gp->nKey == nKey );
                     CPPUNIT_CHECK( gp->nVal == nKey * 2 );
+                    gp.release();
 
-                    CPPUNIT_ASSERT( s.extract_with( gp, nKey, less<value_type>() ));
+                    gp = s.extract_with( nKey, less<value_type>() );
+                    CPPUNIT_ASSERT( gp );
                     CPPUNIT_ASSERT( !gp.empty() );
                     CPPUNIT_CHECK( gp->nKey == nKey );
                     CPPUNIT_CHECK( gp->nVal == nKey * 2 );
                     gp.release();
 
-                    CPPUNIT_CHECK( !s.get_with( gp, nKey, less<value_type>() ));
+                    gp = s.get_with( nKey, less<value_type>() );
+                    CPPUNIT_CHECK( !gp );
                     CPPUNIT_CHECK( gp.empty());
-                    CPPUNIT_CHECK( !s.extract_with( gp, nKey, less<value_type>() ));
+                    CPPUNIT_CHECK( !s.extract_with( nKey, less<value_type>() ));
                     CPPUNIT_CHECK( gp.empty());
                 }
                 CPPUNIT_CHECK( s.empty() );
                 CPPUNIT_CHECK( check_size( s, 0 ));
 
-                CPPUNIT_CHECK( !s.get( gp, 100 ));
-                CPPUNIT_CHECK( !s.extract( gp, 100 ));
+                CPPUNIT_CHECK( !s.get( 100 ));
+                CPPUNIT_CHECK( !s.extract( 100 ));
                 CPPUNIT_CHECK( gp.empty() );
 
                 Set::gc::force_dispose();
@@ -1031,7 +1043,8 @@ namespace set {
                         CPPUNIT_CHECK( pVal->nKey == nKey );
                         CPPUNIT_CHECK( pVal->nVal == nKey * 2 );
 
-                        CPPUNIT_ASSERT( s.extract( ep, nKey ));
+                        ep = s.extract( nKey );
+                        CPPUNIT_ASSERT( ep );
                         CPPUNIT_ASSERT( !ep.empty() );
                         CPPUNIT_CHECK( pVal->nKey == ep->nKey );
                         CPPUNIT_CHECK( pVal->nVal == (*ep).nVal );
@@ -1040,7 +1053,7 @@ namespace set {
                     {
                         rcu_lock l;
                         CPPUNIT_CHECK( s.get( nKey ) == nullptr );
-                        CPPUNIT_CHECK( !s.extract( ep, nKey ));
+                        CPPUNIT_CHECK( !s.extract( nKey ));
                         CPPUNIT_CHECK( ep.empty() );
 
                         nKey = arr[i+1];
@@ -1049,7 +1062,8 @@ namespace set {
                         CPPUNIT_CHECK( pVal->nKey == nKey );
                         CPPUNIT_CHECK( pVal->nVal == nKey * 2 );
 
-                        CPPUNIT_ASSERT( s.extract_with( ep, nKey, less<value_type>() ));
+                        ep = s.extract_with( nKey, less<value_type>() );
+                        CPPUNIT_ASSERT( ep );
                         CPPUNIT_ASSERT( !ep.empty() );
                         CPPUNIT_CHECK( pVal->nKey == ep->nKey );
                         CPPUNIT_CHECK( pVal->nVal == (*ep).nVal );
@@ -1058,7 +1072,8 @@ namespace set {
                     {
                         rcu_lock l;
                         CPPUNIT_CHECK( s.get_with( nKey, less<value_type>() ) == nullptr );
-                        CPPUNIT_CHECK( !s.extract_with( ep, nKey, less<value_type>() ));
+                        ep = s.extract_with( nKey, less<value_type>() );
+                        CPPUNIT_CHECK( !ep );
                         CPPUNIT_CHECK( ep.empty() );
                     }
                 }
@@ -1067,7 +1082,8 @@ namespace set {
                 {
                     rcu_lock l;
                     CPPUNIT_CHECK( s.get( 100 ) == nullptr );
-                    CPPUNIT_CHECK( !s.extract( ep, 100 ));
+                    ep = s.extract( 100 );
+                    CPPUNIT_CHECK( !ep );
                     CPPUNIT_CHECK( ep.empty() );
                 }
 
@@ -1853,3 +1869,5 @@ namespace set {
     };
 
 }   // namespace set
+
+#endif // #ifndef CDSTEST_HDR_INTRUSIVE_SET_H
\ No newline at end of file