1 /////////////////////////////////////////////////////////////////////////////
3 // (C) Copyright Ion Gaztanaga 2007-2013
5 // Distributed under the Boost Software License, Version 1.0.
6 // (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 // See http://www.boost.org/libs/intrusive for documentation.
11 /////////////////////////////////////////////////////////////////////////////
12 #include <boost/intrusive/sg_set.hpp>
13 #include "itestvalue.hpp"
14 #include "bptr_value.hpp"
15 #include "smart_ptr.hpp"
16 #include "bs_test_common.hpp"
17 #include "generic_set_test.hpp"
19 using namespace boost::intrusive
;
21 template < class ValueTraits
, bool FloatingPoint
, bool DefaultHolder
, bool Map
>
24 typedef tree_rebinder_common
<ValueTraits
, DefaultHolder
, Map
> common_t
;
25 typedef typename ValueContainer
< typename
ValueTraits::value_type
>::type value_cont_type
;
27 template < class Option1
=void
33 < typename
common_t::value_type
34 , value_traits
<ValueTraits
>
35 , floating_point
<FloatingPoint
>
36 , typename
common_t::holder_opt
37 , typename
common_t::key_of_value_opt
41 BOOST_STATIC_ASSERT((key_type_tester
<typename
common_t::key_of_value_opt
, type
>::value
));
52 template<class VoidPointer
, bool FloatingPoint
, bool DefaultHolder
, bool Map
, HookType Type
>
53 class test_main_template
;
55 template<class VoidPointer
, bool FloatingPoint
, bool DefaultHolder
, bool Map
>
56 class test_main_template
<VoidPointer
, FloatingPoint
, DefaultHolder
, Map
, Base
>
61 typedef testvalue_traits
< bs_hooks
<VoidPointer
> > testval_traits_t
;
63 typedef typename
testval_traits_t::base_value_traits base_hook_t
;
64 test::test_generic_set
65 < rebinder
<base_hook_t
, FloatingPoint
, DefaultHolder
, Map
>
70 template<class VoidPointer
, bool FloatingPoint
, bool DefaultHolder
, bool Map
>
71 class test_main_template
<VoidPointer
, FloatingPoint
, DefaultHolder
, Map
, Member
>
76 typedef testvalue_traits
< bs_hooks
<VoidPointer
> > testval_traits_t
;
78 typedef typename
testval_traits_t::member_value_traits member_hook_t
;
79 test::test_generic_set
80 < rebinder
<member_hook_t
, FloatingPoint
, DefaultHolder
, Map
>
85 template<class VoidPointer
, bool FloatingPoint
, bool DefaultHolder
, bool Map
>
86 class test_main_template
<VoidPointer
, FloatingPoint
, DefaultHolder
, Map
, NonMember
>
91 typedef testvalue_traits
< bs_hooks
<VoidPointer
> > testval_traits_t
;
93 test::test_generic_set
94 < rebinder
<typename
testval_traits_t::nonhook_value_traits
, FloatingPoint
, DefaultHolder
, Map
>
99 template < bool FloatingPoint
, bool Map
>
100 struct test_main_template_bptr
102 static void execute()
104 typedef BPtr_Value_Traits
< Tree_BPtr_Node_Traits
> value_traits
;
105 typedef bounded_allocator
< BPtr_Value
> allocator_type
;
107 bounded_allocator_scope
<allocator_type
> bounded_scope
; (void)bounded_scope
;
108 test::test_generic_set
109 < rebinder
< value_traits
, FloatingPoint
, true, Map
>
116 //Combinations: VoidPointer x FloatingPoint x DefaultHolder x Map
117 //Minimize them selecting different combinations for raw and smart pointers
118 //Start with ('false', 'false', 'false') in sets and 'false', 'false', 'true' in multisets
121 test_main_template
<void*, false, false, false, Base
>::execute();
122 //test_main_template<void*, false, false, true>::execute();
123 test_main_template
<void*, false, true, false, Member
>::execute();
124 //test_main_template<void*, false, true, true>::execute();
125 test_main_template
<void*, true, false, false, Base
>::execute();
126 //test_main_template<void*, true, false, true>::execute();
127 test_main_template
<void*, true, true, false, Member
>::execute();
128 test_main_template
<void*, true, true, true, NonMember
>::execute();
131 //test_main_template<smart_ptr<void>, false, false, false>::execute();
132 test_main_template
<smart_ptr
<void>, false, false, true, Base
>::execute();
133 //test_main_template<smart_ptr<void>, false, true, false>::execute();
134 test_main_template
<smart_ptr
<void>, false, true, true, Member
>::execute();
135 //test_main_template<smart_ptr<void>, true, false, false>::execute();
136 test_main_template
<smart_ptr
<void>, true, false, true, NonMember
>::execute();
137 //test_main_template<smart_ptr<void>, true, true, false>::execute();
138 //test_main_template<smart_ptr<void>, true, true, true>::execute();
140 //bounded_ptr (bool FloatingPoint, bool Map)
141 test_main_template_bptr
< false, false >::execute();
142 //test_main_template_bptr< false, true >::execute();
143 //test_main_template_bptr< true, false >::execute();
144 test_main_template_bptr
< true, true >::execute();
146 return boost::report_errors();