issue#11: tests/test-hdr: changed .h file guard prefix to CDSTEST_xxx
[libcds.git] / tests / test-hdr / set / hdr_skiplist_set.h
index 706e3c8d86c3c720d5943b8a8338e98ae4a03ca6..73317055188731d8a7412f9d03d4707eca1b6892 100644 (file)
@@ -1,5 +1,8 @@
 //$$CDS-header$$
 
+#ifndef CDSTEST_HDR_SKIPLIST_SET_H
+#define CDSTEST_HDR_SKIPLIST_SET_H
+
 #include "set/hdr_set.h"
 
 namespace set {
@@ -36,12 +39,14 @@ namespace set {
             CPPUNIT_ASSERT( s.empty() );
 
             for ( int i = 0; i < nLimit; ++i ) {
-                CPPUNIT_CHECK( !s.get(gp, i) );
+                gp = s.get( i );
+                CPPUNIT_CHECK( !gp );
                 CPPUNIT_CHECK( gp.empty() );
 
                 CPPUNIT_ASSERT( s.insert(i) );
 
-                CPPUNIT_CHECK( s.get(gp, i));
+                gp = s.get( i );
+                CPPUNIT_CHECK( gp );
                 CPPUNIT_ASSERT( !gp.empty());
                 CPPUNIT_CHECK( gp->nKey == i );
                 CPPUNIT_CHECK( gp->nVal == i );
@@ -62,7 +67,8 @@ namespace set {
                 nPrevKey = it->nKey;
 
                 // get
-                CPPUNIT_CHECK( s.get( gp, it->nKey ));
+                gp = s.get( it->nKey );
+                CPPUNIT_CHECK( gp );
                 CPPUNIT_ASSERT( !gp.empty() );
                 CPPUNIT_CHECK( gp->nKey == it->nKey );
                 CPPUNIT_CHECK( gp->nVal == it->nKey * 2 );
@@ -86,13 +92,15 @@ namespace set {
             CPPUNIT_ASSERT( s.empty() );
 
             for ( int i = nLimit; i > 0; --i ) {
-                CPPUNIT_CHECK( !s.get_with(gp, i-1, base_class::less<typename Set::value_type>() ) );
+                gp = s.get_with( i - 1, base_class::less<typename Set::value_type>());
+                CPPUNIT_CHECK( !gp );
                 CPPUNIT_CHECK( gp.empty() );
 
                 CPPUNIT_ASSERT( s.insert( std::make_pair(i - 1, (i-1) * 2) ));
 
                 // get_with
-                CPPUNIT_CHECK( s.get_with(gp, i-1, base_class::less<typename Set::value_type>() ));
+                gp = s.get_with( i - 1, base_class::less<typename Set::value_type>());
+                CPPUNIT_CHECK( gp );
                 CPPUNIT_ASSERT( !gp.empty());
                 CPPUNIT_CHECK( gp->nKey == i-1 );
                 CPPUNIT_CHECK( gp->nVal == (i-1) * 2 );
@@ -167,22 +175,24 @@ namespace set {
                 // extract/get
                 for ( int i = 0; i < nLimit; ++i ) {
                     int nKey = arrRandom[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));
-                    CPPUNIT_ASSERT( gp.empty());
-                    CPPUNIT_ASSERT( !s.extract(gp, nKey));
+                    gp = s.get( nKey );
+                    CPPUNIT_CHECK( !gp );
                     CPPUNIT_ASSERT( gp.empty());
+                    CPPUNIT_ASSERT( !s.extract(nKey));
                 }
                 CPPUNIT_ASSERT( s.empty() );
 
@@ -192,19 +202,23 @@ namespace set {
 
                 for ( int i = 0; i < nLimit; ++i ) {
                     int nKey = arrRandom[i];
-                    CPPUNIT_ASSERT( s.get_with(gp, wrapped_item(nKey), wrapped_less() ));
+                    gp = s.get_with( wrapped_item( nKey ), wrapped_less());
+                    CPPUNIT_ASSERT( gp );
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->nKey == nKey );
                     CPPUNIT_CHECK( gp->nVal == nKey );
                     gp.release();
 
-                    CPPUNIT_ASSERT( s.extract_with(gp, wrapped_item(nKey), wrapped_less() ));
+                    gp = s.extract_with( wrapped_item( nKey ), wrapped_less());
+                    CPPUNIT_ASSERT( gp );
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->nKey == nKey );
                     CPPUNIT_CHECK( gp->nVal == nKey );
-                    CPPUNIT_CHECK( !s.get_with(gp, wrapped_item(nKey), wrapped_less() ));
-                    CPPUNIT_ASSERT( !s.extract_with(gp, wrapped_item(nKey), wrapped_less() ));
                     gp.release();
+
+                    gp = s.get_with( wrapped_item( nKey ), wrapped_less());
+                    CPPUNIT_CHECK( !gp );
+                    CPPUNIT_ASSERT( !s.extract_with( wrapped_item(nKey), wrapped_less() ));
                 }
                 CPPUNIT_ASSERT( s.empty() );
 
@@ -213,36 +227,38 @@ namespace set {
                     CPPUNIT_ASSERT( s.insert( arrRandom[i]) );
 
                 for ( int i = 0; i < nLimit; ++i ) {
-                    CPPUNIT_ASSERT( s.extract_min(gp));
+                    gp = s.extract_min();
+                    CPPUNIT_ASSERT( gp );
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->nKey == i );
                     CPPUNIT_CHECK( gp->nVal == i );
-                    CPPUNIT_CHECK( !s.get(gp, i ));
                     gp.release();
+
+                    gp = s.get( i );
+                    CPPUNIT_CHECK( !gp );
                 }
                 CPPUNIT_ASSERT( s.empty() );
-                CPPUNIT_CHECK( !s.extract_min(gp));
-                CPPUNIT_ASSERT( gp.empty() );
-                CPPUNIT_CHECK( !s.extract_max(gp));
-                CPPUNIT_ASSERT( gp.empty() );
+                CPPUNIT_CHECK( !s.extract_min());
+                CPPUNIT_CHECK( !s.extract_max());
 
                 // extract_max
                 for ( int i = 0; i < nLimit; ++i )
                     CPPUNIT_ASSERT( s.insert( arrRandom[i]) );
 
                 for ( int i = nLimit-1; i >= 0; --i ) {
-                    CPPUNIT_ASSERT( s.extract_max(gp));
+                    gp = s.extract_max();
+                    CPPUNIT_ASSERT( gp );
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->nKey == i );
                     CPPUNIT_CHECK( gp->nVal == i );
-                    CPPUNIT_CHECK( !s.get(gp, i ));
                     gp.release();
+
+                    gp = s.get( i );
+                    CPPUNIT_CHECK( !gp );
                 }
                 CPPUNIT_ASSERT( s.empty() );
-                CPPUNIT_CHECK( !s.extract_min(gp));
-                CPPUNIT_ASSERT( gp.empty() );
-                CPPUNIT_CHECK( !s.extract_max(gp));
-                CPPUNIT_ASSERT( gp.empty() );
+                CPPUNIT_CHECK( !s.extract_min());
+                CPPUNIT_CHECK( !s.extract_max());
             }
 
             CPPUNIT_MSG( PrintStat()(s, nullptr) );
@@ -329,7 +345,6 @@ namespace set {
             CPPUNIT_ASSERT( it->key() == 50 );
             CPPUNIT_ASSERT( it->val() == 25 );
 
-#       ifdef CDS_EMPLACE_SUPPORT
             // emplace test
             it = s.emplace( 151 ) ;  // key = 151,  val = 151
             CPPUNIT_ASSERT( it != s.end() );
@@ -360,7 +375,6 @@ namespace set {
             CPPUNIT_ASSERT( it != s.end() );
             CPPUNIT_ASSERT( it->key() == 151 );
             CPPUNIT_ASSERT( it->val() == 151 );
-#       endif
 
             CPPUNIT_ASSERT( !s.empty() );
             s.clear();
@@ -433,55 +447,30 @@ namespace set {
         void SkipList_HP_michaelalloc_cmp_stat();
         void SkipList_HP_michaelalloc_cmpless_stat();
 
-        void SkipList_HRC_less();
-        void SkipList_HRC_cmp();
-        void SkipList_HRC_cmpless();
-        void SkipList_HRC_less_stat();
-        void SkipList_HRC_cmp_stat();
-        void SkipList_HRC_cmpless_stat();
-        void SkipList_HRC_xorshift_less();
-        void SkipList_HRC_xorshift_cmp();
-        void SkipList_HRC_xorshift_cmpless();
-        void SkipList_HRC_xorshift_less_stat();
-        void SkipList_HRC_xorshift_cmp_stat();
-        void SkipList_HRC_xorshift_cmpless_stat();
-        void SkipList_HRC_turbopas_less();
-        void SkipList_HRC_turbopas_cmp();
-        void SkipList_HRC_turbopas_cmpless();
-        void SkipList_HRC_turbopas_less_stat();
-        void SkipList_HRC_turbopas_cmp_stat();
-        void SkipList_HRC_turbopas_cmpless_stat();
-        void SkipList_HRC_michaelalloc_less();
-        void SkipList_HRC_michaelalloc_cmp();
-        void SkipList_HRC_michaelalloc_cmpless();
-        void SkipList_HRC_michaelalloc_less_stat();
-        void SkipList_HRC_michaelalloc_cmp_stat();
-        void SkipList_HRC_michaelalloc_cmpless_stat();
-
-        void SkipList_PTB_less();
-        void SkipList_PTB_cmp();
-        void SkipList_PTB_cmpless();
-        void SkipList_PTB_less_stat();
-        void SkipList_PTB_cmp_stat();
-        void SkipList_PTB_cmpless_stat();
-        void SkipList_PTB_xorshift_less();
-        void SkipList_PTB_xorshift_cmp();
-        void SkipList_PTB_xorshift_cmpless();
-        void SkipList_PTB_xorshift_less_stat();
-        void SkipList_PTB_xorshift_cmp_stat();
-        void SkipList_PTB_xorshift_cmpless_stat();
-        void SkipList_PTB_turbopas_less();
-        void SkipList_PTB_turbopas_cmp();
-        void SkipList_PTB_turbopas_cmpless();
-        void SkipList_PTB_turbopas_less_stat();
-        void SkipList_PTB_turbopas_cmp_stat();
-        void SkipList_PTB_turbopas_cmpless_stat();
-        void SkipList_PTB_michaelalloc_less();
-        void SkipList_PTB_michaelalloc_cmp();
-        void SkipList_PTB_michaelalloc_cmpless();
-        void SkipList_PTB_michaelalloc_less_stat();
-        void SkipList_PTB_michaelalloc_cmp_stat();
-        void SkipList_PTB_michaelalloc_cmpless_stat();
+        void SkipList_DHP_less();
+        void SkipList_DHP_cmp();
+        void SkipList_DHP_cmpless();
+        void SkipList_DHP_less_stat();
+        void SkipList_DHP_cmp_stat();
+        void SkipList_DHP_cmpless_stat();
+        void SkipList_DHP_xorshift_less();
+        void SkipList_DHP_xorshift_cmp();
+        void SkipList_DHP_xorshift_cmpless();
+        void SkipList_DHP_xorshift_less_stat();
+        void SkipList_DHP_xorshift_cmp_stat();
+        void SkipList_DHP_xorshift_cmpless_stat();
+        void SkipList_DHP_turbopas_less();
+        void SkipList_DHP_turbopas_cmp();
+        void SkipList_DHP_turbopas_cmpless();
+        void SkipList_DHP_turbopas_less_stat();
+        void SkipList_DHP_turbopas_cmp_stat();
+        void SkipList_DHP_turbopas_cmpless_stat();
+        void SkipList_DHP_michaelalloc_less();
+        void SkipList_DHP_michaelalloc_cmp();
+        void SkipList_DHP_michaelalloc_cmpless();
+        void SkipList_DHP_michaelalloc_less_stat();
+        void SkipList_DHP_michaelalloc_cmp_stat();
+        void SkipList_DHP_michaelalloc_cmpless_stat();
 
         void SkipList_NOGC_less();
         void SkipList_NOGC_cmp();
@@ -534,55 +523,30 @@ namespace set {
             CPPUNIT_TEST(SkipList_HP_michaelalloc_cmp_stat)
             CPPUNIT_TEST(SkipList_HP_michaelalloc_cmpless_stat)
 
-            CPPUNIT_TEST(SkipList_HRC_less)
-            CPPUNIT_TEST(SkipList_HRC_cmp)
-            CPPUNIT_TEST(SkipList_HRC_cmpless)
-            CPPUNIT_TEST(SkipList_HRC_less_stat)
-            CPPUNIT_TEST(SkipList_HRC_cmp_stat)
-            CPPUNIT_TEST(SkipList_HRC_cmpless_stat)
-            CPPUNIT_TEST(SkipList_HRC_xorshift_less)
-            CPPUNIT_TEST(SkipList_HRC_xorshift_cmp)
-            CPPUNIT_TEST(SkipList_HRC_xorshift_cmpless)
-            CPPUNIT_TEST(SkipList_HRC_xorshift_less_stat)
-            CPPUNIT_TEST(SkipList_HRC_xorshift_cmp_stat)
-            CPPUNIT_TEST(SkipList_HRC_xorshift_cmpless_stat)
-            CPPUNIT_TEST(SkipList_HRC_turbopas_less)
-            CPPUNIT_TEST(SkipList_HRC_turbopas_cmp)
-            CPPUNIT_TEST(SkipList_HRC_turbopas_cmpless)
-            CPPUNIT_TEST(SkipList_HRC_turbopas_less_stat)
-            CPPUNIT_TEST(SkipList_HRC_turbopas_cmp_stat)
-            CPPUNIT_TEST(SkipList_HRC_turbopas_cmpless_stat)
-            CPPUNIT_TEST(SkipList_HRC_michaelalloc_less)
-            CPPUNIT_TEST(SkipList_HRC_michaelalloc_cmp)
-            CPPUNIT_TEST(SkipList_HRC_michaelalloc_cmpless)
-            CPPUNIT_TEST(SkipList_HRC_michaelalloc_less_stat)
-            CPPUNIT_TEST(SkipList_HRC_michaelalloc_cmp_stat)
-            CPPUNIT_TEST(SkipList_HRC_michaelalloc_cmpless_stat)
-
-            CPPUNIT_TEST(SkipList_PTB_less)
-            CPPUNIT_TEST(SkipList_PTB_cmp)
-            CPPUNIT_TEST(SkipList_PTB_cmpless)
-            CPPUNIT_TEST(SkipList_PTB_less_stat)
-            CPPUNIT_TEST(SkipList_PTB_cmp_stat)
-            CPPUNIT_TEST(SkipList_PTB_cmpless_stat)
-            CPPUNIT_TEST(SkipList_PTB_xorshift_less)
-            CPPUNIT_TEST(SkipList_PTB_xorshift_cmp)
-            CPPUNIT_TEST(SkipList_PTB_xorshift_cmpless)
-            CPPUNIT_TEST(SkipList_PTB_xorshift_less_stat)
-            CPPUNIT_TEST(SkipList_PTB_xorshift_cmp_stat)
-            CPPUNIT_TEST(SkipList_PTB_xorshift_cmpless_stat)
-            CPPUNIT_TEST(SkipList_PTB_turbopas_less)
-            CPPUNIT_TEST(SkipList_PTB_turbopas_cmp)
-            CPPUNIT_TEST(SkipList_PTB_turbopas_cmpless)
-            CPPUNIT_TEST(SkipList_PTB_turbopas_less_stat)
-            CPPUNIT_TEST(SkipList_PTB_turbopas_cmp_stat)
-            CPPUNIT_TEST(SkipList_PTB_turbopas_cmpless_stat)
-            CPPUNIT_TEST(SkipList_PTB_michaelalloc_less)
-            CPPUNIT_TEST(SkipList_PTB_michaelalloc_cmp)
-            CPPUNIT_TEST(SkipList_PTB_michaelalloc_cmpless)
-            CPPUNIT_TEST(SkipList_PTB_michaelalloc_less_stat)
-            CPPUNIT_TEST(SkipList_PTB_michaelalloc_cmp_stat)
-            CPPUNIT_TEST(SkipList_PTB_michaelalloc_cmpless_stat)
+            CPPUNIT_TEST(SkipList_DHP_less)
+            CPPUNIT_TEST(SkipList_DHP_cmp)
+            CPPUNIT_TEST(SkipList_DHP_cmpless)
+            CPPUNIT_TEST(SkipList_DHP_less_stat)
+            CPPUNIT_TEST(SkipList_DHP_cmp_stat)
+            CPPUNIT_TEST(SkipList_DHP_cmpless_stat)
+            CPPUNIT_TEST(SkipList_DHP_xorshift_less)
+            CPPUNIT_TEST(SkipList_DHP_xorshift_cmp)
+            CPPUNIT_TEST(SkipList_DHP_xorshift_cmpless)
+            CPPUNIT_TEST(SkipList_DHP_xorshift_less_stat)
+            CPPUNIT_TEST(SkipList_DHP_xorshift_cmp_stat)
+            CPPUNIT_TEST(SkipList_DHP_xorshift_cmpless_stat)
+            CPPUNIT_TEST(SkipList_DHP_turbopas_less)
+            CPPUNIT_TEST(SkipList_DHP_turbopas_cmp)
+            CPPUNIT_TEST(SkipList_DHP_turbopas_cmpless)
+            CPPUNIT_TEST(SkipList_DHP_turbopas_less_stat)
+            CPPUNIT_TEST(SkipList_DHP_turbopas_cmp_stat)
+            CPPUNIT_TEST(SkipList_DHP_turbopas_cmpless_stat)
+            CPPUNIT_TEST(SkipList_DHP_michaelalloc_less)
+            CPPUNIT_TEST(SkipList_DHP_michaelalloc_cmp)
+            CPPUNIT_TEST(SkipList_DHP_michaelalloc_cmpless)
+            CPPUNIT_TEST(SkipList_DHP_michaelalloc_less_stat)
+            CPPUNIT_TEST(SkipList_DHP_michaelalloc_cmp_stat)
+            CPPUNIT_TEST(SkipList_DHP_michaelalloc_cmpless_stat)
 
             CPPUNIT_TEST(SkipList_NOGC_less)
             CPPUNIT_TEST(SkipList_NOGC_cmp)
@@ -613,3 +577,5 @@ namespace set {
 
     };
 }
+
+#endif // #ifndef CDSTEST_HDR_SKIPLIST_SET_H