|
|
@ -19,7 +19,7 @@ void test_size() {
|
|
|
|
test.push_back( 2 );
|
|
|
|
test.push_back( 2 );
|
|
|
|
test.push_back( 3 );
|
|
|
|
test.push_back( 3 );
|
|
|
|
test.push_back( 4 );
|
|
|
|
test.push_back( 4 );
|
|
|
|
BOOST_CHECK_ETQUAL( test.size(), 4u );
|
|
|
|
BOOST_CHECK_EQUAL( test.size(), 4u );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
template <typename T>
|
|
|
|
template <typename T>
|
|
|
@ -30,7 +30,7 @@ void test_put_recover() {
|
|
|
|
test.push_back( T( i*13 + i*i*45 + 23 ) );
|
|
|
|
test.push_back( T( i*13 + i*i*45 + 23 ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for ( int i = 0; i != 20; ++i ) {
|
|
|
|
for ( int i = 0; i != 20; ++i ) {
|
|
|
|
BOOST_CHECK_ETQUAL( test[ i ], T( i*13 + i*i*45 + 23 ) );
|
|
|
|
BOOST_CHECK_EQUAL( test[ i ], T( i*13 + i*i*45 + 23 ) );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -39,7 +39,7 @@ void resize() {
|
|
|
|
memvector<uint32_t> test( fname );
|
|
|
|
memvector<uint32_t> test( fname );
|
|
|
|
test.push_back( 1 );
|
|
|
|
test.push_back( 1 );
|
|
|
|
test.resize( 50 );
|
|
|
|
test.resize( 50 );
|
|
|
|
BOOST_CHECK_ETQUAL( test.size(), 50u );
|
|
|
|
BOOST_CHECK_EQUAL( test.size(), 50u );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -55,9 +55,9 @@ void test_persistent() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
{
|
|
|
|
{
|
|
|
|
memvector<uint32_t> test( fname );
|
|
|
|
memvector<uint32_t> test( fname );
|
|
|
|
BOOST_CHECK_ETQUAL( test.size(), 5u );
|
|
|
|
BOOST_CHECK_EQUAL( test.size(), 5u );
|
|
|
|
for ( unsigned i = 0; i != test.size(); ++i )
|
|
|
|
for ( unsigned i = 0; i != test.size(); ++i )
|
|
|
|
BOOST_CHECK_ETQUAL( test[ i ], i + 1 );
|
|
|
|
BOOST_CHECK_EQUAL( test[ i ], i + 1 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -71,12 +71,12 @@ void test_insert() {
|
|
|
|
|
|
|
|
|
|
|
|
test.insert( test.begin() + 2, 13 );
|
|
|
|
test.insert( test.begin() + 2, 13 );
|
|
|
|
|
|
|
|
|
|
|
|
BOOST_CHECK_ETQUAL( test.size(), 5u );
|
|
|
|
BOOST_CHECK_EQUAL( test.size(), 5u );
|
|
|
|
BOOST_CHECK_ETQUAL( test[ 0 ], 12u );
|
|
|
|
BOOST_CHECK_EQUAL( test[ 0 ], 12u );
|
|
|
|
BOOST_CHECK_ETQUAL( test[ 1 ], 12u );
|
|
|
|
BOOST_CHECK_EQUAL( test[ 1 ], 12u );
|
|
|
|
BOOST_CHECK_ETQUAL( test[ 2 ], 13u );
|
|
|
|
BOOST_CHECK_EQUAL( test[ 2 ], 13u );
|
|
|
|
BOOST_CHECK_ETQUAL( test[ 3 ], 12u );
|
|
|
|
BOOST_CHECK_EQUAL( test[ 3 ], 12u );
|
|
|
|
BOOST_CHECK_ETQUAL( test[ 4 ], 12u );
|
|
|
|
BOOST_CHECK_EQUAL( test[ 4 ], 12u );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void test_iterator() {
|
|
|
|
void test_iterator() {
|
|
|
@ -85,38 +85,38 @@ void test_iterator() {
|
|
|
|
test.push_back( 1 );
|
|
|
|
test.push_back( 1 );
|
|
|
|
test.push_back( 2 );
|
|
|
|
test.push_back( 2 );
|
|
|
|
|
|
|
|
|
|
|
|
BOOST_CHECK_ETQUAL( test[ 0 ], 1u );
|
|
|
|
BOOST_CHECK_EQUAL( test[ 0 ], 1u );
|
|
|
|
BOOST_CHECK_ETQUAL( test[ 1 ], 2u );
|
|
|
|
BOOST_CHECK_EQUAL( test[ 1 ], 2u );
|
|
|
|
|
|
|
|
|
|
|
|
BOOST_CHECK_ETQUAL( *test.begin(), 1u );
|
|
|
|
BOOST_CHECK_EQUAL( *test.begin(), 1u );
|
|
|
|
BOOST_CHECK_ETQUAL( *( test.begin() + 1 ), 2u );
|
|
|
|
BOOST_CHECK_EQUAL( *( test.begin() + 1 ), 2u );
|
|
|
|
|
|
|
|
|
|
|
|
memvector<unsigned>::iterator iter = test.begin();
|
|
|
|
memvector<unsigned>::iterator iter = test.begin();
|
|
|
|
|
|
|
|
|
|
|
|
BOOST_CHECK_ETQUAL( *iter, 1u );
|
|
|
|
BOOST_CHECK_EQUAL( *iter, 1u );
|
|
|
|
|
|
|
|
|
|
|
|
BOOST_CHECK( test.begin() == iter );
|
|
|
|
BOOST_CHECK( test.begin() == iter );
|
|
|
|
|
|
|
|
|
|
|
|
*iter= 3;
|
|
|
|
*iter= 3;
|
|
|
|
|
|
|
|
|
|
|
|
BOOST_CHECK_ETQUAL( test[ 0 ], 3u );
|
|
|
|
BOOST_CHECK_EQUAL( test[ 0 ], 3u );
|
|
|
|
BOOST_CHECK_ETQUAL( *iter, 3u );
|
|
|
|
BOOST_CHECK_EQUAL( *iter, 3u );
|
|
|
|
BOOST_CHECK_ETQUAL( *test.begin(), 3u );
|
|
|
|
BOOST_CHECK_EQUAL( *test.begin(), 3u );
|
|
|
|
|
|
|
|
|
|
|
|
++iter;
|
|
|
|
++iter;
|
|
|
|
|
|
|
|
|
|
|
|
BOOST_CHECK_ETQUAL( *iter, 2u );
|
|
|
|
BOOST_CHECK_EQUAL( *iter, 2u );
|
|
|
|
|
|
|
|
|
|
|
|
*iter = 5;
|
|
|
|
*iter = 5;
|
|
|
|
|
|
|
|
|
|
|
|
BOOST_CHECK_ETQUAL( *iter, 5u );
|
|
|
|
BOOST_CHECK_EQUAL( *iter, 5u );
|
|
|
|
BOOST_CHECK_ETQUAL( test[ 1 ], 5u );
|
|
|
|
BOOST_CHECK_EQUAL( test[ 1 ], 5u );
|
|
|
|
|
|
|
|
|
|
|
|
BOOST_CHECK_ETQUAL( std::distance( test.begin(), test.end() ) , test.size() );
|
|
|
|
BOOST_CHECK_EQUAL( std::distance( test.begin(), test.end() ) , test.size() );
|
|
|
|
test.push_back( 5 );
|
|
|
|
test.push_back( 5 );
|
|
|
|
BOOST_CHECK_ETQUAL( std::distance( test.begin(), test.end() ) , test.size() );
|
|
|
|
BOOST_CHECK_EQUAL( std::distance( test.begin(), test.end() ) , test.size() );
|
|
|
|
test.push_back( 5 );
|
|
|
|
test.push_back( 5 );
|
|
|
|
BOOST_CHECK_ETQUAL( std::distance( test.begin(), test.end() ) , test.size() );
|
|
|
|
BOOST_CHECK_EQUAL( std::distance( test.begin(), test.end() ) , test.size() );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void test_iteration() {
|
|
|
|
void test_iteration() {
|
|
|
@ -133,15 +133,15 @@ void test_iteration() {
|
|
|
|
BOOST_CHECK( iter == test.begin() );
|
|
|
|
BOOST_CHECK( iter == test.begin() );
|
|
|
|
BOOST_CHECK( iter != test.end() );
|
|
|
|
BOOST_CHECK( iter != test.end() );
|
|
|
|
|
|
|
|
|
|
|
|
BOOST_CHECK_ETQUAL( *iter, 1u );
|
|
|
|
BOOST_CHECK_EQUAL( *iter, 1u );
|
|
|
|
++iter;
|
|
|
|
++iter;
|
|
|
|
BOOST_CHECK_ETQUAL( *iter, 2u );
|
|
|
|
BOOST_CHECK_EQUAL( *iter, 2u );
|
|
|
|
iter += 2;
|
|
|
|
iter += 2;
|
|
|
|
BOOST_CHECK_ETQUAL( *iter, 3u );
|
|
|
|
BOOST_CHECK_EQUAL( *iter, 3u );
|
|
|
|
*iter = 7;
|
|
|
|
*iter = 7;
|
|
|
|
BOOST_CHECK_ETQUAL( *iter, 7u );
|
|
|
|
BOOST_CHECK_EQUAL( *iter, 7u );
|
|
|
|
--iter;
|
|
|
|
--iter;
|
|
|
|
BOOST_CHECK_ETQUAL( *iter, 5u );
|
|
|
|
BOOST_CHECK_EQUAL( *iter, 5u );
|
|
|
|
BOOST_CHECK( iter != test.end() );
|
|
|
|
BOOST_CHECK( iter != test.end() );
|
|
|
|
iter += 2;
|
|
|
|
iter += 2;
|
|
|
|
BOOST_CHECK( iter == test.end() );
|
|
|
|
BOOST_CHECK( iter == test.end() );
|
|
|
@ -160,20 +160,20 @@ void test_sort() {
|
|
|
|
test.push_back( 3 );
|
|
|
|
test.push_back( 3 );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BOOST_CHECK_ETQUAL( *std::min_element( test.begin(), test.end() ), 0 );
|
|
|
|
BOOST_CHECK_EQUAL( *std::min_element( test.begin(), test.end() ), 0 );
|
|
|
|
BOOST_CHECK( std::min_element( test.begin(), test.end() ) == test.begin() + 1 );
|
|
|
|
BOOST_CHECK( std::min_element( test.begin(), test.end() ) == test.begin() + 1 );
|
|
|
|
BOOST_CHECK_ETQUAL( *std::max_element( test.begin(), test.end() ), 14 );
|
|
|
|
BOOST_CHECK_EQUAL( *std::max_element( test.begin(), test.end() ), 14 );
|
|
|
|
BOOST_CHECK( std::max_element( test.begin(), test.end() ) == test.begin() + 2 );
|
|
|
|
BOOST_CHECK( std::max_element( test.begin(), test.end() ) == test.begin() + 2 );
|
|
|
|
|
|
|
|
|
|
|
|
std::sort( test.begin(), test.end() );
|
|
|
|
std::sort( test.begin(), test.end() );
|
|
|
|
BOOST_CHECK_ETQUAL( test[ 0 ], 0 );
|
|
|
|
BOOST_CHECK_EQUAL( test[ 0 ], 0 );
|
|
|
|
BOOST_CHECK_ETQUAL( test[ 1 ], 3 );
|
|
|
|
BOOST_CHECK_EQUAL( test[ 1 ], 3 );
|
|
|
|
BOOST_CHECK_ETQUAL( test[ 2 ], 4 );
|
|
|
|
BOOST_CHECK_EQUAL( test[ 2 ], 4 );
|
|
|
|
BOOST_CHECK_ETQUAL( test[ 3 ], 5 );
|
|
|
|
BOOST_CHECK_EQUAL( test[ 3 ], 5 );
|
|
|
|
BOOST_CHECK_ETQUAL( test[ 4 ], 8 );
|
|
|
|
BOOST_CHECK_EQUAL( test[ 4 ], 8 );
|
|
|
|
BOOST_CHECK_ETQUAL( test[ 5 ], 10 );
|
|
|
|
BOOST_CHECK_EQUAL( test[ 5 ], 10 );
|
|
|
|
BOOST_CHECK_ETQUAL( test[ 6 ], 12 );
|
|
|
|
BOOST_CHECK_EQUAL( test[ 6 ], 12 );
|
|
|
|
BOOST_CHECK_ETQUAL( test[ 7 ], 14 );
|
|
|
|
BOOST_CHECK_EQUAL( test[ 7 ], 14 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void remove() {
|
|
|
|
void remove() {
|
|
|
@ -181,11 +181,11 @@ void remove() {
|
|
|
|
cleanup();
|
|
|
|
cleanup();
|
|
|
|
memvector<unsigned> test( fname );
|
|
|
|
memvector<unsigned> test( fname );
|
|
|
|
test.push_back( 1 );
|
|
|
|
test.push_back( 1 );
|
|
|
|
BOOST_CHECK_ETQUAL( test.size(), 1 );
|
|
|
|
BOOST_CHECK_EQUAL( test.size(), 1 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
memvector<unsigned>::remove( fname );
|
|
|
|
memvector<unsigned>::remove( fname );
|
|
|
|
memvector<unsigned> test( fname );
|
|
|
|
memvector<unsigned> test( fname );
|
|
|
|
BOOST_CHECK_ETQUAL( test.size(), 0 );
|
|
|
|
BOOST_CHECK_EQUAL( test.size(), 0 );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void assign() {
|
|
|
|
void assign() {
|
|
|
@ -193,7 +193,7 @@ void assign() {
|
|
|
|
memvector<uint32_t> test( fname );
|
|
|
|
memvector<uint32_t> test( fname );
|
|
|
|
test.push_back( 2 );
|
|
|
|
test.push_back( 2 );
|
|
|
|
test[ 0 ] = 3;
|
|
|
|
test[ 0 ] = 3;
|
|
|
|
BOOST_CHECK_ETQUAL( test[ 0 ], 3u );
|
|
|
|
BOOST_CHECK_EQUAL( test[ 0 ], 3u );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void erase() {
|
|
|
|
void erase() {
|
|
|
@ -205,20 +205,20 @@ void erase() {
|
|
|
|
test.push_back( 16 );
|
|
|
|
test.push_back( 16 );
|
|
|
|
test.push_back( 32 );
|
|
|
|
test.push_back( 32 );
|
|
|
|
|
|
|
|
|
|
|
|
BOOST_CHECK_ETQUAL( test.size(), 5u );
|
|
|
|
BOOST_CHECK_EQUAL( test.size(), 5u );
|
|
|
|
test.erase( test.begin() + 1 );
|
|
|
|
test.erase( test.begin() + 1 );
|
|
|
|
|
|
|
|
|
|
|
|
BOOST_CHECK_ETQUAL( test[ 0 ], 2u );
|
|
|
|
BOOST_CHECK_EQUAL( test[ 0 ], 2u );
|
|
|
|
BOOST_CHECK_ETQUAL( test[ 1 ], 8u );
|
|
|
|
BOOST_CHECK_EQUAL( test[ 1 ], 8u );
|
|
|
|
BOOST_CHECK_ETQUAL( test[ 2 ], 16u );
|
|
|
|
BOOST_CHECK_EQUAL( test[ 2 ], 16u );
|
|
|
|
BOOST_CHECK_ETQUAL( test[ 3 ], 32u );
|
|
|
|
BOOST_CHECK_EQUAL( test[ 3 ], 32u );
|
|
|
|
BOOST_CHECK_ETQUAL( test.size(), 4u );
|
|
|
|
BOOST_CHECK_EQUAL( test.size(), 4u );
|
|
|
|
|
|
|
|
|
|
|
|
test.erase( test.begin() + 3 );
|
|
|
|
test.erase( test.begin() + 3 );
|
|
|
|
BOOST_CHECK_ETQUAL( test[ 0 ], 2u );
|
|
|
|
BOOST_CHECK_EQUAL( test[ 0 ], 2u );
|
|
|
|
BOOST_CHECK_ETQUAL( test[ 1 ], 8u );
|
|
|
|
BOOST_CHECK_EQUAL( test[ 1 ], 8u );
|
|
|
|
BOOST_CHECK_ETQUAL( test[ 2 ], 16u );
|
|
|
|
BOOST_CHECK_EQUAL( test[ 2 ], 16u );
|
|
|
|
BOOST_CHECK_ETQUAL( test.size(), 3u );
|
|
|
|
BOOST_CHECK_EQUAL( test.size(), 3u );
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -234,7 +234,7 @@ void clear() {
|
|
|
|
test.clear();
|
|
|
|
test.clear();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BOOST_CHECK_ETQUAL( test.size(), 0u );
|
|
|
|
BOOST_CHECK_EQUAL( test.size(), 0u );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
test_suite* get_suite() {
|
|
|
|
test_suite* get_suite() {
|
|
|
|