{
cds_test::thread_pool& pool = get_pool();
- typedef Consumer<Queue> Consumer;
- typedef Producer<Queue> Producer;
+ typedef Consumer<Queue> consumer_type;
+ typedef Producer<Queue> producer_type;
size_t nPostTestPops = 0;
{
size_t nPoppedItems = 0;
size_t nPushFailed = 0;
- std::vector< Consumer * > arrConsumer;
+ std::vector< consumer_type * > arrConsumer;
for ( size_t i = 0; i < pool.size(); ++i ) {
cds_test::thread& thr = pool.get(i);
if ( thr.type() == consumer_thread ) {
- Consumer& consumer = static_cast<Consumer&>( thr );
+ consumer_type& consumer = static_cast<consumer_type&>( thr );
nTotalPops += consumer.m_nPopped;
nPopFalse += consumer.m_nPopEmpty;
arrConsumer.push_back( &consumer );
else {
assert( thr.type() == producer_thread );
- Producer& producer = static_cast<Producer&>( thr );
+ producer_type& producer = static_cast<producer_type&>( thr );
nPushFailed += producer.m_nPushFailed;
EXPECT_EQ( producer.m_nPushFailed, 0u ) << "producer_thread_no " << i;
}
case 0:
ASSERT_TRUE( m.insert( i, &val ));
ASSERT_FALSE( m.insert( i, &val ));
- ASSERT_TRUE( m.find( i.nKey, []( key_type const& key, mapped_type& val ) {
- val.nVal = key.nKey;
- val.strVal = std::to_string( key.nKey );
+ ASSERT_TRUE( m.find( i.nKey, []( key_type const& k, mapped_type& v ) {
+ v.nVal = k.nKey;
+ v.strVal = std::to_string( k.nKey );
} ));
break;
case 1:
ASSERT_TRUE( m.insert( i.nKey, &val ));
ASSERT_FALSE( m.insert( i.nKey, &val ));
- ASSERT_TRUE( m.find( i.nKey, []( key_type const& key, mapped_type& val ) {
- val.nVal = key.nKey;
- val.strVal = std::to_string( key.nKey );
+ ASSERT_TRUE( m.find( i.nKey, []( key_type const& k, mapped_type& v ) {
+ v.nVal = k.nKey;
+ v.strVal = std::to_string( k.nKey );
} ));
break;
case 2:
ASSERT_TRUE( m.insert( std::to_string( i.nKey ), &val ));
ASSERT_FALSE( m.insert( std::to_string( i.nKey ), &val ));
- ASSERT_TRUE( m.find( i.nKey, []( key_type const& key, mapped_type& val ) {
- val.nVal = key.nKey;
- val.strVal = std::to_string( key.nKey );
+ ASSERT_TRUE( m.find( i.nKey, []( key_type const& k, mapped_type& v ) {
+ v.nVal = k.nKey;
+ v.strVal = std::to_string( k.nKey );
} ));
break;
case 3:
ASSERT_TRUE( m.contains( i.nKey ));
ASSERT_TRUE( m.contains( i ));
ASSERT_TRUE( m.contains( other_item( i.nKey ), other_less()));
- ASSERT_TRUE( m.find( i, []( key_type const& key, mapped_type& val ) {
- EXPECT_EQ( key.nKey, val.nVal );
- EXPECT_EQ( std::to_string( key.nKey ), val.strVal );
+ ASSERT_TRUE( m.find( i, []( key_type const& k, mapped_type& v ) {
+ EXPECT_EQ( k.nKey, v.nVal );
+ EXPECT_EQ( std::to_string( k.nKey ), v.strVal );
} ));
- ASSERT_TRUE( m.find( i.nKey, []( key_type const& key, mapped_type& val ) {
- EXPECT_EQ( key.nKey, val.nVal );
- EXPECT_EQ( std::to_string( key.nKey ), val.strVal );
+ ASSERT_TRUE( m.find( i.nKey, []( key_type const& k, mapped_type& v ) {
+ EXPECT_EQ( k.nKey, v.nVal );
+ EXPECT_EQ( std::to_string( k.nKey ), v.strVal );
} ));
- ASSERT_TRUE( m.find_with( other_item( i.nKey ), other_less(), []( key_type const& key, mapped_type& val ) {
- EXPECT_EQ( key.nKey, val.nVal );
- EXPECT_EQ( std::to_string( key.nKey ), val.strVal );
+ ASSERT_TRUE( m.find_with( other_item( i.nKey ), other_less(), []( key_type const& k, mapped_type& v ) {
+ EXPECT_EQ( k.nKey, v.nVal );
+ EXPECT_EQ( std::to_string( k.nKey ), v.strVal );
} ));
}
ASSERT_FALSE( m.empty());
ASSERT_TRUE( m.contains( val.strVal ));
ASSERT_TRUE( m.contains( i ));
ASSERT_TRUE( m.contains( other_item( i.nKey ), other_less()));
- ASSERT_TRUE( m.find( i, []( key_type const& key, mapped_type& val ) {
- EXPECT_EQ( key.nKey, val.nVal );
- EXPECT_EQ( std::to_string( key.nKey ), val.strVal );
+ ASSERT_TRUE( m.find( i, []( key_type const& k, mapped_type& v ) {
+ EXPECT_EQ( k.nKey, v.nVal );
+ EXPECT_EQ( std::to_string( k.nKey ), v.strVal );
} ));
- ASSERT_TRUE( m.find( i.nKey, []( key_type const& key, mapped_type& val ) {
- EXPECT_EQ( key.nKey, val.nVal );
- EXPECT_EQ( std::to_string( key.nKey ), val.strVal );
+ ASSERT_TRUE( m.find( i.nKey, []( key_type const& k, mapped_type& v ) {
+ EXPECT_EQ( k.nKey, v.nVal );
+ EXPECT_EQ( std::to_string( k.nKey ), v.strVal );
} ));
- ASSERT_TRUE( m.find_with( other_item( i.nKey ), other_less(), []( key_type const& key, mapped_type& val ) {
- EXPECT_EQ( key.nKey, val.nVal );
- EXPECT_EQ( std::to_string( key.nKey ), val.strVal );
+ ASSERT_TRUE( m.find_with( other_item( i.nKey ), other_less(), []( key_type const& k, mapped_type& v ) {
+ EXPECT_EQ( k.nKey, v.nVal );
+ EXPECT_EQ( std::to_string( k.nKey ), v.strVal );
} ));
ASSERT_FALSE( m.erase_with( other_item( i.nKey ), other_less()));
break;
case 4:
- ASSERT_TRUE( m.erase( i, []( key_type const& key, mapped_type& val ) {
- EXPECT_EQ( key.nKey, val.nVal );
- EXPECT_EQ( std::to_string( key.nKey ), val.strVal );
+ ASSERT_TRUE( m.erase( i, []( key_type const& k, mapped_type& v ) {
+ EXPECT_EQ( k.nKey, v.nVal );
+ EXPECT_EQ( std::to_string( k.nKey ), v.strVal );
}));
ASSERT_FALSE( m.erase( i, []( key_type const& /*key*/, mapped_type& /*val*/ ) {
EXPECT_TRUE( false );