X-Git-Url: http://plrg.eecs.uci.edu/git/?p=libcds.git;a=blobdiff_plain;f=tests%2Ftest-hdr%2Fset%2Fhdr_intrusive_skiplist_set.h;h=349b2a259180d3e07e3cbc1b1d007d737349b1e9;hp=342b456dfcfe8ebac03525cf45be69bbdd1b2353;hb=35a035d8d6c7b53a1b3bc1fbb268ca72fa61e387;hpb=dd9008b0f638e049779a29522055fee08fbc918f diff --git a/tests/test-hdr/set/hdr_intrusive_skiplist_set.h b/tests/test-hdr/set/hdr_intrusive_skiplist_set.h index 342b456d..349b2a25 100644 --- a/tests/test-hdr/set/hdr_intrusive_skiplist_set.h +++ b/tests/test-hdr/set/hdr_intrusive_skiplist_set.h @@ -230,38 +230,40 @@ namespace set { // extract fill_skiplist( s, v ); for ( int i = c_nArrSize - 1; i >= 0; i -= 1 ) { - CPPUNIT_CHECK( s.get(gp, i)); + gp = s.get( i ); + CPPUNIT_CHECK( gp ); CPPUNIT_CHECK( gp->nKey == i ); CPPUNIT_CHECK( gp->nVal == i * 2 ); gp->nVal *= 2; - gp.release(); - CPPUNIT_CHECK( s.extract( gp, i )); + 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 ); - CPPUNIT_CHECK( !s.extract( gp, i )); - CPPUNIT_CHECK( !s.get( gp, i )); + gp = s.extract( i ); + CPPUNIT_CHECK( !gp ); + CPPUNIT_CHECK( !s.get( i )); } - gp.release(); CPPUNIT_CHECK( s.empty() ); Set::gc::force_dispose(); // extract_with fill_skiplist( s, v ); for ( int i = c_nArrSize - 1; i >= 0; i -= 1 ) { - CPPUNIT_CHECK( s.get_with( gp, other_key(i), other_key_less() )); + gp = s.get_with( other_key( i ), other_key_less() ); + CPPUNIT_CHECK( gp ); CPPUNIT_CHECK( gp->nKey == i ); CPPUNIT_CHECK( (*gp).nVal == i * 2 ); gp->nVal *= 2; - gp.release(); - CPPUNIT_CHECK( s.extract_with( gp, other_key(i), other_key_less() )); + gp = s.extract_with( other_key( i ), other_key_less() ); + 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 ); - CPPUNIT_CHECK( !s.extract_with( gp, other_key(i), other_key_less() )); - CPPUNIT_CHECK( !s.get_with( gp, other_key(i), other_key_less() )); + gp = s.extract_with( other_key( i ), other_key_less() ); + CPPUNIT_CHECK( !gp ); + CPPUNIT_CHECK( !s.get_with( other_key(i), other_key_less() )); } - gp.release(); CPPUNIT_CHECK( s.empty() ); Set::gc::force_dispose(); @@ -269,18 +271,19 @@ namespace set { { fill_skiplist( s, v ); int nPrevKey; - CPPUNIT_ASSERT( s.extract_min( gp )); + gp = s.extract_min(); + CPPUNIT_ASSERT( gp ); nPrevKey = gp->nKey; while ( !s.empty() ) { - CPPUNIT_CHECK( s.extract_min( gp )); + gp = s.extract_min(); + CPPUNIT_CHECK( gp ); CPPUNIT_ASSERT( !gp.empty()); 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(gp)); + CPPUNIT_CHECK( !s.extract_min()); CPPUNIT_CHECK( gp.empty()); } Set::gc::force_dispose(); @@ -289,23 +292,22 @@ namespace set { { fill_skiplist( s, v ); int nPrevKey; - CPPUNIT_ASSERT( s.extract_max( gp )); + gp = s.extract_max(); + CPPUNIT_ASSERT( gp ); nPrevKey = gp->nKey; while ( !s.empty() ) { - - CPPUNIT_CHECK( s.extract_max( gp )); + gp = s.extract_max(); + CPPUNIT_CHECK( gp ); CPPUNIT_ASSERT( !gp.empty() ); 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(gp)); + CPPUNIT_CHECK( !s.extract_min()); CPPUNIT_CHECK( gp.empty()); - CPPUNIT_CHECK( !s.extract_max(gp)); - CPPUNIT_CHECK( gp.empty()); + CPPUNIT_CHECK( !s.extract_max()); } Set::gc::force_dispose(); }