}
};
struct dummy_insert_functor {
- void operator ()( item& i )
+ void operator ()( item& /*i*/ )
{
// This functor should not be called
TestCase::current_test()->error( "CPPUNIT_ASSERT", "dummy_insert_functor should not be called", __FILE__, __LINE__ );
{
i.nVal = i.nKey * 1024;
}
- static void dummy_insert_function( item& i )
+ static void dummy_insert_function( item& /*i*/ )
{
// This function should not be called
TestCase::current_test()->error( "CPPUNIT_ASSERT", "dummy_insert_function should not be called", __FILE__, __LINE__ );
};
struct dummy_check_value {
- void operator()( item& i, int )
+ void operator()( item& /*i*/, int )
{
// This functor should not be called
TestCase::current_test()->error( "CPPUNIT_ASSERT", "dummy_check_value should not be called", __FILE__, __LINE__ );
};
struct ensure_functor {
- void operator()( bool bNew, item& i, int n )
+ void operator()( bool /*bNew*/, item& i, int n )
{
i.nVal = i.nKey * 1024;
}
};
- static void ensure_func( bool bNew, item& i, int n )
+ static void ensure_func( bool /*bNew*/, item& i, int n )
{
i.nVal = n * 1033;
}
{
int nCount = 100;
for ( int i = 0; i < nCount; ++i )
- CPPUNIT_ASSERT( l.insert(i) );
+ CPPUNIT_ASSERT( l.insert( i ) );
+
+ {
+ typename OrdList::iterator it( l.begin() );
+ typename OrdList::const_iterator cit( l.cbegin() );
+ CPPUNIT_CHECK( it == cit );
+ CPPUNIT_CHECK( it != l.end() );
+ CPPUNIT_CHECK( it != l.cend() );
+ CPPUNIT_CHECK( cit != l.end() );
+ CPPUNIT_CHECK( cit != l.cend() );
+ ++it;
+ CPPUNIT_CHECK( it != cit );
+ CPPUNIT_CHECK( it != l.end() );
+ CPPUNIT_CHECK( it != l.cend() );
+ CPPUNIT_CHECK( cit != l.end() );
+ CPPUNIT_CHECK( cit != l.cend() );
+ ++cit;
+ CPPUNIT_CHECK( it == cit );
+ CPPUNIT_CHECK( it != l.end() );
+ CPPUNIT_CHECK( it != l.cend() );
+ CPPUNIT_CHECK( cit != l.end() );
+ CPPUNIT_CHECK( cit != l.cend() );
+ }
int i = 0;
for ( typename OrdList::iterator it = l.begin(), itEnd = l.end(); it != itEnd; ++it, ++i ) {
for ( int i = 0; i < nLimit; ++i ) {
int nKey = arr[i];
- CPPUNIT_ASSERT( l.get(gp, nKey));
+ gp = l.get( nKey );
+ CPPUNIT_ASSERT( gp );
CPPUNIT_ASSERT( !gp.empty());
CPPUNIT_CHECK( gp->nKey == nKey );
CPPUNIT_CHECK( gp->nVal == nKey * 2 );
- gp.release();
- CPPUNIT_ASSERT( l.extract(gp, nKey));
+ gp = l.extract( nKey );
+ CPPUNIT_ASSERT( gp );
CPPUNIT_ASSERT( !gp.empty());
CPPUNIT_CHECK( gp->nKey == nKey );
CPPUNIT_CHECK( gp->nVal == nKey*2 );
- gp.release();
- CPPUNIT_CHECK( !l.get(gp, nKey));
+ gp = l.get( nKey );
+ CPPUNIT_CHECK( !gp );
CPPUNIT_CHECK( gp.empty());
- CPPUNIT_CHECK( !l.extract( gp, nKey));
+ CPPUNIT_CHECK( !l.extract( nKey));
CPPUNIT_CHECK( gp.empty());
}
CPPUNIT_ASSERT( l.empty());
- CPPUNIT_CHECK( !l.get(gp, arr[0]));
+ CPPUNIT_CHECK( !l.get(arr[0]));
CPPUNIT_CHECK( gp.empty());
- CPPUNIT_CHECK( !l.extract( gp, arr[0]));
+ CPPUNIT_CHECK( !l.extract( arr[0]));
CPPUNIT_CHECK( gp.empty());
}
int nKey = arr[i];
other_item key( nKey );
- CPPUNIT_ASSERT( l.get_with(gp, key, other_less()));
+ gp = l.get_with( key, other_less() );
+ CPPUNIT_ASSERT( gp );
CPPUNIT_ASSERT( !gp.empty());
CPPUNIT_CHECK( gp->nKey == nKey );
CPPUNIT_CHECK( gp->nVal == nKey * 2 );
- gp.release();
- CPPUNIT_ASSERT( l.extract_with(gp, key, other_less()));
+ 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();
- CPPUNIT_CHECK( !l.get_with(gp, key, other_less()));
+ gp = l.get_with( key, other_less() );
+ CPPUNIT_CHECK( !gp );
CPPUNIT_CHECK( gp.empty());
- CPPUNIT_CHECK( !l.extract_with( gp, key, other_less()));
+ CPPUNIT_CHECK( !l.extract_with( key, other_less()));
CPPUNIT_CHECK( gp.empty());
}
CPPUNIT_ASSERT( l.empty());
- CPPUNIT_CHECK( !l.get_with(gp, other_item(arr[0]), other_less()));
+ CPPUNIT_CHECK( !l.get_with(other_item(arr[0]), other_less()));
CPPUNIT_CHECK( gp.empty());
- CPPUNIT_CHECK( !l.extract_with( gp, other_item(arr[0]), other_less()));
+ CPPUNIT_CHECK( !l.extract_with( other_item(arr[0]), other_less()));
CPPUNIT_CHECK( gp.empty());
}
CPPUNIT_CHECK( pGet->nKey == a[i] );
CPPUNIT_CHECK( pGet->nVal == a[i] * 2 );
- CPPUNIT_ASSERT( l.extract( ep, a[i] ));
+ ep = l.extract( a[i] );
+ CPPUNIT_ASSERT( ep );
CPPUNIT_ASSERT( !ep.empty() );
CPPUNIT_CHECK( ep->nKey == a[i] );
CPPUNIT_CHECK( (*ep).nVal == a[i] * 2 );
{
rcu_lock lock;
CPPUNIT_CHECK( l.get( a[i] ) == nullptr );
- CPPUNIT_CHECK( !l.extract( ep, a[i] ));
- CPPUNIT_CHECK( ep.empty() );
+ CPPUNIT_CHECK( !l.extract( a[i] ));
}
}
CPPUNIT_ASSERT( l.empty() );
{
rcu_lock lock;
CPPUNIT_CHECK( l.get( a[0] ) == nullptr );
- CPPUNIT_CHECK( !l.extract( ep, a[0] ) );
+ ep = l.extract( a[0] );
+ CPPUNIT_CHECK( !ep );
CPPUNIT_CHECK( ep.empty() );
}
CPPUNIT_CHECK( pGet->nKey == a[i] );
CPPUNIT_CHECK( pGet->nVal == a[i] * 2 );
- CPPUNIT_ASSERT( l.extract_with( ep, itm, other_less() ));
+ ep = l.extract_with( itm, other_less() );
+ CPPUNIT_ASSERT( ep );
CPPUNIT_ASSERT( !ep.empty() );
CPPUNIT_CHECK( ep->nKey == a[i] );
CPPUNIT_CHECK( ep->nVal == a[i] * 2 );
{
rcu_lock lock;
CPPUNIT_CHECK( l.get_with( itm, other_less() ) == nullptr );
- CPPUNIT_CHECK( !l.extract_with( ep, itm, other_less() ));
+ ep = l.extract_with( itm, other_less() );
+ CPPUNIT_CHECK( !ep );
CPPUNIT_CHECK( ep.empty() );
}
}
{
rcu_lock lock;
CPPUNIT_CHECK( l.get_with( other_item( 0 ), other_less() ) == nullptr );
- CPPUNIT_CHECK( !l.extract_with( ep, other_item(0), other_less() ));
+ CPPUNIT_CHECK( !l.extract_with( other_item(0), other_less() ));
CPPUNIT_CHECK( ep.empty() );
}
}
CPPUNIT_ASSERT( it->nKey == 1001 );
CPPUNIT_ASSERT( it->nVal == 1001 * 2 );
+ {
+ typename OrdList::iterator it( l.begin() );
+ typename OrdList::const_iterator cit( l.cbegin() );
+ CPPUNIT_CHECK( it == cit );
+ CPPUNIT_CHECK( it != l.end() );
+ CPPUNIT_CHECK( it != l.cend() );
+ CPPUNIT_CHECK( cit != l.end() );
+ CPPUNIT_CHECK( cit != l.cend() );
+ ++it;
+ CPPUNIT_CHECK( it != cit );
+ CPPUNIT_CHECK( it != l.end() );
+ CPPUNIT_CHECK( it != l.cend() );
+ CPPUNIT_CHECK( cit != l.end() );
+ CPPUNIT_CHECK( cit != l.cend() );
+ ++cit;
+ CPPUNIT_CHECK( it == cit );
+ CPPUNIT_CHECK( it != l.end() );
+ CPPUNIT_CHECK( it != l.cend() );
+ CPPUNIT_CHECK( cit != l.end() );
+ CPPUNIT_CHECK( cit != l.cend() );
+ }
+
+
l.clear();
CPPUNIT_ASSERT( l.empty() );
}
void HP_cmpmix();
void HP_ic();
- void PTB_cmp();
- void PTB_less();
- void PTB_cmpmix();
- void PTB_ic();
+ void DHP_cmp();
+ void DHP_less();
+ void DHP_cmpmix();
+ void DHP_ic();
void RCU_GPI_cmp();
void RCU_GPI_less();
CPPUNIT_TEST(HP_cmpmix)
CPPUNIT_TEST(HP_ic)
- CPPUNIT_TEST(PTB_cmp)
- CPPUNIT_TEST(PTB_less)
- CPPUNIT_TEST(PTB_cmpmix)
- CPPUNIT_TEST(PTB_ic)
+ CPPUNIT_TEST(DHP_cmp)
+ CPPUNIT_TEST(DHP_less)
+ CPPUNIT_TEST(DHP_cmpmix)
+ CPPUNIT_TEST(DHP_ic)
CPPUNIT_TEST(RCU_GPI_cmp)
CPPUNIT_TEST(RCU_GPI_less)