2 // Boost.Pointer Container
4 // Copyright Thorsten Ottosen 2003-2005. Use, modification and
5 // distribution is subject to the Boost Software License, Version
6 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 // For more information, see http://www.boost.org/libs/ptr_container/
12 #include "test_data.hpp"
13 #include <boost/ptr_container/ptr_map.hpp>
18 void test_ptr_map_adapter()
20 //typedef_test< ptr_map<int, Base>, Derived >();
21 //typedef_test< ptr_map<int, Value>, Value >();
23 //associative_container_test< ptr_map<int, Base>, Base, Derived >();
24 //associative_container_test< ptr_map<int, Value>, Value, Value >();
26 //typedef_test< ptr_multimap<int, Base>, Derived >();
27 //typedef_test< ptr_multimap<int, Value>, Value >();
29 //associative_container_test< ptr_multimap<int, Base>, Base, Derived >();
30 //associative_container_test< ptr_multimap<int, Value>, Value, Value >();
33 string brian
= "brian";
35 ptr_map
<string
,int> m
;
36 m
.insert( joe
, new int( 4 ) );
37 m
.insert( brian
, std::auto_ptr
<int>( new int( 6 ) ) );
45 catch( const bad_ptr_container_operation
& )
48 ptr_map
<string
,int> m2
;
49 m2
.insert( m2
.begin(), *m
.begin() );
50 BOOST_CHECK( m
!= m2
);
51 BOOST_CHECK( m2
< m
);
52 m2
.insert( m2
.begin(), joe
, new int(5) );
53 BOOST_CHECK( m
!= m2
);
54 BOOST_CHECK( m2
> m
);
56 ptr_multimap
<string
,int> m3
;
57 m3
.insert( m3
.begin(), *m
.begin() );
58 BOOST_CHECK( m3
.size() == 1u );
59 m3
.insert( m3
.begin(), brian
, new int(11 ) );
60 BOOST_CHECK( m3
.size() == 2u );
64 #include <boost/test/included/unit_test.hpp>
66 using boost::unit_test::test_suite
;
68 test_suite
* init_unit_test_suite( int argc
, char* argv
[] )
70 test_suite
* test
= BOOST_TEST_SUITE( "Pointer Container Test Suite" );
72 test
->add( BOOST_TEST_CASE( &test_ptr_map_adapter
) );