Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/ptr_container/test/ptr_set.cpp @ 33

Last change on this file since 33 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 1.7 KB
Line 
1//
2// Boost.Pointer Container
3//
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)
8//
9// For more information, see http://www.boost.org/libs/ptr_container/
10//
11 
12#include <boost/test/unit_test.hpp>
13#include "associative_test_data.hpp"
14#include <boost/ptr_container/ptr_set.hpp>
15
16template< class SetDerived, class SetBase, class T >
17void test_transfer()
18{
19    SetBase to;
20    SetDerived from;
21    from.insert( new T );
22    from.insert( new T );
23    transfer_test( from, to );
24}
25
26void test_set()
27{   
28
29    ptr_set_test< ptr_set<Base>, Base, Derived_class >();
30    ptr_set_test< ptr_set<Value>, Value, Value >();
31
32    ptr_set_test< ptr_multiset<Base>, Base, Derived_class >();
33    ptr_set_test< ptr_multiset<Value>, Value, Value >();
34
35    test_transfer< ptr_set<Derived_class>, ptr_set<Base>, Derived_class>();
36    test_transfer< ptr_multiset<Derived_class>, ptr_multiset<Base>, Derived_class>();
37   
38    ptr_set<int> set;
39
40    BOOST_CHECK_THROW( set.insert( 0 ), bad_ptr_container_operation );
41    set.insert( new int(0) );
42    set.insert( std::auto_ptr<int>( new int(1) ) );
43    BOOST_CHECK_THROW( (set.replace(set.begin(), 0 )), bad_ptr_container_operation );
44    BOOST_CHECK_THROW( (set.replace(set.begin(), std::auto_ptr<int>(0) )), bad_ptr_container_operation );
45
46
47}
48
49using boost::unit_test::test_suite;
50
51test_suite* init_unit_test_suite( int argc, char* argv[] )
52{
53    test_suite* test = BOOST_TEST_SUITE( "Pointer Container Test Suite" );
54
55    test->add( BOOST_TEST_CASE( &test_set ) );
56
57    return test;
58}
59
60
61
62
63
64
Note: See TracBrowser for help on using the repository browser.