fix tests for guarded_ptr and exempt_ptr
authorkhizmax <khizmax@gmail.com>
Mon, 24 Nov 2014 10:27:34 +0000 (13:27 +0300)
committerkhizmax <khizmax@gmail.com>
Mon, 24 Nov 2014 10:27:34 +0000 (13:27 +0300)
13 files changed:
tests/test-hdr/map/hdr_map.h
tests/test-hdr/map/hdr_skiplist_map.h
tests/test-hdr/map/hdr_skiplist_map_rcu.h
tests/test-hdr/ordered_list/hdr_lazy.h
tests/test-hdr/ordered_list/hdr_lazy_kv.h
tests/test-hdr/ordered_list/hdr_michael.h
tests/test-hdr/ordered_list/hdr_michael_kv.h
tests/test-hdr/set/hdr_intrusive_set.h
tests/test-hdr/set/hdr_intrusive_skiplist_set.h
tests/test-hdr/set/hdr_intrusive_skiplist_set_rcu.h
tests/test-hdr/set/hdr_set.h
tests/test-hdr/set/hdr_skiplist_set.h
tests/test-hdr/set/hdr_skiplist_set_rcu.h

index 81462dd..1441b46 100644 (file)
@@ -214,12 +214,15 @@ namespace map {
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->first == nKey );
                     CPPUNIT_CHECK( gp->second.m_val == nKey );
+                    gp.release();
 
                     gp = m.extract( nKey );
                     CPPUNIT_ASSERT( gp );
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->first == nKey );
                     CPPUNIT_CHECK( gp->second.m_val == nKey );
+                    gp.release();
+
                     gp = m.get( nKey );
                     CPPUNIT_CHECK( !gp );
 
@@ -238,12 +241,15 @@ namespace map {
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->first == nKey );
                     CPPUNIT_CHECK( gp->second.m_val == nKey );
+                    gp.release();
 
                     gp = m.extract_with( other_item( nKey ), other_less() );
                     CPPUNIT_ASSERT( gp );
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->first == nKey );
                     CPPUNIT_CHECK( gp->second.m_val == nKey );
+                    gp.release();
+
                     gp = m.get_with( other_item( nKey ), other_less() );
                     CPPUNIT_CHECK( !gp );
 
index 1614529..7d5db32 100644 (file)
@@ -152,12 +152,14 @@ namespace map {
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->first == nKey );
                     CPPUNIT_CHECK( gp->second.m_val == nKey * 2 );
+                    gp.release();
 
                     gp = m.extract( nKey );
                     CPPUNIT_ASSERT( gp );
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->first == nKey );
                     CPPUNIT_CHECK( gp->second.m_val == nKey * 2 );
+                    gp.release();
 
                     gp = m.get( nKey );
                     CPPUNIT_CHECK( !gp );
@@ -177,12 +179,14 @@ namespace map {
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->first == nKey );
                     CPPUNIT_CHECK( gp->second.m_val == nKey * 2 );
+                    gp.release();
                     
                     gp = m.extract_with( wrapped_item( nKey ), wrapped_less());
                     CPPUNIT_ASSERT( gp );
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->first == nKey );
                     CPPUNIT_CHECK( gp->second.m_val == nKey * 2 );
+                    gp.release();
 
                     gp = m.get_with( wrapped_item( nKey ), wrapped_less() );
                     CPPUNIT_CHECK( !gp );
@@ -219,7 +223,7 @@ namespace map {
                     gp.release();
                     CPPUNIT_CHECK( gp.empty());
                 }
-                CPPUNIT_CHECK( m.extract_max());
+                CPPUNIT_CHECK( !m.extract_max());
                 CPPUNIT_CHECK( gp.empty());
                 CPPUNIT_ASSERT( m.empty());
             }
index c3a5d43..adff9d5 100644 (file)
@@ -179,6 +179,7 @@ namespace map {
                     CPPUNIT_ASSERT( !ep.empty() );
                     CPPUNIT_CHECK( ep->first == nKey );
                     CPPUNIT_CHECK( ep->second.m_val == nKey * 2 );
+                    ep.release();
 
                     {
                         rcu_lock l;
@@ -208,6 +209,7 @@ namespace map {
                     CPPUNIT_ASSERT( !ep.empty() );
                     CPPUNIT_CHECK( ep->first == nKey );
                     CPPUNIT_CHECK( ep->second.m_val == nKey * 2 );
+                    ep.release();
 
                     {
                         rcu_lock l;
@@ -227,6 +229,7 @@ namespace map {
                     CPPUNIT_ASSERT( !ep.empty() );
                     CPPUNIT_CHECK( ep->first == i );
                     CPPUNIT_CHECK( ep->second.m_val == i * 2 );
+                    ep.release();
                 }
                 CPPUNIT_ASSERT( m.empty() );
                 ep = m.extract_min();
@@ -241,6 +244,7 @@ namespace map {
                     CPPUNIT_ASSERT( !ep.empty() );
                     CPPUNIT_CHECK( ep->first == i );
                     CPPUNIT_CHECK( ep->second.m_val == i * 2 );
+                    ep.release();
                 }
                 CPPUNIT_ASSERT( m.empty() );
                 ep = m.extract_max();
index b472bdb..0b6bde9 100644 (file)
@@ -474,12 +474,14 @@ namespace ordlist {
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->nKey == nKey );
                     CPPUNIT_CHECK( gp->nVal == nKey * 2 );
+                    gp.release();
 
                     gp = l.extract( nKey );
                     CPPUNIT_ASSERT( gp );
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->nKey == nKey );
                     CPPUNIT_CHECK( gp->nVal == nKey*2 );
+                    gp.release();
 
                     gp = l.get( nKey );
                     CPPUNIT_CHECK( !gp );
@@ -508,12 +510,14 @@ namespace ordlist {
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->nKey == nKey );
                     CPPUNIT_CHECK( gp->nVal == nKey * 2 );
+                    gp.release();
 
                     gp = l.extract_with( key, other_less() );
                     CPPUNIT_ASSERT( gp );
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->nKey == nKey );
                     CPPUNIT_CHECK( gp->nVal == nKey*2 );
+                    gp.release();
 
                     gp = l.get_with( key, other_less() );
                     CPPUNIT_CHECK( !gp );
index 27f6396..3a8509a 100644 (file)
@@ -302,12 +302,14 @@ namespace ordlist {
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->first == nKey );
                     CPPUNIT_CHECK( gp->second.m_val == nKey * 2 );
+                    gp.release();
 
                     gp = l.extract( nKey );
                     CPPUNIT_ASSERT( gp );
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->first == nKey );
                     CPPUNIT_CHECK( gp->second.m_val == nKey*2 );
+                    gp.release();
 
                     gp = l.get( nKey );
                     CPPUNIT_CHECK( !gp );
@@ -336,12 +338,14 @@ namespace ordlist {
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->first == nKey );
                     CPPUNIT_CHECK( gp->second.m_val == nKey * 2 );
+                    gp.release();
 
                     gp = l.extract_with( key, other_less() );
                     CPPUNIT_ASSERT( gp );
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->first == nKey );
                     CPPUNIT_CHECK( gp->second.m_val == nKey*2 );
+                    gp.release();
 
                     gp = l.get_with( key, other_less() );
                     CPPUNIT_CHECK( !gp );
@@ -410,7 +414,6 @@ namespace ordlist {
                     rcu_lock lock;
                     CPPUNIT_CHECK( l.get( a[0] ) == nullptr );
                     CPPUNIT_CHECK( !l.extract( a[0] ) );
-                    //CPPUNIT_CHECK( ep.empty() );
                 }
 
                 // extract_with/get_with
index 8d3fb9a..4672e97 100644 (file)
@@ -475,12 +475,14 @@ namespace ordlist {
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->nKey == nKey );
                     CPPUNIT_CHECK( gp->nVal == nKey * 2 );
+                    gp.release();
 
                     gp = l.extract( nKey );
                     CPPUNIT_ASSERT( gp );
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->nKey == nKey );
                     CPPUNIT_CHECK( gp->nVal == nKey*2 );
+                    gp.release();
 
                     gp = l.get( nKey );
                     CPPUNIT_CHECK( !gp );
@@ -509,12 +511,14 @@ namespace ordlist {
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->nKey == nKey );
                     CPPUNIT_CHECK( gp->nVal == nKey * 2 );
+                    gp.release();
 
                     gp = l.extract_with( key, other_less() );
                     CPPUNIT_ASSERT( gp );
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->nKey == nKey );
                     CPPUNIT_CHECK( gp->nVal == nKey*2 );
+                    gp.release();
 
                     gp = l.get_with( key, other_less() );
                     CPPUNIT_CHECK( !gp );
index c2b12e3..e4acdf8 100644 (file)
@@ -312,12 +312,15 @@ namespace ordlist {
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->first == nKey );
                     CPPUNIT_CHECK( gp->second.m_val == nKey * 2 );
+                    gp.release();
+                    CPPUNIT_CHECK( gp.empty() );
 
                     gp = l.extract( nKey );
                     CPPUNIT_ASSERT( gp );
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->first == nKey );
                     CPPUNIT_CHECK( gp->second.m_val == nKey*2 );
+                    gp.release();
 
                     gp = l.get( nKey );
                     CPPUNIT_CHECK( !gp );
@@ -346,12 +349,14 @@ namespace ordlist {
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->first == nKey );
                     CPPUNIT_CHECK( gp->second.m_val == nKey * 2 );
+                    gp.release();
 
                     gp = l.extract_with( key, other_less() );
                     CPPUNIT_ASSERT( gp );
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->first == nKey );
                     CPPUNIT_CHECK( gp->second.m_val == nKey*2 );
+                    gp.release();
 
                     gp = l.get_with( key, other_less() );
                     CPPUNIT_CHECK( !gp );
index 5c69aff..23636f8 100644 (file)
@@ -508,12 +508,14 @@ namespace set {
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->nKey == nKey );
                     CPPUNIT_CHECK( gp->nVal == nKey * 2 );
+                    gp.release();
 
                     gp = s.extract( nKey );
                     CPPUNIT_ASSERT( gp );
                     CPPUNIT_ASSERT( !gp.empty() );
                     CPPUNIT_CHECK( gp->nKey == nKey );
                     CPPUNIT_CHECK( gp->nVal == nKey * 2 );
+                    gp.release();
 
                     gp = s.get( nKey );
                     CPPUNIT_CHECK( !gp );
@@ -526,12 +528,14 @@ namespace set {
                     CPPUNIT_ASSERT( gp );
                     CPPUNIT_CHECK( gp->nKey == nKey );
                     CPPUNIT_CHECK( gp->nVal == nKey * 2 );
+                    gp.release();
 
                     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();
 
                     gp = s.get_with( nKey, less<value_type>() );
                     CPPUNIT_CHECK( !gp );
index 349b2a2..8739554 100644 (file)
@@ -235,11 +235,14 @@ namespace set {
                     CPPUNIT_CHECK( gp->nKey == i );
                     CPPUNIT_CHECK( gp->nVal == i * 2 );
                     gp->nVal *= 2;
+                    gp.release();
 
                     gp = s.extract( i );
                     CPPUNIT_CHECK( gp );
                     CPPUNIT_CHECK_EX( gp->nKey == i, "i=" << i << ", gp->nKey=" << gp->nKey);
                     CPPUNIT_CHECK_EX( (*gp).nVal == i * 4, "i=" << i << ", gp->nVal=" << gp->nVal );
+                    gp.release();
+
                     gp = s.extract( i );
                     CPPUNIT_CHECK( !gp );
                     CPPUNIT_CHECK( !s.get( i ));
@@ -255,11 +258,14 @@ namespace set {
                     CPPUNIT_CHECK( gp->nKey == i );
                     CPPUNIT_CHECK( (*gp).nVal == i * 2 );
                     gp->nVal *= 2;
+                    gp.release();
 
                     gp = s.extract_with( other_key( i ), other_key_less<typename Set::value_type>() );
                     CPPUNIT_CHECK( gp );
                     CPPUNIT_CHECK_EX( gp->nKey == i, "i=" << i << ", gp->nKey=" << gp->nKey);
                     CPPUNIT_CHECK_EX( (*gp).nVal == i * 4, "i=" << i << ", gp->nVal=" << gp->nVal );
+                    gp.release();
+
                     gp = s.extract_with( other_key( i ), other_key_less<typename Set::value_type>() );
                     CPPUNIT_CHECK( !gp );
                     CPPUNIT_CHECK( !s.get_with( other_key(i), other_key_less<typename Set::value_type>() ));
@@ -281,6 +287,7 @@ namespace set {
                         CPPUNIT_CHECK( gp->nKey == nPrevKey + 1 );
                         CPPUNIT_CHECK( (*gp).nVal == (nPrevKey + 1) * 2 );
                         nPrevKey = gp->nKey;
+                        gp.release();
                     }
                     gp.release();
                     CPPUNIT_CHECK( !s.extract_min());
@@ -302,6 +309,7 @@ namespace set {
                         CPPUNIT_CHECK( gp->nKey == nPrevKey - 1 );
                         CPPUNIT_CHECK( (*gp).nVal == (nPrevKey - 1) * 2 );
                         nPrevKey = gp->nKey;
+                        gp.release();
                     }
                     gp.release();
                     CPPUNIT_CHECK( !s.extract_min());
index cd7d0ff..1b4fd92 100644 (file)
@@ -273,7 +273,7 @@ namespace set {
                         CPPUNIT_ASSERT( !ep.empty() );
                         CPPUNIT_CHECK( ep->nKey == i );
                         CPPUNIT_CHECK( ep->nVal == i * 4 );
-                        //ep.release();
+                        ep.release();
 
                         {
                             rcu_lock l;
@@ -305,7 +305,7 @@ namespace set {
                         CPPUNIT_ASSERT( !ep.empty() );
                         CPPUNIT_CHECK( ep->nKey == i );
                         CPPUNIT_CHECK( ep->nVal == i * 4 );
-                        //ep.release();
+                        ep.release();
 
                         {
                             rcu_lock l;
@@ -327,7 +327,7 @@ namespace set {
                     CPPUNIT_ASSERT( ep );
                     CPPUNIT_ASSERT( !ep.empty());
                     nPrevKey = ep->nKey;
-                    //ep.release();
+                    ep.release();
 
                     while ( !s.empty() ) {
                         ep = s.extract_min();
@@ -336,7 +336,7 @@ namespace set {
                         CPPUNIT_CHECK( ep->nKey == nPrevKey + 1 );
                         CPPUNIT_CHECK( ep->nVal == (nPrevKey + 1) * 2 );
                         nPrevKey = ep->nKey;
-                        //ep.release();
+                        ep.release();
                     }
                     ep = s.extract_min();
                     CPPUNIT_CHECK( !ep );
@@ -353,7 +353,7 @@ namespace set {
                     CPPUNIT_ASSERT( ep );
                     CPPUNIT_ASSERT( !ep.empty());
                     nPrevKey = ep->nKey;
-                    //ep.release();
+                    ep.release();
 
                     while ( !s.empty() ) {
                         ep = s.extract_max();
@@ -362,7 +362,7 @@ namespace set {
                         CPPUNIT_CHECK( ep->nKey == nPrevKey - 1 );
                         CPPUNIT_CHECK( ep->nVal == (nPrevKey - 1) * 2 );
                         nPrevKey = ep->nKey;
-                        //ep.release();
+                        ep.release();
                     }
                     ep = s.extract_min();
                     CPPUNIT_CHECK( !ep );
index 261f1bf..4e2281e 100644 (file)
@@ -365,13 +365,15 @@ namespace set {
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->nKey == nKey );
                     CPPUNIT_CHECK( gp->nVal == nKey );
+                    gp.release();
 
                     gp = s.extract( nKey );
                     CPPUNIT_ASSERT( gp );
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->nKey == nKey );
                     CPPUNIT_CHECK( gp->nVal == nKey );
-                    CPPUNIT_CHECK( !s.get(nKey));
+                    gp.release();
+                    CPPUNIT_CHECK( !s.get( nKey ) );
 
                     gp = s.extract( nKey );
                     CPPUNIT_CHECK( !gp );
@@ -390,12 +392,15 @@ namespace set {
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->nKey == nKey );
                     CPPUNIT_CHECK( gp->nVal == nKey );
+                    gp.release();
 
                     gp = s.extract_with( other_item( nKey ), other_less() );
                     CPPUNIT_ASSERT( gp );
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->nKey == nKey );
                     CPPUNIT_CHECK( gp->nVal == nKey );
+                    gp.release();
+
                     gp = s.get_with( other_item( nKey ), other_less() );
                     CPPUNIT_CHECK( !gp );
 
index f8805cc..da528d3 100644 (file)
@@ -47,6 +47,7 @@ namespace set {
                 CPPUNIT_ASSERT( !gp.empty());
                 CPPUNIT_CHECK( gp->nKey == i );
                 CPPUNIT_CHECK( gp->nVal == i );
+                gp.release();
             }
             CPPUNIT_MSG( PrintStat()(s, "Iterator test, ascending insert order") );
 
@@ -68,6 +69,7 @@ namespace set {
                 CPPUNIT_ASSERT( !gp.empty() );
                 CPPUNIT_CHECK( gp->nKey == it->nKey );
                 CPPUNIT_CHECK( gp->nVal == it->nKey * 2 );
+                gp.release();
             }
             CPPUNIT_ASSERT( nCount == nLimit );
 
@@ -99,6 +101,7 @@ namespace set {
                 CPPUNIT_ASSERT( !gp.empty());
                 CPPUNIT_CHECK( gp->nKey == i-1 );
                 CPPUNIT_CHECK( gp->nVal == (i-1) * 2 );
+                gp.release();
             }
             CPPUNIT_MSG( PrintStat()(s, "Iterator test, descending insert order") );
 
@@ -174,12 +177,14 @@ namespace set {
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->nKey == nKey );
                     CPPUNIT_CHECK( gp->nVal == nKey * 2);
+                    gp.release();
 
                     gp = s.extract( nKey );
                     CPPUNIT_ASSERT( gp );
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->nKey == nKey );
                     CPPUNIT_CHECK( gp->nVal == nKey * 2);
+                    gp.release();
 
                     gp = s.get( nKey );
                     CPPUNIT_CHECK( !gp );
@@ -199,12 +204,15 @@ namespace set {
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->nKey == nKey );
                     CPPUNIT_CHECK( gp->nVal == nKey );
+                    gp.release();
 
                     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 );
+                    gp.release();
+
                     gp = s.get_with( wrapped_item( nKey ), wrapped_less());
                     CPPUNIT_CHECK( !gp );
                     CPPUNIT_ASSERT( !s.extract_with( wrapped_item(nKey), wrapped_less() ));
@@ -221,6 +229,8 @@ namespace set {
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->nKey == i );
                     CPPUNIT_CHECK( gp->nVal == i );
+                    gp.release();
+
                     gp = s.get( i );
                     CPPUNIT_CHECK( !gp );
                 }
@@ -238,6 +248,8 @@ namespace set {
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->nKey == i );
                     CPPUNIT_CHECK( gp->nVal == i );
+                    gp.release();
+
                     gp = s.get( i );
                     CPPUNIT_CHECK( !gp );
                 }
index ad10c40..027ee0a 100644 (file)
@@ -173,6 +173,7 @@ namespace set {
                     CPPUNIT_ASSERT( !ep.empty() );
                     CPPUNIT_CHECK( ep->nKey == nKey );
                     CPPUNIT_CHECK( ep->nVal == nKey * 2 );
+                    ep.release();
 
                     {
                         rcu_lock l;
@@ -202,6 +203,7 @@ namespace set {
                     CPPUNIT_ASSERT( !ep.empty() );
                     CPPUNIT_CHECK( ep->nKey == nKey );
                     CPPUNIT_CHECK( ep->nVal == nKey );
+                    ep.release();
 
                     {
                         rcu_lock l;
@@ -223,6 +225,7 @@ namespace set {
                     CPPUNIT_CHECK( ep->nKey == i );
                     CPPUNIT_CHECK( ep->nVal == i );
                     CPPUNIT_CHECK( !s.find(i) );
+                    ep.release();
                 }
                 CPPUNIT_CHECK( s.empty());
 
@@ -237,6 +240,7 @@ namespace set {
                     CPPUNIT_CHECK( ep->nKey == i );
                     CPPUNIT_CHECK( ep->nVal == i );
                     CPPUNIT_CHECK( !s.find(i) );
+                    ep.release();
                 }
                 CPPUNIT_CHECK( s.empty());
                 ep = s.extract_min();