change support python version
[platform/upstream/boost.git] / libs / ptr_container / test / ptr_deque.cpp
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 "sequence_test_data.hpp"
14 #include <boost/ptr_container/ptr_deque.hpp>
15 #include <boost/ptr_container/detail/ptr_container_disable_deprecated.hpp>
16
17 #if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED)
18 #pragma GCC diagnostic push
19 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
20 #endif
21
22 void test_ptr_deque()
23 {
24     reversible_container_test< ptr_deque<Base>, Base, Derived_class >();
25     reversible_container_test< ptr_deque<Value>, Value, Value >();
26     reversible_container_test< ptr_deque< nullable<Base> >, Base, Derived_class >();
27     reversible_container_test< ptr_deque< nullable<Value> >, Value, Value >();
28
29     container_assignment_test< ptr_deque<Base>, ptr_deque<Derived_class>, 
30                                Derived_class>();
31     container_assignment_test< ptr_deque< nullable<Base> >, 
32                                ptr_deque< nullable<Derived_class> >, 
33                                Derived_class>();
34     container_assignment_test< ptr_deque< nullable<Base> >, 
35                                ptr_deque<Derived_class>, 
36                                Derived_class>();
37     container_assignment_test< ptr_deque<Base>, 
38                                ptr_deque< nullable<Derived_class> >, 
39                                Derived_class>();                           
40
41     test_transfer< ptr_deque<Derived_class>, ptr_deque<Base>, Derived_class>();
42     
43     random_access_algorithms_test< ptr_deque<int> >();
44     ptr_deque<int> di;
45     di.push_front( new int(0) );
46     std::size_t size = 1u;
47     BOOST_CHECK_EQUAL( di.size(), size );
48 #ifndef BOOST_NO_AUTO_PTR
49     di.push_front( std::auto_ptr<int>( new int(1) ) );
50     ++size;
51 #endif
52 #ifndef BOOST_NO_CXX11_SMART_PTR
53     di.push_front( std::unique_ptr<int>( new int(2) ) );
54     ++size;
55 #endif
56     BOOST_CHECK_EQUAL( di.size(), size );
57 }
58
59 #if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED)
60 #pragma GCC diagnostic pop
61 #endif
62
63 using boost::unit_test::test_suite;
64
65 test_suite* init_unit_test_suite( int argc, char* argv[] )
66 {
67     test_suite* test = BOOST_TEST_SUITE( "Pointer Container Test Suite" );
68
69     test->add( BOOST_TEST_CASE( &test_ptr_deque ) );
70
71     return test;
72 }
73