Renaming map member function insert_key() to insert_with()
[libcds.git] / tests / test-hdr / tree / hdr_ellenbintree_map.h
index 033db4e31e2a1529cab10f69df01ef29cc002a10..d2c9051948bce05abb7e85528eaa0ae323d8d5a3 100644 (file)
@@ -245,14 +245,14 @@ namespace tree {
             CPPUNIT_ASSERT( check_size( m, 2 ));
 
             CPPUNIT_ASSERT( !m.find(30) );
-            CPPUNIT_ASSERT( m.insert_key( 30, insert_functor<Map>() ) )    ; // value = 90
+            CPPUNIT_ASSERT( m.insert_with( 30, insert_functor<Map>() ) )    ; // value = 90
             CPPUNIT_ASSERT( !m.empty() );
             CPPUNIT_ASSERT( check_size( m, 3 ));
             CPPUNIT_ASSERT( m.find(30) );
 
-            CPPUNIT_ASSERT( !m.insert_key( 10, insert_functor<Map>() ) );
-            CPPUNIT_ASSERT( !m.insert_key( 25, insert_functor<Map>() ) );
-            CPPUNIT_ASSERT( !m.insert_key( 30, insert_functor<Map>() ) );
+            CPPUNIT_ASSERT( !m.insert_with( 10, insert_functor<Map>() ) );
+            CPPUNIT_ASSERT( !m.insert_with( 25, insert_functor<Map>() ) );
+            CPPUNIT_ASSERT( !m.insert_with( 30, insert_functor<Map>() ) );
 
             // ensure (new key)
             CPPUNIT_ASSERT( !m.find(27) );
@@ -386,11 +386,11 @@ namespace tree {
                 int i = 0;
                 std::pair<key_type, value_type> v;
                 while ( !m.empty() ) {
-                    CPPUNIT_ASSERT( m.extract_min( gp ) );
+                    gp = m.extract_min();
+                    CPPUNIT_ASSERT( gp );
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_ASSERT( gp->first == i );
                     ++i;
-                    gp.release();
                 }
                 CPPUNIT_ASSERT( m.empty() );
                 CPPUNIT_ASSERT( check_size( m, 0 ));
@@ -399,11 +399,11 @@ namespace tree {
                 fill_map( m, arr );
                 i = (int) c_nItemCount - 1;
                 while ( !m.empty() ) {
-                    CPPUNIT_ASSERT( m.extract_max( gp ) );
+                    gp = m.extract_max();
+                    CPPUNIT_ASSERT( gp );
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_ASSERT( gp->first == i );
                     --i;
-                    gp.release();
                 }
                 CPPUNIT_ASSERT( m.empty() );
                 CPPUNIT_ASSERT( check_size( m, 0 ));
@@ -411,19 +411,20 @@ namespace tree {
                 fill_map( m, arr );
                 for ( int i = 0; i < static_cast<int>( c_nItemCount ); ++i ) {
                     int nKey = arr[i];
-                    CPPUNIT_ASSERT( m.get( gp, nKey ));
+                    gp = m.get( nKey );
+                    CPPUNIT_ASSERT( gp );
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->first == nKey );
 
-                    gp.release();
-                    CPPUNIT_ASSERT( m.extract( gp, nKey ));
+                    gp = m.extract( nKey );
+                    CPPUNIT_ASSERT( gp );
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->first == nKey );
 
-                    gp.release();
-                    CPPUNIT_CHECK( !m.get( gp, nKey ));
+                    gp = m.get( nKey );
+                    CPPUNIT_CHECK( !gp );
                     CPPUNIT_CHECK( gp.empty());
-                    CPPUNIT_CHECK( !m.extract( gp, nKey ));
+                    CPPUNIT_CHECK( !m.extract( nKey ));
                     CPPUNIT_CHECK( gp.empty());
                 }
                 CPPUNIT_ASSERT( m.empty() );
@@ -432,19 +433,20 @@ namespace tree {
                 fill_map( m, arr );
                 for ( int i = 0; i < static_cast<int>( c_nItemCount ); ++i ) {
                     int nKey = arr[i];
-                    CPPUNIT_ASSERT( m.get_with( gp, wrapped_int(nKey), wrapped_less() ));
+                    gp = m.get_with( wrapped_int( nKey ), wrapped_less() );
+                    CPPUNIT_ASSERT( gp );
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->first == nKey );
 
-                    gp.release();
-                    CPPUNIT_ASSERT( m.extract_with( gp, wrapped_int(nKey), wrapped_less() ));
+                    gp = m.extract_with( wrapped_int( nKey ), wrapped_less() );
+                    CPPUNIT_ASSERT( gp );
                     CPPUNIT_ASSERT( !gp.empty());
                     CPPUNIT_CHECK( gp->first == nKey );
 
-                    gp.release();
-                    CPPUNIT_CHECK( !m.get_with( gp, wrapped_int(nKey), wrapped_less() ));
+                    gp = m.get_with( wrapped_int( nKey ), wrapped_less() );
+                    CPPUNIT_CHECK( !gp );
                     CPPUNIT_CHECK( gp.empty());
-                    CPPUNIT_CHECK( !m.extract_with( gp, wrapped_int(nKey), wrapped_less() ));
+                    CPPUNIT_CHECK( !m.extract_with( wrapped_int(nKey), wrapped_less() ));
                     CPPUNIT_CHECK( gp.empty());
                 }
 
@@ -476,29 +478,33 @@ namespace tree {
 
                 int i = 0;
                 while ( !m.empty() ) {
-                    CPPUNIT_ASSERT( m.extract_min( ep ) );
+                    ep = m.extract_min();
+                    CPPUNIT_ASSERT( ep );
                     CPPUNIT_ASSERT( !ep.empty());
                     CPPUNIT_ASSERT(ep->first == i );
                     ++i;
-                    ep.release();
+                    //ep.release();
                 }
                 CPPUNIT_ASSERT( m.empty() );
                 CPPUNIT_ASSERT( check_size( m, 0 ));
-                CPPUNIT_ASSERT( !m.extract_min( ep ) );
+                ep = m.extract_min();
+                CPPUNIT_ASSERT( !ep );
                 CPPUNIT_ASSERT( ep.empty());
 
                 fill_map( m, arr );
                 i = (int) c_nItemCount - 1;
                 while ( !m.empty() ) {
-                    CPPUNIT_ASSERT( m.extract_max( ep ) );
+                    ep = m.extract_max();
+                    CPPUNIT_ASSERT( ep );
                     CPPUNIT_ASSERT( !ep.empty());
                     CPPUNIT_ASSERT( ep->first == i );
                     --i;
-                    ep.release();
+                    //ep.release();
                 }
                 CPPUNIT_ASSERT( m.empty() );
                 CPPUNIT_ASSERT( check_size( m, 0 ));
-                CPPUNIT_ASSERT( !m.extract_max( ep ) );
+                ep = m.extract_max();
+                CPPUNIT_ASSERT( !ep );
                 CPPUNIT_ASSERT( ep.empty());
 
                 fill_map( m, arr );
@@ -510,12 +516,14 @@ namespace tree {
                         CPPUNIT_ASSERT( pVal != nullptr );
                         CPPUNIT_CHECK( pVal->first == nKey);
                     }
-                    CPPUNIT_ASSERT( m.extract( ep, nKey ));
+                    ep = m.extract( nKey );
+                    CPPUNIT_ASSERT( ep );
                     CPPUNIT_ASSERT( !ep.empty());
                     CPPUNIT_CHECK( ep->first == nKey);
-                    ep.release();
+                    //ep.release();
 
-                    CPPUNIT_ASSERT( !m.extract( ep, nKey ));
+                    ep = m.extract( nKey );
+                    CPPUNIT_ASSERT( !ep );
                     CPPUNIT_ASSERT( ep.empty());
                     {
                         typename map_type::rcu_lock l;
@@ -534,12 +542,14 @@ namespace tree {
                         CPPUNIT_ASSERT( pVal != nullptr );
                         CPPUNIT_CHECK( pVal->first == nKey);
                     }
-                    CPPUNIT_ASSERT( m.extract_with( ep, wrapped_int(nKey), wrapped_less() ));
+                    ep = m.extract_with( wrapped_int( nKey ), wrapped_less() );
+                    CPPUNIT_ASSERT( ep );
                     CPPUNIT_ASSERT( !ep.empty());
                     CPPUNIT_CHECK( ep->first == nKey);
-                    ep.release();
+                    //ep.release();
 
-                    CPPUNIT_ASSERT( !m.extract_with( ep, wrapped_int(nKey), wrapped_less() ));
+                    ep = m.extract_with( wrapped_int( nKey ), wrapped_less() );
+                    CPPUNIT_ASSERT( !ep );
                     CPPUNIT_ASSERT( ep.empty());
                     {
                         typename map_type::rcu_lock l;