static void apply( MyTable& table, int i ) { bool b; if(i&4) { if(i&8) { MyTable::const_accessor a; b = table.find( a, MyKey::make(i) ) && table.erase( a ); } else { MyTable::accessor a; b = table.find( a, MyKey::make(i) ) && table.erase( a ); } } else b = table.erase( MyKey::make(i) ); if( b ) ++EraseCount; ASSERT( table.count(MyKey::make(i)) == 0, NULL ); }
static void apply( const MyTable& table, int i ) { MyTable::const_accessor a; const MyTable::const_accessor& ca = a; bool b = table.find( a, MyKey::make(i) ); ASSERT( b==(table.count(MyKey::make(i))>0), NULL ); ASSERT( b==!a.empty(), NULL ); ASSERT( b==UseKey(i), NULL ); if( b ) { AssertSameType( &*ca, static_cast<const MyTable::value_type*>(0) ); ASSERT( ca->second.value_of()==~(i*i), NULL ); ASSERT( (*ca).second.value_of()==~(i*i), NULL ); } }
static void CheckTable( const MyTable& x, int n ) { ASSERT( x.size()==size_t(n), "table is different size than expected" ); ASSERT( x.empty()==(n==0), NULL ); ASSERT( x.size()<=x.max_size(), NULL ); for( int i=1; i<=n; ++i ) { MyKey key( MyKey::make(-i) ); typename MyTable::const_accessor a; bool b = x.find(a,key); ASSERT( b, NULL ); ASSERT( a->second.value_of()==i*i, NULL ); } int count = 0; int key_sum = 0; for( typename MyTable::const_iterator i(x.begin()); i!=x.end(); ++i ) { ++count; key_sum += -i->first.value_of(); } ASSERT( count==n, NULL ); ASSERT( key_sum==n*(n+1)/2, NULL ); }
static void apply( MyTable& table, int i ) { MyTable::accessor a; const MyTable::accessor& ca = a; bool b = table.find( a, MyKey::make(i) ); ASSERT( b==!a.empty(), NULL ); if( b ) { if( !UseKey(i) ) REPORT("Line %d: unexpected key %d present\n",__LINE__,i); AssertSameType( &*a, static_cast<MyTable::value_type*>(0) ); ASSERT( ca->second.value_of()==i*i, NULL ); ASSERT( (*ca).second.value_of()==i*i, NULL ); if( i&1 ) ca->second.set_value( ~ca->second.value_of() ); else (*ca).second.set_value( ~ca->second.value_of() ); } else { if( UseKey(i) ) REPORT("Line %d: key %d missing\n",__LINE__,i); } }