From 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 20:24:20 +0200 Subject: Adding upstream version 14.2.21. Signed-off-by: Daniel Baumann --- src/boost/libs/intrusive/test/treap_set_test.cpp | 156 +++++++++++++++++++++++ 1 file changed, 156 insertions(+) create mode 100644 src/boost/libs/intrusive/test/treap_set_test.cpp (limited to 'src/boost/libs/intrusive/test/treap_set_test.cpp') diff --git a/src/boost/libs/intrusive/test/treap_set_test.cpp b/src/boost/libs/intrusive/test/treap_set_test.cpp new file mode 100644 index 00000000..f7987777 --- /dev/null +++ b/src/boost/libs/intrusive/test/treap_set_test.cpp @@ -0,0 +1,156 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2007-2015 +// +// Distributed under the Boost Software License, Version 1.0. +// (See accompanying file LICENSE_1_0.txt or copy at +// http://www.boost.org/LICENSE_1_0.txt) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// +#include "itestvalue.hpp" +#include "bptr_value.hpp" +#include "smart_ptr.hpp" +#include "bs_test_common.hpp" +#include "generic_set_test.hpp" +#include + +using namespace boost::intrusive; + +template < class ValueTraits, bool ConstantTimeSize, bool DefaultHolder, bool Map > +struct rebinder +{ + typedef tree_rebinder_common common_t; + typedef typename ValueContainer< typename ValueTraits::value_type >::type value_cont_type; + + template < class Option1 =void + , class Option2 =void + > + struct container + { + typedef treap_set + < typename common_t::value_type + , value_traits + , constant_time_size + , typename common_t::holder_opt + , typename common_t::key_of_value_opt + , typename common_t::prio_of_value_opt + , Option1 + , Option2 + > type; + BOOST_STATIC_ASSERT((key_type_tester::value)); + }; +}; + +enum HookType +{ + Base, + Member, + NonMember +}; + +template +class test_main_template; + +template +class test_main_template +{ + public: + static void execute() + { + typedef testvalue_traits< bs_hooks > testval_traits_t; + //base + typedef typename detail::if_c + < ConstantTimeSize + , typename testval_traits_t::base_value_traits + , typename testval_traits_t::auto_base_value_traits + >::type base_hook_t; + test::test_generic_set + < rebinder + >::test_all(); + } +}; + +template +class test_main_template +{ + public: + static void execute() + { + typedef testvalue_traits< bs_hooks > testval_traits_t; + //member + typedef typename detail::if_c + < ConstantTimeSize + , typename testval_traits_t::member_value_traits + , typename testval_traits_t::auto_member_value_traits + >::type member_hook_t; + test::test_generic_set + < rebinder + >::test_all(); + } +}; + +template +class test_main_template +{ + public: + static void execute() + { + typedef testvalue_traits< bs_hooks > testval_traits_t; + //nonmember + test::test_generic_set + < rebinder + >::test_all(); + } +}; + +template < bool ConstantTimeSize, bool Map > +struct test_main_template_bptr +{ + static void execute() + { + typedef BPtr_Value_Traits< Tree_BPtr_Node_Traits > value_traits; + typedef bounded_allocator< BPtr_Value > allocator_type; + + bounded_allocator_scope bounded_scope; (void)bounded_scope; + test::test_generic_set + < rebinder< value_traits, ConstantTimeSize, true, Map> + >::test_all(); + } +}; + +int main() +{ + //Combinations: VoidPointer x ConstantTimeSize x DefaultHolder x Map + //Minimize them selecting different combinations for raw and smart pointers + //Start with ('false', 'false', 'false') in sets and 'false', 'false', 'true' in multisets + + //void pointer + test_main_template::execute(); + //test_main_template::execute(); + test_main_template::execute(); + //test_main_template::execute(); + test_main_template::execute(); + //test_main_template::execute(); + test_main_template::execute(); + test_main_template::execute(); + + //smart_ptr + //test_main_template, false, false, false>::execute(); + test_main_template, false, false, true, Base>::execute(); + //test_main_template, false, true, false>::execute(); + test_main_template, false, true, true, Member>::execute(); + //test_main_template, true, false, false>::execute(); + test_main_template, true, false, true, NonMember>::execute(); + //test_main_template, true, true, false>::execute(); + //test_main_template, true, true, true>::execute(); + + //bounded_ptr (bool ConstantTimeSize, bool Map) + test_main_template_bptr< false, false >::execute(); + //test_main_template_bptr< false, true >::execute(); + //test_main_template_bptr< true, false >::execute(); + test_main_template_bptr< true, true >::execute(); + + return boost::report_errors(); +} -- cgit v1.2.3