]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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 | #define PTR_LIST_TEST 1 | |
13 | #define PTR_CONTAINER_DEBUG 0 | |
14 | ||
15 | #include <boost/test/unit_test.hpp> | |
16 | #include "sequence_test_data.hpp" | |
17 | #include <boost/ptr_container/ptr_list.hpp> | |
11fdf7f2 TL |
18 | #include <boost/ptr_container/detail/ptr_container_disable_deprecated.hpp> |
19 | ||
20 | #if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED) | |
21 | #pragma GCC diagnostic push | |
22 | #pragma GCC diagnostic ignored "-Wdeprecated-declarations" | |
23 | #endif | |
7c673cae FG |
24 | |
25 | void test_list() | |
26 | { | |
27 | ||
28 | reversible_container_test< ptr_list<Base>, Base, Derived_class >(); | |
29 | reversible_container_test< ptr_list<Value>, Value, Value >(); | |
30 | reversible_container_test< ptr_list< nullable<Base> >, Base, Derived_class >(); | |
31 | reversible_container_test< ptr_list< nullable<Value> >, Value, Value >(); | |
32 | ||
33 | container_assignment_test< ptr_list<Base>, ptr_list<Derived_class>, | |
34 | Derived_class>(); | |
35 | container_assignment_test< ptr_list< nullable<Base> >, | |
36 | ptr_list< nullable<Derived_class> >, | |
37 | Derived_class>(); | |
38 | container_assignment_test< ptr_list< nullable<Base> >, | |
39 | ptr_list<Derived_class>, | |
40 | Derived_class>(); | |
41 | container_assignment_test< ptr_list<Base>, | |
42 | ptr_list< nullable<Derived_class> >, | |
43 | Derived_class>(); | |
44 | ||
45 | test_transfer< ptr_list<Derived_class>, ptr_list<Base>, Derived_class>(); | |
46 | ||
47 | random_access_algorithms_test< ptr_list<int> >(); | |
48 | ptr_list<int> list; | |
49 | list.push_back( new int(0) ); | |
50 | list.push_back( new int(2) ); | |
51 | list.push_back( new int(1) ); | |
52 | list.push_front( new int(3) ); | |
11fdf7f2 | 53 | #ifndef BOOST_NO_AUTO_PTR |
7c673cae | 54 | list.push_front( std::auto_ptr<int>( new int(42) ) ); |
11fdf7f2 TL |
55 | #endif |
56 | #ifndef BOOST_NO_CXX11_SMART_PTR | |
57 | list.push_front( std::unique_ptr<int>( new int(43) ) ); | |
58 | #endif | |
7c673cae | 59 | list.reverse(); |
7c673cae FG |
60 | } |
61 | ||
11fdf7f2 TL |
62 | #if defined(BOOST_PTR_CONTAINER_DISABLE_DEPRECATED) |
63 | #pragma GCC diagnostic pop | |
64 | #endif | |
7c673cae FG |
65 | |
66 | using boost::unit_test::test_suite; | |
67 | ||
68 | test_suite* init_unit_test_suite( int argc, char* argv[] ) | |
69 | { | |
70 | test_suite* test = BOOST_TEST_SUITE( "Pointer Container Test Suite" ); | |
71 | ||
72 | test->add( BOOST_TEST_CASE( &test_list ) ); | |
73 | ||
74 | return test; | |
75 | } |