|
Boost-Commit : |
From: nesotto_at_[hidden]
Date: 2008-06-11 08:09:39
Author: nesotto
Date: 2008-06-11 08:09:38 EDT (Wed, 11 Jun 2008)
New Revision: 46320
URL: http://svn.boost.org/trac/boost/changeset/46320
Log:
update to support circular_buffer
Binary files modified:
trunk/libs/ptr_container/test/ptr_circular_buffer.cpp
Text files modified:
trunk/libs/ptr_container/test/Jamfile.v2 | 2 +-
trunk/libs/ptr_container/test/sequence_test_data.hpp | 33 ++++++++++++++++++++++-----------
trunk/libs/ptr_container/test/serialization.cpp | 26 ++++++++++++++++++++++++++
trunk/libs/ptr_container/test/test_data.hpp | 17 +++++++++++++++++
4 files changed, 66 insertions(+), 12 deletions(-)
Modified: trunk/libs/ptr_container/test/Jamfile.v2
==============================================================================
--- trunk/libs/ptr_container/test/Jamfile.v2 (original)
+++ trunk/libs/ptr_container/test/Jamfile.v2 2008-06-11 08:09:38 EDT (Wed, 11 Jun 2008)
@@ -37,6 +37,6 @@
[ sc-test ptr_unordered_set ]
[ sc-test ptr_unordered_map ]
- #[ sc-test ptr_circular_buffer ]
+ [ sc-test ptr_circular_buffer ]
;
Modified: trunk/libs/ptr_container/test/ptr_circular_buffer.cpp
==============================================================================
Binary files. No diff available.
Modified: trunk/libs/ptr_container/test/sequence_test_data.hpp
==============================================================================
--- trunk/libs/ptr_container/test/sequence_test_data.hpp (original)
+++ trunk/libs/ptr_container/test/sequence_test_data.hpp 2008-06-11 08:09:38 EDT (Wed, 11 Jun 2008)
@@ -19,13 +19,6 @@
template< class IntContainer >
void algorithms_test();
-template< class Cont >
-struct set_capacity
-{
- void operator()( Cont& ) const
- { }
-};
-
template< typename C, typename B, typename T >
void reversible_container_test()
{
@@ -39,16 +32,20 @@
c.push_back( new T );
BOOST_CHECK( c.size() == 1 );
+ const C c2_dummy( c.begin(), c.end() );
+ BOOST_CHECK_EQUAL( c2_dummy.size(), c.size() );
const C c2( c.clone() );
- BOOST_CHECK( c2.size() == c.size() );
+ BOOST_CHECK_EQUAL( c2.size(), c.size() );
C c3( c.begin(), c.end() );
- BOOST_CHECK( c.size() == c3.size() );
+ set_capacity<C>()( c3 );
+ BOOST_CHECK_EQUAL( c.size(), c3.size() );
c.assign( c3.begin(), c3.end() );
- BOOST_CHECK( c.size() == c3.size() );
+ BOOST_CHECK_EQUAL( c.size(), c3.size() );
c.assign( c3 );
+ set_capacity<C>()( c );
BOOST_MESSAGE( "finished construction test" );
C a_copy( c );
@@ -62,7 +59,7 @@
BOOST_MESSAGE( "finished copying test" );
BOOST_DEDUCED_TYPENAME C::allocator_type alloc = c.get_allocator();
- hide_warning(alloc);
+ hide_warning(alloc);
BOOST_DEDUCED_TYPENAME C::iterator i = c.begin();
BOOST_DEDUCED_TYPENAME C::const_iterator ci = c2.begin();
BOOST_DEDUCED_TYPENAME C::iterator i2 = c.end();
@@ -101,10 +98,13 @@
BOOST_MESSAGE( "finished accessors test" );
c.push_back( new T );
+ BOOST_CHECK_EQUAL( c.size(), 4u );
c.pop_back();
+ BOOST_CHECK( !c.empty() );
c.insert( c.end(), new T );
c.insert( c.end(), std::auto_ptr<T>( new T ) );
+ BOOST_CHECK_EQUAL( c.size(), 5u );
#if defined(BOOST_NO_SFINAE) || defined(BOOST_NO_FUNCTION_TEMPLATE_ORDERING)
#else
@@ -115,6 +115,7 @@
c3.erase( c3.begin(), c3.end() );
c3.erase( boost::make_iterator_range(c3) );
BOOST_CHECK( c3.empty() );
+ BOOST_CHECK( !c.empty() );
c.swap( c3 );
BOOST_CHECK( !c3.empty() );
c3.clear();
@@ -172,12 +173,17 @@
template< class CDerived, class CBase, class T >
void test_transfer()
{
+ BOOST_MESSAGE( "starting transfer test" );
CDerived from;
CBase to;
+ set_capacity<CDerived>()( from );
+ set_capacity<CBase>()( to );
+
from.push_back( new T );
from.push_back( new T );
to. BOOST_NESTED_TEMPLATE transfer<CDerived>( to.end(), from );
+ BOOST_MESSAGE( "finished transfer test" );
}
@@ -229,7 +235,10 @@
template< class IntContainer >
void random_access_algorithms_test()
{
+ BOOST_MESSAGE( "starting random accessors algorithms test" );
+
IntContainer c;
+ set_capacity<IntContainer>()( c );
assign::push_back( c )
( new int(1) )
( new int(3) )
@@ -274,6 +283,7 @@
// C = [0,2,3,6]
IntContainer c2;
+ set_capacity<IntContainer>()( c2 );
assign::push_back( c2 )
( new int(-1) )
( new int(1) )
@@ -285,5 +295,6 @@
BOOST_CHECK( c2.empty() );
BOOST_CHECK( c.size() == 9u );
BOOST_CHECK( is_sorted< std::less_equal<int> >( c ) );
+ BOOST_MESSAGE( "finished random accessors algorithms test" );
}
Modified: trunk/libs/ptr_container/test/serialization.cpp
==============================================================================
--- trunk/libs/ptr_container/test/serialization.cpp (original)
+++ trunk/libs/ptr_container/test/serialization.cpp 2008-06-11 08:09:38 EDT (Wed, 11 Jun 2008)
@@ -39,6 +39,25 @@
}
//
+// used to customize tests for circular_buffer
+//
+template< class Cont >
+struct set_capacity
+{
+ void operator()( Cont& ) const
+ { }
+};
+
+template<class T>
+struct set_capacity< ptr_circular_buffer<T> >
+{
+ void operator()( ptr_circular_buffer<T>& c ) const
+ {
+ c.set_capacity( 100u );
+ }
+};
+
+//
// class hierarchy
//
struct Base
@@ -121,6 +140,7 @@
void test_serialization_helper()
{
Cont vec;
+ set_capacity<Cont>()( vec );
add( vec, new Base( -1 ), 0u );
add( vec, new Derived( 1 ), 1u );
@@ -220,6 +240,12 @@
test_serialization_helper< boost::ptr_vector<Base>,
boost::archive::xml_oarchive,
boost::archive::xml_iarchive>();
+ test_serialization_helper< boost::ptr_circular_buffer<Base>,
+ boost::archive::text_oarchive,
+ boost::archive::text_iarchive>();
+ test_serialization_helper< boost::ptr_circular_buffer<Base>,
+ boost::archive::xml_oarchive,
+ boost::archive::xml_iarchive>();
test_serialization_helper< boost::ptr_array<Base,2>,
boost::archive::text_oarchive,
boost::archive::text_iarchive>();
Modified: trunk/libs/ptr_container/test/test_data.hpp
==============================================================================
--- trunk/libs/ptr_container/test/test_data.hpp (original)
+++ trunk/libs/ptr_container/test/test_data.hpp 2008-06-11 08:09:38 EDT (Wed, 11 Jun 2008)
@@ -278,15 +278,27 @@
{ }
//
+// used to customize tests for circular_buffer
+//
+template< class Cont >
+struct set_capacity
+{
+ void operator()( Cont& ) const
+ { }
+};
+
+//
// transfer() test
//
template< class Cont1, class Cont2 >
void transfer_test( Cont1& from, Cont2& to )
{
+ BOOST_MESSAGE( "starting container transfer test" );
BOOST_CHECK( !from.empty() );
to. BOOST_NESTED_TEMPLATE transfer<Cont1>( from );
BOOST_CHECK( !to.empty() );
+ BOOST_MESSAGE( "finishing container transfer test" );
}
@@ -297,7 +309,10 @@
template< class BaseContainer, class DerivedContainer, class Derived >
void container_assignment_test()
{
+ BOOST_MESSAGE( "starting container assignment test" );
+
DerivedContainer derived;
+ set_capacity<DerivedContainer>()( derived );
derived.insert( derived.begin(), new Derived );
derived.insert( derived.begin(), new Derived );
@@ -311,6 +326,8 @@
base2 = base;
BOOST_CHECK_EQUAL( base2.size(), base.size() );
base = base;
+
+ BOOST_MESSAGE( "finished container assignment test" );
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk