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 );
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 );
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 );
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 );
gp.release();
CPPUNIT_CHECK( gp.empty());
}
- CPPUNIT_CHECK( m.extract_max());
+ CPPUNIT_CHECK( !m.extract_max());
CPPUNIT_CHECK( gp.empty());
CPPUNIT_ASSERT( m.empty());
}
CPPUNIT_ASSERT( !ep.empty() );
CPPUNIT_CHECK( ep->first == nKey );
CPPUNIT_CHECK( ep->second.m_val == nKey * 2 );
+ ep.release();
{
rcu_lock l;
CPPUNIT_ASSERT( !ep.empty() );
CPPUNIT_CHECK( ep->first == nKey );
CPPUNIT_CHECK( ep->second.m_val == nKey * 2 );
+ ep.release();
{
rcu_lock l;
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();
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();
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 );
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 );
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 );
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 );
rcu_lock lock;
CPPUNIT_CHECK( l.get( a[0] ) == nullptr );
CPPUNIT_CHECK( !l.extract( a[0] ) );
- //CPPUNIT_CHECK( ep.empty() );
}
// extract_with/get_with
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 );
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 );
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 );
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 );
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 );
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 );
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 ));
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>() ));
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());
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());
CPPUNIT_ASSERT( !ep.empty() );
CPPUNIT_CHECK( ep->nKey == i );
CPPUNIT_CHECK( ep->nVal == i * 4 );
- //ep.release();
+ ep.release();
{
rcu_lock l;
CPPUNIT_ASSERT( !ep.empty() );
CPPUNIT_CHECK( ep->nKey == i );
CPPUNIT_CHECK( ep->nVal == i * 4 );
- //ep.release();
+ ep.release();
{
rcu_lock l;
CPPUNIT_ASSERT( ep );
CPPUNIT_ASSERT( !ep.empty());
nPrevKey = ep->nKey;
- //ep.release();
+ ep.release();
while ( !s.empty() ) {
ep = s.extract_min();
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 );
CPPUNIT_ASSERT( ep );
CPPUNIT_ASSERT( !ep.empty());
nPrevKey = ep->nKey;
- //ep.release();
+ ep.release();
while ( !s.empty() ) {
ep = s.extract_max();
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 );
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 );
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 );
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") );
CPPUNIT_ASSERT( !gp.empty() );
CPPUNIT_CHECK( gp->nKey == it->nKey );
CPPUNIT_CHECK( gp->nVal == it->nKey * 2 );
+ gp.release();
}
CPPUNIT_ASSERT( nCount == nLimit );
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") );
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 );
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() ));
CPPUNIT_ASSERT( !gp.empty());
CPPUNIT_CHECK( gp->nKey == i );
CPPUNIT_CHECK( gp->nVal == i );
+ gp.release();
+
gp = s.get( i );
CPPUNIT_CHECK( !gp );
}
CPPUNIT_ASSERT( !gp.empty());
CPPUNIT_CHECK( gp->nKey == i );
CPPUNIT_CHECK( gp->nVal == i );
+ gp.release();
+
gp = s.get( i );
CPPUNIT_CHECK( !gp );
}
CPPUNIT_ASSERT( !ep.empty() );
CPPUNIT_CHECK( ep->nKey == nKey );
CPPUNIT_CHECK( ep->nVal == nKey * 2 );
+ ep.release();
{
rcu_lock l;
CPPUNIT_ASSERT( !ep.empty() );
CPPUNIT_CHECK( ep->nKey == nKey );
CPPUNIT_CHECK( ep->nVal == nKey );
+ ep.release();
{
rcu_lock l;
CPPUNIT_CHECK( ep->nKey == i );
CPPUNIT_CHECK( ep->nVal == i );
CPPUNIT_CHECK( !s.find(i) );
+ ep.release();
}
CPPUNIT_CHECK( s.empty());
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();