X-Git-Url: http://plrg.eecs.uci.edu/git/?p=libcds.git;a=blobdiff_plain;f=tests%2Ftest-hdr%2Fset%2Fhdr_skiplist_set.h;h=f8805cce3587f3f262b4874b0661ed82417aaded;hp=fb0694358f8c618fed9fb048bee19e66f1d3a698;hb=35a035d8d6c7b53a1b3bc1fbb268ca72fa61e387;hpb=7d15399a4d18ae2061ddb01656d85dbc940ff915 diff --git a/tests/test-hdr/set/hdr_skiplist_set.h b/tests/test-hdr/set/hdr_skiplist_set.h index fb069435..f8805cce 100644 --- a/tests/test-hdr/set/hdr_skiplist_set.h +++ b/tests/test-hdr/set/hdr_skiplist_set.h @@ -36,16 +36,17 @@ 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 ); - gp.release(); } CPPUNIT_MSG( PrintStat()(s, "Iterator test, ascending insert order") ); @@ -62,11 +63,11 @@ 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 ); - gp.release(); } CPPUNIT_ASSERT( nCount == nLimit ); @@ -86,17 +87,18 @@ namespace set { CPPUNIT_ASSERT( s.empty() ); for ( int i = nLimit; i > 0; --i ) { - CPPUNIT_CHECK( !s.get_with(gp, i-1, base_class::less() ) ); + gp = s.get_with( i - 1, base_class::less()); + 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() )); + gp = s.get_with( i - 1, base_class::less()); + CPPUNIT_CHECK( gp ); 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") ); @@ -167,22 +169,22 @@ 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 +194,20 @@ 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,39 +216,37 @@ 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, NULL) ); + CPPUNIT_MSG( PrintStat()(s, nullptr) ); } template @@ -329,7 +330,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 +360,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(); @@ -372,7 +371,7 @@ namespace set { CPPUNIT_ASSERT( s.insert( std::make_pair( i, i * 2) ) != s.end() ); typename Set::value_type * pVal = s.get_min(); - CPPUNIT_ASSERT( pVal != NULL ); + CPPUNIT_ASSERT( pVal != nullptr ); CPPUNIT_CHECK( pVal->nKey == i ); CPPUNIT_CHECK( pVal->nVal == i * 2 ); } @@ -381,15 +380,15 @@ namespace set { CPPUNIT_ASSERT( s.empty() ); CPPUNIT_ASSERT( check_size( s, 0 )); - CPPUNIT_CHECK( s.get_min() == NULL ); - CPPUNIT_CHECK( s.get_max() == NULL ); + CPPUNIT_CHECK( s.get_min() == nullptr ); + CPPUNIT_CHECK( s.get_max() == nullptr ); // iterator test for ( int i = 0; i < 500; ++i ) { CPPUNIT_ASSERT( s.insert( std::make_pair( i, i * 2) ) != s.end() ); typename Set::value_type * pVal = s.get_max(); - CPPUNIT_ASSERT( pVal != NULL ); + CPPUNIT_ASSERT( pVal != nullptr ); CPPUNIT_CHECK( pVal->nKey == i ); CPPUNIT_CHECK( pVal->nVal == i * 2 ); } @@ -433,55 +432,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 +508,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)