stat& operator =( const stat& s )
{
- memcpy( this, &s, sizeof( s ) );
+ memcpy( this, &s, sizeof( s ));
return *this;
}
};
struct cmp {
int operator ()( const T& v1, const T& v2 ) const
{
- if ( v1.key() < v2.key() )
+ if ( v1.key() < v2.key())
return -1;
return v1.key() > v2.key() ? 1 : 0;
}
template <typename Q>
int operator ()( const Q& v1, const T& v2 ) const
{
- if ( v1 < v2.key() )
+ if ( v1 < v2.key())
return -1;
return v1 > v2.key() ? 1 : 0;
}
shuffle( arr, arr + nSize );
shuffle( arr2, arr2 + nSize );
- ASSERT_TRUE( l.empty() );
+ ASSERT_TRUE( l.empty());
ASSERT_CONTAINER_SIZE( l, 0 );
typedef typename List::iterator iterator;
EXPECT_TRUE( l.contains( i.nKey ));
EXPECT_TRUE( l.contains( i ));
EXPECT_TRUE( l.contains( other_item( i.nKey ), other_less()));
- EXPECT_FALSE( l.find( i.nKey ) == l.end() );
+ EXPECT_FALSE( l.find( i.nKey ) == l.end());
EXPECT_TRUE( l.find( i.nKey, []( value_type& item, int ) { ++item.s.nFindCall; } ));
EXPECT_EQ( i.s.nFindCall, 1 );
EXPECT_TRUE( l.find( i, []( value_type& item, value_type const& ) { ++item.s.nFindCall; } ));
EXPECT_TRUE( l.find_with( other_item( i.nKey ), other_less(), []( value_type& item, other_item const& ) { ++item.s.nFindCall; } ));
EXPECT_EQ( i.s.nFindCall, 3 );
- EXPECT_FALSE( l.insert( i ) );
- ASSERT_FALSE( l.empty() );
+ EXPECT_FALSE( l.insert( i ));
+ ASSERT_FALSE( l.empty());
int const ckey = i.nKey;
iterator it = l.find( ckey );
- ASSERT_FALSE( it == l.end() );
+ ASSERT_FALSE( it == l.end());
EXPECT_EQ( it->nKey, i.nKey );
EXPECT_EQ( (*it).nVal, i.nVal );
- check_ordered( it, l.end() );
+ check_ordered( it, l.end());
it = l.find( i.nKey );
- ASSERT_FALSE( it == l.end() );
+ ASSERT_FALSE( it == l.end());
EXPECT_EQ( it->nKey, i.nKey );
EXPECT_EQ( (*it).nVal, i.nVal );
- check_ordered( it, l.end() );
+ check_ordered( it, l.end());
- it = l.find_with( other_item( i.nKey ), other_less() );
- ASSERT_FALSE( it == l.end() );
+ it = l.find_with( other_item( i.nKey ), other_less());
+ ASSERT_FALSE( it == l.end());
EXPECT_EQ( it->nKey, i.nKey );
EXPECT_EQ( it->nVal, i.nVal );
- check_ordered( it, l.end() );
+ check_ordered( it, l.end());
}
ASSERT_CONTAINER_SIZE( l, nSize );
EXPECT_TRUE( l.find_with( other_item( i.nKey ), other_less(), []( value_type& item, other_item const& ) { ++item.s.nFindCall; } ));
EXPECT_EQ( i.s.nFindCall, 6 );
}
- ASSERT_FALSE( l.empty() );
+ ASSERT_FALSE( l.empty());
ASSERT_CONTAINER_SIZE( l, nSize );
// update existing test
for ( auto& i : arr2 ) {
EXPECT_EQ( i.s.nUpdateExistsCall, 0 );
- std::pair<bool, bool> ret = l.update( i, update_functor() );
+ std::pair<bool, bool> ret = l.update( i, update_functor());
EXPECT_TRUE( ret.first );
EXPECT_FALSE( ret.second );
EXPECT_EQ( i.s.nUpdateExistsCall, 1 );
// update with the same value must be empty - no functor is called
for ( auto& i : arr2 ) {
EXPECT_EQ( i.s.nUpdateExistsCall, 1 );
- std::pair<bool, bool> ret = l.update( i, update_functor() );
+ std::pair<bool, bool> ret = l.update( i, update_functor());
EXPECT_TRUE( ret.first );
EXPECT_FALSE( ret.second );
EXPECT_EQ( i.s.nUpdateExistsCall, 1 );
if ( i.nKey & 1 )
EXPECT_TRUE( l.erase( i.nKey ));
else
- EXPECT_TRUE( l.erase_with( other_item( i.nKey ), other_less() ));
+ EXPECT_TRUE( l.erase_with( other_item( i.nKey ), other_less()));
EXPECT_FALSE( l.contains( i ));
}
- EXPECT_TRUE( l.empty() );
+ EXPECT_TRUE( l.empty());
EXPECT_CONTAINER_SIZE( l, 0 );
// Apply retired pointer to clean links
EXPECT_TRUE( ret.second );
EXPECT_EQ( i.s.nUpdateNewCall, updateNewCall + 1 );
}
- EXPECT_FALSE( l.empty() );
+ EXPECT_FALSE( l.empty());
EXPECT_CONTAINER_SIZE( l, nSize );
for ( auto const& i : arr ) {
EXPECT_EQ( i.s.nEraseCall, 1 );
EXPECT_FALSE( l.contains( i.nKey ));
}
- EXPECT_TRUE( l.empty() );
+ EXPECT_TRUE( l.empty());
EXPECT_CONTAINER_SIZE( l, 0 );
// Apply retired pointer to clean links
for ( auto& i : arr )
EXPECT_TRUE( l.insert( i ));
- EXPECT_FALSE( l.empty() );
+ EXPECT_FALSE( l.empty());
EXPECT_CONTAINER_SIZE( l, nSize );
l.clear();
- EXPECT_TRUE( l.empty() );
+ EXPECT_TRUE( l.empty());
EXPECT_CONTAINER_SIZE( l, 0 );
// Apply retired pointer to clean links
// unlink test
for ( auto& i : arr )
- EXPECT_TRUE( l.insert( i ) );
+ EXPECT_TRUE( l.insert( i ));
for ( auto& i : arr ) {
value_type val( i );
EXPECT_TRUE( l.contains( val ));
EXPECT_FALSE( l.unlink( val ));
- EXPECT_TRUE( l.contains( val ) );
+ EXPECT_TRUE( l.contains( val ));
EXPECT_TRUE( l.unlink( i ));
EXPECT_FALSE( l.unlink( i ));
- EXPECT_FALSE( l.contains( i ) );
+ EXPECT_FALSE( l.contains( i ));
}
- EXPECT_TRUE( l.empty() );
+ EXPECT_TRUE( l.empty());
EXPECT_CONTAINER_SIZE( l, 0 );
// Apply retired pointer to clean links
List::gc::force_dispose();
for ( auto const& i : arr ) {
EXPECT_EQ( i.s.nDisposeCount, 5 );
- EXPECT_FALSE( l.contains( i ) );
+ EXPECT_FALSE( l.contains( i ));
}
// Iterators on empty list
}
shuffle( arr, arr + nSize );
- ASSERT_TRUE( l.empty() );
+ ASSERT_TRUE( l.empty());
ASSERT_CONTAINER_SIZE( l, 0 );
for ( auto& i : arr )
- EXPECT_TRUE( l.insert( i ) );
+ EXPECT_TRUE( l.insert( i ));
int key = 0;
for ( auto it = l.begin(); it != l.end(); ++it ) {
List::gc::force_dispose();
for ( auto const& i : arr ) {
EXPECT_EQ( i.s.nDisposeCount, 1 );
- EXPECT_FALSE( l.contains( i ) );
+ EXPECT_FALSE( l.contains( i ));
}
}