Unnamed: 0
int64
0
0
repo_id
stringlengths
5
186
file_path
stringlengths
15
223
content
stringlengths
1
32.8M
0
repos/unordered/test
repos/unordered/test/cfoa/rw_spinlock_test7.cpp
// Copyright 2023 Peter Dimov // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt #include <boost/unordered/detail/foa/rw_spinlock.hpp> #include <boost/compat/shared_lock.hpp> #include <boost/core/lightweight_test.hpp> #include <mutex> #include <thread> #include <cstdio> using boost::unordered::detail::foa::rw_spinlock; static int count = 0; static rw_spinlock sp; void f( int k, int n ) { std::printf( "Thread %d started.\n", k ); int i = 0; for( ;; ++i ) { int oldc; { boost::compat::shared_lock<rw_spinlock> lock( sp ); if( count >= n ) break; oldc = count; } { std::lock_guard<rw_spinlock> lock( sp ); if( count == oldc ) ++count; } } std::printf( "Thread %d finished (%i iterations).\n", k, i ); } int main() { int const N = 1000000; // total iterations int const M = 8; // threads std::thread th[ M ]; for( int i = 0; i < M; ++i ) { th[ i ] = std::thread( f, i, N ); } for( int i = 0; i < M; ++i ) { th[ i ].join(); } BOOST_TEST_EQ( count, N ); return boost::report_errors(); }
0
repos/unordered/test
repos/unordered/test/cfoa/rw_spinlock_test5.cpp
// Copyright 2023 Peter Dimov // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt #include <boost/unordered/detail/foa/rw_spinlock.hpp> #include <boost/compat/shared_lock.hpp> #include <boost/core/lightweight_test.hpp> #include <mutex> using boost::unordered::detail::foa::rw_spinlock; static rw_spinlock sp; int main() { { BOOST_TEST( sp.try_lock_shared() ); BOOST_TEST( sp.try_lock_shared() ); sp.unlock_shared(); sp.unlock_shared(); } { BOOST_TEST( sp.try_lock() ); BOOST_TEST( !sp.try_lock_shared() ); sp.unlock(); } { std::lock_guard<rw_spinlock> lock( sp ); BOOST_TEST( !sp.try_lock_shared() ); } { boost::compat::shared_lock<rw_spinlock> lock( sp ); BOOST_TEST( !sp.try_lock() ); BOOST_TEST( sp.try_lock_shared() ); sp.unlock_shared(); } return boost::report_errors(); }
0
repos/unordered/test
repos/unordered/test/cfoa/exception_insert_tests.cpp
// Copyright (C) 2023 Christian Mazakas // Copyright (C) 2023 Joaquin M Lopez Munoz // 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) #include "exception_helpers.hpp" #include <boost/unordered/concurrent_flat_map.hpp> #include <boost/unordered/concurrent_flat_set.hpp> #include <boost/core/ignore_unused.hpp> namespace { test::seed_t initialize_seed(73987); struct lvalue_inserter_type { template <class T, class X> void operator()(std::vector<T>& values, X& x) { enable_exceptions(); std::atomic<std::uint64_t> num_inserts{0}; thread_runner(values, [&x, &num_inserts](boost::span<T> s) { for (auto const& r : s) { try { bool b = x.insert(r); if (b) { ++num_inserts; } } catch (...) { } } }); disable_exceptions(); BOOST_TEST_EQ(raii::copy_assignment, 0u); BOOST_TEST_EQ(raii::move_assignment, 0u); } } lvalue_inserter; struct norehash_lvalue_inserter_type : public lvalue_inserter_type { template <class T, class X> void operator()(std::vector<T>& values, X& x) { x.reserve(values.size()); lvalue_inserter_type::operator()(values, x); BOOST_TEST_GT(raii::copy_constructor, 0u); BOOST_TEST_EQ(raii::move_constructor, 0u); } } norehash_lvalue_inserter; struct rvalue_inserter_type { template <class T, class X> void operator()(std::vector<T>& values, X& x) { BOOST_TEST_EQ(raii::copy_constructor, 0u); enable_exceptions(); std::atomic<std::uint64_t> num_inserts{0}; thread_runner(values, [&x, &num_inserts](boost::span<T> s) { for (auto& r : s) { try { bool b = x.insert(std::move(r)); if (b) { ++num_inserts; } } catch (...) { } } }); disable_exceptions(); if (!std::is_same<T, typename X::value_type>::value) { BOOST_TEST_EQ(raii::copy_constructor, 0u); } BOOST_TEST_EQ(raii::copy_assignment, 0u); BOOST_TEST_EQ(raii::move_assignment, 0u); } } rvalue_inserter; struct norehash_rvalue_inserter_type : public rvalue_inserter_type { template <class T, class X> void operator()(std::vector<T>& values, X& x) { static constexpr auto value_type_cardinality = value_cardinality<typename X::value_type>::value; x.reserve(values.size()); BOOST_TEST_EQ(raii::copy_constructor, 0u); BOOST_TEST_EQ(raii::move_constructor, 0u); rvalue_inserter_type::operator()(values, x); if (std::is_same<T, typename X::value_type>::value) { if (std::is_same<typename X::key_type, typename X::value_type>::value) { BOOST_TEST_EQ(raii::copy_constructor, 0u); BOOST_TEST_EQ(raii::move_constructor, x.size()); } else { BOOST_TEST_EQ(raii::copy_constructor, x.size()); BOOST_TEST_EQ(raii::move_constructor, x.size()); } } else { BOOST_TEST_EQ(raii::copy_constructor, 0u); BOOST_TEST_EQ( raii::move_constructor, value_type_cardinality * x.size()); } } } norehash_rvalue_inserter; struct iterator_range_inserter_type { template <class T, class X> void operator()(std::vector<T>& values, X& x) { for (std::size_t i = 0; i < 10; ++i) { x.insert(values[i]); } enable_exceptions(); thread_runner(values, [&x](boost::span<T> s) { try { x.insert(s.begin(), s.end()); } catch (...) { } }); disable_exceptions(); BOOST_TEST_EQ(raii::copy_assignment, 0u); BOOST_TEST_EQ(raii::move_assignment, 0u); } } iterator_range_inserter; struct lvalue_insert_or_assign_copy_assign_type { template <class T, class X> void operator()(std::vector<T>& values, X& x) { enable_exceptions(); thread_runner(values, [&x](boost::span<T> s) { for (auto& r : s) { try { x.insert_or_assign(r.first, r.second); } catch (...) { } } }); disable_exceptions(); BOOST_TEST_EQ(raii::default_constructor, 0u); BOOST_TEST_GT(raii::copy_constructor, 0u); BOOST_TEST_GT(raii::move_constructor, 0u); BOOST_TEST_EQ(raii::move_assignment, 0u); } } lvalue_insert_or_assign_copy_assign; struct lvalue_insert_or_assign_move_assign_type { template <class T, class X> void operator()(std::vector<T>& values, X& x) { enable_exceptions(); thread_runner(values, [&x](boost::span<T> s) { for (auto& r : s) { try { x.insert_or_assign(r.first, std::move(r.second)); } catch (...) { } } }); disable_exceptions(); BOOST_TEST_EQ(raii::default_constructor, 0u); BOOST_TEST_GT(raii::copy_constructor, 0u); BOOST_TEST_GT(raii::move_constructor, 0u); BOOST_TEST_EQ(raii::copy_assignment, 0u); } } lvalue_insert_or_assign_move_assign; struct rvalue_insert_or_assign_copy_assign_type { template <class T, class X> void operator()(std::vector<T>& values, X& x) { enable_exceptions(); thread_runner(values, [&x](boost::span<T> s) { for (auto& r : s) { try { x.insert_or_assign(std::move(r.first), r.second); } catch (...) { } } }); disable_exceptions(); BOOST_TEST_EQ(raii::default_constructor, 0u); BOOST_TEST_GT(raii::copy_constructor, 0u); BOOST_TEST_GT(raii::move_constructor, x.size()); // rehashing BOOST_TEST_EQ(raii::move_assignment, 0u); } } rvalue_insert_or_assign_copy_assign; struct rvalue_insert_or_assign_move_assign_type { template <class T, class X> void operator()(std::vector<T>& values, X& x) { enable_exceptions(); thread_runner(values, [&x](boost::span<T> s) { for (auto& r : s) { try { x.insert_or_assign(std::move(r.first), std::move(r.second)); } catch (...) { } } }); disable_exceptions(); BOOST_TEST_EQ(raii::default_constructor, 0u); BOOST_TEST_EQ(raii::copy_constructor, 0u); BOOST_TEST_GT(raii::move_constructor, 0u); BOOST_TEST_EQ(raii::copy_assignment, 0u); } } rvalue_insert_or_assign_move_assign; struct lvalue_insert_or_cvisit_type { template <class T, class X> void operator()(std::vector<T>& values, X& x) { std::atomic<std::uint64_t> num_inserts{0}; enable_exceptions(); thread_runner(values, [&x, &num_inserts](boost::span<T> s) { for (auto& r : s) { try { bool b = x.insert_or_cvisit( r, [](typename X::value_type const& v) { (void)v; }); if (b) { ++num_inserts; } } catch (...) { } } }); disable_exceptions(); BOOST_TEST_GT(num_inserts, 0u); BOOST_TEST_EQ(raii::default_constructor, 0u); // don't check move construction count here because of rehashing BOOST_TEST_GT(raii::move_constructor, 0u); BOOST_TEST_EQ(raii::move_assignment, 0u); } } lvalue_insert_or_cvisit; struct lvalue_insert_or_visit_type { template <class T, class X> void operator()(std::vector<T>& values, X& x) { // concurrent_flat_set visit is always const access using arg_type = typename std::conditional< std::is_same<typename X::key_type, typename X::value_type>::value, typename X::value_type const, typename X::value_type >::type; std::atomic<std::uint64_t> num_inserts{0}; enable_exceptions(); thread_runner(values, [&x, &num_inserts](boost::span<T> s) { for (auto& r : s) { try { bool b = x.insert_or_visit(r, [](arg_type& v) { (void)v; }); if (b) { ++num_inserts; } } catch (...) { } } }); disable_exceptions(); BOOST_TEST_GT(num_inserts, 0u); BOOST_TEST_EQ(raii::default_constructor, 0u); // don't check move construction count here because of rehashing BOOST_TEST_GT(raii::move_constructor, 0u); BOOST_TEST_EQ(raii::move_assignment, 0u); } } lvalue_insert_or_visit; struct rvalue_insert_or_cvisit_type { template <class T, class X> void operator()(std::vector<T>& values, X& x) { std::atomic<std::uint64_t> num_inserts{0}; enable_exceptions(); thread_runner(values, [&x, &num_inserts](boost::span<T> s) { for (auto& r : s) { try { bool b = x.insert_or_cvisit( std::move(r), [](typename X::value_type const& v) { (void)v; }); if (b) { ++num_inserts; } } catch (...) { } } }); disable_exceptions(); BOOST_TEST_GT(num_inserts, 0u); BOOST_TEST_EQ(raii::default_constructor, 0u); } } rvalue_insert_or_cvisit; struct rvalue_insert_or_visit_type { template <class T, class X> void operator()(std::vector<T>& values, X& x) { // concurrent_flat_set visit is always const access using arg_type = typename std::conditional< std::is_same<typename X::key_type, typename X::value_type>::value, typename X::value_type const, typename X::value_type >::type; std::atomic<std::uint64_t> num_inserts{0}; enable_exceptions(); thread_runner(values, [&x, &num_inserts](boost::span<T> s) { for (auto& r : s) { try { bool b = x.insert_or_visit( std::move(r), [](arg_type& v) { (void)v; }); if (b) { ++num_inserts; } } catch (...) { } } }); disable_exceptions(); BOOST_TEST_GT(num_inserts, 0u); BOOST_TEST_EQ(raii::default_constructor, 0u); if (!std::is_same<T, typename X::value_type>::value) { BOOST_TEST_EQ(raii::copy_constructor, 0u); } } } rvalue_insert_or_visit; struct iterator_range_insert_or_cvisit_type { template <class T, class X> void operator()(std::vector<T>& values, X& x) { for (std::size_t i = 0; i < 10; ++i) { x.insert(values[i]); } enable_exceptions(); thread_runner(values, [&x](boost::span<T> s) { try { x.insert_or_cvisit(s.begin(), s.end(), [](typename X::value_type const& v) { (void)v; }); } catch (...) { } }); disable_exceptions(); BOOST_TEST_EQ(raii::default_constructor, 0u); } } iterator_range_insert_or_cvisit; struct iterator_range_insert_or_visit_type { template <class T, class X> void operator()(std::vector<T>& values, X& x) { for (std::size_t i = 0; i < 10; ++i) { x.insert(values[i]); } enable_exceptions(); thread_runner(values, [&x](boost::span<T> s) { try { x.insert_or_visit(s.begin(), s.end(), [](typename X::value_type const& v) { (void)v; }); } catch (...) { } }); disable_exceptions(); BOOST_TEST_EQ(raii::default_constructor, 0u); } } iterator_range_insert_or_visit; template <class X, class GF, class F> void insert(X*, GF gen_factory, F inserter, test::random_generator rg) { disable_exceptions(); auto gen = gen_factory.template get<X>(); auto values = make_random_values(1024 * 16, [&] { return gen(rg); }); auto reference_cont = reference_container<X>(values.begin(), values.end()); raii::reset_counts(); { X x; inserter(values, x); test_fuzzy_matches_reference(x, reference_cont, rg); } check_raii_counts(); } boost::unordered::concurrent_flat_map<raii, raii, stateful_hash, stateful_key_equal, stateful_allocator<std::pair<raii const, raii> > >* map; boost::unordered::concurrent_flat_set<raii, stateful_hash, stateful_key_equal, stateful_allocator<raii> >* set; } // namespace using test::default_generator; using test::limited_range; using test::sequential; // clang-format off UNORDERED_TEST( insert, ((map)(set)) ((exception_value_type_generator_factory) (exception_init_type_generator_factory)) ((lvalue_inserter)(rvalue_inserter)(iterator_range_inserter) (norehash_lvalue_inserter)(norehash_rvalue_inserter) (lvalue_insert_or_cvisit)(lvalue_insert_or_visit) (rvalue_insert_or_cvisit)(rvalue_insert_or_visit) (iterator_range_insert_or_cvisit)(iterator_range_insert_or_visit)) ((default_generator)(sequential)(limited_range))) UNORDERED_TEST( insert, ((map)) ((exception_init_type_generator_factory)) ((lvalue_insert_or_assign_copy_assign)(lvalue_insert_or_assign_move_assign) (rvalue_insert_or_assign_copy_assign)(rvalue_insert_or_assign_move_assign)) ((default_generator)(sequential)(limited_range))) // clang-format on RUN_TESTS()
0
repos/unordered/test
repos/unordered/test/cfoa/equality_tests.cpp
// Copyright (C) 2023 Christian Mazakas // Copyright (C) 2023 Joaquin M Lopez Munoz // 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) #include "helpers.hpp" #include <boost/unordered/concurrent_flat_map.hpp> #include <boost/unordered/concurrent_flat_set.hpp> test::seed_t initialize_seed{1634048962}; using test::default_generator; using test::limited_range; using test::sequential; using hasher = stateful_hash; using key_equal = stateful_key_equal; using map_type = boost::unordered::concurrent_flat_map<raii, raii, hasher, key_equal, stateful_allocator<std::pair<raii const, raii> > >; using set_type = boost::unordered::concurrent_flat_set<raii, hasher, key_equal, stateful_allocator<raii> >; map_type* test_map; set_type* test_set; namespace { UNORDERED_AUTO_TEST (simple_map_equality) { using allocator_type = map_type::allocator_type; { map_type x1( {{1, 11}, {2, 22}}, 0, hasher(1), key_equal(2), allocator_type(3)); map_type x2( {{1, 11}, {2, 22}}, 0, hasher(2), key_equal(2), allocator_type(3)); map_type x3( {{1, 11}, {2, 23}}, 0, hasher(2), key_equal(2), allocator_type(3)); map_type x4({{1, 11}}, 0, hasher(2), key_equal(2), allocator_type(3)); BOOST_TEST_EQ(x1.size(), x2.size()); BOOST_TEST(x1 == x2); BOOST_TEST(!(x1 != x2)); BOOST_TEST_EQ(x1.size(), x3.size()); BOOST_TEST(!(x1 == x3)); BOOST_TEST(x1 != x3); BOOST_TEST(x1.size() != x4.size()); BOOST_TEST(!(x1 == x4)); BOOST_TEST(x1 != x4); } } UNORDERED_AUTO_TEST (simple_set_equality) { using allocator_type = set_type::allocator_type; { set_type x1( {1, 2}, 0, hasher(1), key_equal(2), allocator_type(3)); set_type x2( {1, 2}, 0, hasher(2), key_equal(2), allocator_type(3)); set_type x3({1}, 0, hasher(2), key_equal(2), allocator_type(3)); BOOST_TEST_EQ(x1.size(), x2.size()); BOOST_TEST(x1 == x2); BOOST_TEST(!(x1 != x2)); BOOST_TEST(x1.size() != x3.size()); BOOST_TEST(!(x1 == x3)); BOOST_TEST(x1 != x3); } } template <class X, class GF> void insert_and_compare(X*, GF gen_factory, test::random_generator rg) { using allocator_type = typename X::allocator_type; auto gen = gen_factory.template get<X>(); auto vals1 = make_random_values(1024 * 8, [&] { return gen(rg); }); auto reference_cont = reference_container<X>(vals1.begin(), vals1.end()); { raii::reset_counts(); X x1(vals1.size(), hasher(1), key_equal(2), allocator_type(3)); X x2(vals1.begin(), vals1.end(), vals1.size(), hasher(2), key_equal(2), allocator_type(3)); std::thread t1, t2; std::mutex m; std::condition_variable cv; std::atomic_bool done{false}; std::atomic<unsigned> num_compares{0}; bool ready = false; BOOST_TEST(x1.empty()); t1 = std::thread([&x1, &m, &cv, &vals1, &done, &ready] { for (std::size_t idx = 0; idx < vals1.size(); ++idx) { auto const& v = vals1[idx]; x1.insert(v); if (idx % (vals1.size() / 128) == 0) { { std::unique_lock<std::mutex> lk(m); ready = true; } cv.notify_all(); } std::this_thread::yield(); } done = true; { std::unique_lock<std::mutex> lk(m); ready = true; } cv.notify_all(); }); t2 = std::thread([&x1, &x2, &m, &cv, &done, &num_compares, &ready] { do { { std::unique_lock<std::mutex> lk(m); cv.wait(lk, [&ready] { return ready; }); ready = false; } volatile bool b = false; b = x1 == x2; b = x1 != x2; b; ++num_compares; std::this_thread::yield(); } while (!done); BOOST_TEST(done); }); t1.join(); t2.join(); BOOST_TEST_GE(num_compares, 1u); BOOST_TEST(x1 == x2); BOOST_TEST(!(x1 != x2)); test_matches_reference(x1, reference_cont); } check_raii_counts(); } } // namespace // clang-format off UNORDERED_TEST( insert_and_compare, ((test_map)(test_set)) ((value_type_generator_factory)) ((default_generator)(sequential)(limited_range))) // clang-format on RUN_TESTS()
0
repos/unordered/test
repos/unordered/test/cfoa/serialization_tests.cpp
// Copyright (C) 2023 Joaquin M Lopez Munoz // 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) #include "../objects/test.hpp" #include "../helpers/random_values.hpp" #include <boost/archive/text_oarchive.hpp> #include <boost/archive/text_iarchive.hpp> #include <boost/archive/xml_oarchive.hpp> #include <boost/archive/xml_iarchive.hpp> #include <boost/serialization/nvp.hpp> #include <boost/unordered/concurrent_flat_map.hpp> #include <boost/unordered/concurrent_flat_set.hpp> namespace { template <class Container, typename ArchivePair> void serialization_tests( Container*, ArchivePair*, test::random_generator generator) { using output_archive = typename ArchivePair::first_type ; using input_archive = typename ArchivePair::second_type; BOOST_LIGHTWEIGHT_TEST_OSTREAM << "serialization_tests1\n"; { Container c; std::ostringstream oss; { output_archive oa(oss); oa << boost::serialization::make_nvp("container", c); } test::random_values<Container> values(100, generator); Container c2(values.begin(), values.end()); std::istringstream iss(oss.str()); input_archive ia(iss); ia >> boost::serialization::make_nvp("container", c2); BOOST_TEST(c2.empty()); } BOOST_LIGHTWEIGHT_TEST_OSTREAM << "serialization_tests2\n"; { test::random_values<Container> values(100, generator); Container c(values.begin(), values.end()); std::ostringstream oss; { output_archive oa(oss); oa << boost::serialization::make_nvp("container", c); } Container c2; std::istringstream iss(oss.str()); input_archive ia(iss); ia >> boost::serialization::make_nvp("container", c2); BOOST_TEST(c == c2); } } using test::default_generator; std::pair< boost::archive::text_oarchive, boost::archive::text_iarchive>* text_archive; std::pair< boost::archive::xml_oarchive, boost::archive::xml_iarchive>* xml_archive; boost::concurrent_flat_map< test::object, test::object, test::hash, test::equal_to>* test_flat_map; boost::concurrent_flat_set< test::object, test::hash, test::equal_to>* test_flat_set; UNORDERED_TEST(serialization_tests, ((test_flat_map)(test_flat_set)) ((text_archive)(xml_archive)) ((default_generator))) } RUN_TESTS()
0
repos/unordered/test
repos/unordered/test/cfoa/explicit_alloc_ctor_tests.cpp
// Copyright 2024 Joaquin M Lopez Muoz. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at htT://www.boost.org/LICENSE_1_0.txt) #define BOOST_UNORDERED_CFOA_TESTS #include "../unordered/explicit_alloc_ctor_tests.cpp"
0
repos/unordered/test
repos/unordered/test/cfoa/rw_spinlock_test4.cpp
// Copyright 2023 Peter Dimov // Distributed under the Boost Software License, Version 1.0. // https://www.boost.org/LICENSE_1_0.txt #include <boost/unordered/detail/foa/rw_spinlock.hpp> #include <boost/compat/shared_lock.hpp> #include <mutex> using boost::unordered::detail::foa::rw_spinlock; static rw_spinlock sp; static rw_spinlock sp2; int main() { sp.lock(); sp2.lock_shared(); sp2.lock_shared(); sp.unlock(); sp2.unlock_shared(); sp2.unlock_shared(); { std::lock_guard<rw_spinlock> lock( sp ); boost::compat::shared_lock<rw_spinlock> lock2( sp2 ); boost::compat::shared_lock<rw_spinlock> lock3( sp2 ); } }
0
repos/unordered/test
repos/unordered/test/cfoa/emplace_tests.cpp
// Copyright (C) 2023 Christian Mazakas // Copyright (C) 2023 Joaquin M Lopez Munoz // Copyright (C) 2024 Braden Ganetsky // 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) #include "helpers.hpp" #include "../helpers/count.hpp" #include <boost/unordered/concurrent_flat_map.hpp> #include <boost/unordered/concurrent_flat_set.hpp> #include <boost/core/ignore_unused.hpp> namespace { test::seed_t initialize_seed(335740237); template <typename Container, typename Value> bool member_emplace(Container& x, Value const & v) { return x.emplace(v.x_); } template <typename Container, typename Key, typename Value> bool member_emplace(Container& x, std::pair<Key, Value> const & v) { return x.emplace(v.first.x_, v.second.x_); } template <typename Container, typename Value, typename F> bool member_emplace_or_visit(Container& x, Value& v, F f) { return x.emplace_or_visit(v.x_, f); } template <typename Container, typename Key, typename Value, typename F> bool member_emplace_or_visit(Container& x, std::pair<Key, Value>& v, F f) { return x.emplace_or_visit(v.first.x_, v.second.x_, f); } template <typename Container, typename Value, typename F> bool member_emplace_or_cvisit(Container& x, Value& v, F f) { return x.emplace_or_cvisit(v.x_, f); } template <typename Container, typename Key, typename Value, typename F> bool member_emplace_or_cvisit(Container& x, std::pair<Key, Value>& v, F f) { return x.emplace_or_cvisit(v.first.x_, v.second.x_, f); } struct lvalue_emplacer_type { template <class T, class X> void call_impl(std::vector<T>& values, X& x) { static constexpr auto value_type_cardinality = value_cardinality<typename X::value_type>::value; std::atomic<std::uint64_t> num_inserts{0}; thread_runner(values, [&x, &num_inserts](boost::span<T> s) { for (auto const& r : s) { bool b = member_emplace(x, r); if (b) { ++num_inserts; } } }); BOOST_TEST_EQ(num_inserts, x.size()); std::uint64_t const default_constructors = value_type_cardinality == 2 ? values.size() + num_inserts : values.size(); BOOST_TEST_EQ(raii::default_constructor, default_constructors); BOOST_TEST_EQ(raii::copy_constructor, 0u); BOOST_TEST_EQ(raii::copy_assignment, 0u); BOOST_TEST_EQ(raii::move_assignment, 0u); } template <class T, class X> void operator()(std::vector<T>& values, X& x) { static constexpr auto value_type_cardinality = value_cardinality<typename X::value_type>::value; call_impl(values, x); BOOST_TEST_GE(raii::move_constructor, value_type_cardinality * x.size()); } } lvalue_emplacer; struct norehash_lvalue_emplacer_type : public lvalue_emplacer_type { template <class T, class X> void operator()(std::vector<T>& values, X& x) { x.reserve(values.size()); lvalue_emplacer_type::call_impl(values, x); BOOST_TEST_EQ(raii::move_constructor, x.size()); } } norehash_lvalue_emplacer; struct lvalue_emplace_or_cvisit_type { template <class T, class X> void operator()(std::vector<T>& values, X& x) { static constexpr auto value_type_cardinality = value_cardinality<typename X::value_type>::value; std::atomic<std::uint64_t> num_inserts{0}; std::atomic<std::uint64_t> num_invokes{0}; thread_runner(values, [&x, &num_inserts, &num_invokes](boost::span<T> s) { for (auto& r : s) { bool b = member_emplace_or_cvisit( x, r, [&num_invokes](typename X::value_type const& v) { (void)v; ++num_invokes; }); if (b) { ++num_inserts; } } }); BOOST_TEST_EQ(num_inserts, x.size()); BOOST_TEST_EQ(num_invokes, values.size() - x.size()); BOOST_TEST_EQ( raii::default_constructor, value_type_cardinality * values.size()); BOOST_TEST_EQ(raii::copy_constructor, 0u); BOOST_TEST_GE(raii::move_constructor, value_type_cardinality * x.size()); BOOST_TEST_EQ(raii::move_assignment, 0u); BOOST_TEST_EQ(raii::copy_assignment, 0u); } } lvalue_emplace_or_cvisit; struct lvalue_emplace_or_visit_type { template <class T, class X> void operator()(std::vector<T>& values, X& x) { static constexpr auto value_type_cardinality = value_cardinality<typename X::value_type>::value; // concurrent_flat_set visit is always const access using arg_type = typename std::conditional< std::is_same<typename X::key_type, typename X::value_type>::value, typename X::value_type const, typename X::value_type >::type; std::atomic<std::uint64_t> num_inserts{0}; std::atomic<std::uint64_t> num_invokes{0}; thread_runner(values, [&x, &num_inserts, &num_invokes](boost::span<T> s) { for (auto& r : s) { bool b = member_emplace_or_visit( x, r, [&num_invokes](arg_type& v) { (void)v; ++num_invokes; }); if (b) { ++num_inserts; } } }); BOOST_TEST_EQ(num_inserts, x.size()); BOOST_TEST_EQ(num_invokes, values.size() - x.size()); BOOST_TEST_EQ( raii::default_constructor, value_type_cardinality * values.size()); BOOST_TEST_EQ(raii::copy_constructor, 0u); BOOST_TEST_GE(raii::move_constructor, value_type_cardinality * x.size()); BOOST_TEST_EQ(raii::move_assignment, 0u); BOOST_TEST_EQ(raii::copy_assignment, 0u); } } lvalue_emplace_or_visit; struct copy_emplacer_type { template <class T, class X> void operator()(std::vector<T>& values, X& x) { static constexpr auto value_type_cardinality = value_cardinality<typename X::value_type>::value; std::atomic<std::uint64_t> num_inserts{0}; thread_runner(values, [&x, &num_inserts](boost::span<T> s) { for (auto const& r : s) { bool b = x.emplace(r); if (b) { ++num_inserts; } } }); BOOST_TEST_EQ(num_inserts, x.size()); BOOST_TEST_EQ(raii::default_constructor, 0u); BOOST_TEST_EQ(raii::copy_constructor, value_type_cardinality * x.size()); BOOST_TEST_GT(raii::move_constructor, 0u); BOOST_TEST_EQ(raii::copy_assignment, 0u); BOOST_TEST_EQ(raii::move_assignment, 0u); } } copy_emplacer; struct move_emplacer_type { template <class T, class X> void operator()(std::vector<T>& values, X& x) { static constexpr auto value_type_cardinality = value_cardinality<typename X::value_type>::value; std::atomic<std::uint64_t> num_inserts{0}; thread_runner(values, [&x, &num_inserts](boost::span<T> s) { for (auto& r : s) { bool b = x.emplace(std::move(r)); if (b) { ++num_inserts; } } }); BOOST_TEST_EQ(num_inserts, x.size()); BOOST_TEST_EQ(raii::default_constructor, 0u); #if defined(BOOST_MSVC) #pragma warning(push) #pragma warning(disable : 4127) // conditional expression is constant #endif if (std::is_same<T, typename X::value_type>::value && !std::is_same<typename X::key_type, typename X::value_type>::value) { // map value_type can only be // copied, no move BOOST_TEST_EQ(raii::copy_constructor, x.size()); } else { BOOST_TEST_EQ(raii::copy_constructor, 0u); } #if defined(BOOST_MSVC) #pragma warning(pop) // C4127 #endif BOOST_TEST_GT(raii::move_constructor, value_type_cardinality * x.size()); BOOST_TEST_EQ(raii::copy_assignment, 0u); BOOST_TEST_EQ(raii::move_assignment, 0u); } } move_emplacer; template <class X, class GF, class F> void emplace(X*, GF gen_factory, F emplacer, test::random_generator rg) { auto gen = gen_factory.template get<X>(); auto values = make_random_values(1024 * 16, [&] { return gen(rg); }); auto reference_cont = reference_container<X>(values.begin(), values.end()); raii::reset_counts(); { X x; emplacer(values, x); BOOST_TEST_EQ(x.size(), reference_cont.size()); using value_type = typename X::value_type; BOOST_TEST_EQ(x.size(), x.visit_all([&](value_type const& v) { BOOST_TEST(reference_cont.contains(get_key(v))); if (rg == test::sequential) { BOOST_TEST_EQ(v, *reference_cont.find(get_key(v))); } })); } BOOST_TEST_GE(raii::default_constructor, 0u); BOOST_TEST_GE(raii::copy_constructor, 0u); BOOST_TEST_GE(raii::move_constructor, 0u); BOOST_TEST_GT(raii::destructor, 0u); BOOST_TEST_EQ(raii::default_constructor + raii::copy_constructor + raii::move_constructor, raii::destructor); } boost::unordered::concurrent_flat_map<raii, raii>* map; boost::unordered::concurrent_flat_set<raii>* set; } // namespace using test::default_generator; using test::limited_range; using test::sequential; // clang-format off UNORDERED_TEST( emplace, ((map)(set)) ((value_type_generator_factory)(init_type_generator_factory)) ((lvalue_emplacer)(norehash_lvalue_emplacer) (lvalue_emplace_or_cvisit)(lvalue_emplace_or_visit)(copy_emplacer)(move_emplacer)) ((default_generator)(sequential)(limited_range))) // clang-format on namespace { using converting_key_type = basic_raii<struct converting_key_tag_>; using converting_value_type = basic_raii<struct converting_value_tag_>; class counted_key_type : public basic_raii<struct counted_key_tag_> { public: using basic_raii::basic_raii; counted_key_type() = default; counted_key_type(const converting_key_type& k) : counted_key_type(k.x_) {} }; class counted_value_type : public basic_raii<struct counted_value_tag_> { public: using basic_raii::basic_raii; counted_value_type() = default; counted_value_type(const converting_value_type& v) : counted_value_type(v.x_) { } }; void reset_counts() { counted_key_type::reset_counts(); counted_value_type::reset_counts(); converting_key_type::reset_counts(); converting_value_type::reset_counts(); } using test::smf_count; template <class T> smf_count count_for() { return test::smf_count{ (int)T::default_constructor.load(std::memory_order_relaxed), (int)T::copy_constructor.load(std::memory_order_relaxed), (int)T::move_constructor.load(std::memory_order_relaxed), (int)T::copy_assignment.load(std::memory_order_relaxed), (int)T::move_assignment.load(std::memory_order_relaxed), (int)T::destructor.load(std::memory_order_relaxed)}; } enum emplace_kind { copy, move }; enum emplace_status { fail, success }; struct counted_key_checker_type { using key_type = counted_key_type; void operator()(emplace_kind kind, emplace_status status) { int copies = (kind == copy && status == success) ? 1 : 0; int moves = (kind == move && status == success) ? 1 : 0; BOOST_TEST_EQ( count_for<counted_key_type>(), (smf_count{0, copies, moves, 0, 0, 0})); } } counted_key_checker; struct converting_key_checker_type { using key_type = converting_key_type; void operator()(emplace_kind, emplace_status status) { int moves = (status == success) ? 1 : 0; BOOST_TEST_EQ( count_for<counted_key_type>(), (smf_count{1, 0, moves, 0, 0, 1})); } } converting_key_checker; struct counted_value_checker_type { using mapped_type = counted_value_type; void operator()(emplace_kind kind, emplace_status status) { int copies = (kind == copy && status == success) ? 1 : 0; int moves = (kind == move && status == success) ? 1 : 0; BOOST_TEST_EQ(count_for<counted_value_type>(), (smf_count{0, copies, moves, 0, 0, 0})); } } counted_value_checker; struct converting_value_checker_type { using mapped_type = converting_value_type; void operator()(emplace_kind, emplace_status status) { int ctors = (status == success) ? 1 : 0; BOOST_TEST_EQ( count_for<counted_value_type>(), (smf_count{ctors, 0, 0, 0, 0, 0})); } } converting_value_checker; template <class X, class KC, class VC> void emplace_map_key_value( X*, emplace_kind kind, KC key_checker, VC value_checker) { using container = X; using key_type = typename KC::key_type; using mapped_type = typename VC::mapped_type; container x; key_type key{}; key_type key2 = key; mapped_type value{}; mapped_type value2 = value; { reset_counts(); auto ret = (kind == copy) ? x.emplace(key, value) : x.emplace(std::move(key), std::move(value)); BOOST_TEST_EQ(ret, true); key_checker(kind, success); value_checker(kind, success); BOOST_TEST_EQ( count_for<converting_key_type>(), (smf_count{0, 0, 0, 0, 0, 0})); BOOST_TEST_EQ( count_for<converting_value_type>(), (smf_count{0, 0, 0, 0, 0, 0})); } { reset_counts(); bool ret = x.emplace(key2, value2); BOOST_TEST_EQ(ret, false); key_checker(kind, fail); value_checker(kind, fail); BOOST_TEST_EQ( count_for<converting_key_type>(), (smf_count{0, 0, 0, 0, 0, 0})); BOOST_TEST_EQ( count_for<converting_value_type>(), (smf_count{0, 0, 0, 0, 0, 0})); } { reset_counts(); bool ret = x.emplace(std::move(key2), std::move(value2)); BOOST_TEST_EQ(ret, false); key_checker(kind, fail); value_checker(kind, fail); BOOST_TEST_EQ( count_for<converting_key_type>(), (smf_count{0, 0, 0, 0, 0, 0})); BOOST_TEST_EQ( count_for<converting_value_type>(), (smf_count{0, 0, 0, 0, 0, 0})); } } boost::unordered::concurrent_flat_map<counted_key_type, counted_value_type>* test_counted_flat_map = {}; } // namespace // clang-format off UNORDERED_TEST( emplace_map_key_value, ((test_counted_flat_map)) ((copy)(move)) ((counted_key_checker)(converting_key_checker)) ((counted_value_checker)(converting_value_checker)) ) // clang-format on RUN_TESTS()
0
repos/unordered/test
repos/unordered/test/cfoa/clear_tests.cpp
// Copyright (C) 2023 Christian Mazakas // Copyright (C) 2023 Joaquin M Lopez Munoz // 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) #include "helpers.hpp" #include <boost/unordered/concurrent_flat_map.hpp> #include <boost/unordered/concurrent_flat_set.hpp> test::seed_t initialize_seed{674140082}; using test::default_generator; using test::limited_range; using test::sequential; using hasher = stateful_hash; using key_equal = stateful_key_equal; using map_type = boost::unordered::concurrent_flat_map<raii, raii, hasher, key_equal, stateful_allocator<std::pair<raii const, raii> > >; using set_type = boost::unordered::concurrent_flat_set<raii, hasher, key_equal, stateful_allocator<raii> >; map_type* test_map; set_type* test_set; namespace { template <class X, class GF> void clear_tests(X*, GF gen_factory, test::random_generator rg) { using value_type = typename X::value_type; static constexpr auto value_type_cardinality = value_cardinality<value_type>::value; using allocator_type = typename X::allocator_type; auto gen = gen_factory.template get<X>(); auto values = make_random_values(1024 * 16, [&] { return gen(rg); }); raii::reset_counts(); X x(values.begin(), values.end(), values.size(), hasher(1), key_equal(2), allocator_type(3)); auto const old_size = x.size(); auto const old_d = +raii::destructor; thread_runner(values, [&x](boost::span<value_type> s) { (void)s; x.clear(); }); BOOST_TEST(x.empty()); BOOST_TEST_EQ(raii::destructor, old_d + value_type_cardinality * old_size); check_raii_counts(); } template <class X, class GF> void insert_and_clear(X*, GF gen_factory, test::random_generator rg) { using allocator_type = typename X::allocator_type; auto gen = gen_factory.template get<X>(); auto values = make_random_values(1024 * 16, [&] { return gen(rg); }); auto reference_cont = reference_container<X>(values.begin(), values.end()); raii::reset_counts(); std::thread t1, t2; { X x(0, hasher(1), key_equal(2), allocator_type(3)); std::mutex m; std::condition_variable cv; std::atomic<bool> done{false}; std::atomic<unsigned> num_clears{0}; bool ready = false; t1 = std::thread([&x, &values, &cv, &done, &m, &ready] { for (auto i = 0u; i < values.size(); ++i) { x.insert(values[i]); if (i % (values.size() / 128) == 0) { { std::unique_lock<std::mutex> lk(m); ready = true; } cv.notify_all(); } } done = true; { std::unique_lock<std::mutex> lk(m); ready = true; } cv.notify_all(); }); t2 = std::thread([&x, &m, &cv, &done, &ready, &num_clears] { do { { std::unique_lock<std::mutex> lk(m); cv.wait(lk, [&ready] { return ready; }); ready = false; } x.clear(); ++num_clears; } while (!done); }); t1.join(); t2.join(); BOOST_TEST_GE(num_clears, 1u); if (!x.empty()) { test_fuzzy_matches_reference(x, reference_cont, rg); } } check_raii_counts(); } } // namespace // clang-format off UNORDERED_TEST( clear_tests, ((test_map)(test_set)) ((value_type_generator_factory)) ((default_generator)(sequential)(limited_range))) UNORDERED_TEST(insert_and_clear, ((test_map)(test_set)) ((value_type_generator_factory)) ((default_generator)(sequential)(limited_range))) // clang-format on RUN_TESTS()
0
repos/unordered/test
repos/unordered/test/cfoa/merge_tests.cpp
// Copyright (C) 2023 Christian Mazakas // Copyright (C) 2023 Joaquin M Lopez Munoz // 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) #include "helpers.hpp" #include <boost/unordered/concurrent_flat_map.hpp> #include <boost/unordered/concurrent_flat_set.hpp> test::seed_t initialize_seed{402031699}; using test::default_generator; using test::limited_range; using test::sequential; using hasher = stateful_hash; using key_equal = stateful_key_equal; using map_type = boost::unordered::concurrent_flat_map<raii, raii, hasher, key_equal, stateful_allocator<std::pair<raii const, raii> > >; using map2_type = boost::unordered::concurrent_flat_map<raii, raii, std::hash<raii>, std::equal_to<raii>, stateful_allocator<std::pair<raii const, raii> > >; using set_type = boost::unordered::concurrent_flat_set<raii, hasher, key_equal, stateful_allocator<raii> >; using set2_type = boost::unordered::concurrent_flat_set<raii, std::hash<raii>, std::equal_to<raii>, stateful_allocator<raii> >; map_type* test_map; map2_type* test_map2; auto test_maps=std::make_pair(test_map,test_map2); set_type* test_set; set2_type* test_set2; auto test_sets=std::make_pair(test_set,test_set2); struct { template <class X1, class X2> std::size_t operator()(X1& x1, X2& x2) const noexcept { return x1.merge(x2); } } lvalue_merge; struct { template <class X1, class X2> std::size_t operator()(X1& x1, X2& x2) const noexcept { return x1.merge(std::move(x2)); } } rvalue_merge; namespace { template <typename X, typename Y, class F, class GF> void merge_tests( std::pair<X*, Y*>, F merger, GF gen_factory, test::random_generator rg) { using value_type = typename X::value_type; static constexpr auto value_type_cardinality = value_cardinality<value_type>::value; using allocator_type = typename X::allocator_type; auto gen = gen_factory.template get<X>(); auto values = make_random_values(1024 * 8, [&] { return gen(rg); }); auto reference_cont = reference_container<X>(values.begin(), values.end()); { raii::reset_counts(); X x(values.size(), hasher(1), key_equal(2), allocator_type(3)); auto const old_cc = +raii::copy_constructor; std::atomic<unsigned long long> expected_copies{0}; std::atomic<unsigned long long> num_merged{0}; thread_runner(values, [&x, &expected_copies, &num_merged, merger]( boost::span<value_type> s) { Y y(s.size(), allocator_type(3)); for (auto const& v : s) { y.insert(v); } expected_copies += value_type_cardinality * y.size(); BOOST_TEST(x.get_allocator() == y.get_allocator()); num_merged += merger(x, y); }); BOOST_TEST_EQ(raii::copy_constructor, old_cc + expected_copies); BOOST_TEST_EQ( raii::move_constructor, value_type_cardinality * reference_cont.size()); BOOST_TEST_EQ(+num_merged, reference_cont.size()); test_fuzzy_matches_reference(x, reference_cont, rg); } check_raii_counts(); } template <typename X, typename Y, class GF> void insert_and_merge_tests( std::pair<X*, Y*>, GF gen_factory, test::random_generator rg) { static constexpr auto value_type_cardinality = value_cardinality<typename X::value_type>::value; using allocator_type = typename X::allocator_type; auto gen = gen_factory.template get<X>(); auto vals1 = make_random_values(1024 * 8, [&] { return gen(rg); }); auto vals2 = make_random_values(1024 * 4, [&] { return gen(rg); }); auto reference_cont = reference_container<X>(); reference_cont.insert(vals1.begin(), vals1.end()); reference_cont.insert(vals2.begin(), vals2.end()); { raii::reset_counts(); X x1(2 * vals1.size(), hasher(1), key_equal(2), allocator_type(3)); Y x2(2 * vals1.size(), allocator_type(3)); std::thread t1, t2, t3; boost::compat::latch l(2); std::mutex m; std::condition_variable cv; std::atomic_bool done1{false}, done2{false}; std::atomic<unsigned long long> num_merges{0}; std::atomic<unsigned long long> call_count{0}; bool ready = false; auto const old_mc = +raii::move_constructor; BOOST_TEST_EQ(old_mc, 0u); t1 = std::thread([&x1, &vals1, &l, &done1, &cv, &ready, &m] { l.arrive_and_wait(); for (std::size_t idx = 0; idx < vals1.size(); ++idx) { auto const& val = vals1[idx]; x1.insert(val); if (idx % (vals1.size() / 128) == 0) { { std::unique_lock<std::mutex> lk(m); ready = true; } cv.notify_all(); std::this_thread::yield(); } } done1 = true; { std::unique_lock<std::mutex> lk(m); ready = true; } cv.notify_all(); }); t2 = std::thread([&x2, &vals2, &l, &done2, &cv, &m, &ready] { l.arrive_and_wait(); for (std::size_t idx = 0; idx < vals2.size(); ++idx) { auto const& val = vals2[idx]; x2.insert(val); if (idx % 100 == 0) { std::this_thread::yield(); } } done2 = true; { std::unique_lock<std::mutex> lk(m); ready = true; } cv.notify_all(); }); t3 = std::thread( [&x1, &x2, &m, &cv, &done1, &done2, &num_merges, &call_count, &ready] { while (x1.empty() && x2.empty()) { } do { { std::unique_lock<std::mutex> lk(m); cv.wait(lk, [&ready] { return ready; }); ready = false; } num_merges += x1.merge(x2); std::this_thread::yield(); num_merges += x2.merge(x1); call_count += 1; } while (!done1 || !done2); BOOST_TEST(done1); BOOST_TEST(done2); }); t1.join(); t2.join(); t3.join(); if (num_merges > 0) { // num merges is 0 most commonly in the cast of the limited_range // generator as both maps will contains keys from 0 to 99 BOOST_TEST_EQ( +raii::move_constructor, value_type_cardinality * num_merges); BOOST_TEST_GE(call_count, 1u); } x1.merge(x2); test_fuzzy_matches_reference(x1, reference_cont, rg); } check_raii_counts(); } } // namespace // clang-format off UNORDERED_TEST( merge_tests, ((test_maps)(test_sets)) ((lvalue_merge)(rvalue_merge)) ((value_type_generator_factory)) ((default_generator)(sequential)(limited_range))) UNORDERED_TEST( insert_and_merge_tests, ((test_maps)(test_sets)) ((value_type_generator_factory)) ((default_generator)(sequential)(limited_range))) // clang-format on RUN_TESTS()
0
repos/unordered/test
repos/unordered/test/cfoa/exception_merge_tests.cpp
// Copyright (C) 2023 Christian Mazakas // Copyright (C) 2023 Joaquin M Lopez Munoz // 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) #include "exception_helpers.hpp" #include <boost/unordered/concurrent_flat_map.hpp> #include <boost/unordered/concurrent_flat_set.hpp> #include <boost/core/ignore_unused.hpp> using hasher = stateful_hash; using key_equal = stateful_key_equal; using map_type = boost::unordered::concurrent_flat_map<raii, raii, hasher, key_equal, stateful_allocator<std::pair<raii const, raii> > >; using set_type = boost::unordered::concurrent_flat_set<raii, hasher, key_equal, stateful_allocator<raii> >; map_type* test_map; set_type* test_set; namespace { test::seed_t initialize_seed(223333016); template <class X, class GF> void merge(X*, GF gen_factory, test::random_generator rg) { using allocator_type = typename X::allocator_type; auto gen = gen_factory.template get<X>(); auto values = make_random_values(1024 * 16, [&] { return gen(rg); }); auto reference_cont = reference_container<X>(values.begin(), values.end()); raii::reset_counts(); auto begin = values.begin(); auto mid = begin + static_cast<std::ptrdiff_t>(values.size() / 2); auto end = values.end(); { unsigned num_throws = 0; for (unsigned i = 0; i < 5 * alloc_throw_threshold; ++i) { disable_exceptions(); X x1(0, hasher(1), key_equal(2), allocator_type(3)); x1.insert(begin, mid); X x2(0, hasher(2), key_equal(1), allocator_type(3)); x2.insert(mid, end); enable_exceptions(); try { x1.merge(x2); } catch (...) { ++num_throws; } disable_exceptions(); test_fuzzy_matches_reference(x1, reference_cont, rg); test_fuzzy_matches_reference(x2, reference_cont, rg); } BOOST_TEST_GT(num_throws, 0u); } check_raii_counts(); } } // namespace using test::default_generator; using test::limited_range; using test::sequential; // clang-format off UNORDERED_TEST( merge, ((test_map)(test_set)) ((exception_value_type_generator_factory)) ((default_generator)(sequential)(limited_range))) // clang-format on RUN_TESTS()
0
repos/unordered/test
repos/unordered/test/cmake_install_test/CMakeLists.txt
# Copyright 2018, 2019, 2021 Peter Dimov # 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 cmake_minimum_required(VERSION 3.5...3.20) project(cmake_install_test LANGUAGES CXX) find_package(boost_unordered REQUIRED) add_executable(quick ../quick.cpp) target_link_libraries(quick Boost::unordered) enable_testing() add_test(quick quick) add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
0
repos/unordered/test
repos/unordered/test/legacy_archives/multiset_int_0.txt
22 serialization::archive 19 0 0 0 0 0 0 0
0
repos/unordered/test
repos/unordered/test/legacy_archives/set_string_100.txt
22 serialization::archive 19 0 0 100 193 0 10 1970368353 10 2417781066 10 3186940620 10 1421489007 9 776215953 10 1775667486 9 159865104 10 2355967322 10 2748750790 10 1832705803 10 4239032041 10 3876107121 10 3479493952 10 2600961200 10 1241175627 9 258343568 10 1630722604 10 3255615729 7 5018725 10 2774454326 10 2825882502 9 581989062 9 178482033 10 1786883066 9 286273879 10 2298524549 9 259868705 9 601527218 9 411876340 10 4029502563 9 109292002 9 941660988 10 4256439559 10 3401943278 10 2663762324 10 3042379069 10 2509159060 10 1859681623 10 3356491351 10 2620626957 10 2652233125 10 1568788209 9 607596425 10 2868860431 9 670291604 10 2764558328 10 3226376894 10 3930851132 10 3801137760 9 287343763 10 2138619156 9 257760945 9 967560929 10 2056892401 10 1829132124 10 3807848133 9 310524955 9 190104374 10 1481537722 10 2361415202 10 2148764457 10 3862464713 10 3862418431 9 918842470 9 183526573 10 2097663454 10 3377617071 9 167237906 10 2492774796 10 3254104696 10 3551458167 10 3989581123 10 2427983947 9 430136711 10 2975706254 10 1198739057 9 473010817 10 2075478837 10 2956234822 10 3435288264 10 2491360284 10 4076377133 10 3869918764 9 647803737 9 669358715 9 177811234 10 1021729225 10 2327152015 10 3793441059 9 390937317 10 2421236149 10 3346291068 10 3880200042 10 2299140636 10 3743837736 10 1315739433 10 2784034063 10 1354395138 10 4062777255 10 3126701396 0 0 152 0 10 3356491351 10 3356491351 10 2600961200 10 2509159060 10 1021729225 10 1021729225 10 1832705803 10 1832705803 9 581989062 10 1354395138 10 2097663454 10 3551458167 10 3551458167 10 3126701396 10 3880200042 10 3255615729 10 3255615729 9 167237906 9 177811234 10 3930851132 10 2361415202 9 259868705 9 259868705 10 3793441059 10 3793441059 9 776215953 9 776215953 10 1630722604 9 310524955 9 310524955 9 473010817 9 473010817 10 1970368353 10 1970368353 9 647803737 9 647803737 10 3042379069 10 3042379069 9 669358715 9 669358715 10 2075478837 10 2075478837 10 2299140636 9 109292002 10 1421489007 10 1421489007 9 287343763 9 287343763 10 3186940620 10 1829132124 10 2748750790 9 941660988 10 3989581123 10 3989581123 10 3479493952 10 2417781066 9 601527218 10 4256439559 10 4256439559 10 3226376894 10 1568788209 10 1568788209 10 1198739057 10 1198739057 10 2138619156 10 4076377133 10 4076377133 10 2825882502 10 3801137760 10 4062777255 10 4062777255 10 2620626957 10 2620626957 10 1775667486 10 3346291068 10 2956234822 9 178482033 9 178482033 9 918842470 10 3377617071 10 3377617071 9 390937317 9 390937317 10 3876107121 10 3876107121 9 670291604 10 1859681623 10 1859681623 10 1241175627 10 1241175627 10 3807848133 10 3807848133 10 1315739433 10 1315739433 10 2355967322 10 1786883066 10 4239032041 10 4239032041 10 2148764457 10 2148764457 10 2427983947 10 2427983947 9 607596425 9 607596425 10 3869918764 10 3401943278 10 2421236149 10 2421236149 9 159865104 9 411876340 10 2056892401 10 2056892401 10 2652233125 10 2652233125 10 2298524549 10 2298524549 9 257760945 9 257760945 10 2663762324 10 2492774796 10 3862418431 10 3862418431 10 3743837736 10 2975706254 10 3435288264 10 2784034063 10 2784034063 9 286273879 9 286273879 10 1481537722 9 258343568 10 4029502563 10 4029502563 10 3862464713 10 3862464713 10 2327152015 10 2327152015 10 2764558328 9 967560929 9 967560929 10 2868860431 10 2868860431 9 190104374 9 430136711 9 430136711 10 2491360284 10 2774454326 7 5018725 7 5018725 9 183526573 9 183526573 10 3254104696
0
repos/unordered/test
repos/unordered/test/legacy_archives/map_int_100.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="19"> <container class_id="0" tracking_level="0" version="0"> <count>100</count> <bucket_count>193</bucket_count> <item_version>0</item_version> <item class_id="1" tracking_level="0" version="0"> <first>1775667486</first> <second>1775667486</second> </item> <item> <first>-948676228</first> <second>-948676228</second> </item> <item> <first>-1108026676</first> <second>-1108026676</second> </item> <item> <first>-1866983349</first> <second>-1866983349</second> </item> <item> <first>258343568</first> <second>258343568</second> </item> <item> <first>-1068590402</first> <second>-1068590402</second> </item> <item> <first>-432548865</first> <second>-432548865</second> </item> <item> <first>177811234</first> <second>177811234</second> </item> <item> <first>5018725</first> <second>5018725</second> </item> <item> <first>190104374</first> <second>190104374</second> </item> <item> <first>1315739433</first> <second>1315739433</second> </item> <item> <first>-1995826660</first> <second>-1995826660</second> </item> <item> <first>-305386173</first> <second>-305386173</second> </item> <item> <first>287343763</first> <second>287343763</second> </item> <item> <first>1241175627</first> <second>1241175627</second> </item> <item> <first>109292002</first> <second>109292002</second> </item> <item> <first>1021729225</first> <second>1021729225</second> </item> <item> <first>918842470</first> <second>918842470</second> </item> <item> <first>-1426106865</first> <second>-1426106865</second> </item> <item> <first>-1338732474</first> <second>-1338732474</second> </item> <item> <first>669358715</first> <second>669358715</second> </item> <item> <first>183526573</first> <second>183526573</second> </item> <item> <first>-938475945</first> <second>-938475945</second> </item> <item> <first>-1694006096</first> <second>-1694006096</second> </item> <item> <first>1630722604</first> <second>1630722604</second> </item> <item> <first>-1933552094</first> <second>-1933552094</second> </item> <item> <first>257760945</first> <second>257760945</second> </item> <item> <first>390937317</first> <second>390937317</second> </item> <item> <first>-1510933233</first> <second>-1510933233</second> </item> <item> <first>259868705</first> <second>259868705</second> </item> <item> <first>-38527737</first> <second>-38527737</second> </item> <item> <first>-551129560</first> <second>-551129560</second> </item> <item> <first>1832705803</first> <second>1832705803</second> </item> <item> <first>607596425</first> <second>607596425</second> </item> <item> <first>-1520512970</first> <second>-1520512970</second> </item> <item> <first>-1674340339</first> <second>-1674340339</second> </item> <item> <first>1421489007</first> <second>1421489007</second> </item> <item> <first>-501526237</first> <second>-501526237</second> </item> <item> <first>-1873731147</first> <second>-1873731147</second> </item> <item> <first>-1877186230</first> <second>-1877186230</second> </item> <item> <first>-218590163</first> <second>-218590163</second> </item> <item> <first>647803737</first> <second>647803737</second> </item> <item> <first>-859679032</first> <second>-859679032</second> </item> <item> <first>967560929</first> <second>967560929</second> </item> <item> <first>-815473344</first> <second>-815473344</second> </item> <item> <first>-487119163</first> <second>-487119163</second> </item> <item> <first>-1546216506</first> <second>-1546216506</second> </item> <item> <first>1859681623</first> <second>1859681623</second> </item> <item> <first>-1040862600</first> <second>-1040862600</second> </item> <item> <first>-893024018</first> <second>-893024018</second> </item> <item> <first>-1252588227</first> <second>-1252588227</second> </item> <item> <first>-1319261042</first> <second>-1319261042</second> </item> <item> <first>-1785808236</first> <second>-1785808236</second> </item> <item> <first>1198739057</first> <second>1198739057</second> </item> <item> <first>-1469084794</first> <second>-1469084794</second> </item> <item> <first>473010817</first> <second>473010817</second> </item> <item> <first>1481537722</first> <second>1481537722</second> </item> <item> <first>2138619156</first> <second>2138619156</second> </item> <item> <first>-1039351567</first> <second>-1039351567</second> </item> <item> <first>-493829536</first> <second>-493829536</second> </item> <item> <first>411876340</first> <second>411876340</second> </item> <item> <first>-364116164</first> <second>-364116164</second> </item> <item> <first>776215953</first> <second>776215953</second> </item> <item> <first>1568788209</first> <second>1568788209</second> </item> <item> <first>-1631204972</first> <second>-1631204972</second> </item> <item> <first>601527218</first> <second>601527218</second> </item> <item> <first>-232190041</first> <second>-232190041</second> </item> <item> <first>286273879</first> <second>286273879</second> </item> <item> <first>2075478837</first> <second>2075478837</second> </item> <item> <first>-1168265900</first> <second>-1168265900</second> </item> <item> <first>581989062</first> <second>581989062</second> </item> <item> <first>178482033</first> <second>178482033</second> </item> <item> <first>1354395138</first> <second>1354395138</second> </item> <item> <first>-1530408968</first> <second>-1530408968</second> </item> <item> <first>-414767254</first> <second>-414767254</second> </item> <item> <first>1970368353</first> <second>1970368353</second> </item> <item> <first>-1967815281</first> <second>-1967815281</second> </item> <item> <first>941660988</first> <second>941660988</second> </item> <item> <first>1786883066</first> <second>1786883066</second> </item> <item> <first>670291604</first> <second>670291604</second> </item> <item> <first>-1803607012</first> <second>-1803607012</second> </item> <item> <first>1829132124</first> <second>1829132124</second> </item> <item> <first>-432502583</first> <second>-432502583</second> </item> <item> <first>-1642734171</first> <second>-1642734171</second> </item> <item> <first>-425048532</first> <second>-425048532</second> </item> <item> <first>2097663454</first> <second>2097663454</second> </item> <item> <first>-1938999974</first> <second>-1938999974</second> </item> <item> <first>-917350225</first> <second>-917350225</second> </item> <item> <first>2056892401</first> <second>2056892401</second> </item> <item> <first>-55935255</first> <second>-55935255</second> </item> <item> <first>-1802192500</first> <second>-1802192500</second> </item> <item> <first>-418860175</first> <second>-418860175</second> </item> <item> <first>-2146202839</first> <second>-2146202839</second> </item> <item> <first>310524955</first> <second>310524955</second> </item> <item> <first>159865104</first> <second>159865104</second> </item> <item> <first>-265464733</first> <second>-265464733</second> </item> <item> <first>-1996442747</first> <second>-1996442747</second> </item> <item> <first>430136711</first> <second>430136711</second> </item> <item> <first>-743509129</first> <second>-743509129</second> </item> <item> <first>167237906</first> <second>167237906</second> </item> </container> <values class_id="2" tracking_level="0" version="0"> <count>152</count> <item_version>0</item_version> <item class_id="3" tracking_level="0" version="0"> <first>-938475945</first> <second>-938475945</second> </item> <item> <first>-938475945</first> <second>-938475945</second> </item> <item> <first>-1694006096</first> <second>-1694006096</second> </item> <item> <first>-1785808236</first> <second>-1785808236</second> </item> <item> <first>1021729225</first> <second>1021729225</second> </item> <item> <first>1021729225</first> <second>1021729225</second> </item> <item> <first>1832705803</first> <second>1832705803</second> </item> <item> <first>1832705803</first> <second>1832705803</second> </item> <item> <first>581989062</first> <second>581989062</second> </item> <item> <first>1354395138</first> <second>1354395138</second> </item> <item> <first>2097663454</first> <second>2097663454</second> </item> <item> <first>-743509129</first> <second>-743509129</second> </item> <item> <first>-743509129</first> <second>-743509129</second> </item> <item> <first>-1168265900</first> <second>-1168265900</second> </item> <item> <first>-414767254</first> <second>-414767254</second> </item> <item> <first>-1039351567</first> <second>-1039351567</second> </item> <item> <first>-1039351567</first> <second>-1039351567</second> </item> <item> <first>167237906</first> <second>167237906</second> </item> <item> <first>177811234</first> <second>177811234</second> </item> <item> <first>-364116164</first> <second>-364116164</second> </item> <item> <first>-1933552094</first> <second>-1933552094</second> </item> <item> <first>259868705</first> <second>259868705</second> </item> <item> <first>259868705</first> <second>259868705</second> </item> <item> <first>-501526237</first> <second>-501526237</second> </item> <item> <first>-501526237</first> <second>-501526237</second> </item> <item> <first>776215953</first> <second>776215953</second> </item> <item> <first>776215953</first> <second>776215953</second> </item> <item> <first>1630722604</first> <second>1630722604</second> </item> <item> <first>310524955</first> <second>310524955</second> </item> <item> <first>310524955</first> <second>310524955</second> </item> <item> <first>473010817</first> <second>473010817</second> </item> <item> <first>473010817</first> <second>473010817</second> </item> <item> <first>1970368353</first> <second>1970368353</second> </item> <item> <first>1970368353</first> <second>1970368353</second> </item> <item> <first>647803737</first> <second>647803737</second> </item> <item> <first>647803737</first> <second>647803737</second> </item> <item> <first>-1252588227</first> <second>-1252588227</second> </item> <item> <first>-1252588227</first> <second>-1252588227</second> </item> <item> <first>669358715</first> <second>669358715</second> </item> <item> <first>669358715</first> <second>669358715</second> </item> <item> <first>2075478837</first> <second>2075478837</second> </item> <item> <first>2075478837</first> <second>2075478837</second> </item> <item> <first>-1995826660</first> <second>-1995826660</second> </item> <item> <first>109292002</first> <second>109292002</second> </item> <item> <first>1421489007</first> <second>1421489007</second> </item> <item> <first>1421489007</first> <second>1421489007</second> </item> <item> <first>287343763</first> <second>287343763</second> </item> <item> <first>287343763</first> <second>287343763</second> </item> <item> <first>-1108026676</first> <second>-1108026676</second> </item> <item> <first>1829132124</first> <second>1829132124</second> </item> <item> <first>-1546216506</first> <second>-1546216506</second> </item> <item> <first>941660988</first> <second>941660988</second> </item> <item> <first>-305386173</first> <second>-305386173</second> </item> <item> <first>-305386173</first> <second>-305386173</second> </item> <item> <first>-815473344</first> <second>-815473344</second> </item> <item> <first>-1877186230</first> <second>-1877186230</second> </item> <item> <first>601527218</first> <second>601527218</second> </item> <item> <first>-38527737</first> <second>-38527737</second> </item> <item> <first>-38527737</first> <second>-38527737</second> </item> <item> <first>-1068590402</first> <second>-1068590402</second> </item> <item> <first>1568788209</first> <second>1568788209</second> </item> <item> <first>1568788209</first> <second>1568788209</second> </item> <item> <first>1198739057</first> <second>1198739057</second> </item> <item> <first>1198739057</first> <second>1198739057</second> </item> <item> <first>2138619156</first> <second>2138619156</second> </item> <item> <first>-218590163</first> <second>-218590163</second> </item> <item> <first>-218590163</first> <second>-218590163</second> </item> <item> <first>-1469084794</first> <second>-1469084794</second> </item> <item> <first>-493829536</first> <second>-493829536</second> </item> <item> <first>-232190041</first> <second>-232190041</second> </item> <item> <first>-232190041</first> <second>-232190041</second> </item> <item> <first>-1674340339</first> <second>-1674340339</second> </item> <item> <first>-1674340339</first> <second>-1674340339</second> </item> <item> <first>1775667486</first> <second>1775667486</second> </item> <item> <first>-948676228</first> <second>-948676228</second> </item> <item> <first>-1338732474</first> <second>-1338732474</second> </item> <item> <first>178482033</first> <second>178482033</second> </item> <item> <first>178482033</first> <second>178482033</second> </item> <item> <first>918842470</first> <second>918842470</second> </item> <item> <first>-917350225</first> <second>-917350225</second> </item> <item> <first>-917350225</first> <second>-917350225</second> </item> <item> <first>390937317</first> <second>390937317</second> </item> <item> <first>390937317</first> <second>390937317</second> </item> <item> <first>-418860175</first> <second>-418860175</second> </item> <item> <first>-418860175</first> <second>-418860175</second> </item> <item> <first>670291604</first> <second>670291604</second> </item> <item> <first>1859681623</first> <second>1859681623</second> </item> <item> <first>1859681623</first> <second>1859681623</second> </item> <item> <first>1241175627</first> <second>1241175627</second> </item> <item> <first>1241175627</first> <second>1241175627</second> </item> <item> <first>-487119163</first> <second>-487119163</second> </item> <item> <first>-487119163</first> <second>-487119163</second> </item> <item> <first>1315739433</first> <second>1315739433</second> </item> <item> <first>1315739433</first> <second>1315739433</second> </item> <item> <first>-1938999974</first> <second>-1938999974</second> </item> <item> <first>1786883066</first> <second>1786883066</second> </item> <item> <first>-55935255</first> <second>-55935255</second> </item> <item> <first>-55935255</first> <second>-55935255</second> </item> <item> <first>-2146202839</first> <second>-2146202839</second> </item> <item> <first>-2146202839</first> <second>-2146202839</second> </item> <item> <first>-1866983349</first> <second>-1866983349</second> </item> <item> <first>-1866983349</first> <second>-1866983349</second> </item> <item> <first>607596425</first> <second>607596425</second> </item> <item> <first>607596425</first> <second>607596425</second> </item> <item> <first>-425048532</first> <second>-425048532</second> </item> <item> <first>-893024018</first> <second>-893024018</second> </item> <item> <first>-1873731147</first> <second>-1873731147</second> </item> <item> <first>-1873731147</first> <second>-1873731147</second> </item> <item> <first>159865104</first> <second>159865104</second> </item> <item> <first>411876340</first> <second>411876340</second> </item> <item> <first>2056892401</first> <second>2056892401</second> </item> <item> <first>2056892401</first> <second>2056892401</second> </item> <item> <first>-1642734171</first> <second>-1642734171</second> </item> <item> <first>-1642734171</first> <second>-1642734171</second> </item> <item> <first>-1996442747</first> <second>-1996442747</second> </item> <item> <first>-1996442747</first> <second>-1996442747</second> </item> <item> <first>257760945</first> <second>257760945</second> </item> <item> <first>257760945</first> <second>257760945</second> </item> <item> <first>-1631204972</first> <second>-1631204972</second> </item> <item> <first>-1802192500</first> <second>-1802192500</second> </item> <item> <first>-432548865</first> <second>-432548865</second> </item> <item> <first>-432548865</first> <second>-432548865</second> </item> <item> <first>-551129560</first> <second>-551129560</second> </item> <item> <first>-1319261042</first> <second>-1319261042</second> </item> <item> <first>-859679032</first> <second>-859679032</second> </item> <item> <first>-1510933233</first> <second>-1510933233</second> </item> <item> <first>-1510933233</first> <second>-1510933233</second> </item> <item> <first>286273879</first> <second>286273879</second> </item> <item> <first>286273879</first> <second>286273879</second> </item> <item> <first>1481537722</first> <second>1481537722</second> </item> <item> <first>258343568</first> <second>258343568</second> </item> <item> <first>-265464733</first> <second>-265464733</second> </item> <item> <first>-265464733</first> <second>-265464733</second> </item> <item> <first>-432502583</first> <second>-432502583</second> </item> <item> <first>-432502583</first> <second>-432502583</second> </item> <item> <first>-1967815281</first> <second>-1967815281</second> </item> <item> <first>-1967815281</first> <second>-1967815281</second> </item> <item> <first>-1530408968</first> <second>-1530408968</second> </item> <item> <first>967560929</first> <second>967560929</second> </item> <item> <first>967560929</first> <second>967560929</second> </item> <item> <first>-1426106865</first> <second>-1426106865</second> </item> <item> <first>-1426106865</first> <second>-1426106865</second> </item> <item> <first>190104374</first> <second>190104374</second> </item> <item> <first>430136711</first> <second>430136711</second> </item> <item> <first>430136711</first> <second>430136711</second> </item> <item> <first>-1803607012</first> <second>-1803607012</second> </item> <item> <first>-1520512970</first> <second>-1520512970</second> </item> <item> <first>5018725</first> <second>5018725</second> </item> <item> <first>5018725</first> <second>5018725</second> </item> <item> <first>183526573</first> <second>183526573</second> </item> <item> <first>183526573</first> <second>183526573</second> </item> <item> <first>-1040862600</first> <second>-1040862600</second> </item> </values> </boost_serialization>
0
repos/unordered/test
repos/unordered/test/legacy_archives/map_int_10.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="19"> <container class_id="0" tracking_level="0" version="0"> <count>10</count> <bucket_count>13</bucket_count> <item_version>0</item_version> <item class_id="1" tracking_level="0" version="0"> <first>2097663454</first> <second>2097663454</second> </item> <item> <first>-1785808236</first> <second>-1785808236</second> </item> <item> <first>-938475945</first> <second>-938475945</second> </item> <item> <first>1354395138</first> <second>1354395138</second> </item> <item> <first>581989062</first> <second>581989062</second> </item> <item> <first>-1694006096</first> <second>-1694006096</second> </item> <item> <first>1832705803</first> <second>1832705803</second> </item> <item> <first>-743509129</first> <second>-743509129</second> </item> <item> <first>1021729225</first> <second>1021729225</second> </item> <item> <first>-1168265900</first> <second>-1168265900</second> </item> </container> <values class_id="2" tracking_level="0" version="0"> <count>14</count> <item_version>0</item_version> <item class_id="3" tracking_level="0" version="0"> <first>-938475945</first> <second>-938475945</second> </item> <item> <first>-938475945</first> <second>-938475945</second> </item> <item> <first>-1694006096</first> <second>-1694006096</second> </item> <item> <first>-1785808236</first> <second>-1785808236</second> </item> <item> <first>1021729225</first> <second>1021729225</second> </item> <item> <first>1021729225</first> <second>1021729225</second> </item> <item> <first>1832705803</first> <second>1832705803</second> </item> <item> <first>1832705803</first> <second>1832705803</second> </item> <item> <first>581989062</first> <second>581989062</second> </item> <item> <first>1354395138</first> <second>1354395138</second> </item> <item> <first>2097663454</first> <second>2097663454</second> </item> <item> <first>-743509129</first> <second>-743509129</second> </item> <item> <first>-743509129</first> <second>-743509129</second> </item> <item> <first>-1168265900</first> <second>-1168265900</second> </item> </values> </boost_serialization>
0
repos/unordered/test
repos/unordered/test/legacy_archives/multimap_string_100.txt
22 serialization::archive 19 0 0 152 193 0 0 0 9 178482033 9 178482033 9 178482033 9 178482033 10 1786883066 10 1786883066 9 286273879 9 286273879 9 286273879 9 286273879 10 2298524549 10 2298524549 10 2298524549 10 2298524549 9 259868705 9 259868705 9 259868705 9 259868705 9 601527218 9 601527218 9 411876340 9 411876340 10 4029502563 10 4029502563 10 4029502563 10 4029502563 9 109292002 9 109292002 9 941660988 9 941660988 10 4256439559 10 4256439559 10 4256439559 10 4256439559 10 3401943278 10 3401943278 10 2663762324 10 2663762324 10 3042379069 10 3042379069 10 3042379069 10 3042379069 10 2509159060 10 2509159060 10 1859681623 10 1859681623 10 1859681623 10 1859681623 10 3356491351 10 3356491351 10 3356491351 10 3356491351 10 2620626957 10 2620626957 10 2620626957 10 2620626957 10 2652233125 10 2652233125 10 2652233125 10 2652233125 9 607596425 9 607596425 9 607596425 9 607596425 10 1568788209 10 1568788209 10 1568788209 10 1568788209 10 2868860431 10 2868860431 10 2868860431 10 2868860431 9 670291604 9 670291604 10 2764558328 10 2764558328 10 3226376894 10 3226376894 10 3930851132 10 3930851132 10 3801137760 10 3801137760 9 287343763 9 287343763 9 287343763 9 287343763 10 2138619156 10 2138619156 9 967560929 9 967560929 9 967560929 9 967560929 9 257760945 9 257760945 9 257760945 9 257760945 10 2056892401 10 2056892401 10 2056892401 10 2056892401 10 1829132124 10 1829132124 10 3807848133 10 3807848133 10 3807848133 10 3807848133 9 190104374 9 190104374 9 310524955 9 310524955 9 310524955 9 310524955 10 1481537722 10 1481537722 10 2361415202 10 2361415202 10 1970368353 10 1970368353 10 1970368353 10 1970368353 10 2417781066 10 2417781066 10 3186940620 10 3186940620 10 1421489007 10 1421489007 10 1421489007 10 1421489007 9 776215953 9 776215953 9 776215953 9 776215953 10 1775667486 10 1775667486 9 159865104 9 159865104 10 2355967322 10 2355967322 10 2748750790 10 2748750790 10 1832705803 10 1832705803 10 1832705803 10 1832705803 10 4239032041 10 4239032041 10 4239032041 10 4239032041 10 3876107121 10 3876107121 10 3876107121 10 3876107121 10 3479493952 10 3479493952 10 2600961200 10 2600961200 10 1241175627 10 1241175627 10 1241175627 10 1241175627 9 258343568 9 258343568 10 1630722604 10 1630722604 10 3255615729 10 3255615729 10 3255615729 10 3255615729 7 5018725 7 5018725 7 5018725 7 5018725 10 2774454326 10 2774454326 10 2825882502 10 2825882502 9 581989062 9 581989062 10 2148764457 10 2148764457 10 2148764457 10 2148764457 10 3862464713 10 3862464713 10 3862464713 10 3862464713 10 3862418431 10 3862418431 10 3862418431 10 3862418431 9 918842470 9 918842470 9 183526573 9 183526573 9 183526573 9 183526573 10 2097663454 10 2097663454 10 3377617071 10 3377617071 10 3377617071 10 3377617071 9 167237906 9 167237906 10 2492774796 10 2492774796 10 3254104696 10 3254104696 10 3551458167 10 3551458167 10 3551458167 10 3551458167 10 3989581123 10 3989581123 10 3989581123 10 3989581123 9 430136711 9 430136711 9 430136711 9 430136711 10 2427983947 10 2427983947 10 2427983947 10 2427983947 10 2975706254 10 2975706254 10 1198739057 10 1198739057 10 1198739057 10 1198739057 9 473010817 9 473010817 9 473010817 9 473010817 10 2075478837 10 2075478837 10 2075478837 10 2075478837 10 2956234822 10 2956234822 10 3435288264 10 3435288264 10 2491360284 10 2491360284 10 4076377133 10 4076377133 10 4076377133 10 4076377133 10 3869918764 10 3869918764 9 647803737 9 647803737 9 647803737 9 647803737 9 669358715 9 669358715 9 669358715 9 669358715 9 177811234 9 177811234 10 1021729225 10 1021729225 10 1021729225 10 1021729225 10 2327152015 10 2327152015 10 2327152015 10 2327152015 10 3793441059 10 3793441059 10 3793441059 10 3793441059 9 390937317 9 390937317 9 390937317 9 390937317 10 2421236149 10 2421236149 10 2421236149 10 2421236149 10 3346291068 10 3346291068 10 3880200042 10 3880200042 10 2299140636 10 2299140636 10 3743837736 10 3743837736 10 2784034063 10 2784034063 10 2784034063 10 2784034063 10 1315739433 10 1315739433 10 1315739433 10 1315739433 10 1354395138 10 1354395138 10 4062777255 10 4062777255 10 4062777255 10 4062777255 10 3126701396 10 3126701396 0 0 152 0 0 0 10 3356491351 10 3356491351 10 3356491351 10 3356491351 10 2600961200 10 2600961200 10 2509159060 10 2509159060 10 1021729225 10 1021729225 10 1021729225 10 1021729225 10 1832705803 10 1832705803 10 1832705803 10 1832705803 9 581989062 9 581989062 10 1354395138 10 1354395138 10 2097663454 10 2097663454 10 3551458167 10 3551458167 10 3551458167 10 3551458167 10 3126701396 10 3126701396 10 3880200042 10 3880200042 10 3255615729 10 3255615729 10 3255615729 10 3255615729 9 167237906 9 167237906 9 177811234 9 177811234 10 3930851132 10 3930851132 10 2361415202 10 2361415202 9 259868705 9 259868705 9 259868705 9 259868705 10 3793441059 10 3793441059 10 3793441059 10 3793441059 9 776215953 9 776215953 9 776215953 9 776215953 10 1630722604 10 1630722604 9 310524955 9 310524955 9 310524955 9 310524955 9 473010817 9 473010817 9 473010817 9 473010817 10 1970368353 10 1970368353 10 1970368353 10 1970368353 9 647803737 9 647803737 9 647803737 9 647803737 10 3042379069 10 3042379069 10 3042379069 10 3042379069 9 669358715 9 669358715 9 669358715 9 669358715 10 2075478837 10 2075478837 10 2075478837 10 2075478837 10 2299140636 10 2299140636 9 109292002 9 109292002 10 1421489007 10 1421489007 10 1421489007 10 1421489007 9 287343763 9 287343763 9 287343763 9 287343763 10 3186940620 10 3186940620 10 1829132124 10 1829132124 10 2748750790 10 2748750790 9 941660988 9 941660988 10 3989581123 10 3989581123 10 3989581123 10 3989581123 10 3479493952 10 3479493952 10 2417781066 10 2417781066 9 601527218 9 601527218 10 4256439559 10 4256439559 10 4256439559 10 4256439559 10 3226376894 10 3226376894 10 1568788209 10 1568788209 10 1568788209 10 1568788209 10 1198739057 10 1198739057 10 1198739057 10 1198739057 10 2138619156 10 2138619156 10 4076377133 10 4076377133 10 4076377133 10 4076377133 10 2825882502 10 2825882502 10 3801137760 10 3801137760 10 4062777255 10 4062777255 10 4062777255 10 4062777255 10 2620626957 10 2620626957 10 2620626957 10 2620626957 10 1775667486 10 1775667486 10 3346291068 10 3346291068 10 2956234822 10 2956234822 9 178482033 9 178482033 9 178482033 9 178482033 9 918842470 9 918842470 10 3377617071 10 3377617071 10 3377617071 10 3377617071 9 390937317 9 390937317 9 390937317 9 390937317 10 3876107121 10 3876107121 10 3876107121 10 3876107121 9 670291604 9 670291604 10 1859681623 10 1859681623 10 1859681623 10 1859681623 10 1241175627 10 1241175627 10 1241175627 10 1241175627 10 3807848133 10 3807848133 10 3807848133 10 3807848133 10 1315739433 10 1315739433 10 1315739433 10 1315739433 10 2355967322 10 2355967322 10 1786883066 10 1786883066 10 4239032041 10 4239032041 10 4239032041 10 4239032041 10 2148764457 10 2148764457 10 2148764457 10 2148764457 10 2427983947 10 2427983947 10 2427983947 10 2427983947 9 607596425 9 607596425 9 607596425 9 607596425 10 3869918764 10 3869918764 10 3401943278 10 3401943278 10 2421236149 10 2421236149 10 2421236149 10 2421236149 9 159865104 9 159865104 9 411876340 9 411876340 10 2056892401 10 2056892401 10 2056892401 10 2056892401 10 2652233125 10 2652233125 10 2652233125 10 2652233125 10 2298524549 10 2298524549 10 2298524549 10 2298524549 9 257760945 9 257760945 9 257760945 9 257760945 10 2663762324 10 2663762324 10 2492774796 10 2492774796 10 3862418431 10 3862418431 10 3862418431 10 3862418431 10 3743837736 10 3743837736 10 2975706254 10 2975706254 10 3435288264 10 3435288264 10 2784034063 10 2784034063 10 2784034063 10 2784034063 9 286273879 9 286273879 9 286273879 9 286273879 10 1481537722 10 1481537722 9 258343568 9 258343568 10 4029502563 10 4029502563 10 4029502563 10 4029502563 10 3862464713 10 3862464713 10 3862464713 10 3862464713 10 2327152015 10 2327152015 10 2327152015 10 2327152015 10 2764558328 10 2764558328 9 967560929 9 967560929 9 967560929 9 967560929 10 2868860431 10 2868860431 10 2868860431 10 2868860431 9 190104374 9 190104374 9 430136711 9 430136711 9 430136711 9 430136711 10 2491360284 10 2491360284 10 2774454326 10 2774454326 7 5018725 7 5018725 7 5018725 7 5018725 9 183526573 9 183526573 9 183526573 9 183526573 10 3254104696 10 3254104696
0
repos/unordered/test
repos/unordered/test/legacy_archives/set_int_10.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="19"> <container class_id="0" tracking_level="0" version="0"> <count>10</count> <bucket_count>13</bucket_count> <item_version>0</item_version> <item>2097663454</item> <item>-1785808236</item> <item>-938475945</item> <item>1354395138</item> <item>581989062</item> <item>-1694006096</item> <item>1832705803</item> <item>-743509129</item> <item>1021729225</item> <item>-1168265900</item> </container> <values> <count>14</count> <item_version>0</item_version> <item>-938475945</item> <item>-938475945</item> <item>-1694006096</item> <item>-1785808236</item> <item>1021729225</item> <item>1021729225</item> <item>1832705803</item> <item>1832705803</item> <item>581989062</item> <item>1354395138</item> <item>2097663454</item> <item>-743509129</item> <item>-743509129</item> <item>-1168265900</item> </values> </boost_serialization>
0
repos/unordered/test
repos/unordered/test/legacy_archives/set_string_0.txt
22 serialization::archive 19 0 0 0 0 0 0 0 0 0
0
repos/unordered/test
repos/unordered/test/legacy_archives/map_string_100.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="19"> <container class_id="0" tracking_level="0" version="0"> <count>100</count> <bucket_count>193</bucket_count> <item_version>0</item_version> <item class_id="1" tracking_level="0" version="0"> <first>1970368353</first> <second>1970368353</second> </item> <item> <first>2417781066</first> <second>2417781066</second> </item> <item> <first>3186940620</first> <second>3186940620</second> </item> <item> <first>1421489007</first> <second>1421489007</second> </item> <item> <first>776215953</first> <second>776215953</second> </item> <item> <first>1775667486</first> <second>1775667486</second> </item> <item> <first>159865104</first> <second>159865104</second> </item> <item> <first>2355967322</first> <second>2355967322</second> </item> <item> <first>2748750790</first> <second>2748750790</second> </item> <item> <first>1832705803</first> <second>1832705803</second> </item> <item> <first>4239032041</first> <second>4239032041</second> </item> <item> <first>3876107121</first> <second>3876107121</second> </item> <item> <first>3479493952</first> <second>3479493952</second> </item> <item> <first>2600961200</first> <second>2600961200</second> </item> <item> <first>1241175627</first> <second>1241175627</second> </item> <item> <first>258343568</first> <second>258343568</second> </item> <item> <first>1630722604</first> <second>1630722604</second> </item> <item> <first>3255615729</first> <second>3255615729</second> </item> <item> <first>5018725</first> <second>5018725</second> </item> <item> <first>2774454326</first> <second>2774454326</second> </item> <item> <first>2825882502</first> <second>2825882502</second> </item> <item> <first>581989062</first> <second>581989062</second> </item> <item> <first>178482033</first> <second>178482033</second> </item> <item> <first>1786883066</first> <second>1786883066</second> </item> <item> <first>286273879</first> <second>286273879</second> </item> <item> <first>2298524549</first> <second>2298524549</second> </item> <item> <first>259868705</first> <second>259868705</second> </item> <item> <first>601527218</first> <second>601527218</second> </item> <item> <first>411876340</first> <second>411876340</second> </item> <item> <first>4029502563</first> <second>4029502563</second> </item> <item> <first>109292002</first> <second>109292002</second> </item> <item> <first>941660988</first> <second>941660988</second> </item> <item> <first>4256439559</first> <second>4256439559</second> </item> <item> <first>3401943278</first> <second>3401943278</second> </item> <item> <first>2663762324</first> <second>2663762324</second> </item> <item> <first>3042379069</first> <second>3042379069</second> </item> <item> <first>2509159060</first> <second>2509159060</second> </item> <item> <first>1859681623</first> <second>1859681623</second> </item> <item> <first>3356491351</first> <second>3356491351</second> </item> <item> <first>2620626957</first> <second>2620626957</second> </item> <item> <first>2652233125</first> <second>2652233125</second> </item> <item> <first>1568788209</first> <second>1568788209</second> </item> <item> <first>607596425</first> <second>607596425</second> </item> <item> <first>2868860431</first> <second>2868860431</second> </item> <item> <first>670291604</first> <second>670291604</second> </item> <item> <first>2764558328</first> <second>2764558328</second> </item> <item> <first>3226376894</first> <second>3226376894</second> </item> <item> <first>3930851132</first> <second>3930851132</second> </item> <item> <first>3801137760</first> <second>3801137760</second> </item> <item> <first>287343763</first> <second>287343763</second> </item> <item> <first>2138619156</first> <second>2138619156</second> </item> <item> <first>257760945</first> <second>257760945</second> </item> <item> <first>967560929</first> <second>967560929</second> </item> <item> <first>2056892401</first> <second>2056892401</second> </item> <item> <first>1829132124</first> <second>1829132124</second> </item> <item> <first>3807848133</first> <second>3807848133</second> </item> <item> <first>310524955</first> <second>310524955</second> </item> <item> <first>190104374</first> <second>190104374</second> </item> <item> <first>1481537722</first> <second>1481537722</second> </item> <item> <first>2361415202</first> <second>2361415202</second> </item> <item> <first>2148764457</first> <second>2148764457</second> </item> <item> <first>3862464713</first> <second>3862464713</second> </item> <item> <first>3862418431</first> <second>3862418431</second> </item> <item> <first>918842470</first> <second>918842470</second> </item> <item> <first>183526573</first> <second>183526573</second> </item> <item> <first>2097663454</first> <second>2097663454</second> </item> <item> <first>3377617071</first> <second>3377617071</second> </item> <item> <first>167237906</first> <second>167237906</second> </item> <item> <first>2492774796</first> <second>2492774796</second> </item> <item> <first>3254104696</first> <second>3254104696</second> </item> <item> <first>3551458167</first> <second>3551458167</second> </item> <item> <first>3989581123</first> <second>3989581123</second> </item> <item> <first>2427983947</first> <second>2427983947</second> </item> <item> <first>430136711</first> <second>430136711</second> </item> <item> <first>2975706254</first> <second>2975706254</second> </item> <item> <first>1198739057</first> <second>1198739057</second> </item> <item> <first>473010817</first> <second>473010817</second> </item> <item> <first>2075478837</first> <second>2075478837</second> </item> <item> <first>2956234822</first> <second>2956234822</second> </item> <item> <first>3435288264</first> <second>3435288264</second> </item> <item> <first>2491360284</first> <second>2491360284</second> </item> <item> <first>4076377133</first> <second>4076377133</second> </item> <item> <first>3869918764</first> <second>3869918764</second> </item> <item> <first>647803737</first> <second>647803737</second> </item> <item> <first>669358715</first> <second>669358715</second> </item> <item> <first>177811234</first> <second>177811234</second> </item> <item> <first>1021729225</first> <second>1021729225</second> </item> <item> <first>2327152015</first> <second>2327152015</second> </item> <item> <first>3793441059</first> <second>3793441059</second> </item> <item> <first>390937317</first> <second>390937317</second> </item> <item> <first>2421236149</first> <second>2421236149</second> </item> <item> <first>3346291068</first> <second>3346291068</second> </item> <item> <first>3880200042</first> <second>3880200042</second> </item> <item> <first>2299140636</first> <second>2299140636</second> </item> <item> <first>3743837736</first> <second>3743837736</second> </item> <item> <first>1315739433</first> <second>1315739433</second> </item> <item> <first>2784034063</first> <second>2784034063</second> </item> <item> <first>1354395138</first> <second>1354395138</second> </item> <item> <first>4062777255</first> <second>4062777255</second> </item> <item> <first>3126701396</first> <second>3126701396</second> </item> </container> <values class_id="2" tracking_level="0" version="0"> <count>152</count> <item_version>0</item_version> <item class_id="3" tracking_level="0" version="0"> <first>3356491351</first> <second>3356491351</second> </item> <item> <first>3356491351</first> <second>3356491351</second> </item> <item> <first>2600961200</first> <second>2600961200</second> </item> <item> <first>2509159060</first> <second>2509159060</second> </item> <item> <first>1021729225</first> <second>1021729225</second> </item> <item> <first>1021729225</first> <second>1021729225</second> </item> <item> <first>1832705803</first> <second>1832705803</second> </item> <item> <first>1832705803</first> <second>1832705803</second> </item> <item> <first>581989062</first> <second>581989062</second> </item> <item> <first>1354395138</first> <second>1354395138</second> </item> <item> <first>2097663454</first> <second>2097663454</second> </item> <item> <first>3551458167</first> <second>3551458167</second> </item> <item> <first>3551458167</first> <second>3551458167</second> </item> <item> <first>3126701396</first> <second>3126701396</second> </item> <item> <first>3880200042</first> <second>3880200042</second> </item> <item> <first>3255615729</first> <second>3255615729</second> </item> <item> <first>3255615729</first> <second>3255615729</second> </item> <item> <first>167237906</first> <second>167237906</second> </item> <item> <first>177811234</first> <second>177811234</second> </item> <item> <first>3930851132</first> <second>3930851132</second> </item> <item> <first>2361415202</first> <second>2361415202</second> </item> <item> <first>259868705</first> <second>259868705</second> </item> <item> <first>259868705</first> <second>259868705</second> </item> <item> <first>3793441059</first> <second>3793441059</second> </item> <item> <first>3793441059</first> <second>3793441059</second> </item> <item> <first>776215953</first> <second>776215953</second> </item> <item> <first>776215953</first> <second>776215953</second> </item> <item> <first>1630722604</first> <second>1630722604</second> </item> <item> <first>310524955</first> <second>310524955</second> </item> <item> <first>310524955</first> <second>310524955</second> </item> <item> <first>473010817</first> <second>473010817</second> </item> <item> <first>473010817</first> <second>473010817</second> </item> <item> <first>1970368353</first> <second>1970368353</second> </item> <item> <first>1970368353</first> <second>1970368353</second> </item> <item> <first>647803737</first> <second>647803737</second> </item> <item> <first>647803737</first> <second>647803737</second> </item> <item> <first>3042379069</first> <second>3042379069</second> </item> <item> <first>3042379069</first> <second>3042379069</second> </item> <item> <first>669358715</first> <second>669358715</second> </item> <item> <first>669358715</first> <second>669358715</second> </item> <item> <first>2075478837</first> <second>2075478837</second> </item> <item> <first>2075478837</first> <second>2075478837</second> </item> <item> <first>2299140636</first> <second>2299140636</second> </item> <item> <first>109292002</first> <second>109292002</second> </item> <item> <first>1421489007</first> <second>1421489007</second> </item> <item> <first>1421489007</first> <second>1421489007</second> </item> <item> <first>287343763</first> <second>287343763</second> </item> <item> <first>287343763</first> <second>287343763</second> </item> <item> <first>3186940620</first> <second>3186940620</second> </item> <item> <first>1829132124</first> <second>1829132124</second> </item> <item> <first>2748750790</first> <second>2748750790</second> </item> <item> <first>941660988</first> <second>941660988</second> </item> <item> <first>3989581123</first> <second>3989581123</second> </item> <item> <first>3989581123</first> <second>3989581123</second> </item> <item> <first>3479493952</first> <second>3479493952</second> </item> <item> <first>2417781066</first> <second>2417781066</second> </item> <item> <first>601527218</first> <second>601527218</second> </item> <item> <first>4256439559</first> <second>4256439559</second> </item> <item> <first>4256439559</first> <second>4256439559</second> </item> <item> <first>3226376894</first> <second>3226376894</second> </item> <item> <first>1568788209</first> <second>1568788209</second> </item> <item> <first>1568788209</first> <second>1568788209</second> </item> <item> <first>1198739057</first> <second>1198739057</second> </item> <item> <first>1198739057</first> <second>1198739057</second> </item> <item> <first>2138619156</first> <second>2138619156</second> </item> <item> <first>4076377133</first> <second>4076377133</second> </item> <item> <first>4076377133</first> <second>4076377133</second> </item> <item> <first>2825882502</first> <second>2825882502</second> </item> <item> <first>3801137760</first> <second>3801137760</second> </item> <item> <first>4062777255</first> <second>4062777255</second> </item> <item> <first>4062777255</first> <second>4062777255</second> </item> <item> <first>2620626957</first> <second>2620626957</second> </item> <item> <first>2620626957</first> <second>2620626957</second> </item> <item> <first>1775667486</first> <second>1775667486</second> </item> <item> <first>3346291068</first> <second>3346291068</second> </item> <item> <first>2956234822</first> <second>2956234822</second> </item> <item> <first>178482033</first> <second>178482033</second> </item> <item> <first>178482033</first> <second>178482033</second> </item> <item> <first>918842470</first> <second>918842470</second> </item> <item> <first>3377617071</first> <second>3377617071</second> </item> <item> <first>3377617071</first> <second>3377617071</second> </item> <item> <first>390937317</first> <second>390937317</second> </item> <item> <first>390937317</first> <second>390937317</second> </item> <item> <first>3876107121</first> <second>3876107121</second> </item> <item> <first>3876107121</first> <second>3876107121</second> </item> <item> <first>670291604</first> <second>670291604</second> </item> <item> <first>1859681623</first> <second>1859681623</second> </item> <item> <first>1859681623</first> <second>1859681623</second> </item> <item> <first>1241175627</first> <second>1241175627</second> </item> <item> <first>1241175627</first> <second>1241175627</second> </item> <item> <first>3807848133</first> <second>3807848133</second> </item> <item> <first>3807848133</first> <second>3807848133</second> </item> <item> <first>1315739433</first> <second>1315739433</second> </item> <item> <first>1315739433</first> <second>1315739433</second> </item> <item> <first>2355967322</first> <second>2355967322</second> </item> <item> <first>1786883066</first> <second>1786883066</second> </item> <item> <first>4239032041</first> <second>4239032041</second> </item> <item> <first>4239032041</first> <second>4239032041</second> </item> <item> <first>2148764457</first> <second>2148764457</second> </item> <item> <first>2148764457</first> <second>2148764457</second> </item> <item> <first>2427983947</first> <second>2427983947</second> </item> <item> <first>2427983947</first> <second>2427983947</second> </item> <item> <first>607596425</first> <second>607596425</second> </item> <item> <first>607596425</first> <second>607596425</second> </item> <item> <first>3869918764</first> <second>3869918764</second> </item> <item> <first>3401943278</first> <second>3401943278</second> </item> <item> <first>2421236149</first> <second>2421236149</second> </item> <item> <first>2421236149</first> <second>2421236149</second> </item> <item> <first>159865104</first> <second>159865104</second> </item> <item> <first>411876340</first> <second>411876340</second> </item> <item> <first>2056892401</first> <second>2056892401</second> </item> <item> <first>2056892401</first> <second>2056892401</second> </item> <item> <first>2652233125</first> <second>2652233125</second> </item> <item> <first>2652233125</first> <second>2652233125</second> </item> <item> <first>2298524549</first> <second>2298524549</second> </item> <item> <first>2298524549</first> <second>2298524549</second> </item> <item> <first>257760945</first> <second>257760945</second> </item> <item> <first>257760945</first> <second>257760945</second> </item> <item> <first>2663762324</first> <second>2663762324</second> </item> <item> <first>2492774796</first> <second>2492774796</second> </item> <item> <first>3862418431</first> <second>3862418431</second> </item> <item> <first>3862418431</first> <second>3862418431</second> </item> <item> <first>3743837736</first> <second>3743837736</second> </item> <item> <first>2975706254</first> <second>2975706254</second> </item> <item> <first>3435288264</first> <second>3435288264</second> </item> <item> <first>2784034063</first> <second>2784034063</second> </item> <item> <first>2784034063</first> <second>2784034063</second> </item> <item> <first>286273879</first> <second>286273879</second> </item> <item> <first>286273879</first> <second>286273879</second> </item> <item> <first>1481537722</first> <second>1481537722</second> </item> <item> <first>258343568</first> <second>258343568</second> </item> <item> <first>4029502563</first> <second>4029502563</second> </item> <item> <first>4029502563</first> <second>4029502563</second> </item> <item> <first>3862464713</first> <second>3862464713</second> </item> <item> <first>3862464713</first> <second>3862464713</second> </item> <item> <first>2327152015</first> <second>2327152015</second> </item> <item> <first>2327152015</first> <second>2327152015</second> </item> <item> <first>2764558328</first> <second>2764558328</second> </item> <item> <first>967560929</first> <second>967560929</second> </item> <item> <first>967560929</first> <second>967560929</second> </item> <item> <first>2868860431</first> <second>2868860431</second> </item> <item> <first>2868860431</first> <second>2868860431</second> </item> <item> <first>190104374</first> <second>190104374</second> </item> <item> <first>430136711</first> <second>430136711</second> </item> <item> <first>430136711</first> <second>430136711</second> </item> <item> <first>2491360284</first> <second>2491360284</second> </item> <item> <first>2774454326</first> <second>2774454326</second> </item> <item> <first>5018725</first> <second>5018725</second> </item> <item> <first>5018725</first> <second>5018725</second> </item> <item> <first>183526573</first> <second>183526573</second> </item> <item> <first>183526573</first> <second>183526573</second> </item> <item> <first>3254104696</first> <second>3254104696</second> </item> </values> </boost_serialization>
0
repos/unordered/test
repos/unordered/test/legacy_archives/set_int_0.txt
22 serialization::archive 19 0 0 0 0 0 0 0
0
repos/unordered/test
repos/unordered/test/legacy_archives/multimap_string_100.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="19"> <container class_id="0" tracking_level="0" version="0"> <count>152</count> <bucket_count>193</bucket_count> <item_version>0</item_version> <item class_id="1" tracking_level="0" version="0"> <first>178482033</first> <second>178482033</second> </item> <item> <first>178482033</first> <second>178482033</second> </item> <item> <first>1786883066</first> <second>1786883066</second> </item> <item> <first>286273879</first> <second>286273879</second> </item> <item> <first>286273879</first> <second>286273879</second> </item> <item> <first>2298524549</first> <second>2298524549</second> </item> <item> <first>2298524549</first> <second>2298524549</second> </item> <item> <first>259868705</first> <second>259868705</second> </item> <item> <first>259868705</first> <second>259868705</second> </item> <item> <first>601527218</first> <second>601527218</second> </item> <item> <first>411876340</first> <second>411876340</second> </item> <item> <first>4029502563</first> <second>4029502563</second> </item> <item> <first>4029502563</first> <second>4029502563</second> </item> <item> <first>109292002</first> <second>109292002</second> </item> <item> <first>941660988</first> <second>941660988</second> </item> <item> <first>4256439559</first> <second>4256439559</second> </item> <item> <first>4256439559</first> <second>4256439559</second> </item> <item> <first>3401943278</first> <second>3401943278</second> </item> <item> <first>2663762324</first> <second>2663762324</second> </item> <item> <first>3042379069</first> <second>3042379069</second> </item> <item> <first>3042379069</first> <second>3042379069</second> </item> <item> <first>2509159060</first> <second>2509159060</second> </item> <item> <first>1859681623</first> <second>1859681623</second> </item> <item> <first>1859681623</first> <second>1859681623</second> </item> <item> <first>3356491351</first> <second>3356491351</second> </item> <item> <first>3356491351</first> <second>3356491351</second> </item> <item> <first>2620626957</first> <second>2620626957</second> </item> <item> <first>2620626957</first> <second>2620626957</second> </item> <item> <first>2652233125</first> <second>2652233125</second> </item> <item> <first>2652233125</first> <second>2652233125</second> </item> <item> <first>607596425</first> <second>607596425</second> </item> <item> <first>607596425</first> <second>607596425</second> </item> <item> <first>1568788209</first> <second>1568788209</second> </item> <item> <first>1568788209</first> <second>1568788209</second> </item> <item> <first>2868860431</first> <second>2868860431</second> </item> <item> <first>2868860431</first> <second>2868860431</second> </item> <item> <first>670291604</first> <second>670291604</second> </item> <item> <first>2764558328</first> <second>2764558328</second> </item> <item> <first>3226376894</first> <second>3226376894</second> </item> <item> <first>3930851132</first> <second>3930851132</second> </item> <item> <first>3801137760</first> <second>3801137760</second> </item> <item> <first>287343763</first> <second>287343763</second> </item> <item> <first>287343763</first> <second>287343763</second> </item> <item> <first>2138619156</first> <second>2138619156</second> </item> <item> <first>967560929</first> <second>967560929</second> </item> <item> <first>967560929</first> <second>967560929</second> </item> <item> <first>257760945</first> <second>257760945</second> </item> <item> <first>257760945</first> <second>257760945</second> </item> <item> <first>2056892401</first> <second>2056892401</second> </item> <item> <first>2056892401</first> <second>2056892401</second> </item> <item> <first>1829132124</first> <second>1829132124</second> </item> <item> <first>3807848133</first> <second>3807848133</second> </item> <item> <first>3807848133</first> <second>3807848133</second> </item> <item> <first>190104374</first> <second>190104374</second> </item> <item> <first>310524955</first> <second>310524955</second> </item> <item> <first>310524955</first> <second>310524955</second> </item> <item> <first>1481537722</first> <second>1481537722</second> </item> <item> <first>2361415202</first> <second>2361415202</second> </item> <item> <first>1970368353</first> <second>1970368353</second> </item> <item> <first>1970368353</first> <second>1970368353</second> </item> <item> <first>2417781066</first> <second>2417781066</second> </item> <item> <first>3186940620</first> <second>3186940620</second> </item> <item> <first>1421489007</first> <second>1421489007</second> </item> <item> <first>1421489007</first> <second>1421489007</second> </item> <item> <first>776215953</first> <second>776215953</second> </item> <item> <first>776215953</first> <second>776215953</second> </item> <item> <first>1775667486</first> <second>1775667486</second> </item> <item> <first>159865104</first> <second>159865104</second> </item> <item> <first>2355967322</first> <second>2355967322</second> </item> <item> <first>2748750790</first> <second>2748750790</second> </item> <item> <first>1832705803</first> <second>1832705803</second> </item> <item> <first>1832705803</first> <second>1832705803</second> </item> <item> <first>4239032041</first> <second>4239032041</second> </item> <item> <first>4239032041</first> <second>4239032041</second> </item> <item> <first>3876107121</first> <second>3876107121</second> </item> <item> <first>3876107121</first> <second>3876107121</second> </item> <item> <first>3479493952</first> <second>3479493952</second> </item> <item> <first>2600961200</first> <second>2600961200</second> </item> <item> <first>1241175627</first> <second>1241175627</second> </item> <item> <first>1241175627</first> <second>1241175627</second> </item> <item> <first>258343568</first> <second>258343568</second> </item> <item> <first>1630722604</first> <second>1630722604</second> </item> <item> <first>3255615729</first> <second>3255615729</second> </item> <item> <first>3255615729</first> <second>3255615729</second> </item> <item> <first>5018725</first> <second>5018725</second> </item> <item> <first>5018725</first> <second>5018725</second> </item> <item> <first>2774454326</first> <second>2774454326</second> </item> <item> <first>2825882502</first> <second>2825882502</second> </item> <item> <first>581989062</first> <second>581989062</second> </item> <item> <first>2148764457</first> <second>2148764457</second> </item> <item> <first>2148764457</first> <second>2148764457</second> </item> <item> <first>3862464713</first> <second>3862464713</second> </item> <item> <first>3862464713</first> <second>3862464713</second> </item> <item> <first>3862418431</first> <second>3862418431</second> </item> <item> <first>3862418431</first> <second>3862418431</second> </item> <item> <first>918842470</first> <second>918842470</second> </item> <item> <first>183526573</first> <second>183526573</second> </item> <item> <first>183526573</first> <second>183526573</second> </item> <item> <first>2097663454</first> <second>2097663454</second> </item> <item> <first>3377617071</first> <second>3377617071</second> </item> <item> <first>3377617071</first> <second>3377617071</second> </item> <item> <first>167237906</first> <second>167237906</second> </item> <item> <first>2492774796</first> <second>2492774796</second> </item> <item> <first>3254104696</first> <second>3254104696</second> </item> <item> <first>3551458167</first> <second>3551458167</second> </item> <item> <first>3551458167</first> <second>3551458167</second> </item> <item> <first>3989581123</first> <second>3989581123</second> </item> <item> <first>3989581123</first> <second>3989581123</second> </item> <item> <first>430136711</first> <second>430136711</second> </item> <item> <first>430136711</first> <second>430136711</second> </item> <item> <first>2427983947</first> <second>2427983947</second> </item> <item> <first>2427983947</first> <second>2427983947</second> </item> <item> <first>2975706254</first> <second>2975706254</second> </item> <item> <first>1198739057</first> <second>1198739057</second> </item> <item> <first>1198739057</first> <second>1198739057</second> </item> <item> <first>473010817</first> <second>473010817</second> </item> <item> <first>473010817</first> <second>473010817</second> </item> <item> <first>2075478837</first> <second>2075478837</second> </item> <item> <first>2075478837</first> <second>2075478837</second> </item> <item> <first>2956234822</first> <second>2956234822</second> </item> <item> <first>3435288264</first> <second>3435288264</second> </item> <item> <first>2491360284</first> <second>2491360284</second> </item> <item> <first>4076377133</first> <second>4076377133</second> </item> <item> <first>4076377133</first> <second>4076377133</second> </item> <item> <first>3869918764</first> <second>3869918764</second> </item> <item> <first>647803737</first> <second>647803737</second> </item> <item> <first>647803737</first> <second>647803737</second> </item> <item> <first>669358715</first> <second>669358715</second> </item> <item> <first>669358715</first> <second>669358715</second> </item> <item> <first>177811234</first> <second>177811234</second> </item> <item> <first>1021729225</first> <second>1021729225</second> </item> <item> <first>1021729225</first> <second>1021729225</second> </item> <item> <first>2327152015</first> <second>2327152015</second> </item> <item> <first>2327152015</first> <second>2327152015</second> </item> <item> <first>3793441059</first> <second>3793441059</second> </item> <item> <first>3793441059</first> <second>3793441059</second> </item> <item> <first>390937317</first> <second>390937317</second> </item> <item> <first>390937317</first> <second>390937317</second> </item> <item> <first>2421236149</first> <second>2421236149</second> </item> <item> <first>2421236149</first> <second>2421236149</second> </item> <item> <first>3346291068</first> <second>3346291068</second> </item> <item> <first>3880200042</first> <second>3880200042</second> </item> <item> <first>2299140636</first> <second>2299140636</second> </item> <item> <first>3743837736</first> <second>3743837736</second> </item> <item> <first>2784034063</first> <second>2784034063</second> </item> <item> <first>2784034063</first> <second>2784034063</second> </item> <item> <first>1315739433</first> <second>1315739433</second> </item> <item> <first>1315739433</first> <second>1315739433</second> </item> <item> <first>1354395138</first> <second>1354395138</second> </item> <item> <first>4062777255</first> <second>4062777255</second> </item> <item> <first>4062777255</first> <second>4062777255</second> </item> <item> <first>3126701396</first> <second>3126701396</second> </item> </container> <values class_id="2" tracking_level="0" version="0"> <count>152</count> <item_version>0</item_version> <item class_id="3" tracking_level="0" version="0"> <first>3356491351</first> <second>3356491351</second> </item> <item> <first>3356491351</first> <second>3356491351</second> </item> <item> <first>2600961200</first> <second>2600961200</second> </item> <item> <first>2509159060</first> <second>2509159060</second> </item> <item> <first>1021729225</first> <second>1021729225</second> </item> <item> <first>1021729225</first> <second>1021729225</second> </item> <item> <first>1832705803</first> <second>1832705803</second> </item> <item> <first>1832705803</first> <second>1832705803</second> </item> <item> <first>581989062</first> <second>581989062</second> </item> <item> <first>1354395138</first> <second>1354395138</second> </item> <item> <first>2097663454</first> <second>2097663454</second> </item> <item> <first>3551458167</first> <second>3551458167</second> </item> <item> <first>3551458167</first> <second>3551458167</second> </item> <item> <first>3126701396</first> <second>3126701396</second> </item> <item> <first>3880200042</first> <second>3880200042</second> </item> <item> <first>3255615729</first> <second>3255615729</second> </item> <item> <first>3255615729</first> <second>3255615729</second> </item> <item> <first>167237906</first> <second>167237906</second> </item> <item> <first>177811234</first> <second>177811234</second> </item> <item> <first>3930851132</first> <second>3930851132</second> </item> <item> <first>2361415202</first> <second>2361415202</second> </item> <item> <first>259868705</first> <second>259868705</second> </item> <item> <first>259868705</first> <second>259868705</second> </item> <item> <first>3793441059</first> <second>3793441059</second> </item> <item> <first>3793441059</first> <second>3793441059</second> </item> <item> <first>776215953</first> <second>776215953</second> </item> <item> <first>776215953</first> <second>776215953</second> </item> <item> <first>1630722604</first> <second>1630722604</second> </item> <item> <first>310524955</first> <second>310524955</second> </item> <item> <first>310524955</first> <second>310524955</second> </item> <item> <first>473010817</first> <second>473010817</second> </item> <item> <first>473010817</first> <second>473010817</second> </item> <item> <first>1970368353</first> <second>1970368353</second> </item> <item> <first>1970368353</first> <second>1970368353</second> </item> <item> <first>647803737</first> <second>647803737</second> </item> <item> <first>647803737</first> <second>647803737</second> </item> <item> <first>3042379069</first> <second>3042379069</second> </item> <item> <first>3042379069</first> <second>3042379069</second> </item> <item> <first>669358715</first> <second>669358715</second> </item> <item> <first>669358715</first> <second>669358715</second> </item> <item> <first>2075478837</first> <second>2075478837</second> </item> <item> <first>2075478837</first> <second>2075478837</second> </item> <item> <first>2299140636</first> <second>2299140636</second> </item> <item> <first>109292002</first> <second>109292002</second> </item> <item> <first>1421489007</first> <second>1421489007</second> </item> <item> <first>1421489007</first> <second>1421489007</second> </item> <item> <first>287343763</first> <second>287343763</second> </item> <item> <first>287343763</first> <second>287343763</second> </item> <item> <first>3186940620</first> <second>3186940620</second> </item> <item> <first>1829132124</first> <second>1829132124</second> </item> <item> <first>2748750790</first> <second>2748750790</second> </item> <item> <first>941660988</first> <second>941660988</second> </item> <item> <first>3989581123</first> <second>3989581123</second> </item> <item> <first>3989581123</first> <second>3989581123</second> </item> <item> <first>3479493952</first> <second>3479493952</second> </item> <item> <first>2417781066</first> <second>2417781066</second> </item> <item> <first>601527218</first> <second>601527218</second> </item> <item> <first>4256439559</first> <second>4256439559</second> </item> <item> <first>4256439559</first> <second>4256439559</second> </item> <item> <first>3226376894</first> <second>3226376894</second> </item> <item> <first>1568788209</first> <second>1568788209</second> </item> <item> <first>1568788209</first> <second>1568788209</second> </item> <item> <first>1198739057</first> <second>1198739057</second> </item> <item> <first>1198739057</first> <second>1198739057</second> </item> <item> <first>2138619156</first> <second>2138619156</second> </item> <item> <first>4076377133</first> <second>4076377133</second> </item> <item> <first>4076377133</first> <second>4076377133</second> </item> <item> <first>2825882502</first> <second>2825882502</second> </item> <item> <first>3801137760</first> <second>3801137760</second> </item> <item> <first>4062777255</first> <second>4062777255</second> </item> <item> <first>4062777255</first> <second>4062777255</second> </item> <item> <first>2620626957</first> <second>2620626957</second> </item> <item> <first>2620626957</first> <second>2620626957</second> </item> <item> <first>1775667486</first> <second>1775667486</second> </item> <item> <first>3346291068</first> <second>3346291068</second> </item> <item> <first>2956234822</first> <second>2956234822</second> </item> <item> <first>178482033</first> <second>178482033</second> </item> <item> <first>178482033</first> <second>178482033</second> </item> <item> <first>918842470</first> <second>918842470</second> </item> <item> <first>3377617071</first> <second>3377617071</second> </item> <item> <first>3377617071</first> <second>3377617071</second> </item> <item> <first>390937317</first> <second>390937317</second> </item> <item> <first>390937317</first> <second>390937317</second> </item> <item> <first>3876107121</first> <second>3876107121</second> </item> <item> <first>3876107121</first> <second>3876107121</second> </item> <item> <first>670291604</first> <second>670291604</second> </item> <item> <first>1859681623</first> <second>1859681623</second> </item> <item> <first>1859681623</first> <second>1859681623</second> </item> <item> <first>1241175627</first> <second>1241175627</second> </item> <item> <first>1241175627</first> <second>1241175627</second> </item> <item> <first>3807848133</first> <second>3807848133</second> </item> <item> <first>3807848133</first> <second>3807848133</second> </item> <item> <first>1315739433</first> <second>1315739433</second> </item> <item> <first>1315739433</first> <second>1315739433</second> </item> <item> <first>2355967322</first> <second>2355967322</second> </item> <item> <first>1786883066</first> <second>1786883066</second> </item> <item> <first>4239032041</first> <second>4239032041</second> </item> <item> <first>4239032041</first> <second>4239032041</second> </item> <item> <first>2148764457</first> <second>2148764457</second> </item> <item> <first>2148764457</first> <second>2148764457</second> </item> <item> <first>2427983947</first> <second>2427983947</second> </item> <item> <first>2427983947</first> <second>2427983947</second> </item> <item> <first>607596425</first> <second>607596425</second> </item> <item> <first>607596425</first> <second>607596425</second> </item> <item> <first>3869918764</first> <second>3869918764</second> </item> <item> <first>3401943278</first> <second>3401943278</second> </item> <item> <first>2421236149</first> <second>2421236149</second> </item> <item> <first>2421236149</first> <second>2421236149</second> </item> <item> <first>159865104</first> <second>159865104</second> </item> <item> <first>411876340</first> <second>411876340</second> </item> <item> <first>2056892401</first> <second>2056892401</second> </item> <item> <first>2056892401</first> <second>2056892401</second> </item> <item> <first>2652233125</first> <second>2652233125</second> </item> <item> <first>2652233125</first> <second>2652233125</second> </item> <item> <first>2298524549</first> <second>2298524549</second> </item> <item> <first>2298524549</first> <second>2298524549</second> </item> <item> <first>257760945</first> <second>257760945</second> </item> <item> <first>257760945</first> <second>257760945</second> </item> <item> <first>2663762324</first> <second>2663762324</second> </item> <item> <first>2492774796</first> <second>2492774796</second> </item> <item> <first>3862418431</first> <second>3862418431</second> </item> <item> <first>3862418431</first> <second>3862418431</second> </item> <item> <first>3743837736</first> <second>3743837736</second> </item> <item> <first>2975706254</first> <second>2975706254</second> </item> <item> <first>3435288264</first> <second>3435288264</second> </item> <item> <first>2784034063</first> <second>2784034063</second> </item> <item> <first>2784034063</first> <second>2784034063</second> </item> <item> <first>286273879</first> <second>286273879</second> </item> <item> <first>286273879</first> <second>286273879</second> </item> <item> <first>1481537722</first> <second>1481537722</second> </item> <item> <first>258343568</first> <second>258343568</second> </item> <item> <first>4029502563</first> <second>4029502563</second> </item> <item> <first>4029502563</first> <second>4029502563</second> </item> <item> <first>3862464713</first> <second>3862464713</second> </item> <item> <first>3862464713</first> <second>3862464713</second> </item> <item> <first>2327152015</first> <second>2327152015</second> </item> <item> <first>2327152015</first> <second>2327152015</second> </item> <item> <first>2764558328</first> <second>2764558328</second> </item> <item> <first>967560929</first> <second>967560929</second> </item> <item> <first>967560929</first> <second>967560929</second> </item> <item> <first>2868860431</first> <second>2868860431</second> </item> <item> <first>2868860431</first> <second>2868860431</second> </item> <item> <first>190104374</first> <second>190104374</second> </item> <item> <first>430136711</first> <second>430136711</second> </item> <item> <first>430136711</first> <second>430136711</second> </item> <item> <first>2491360284</first> <second>2491360284</second> </item> <item> <first>2774454326</first> <second>2774454326</second> </item> <item> <first>5018725</first> <second>5018725</second> </item> <item> <first>5018725</first> <second>5018725</second> </item> <item> <first>183526573</first> <second>183526573</second> </item> <item> <first>183526573</first> <second>183526573</second> </item> <item> <first>3254104696</first> <second>3254104696</second> </item> </values> </boost_serialization>
0
repos/unordered/test
repos/unordered/test/legacy_archives/multiset_int_100.txt
22 serialization::archive 19 0 0 152 193 0 1775667486 -948676228 -1108026676 -1866983349 -1866983349 258343568 -1068590402 -432548865 -432548865 177811234 5018725 5018725 190104374 1315739433 1315739433 -1995826660 -305386173 -305386173 287343763 287343763 1241175627 1241175627 109292002 1021729225 1021729225 -1426106865 -1426106865 918842470 -1338732474 669358715 669358715 183526573 183526573 -938475945 -938475945 -1694006096 1630722604 -1933552094 257760945 257760945 -1510933233 -1510933233 390937317 390937317 259868705 259868705 -38527737 -38527737 -551129560 1832705803 1832705803 607596425 607596425 -1520512970 -1674340339 -1674340339 -1873731147 -1873731147 1421489007 1421489007 -501526237 -501526237 -1877186230 -218590163 -218590163 647803737 647803737 -859679032 967560929 967560929 -815473344 -487119163 -487119163 -1546216506 1859681623 1859681623 -1040862600 -893024018 -1319261042 -1252588227 -1252588227 -1785808236 1198739057 1198739057 -1469084794 473010817 473010817 1481537722 2138619156 -1039351567 -1039351567 -493829536 411876340 -364116164 776215953 776215953 1568788209 1568788209 -1631204972 601527218 286273879 286273879 -232190041 -232190041 2075478837 2075478837 -1168265900 581989062 178482033 178482033 1354395138 -1530408968 -414767254 1970368353 1970368353 -1967815281 -1967815281 941660988 1786883066 670291604 -1803607012 1829132124 -432502583 -432502583 -1642734171 -1642734171 -425048532 2097663454 -1938999974 -1802192500 2056892401 2056892401 -917350225 -917350225 -55935255 -55935255 -418860175 -418860175 -2146202839 -2146202839 310524955 310524955 159865104 -265464733 -265464733 -1996442747 -1996442747 430136711 430136711 -743509129 -743509129 167237906 152 0 -938475945 -938475945 -1694006096 -1785808236 1021729225 1021729225 1832705803 1832705803 581989062 1354395138 2097663454 -743509129 -743509129 -1168265900 -414767254 -1039351567 -1039351567 167237906 177811234 -364116164 -1933552094 259868705 259868705 -501526237 -501526237 776215953 776215953 1630722604 310524955 310524955 473010817 473010817 1970368353 1970368353 647803737 647803737 -1252588227 -1252588227 669358715 669358715 2075478837 2075478837 -1995826660 109292002 1421489007 1421489007 287343763 287343763 -1108026676 1829132124 -1546216506 941660988 -305386173 -305386173 -815473344 -1877186230 601527218 -38527737 -38527737 -1068590402 1568788209 1568788209 1198739057 1198739057 2138619156 -218590163 -218590163 -1469084794 -493829536 -232190041 -232190041 -1674340339 -1674340339 1775667486 -948676228 -1338732474 178482033 178482033 918842470 -917350225 -917350225 390937317 390937317 -418860175 -418860175 670291604 1859681623 1859681623 1241175627 1241175627 -487119163 -487119163 1315739433 1315739433 -1938999974 1786883066 -55935255 -55935255 -2146202839 -2146202839 -1866983349 -1866983349 607596425 607596425 -425048532 -893024018 -1873731147 -1873731147 159865104 411876340 2056892401 2056892401 -1642734171 -1642734171 -1996442747 -1996442747 257760945 257760945 -1631204972 -1802192500 -432548865 -432548865 -551129560 -1319261042 -859679032 -1510933233 -1510933233 286273879 286273879 1481537722 258343568 -265464733 -265464733 -432502583 -432502583 -1967815281 -1967815281 -1530408968 967560929 967560929 -1426106865 -1426106865 190104374 430136711 430136711 -1803607012 -1520512970 5018725 5018725 183526573 183526573 -1040862600
0
repos/unordered/test
repos/unordered/test/legacy_archives/multiset_string_0.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="19"> <container class_id="0" tracking_level="0" version="0"> <count>0</count> <bucket_count>0</bucket_count> <item_version>0</item_version> </container> <values class_id="1" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </values> </boost_serialization>
0
repos/unordered/test
repos/unordered/test/legacy_archives/multiset_string_10.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="19"> <container class_id="0" tracking_level="0" version="0"> <count>14</count> <bucket_count>29</bucket_count> <item_version>0</item_version> <item>3551458167</item> <item>3551458167</item> <item>2600961200</item> <item>3126701396</item> <item>581989062</item> <item>1832705803</item> <item>1832705803</item> <item>3356491351</item> <item>3356491351</item> <item>1021729225</item> <item>1021729225</item> <item>2097663454</item> <item>1354395138</item> <item>2509159060</item> </container> <values class_id="1" tracking_level="0" version="0"> <count>14</count> <item_version>0</item_version> <item>3356491351</item> <item>3356491351</item> <item>2600961200</item> <item>2509159060</item> <item>1021729225</item> <item>1021729225</item> <item>1832705803</item> <item>1832705803</item> <item>581989062</item> <item>1354395138</item> <item>2097663454</item> <item>3551458167</item> <item>3551458167</item> <item>3126701396</item> </values> </boost_serialization>
0
repos/unordered/test
repos/unordered/test/legacy_archives/map_int_0.txt
22 serialization::archive 19 0 0 0 0 0 0 0 0 0
0
repos/unordered/test
repos/unordered/test/legacy_archives/multiset_string_0.txt
22 serialization::archive 19 0 0 0 0 0 0 0 0 0
0
repos/unordered/test
repos/unordered/test/legacy_archives/multiset_int_10.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="19"> <container class_id="0" tracking_level="0" version="0"> <count>14</count> <bucket_count>29</bucket_count> <item_version>0</item_version> <item>-938475945</item> <item>-938475945</item> <item>-1785808236</item> <item>-1694006096</item> <item>1021729225</item> <item>1021729225</item> <item>581989062</item> <item>-1168265900</item> <item>2097663454</item> <item>1354395138</item> <item>-743509129</item> <item>-743509129</item> <item>1832705803</item> <item>1832705803</item> </container> <values> <count>14</count> <item_version>0</item_version> <item>-938475945</item> <item>-938475945</item> <item>-1694006096</item> <item>-1785808236</item> <item>1021729225</item> <item>1021729225</item> <item>1832705803</item> <item>1832705803</item> <item>581989062</item> <item>1354395138</item> <item>2097663454</item> <item>-743509129</item> <item>-743509129</item> <item>-1168265900</item> </values> </boost_serialization>
0
repos/unordered/test
repos/unordered/test/legacy_archives/set_int_100.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="19"> <container class_id="0" tracking_level="0" version="0"> <count>100</count> <bucket_count>193</bucket_count> <item_version>0</item_version> <item>1775667486</item> <item>-948676228</item> <item>-1108026676</item> <item>-1866983349</item> <item>258343568</item> <item>-1068590402</item> <item>-432548865</item> <item>177811234</item> <item>5018725</item> <item>190104374</item> <item>1315739433</item> <item>-1995826660</item> <item>-305386173</item> <item>287343763</item> <item>1241175627</item> <item>109292002</item> <item>1021729225</item> <item>918842470</item> <item>-1426106865</item> <item>-1338732474</item> <item>669358715</item> <item>183526573</item> <item>-938475945</item> <item>-1694006096</item> <item>1630722604</item> <item>-1933552094</item> <item>257760945</item> <item>390937317</item> <item>-1510933233</item> <item>259868705</item> <item>-38527737</item> <item>-551129560</item> <item>1832705803</item> <item>607596425</item> <item>-1520512970</item> <item>-1674340339</item> <item>1421489007</item> <item>-501526237</item> <item>-1873731147</item> <item>-1877186230</item> <item>-218590163</item> <item>647803737</item> <item>-859679032</item> <item>967560929</item> <item>-815473344</item> <item>-487119163</item> <item>-1546216506</item> <item>1859681623</item> <item>-1040862600</item> <item>-893024018</item> <item>-1252588227</item> <item>-1319261042</item> <item>-1785808236</item> <item>1198739057</item> <item>-1469084794</item> <item>473010817</item> <item>1481537722</item> <item>2138619156</item> <item>-1039351567</item> <item>-493829536</item> <item>411876340</item> <item>-364116164</item> <item>776215953</item> <item>1568788209</item> <item>-1631204972</item> <item>601527218</item> <item>-232190041</item> <item>286273879</item> <item>2075478837</item> <item>-1168265900</item> <item>581989062</item> <item>178482033</item> <item>1354395138</item> <item>-1530408968</item> <item>-414767254</item> <item>1970368353</item> <item>-1967815281</item> <item>941660988</item> <item>1786883066</item> <item>670291604</item> <item>-1803607012</item> <item>1829132124</item> <item>-432502583</item> <item>-1642734171</item> <item>-425048532</item> <item>2097663454</item> <item>-1938999974</item> <item>-917350225</item> <item>2056892401</item> <item>-55935255</item> <item>-1802192500</item> <item>-418860175</item> <item>-2146202839</item> <item>310524955</item> <item>159865104</item> <item>-265464733</item> <item>-1996442747</item> <item>430136711</item> <item>-743509129</item> <item>167237906</item> </container> <values> <count>152</count> <item_version>0</item_version> <item>-938475945</item> <item>-938475945</item> <item>-1694006096</item> <item>-1785808236</item> <item>1021729225</item> <item>1021729225</item> <item>1832705803</item> <item>1832705803</item> <item>581989062</item> <item>1354395138</item> <item>2097663454</item> <item>-743509129</item> <item>-743509129</item> <item>-1168265900</item> <item>-414767254</item> <item>-1039351567</item> <item>-1039351567</item> <item>167237906</item> <item>177811234</item> <item>-364116164</item> <item>-1933552094</item> <item>259868705</item> <item>259868705</item> <item>-501526237</item> <item>-501526237</item> <item>776215953</item> <item>776215953</item> <item>1630722604</item> <item>310524955</item> <item>310524955</item> <item>473010817</item> <item>473010817</item> <item>1970368353</item> <item>1970368353</item> <item>647803737</item> <item>647803737</item> <item>-1252588227</item> <item>-1252588227</item> <item>669358715</item> <item>669358715</item> <item>2075478837</item> <item>2075478837</item> <item>-1995826660</item> <item>109292002</item> <item>1421489007</item> <item>1421489007</item> <item>287343763</item> <item>287343763</item> <item>-1108026676</item> <item>1829132124</item> <item>-1546216506</item> <item>941660988</item> <item>-305386173</item> <item>-305386173</item> <item>-815473344</item> <item>-1877186230</item> <item>601527218</item> <item>-38527737</item> <item>-38527737</item> <item>-1068590402</item> <item>1568788209</item> <item>1568788209</item> <item>1198739057</item> <item>1198739057</item> <item>2138619156</item> <item>-218590163</item> <item>-218590163</item> <item>-1469084794</item> <item>-493829536</item> <item>-232190041</item> <item>-232190041</item> <item>-1674340339</item> <item>-1674340339</item> <item>1775667486</item> <item>-948676228</item> <item>-1338732474</item> <item>178482033</item> <item>178482033</item> <item>918842470</item> <item>-917350225</item> <item>-917350225</item> <item>390937317</item> <item>390937317</item> <item>-418860175</item> <item>-418860175</item> <item>670291604</item> <item>1859681623</item> <item>1859681623</item> <item>1241175627</item> <item>1241175627</item> <item>-487119163</item> <item>-487119163</item> <item>1315739433</item> <item>1315739433</item> <item>-1938999974</item> <item>1786883066</item> <item>-55935255</item> <item>-55935255</item> <item>-2146202839</item> <item>-2146202839</item> <item>-1866983349</item> <item>-1866983349</item> <item>607596425</item> <item>607596425</item> <item>-425048532</item> <item>-893024018</item> <item>-1873731147</item> <item>-1873731147</item> <item>159865104</item> <item>411876340</item> <item>2056892401</item> <item>2056892401</item> <item>-1642734171</item> <item>-1642734171</item> <item>-1996442747</item> <item>-1996442747</item> <item>257760945</item> <item>257760945</item> <item>-1631204972</item> <item>-1802192500</item> <item>-432548865</item> <item>-432548865</item> <item>-551129560</item> <item>-1319261042</item> <item>-859679032</item> <item>-1510933233</item> <item>-1510933233</item> <item>286273879</item> <item>286273879</item> <item>1481537722</item> <item>258343568</item> <item>-265464733</item> <item>-265464733</item> <item>-432502583</item> <item>-432502583</item> <item>-1967815281</item> <item>-1967815281</item> <item>-1530408968</item> <item>967560929</item> <item>967560929</item> <item>-1426106865</item> <item>-1426106865</item> <item>190104374</item> <item>430136711</item> <item>430136711</item> <item>-1803607012</item> <item>-1520512970</item> <item>5018725</item> <item>5018725</item> <item>183526573</item> <item>183526573</item> <item>-1040862600</item> </values> </boost_serialization>
0
repos/unordered/test
repos/unordered/test/legacy_archives/multiset_string_100.txt
22 serialization::archive 19 0 0 152 193 0 9 178482033 9 178482033 10 1786883066 9 286273879 9 286273879 10 2298524549 10 2298524549 9 259868705 9 259868705 9 601527218 9 411876340 10 4029502563 10 4029502563 9 109292002 9 941660988 10 4256439559 10 4256439559 10 3401943278 10 2663762324 10 3042379069 10 3042379069 10 2509159060 10 1859681623 10 1859681623 10 3356491351 10 3356491351 10 2620626957 10 2620626957 10 2652233125 10 2652233125 9 607596425 9 607596425 10 1568788209 10 1568788209 10 2868860431 10 2868860431 9 670291604 10 2764558328 10 3226376894 10 3930851132 10 3801137760 9 287343763 9 287343763 10 2138619156 9 967560929 9 967560929 9 257760945 9 257760945 10 2056892401 10 2056892401 10 1829132124 10 3807848133 10 3807848133 9 190104374 9 310524955 9 310524955 10 1481537722 10 2361415202 10 1970368353 10 1970368353 10 2417781066 10 3186940620 10 1421489007 10 1421489007 9 776215953 9 776215953 10 1775667486 9 159865104 10 2355967322 10 2748750790 10 1832705803 10 1832705803 10 4239032041 10 4239032041 10 3876107121 10 3876107121 10 3479493952 10 2600961200 10 1241175627 10 1241175627 9 258343568 10 1630722604 10 3255615729 10 3255615729 7 5018725 7 5018725 10 2774454326 10 2825882502 9 581989062 10 2148764457 10 2148764457 10 3862464713 10 3862464713 10 3862418431 10 3862418431 9 918842470 9 183526573 9 183526573 10 2097663454 10 3377617071 10 3377617071 9 167237906 10 2492774796 10 3254104696 10 3551458167 10 3551458167 10 3989581123 10 3989581123 9 430136711 9 430136711 10 2427983947 10 2427983947 10 2975706254 10 1198739057 10 1198739057 9 473010817 9 473010817 10 2075478837 10 2075478837 10 2956234822 10 3435288264 10 2491360284 10 4076377133 10 4076377133 10 3869918764 9 647803737 9 647803737 9 669358715 9 669358715 9 177811234 10 1021729225 10 1021729225 10 2327152015 10 2327152015 10 3793441059 10 3793441059 9 390937317 9 390937317 10 2421236149 10 2421236149 10 3346291068 10 3880200042 10 2299140636 10 3743837736 10 2784034063 10 2784034063 10 1315739433 10 1315739433 10 1354395138 10 4062777255 10 4062777255 10 3126701396 0 0 152 0 10 3356491351 10 3356491351 10 2600961200 10 2509159060 10 1021729225 10 1021729225 10 1832705803 10 1832705803 9 581989062 10 1354395138 10 2097663454 10 3551458167 10 3551458167 10 3126701396 10 3880200042 10 3255615729 10 3255615729 9 167237906 9 177811234 10 3930851132 10 2361415202 9 259868705 9 259868705 10 3793441059 10 3793441059 9 776215953 9 776215953 10 1630722604 9 310524955 9 310524955 9 473010817 9 473010817 10 1970368353 10 1970368353 9 647803737 9 647803737 10 3042379069 10 3042379069 9 669358715 9 669358715 10 2075478837 10 2075478837 10 2299140636 9 109292002 10 1421489007 10 1421489007 9 287343763 9 287343763 10 3186940620 10 1829132124 10 2748750790 9 941660988 10 3989581123 10 3989581123 10 3479493952 10 2417781066 9 601527218 10 4256439559 10 4256439559 10 3226376894 10 1568788209 10 1568788209 10 1198739057 10 1198739057 10 2138619156 10 4076377133 10 4076377133 10 2825882502 10 3801137760 10 4062777255 10 4062777255 10 2620626957 10 2620626957 10 1775667486 10 3346291068 10 2956234822 9 178482033 9 178482033 9 918842470 10 3377617071 10 3377617071 9 390937317 9 390937317 10 3876107121 10 3876107121 9 670291604 10 1859681623 10 1859681623 10 1241175627 10 1241175627 10 3807848133 10 3807848133 10 1315739433 10 1315739433 10 2355967322 10 1786883066 10 4239032041 10 4239032041 10 2148764457 10 2148764457 10 2427983947 10 2427983947 9 607596425 9 607596425 10 3869918764 10 3401943278 10 2421236149 10 2421236149 9 159865104 9 411876340 10 2056892401 10 2056892401 10 2652233125 10 2652233125 10 2298524549 10 2298524549 9 257760945 9 257760945 10 2663762324 10 2492774796 10 3862418431 10 3862418431 10 3743837736 10 2975706254 10 3435288264 10 2784034063 10 2784034063 9 286273879 9 286273879 10 1481537722 9 258343568 10 4029502563 10 4029502563 10 3862464713 10 3862464713 10 2327152015 10 2327152015 10 2764558328 9 967560929 9 967560929 10 2868860431 10 2868860431 9 190104374 9 430136711 9 430136711 10 2491360284 10 2774454326 7 5018725 7 5018725 9 183526573 9 183526573 10 3254104696
0
repos/unordered/test
repos/unordered/test/legacy_archives/set_string_10.txt
22 serialization::archive 19 0 0 10 13 0 10 1832705803 10 2097663454 10 3551458167 10 2509159060 10 2600961200 9 581989062 10 1021729225 10 3126701396 10 1354395138 10 3356491351 0 0 14 0 10 3356491351 10 3356491351 10 2600961200 10 2509159060 10 1021729225 10 1021729225 10 1832705803 10 1832705803 9 581989062 10 1354395138 10 2097663454 10 3551458167 10 3551458167 10 3126701396
0
repos/unordered/test
repos/unordered/test/legacy_archives/set_int_0.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="19"> <container class_id="0" tracking_level="0" version="0"> <count>0</count> <bucket_count>0</bucket_count> <item_version>0</item_version> </container> <values> <count>0</count> <item_version>0</item_version> </values> </boost_serialization>
0
repos/unordered/test
repos/unordered/test/legacy_archives/set_string_100.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="19"> <container class_id="0" tracking_level="0" version="0"> <count>100</count> <bucket_count>193</bucket_count> <item_version>0</item_version> <item>1970368353</item> <item>2417781066</item> <item>3186940620</item> <item>1421489007</item> <item>776215953</item> <item>1775667486</item> <item>159865104</item> <item>2355967322</item> <item>2748750790</item> <item>1832705803</item> <item>4239032041</item> <item>3876107121</item> <item>3479493952</item> <item>2600961200</item> <item>1241175627</item> <item>258343568</item> <item>1630722604</item> <item>3255615729</item> <item>5018725</item> <item>2774454326</item> <item>2825882502</item> <item>581989062</item> <item>178482033</item> <item>1786883066</item> <item>286273879</item> <item>2298524549</item> <item>259868705</item> <item>601527218</item> <item>411876340</item> <item>4029502563</item> <item>109292002</item> <item>941660988</item> <item>4256439559</item> <item>3401943278</item> <item>2663762324</item> <item>3042379069</item> <item>2509159060</item> <item>1859681623</item> <item>3356491351</item> <item>2620626957</item> <item>2652233125</item> <item>1568788209</item> <item>607596425</item> <item>2868860431</item> <item>670291604</item> <item>2764558328</item> <item>3226376894</item> <item>3930851132</item> <item>3801137760</item> <item>287343763</item> <item>2138619156</item> <item>257760945</item> <item>967560929</item> <item>2056892401</item> <item>1829132124</item> <item>3807848133</item> <item>310524955</item> <item>190104374</item> <item>1481537722</item> <item>2361415202</item> <item>2148764457</item> <item>3862464713</item> <item>3862418431</item> <item>918842470</item> <item>183526573</item> <item>2097663454</item> <item>3377617071</item> <item>167237906</item> <item>2492774796</item> <item>3254104696</item> <item>3551458167</item> <item>3989581123</item> <item>2427983947</item> <item>430136711</item> <item>2975706254</item> <item>1198739057</item> <item>473010817</item> <item>2075478837</item> <item>2956234822</item> <item>3435288264</item> <item>2491360284</item> <item>4076377133</item> <item>3869918764</item> <item>647803737</item> <item>669358715</item> <item>177811234</item> <item>1021729225</item> <item>2327152015</item> <item>3793441059</item> <item>390937317</item> <item>2421236149</item> <item>3346291068</item> <item>3880200042</item> <item>2299140636</item> <item>3743837736</item> <item>1315739433</item> <item>2784034063</item> <item>1354395138</item> <item>4062777255</item> <item>3126701396</item> </container> <values class_id="1" tracking_level="0" version="0"> <count>152</count> <item_version>0</item_version> <item>3356491351</item> <item>3356491351</item> <item>2600961200</item> <item>2509159060</item> <item>1021729225</item> <item>1021729225</item> <item>1832705803</item> <item>1832705803</item> <item>581989062</item> <item>1354395138</item> <item>2097663454</item> <item>3551458167</item> <item>3551458167</item> <item>3126701396</item> <item>3880200042</item> <item>3255615729</item> <item>3255615729</item> <item>167237906</item> <item>177811234</item> <item>3930851132</item> <item>2361415202</item> <item>259868705</item> <item>259868705</item> <item>3793441059</item> <item>3793441059</item> <item>776215953</item> <item>776215953</item> <item>1630722604</item> <item>310524955</item> <item>310524955</item> <item>473010817</item> <item>473010817</item> <item>1970368353</item> <item>1970368353</item> <item>647803737</item> <item>647803737</item> <item>3042379069</item> <item>3042379069</item> <item>669358715</item> <item>669358715</item> <item>2075478837</item> <item>2075478837</item> <item>2299140636</item> <item>109292002</item> <item>1421489007</item> <item>1421489007</item> <item>287343763</item> <item>287343763</item> <item>3186940620</item> <item>1829132124</item> <item>2748750790</item> <item>941660988</item> <item>3989581123</item> <item>3989581123</item> <item>3479493952</item> <item>2417781066</item> <item>601527218</item> <item>4256439559</item> <item>4256439559</item> <item>3226376894</item> <item>1568788209</item> <item>1568788209</item> <item>1198739057</item> <item>1198739057</item> <item>2138619156</item> <item>4076377133</item> <item>4076377133</item> <item>2825882502</item> <item>3801137760</item> <item>4062777255</item> <item>4062777255</item> <item>2620626957</item> <item>2620626957</item> <item>1775667486</item> <item>3346291068</item> <item>2956234822</item> <item>178482033</item> <item>178482033</item> <item>918842470</item> <item>3377617071</item> <item>3377617071</item> <item>390937317</item> <item>390937317</item> <item>3876107121</item> <item>3876107121</item> <item>670291604</item> <item>1859681623</item> <item>1859681623</item> <item>1241175627</item> <item>1241175627</item> <item>3807848133</item> <item>3807848133</item> <item>1315739433</item> <item>1315739433</item> <item>2355967322</item> <item>1786883066</item> <item>4239032041</item> <item>4239032041</item> <item>2148764457</item> <item>2148764457</item> <item>2427983947</item> <item>2427983947</item> <item>607596425</item> <item>607596425</item> <item>3869918764</item> <item>3401943278</item> <item>2421236149</item> <item>2421236149</item> <item>159865104</item> <item>411876340</item> <item>2056892401</item> <item>2056892401</item> <item>2652233125</item> <item>2652233125</item> <item>2298524549</item> <item>2298524549</item> <item>257760945</item> <item>257760945</item> <item>2663762324</item> <item>2492774796</item> <item>3862418431</item> <item>3862418431</item> <item>3743837736</item> <item>2975706254</item> <item>3435288264</item> <item>2784034063</item> <item>2784034063</item> <item>286273879</item> <item>286273879</item> <item>1481537722</item> <item>258343568</item> <item>4029502563</item> <item>4029502563</item> <item>3862464713</item> <item>3862464713</item> <item>2327152015</item> <item>2327152015</item> <item>2764558328</item> <item>967560929</item> <item>967560929</item> <item>2868860431</item> <item>2868860431</item> <item>190104374</item> <item>430136711</item> <item>430136711</item> <item>2491360284</item> <item>2774454326</item> <item>5018725</item> <item>5018725</item> <item>183526573</item> <item>183526573</item> <item>3254104696</item> </values> </boost_serialization>
0
repos/unordered/test
repos/unordered/test/legacy_archives/map_int_0.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="19"> <container class_id="0" tracking_level="0" version="0"> <count>0</count> <bucket_count>0</bucket_count> <item_version>0</item_version> </container> <values class_id="1" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </values> </boost_serialization>
0
repos/unordered/test
repos/unordered/test/legacy_archives/multiset_int_0.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="19"> <container class_id="0" tracking_level="0" version="0"> <count>0</count> <bucket_count>0</bucket_count> <item_version>0</item_version> </container> <values> <count>0</count> <item_version>0</item_version> </values> </boost_serialization>
0
repos/unordered/test
repos/unordered/test/legacy_archives/multimap_string_0.txt
22 serialization::archive 19 0 0 0 0 0 0 0 0 0
0
repos/unordered/test
repos/unordered/test/legacy_archives/multiset_int_10.txt
22 serialization::archive 19 0 0 14 29 0 -938475945 -938475945 -1785808236 -1694006096 1021729225 1021729225 581989062 -1168265900 2097663454 1354395138 -743509129 -743509129 1832705803 1832705803 14 0 -938475945 -938475945 -1694006096 -1785808236 1021729225 1021729225 1832705803 1832705803 581989062 1354395138 2097663454 -743509129 -743509129 -1168265900
0
repos/unordered/test
repos/unordered/test/legacy_archives/multiset_string_100.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="19"> <container class_id="0" tracking_level="0" version="0"> <count>152</count> <bucket_count>193</bucket_count> <item_version>0</item_version> <item>178482033</item> <item>178482033</item> <item>1786883066</item> <item>286273879</item> <item>286273879</item> <item>2298524549</item> <item>2298524549</item> <item>259868705</item> <item>259868705</item> <item>601527218</item> <item>411876340</item> <item>4029502563</item> <item>4029502563</item> <item>109292002</item> <item>941660988</item> <item>4256439559</item> <item>4256439559</item> <item>3401943278</item> <item>2663762324</item> <item>3042379069</item> <item>3042379069</item> <item>2509159060</item> <item>1859681623</item> <item>1859681623</item> <item>3356491351</item> <item>3356491351</item> <item>2620626957</item> <item>2620626957</item> <item>2652233125</item> <item>2652233125</item> <item>607596425</item> <item>607596425</item> <item>1568788209</item> <item>1568788209</item> <item>2868860431</item> <item>2868860431</item> <item>670291604</item> <item>2764558328</item> <item>3226376894</item> <item>3930851132</item> <item>3801137760</item> <item>287343763</item> <item>287343763</item> <item>2138619156</item> <item>967560929</item> <item>967560929</item> <item>257760945</item> <item>257760945</item> <item>2056892401</item> <item>2056892401</item> <item>1829132124</item> <item>3807848133</item> <item>3807848133</item> <item>190104374</item> <item>310524955</item> <item>310524955</item> <item>1481537722</item> <item>2361415202</item> <item>1970368353</item> <item>1970368353</item> <item>2417781066</item> <item>3186940620</item> <item>1421489007</item> <item>1421489007</item> <item>776215953</item> <item>776215953</item> <item>1775667486</item> <item>159865104</item> <item>2355967322</item> <item>2748750790</item> <item>1832705803</item> <item>1832705803</item> <item>4239032041</item> <item>4239032041</item> <item>3876107121</item> <item>3876107121</item> <item>3479493952</item> <item>2600961200</item> <item>1241175627</item> <item>1241175627</item> <item>258343568</item> <item>1630722604</item> <item>3255615729</item> <item>3255615729</item> <item>5018725</item> <item>5018725</item> <item>2774454326</item> <item>2825882502</item> <item>581989062</item> <item>2148764457</item> <item>2148764457</item> <item>3862464713</item> <item>3862464713</item> <item>3862418431</item> <item>3862418431</item> <item>918842470</item> <item>183526573</item> <item>183526573</item> <item>2097663454</item> <item>3377617071</item> <item>3377617071</item> <item>167237906</item> <item>2492774796</item> <item>3254104696</item> <item>3551458167</item> <item>3551458167</item> <item>3989581123</item> <item>3989581123</item> <item>430136711</item> <item>430136711</item> <item>2427983947</item> <item>2427983947</item> <item>2975706254</item> <item>1198739057</item> <item>1198739057</item> <item>473010817</item> <item>473010817</item> <item>2075478837</item> <item>2075478837</item> <item>2956234822</item> <item>3435288264</item> <item>2491360284</item> <item>4076377133</item> <item>4076377133</item> <item>3869918764</item> <item>647803737</item> <item>647803737</item> <item>669358715</item> <item>669358715</item> <item>177811234</item> <item>1021729225</item> <item>1021729225</item> <item>2327152015</item> <item>2327152015</item> <item>3793441059</item> <item>3793441059</item> <item>390937317</item> <item>390937317</item> <item>2421236149</item> <item>2421236149</item> <item>3346291068</item> <item>3880200042</item> <item>2299140636</item> <item>3743837736</item> <item>2784034063</item> <item>2784034063</item> <item>1315739433</item> <item>1315739433</item> <item>1354395138</item> <item>4062777255</item> <item>4062777255</item> <item>3126701396</item> </container> <values class_id="1" tracking_level="0" version="0"> <count>152</count> <item_version>0</item_version> <item>3356491351</item> <item>3356491351</item> <item>2600961200</item> <item>2509159060</item> <item>1021729225</item> <item>1021729225</item> <item>1832705803</item> <item>1832705803</item> <item>581989062</item> <item>1354395138</item> <item>2097663454</item> <item>3551458167</item> <item>3551458167</item> <item>3126701396</item> <item>3880200042</item> <item>3255615729</item> <item>3255615729</item> <item>167237906</item> <item>177811234</item> <item>3930851132</item> <item>2361415202</item> <item>259868705</item> <item>259868705</item> <item>3793441059</item> <item>3793441059</item> <item>776215953</item> <item>776215953</item> <item>1630722604</item> <item>310524955</item> <item>310524955</item> <item>473010817</item> <item>473010817</item> <item>1970368353</item> <item>1970368353</item> <item>647803737</item> <item>647803737</item> <item>3042379069</item> <item>3042379069</item> <item>669358715</item> <item>669358715</item> <item>2075478837</item> <item>2075478837</item> <item>2299140636</item> <item>109292002</item> <item>1421489007</item> <item>1421489007</item> <item>287343763</item> <item>287343763</item> <item>3186940620</item> <item>1829132124</item> <item>2748750790</item> <item>941660988</item> <item>3989581123</item> <item>3989581123</item> <item>3479493952</item> <item>2417781066</item> <item>601527218</item> <item>4256439559</item> <item>4256439559</item> <item>3226376894</item> <item>1568788209</item> <item>1568788209</item> <item>1198739057</item> <item>1198739057</item> <item>2138619156</item> <item>4076377133</item> <item>4076377133</item> <item>2825882502</item> <item>3801137760</item> <item>4062777255</item> <item>4062777255</item> <item>2620626957</item> <item>2620626957</item> <item>1775667486</item> <item>3346291068</item> <item>2956234822</item> <item>178482033</item> <item>178482033</item> <item>918842470</item> <item>3377617071</item> <item>3377617071</item> <item>390937317</item> <item>390937317</item> <item>3876107121</item> <item>3876107121</item> <item>670291604</item> <item>1859681623</item> <item>1859681623</item> <item>1241175627</item> <item>1241175627</item> <item>3807848133</item> <item>3807848133</item> <item>1315739433</item> <item>1315739433</item> <item>2355967322</item> <item>1786883066</item> <item>4239032041</item> <item>4239032041</item> <item>2148764457</item> <item>2148764457</item> <item>2427983947</item> <item>2427983947</item> <item>607596425</item> <item>607596425</item> <item>3869918764</item> <item>3401943278</item> <item>2421236149</item> <item>2421236149</item> <item>159865104</item> <item>411876340</item> <item>2056892401</item> <item>2056892401</item> <item>2652233125</item> <item>2652233125</item> <item>2298524549</item> <item>2298524549</item> <item>257760945</item> <item>257760945</item> <item>2663762324</item> <item>2492774796</item> <item>3862418431</item> <item>3862418431</item> <item>3743837736</item> <item>2975706254</item> <item>3435288264</item> <item>2784034063</item> <item>2784034063</item> <item>286273879</item> <item>286273879</item> <item>1481537722</item> <item>258343568</item> <item>4029502563</item> <item>4029502563</item> <item>3862464713</item> <item>3862464713</item> <item>2327152015</item> <item>2327152015</item> <item>2764558328</item> <item>967560929</item> <item>967560929</item> <item>2868860431</item> <item>2868860431</item> <item>190104374</item> <item>430136711</item> <item>430136711</item> <item>2491360284</item> <item>2774454326</item> <item>5018725</item> <item>5018725</item> <item>183526573</item> <item>183526573</item> <item>3254104696</item> </values> </boost_serialization>
0
repos/unordered/test
repos/unordered/test/legacy_archives/multimap_string_0.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="19"> <container class_id="0" tracking_level="0" version="0"> <count>0</count> <bucket_count>0</bucket_count> <item_version>0</item_version> </container> <values class_id="1" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </values> </boost_serialization>
0
repos/unordered/test
repos/unordered/test/legacy_archives/map_string_10.txt
22 serialization::archive 19 0 0 10 13 0 0 0 10 1832705803 10 1832705803 10 2097663454 10 2097663454 10 3551458167 10 3551458167 10 2509159060 10 2509159060 10 2600961200 10 2600961200 9 581989062 9 581989062 10 1021729225 10 1021729225 10 3126701396 10 3126701396 10 1354395138 10 1354395138 10 3356491351 10 3356491351 0 0 14 0 0 0 10 3356491351 10 3356491351 10 3356491351 10 3356491351 10 2600961200 10 2600961200 10 2509159060 10 2509159060 10 1021729225 10 1021729225 10 1021729225 10 1021729225 10 1832705803 10 1832705803 10 1832705803 10 1832705803 9 581989062 9 581989062 10 1354395138 10 1354395138 10 2097663454 10 2097663454 10 3551458167 10 3551458167 10 3551458167 10 3551458167 10 3126701396 10 3126701396
0
repos/unordered/test
repos/unordered/test/legacy_archives/map_int_10.txt
22 serialization::archive 19 0 0 10 13 0 0 0 2097663454 2097663454 -1785808236 -1785808236 -938475945 -938475945 1354395138 1354395138 581989062 581989062 -1694006096 -1694006096 1832705803 1832705803 -743509129 -743509129 1021729225 1021729225 -1168265900 -1168265900 0 0 14 0 0 0 -938475945 -938475945 -938475945 -938475945 -1694006096 -1694006096 -1785808236 -1785808236 1021729225 1021729225 1021729225 1021729225 1832705803 1832705803 1832705803 1832705803 581989062 581989062 1354395138 1354395138 2097663454 2097663454 -743509129 -743509129 -743509129 -743509129 -1168265900 -1168265900
0
repos/unordered/test
repos/unordered/test/legacy_archives/map_int_100.txt
22 serialization::archive 19 0 0 100 193 0 0 0 1775667486 1775667486 -948676228 -948676228 -1108026676 -1108026676 -1866983349 -1866983349 258343568 258343568 -1068590402 -1068590402 -432548865 -432548865 177811234 177811234 5018725 5018725 190104374 190104374 1315739433 1315739433 -1995826660 -1995826660 -305386173 -305386173 287343763 287343763 1241175627 1241175627 109292002 109292002 1021729225 1021729225 918842470 918842470 -1426106865 -1426106865 -1338732474 -1338732474 669358715 669358715 183526573 183526573 -938475945 -938475945 -1694006096 -1694006096 1630722604 1630722604 -1933552094 -1933552094 257760945 257760945 390937317 390937317 -1510933233 -1510933233 259868705 259868705 -38527737 -38527737 -551129560 -551129560 1832705803 1832705803 607596425 607596425 -1520512970 -1520512970 -1674340339 -1674340339 1421489007 1421489007 -501526237 -501526237 -1873731147 -1873731147 -1877186230 -1877186230 -218590163 -218590163 647803737 647803737 -859679032 -859679032 967560929 967560929 -815473344 -815473344 -487119163 -487119163 -1546216506 -1546216506 1859681623 1859681623 -1040862600 -1040862600 -893024018 -893024018 -1252588227 -1252588227 -1319261042 -1319261042 -1785808236 -1785808236 1198739057 1198739057 -1469084794 -1469084794 473010817 473010817 1481537722 1481537722 2138619156 2138619156 -1039351567 -1039351567 -493829536 -493829536 411876340 411876340 -364116164 -364116164 776215953 776215953 1568788209 1568788209 -1631204972 -1631204972 601527218 601527218 -232190041 -232190041 286273879 286273879 2075478837 2075478837 -1168265900 -1168265900 581989062 581989062 178482033 178482033 1354395138 1354395138 -1530408968 -1530408968 -414767254 -414767254 1970368353 1970368353 -1967815281 -1967815281 941660988 941660988 1786883066 1786883066 670291604 670291604 -1803607012 -1803607012 1829132124 1829132124 -432502583 -432502583 -1642734171 -1642734171 -425048532 -425048532 2097663454 2097663454 -1938999974 -1938999974 -917350225 -917350225 2056892401 2056892401 -55935255 -55935255 -1802192500 -1802192500 -418860175 -418860175 -2146202839 -2146202839 310524955 310524955 159865104 159865104 -265464733 -265464733 -1996442747 -1996442747 430136711 430136711 -743509129 -743509129 167237906 167237906 0 0 152 0 0 0 -938475945 -938475945 -938475945 -938475945 -1694006096 -1694006096 -1785808236 -1785808236 1021729225 1021729225 1021729225 1021729225 1832705803 1832705803 1832705803 1832705803 581989062 581989062 1354395138 1354395138 2097663454 2097663454 -743509129 -743509129 -743509129 -743509129 -1168265900 -1168265900 -414767254 -414767254 -1039351567 -1039351567 -1039351567 -1039351567 167237906 167237906 177811234 177811234 -364116164 -364116164 -1933552094 -1933552094 259868705 259868705 259868705 259868705 -501526237 -501526237 -501526237 -501526237 776215953 776215953 776215953 776215953 1630722604 1630722604 310524955 310524955 310524955 310524955 473010817 473010817 473010817 473010817 1970368353 1970368353 1970368353 1970368353 647803737 647803737 647803737 647803737 -1252588227 -1252588227 -1252588227 -1252588227 669358715 669358715 669358715 669358715 2075478837 2075478837 2075478837 2075478837 -1995826660 -1995826660 109292002 109292002 1421489007 1421489007 1421489007 1421489007 287343763 287343763 287343763 287343763 -1108026676 -1108026676 1829132124 1829132124 -1546216506 -1546216506 941660988 941660988 -305386173 -305386173 -305386173 -305386173 -815473344 -815473344 -1877186230 -1877186230 601527218 601527218 -38527737 -38527737 -38527737 -38527737 -1068590402 -1068590402 1568788209 1568788209 1568788209 1568788209 1198739057 1198739057 1198739057 1198739057 2138619156 2138619156 -218590163 -218590163 -218590163 -218590163 -1469084794 -1469084794 -493829536 -493829536 -232190041 -232190041 -232190041 -232190041 -1674340339 -1674340339 -1674340339 -1674340339 1775667486 1775667486 -948676228 -948676228 -1338732474 -1338732474 178482033 178482033 178482033 178482033 918842470 918842470 -917350225 -917350225 -917350225 -917350225 390937317 390937317 390937317 390937317 -418860175 -418860175 -418860175 -418860175 670291604 670291604 1859681623 1859681623 1859681623 1859681623 1241175627 1241175627 1241175627 1241175627 -487119163 -487119163 -487119163 -487119163 1315739433 1315739433 1315739433 1315739433 -1938999974 -1938999974 1786883066 1786883066 -55935255 -55935255 -55935255 -55935255 -2146202839 -2146202839 -2146202839 -2146202839 -1866983349 -1866983349 -1866983349 -1866983349 607596425 607596425 607596425 607596425 -425048532 -425048532 -893024018 -893024018 -1873731147 -1873731147 -1873731147 -1873731147 159865104 159865104 411876340 411876340 2056892401 2056892401 2056892401 2056892401 -1642734171 -1642734171 -1642734171 -1642734171 -1996442747 -1996442747 -1996442747 -1996442747 257760945 257760945 257760945 257760945 -1631204972 -1631204972 -1802192500 -1802192500 -432548865 -432548865 -432548865 -432548865 -551129560 -551129560 -1319261042 -1319261042 -859679032 -859679032 -1510933233 -1510933233 -1510933233 -1510933233 286273879 286273879 286273879 286273879 1481537722 1481537722 258343568 258343568 -265464733 -265464733 -265464733 -265464733 -432502583 -432502583 -432502583 -432502583 -1967815281 -1967815281 -1967815281 -1967815281 -1530408968 -1530408968 967560929 967560929 967560929 967560929 -1426106865 -1426106865 -1426106865 -1426106865 190104374 190104374 430136711 430136711 430136711 430136711 -1803607012 -1803607012 -1520512970 -1520512970 5018725 5018725 5018725 5018725 183526573 183526573 183526573 183526573 -1040862600 -1040862600
0
repos/unordered/test
repos/unordered/test/legacy_archives/map_string_100.txt
22 serialization::archive 19 0 0 100 193 0 0 0 10 1970368353 10 1970368353 10 2417781066 10 2417781066 10 3186940620 10 3186940620 10 1421489007 10 1421489007 9 776215953 9 776215953 10 1775667486 10 1775667486 9 159865104 9 159865104 10 2355967322 10 2355967322 10 2748750790 10 2748750790 10 1832705803 10 1832705803 10 4239032041 10 4239032041 10 3876107121 10 3876107121 10 3479493952 10 3479493952 10 2600961200 10 2600961200 10 1241175627 10 1241175627 9 258343568 9 258343568 10 1630722604 10 1630722604 10 3255615729 10 3255615729 7 5018725 7 5018725 10 2774454326 10 2774454326 10 2825882502 10 2825882502 9 581989062 9 581989062 9 178482033 9 178482033 10 1786883066 10 1786883066 9 286273879 9 286273879 10 2298524549 10 2298524549 9 259868705 9 259868705 9 601527218 9 601527218 9 411876340 9 411876340 10 4029502563 10 4029502563 9 109292002 9 109292002 9 941660988 9 941660988 10 4256439559 10 4256439559 10 3401943278 10 3401943278 10 2663762324 10 2663762324 10 3042379069 10 3042379069 10 2509159060 10 2509159060 10 1859681623 10 1859681623 10 3356491351 10 3356491351 10 2620626957 10 2620626957 10 2652233125 10 2652233125 10 1568788209 10 1568788209 9 607596425 9 607596425 10 2868860431 10 2868860431 9 670291604 9 670291604 10 2764558328 10 2764558328 10 3226376894 10 3226376894 10 3930851132 10 3930851132 10 3801137760 10 3801137760 9 287343763 9 287343763 10 2138619156 10 2138619156 9 257760945 9 257760945 9 967560929 9 967560929 10 2056892401 10 2056892401 10 1829132124 10 1829132124 10 3807848133 10 3807848133 9 310524955 9 310524955 9 190104374 9 190104374 10 1481537722 10 1481537722 10 2361415202 10 2361415202 10 2148764457 10 2148764457 10 3862464713 10 3862464713 10 3862418431 10 3862418431 9 918842470 9 918842470 9 183526573 9 183526573 10 2097663454 10 2097663454 10 3377617071 10 3377617071 9 167237906 9 167237906 10 2492774796 10 2492774796 10 3254104696 10 3254104696 10 3551458167 10 3551458167 10 3989581123 10 3989581123 10 2427983947 10 2427983947 9 430136711 9 430136711 10 2975706254 10 2975706254 10 1198739057 10 1198739057 9 473010817 9 473010817 10 2075478837 10 2075478837 10 2956234822 10 2956234822 10 3435288264 10 3435288264 10 2491360284 10 2491360284 10 4076377133 10 4076377133 10 3869918764 10 3869918764 9 647803737 9 647803737 9 669358715 9 669358715 9 177811234 9 177811234 10 1021729225 10 1021729225 10 2327152015 10 2327152015 10 3793441059 10 3793441059 9 390937317 9 390937317 10 2421236149 10 2421236149 10 3346291068 10 3346291068 10 3880200042 10 3880200042 10 2299140636 10 2299140636 10 3743837736 10 3743837736 10 1315739433 10 1315739433 10 2784034063 10 2784034063 10 1354395138 10 1354395138 10 4062777255 10 4062777255 10 3126701396 10 3126701396 0 0 152 0 0 0 10 3356491351 10 3356491351 10 3356491351 10 3356491351 10 2600961200 10 2600961200 10 2509159060 10 2509159060 10 1021729225 10 1021729225 10 1021729225 10 1021729225 10 1832705803 10 1832705803 10 1832705803 10 1832705803 9 581989062 9 581989062 10 1354395138 10 1354395138 10 2097663454 10 2097663454 10 3551458167 10 3551458167 10 3551458167 10 3551458167 10 3126701396 10 3126701396 10 3880200042 10 3880200042 10 3255615729 10 3255615729 10 3255615729 10 3255615729 9 167237906 9 167237906 9 177811234 9 177811234 10 3930851132 10 3930851132 10 2361415202 10 2361415202 9 259868705 9 259868705 9 259868705 9 259868705 10 3793441059 10 3793441059 10 3793441059 10 3793441059 9 776215953 9 776215953 9 776215953 9 776215953 10 1630722604 10 1630722604 9 310524955 9 310524955 9 310524955 9 310524955 9 473010817 9 473010817 9 473010817 9 473010817 10 1970368353 10 1970368353 10 1970368353 10 1970368353 9 647803737 9 647803737 9 647803737 9 647803737 10 3042379069 10 3042379069 10 3042379069 10 3042379069 9 669358715 9 669358715 9 669358715 9 669358715 10 2075478837 10 2075478837 10 2075478837 10 2075478837 10 2299140636 10 2299140636 9 109292002 9 109292002 10 1421489007 10 1421489007 10 1421489007 10 1421489007 9 287343763 9 287343763 9 287343763 9 287343763 10 3186940620 10 3186940620 10 1829132124 10 1829132124 10 2748750790 10 2748750790 9 941660988 9 941660988 10 3989581123 10 3989581123 10 3989581123 10 3989581123 10 3479493952 10 3479493952 10 2417781066 10 2417781066 9 601527218 9 601527218 10 4256439559 10 4256439559 10 4256439559 10 4256439559 10 3226376894 10 3226376894 10 1568788209 10 1568788209 10 1568788209 10 1568788209 10 1198739057 10 1198739057 10 1198739057 10 1198739057 10 2138619156 10 2138619156 10 4076377133 10 4076377133 10 4076377133 10 4076377133 10 2825882502 10 2825882502 10 3801137760 10 3801137760 10 4062777255 10 4062777255 10 4062777255 10 4062777255 10 2620626957 10 2620626957 10 2620626957 10 2620626957 10 1775667486 10 1775667486 10 3346291068 10 3346291068 10 2956234822 10 2956234822 9 178482033 9 178482033 9 178482033 9 178482033 9 918842470 9 918842470 10 3377617071 10 3377617071 10 3377617071 10 3377617071 9 390937317 9 390937317 9 390937317 9 390937317 10 3876107121 10 3876107121 10 3876107121 10 3876107121 9 670291604 9 670291604 10 1859681623 10 1859681623 10 1859681623 10 1859681623 10 1241175627 10 1241175627 10 1241175627 10 1241175627 10 3807848133 10 3807848133 10 3807848133 10 3807848133 10 1315739433 10 1315739433 10 1315739433 10 1315739433 10 2355967322 10 2355967322 10 1786883066 10 1786883066 10 4239032041 10 4239032041 10 4239032041 10 4239032041 10 2148764457 10 2148764457 10 2148764457 10 2148764457 10 2427983947 10 2427983947 10 2427983947 10 2427983947 9 607596425 9 607596425 9 607596425 9 607596425 10 3869918764 10 3869918764 10 3401943278 10 3401943278 10 2421236149 10 2421236149 10 2421236149 10 2421236149 9 159865104 9 159865104 9 411876340 9 411876340 10 2056892401 10 2056892401 10 2056892401 10 2056892401 10 2652233125 10 2652233125 10 2652233125 10 2652233125 10 2298524549 10 2298524549 10 2298524549 10 2298524549 9 257760945 9 257760945 9 257760945 9 257760945 10 2663762324 10 2663762324 10 2492774796 10 2492774796 10 3862418431 10 3862418431 10 3862418431 10 3862418431 10 3743837736 10 3743837736 10 2975706254 10 2975706254 10 3435288264 10 3435288264 10 2784034063 10 2784034063 10 2784034063 10 2784034063 9 286273879 9 286273879 9 286273879 9 286273879 10 1481537722 10 1481537722 9 258343568 9 258343568 10 4029502563 10 4029502563 10 4029502563 10 4029502563 10 3862464713 10 3862464713 10 3862464713 10 3862464713 10 2327152015 10 2327152015 10 2327152015 10 2327152015 10 2764558328 10 2764558328 9 967560929 9 967560929 9 967560929 9 967560929 10 2868860431 10 2868860431 10 2868860431 10 2868860431 9 190104374 9 190104374 9 430136711 9 430136711 9 430136711 9 430136711 10 2491360284 10 2491360284 10 2774454326 10 2774454326 7 5018725 7 5018725 7 5018725 7 5018725 9 183526573 9 183526573 9 183526573 9 183526573 10 3254104696 10 3254104696
0
repos/unordered/test
repos/unordered/test/legacy_archives/set_int_100.txt
22 serialization::archive 19 0 0 100 193 0 1775667486 -948676228 -1108026676 -1866983349 258343568 -1068590402 -432548865 177811234 5018725 190104374 1315739433 -1995826660 -305386173 287343763 1241175627 109292002 1021729225 918842470 -1426106865 -1338732474 669358715 183526573 -938475945 -1694006096 1630722604 -1933552094 257760945 390937317 -1510933233 259868705 -38527737 -551129560 1832705803 607596425 -1520512970 -1674340339 1421489007 -501526237 -1873731147 -1877186230 -218590163 647803737 -859679032 967560929 -815473344 -487119163 -1546216506 1859681623 -1040862600 -893024018 -1252588227 -1319261042 -1785808236 1198739057 -1469084794 473010817 1481537722 2138619156 -1039351567 -493829536 411876340 -364116164 776215953 1568788209 -1631204972 601527218 -232190041 286273879 2075478837 -1168265900 581989062 178482033 1354395138 -1530408968 -414767254 1970368353 -1967815281 941660988 1786883066 670291604 -1803607012 1829132124 -432502583 -1642734171 -425048532 2097663454 -1938999974 -917350225 2056892401 -55935255 -1802192500 -418860175 -2146202839 310524955 159865104 -265464733 -1996442747 430136711 -743509129 167237906 152 0 -938475945 -938475945 -1694006096 -1785808236 1021729225 1021729225 1832705803 1832705803 581989062 1354395138 2097663454 -743509129 -743509129 -1168265900 -414767254 -1039351567 -1039351567 167237906 177811234 -364116164 -1933552094 259868705 259868705 -501526237 -501526237 776215953 776215953 1630722604 310524955 310524955 473010817 473010817 1970368353 1970368353 647803737 647803737 -1252588227 -1252588227 669358715 669358715 2075478837 2075478837 -1995826660 109292002 1421489007 1421489007 287343763 287343763 -1108026676 1829132124 -1546216506 941660988 -305386173 -305386173 -815473344 -1877186230 601527218 -38527737 -38527737 -1068590402 1568788209 1568788209 1198739057 1198739057 2138619156 -218590163 -218590163 -1469084794 -493829536 -232190041 -232190041 -1674340339 -1674340339 1775667486 -948676228 -1338732474 178482033 178482033 918842470 -917350225 -917350225 390937317 390937317 -418860175 -418860175 670291604 1859681623 1859681623 1241175627 1241175627 -487119163 -487119163 1315739433 1315739433 -1938999974 1786883066 -55935255 -55935255 -2146202839 -2146202839 -1866983349 -1866983349 607596425 607596425 -425048532 -893024018 -1873731147 -1873731147 159865104 411876340 2056892401 2056892401 -1642734171 -1642734171 -1996442747 -1996442747 257760945 257760945 -1631204972 -1802192500 -432548865 -432548865 -551129560 -1319261042 -859679032 -1510933233 -1510933233 286273879 286273879 1481537722 258343568 -265464733 -265464733 -432502583 -432502583 -1967815281 -1967815281 -1530408968 967560929 967560929 -1426106865 -1426106865 190104374 430136711 430136711 -1803607012 -1520512970 5018725 5018725 183526573 183526573 -1040862600
0
repos/unordered/test
repos/unordered/test/legacy_archives/multimap_int_10.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="19"> <container class_id="0" tracking_level="0" version="0"> <count>14</count> <bucket_count>29</bucket_count> <item_version>0</item_version> <item class_id="1" tracking_level="0" version="0"> <first>-938475945</first> <second>-938475945</second> </item> <item> <first>-938475945</first> <second>-938475945</second> </item> <item> <first>-1785808236</first> <second>-1785808236</second> </item> <item> <first>-1694006096</first> <second>-1694006096</second> </item> <item> <first>1021729225</first> <second>1021729225</second> </item> <item> <first>1021729225</first> <second>1021729225</second> </item> <item> <first>581989062</first> <second>581989062</second> </item> <item> <first>-1168265900</first> <second>-1168265900</second> </item> <item> <first>2097663454</first> <second>2097663454</second> </item> <item> <first>1354395138</first> <second>1354395138</second> </item> <item> <first>-743509129</first> <second>-743509129</second> </item> <item> <first>-743509129</first> <second>-743509129</second> </item> <item> <first>1832705803</first> <second>1832705803</second> </item> <item> <first>1832705803</first> <second>1832705803</second> </item> </container> <values class_id="2" tracking_level="0" version="0"> <count>14</count> <item_version>0</item_version> <item class_id="3" tracking_level="0" version="0"> <first>-938475945</first> <second>-938475945</second> </item> <item> <first>-938475945</first> <second>-938475945</second> </item> <item> <first>-1694006096</first> <second>-1694006096</second> </item> <item> <first>-1785808236</first> <second>-1785808236</second> </item> <item> <first>1021729225</first> <second>1021729225</second> </item> <item> <first>1021729225</first> <second>1021729225</second> </item> <item> <first>1832705803</first> <second>1832705803</second> </item> <item> <first>1832705803</first> <second>1832705803</second> </item> <item> <first>581989062</first> <second>581989062</second> </item> <item> <first>1354395138</first> <second>1354395138</second> </item> <item> <first>2097663454</first> <second>2097663454</second> </item> <item> <first>-743509129</first> <second>-743509129</second> </item> <item> <first>-743509129</first> <second>-743509129</second> </item> <item> <first>-1168265900</first> <second>-1168265900</second> </item> </values> </boost_serialization>
0
repos/unordered/test
repos/unordered/test/legacy_archives/multimap_string_10.txt
22 serialization::archive 19 0 0 14 29 0 0 0 10 3551458167 10 3551458167 10 3551458167 10 3551458167 10 2600961200 10 2600961200 10 3126701396 10 3126701396 9 581989062 9 581989062 10 1832705803 10 1832705803 10 1832705803 10 1832705803 10 3356491351 10 3356491351 10 3356491351 10 3356491351 10 1021729225 10 1021729225 10 1021729225 10 1021729225 10 2097663454 10 2097663454 10 1354395138 10 1354395138 10 2509159060 10 2509159060 0 0 14 0 0 0 10 3356491351 10 3356491351 10 3356491351 10 3356491351 10 2600961200 10 2600961200 10 2509159060 10 2509159060 10 1021729225 10 1021729225 10 1021729225 10 1021729225 10 1832705803 10 1832705803 10 1832705803 10 1832705803 9 581989062 9 581989062 10 1354395138 10 1354395138 10 2097663454 10 2097663454 10 3551458167 10 3551458167 10 3551458167 10 3551458167 10 3126701396 10 3126701396
0
repos/unordered/test
repos/unordered/test/legacy_archives/multimap_int_100.txt
22 serialization::archive 19 0 0 152 193 0 0 0 1775667486 1775667486 -948676228 -948676228 -1108026676 -1108026676 -1866983349 -1866983349 -1866983349 -1866983349 258343568 258343568 -1068590402 -1068590402 -432548865 -432548865 -432548865 -432548865 177811234 177811234 5018725 5018725 5018725 5018725 190104374 190104374 1315739433 1315739433 1315739433 1315739433 -1995826660 -1995826660 -305386173 -305386173 -305386173 -305386173 287343763 287343763 287343763 287343763 1241175627 1241175627 1241175627 1241175627 109292002 109292002 1021729225 1021729225 1021729225 1021729225 -1426106865 -1426106865 -1426106865 -1426106865 918842470 918842470 -1338732474 -1338732474 669358715 669358715 669358715 669358715 183526573 183526573 183526573 183526573 -938475945 -938475945 -938475945 -938475945 -1694006096 -1694006096 1630722604 1630722604 -1933552094 -1933552094 257760945 257760945 257760945 257760945 -1510933233 -1510933233 -1510933233 -1510933233 390937317 390937317 390937317 390937317 259868705 259868705 259868705 259868705 -38527737 -38527737 -38527737 -38527737 -551129560 -551129560 1832705803 1832705803 1832705803 1832705803 607596425 607596425 607596425 607596425 -1520512970 -1520512970 -1674340339 -1674340339 -1674340339 -1674340339 -1873731147 -1873731147 -1873731147 -1873731147 1421489007 1421489007 1421489007 1421489007 -501526237 -501526237 -501526237 -501526237 -1877186230 -1877186230 -218590163 -218590163 -218590163 -218590163 647803737 647803737 647803737 647803737 -859679032 -859679032 967560929 967560929 967560929 967560929 -815473344 -815473344 -487119163 -487119163 -487119163 -487119163 -1546216506 -1546216506 1859681623 1859681623 1859681623 1859681623 -1040862600 -1040862600 -893024018 -893024018 -1319261042 -1319261042 -1252588227 -1252588227 -1252588227 -1252588227 -1785808236 -1785808236 1198739057 1198739057 1198739057 1198739057 -1469084794 -1469084794 473010817 473010817 473010817 473010817 1481537722 1481537722 2138619156 2138619156 -1039351567 -1039351567 -1039351567 -1039351567 -493829536 -493829536 411876340 411876340 -364116164 -364116164 776215953 776215953 776215953 776215953 1568788209 1568788209 1568788209 1568788209 -1631204972 -1631204972 601527218 601527218 286273879 286273879 286273879 286273879 -232190041 -232190041 -232190041 -232190041 2075478837 2075478837 2075478837 2075478837 -1168265900 -1168265900 581989062 581989062 178482033 178482033 178482033 178482033 1354395138 1354395138 -1530408968 -1530408968 -414767254 -414767254 1970368353 1970368353 1970368353 1970368353 -1967815281 -1967815281 -1967815281 -1967815281 941660988 941660988 1786883066 1786883066 670291604 670291604 -1803607012 -1803607012 1829132124 1829132124 -432502583 -432502583 -432502583 -432502583 -1642734171 -1642734171 -1642734171 -1642734171 -425048532 -425048532 2097663454 2097663454 -1938999974 -1938999974 -1802192500 -1802192500 2056892401 2056892401 2056892401 2056892401 -917350225 -917350225 -917350225 -917350225 -55935255 -55935255 -55935255 -55935255 -418860175 -418860175 -418860175 -418860175 -2146202839 -2146202839 -2146202839 -2146202839 310524955 310524955 310524955 310524955 159865104 159865104 -265464733 -265464733 -265464733 -265464733 -1996442747 -1996442747 -1996442747 -1996442747 430136711 430136711 430136711 430136711 -743509129 -743509129 -743509129 -743509129 167237906 167237906 0 0 152 0 0 0 -938475945 -938475945 -938475945 -938475945 -1694006096 -1694006096 -1785808236 -1785808236 1021729225 1021729225 1021729225 1021729225 1832705803 1832705803 1832705803 1832705803 581989062 581989062 1354395138 1354395138 2097663454 2097663454 -743509129 -743509129 -743509129 -743509129 -1168265900 -1168265900 -414767254 -414767254 -1039351567 -1039351567 -1039351567 -1039351567 167237906 167237906 177811234 177811234 -364116164 -364116164 -1933552094 -1933552094 259868705 259868705 259868705 259868705 -501526237 -501526237 -501526237 -501526237 776215953 776215953 776215953 776215953 1630722604 1630722604 310524955 310524955 310524955 310524955 473010817 473010817 473010817 473010817 1970368353 1970368353 1970368353 1970368353 647803737 647803737 647803737 647803737 -1252588227 -1252588227 -1252588227 -1252588227 669358715 669358715 669358715 669358715 2075478837 2075478837 2075478837 2075478837 -1995826660 -1995826660 109292002 109292002 1421489007 1421489007 1421489007 1421489007 287343763 287343763 287343763 287343763 -1108026676 -1108026676 1829132124 1829132124 -1546216506 -1546216506 941660988 941660988 -305386173 -305386173 -305386173 -305386173 -815473344 -815473344 -1877186230 -1877186230 601527218 601527218 -38527737 -38527737 -38527737 -38527737 -1068590402 -1068590402 1568788209 1568788209 1568788209 1568788209 1198739057 1198739057 1198739057 1198739057 2138619156 2138619156 -218590163 -218590163 -218590163 -218590163 -1469084794 -1469084794 -493829536 -493829536 -232190041 -232190041 -232190041 -232190041 -1674340339 -1674340339 -1674340339 -1674340339 1775667486 1775667486 -948676228 -948676228 -1338732474 -1338732474 178482033 178482033 178482033 178482033 918842470 918842470 -917350225 -917350225 -917350225 -917350225 390937317 390937317 390937317 390937317 -418860175 -418860175 -418860175 -418860175 670291604 670291604 1859681623 1859681623 1859681623 1859681623 1241175627 1241175627 1241175627 1241175627 -487119163 -487119163 -487119163 -487119163 1315739433 1315739433 1315739433 1315739433 -1938999974 -1938999974 1786883066 1786883066 -55935255 -55935255 -55935255 -55935255 -2146202839 -2146202839 -2146202839 -2146202839 -1866983349 -1866983349 -1866983349 -1866983349 607596425 607596425 607596425 607596425 -425048532 -425048532 -893024018 -893024018 -1873731147 -1873731147 -1873731147 -1873731147 159865104 159865104 411876340 411876340 2056892401 2056892401 2056892401 2056892401 -1642734171 -1642734171 -1642734171 -1642734171 -1996442747 -1996442747 -1996442747 -1996442747 257760945 257760945 257760945 257760945 -1631204972 -1631204972 -1802192500 -1802192500 -432548865 -432548865 -432548865 -432548865 -551129560 -551129560 -1319261042 -1319261042 -859679032 -859679032 -1510933233 -1510933233 -1510933233 -1510933233 286273879 286273879 286273879 286273879 1481537722 1481537722 258343568 258343568 -265464733 -265464733 -265464733 -265464733 -432502583 -432502583 -432502583 -432502583 -1967815281 -1967815281 -1967815281 -1967815281 -1530408968 -1530408968 967560929 967560929 967560929 967560929 -1426106865 -1426106865 -1426106865 -1426106865 190104374 190104374 430136711 430136711 430136711 430136711 -1803607012 -1803607012 -1520512970 -1520512970 5018725 5018725 5018725 5018725 183526573 183526573 183526573 183526573 -1040862600 -1040862600
0
repos/unordered/test
repos/unordered/test/legacy_archives/multiset_int_100.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="19"> <container class_id="0" tracking_level="0" version="0"> <count>152</count> <bucket_count>193</bucket_count> <item_version>0</item_version> <item>1775667486</item> <item>-948676228</item> <item>-1108026676</item> <item>-1866983349</item> <item>-1866983349</item> <item>258343568</item> <item>-1068590402</item> <item>-432548865</item> <item>-432548865</item> <item>177811234</item> <item>5018725</item> <item>5018725</item> <item>190104374</item> <item>1315739433</item> <item>1315739433</item> <item>-1995826660</item> <item>-305386173</item> <item>-305386173</item> <item>287343763</item> <item>287343763</item> <item>1241175627</item> <item>1241175627</item> <item>109292002</item> <item>1021729225</item> <item>1021729225</item> <item>-1426106865</item> <item>-1426106865</item> <item>918842470</item> <item>-1338732474</item> <item>669358715</item> <item>669358715</item> <item>183526573</item> <item>183526573</item> <item>-938475945</item> <item>-938475945</item> <item>-1694006096</item> <item>1630722604</item> <item>-1933552094</item> <item>257760945</item> <item>257760945</item> <item>-1510933233</item> <item>-1510933233</item> <item>390937317</item> <item>390937317</item> <item>259868705</item> <item>259868705</item> <item>-38527737</item> <item>-38527737</item> <item>-551129560</item> <item>1832705803</item> <item>1832705803</item> <item>607596425</item> <item>607596425</item> <item>-1520512970</item> <item>-1674340339</item> <item>-1674340339</item> <item>-1873731147</item> <item>-1873731147</item> <item>1421489007</item> <item>1421489007</item> <item>-501526237</item> <item>-501526237</item> <item>-1877186230</item> <item>-218590163</item> <item>-218590163</item> <item>647803737</item> <item>647803737</item> <item>-859679032</item> <item>967560929</item> <item>967560929</item> <item>-815473344</item> <item>-487119163</item> <item>-487119163</item> <item>-1546216506</item> <item>1859681623</item> <item>1859681623</item> <item>-1040862600</item> <item>-893024018</item> <item>-1319261042</item> <item>-1252588227</item> <item>-1252588227</item> <item>-1785808236</item> <item>1198739057</item> <item>1198739057</item> <item>-1469084794</item> <item>473010817</item> <item>473010817</item> <item>1481537722</item> <item>2138619156</item> <item>-1039351567</item> <item>-1039351567</item> <item>-493829536</item> <item>411876340</item> <item>-364116164</item> <item>776215953</item> <item>776215953</item> <item>1568788209</item> <item>1568788209</item> <item>-1631204972</item> <item>601527218</item> <item>286273879</item> <item>286273879</item> <item>-232190041</item> <item>-232190041</item> <item>2075478837</item> <item>2075478837</item> <item>-1168265900</item> <item>581989062</item> <item>178482033</item> <item>178482033</item> <item>1354395138</item> <item>-1530408968</item> <item>-414767254</item> <item>1970368353</item> <item>1970368353</item> <item>-1967815281</item> <item>-1967815281</item> <item>941660988</item> <item>1786883066</item> <item>670291604</item> <item>-1803607012</item> <item>1829132124</item> <item>-432502583</item> <item>-432502583</item> <item>-1642734171</item> <item>-1642734171</item> <item>-425048532</item> <item>2097663454</item> <item>-1938999974</item> <item>-1802192500</item> <item>2056892401</item> <item>2056892401</item> <item>-917350225</item> <item>-917350225</item> <item>-55935255</item> <item>-55935255</item> <item>-418860175</item> <item>-418860175</item> <item>-2146202839</item> <item>-2146202839</item> <item>310524955</item> <item>310524955</item> <item>159865104</item> <item>-265464733</item> <item>-265464733</item> <item>-1996442747</item> <item>-1996442747</item> <item>430136711</item> <item>430136711</item> <item>-743509129</item> <item>-743509129</item> <item>167237906</item> </container> <values> <count>152</count> <item_version>0</item_version> <item>-938475945</item> <item>-938475945</item> <item>-1694006096</item> <item>-1785808236</item> <item>1021729225</item> <item>1021729225</item> <item>1832705803</item> <item>1832705803</item> <item>581989062</item> <item>1354395138</item> <item>2097663454</item> <item>-743509129</item> <item>-743509129</item> <item>-1168265900</item> <item>-414767254</item> <item>-1039351567</item> <item>-1039351567</item> <item>167237906</item> <item>177811234</item> <item>-364116164</item> <item>-1933552094</item> <item>259868705</item> <item>259868705</item> <item>-501526237</item> <item>-501526237</item> <item>776215953</item> <item>776215953</item> <item>1630722604</item> <item>310524955</item> <item>310524955</item> <item>473010817</item> <item>473010817</item> <item>1970368353</item> <item>1970368353</item> <item>647803737</item> <item>647803737</item> <item>-1252588227</item> <item>-1252588227</item> <item>669358715</item> <item>669358715</item> <item>2075478837</item> <item>2075478837</item> <item>-1995826660</item> <item>109292002</item> <item>1421489007</item> <item>1421489007</item> <item>287343763</item> <item>287343763</item> <item>-1108026676</item> <item>1829132124</item> <item>-1546216506</item> <item>941660988</item> <item>-305386173</item> <item>-305386173</item> <item>-815473344</item> <item>-1877186230</item> <item>601527218</item> <item>-38527737</item> <item>-38527737</item> <item>-1068590402</item> <item>1568788209</item> <item>1568788209</item> <item>1198739057</item> <item>1198739057</item> <item>2138619156</item> <item>-218590163</item> <item>-218590163</item> <item>-1469084794</item> <item>-493829536</item> <item>-232190041</item> <item>-232190041</item> <item>-1674340339</item> <item>-1674340339</item> <item>1775667486</item> <item>-948676228</item> <item>-1338732474</item> <item>178482033</item> <item>178482033</item> <item>918842470</item> <item>-917350225</item> <item>-917350225</item> <item>390937317</item> <item>390937317</item> <item>-418860175</item> <item>-418860175</item> <item>670291604</item> <item>1859681623</item> <item>1859681623</item> <item>1241175627</item> <item>1241175627</item> <item>-487119163</item> <item>-487119163</item> <item>1315739433</item> <item>1315739433</item> <item>-1938999974</item> <item>1786883066</item> <item>-55935255</item> <item>-55935255</item> <item>-2146202839</item> <item>-2146202839</item> <item>-1866983349</item> <item>-1866983349</item> <item>607596425</item> <item>607596425</item> <item>-425048532</item> <item>-893024018</item> <item>-1873731147</item> <item>-1873731147</item> <item>159865104</item> <item>411876340</item> <item>2056892401</item> <item>2056892401</item> <item>-1642734171</item> <item>-1642734171</item> <item>-1996442747</item> <item>-1996442747</item> <item>257760945</item> <item>257760945</item> <item>-1631204972</item> <item>-1802192500</item> <item>-432548865</item> <item>-432548865</item> <item>-551129560</item> <item>-1319261042</item> <item>-859679032</item> <item>-1510933233</item> <item>-1510933233</item> <item>286273879</item> <item>286273879</item> <item>1481537722</item> <item>258343568</item> <item>-265464733</item> <item>-265464733</item> <item>-432502583</item> <item>-432502583</item> <item>-1967815281</item> <item>-1967815281</item> <item>-1530408968</item> <item>967560929</item> <item>967560929</item> <item>-1426106865</item> <item>-1426106865</item> <item>190104374</item> <item>430136711</item> <item>430136711</item> <item>-1803607012</item> <item>-1520512970</item> <item>5018725</item> <item>5018725</item> <item>183526573</item> <item>183526573</item> <item>-1040862600</item> </values> </boost_serialization>
0
repos/unordered/test
repos/unordered/test/legacy_archives/map_string_0.txt
22 serialization::archive 19 0 0 0 0 0 0 0 0 0
0
repos/unordered/test
repos/unordered/test/legacy_archives/map_string_0.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="19"> <container class_id="0" tracking_level="0" version="0"> <count>0</count> <bucket_count>0</bucket_count> <item_version>0</item_version> </container> <values class_id="1" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </values> </boost_serialization>
0
repos/unordered/test
repos/unordered/test/legacy_archives/multimap_int_0.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="19"> <container class_id="0" tracking_level="0" version="0"> <count>0</count> <bucket_count>0</bucket_count> <item_version>0</item_version> </container> <values class_id="1" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </values> </boost_serialization>
0
repos/unordered/test
repos/unordered/test/legacy_archives/multiset_string_10.txt
22 serialization::archive 19 0 0 14 29 0 10 3551458167 10 3551458167 10 2600961200 10 3126701396 9 581989062 10 1832705803 10 1832705803 10 3356491351 10 3356491351 10 1021729225 10 1021729225 10 2097663454 10 1354395138 10 2509159060 0 0 14 0 10 3356491351 10 3356491351 10 2600961200 10 2509159060 10 1021729225 10 1021729225 10 1832705803 10 1832705803 9 581989062 10 1354395138 10 2097663454 10 3551458167 10 3551458167 10 3126701396
0
repos/unordered/test
repos/unordered/test/legacy_archives/multimap_int_0.txt
22 serialization::archive 19 0 0 0 0 0 0 0 0 0
0
repos/unordered/test
repos/unordered/test/legacy_archives/multimap_int_100.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="19"> <container class_id="0" tracking_level="0" version="0"> <count>152</count> <bucket_count>193</bucket_count> <item_version>0</item_version> <item class_id="1" tracking_level="0" version="0"> <first>1775667486</first> <second>1775667486</second> </item> <item> <first>-948676228</first> <second>-948676228</second> </item> <item> <first>-1108026676</first> <second>-1108026676</second> </item> <item> <first>-1866983349</first> <second>-1866983349</second> </item> <item> <first>-1866983349</first> <second>-1866983349</second> </item> <item> <first>258343568</first> <second>258343568</second> </item> <item> <first>-1068590402</first> <second>-1068590402</second> </item> <item> <first>-432548865</first> <second>-432548865</second> </item> <item> <first>-432548865</first> <second>-432548865</second> </item> <item> <first>177811234</first> <second>177811234</second> </item> <item> <first>5018725</first> <second>5018725</second> </item> <item> <first>5018725</first> <second>5018725</second> </item> <item> <first>190104374</first> <second>190104374</second> </item> <item> <first>1315739433</first> <second>1315739433</second> </item> <item> <first>1315739433</first> <second>1315739433</second> </item> <item> <first>-1995826660</first> <second>-1995826660</second> </item> <item> <first>-305386173</first> <second>-305386173</second> </item> <item> <first>-305386173</first> <second>-305386173</second> </item> <item> <first>287343763</first> <second>287343763</second> </item> <item> <first>287343763</first> <second>287343763</second> </item> <item> <first>1241175627</first> <second>1241175627</second> </item> <item> <first>1241175627</first> <second>1241175627</second> </item> <item> <first>109292002</first> <second>109292002</second> </item> <item> <first>1021729225</first> <second>1021729225</second> </item> <item> <first>1021729225</first> <second>1021729225</second> </item> <item> <first>-1426106865</first> <second>-1426106865</second> </item> <item> <first>-1426106865</first> <second>-1426106865</second> </item> <item> <first>918842470</first> <second>918842470</second> </item> <item> <first>-1338732474</first> <second>-1338732474</second> </item> <item> <first>669358715</first> <second>669358715</second> </item> <item> <first>669358715</first> <second>669358715</second> </item> <item> <first>183526573</first> <second>183526573</second> </item> <item> <first>183526573</first> <second>183526573</second> </item> <item> <first>-938475945</first> <second>-938475945</second> </item> <item> <first>-938475945</first> <second>-938475945</second> </item> <item> <first>-1694006096</first> <second>-1694006096</second> </item> <item> <first>1630722604</first> <second>1630722604</second> </item> <item> <first>-1933552094</first> <second>-1933552094</second> </item> <item> <first>257760945</first> <second>257760945</second> </item> <item> <first>257760945</first> <second>257760945</second> </item> <item> <first>-1510933233</first> <second>-1510933233</second> </item> <item> <first>-1510933233</first> <second>-1510933233</second> </item> <item> <first>390937317</first> <second>390937317</second> </item> <item> <first>390937317</first> <second>390937317</second> </item> <item> <first>259868705</first> <second>259868705</second> </item> <item> <first>259868705</first> <second>259868705</second> </item> <item> <first>-38527737</first> <second>-38527737</second> </item> <item> <first>-38527737</first> <second>-38527737</second> </item> <item> <first>-551129560</first> <second>-551129560</second> </item> <item> <first>1832705803</first> <second>1832705803</second> </item> <item> <first>1832705803</first> <second>1832705803</second> </item> <item> <first>607596425</first> <second>607596425</second> </item> <item> <first>607596425</first> <second>607596425</second> </item> <item> <first>-1520512970</first> <second>-1520512970</second> </item> <item> <first>-1674340339</first> <second>-1674340339</second> </item> <item> <first>-1674340339</first> <second>-1674340339</second> </item> <item> <first>-1873731147</first> <second>-1873731147</second> </item> <item> <first>-1873731147</first> <second>-1873731147</second> </item> <item> <first>1421489007</first> <second>1421489007</second> </item> <item> <first>1421489007</first> <second>1421489007</second> </item> <item> <first>-501526237</first> <second>-501526237</second> </item> <item> <first>-501526237</first> <second>-501526237</second> </item> <item> <first>-1877186230</first> <second>-1877186230</second> </item> <item> <first>-218590163</first> <second>-218590163</second> </item> <item> <first>-218590163</first> <second>-218590163</second> </item> <item> <first>647803737</first> <second>647803737</second> </item> <item> <first>647803737</first> <second>647803737</second> </item> <item> <first>-859679032</first> <second>-859679032</second> </item> <item> <first>967560929</first> <second>967560929</second> </item> <item> <first>967560929</first> <second>967560929</second> </item> <item> <first>-815473344</first> <second>-815473344</second> </item> <item> <first>-487119163</first> <second>-487119163</second> </item> <item> <first>-487119163</first> <second>-487119163</second> </item> <item> <first>-1546216506</first> <second>-1546216506</second> </item> <item> <first>1859681623</first> <second>1859681623</second> </item> <item> <first>1859681623</first> <second>1859681623</second> </item> <item> <first>-1040862600</first> <second>-1040862600</second> </item> <item> <first>-893024018</first> <second>-893024018</second> </item> <item> <first>-1319261042</first> <second>-1319261042</second> </item> <item> <first>-1252588227</first> <second>-1252588227</second> </item> <item> <first>-1252588227</first> <second>-1252588227</second> </item> <item> <first>-1785808236</first> <second>-1785808236</second> </item> <item> <first>1198739057</first> <second>1198739057</second> </item> <item> <first>1198739057</first> <second>1198739057</second> </item> <item> <first>-1469084794</first> <second>-1469084794</second> </item> <item> <first>473010817</first> <second>473010817</second> </item> <item> <first>473010817</first> <second>473010817</second> </item> <item> <first>1481537722</first> <second>1481537722</second> </item> <item> <first>2138619156</first> <second>2138619156</second> </item> <item> <first>-1039351567</first> <second>-1039351567</second> </item> <item> <first>-1039351567</first> <second>-1039351567</second> </item> <item> <first>-493829536</first> <second>-493829536</second> </item> <item> <first>411876340</first> <second>411876340</second> </item> <item> <first>-364116164</first> <second>-364116164</second> </item> <item> <first>776215953</first> <second>776215953</second> </item> <item> <first>776215953</first> <second>776215953</second> </item> <item> <first>1568788209</first> <second>1568788209</second> </item> <item> <first>1568788209</first> <second>1568788209</second> </item> <item> <first>-1631204972</first> <second>-1631204972</second> </item> <item> <first>601527218</first> <second>601527218</second> </item> <item> <first>286273879</first> <second>286273879</second> </item> <item> <first>286273879</first> <second>286273879</second> </item> <item> <first>-232190041</first> <second>-232190041</second> </item> <item> <first>-232190041</first> <second>-232190041</second> </item> <item> <first>2075478837</first> <second>2075478837</second> </item> <item> <first>2075478837</first> <second>2075478837</second> </item> <item> <first>-1168265900</first> <second>-1168265900</second> </item> <item> <first>581989062</first> <second>581989062</second> </item> <item> <first>178482033</first> <second>178482033</second> </item> <item> <first>178482033</first> <second>178482033</second> </item> <item> <first>1354395138</first> <second>1354395138</second> </item> <item> <first>-1530408968</first> <second>-1530408968</second> </item> <item> <first>-414767254</first> <second>-414767254</second> </item> <item> <first>1970368353</first> <second>1970368353</second> </item> <item> <first>1970368353</first> <second>1970368353</second> </item> <item> <first>-1967815281</first> <second>-1967815281</second> </item> <item> <first>-1967815281</first> <second>-1967815281</second> </item> <item> <first>941660988</first> <second>941660988</second> </item> <item> <first>1786883066</first> <second>1786883066</second> </item> <item> <first>670291604</first> <second>670291604</second> </item> <item> <first>-1803607012</first> <second>-1803607012</second> </item> <item> <first>1829132124</first> <second>1829132124</second> </item> <item> <first>-432502583</first> <second>-432502583</second> </item> <item> <first>-432502583</first> <second>-432502583</second> </item> <item> <first>-1642734171</first> <second>-1642734171</second> </item> <item> <first>-1642734171</first> <second>-1642734171</second> </item> <item> <first>-425048532</first> <second>-425048532</second> </item> <item> <first>2097663454</first> <second>2097663454</second> </item> <item> <first>-1938999974</first> <second>-1938999974</second> </item> <item> <first>-1802192500</first> <second>-1802192500</second> </item> <item> <first>2056892401</first> <second>2056892401</second> </item> <item> <first>2056892401</first> <second>2056892401</second> </item> <item> <first>-917350225</first> <second>-917350225</second> </item> <item> <first>-917350225</first> <second>-917350225</second> </item> <item> <first>-55935255</first> <second>-55935255</second> </item> <item> <first>-55935255</first> <second>-55935255</second> </item> <item> <first>-418860175</first> <second>-418860175</second> </item> <item> <first>-418860175</first> <second>-418860175</second> </item> <item> <first>-2146202839</first> <second>-2146202839</second> </item> <item> <first>-2146202839</first> <second>-2146202839</second> </item> <item> <first>310524955</first> <second>310524955</second> </item> <item> <first>310524955</first> <second>310524955</second> </item> <item> <first>159865104</first> <second>159865104</second> </item> <item> <first>-265464733</first> <second>-265464733</second> </item> <item> <first>-265464733</first> <second>-265464733</second> </item> <item> <first>-1996442747</first> <second>-1996442747</second> </item> <item> <first>-1996442747</first> <second>-1996442747</second> </item> <item> <first>430136711</first> <second>430136711</second> </item> <item> <first>430136711</first> <second>430136711</second> </item> <item> <first>-743509129</first> <second>-743509129</second> </item> <item> <first>-743509129</first> <second>-743509129</second> </item> <item> <first>167237906</first> <second>167237906</second> </item> </container> <values class_id="2" tracking_level="0" version="0"> <count>152</count> <item_version>0</item_version> <item class_id="3" tracking_level="0" version="0"> <first>-938475945</first> <second>-938475945</second> </item> <item> <first>-938475945</first> <second>-938475945</second> </item> <item> <first>-1694006096</first> <second>-1694006096</second> </item> <item> <first>-1785808236</first> <second>-1785808236</second> </item> <item> <first>1021729225</first> <second>1021729225</second> </item> <item> <first>1021729225</first> <second>1021729225</second> </item> <item> <first>1832705803</first> <second>1832705803</second> </item> <item> <first>1832705803</first> <second>1832705803</second> </item> <item> <first>581989062</first> <second>581989062</second> </item> <item> <first>1354395138</first> <second>1354395138</second> </item> <item> <first>2097663454</first> <second>2097663454</second> </item> <item> <first>-743509129</first> <second>-743509129</second> </item> <item> <first>-743509129</first> <second>-743509129</second> </item> <item> <first>-1168265900</first> <second>-1168265900</second> </item> <item> <first>-414767254</first> <second>-414767254</second> </item> <item> <first>-1039351567</first> <second>-1039351567</second> </item> <item> <first>-1039351567</first> <second>-1039351567</second> </item> <item> <first>167237906</first> <second>167237906</second> </item> <item> <first>177811234</first> <second>177811234</second> </item> <item> <first>-364116164</first> <second>-364116164</second> </item> <item> <first>-1933552094</first> <second>-1933552094</second> </item> <item> <first>259868705</first> <second>259868705</second> </item> <item> <first>259868705</first> <second>259868705</second> </item> <item> <first>-501526237</first> <second>-501526237</second> </item> <item> <first>-501526237</first> <second>-501526237</second> </item> <item> <first>776215953</first> <second>776215953</second> </item> <item> <first>776215953</first> <second>776215953</second> </item> <item> <first>1630722604</first> <second>1630722604</second> </item> <item> <first>310524955</first> <second>310524955</second> </item> <item> <first>310524955</first> <second>310524955</second> </item> <item> <first>473010817</first> <second>473010817</second> </item> <item> <first>473010817</first> <second>473010817</second> </item> <item> <first>1970368353</first> <second>1970368353</second> </item> <item> <first>1970368353</first> <second>1970368353</second> </item> <item> <first>647803737</first> <second>647803737</second> </item> <item> <first>647803737</first> <second>647803737</second> </item> <item> <first>-1252588227</first> <second>-1252588227</second> </item> <item> <first>-1252588227</first> <second>-1252588227</second> </item> <item> <first>669358715</first> <second>669358715</second> </item> <item> <first>669358715</first> <second>669358715</second> </item> <item> <first>2075478837</first> <second>2075478837</second> </item> <item> <first>2075478837</first> <second>2075478837</second> </item> <item> <first>-1995826660</first> <second>-1995826660</second> </item> <item> <first>109292002</first> <second>109292002</second> </item> <item> <first>1421489007</first> <second>1421489007</second> </item> <item> <first>1421489007</first> <second>1421489007</second> </item> <item> <first>287343763</first> <second>287343763</second> </item> <item> <first>287343763</first> <second>287343763</second> </item> <item> <first>-1108026676</first> <second>-1108026676</second> </item> <item> <first>1829132124</first> <second>1829132124</second> </item> <item> <first>-1546216506</first> <second>-1546216506</second> </item> <item> <first>941660988</first> <second>941660988</second> </item> <item> <first>-305386173</first> <second>-305386173</second> </item> <item> <first>-305386173</first> <second>-305386173</second> </item> <item> <first>-815473344</first> <second>-815473344</second> </item> <item> <first>-1877186230</first> <second>-1877186230</second> </item> <item> <first>601527218</first> <second>601527218</second> </item> <item> <first>-38527737</first> <second>-38527737</second> </item> <item> <first>-38527737</first> <second>-38527737</second> </item> <item> <first>-1068590402</first> <second>-1068590402</second> </item> <item> <first>1568788209</first> <second>1568788209</second> </item> <item> <first>1568788209</first> <second>1568788209</second> </item> <item> <first>1198739057</first> <second>1198739057</second> </item> <item> <first>1198739057</first> <second>1198739057</second> </item> <item> <first>2138619156</first> <second>2138619156</second> </item> <item> <first>-218590163</first> <second>-218590163</second> </item> <item> <first>-218590163</first> <second>-218590163</second> </item> <item> <first>-1469084794</first> <second>-1469084794</second> </item> <item> <first>-493829536</first> <second>-493829536</second> </item> <item> <first>-232190041</first> <second>-232190041</second> </item> <item> <first>-232190041</first> <second>-232190041</second> </item> <item> <first>-1674340339</first> <second>-1674340339</second> </item> <item> <first>-1674340339</first> <second>-1674340339</second> </item> <item> <first>1775667486</first> <second>1775667486</second> </item> <item> <first>-948676228</first> <second>-948676228</second> </item> <item> <first>-1338732474</first> <second>-1338732474</second> </item> <item> <first>178482033</first> <second>178482033</second> </item> <item> <first>178482033</first> <second>178482033</second> </item> <item> <first>918842470</first> <second>918842470</second> </item> <item> <first>-917350225</first> <second>-917350225</second> </item> <item> <first>-917350225</first> <second>-917350225</second> </item> <item> <first>390937317</first> <second>390937317</second> </item> <item> <first>390937317</first> <second>390937317</second> </item> <item> <first>-418860175</first> <second>-418860175</second> </item> <item> <first>-418860175</first> <second>-418860175</second> </item> <item> <first>670291604</first> <second>670291604</second> </item> <item> <first>1859681623</first> <second>1859681623</second> </item> <item> <first>1859681623</first> <second>1859681623</second> </item> <item> <first>1241175627</first> <second>1241175627</second> </item> <item> <first>1241175627</first> <second>1241175627</second> </item> <item> <first>-487119163</first> <second>-487119163</second> </item> <item> <first>-487119163</first> <second>-487119163</second> </item> <item> <first>1315739433</first> <second>1315739433</second> </item> <item> <first>1315739433</first> <second>1315739433</second> </item> <item> <first>-1938999974</first> <second>-1938999974</second> </item> <item> <first>1786883066</first> <second>1786883066</second> </item> <item> <first>-55935255</first> <second>-55935255</second> </item> <item> <first>-55935255</first> <second>-55935255</second> </item> <item> <first>-2146202839</first> <second>-2146202839</second> </item> <item> <first>-2146202839</first> <second>-2146202839</second> </item> <item> <first>-1866983349</first> <second>-1866983349</second> </item> <item> <first>-1866983349</first> <second>-1866983349</second> </item> <item> <first>607596425</first> <second>607596425</second> </item> <item> <first>607596425</first> <second>607596425</second> </item> <item> <first>-425048532</first> <second>-425048532</second> </item> <item> <first>-893024018</first> <second>-893024018</second> </item> <item> <first>-1873731147</first> <second>-1873731147</second> </item> <item> <first>-1873731147</first> <second>-1873731147</second> </item> <item> <first>159865104</first> <second>159865104</second> </item> <item> <first>411876340</first> <second>411876340</second> </item> <item> <first>2056892401</first> <second>2056892401</second> </item> <item> <first>2056892401</first> <second>2056892401</second> </item> <item> <first>-1642734171</first> <second>-1642734171</second> </item> <item> <first>-1642734171</first> <second>-1642734171</second> </item> <item> <first>-1996442747</first> <second>-1996442747</second> </item> <item> <first>-1996442747</first> <second>-1996442747</second> </item> <item> <first>257760945</first> <second>257760945</second> </item> <item> <first>257760945</first> <second>257760945</second> </item> <item> <first>-1631204972</first> <second>-1631204972</second> </item> <item> <first>-1802192500</first> <second>-1802192500</second> </item> <item> <first>-432548865</first> <second>-432548865</second> </item> <item> <first>-432548865</first> <second>-432548865</second> </item> <item> <first>-551129560</first> <second>-551129560</second> </item> <item> <first>-1319261042</first> <second>-1319261042</second> </item> <item> <first>-859679032</first> <second>-859679032</second> </item> <item> <first>-1510933233</first> <second>-1510933233</second> </item> <item> <first>-1510933233</first> <second>-1510933233</second> </item> <item> <first>286273879</first> <second>286273879</second> </item> <item> <first>286273879</first> <second>286273879</second> </item> <item> <first>1481537722</first> <second>1481537722</second> </item> <item> <first>258343568</first> <second>258343568</second> </item> <item> <first>-265464733</first> <second>-265464733</second> </item> <item> <first>-265464733</first> <second>-265464733</second> </item> <item> <first>-432502583</first> <second>-432502583</second> </item> <item> <first>-432502583</first> <second>-432502583</second> </item> <item> <first>-1967815281</first> <second>-1967815281</second> </item> <item> <first>-1967815281</first> <second>-1967815281</second> </item> <item> <first>-1530408968</first> <second>-1530408968</second> </item> <item> <first>967560929</first> <second>967560929</second> </item> <item> <first>967560929</first> <second>967560929</second> </item> <item> <first>-1426106865</first> <second>-1426106865</second> </item> <item> <first>-1426106865</first> <second>-1426106865</second> </item> <item> <first>190104374</first> <second>190104374</second> </item> <item> <first>430136711</first> <second>430136711</second> </item> <item> <first>430136711</first> <second>430136711</second> </item> <item> <first>-1803607012</first> <second>-1803607012</second> </item> <item> <first>-1520512970</first> <second>-1520512970</second> </item> <item> <first>5018725</first> <second>5018725</second> </item> <item> <first>5018725</first> <second>5018725</second> </item> <item> <first>183526573</first> <second>183526573</second> </item> <item> <first>183526573</first> <second>183526573</second> </item> <item> <first>-1040862600</first> <second>-1040862600</second> </item> </values> </boost_serialization>
0
repos/unordered/test
repos/unordered/test/legacy_archives/set_int_10.txt
22 serialization::archive 19 0 0 10 13 0 2097663454 -1785808236 -938475945 1354395138 581989062 -1694006096 1832705803 -743509129 1021729225 -1168265900 14 0 -938475945 -938475945 -1694006096 -1785808236 1021729225 1021729225 1832705803 1832705803 581989062 1354395138 2097663454 -743509129 -743509129 -1168265900
0
repos/unordered/test
repos/unordered/test/legacy_archives/set_string_10.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="19"> <container class_id="0" tracking_level="0" version="0"> <count>10</count> <bucket_count>13</bucket_count> <item_version>0</item_version> <item>1832705803</item> <item>2097663454</item> <item>3551458167</item> <item>2509159060</item> <item>2600961200</item> <item>581989062</item> <item>1021729225</item> <item>3126701396</item> <item>1354395138</item> <item>3356491351</item> </container> <values class_id="1" tracking_level="0" version="0"> <count>14</count> <item_version>0</item_version> <item>3356491351</item> <item>3356491351</item> <item>2600961200</item> <item>2509159060</item> <item>1021729225</item> <item>1021729225</item> <item>1832705803</item> <item>1832705803</item> <item>581989062</item> <item>1354395138</item> <item>2097663454</item> <item>3551458167</item> <item>3551458167</item> <item>3126701396</item> </values> </boost_serialization>
0
repos/unordered/test
repos/unordered/test/legacy_archives/map_string_10.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="19"> <container class_id="0" tracking_level="0" version="0"> <count>10</count> <bucket_count>13</bucket_count> <item_version>0</item_version> <item class_id="1" tracking_level="0" version="0"> <first>1832705803</first> <second>1832705803</second> </item> <item> <first>2097663454</first> <second>2097663454</second> </item> <item> <first>3551458167</first> <second>3551458167</second> </item> <item> <first>2509159060</first> <second>2509159060</second> </item> <item> <first>2600961200</first> <second>2600961200</second> </item> <item> <first>581989062</first> <second>581989062</second> </item> <item> <first>1021729225</first> <second>1021729225</second> </item> <item> <first>3126701396</first> <second>3126701396</second> </item> <item> <first>1354395138</first> <second>1354395138</second> </item> <item> <first>3356491351</first> <second>3356491351</second> </item> </container> <values class_id="2" tracking_level="0" version="0"> <count>14</count> <item_version>0</item_version> <item class_id="3" tracking_level="0" version="0"> <first>3356491351</first> <second>3356491351</second> </item> <item> <first>3356491351</first> <second>3356491351</second> </item> <item> <first>2600961200</first> <second>2600961200</second> </item> <item> <first>2509159060</first> <second>2509159060</second> </item> <item> <first>1021729225</first> <second>1021729225</second> </item> <item> <first>1021729225</first> <second>1021729225</second> </item> <item> <first>1832705803</first> <second>1832705803</second> </item> <item> <first>1832705803</first> <second>1832705803</second> </item> <item> <first>581989062</first> <second>581989062</second> </item> <item> <first>1354395138</first> <second>1354395138</second> </item> <item> <first>2097663454</first> <second>2097663454</second> </item> <item> <first>3551458167</first> <second>3551458167</second> </item> <item> <first>3551458167</first> <second>3551458167</second> </item> <item> <first>3126701396</first> <second>3126701396</second> </item> </values> </boost_serialization>
0
repos/unordered/test
repos/unordered/test/legacy_archives/generate_legacy_archives.cpp
/* Copyright 2023 Joaquin M Lopez Munoz. * 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 https://www.boost.org/libs/unordered for library home page. */ /* This program has been used to generate archives of Boost.Unordered * containers with Boost 1.83, when serialization support was provided * externally to Boost.Unordered in * boost/serialization/boost_unordered_(map|set).hpp. Beginning with the * release of native Boost.Unordered serialization capabilities in Boost * 1.84, these archives are used to test backwards loading compatibility * as enabled by BOOST_UNORDERED_ENABLE_SERIALIZATION_COMPATIBILITY_V0. */ #include <boost/archive/text_oarchive.hpp> #include <boost/archive/xml_oarchive.hpp> #include <boost/serialization/boost_unordered_map.hpp> #include <boost/serialization/boost_unordered_set.hpp> #include <boost/serialization/string.hpp> #include <boost/serialization/vector.hpp> #include <boost/version.hpp> #include <fstream> #include <random> template<typename Value=unsigned int> struct random_generator { Value operator()() { return static_cast<Value>(dist(gen)); } std::uniform_int_distribution<unsigned int> dist; std::mt19937 gen{231}; }; template<> struct random_generator<std::string> { std::string operator()() { return std::to_string(rng()); } random_generator<> rng; }; template<> struct random_generator<const std::string>:random_generator<std::string>{}; template<typename T,typename Q> struct random_generator<std::pair<T,Q>> { std::pair<T,Q> operator()() { return {rngt(),rngq()}; } random_generator<T> rngt; random_generator<Q> rngq; }; template<typename T> struct non_const { typedef T type; }; template<typename T> struct non_const<const T> { using type=typename non_const<T>::type; }; template<typename T, typename Q> struct non_const<std::pair<T, Q>> { using type=std::pair< typename non_const<T>::type, typename non_const<Q>::type>; }; template<typename Container,typename Archive> void generate_legacy_archive(const char* filename,std::size_t n) { using value_type=typename Container::value_type; using vector=std::vector<typename non_const<value_type>::type>; Container c; vector v; random_generator<value_type> rng; std::uniform_int_distribution<> repeat(0,1); std::mt19937 gen{231}; for(std::size_t i=0;i<n;++i){ value_type x=rng(); c.insert(x); v.push_back(x); if(repeat(gen)){ c.insert(x); v.push_back(x); } } std::ofstream ofs(filename); Archive oa(ofs); oa<<boost::serialization::make_nvp("container",c); oa<<boost::serialization::make_nvp("values",v); } int main() { static_assert(BOOST_VERSION<=108300,"to be used with Boost <1.84."); generate_legacy_archive< boost::unordered_map<int,int>,boost::archive::text_oarchive >("map_int_0.txt",0); generate_legacy_archive< boost::unordered_map<int,int>,boost::archive::text_oarchive >("map_int_10.txt",10); generate_legacy_archive< boost::unordered_map<int,int>,boost::archive::text_oarchive >("map_int_100.txt",100); generate_legacy_archive< boost::unordered_map<std::string,std::string>,boost::archive::text_oarchive >("map_string_0.txt",0); generate_legacy_archive< boost::unordered_map<std::string,std::string>,boost::archive::text_oarchive >("map_string_10.txt",10); generate_legacy_archive<boost::unordered_map< std::string,std::string>,boost::archive::text_oarchive >("map_string_100.txt",100); generate_legacy_archive< boost::unordered_multimap<int,int>,boost::archive::text_oarchive >("multimap_int_0.txt",0); generate_legacy_archive< boost::unordered_multimap<int,int>,boost::archive::text_oarchive >("multimap_int_10.txt",10); generate_legacy_archive< boost::unordered_multimap<int,int>,boost::archive::text_oarchive >("multimap_int_100.txt",100); generate_legacy_archive< boost::unordered_multimap<std::string,std::string>,boost::archive::text_oarchive >("multimap_string_0.txt",0); generate_legacy_archive< boost::unordered_multimap<std::string,std::string>,boost::archive::text_oarchive >("multimap_string_10.txt",10); generate_legacy_archive< boost::unordered_multimap<std::string,std::string>,boost::archive::text_oarchive >("multimap_string_100.txt",100); generate_legacy_archive< boost::unordered_set<int>,boost::archive::text_oarchive >("set_int_0.txt",0); generate_legacy_archive< boost::unordered_set<int>,boost::archive::text_oarchive >("set_int_10.txt",10); generate_legacy_archive< boost::unordered_set<int>,boost::archive::text_oarchive >("set_int_100.txt",100); generate_legacy_archive< boost::unordered_set<std::string>,boost::archive::text_oarchive >("set_string_0.txt",0); generate_legacy_archive< boost::unordered_set<std::string>,boost::archive::text_oarchive >("set_string_10.txt",10); generate_legacy_archive< boost::unordered_set<std::string>,boost::archive::text_oarchive >("set_string_100.txt",100); generate_legacy_archive< boost::unordered_multiset<int>,boost::archive::text_oarchive >("multiset_int_0.txt",0); generate_legacy_archive< boost::unordered_multiset<int>,boost::archive::text_oarchive >("multiset_int_10.txt",10); generate_legacy_archive< boost::unordered_multiset<int>,boost::archive::text_oarchive >("multiset_int_100.txt",100); generate_legacy_archive< boost::unordered_multiset<std::string>,boost::archive::text_oarchive >("multiset_string_0.txt",0); generate_legacy_archive< boost::unordered_multiset<std::string>,boost::archive::text_oarchive >("multiset_string_10.txt",10); generate_legacy_archive< boost::unordered_multiset<std::string>,boost::archive::text_oarchive >("multiset_string_100.txt",100); generate_legacy_archive< boost::unordered_map<int,int>,boost::archive::xml_oarchive >("map_int_0.xml",0); generate_legacy_archive< boost::unordered_map<int,int>,boost::archive::xml_oarchive >("map_int_10.xml",10); generate_legacy_archive< boost::unordered_map<int,int>,boost::archive::xml_oarchive >("map_int_100.xml",100); generate_legacy_archive< boost::unordered_map<std::string,std::string>,boost::archive::xml_oarchive >("map_string_0.xml",0); generate_legacy_archive< boost::unordered_map<std::string,std::string>,boost::archive::xml_oarchive >("map_string_10.xml",10); generate_legacy_archive< boost::unordered_map<std::string,std::string>,boost::archive::xml_oarchive >("map_string_100.xml",100); generate_legacy_archive< boost::unordered_multimap<int,int>,boost::archive::xml_oarchive >("multimap_int_0.xml",0); generate_legacy_archive< boost::unordered_multimap<int,int>,boost::archive::xml_oarchive >("multimap_int_10.xml",10); generate_legacy_archive< boost::unordered_multimap<int,int>,boost::archive::xml_oarchive >("multimap_int_100.xml",100); generate_legacy_archive< boost::unordered_multimap<std::string,std::string>,boost::archive::xml_oarchive >("multimap_string_0.xml",0); generate_legacy_archive< boost::unordered_multimap<std::string,std::string>,boost::archive::xml_oarchive >("multimap_string_10.xml",10); generate_legacy_archive< boost::unordered_multimap<std::string,std::string>,boost::archive::xml_oarchive >("multimap_string_100.xml",100); generate_legacy_archive< boost::unordered_set<int>,boost::archive::xml_oarchive >("set_int_0.xml",0); generate_legacy_archive< boost::unordered_set<int>,boost::archive::xml_oarchive >("set_int_10.xml",10); generate_legacy_archive< boost::unordered_set<int>,boost::archive::xml_oarchive >("set_int_100.xml",100); generate_legacy_archive< boost::unordered_set<std::string>,boost::archive::xml_oarchive >("set_string_0.xml",0); generate_legacy_archive< boost::unordered_set<std::string>,boost::archive::xml_oarchive >("set_string_10.xml",10); generate_legacy_archive< boost::unordered_set<std::string>,boost::archive::xml_oarchive >("set_string_100.xml",100); generate_legacy_archive< boost::unordered_multiset<int>,boost::archive::xml_oarchive >("multiset_int_0.xml",0); generate_legacy_archive< boost::unordered_multiset<int>,boost::archive::xml_oarchive >("multiset_int_10.xml",10); generate_legacy_archive< boost::unordered_multiset<int>,boost::archive::xml_oarchive >("multiset_int_100.xml",100); generate_legacy_archive< boost::unordered_multiset<std::string>,boost::archive::xml_oarchive >("multiset_string_0.xml",0); generate_legacy_archive< boost::unordered_multiset<std::string>,boost::archive::xml_oarchive >("multiset_string_10.xml",10); generate_legacy_archive< boost::unordered_multiset<std::string>,boost::archive::xml_oarchive >("multiset_string_100.xml",100); }
0
repos/unordered/test
repos/unordered/test/legacy_archives/set_string_0.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="19"> <container class_id="0" tracking_level="0" version="0"> <count>0</count> <bucket_count>0</bucket_count> <item_version>0</item_version> </container> <values class_id="1" tracking_level="0" version="0"> <count>0</count> <item_version>0</item_version> </values> </boost_serialization>
0
repos/unordered/test
repos/unordered/test/legacy_archives/multimap_string_10.xml
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <!DOCTYPE boost_serialization> <boost_serialization signature="serialization::archive" version="19"> <container class_id="0" tracking_level="0" version="0"> <count>14</count> <bucket_count>29</bucket_count> <item_version>0</item_version> <item class_id="1" tracking_level="0" version="0"> <first>3551458167</first> <second>3551458167</second> </item> <item> <first>3551458167</first> <second>3551458167</second> </item> <item> <first>2600961200</first> <second>2600961200</second> </item> <item> <first>3126701396</first> <second>3126701396</second> </item> <item> <first>581989062</first> <second>581989062</second> </item> <item> <first>1832705803</first> <second>1832705803</second> </item> <item> <first>1832705803</first> <second>1832705803</second> </item> <item> <first>3356491351</first> <second>3356491351</second> </item> <item> <first>3356491351</first> <second>3356491351</second> </item> <item> <first>1021729225</first> <second>1021729225</second> </item> <item> <first>1021729225</first> <second>1021729225</second> </item> <item> <first>2097663454</first> <second>2097663454</second> </item> <item> <first>1354395138</first> <second>1354395138</second> </item> <item> <first>2509159060</first> <second>2509159060</second> </item> </container> <values class_id="2" tracking_level="0" version="0"> <count>14</count> <item_version>0</item_version> <item class_id="3" tracking_level="0" version="0"> <first>3356491351</first> <second>3356491351</second> </item> <item> <first>3356491351</first> <second>3356491351</second> </item> <item> <first>2600961200</first> <second>2600961200</second> </item> <item> <first>2509159060</first> <second>2509159060</second> </item> <item> <first>1021729225</first> <second>1021729225</second> </item> <item> <first>1021729225</first> <second>1021729225</second> </item> <item> <first>1832705803</first> <second>1832705803</second> </item> <item> <first>1832705803</first> <second>1832705803</second> </item> <item> <first>581989062</first> <second>581989062</second> </item> <item> <first>1354395138</first> <second>1354395138</second> </item> <item> <first>2097663454</first> <second>2097663454</second> </item> <item> <first>3551458167</first> <second>3551458167</second> </item> <item> <first>3551458167</first> <second>3551458167</second> </item> <item> <first>3126701396</first> <second>3126701396</second> </item> </values> </boost_serialization>
0
repos/unordered/test
repos/unordered/test/legacy_archives/multimap_int_10.txt
22 serialization::archive 19 0 0 14 29 0 0 0 -938475945 -938475945 -938475945 -938475945 -1785808236 -1785808236 -1694006096 -1694006096 1021729225 1021729225 1021729225 1021729225 581989062 581989062 -1168265900 -1168265900 2097663454 2097663454 1354395138 1354395138 -743509129 -743509129 -743509129 -743509129 1832705803 1832705803 1832705803 1832705803 0 0 14 0 0 0 -938475945 -938475945 -938475945 -938475945 -1694006096 -1694006096 -1785808236 -1785808236 1021729225 1021729225 1021729225 1021729225 1832705803 1832705803 1832705803 1832705803 581989062 581989062 1354395138 1354395138 2097663454 2097663454 -743509129 -743509129 -743509129 -743509129 -1168265900 -1168265900
0
repos/unordered/test
repos/unordered/test/cmake_subdir_test/CMakeLists.txt
# Copyright 2018, 2019, 2021 Peter Dimov # 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 cmake_minimum_required(VERSION 3.5...3.20) project(cmake_subdir_test LANGUAGES CXX) add_subdirectory(../.. boostorg/unordered) # `boostdep --brief unordered` set(deps # Primary dependencies assert config container_hash core move mp11 predef preprocessor static_assert throw_exception tuple type_traits # Secondary dependencies describe ) foreach(dep IN LISTS deps) add_subdirectory(../../../${dep} boostorg/${dep}) endforeach() add_executable(quick ../quick.cpp) target_link_libraries(quick Boost::unordered Boost::core) enable_testing() add_test(quick quick) add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)
0
repos/unordered/test
repos/unordered/test/helpers/postfix.hpp
// Copyright 2012 Daniel James. // 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) // Include this after the boost headers, but before other test headers. #if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic ignored "-Wfloat-equal" #endif
0
repos/unordered/test
repos/unordered/test/helpers/memory.hpp
// Copyright 2006-2009 Daniel James. // 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) #if !defined(BOOST_UNORDERED_TEST_MEMORY_HEADER) #define BOOST_UNORDERED_TEST_MEMORY_HEADER #include "../helpers/test.hpp" #include <boost/assert.hpp> #include <boost/unordered/detail/implementation.hpp> #include <map> #include <memory> namespace test { namespace detail { struct memory_area { void const* start; void const* end; memory_area(void const* s, void const* e) : start(s), end(e) { BOOST_ASSERT(start != end); } }; struct memory_track { explicit memory_track(int tag = -1) : constructed_(0), tag_(tag) {} int constructed_; int tag_; }; // This is a bit dodgy as it defines overlapping // areas as 'equal', so this isn't a total ordering. // But it is for non-overlapping memory regions - which // is what'll be stored. // // All searches will be for areas entirely contained by // a member of the set - so it should find the area that contains // the region that is searched for. struct memory_area_compare { bool operator()(memory_area const& x, memory_area const& y) const { return x.end <= y.start; } }; struct memory_tracker { typedef std::map<memory_area, memory_track, memory_area_compare, std::allocator<std::pair<memory_area const, memory_track> > > allocated_memory_type; allocated_memory_type allocated_memory; unsigned int count_allocators; unsigned int count_allocations; unsigned int count_constructions; bool tracking_constructions; memory_tracker() : count_allocators(0), count_allocations(0), count_constructions(0), tracking_constructions(true) { } ~memory_tracker() { BOOST_ASSERT(count_allocators == 0); } void allocator_ref() { if (count_allocators == 0) { count_allocations = 0; count_constructions = 0; allocated_memory.clear(); } ++count_allocators; } void allocator_unref() { BOOST_TEST(count_allocators > 0); if (count_allocators > 0) { --count_allocators; if (count_allocators == 0) { bool no_allocations_left = (count_allocations == 0); bool no_constructions_left = (count_constructions == 0); bool allocated_memory_empty = allocated_memory.empty(); // Clearing the data before the checks terminate the // tests. count_allocations = 0; count_constructions = 0; allocated_memory.clear(); BOOST_TEST(no_allocations_left); BOOST_TEST(no_constructions_left); BOOST_TEST(allocated_memory_empty); } } } void track_allocate(void* ptr, std::size_t n, std::size_t size, int tag) { if (n == 0) { BOOST_ERROR("Allocating 0 length array."); } else { ++count_allocations; allocated_memory.insert(std::pair<memory_area const, memory_track>( memory_area(ptr, (char*)ptr + n * size), memory_track(tag))); } } void track_deallocate(void* ptr, std::size_t n, std::size_t size, int tag, bool check_tag_ = true) { allocated_memory_type::iterator pos = allocated_memory.find(memory_area(ptr, (char*)ptr + n * size)); if (pos == allocated_memory.end()) { BOOST_ERROR("Deallocating unknown pointer."); } else { BOOST_TEST(pos->first.start == ptr); BOOST_TEST(pos->first.end == (char*)ptr + n * size); if (check_tag_) BOOST_TEST(pos->second.tag_ == tag); allocated_memory.erase(pos); } BOOST_TEST(count_allocations > 0); if (count_allocations > 0) --count_allocations; } void track_construct(void* /*ptr*/, std::size_t /*size*/, int /*tag*/) { if (tracking_constructions) { ++count_constructions; } } void track_destroy(void* /*ptr*/, std::size_t /*size*/, int /*tag*/) { if (tracking_constructions) { BOOST_TEST(count_constructions > 0); if (count_constructions > 0) --count_constructions; } } }; } namespace detail { // This won't be a problem as I'm only using a single compile unit // in each test (this is actually required by the minimal test // framework). // // boostinspect:nounnamed namespace { test::detail::memory_tracker tracker; } } namespace detail { struct disable_construction_tracking { bool old_value; disable_construction_tracking() : old_value(detail::tracker.tracking_constructions) { test::detail::tracker.tracking_constructions = false; } ~disable_construction_tracking() { test::detail::tracker.tracking_constructions = old_value; } private: disable_construction_tracking(disable_construction_tracking const&); disable_construction_tracking& operator=( disable_construction_tracking const&); }; } } #endif
0
repos/unordered/test
repos/unordered/test/helpers/unordered.hpp
// Copyright 2022 Christian Mazakas // 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) #if !defined(BOOST_UNORDERED_TEST_HELPERS_UNORDERED_HEADER) #define BOOST_UNORDERED_TEST_HELPERS_UNORDERED_HEADER // clang-format off #include "prefix.hpp" #ifdef BOOST_UNORDERED_FOA_TESTS #include <boost/unordered/unordered_flat_set.hpp> #include <boost/unordered/unordered_flat_map.hpp> #include <boost/unordered/unordered_node_map.hpp> #include <boost/unordered/unordered_node_set.hpp> #include <boost/unordered/detail/implementation.hpp> #else #include <boost/unordered_set.hpp> #include <boost/unordered_map.hpp> #endif #include "postfix.hpp" // clang-format on #if defined(BOOST_LIBSTDCXX_VERSION) #if BOOST_LIBSTDCXX_VERSION < 60000 #define BOOST_UNORDERED_NO_INIT_TYPE_TESTS #endif #endif #endif
0
repos/unordered/test
repos/unordered/test/helpers/prefix.hpp
// Copyright 2009 Daniel James. // 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) #if defined(_WIN32_WCE) // The standard windows mobile headers trigger this warning so I disable it // before doing anything else. #pragma warning(disable : 4201) // nonstandard extension used : // nameless struct/union #endif
0
repos/unordered/test
repos/unordered/test/helpers/tracker.hpp
// Copyright 2006-2009 Daniel James. // 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) // This header contains metafunctions/functions to get the equivalent // associative container for an unordered container, and compare the contents. #if !defined(BOOST_UNORDERED_TEST_HELPERS_TRACKER_HEADER) #define BOOST_UNORDERED_TEST_HELPERS_TRACKER_HEADER #include "../objects/fwd.hpp" #include "./equivalent.hpp" #include "./helpers.hpp" #include "./list.hpp" #include "./metafunctions.hpp" #include <algorithm> #include <iterator> #include <map> #include <set> namespace test { template <typename X> struct equals_to_compare { typedef std::less<typename X::first_argument_type> type; }; template <> struct equals_to_compare<test::equal_to> { typedef test::less type; }; template<class T> struct equals_to_compare< std::equal_to<T> > { typedef std::less<T> type; }; template <class X1, class X2> void compare_range(X1 const& x1, X2 const& x2) { typedef test::list<typename X1::value_type> value_list; value_list values1(x1.begin(), x1.end()); value_list values2(x2.begin(), x2.end()); values1.sort(); values2.sort(); BOOST_TEST_ALL_WITH(values1.begin(), values1.end(), values2.begin(), values2.end(), test::equivalent); } template <class X1, class X2, class T> void compare_pairs(X1 const& x1, X2 const& x2, T*) { test::list<T> values1(x1.first, x1.second); test::list<T> values2(x2.first, x2.second); values1.sort(); values2.sort(); BOOST_TEST(values1.size() == values2.size() && test::equal(values1.begin(), values1.end(), values2.begin(), test::equivalent)); } template <typename X, bool is_set = test::is_set<X>::value, bool has_unique_keys = test::has_unique_keys<X>::value> struct ordered_base; template <typename X> struct ordered_base<X, true, true> { typedef std::set<typename X::value_type, typename equals_to_compare<typename X::key_equal>::type> type; }; template <typename X> struct ordered_base<X, true, false> { typedef std::multiset<typename X::value_type, typename equals_to_compare<typename X::key_equal>::type> type; }; template <typename X> struct ordered_base<X, false, true> { typedef std::map<typename X::key_type, typename X::mapped_type, typename equals_to_compare<typename X::key_equal>::type> type; }; template <typename X> struct ordered_base<X, false, false> { typedef std::multimap<typename X::key_type, typename X::mapped_type, typename equals_to_compare<typename X::key_equal>::type> type; }; template <class X> class ordered : public ordered_base<X>::type { typedef typename ordered_base<X>::type base; public: typedef typename base::key_compare key_compare; ordered() : base() {} explicit ordered(key_compare const& kc) : base(kc) {} void compare(X const& x) { compare_range(x, *this); } void compare_key(X const& x, typename X::value_type const& val) { compare_pairs(x.equal_range(get_key<X>(val)), this->equal_range(get_key<X>(val)), (typename X::value_type*)0); } template <class It> void insert_range(It b, It e) { while (b != e) { this->insert(*b); ++b; } } }; template <class Equals> typename equals_to_compare<Equals>::type create_compare(Equals const&) { typename equals_to_compare<Equals>::type x; return x; } template <class X> ordered<X> create_ordered(X const& container) { return ordered<X>(create_compare(container.key_eq())); } template <class X1, class X2> void check_container(X1 const& container, X2 const& values) { ordered<X1> tracker = create_ordered(container); tracker.insert_range(values.begin(), values.end()); tracker.compare(container); } } #endif
0
repos/unordered/test
repos/unordered/test/helpers/random_values.hpp
// Copyright 2005-2009 Daniel James. // 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) #if !defined(BOOST_UNORDERED_TEST_HELPERS_RANDOM_VALUES_HEADER) #define BOOST_UNORDERED_TEST_HELPERS_RANDOM_VALUES_HEADER #include "./generators.hpp" #include "./list.hpp" #include "./metafunctions.hpp" #include <boost/type_traits/conditional.hpp> #include <algorithm> namespace test { template <class X> struct unordered_generator_set { typedef typename X::value_type value_type; random_generator type_; unordered_generator_set(random_generator type) : type_(type) {} template <class T> void fill(T& x, std::size_t len) { value_type* value_ptr = 0; len += x.size(); for (std::size_t i = 0; i < len; ++i) { value_type value = generate(value_ptr, type_); std::size_t count = type_ == generate_collisions ? random_value(5) + 1 : 1; for (std::size_t j = 0; j < count; ++j) { x.push_back(value); } } } }; template <class X> struct unordered_generator_map { typedef typename X::key_type key_type; typedef typename X::mapped_type mapped_type; random_generator type_; unordered_generator_map(random_generator type) : type_(type) {} template <class T> void fill(T& x, std::size_t len) { key_type* key_ptr = 0; mapped_type* mapped_ptr = 0; for (std::size_t i = 0; i < len; ++i) { key_type key = generate(key_ptr, type_); std::size_t count = type_ == generate_collisions ? random_value(5) + 1 : 1; for (std::size_t j = 0; j < count; ++j) { x.push_back(std::pair<key_type const, mapped_type>( key, generate(mapped_ptr, type_))); } } } }; template <class X> struct unordered_generator_base : public boost::conditional<test::is_set<X>::value, test::unordered_generator_set<X>, test::unordered_generator_map<X> > { }; template <class X> struct unordered_generator : public unordered_generator_base<X>::type { typedef typename unordered_generator_base<X>::type base; unordered_generator(random_generator const& type = default_generator) : base(type) { } }; template <class X> struct random_values : public test::list<typename X::value_type> { random_values() {} explicit random_values(std::size_t count, test::random_generator const& generator = test::default_generator) { fill(count, generator); } void fill(std::size_t count, test::random_generator const& generator = test::default_generator) { test::unordered_generator<X> gen(generator); gen.fill(*this, count); } }; } #endif
0
repos/unordered/test
repos/unordered/test/helpers/strong.hpp
// Copyright 2005-2009 Daniel James. // 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) #if !defined(BOOST_UNORDERED_TEST_HELPERS_STRONG_HEADER) #define BOOST_UNORDERED_TEST_HELPERS_STRONG_HEADER #include "./equivalent.hpp" #include "./exception_test.hpp" #include "./list.hpp" #include <boost/config.hpp> #include <iterator> namespace test { template <class X> class strong { typedef test::list<typename X::value_type> values_type; values_type values_; unsigned int allocations_; public: void store(X const& x, unsigned int allocations = 0) { DISABLE_EXCEPTIONS; values_.clear(); values_.insert(x.cbegin(), x.cend()); allocations_ = allocations; } void test(X const& x, unsigned int allocations = 0) const { if (!(x.size() == values_.size() && test::equal(x.cbegin(), x.cend(), values_.begin(), test::equivalent))) BOOST_ERROR("Strong exception safety failure."); if (allocations != allocations_) BOOST_ERROR("Strong exception failure: extra allocations."); } }; } #endif
0
repos/unordered/test
repos/unordered/test/helpers/helpers.hpp
// Copyright 2006-2009 Daniel James. // 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) #if !defined(BOOST_UNORDERED_TEST_HELPERS_HEADER) #define BOOST_UNORDERED_TEST_HELPERS_HEADER #include <iterator> namespace test { template <class Container> struct get_key_impl { typedef typename Container::key_type key_type; static key_type const& get_key(key_type const& x) { return x; } template <class T> static key_type const& get_key(std::pair<key_type, T> const& x, char = 0) { return x.first; } template <class T> static key_type const& get_key( std::pair<key_type const, T> const& x, unsigned char = 0) { return x.first; } }; template <class Container, class T> inline typename Container::key_type const& get_key(T const& x) { return get_key_impl<Container>::get_key(x); } // test::next // // Increments an iterator by 1 or a given value. // Like boost::next, but simpler. // Mainly because boost::next uses an MPL file // which causes warnings. template <typename Iterator> Iterator next(Iterator it) { return ++it; } template <typename Iterator, typename IntType> Iterator next(Iterator it, IntType x) { std::advance(it, static_cast<typename std::iterator_traits<Iterator>::difference_type>(x)); return it; } } #endif
0
repos/unordered/test
repos/unordered/test/helpers/metafunctions.hpp
// Copyright 2005-2009 Daniel James. // 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) #if !defined(BOOST_UNORDERED_TEST_HELPERS_METAFUNCTIONS_HEADER) #define BOOST_UNORDERED_TEST_HELPERS_METAFUNCTIONS_HEADER #include <boost/config.hpp> #include <boost/type_traits/is_same.hpp> #include <boost/type_traits/declval.hpp> namespace test { template <class Container> struct is_set : public boost::is_same<typename Container::key_type, typename Container::value_type> { }; template <class Container> struct has_unique_keys { static char flip(typename Container::iterator const&); static long flip(std::pair<typename Container::iterator, bool> const&); BOOST_STATIC_CONSTANT(bool, value = sizeof(long) == sizeof(flip( (boost::declval<Container*>()) ->insert( boost::declval<typename Container::value_type const&>())))); }; } #endif
0
repos/unordered/test
repos/unordered/test/helpers/list.hpp
// Copyright 2008-2009 Daniel James. // 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) // Gratuitous single linked list. // // Sadly some STL implementations aren't up to scratch and I need a simple // cross-platform container. So here it is. #if !defined(UNORDERED_TEST_LIST_HEADER) #define UNORDERED_TEST_LIST_HEADER #include <boost/limits.hpp> #include <functional> #include <iterator> namespace test { template <typename It1, typename It2> bool equal(It1 begin, It1 end, It2 compare) { for (; begin != end; ++begin, ++compare) if (*begin != *compare) return false; return true; } template <typename It1, typename It2, typename Pred> bool equal(It1 begin, It1 end, It2 compare, Pred predicate) { for (; begin != end; ++begin, ++compare) if (!predicate(*begin, *compare)) return false; return true; } template <typename T> class list; namespace test_detail { template <typename T> class list_node; template <typename T> class list_data; template <typename T> class list_iterator; template <typename T> class list_const_iterator; template <typename T> class list_node { list_node(list_node const&); list_node& operator=(list_node const&); public: T value_; list_node* next_; list_node(T const& v) : value_(v), next_(0) {} list_node(T const& v, list_node* n) : value_(v), next_(n) {} }; template <typename T> class list_data { public: typedef list_node<T> node; typedef unsigned int size_type; node* first_; node** last_ptr_; size_type size_; list_data() : first_(0), last_ptr_(&first_), size_(0) {} ~list_data() { while (first_) { node* tmp = first_; first_ = first_->next_; delete tmp; } } private: list_data(list_data const&); list_data& operator=(list_data const&); }; template <typename T> class list_iterator { friend class list_const_iterator<T>; friend class test::list<T>; typedef list_node<T> node; typedef list_const_iterator<T> const_iterator; node* ptr_; public: typedef T value_type; typedef T* pointer; typedef T& reference; typedef int difference_type; typedef std::forward_iterator_tag iterator_category; list_iterator() : ptr_(0) {} explicit list_iterator(node* x) : ptr_(x) {} T& operator*() const { return ptr_->value_; } T* operator->() const { return &ptr_->value_; } list_iterator& operator++() { ptr_ = ptr_->next_; return *this; } list_iterator operator++(int) { list_iterator tmp = *this; ptr_ = ptr_->next_; return tmp; } bool operator==(list_iterator y) const { return ptr_ == y.ptr_; } bool operator!=(list_iterator y) const { return ptr_ != y.ptr_; } bool operator==(const_iterator y) const { return ptr_ == y.ptr_; } bool operator!=(const_iterator y) const { return ptr_ != y.ptr_; } }; template <typename T> class list_const_iterator { friend class list_iterator<T>; friend class test::list<T>; typedef list_node<T> node; typedef list_iterator<T> iterator; typedef list_const_iterator<T> const_iterator; node* ptr_; public: typedef T value_type; typedef T const* pointer; typedef T const& reference; typedef int difference_type; typedef std::forward_iterator_tag iterator_category; list_const_iterator() : ptr_(0) {} list_const_iterator(list_iterator<T> const& x) : ptr_(x.ptr_) {} T const& operator*() const { return ptr_->value_; } T const* operator->() const { return &ptr_->value_; } list_const_iterator& operator++() { ptr_ = ptr_->next_; return *this; } list_const_iterator operator++(int) { list_const_iterator tmp = *this; ptr_ = ptr_->next_; return tmp; } bool operator==(const_iterator y) const { return ptr_ == y.ptr_; } bool operator!=(const_iterator y) const { return ptr_ != y.ptr_; } }; } template <typename T> class list { typedef test::test_detail::list_data<T> data; typedef test::test_detail::list_node<T> node; data data_; public: typedef T value_type; typedef value_type& reference; typedef value_type const& const_reference; typedef unsigned int size_type; typedef test::test_detail::list_iterator<T> iterator; typedef test::test_detail::list_const_iterator<T> const_iterator; list() : data_() {} list(list const& other) : data_() { insert(other.begin(), other.end()); } template <class InputIterator> list(InputIterator i, InputIterator j) : data_() { insert(i, j); } list& operator=(list const& other) { clear(); insert(other.begin(), other.end()); return *this; } iterator begin() { return iterator(data_.first_); } iterator end() { return iterator(); } const_iterator begin() const { return iterator(data_.first_); } const_iterator end() const { return iterator(); } const_iterator cbegin() const { return iterator(data_.first_); } const_iterator cend() const { return iterator(); } template <class InputIterator> void insert(InputIterator i, InputIterator j) { for (; i != j; ++i) push_back(*i); } void push_front(value_type const& v) { data_.first_ = new node(v, data_.first_); if (!data_.size_) data_.last_ptr_ = &(*data_.last_ptr_)->next_; ++data_.size_; } void push_back(value_type const& v) { *data_.last_ptr_ = new node(v); data_.last_ptr_ = &(*data_.last_ptr_)->next_; ++data_.size_; } void clear() { while (data_.first_) { node* tmp = data_.first_; data_.first_ = data_.first_->next_; --data_.size_; delete tmp; } data_.last_ptr_ = &data_.first_; } void erase(const_iterator i, const_iterator j) { node** ptr = &data_.first_; while (*ptr != i.ptr_) { ptr = &(*ptr)->next_; } while (*ptr != j.ptr_) { node* to_delete = *ptr; *ptr = (*ptr)->next_; --data_.size_; delete to_delete; } if (!*ptr) data_.last_ptr_ = ptr; } bool empty() const { return !data_.size_; } size_type size() const { return data_.size_; } void sort() { sort(std::less<T>()); } template <typename Less> void sort(Less less = Less()) { if (!empty()) merge_sort( &data_.first_, (std::numeric_limits<size_type>::max)(), less); } bool operator==(list const& y) const { return size() == y.size() && test::equal(begin(), end(), y.begin()); } bool operator!=(list const& y) const { return !(*this == y); } private: template <typename Less> node** merge_sort(node** l, size_type recurse_limit, Less less) { node** ptr = &(*l)->next_; for (size_type count = 0; count < recurse_limit && *ptr; ++count) { ptr = merge_adjacent_ranges(l, ptr, merge_sort(ptr, count, less), less); } return ptr; } template <typename Less> node** merge_adjacent_ranges( node** first, node** second, node** third, Less less) { for (;;) { for (;;) { if (first == second) return third; if (less((*second)->value_, (*first)->value_)) break; first = &(*first)->next_; } swap_adjacent_ranges(first, second, third); first = &(*first)->next_; // Since the two ranges we just swapped, the order is now: // first...third...second for (;;) { if (first == third) return second; if (!less((*first)->value_, (*third)->value_)) break; first = &(*first)->next_; } swap_adjacent_ranges(first, third, second); first = &(*first)->next_; } } void swap_adjacent_ranges(node** first, node** second, node** third) { node* tmp = *first; *first = *second; *second = *third; *third = tmp; if (!*second) data_.last_ptr_ = second; } }; } #endif
0
repos/unordered/test
repos/unordered/test/helpers/fwd.hpp
// Copyright 2006-2009 Daniel James. // 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) #if !defined(BOOST_UNORDERED_TEST_HELPERS_FWD_HEADER) #define BOOST_UNORDERED_TEST_HELPERS_FWD_HEADER #include <string> namespace test { typedef enum { default_generator, generate_collisions, limited_range, sequential } random_generator; int generate(int const*, random_generator); char generate(char const*, random_generator); signed char generate(signed char const*, random_generator); std::string generate(std::string const*, random_generator); float generate(float const*, random_generator); struct base_type { } base; struct derived_type : base_type { } derived; } #endif
0
repos/unordered/test
repos/unordered/test/helpers/input_iterator.hpp
// Copyright 2005-2010 Daniel James. // 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) #if !defined(BOOST_UNORDERED_TEST_HELPERS_INPUT_ITERATOR_HEADER) #define BOOST_UNORDERED_TEST_HELPERS_INPUT_ITERATOR_HEADER #include <boost/config.hpp> #include <iterator> namespace test { template <class Iterator> struct proxy { typedef typename Iterator::value_type value_type; explicit proxy(value_type const& v) : v_(v) {} proxy(proxy const& x) : v_(x.v_) {} operator value_type const&() const { return v_; } value_type v_; private: proxy& operator=(proxy const&); }; template <class Iterator> struct input_iterator_adaptor { typedef typename std::iterator_traits<Iterator>::value_type value_type; typedef typename std::iterator_traits<Iterator>::pointer pointer; typedef proxy<Iterator> reference; typedef std::ptrdiff_t difference_type; typedef std::input_iterator_tag iterator_category; input_iterator_adaptor() : base_() {} explicit input_iterator_adaptor(Iterator& it) : base_(&it) {} proxy<Iterator> operator*() const { return proxy<Iterator>(**base_); } value_type* operator->() const { return &**base_; } input_iterator_adaptor& operator++() { ++*base_; return *this; } // input_iterator_adaptor operator++(int) { //} bool operator==(input_iterator_adaptor const& x) const { return *base_ == *x.base_; } bool operator!=(input_iterator_adaptor const& x) const { return *base_ != *x.base_; } private: Iterator* base_; }; template <class Iterator> input_iterator_adaptor<Iterator> input_iterator(Iterator& it) { return input_iterator_adaptor<Iterator>(it); } template <class Iterator> struct copy_iterator_adaptor { typedef typename std::iterator_traits<Iterator>::value_type value_type; typedef typename std::iterator_traits<Iterator>::difference_type difference_type; typedef typename std::iterator_traits<Iterator>::iterator_category iterator_category; typedef typename std::iterator_traits<Iterator>::pointer pointer; typedef proxy<Iterator> reference; copy_iterator_adaptor() : base_() {} explicit copy_iterator_adaptor(Iterator const& it) : base_(it) {} value_type operator*() const { return *base_; } value_type* operator->() const { return &*base_; } value_type operator[](difference_type d) { return base_[d]; } copy_iterator_adaptor& operator++() { ++base_; return *this; } copy_iterator_adaptor operator++(int) { copy_iterator_adaptor tmp(*this); ++base_; return tmp; } copy_iterator_adaptor& operator--() { --base_; return *this; } copy_iterator_adaptor operator--(int) { copy_iterator_adaptor tmp(*this); --base_; return tmp; } copy_iterator_adaptor operator+=(difference_type x) { base_ += x; return *this; } copy_iterator_adaptor operator-=(difference_type x) { base_ -= x; return *this; } copy_iterator_adaptor operator+(difference_type n) { return copy_iterator_adaptor(base_ + n); } copy_iterator_adaptor operator-(difference_type n) { return copy_iterator_adaptor(base_ - n); } friend copy_iterator_adaptor operator+( difference_type n, copy_iterator_adaptor x) { return x + n; } difference_type operator-(copy_iterator_adaptor const& other) { return base_ - other.base_; } bool operator==(copy_iterator_adaptor const& x) const { return base_ == x.base_; } bool operator!=(copy_iterator_adaptor const& x) const { return base_ != x.base_; } bool operator<(copy_iterator_adaptor const& x) const { return base_ < x.base_; } bool operator>(copy_iterator_adaptor const& x) const { return base_ > x.base_; } bool operator<=(copy_iterator_adaptor const& x) const { return base_ <= x.base_; } bool operator>=(copy_iterator_adaptor const& x) const { return base_ >= x.base_; } private: Iterator base_; }; template <class Iterator> copy_iterator_adaptor<Iterator> copy_iterator(Iterator const& it) { return copy_iterator_adaptor<Iterator>(it); } } #endif
0
repos/unordered/test
repos/unordered/test/helpers/equivalent.hpp
// Copyright 2005-2009 Daniel James. // 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) #if !defined(BOOST_UNORDERED_TESTS_EQUIVALENT_HEADER) #define BOOST_UNORDERED_TESTS_EQUIVALENT_HEADER #include "./fwd.hpp" #include "./list.hpp" #include "./metafunctions.hpp" #include <algorithm> #include <boost/core/lightweight_test.hpp> #include <boost/unordered_map.hpp> #include <boost/unordered_set.hpp> namespace test { template <class T1, class T2> bool equivalent_impl(T1 const& x, T2 const& y, base_type) { return x == y; } template <class T> bool equivalent_impl( boost::hash<T> const&, boost::hash<T> const&, derived_type) { return true; } template <class T> bool equivalent_impl( std::equal_to<T> const&, std::equal_to<T> const&, derived_type) { return true; } template <class T1, class T2, class T3, class T4> bool equivalent_impl( std::pair<T1, T2> const& x1, std::pair<T3, T4> const& x2, derived_type) { return equivalent_impl(x1.first, x2.first, derived) && equivalent_impl(x1.second, x2.second, derived); } struct equivalent_type { equivalent_type() {} template <class T1, class T2> bool operator()(T1 const& x, T2 const& y) const { return equivalent_impl(x, y, derived); } }; const equivalent_type equivalent; template <class Container> class unordered_equivalence_tester { typename Container::size_type size_; typename Container::hasher hasher_; typename Container::key_equal key_equal_; float max_load_factor_; typedef test::list<typename Container::value_type> value_list; value_list values_; public: unordered_equivalence_tester(Container const& x) : size_(x.size()), hasher_(x.hash_function()), key_equal_(x.key_eq()), max_load_factor_(x.max_load_factor()), values_(x.begin(), x.end()) { values_.sort(); } bool operator()(Container const& x) const { if (!((size_ == x.size()) && (test::equivalent(hasher_, x.hash_function())) && (test::equivalent(key_equal_, x.key_eq())) && (max_load_factor_ == x.max_load_factor()) && (values_.size() == x.size()))) return false; value_list copy(x.begin(), x.end()); copy.sort(); return values_ == copy; } private: unordered_equivalence_tester(); }; } #endif
0
repos/unordered/test
repos/unordered/test/helpers/generators.hpp
// Copyright 2005-2009 Daniel James. // 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) // This uses std::rand to generate random values for tests. // Which is not good as different platforms will be running different tests. // It would be much better to use Boost.Random, but it doesn't // support all the compilers that I want to test on. #if !defined(BOOST_UNORDERED_TEST_HELPERS_GENERATORS_HEADER) #define BOOST_UNORDERED_TEST_HELPERS_GENERATORS_HEADER #include "./fwd.hpp" #include <boost/assert.hpp> #include <boost/type_traits/add_const.hpp> #include <climits> #include <cstdlib> #include <stdexcept> #include <string> #include <utility> namespace test { struct seed_t { seed_t(unsigned int x) { using namespace std; srand(x); } }; std::size_t random_value(std::size_t max) { using namespace std; return static_cast<std::size_t>(rand()) % max; } static int origin = 0; void reset_sequence() { origin = 0; } inline int generate(int const*, random_generator g) { if (g == sequential) { BOOST_ASSERT_MSG( origin < INT_MAX, "test::reset_sequence() should be invoked"); return origin++; } using namespace std; int value = rand(); if (g == limited_range) { value = value % 100; } return value; } inline char generate(char const*, random_generator) { using namespace std; return static_cast<char>((rand() >> 1) % (128 - 32) + 32); } inline signed char generate(signed char const*, random_generator) { using namespace std; return static_cast<signed char>(rand()); } inline std::string generate(std::string const*, random_generator g) { using namespace std; char* char_ptr = 0; std::string result; if (g == limited_range) { std::size_t length = test::random_value(2) + 2; char const* strings[] = {"'vZh(3~ms", "%m", "_Y%U", "N'Y", "4,J_J"}; for (std::size_t i = 0; i < length; ++i) { result += strings[random_value(sizeof(strings) / sizeof(strings[0]))]; } } else { std::size_t length = test::random_value(10) + 1; for (std::size_t i = 0; i < length; ++i) { result += generate(char_ptr, g); } } return result; } float generate(float const*, random_generator g) { using namespace std; int x = 0; int value = generate(&x, g); return (float)value / (float)RAND_MAX; } } #endif
0
repos/unordered/test
repos/unordered/test/helpers/invariants.hpp
// Copyright 2006-2009 Daniel James. // Copyright 2022 Christian Mazakas. // 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) // This header contains metafunctions/functions to get the equivalent // associative container for an unordered container, and compare the contents. #if !defined(BOOST_UNORDERED_TEST_HELPERS_INVARIANT_HEADER) #define BOOST_UNORDERED_TEST_HELPERS_INVARIANT_HEADER #include "./helpers.hpp" #include "./metafunctions.hpp" #include <cmath> #include <set> #if defined(BOOST_MSVC) #pragma warning(push) #pragma warning(disable : 4127) // conditional expression is constant #pragma warning(disable : 4267) // conversion from 'size_t' to 'unsigned int', // possible loss of data #endif namespace test { template <class X> void check_equivalent_keys(X const& x1) { typename X::key_equal eq = x1.key_eq(); typedef typename X::key_type key_type; std::set<key_type, std::less<key_type> > found_; typename X::const_iterator it = x1.begin(), end = x1.end(); typename X::size_type size = 0; while (it != end) { // First test that the current key has not occurred before, required // to test either that keys are unique or that equivalent keys are // adjacent. (6.3.1/6) key_type key = get_key<X>(*it); if (!found_.insert(key).second) BOOST_ERROR("Elements with equivalent keys aren't adjacent."); // Iterate over equivalent keys, counting them. unsigned int count = 0; do { ++it; ++count; ++size; } while (it != end && eq(get_key<X>(*it), key)); // If the container has unique keys, test that there's only one. // Since the previous test makes sure that all equivalent keys are // adjacent, this is all the equivalent keys - so the test is // sufficient. (6.3.1/6 again). if (test::has_unique_keys<X>::value && count != 1) BOOST_ERROR("Non-unique key."); if (x1.count(key) != count) { BOOST_ERROR("Incorrect output of count."); std::cerr << x1.count(key) << "," << count << "\n"; } #ifndef BOOST_UNORDERED_FOA_TESTS // Check that the keys are in the correct bucket and are // adjacent in the bucket. typename X::size_type bucket = x1.bucket(key); typename X::const_local_iterator lit = x1.begin(bucket), lend = x1.end(bucket); unsigned int count_checked = 0; for (; lit != lend && !eq(get_key<X>(*lit), key); ++lit) { ++count_checked; } if (lit == lend) { BOOST_ERROR("Unable to find element with a local_iterator"); std::cerr << "Checked: " << count_checked << " elements" << std::endl; } else { unsigned int count2 = 0; for (; lit != lend && eq(get_key<X>(*lit), key); ++lit) ++count2; if (count != count2) BOOST_ERROR("Element count doesn't match local_iterator."); for (; lit != lend; ++lit) { if (eq(get_key<X>(*lit), key)) { BOOST_ERROR("Non-adjacent element with equivalent key " "in bucket."); break; } } } #endif } // Check that size matches up. if (x1.size() != size) { BOOST_ERROR("x1.size() doesn't match actual size."); std::cout << x1.size() << "/" << size << std::endl; } // Check the load factor. float load_factor = size == 0 ? 0 : static_cast<float>(size) / static_cast<float>(x1.bucket_count()); using namespace std; if (fabs(x1.load_factor() - load_factor) > x1.load_factor() / 64) BOOST_ERROR("x1.load_factor() doesn't match actual load_factor."); #ifndef BOOST_UNORDERED_FOA_TESTS // Check that size in the buckets matches up. typename X::size_type bucket_size = 0; for (typename X::size_type i = 0; i < x1.bucket_count(); ++i) { for (typename X::const_local_iterator begin2 = x1.begin(i), end2 = x1.end(i); begin2 != end2; ++begin2) { ++bucket_size; } } if (x1.size() != bucket_size) { BOOST_ERROR("x1.size() doesn't match bucket size."); std::cout << x1.size() << "/" << bucket_size << std::endl; } #endif } } #if defined(BOOST_MSVC) #pragma warning(pop) #endif #endif
0
repos/unordered/test
repos/unordered/test/helpers/exception_test.hpp
// Copyright 2006-2009 Daniel James. // 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) #if !defined(BOOST_UNORDERED_EXCEPTION_TEST_HEADER) #define BOOST_UNORDERED_EXCEPTION_TEST_HEADER #include "./count.hpp" #include "./test.hpp" #include <boost/preprocessor/cat.hpp> #include <boost/preprocessor/seq/elem.hpp> #include <boost/preprocessor/seq/for_each_product.hpp> #define UNORDERED_EXCEPTION_TEST_CASE(name, test_func, type) \ UNORDERED_AUTO_TEST (name) { \ test_func<type> fixture; \ ::test::lightweight::exception_safety( \ fixture, BOOST_STRINGIZE(test_func<type>)); \ } #define UNORDERED_EXCEPTION_TEST_CASE_REPEAT(name, test_func, n, type) \ UNORDERED_AUTO_TEST (name) { \ for (unsigned i = 0; i < n; ++i) { \ test_func<type> fixture; \ ::test::lightweight::exception_safety( \ fixture, BOOST_STRINGIZE(test_func<type>)); \ } \ } #define UNORDERED_EPOINT_IMPL ::test::lightweight::epoint #define UNORDERED_EXCEPTION_TEST_POSTFIX RUN_TESTS() #define EXCEPTION_TESTS(test_seq, param_seq) \ BOOST_PP_SEQ_FOR_EACH_PRODUCT(EXCEPTION_TESTS_OP, (test_seq)((1))(param_seq)) #define EXCEPTION_TESTS_REPEAT(n, test_seq, param_seq) \ BOOST_PP_SEQ_FOR_EACH_PRODUCT(EXCEPTION_TESTS_OP, (test_seq)((n))(param_seq)) #define EXCEPTION_TESTS_OP(r, product) \ UNORDERED_EXCEPTION_TEST_CASE_REPEAT( \ BOOST_PP_CAT(BOOST_PP_SEQ_ELEM(0, product), \ BOOST_PP_CAT(_, BOOST_PP_SEQ_ELEM(2, product))), \ BOOST_PP_SEQ_ELEM(0, product), BOOST_PP_SEQ_ELEM(1, product), \ BOOST_PP_SEQ_ELEM(2, product)) #define UNORDERED_SCOPE(scope_name) \ for (::test::scope_guard unordered_test_guard(BOOST_STRINGIZE(scope_name)); \ !unordered_test_guard.dismissed(); unordered_test_guard.dismiss()) #define UNORDERED_EPOINT(name) \ if (::test::exceptions_enabled) { \ UNORDERED_EPOINT_IMPL(name); \ } #define ENABLE_EXCEPTIONS \ ::test::exceptions_enable BOOST_PP_CAT(ENABLE_EXCEPTIONS_, __LINE__)(true) #define DISABLE_EXCEPTIONS \ ::test::exceptions_enable BOOST_PP_CAT(ENABLE_EXCEPTIONS_, __LINE__)(false) namespace test { static char const* scope = ""; bool exceptions_enabled = false; class scope_guard { scope_guard& operator=(scope_guard const&); scope_guard(scope_guard const&); char const* old_scope_; char const* scope_; bool dismissed_; public: scope_guard(char const* name) : old_scope_(scope), scope_(name), dismissed_(false) { scope = scope_; } ~scope_guard() { if (dismissed_) scope = old_scope_; } void dismiss() { dismissed_ = true; } bool dismissed() const { return dismissed_; } }; class exceptions_enable { exceptions_enable& operator=(exceptions_enable const&); exceptions_enable(exceptions_enable const&); bool old_value_; bool released_; public: exceptions_enable(bool enable) : old_value_(exceptions_enabled), released_(false) { exceptions_enabled = enable; } ~exceptions_enable() { if (!released_) { exceptions_enabled = old_value_; released_ = true; } } void release() { if (!released_) { exceptions_enabled = old_value_; released_ = true; } } }; struct exception_base { struct data_type { }; struct strong_type { template <class T> void store(T const&) {} template <class T> void test(T const&) const {} }; data_type init() const { return data_type(); } void check BOOST_PREVENT_MACRO_SUBSTITUTION() const {} }; template <class T, class P1, class P2, class T2> inline void call_ignore_extra_parameters( void (T::*fn)() const, T2 const& obj, P1&, P2&) { (obj.*fn)(); } template <class T, class P1, class P2, class T2> inline void call_ignore_extra_parameters( void (T::*fn)(P1&) const, T2 const& obj, P1& p1, P2&) { (obj.*fn)(p1); } template <class T, class P1, class P2, class T2> inline void call_ignore_extra_parameters( void (T::*fn)(P1&, P2&) const, T2 const& obj, P1& p1, P2& p2) { (obj.*fn)(p1, p2); } template <class T> T const& constant(T const& x) { return x; } template <class Test> class test_runner { Test const& test_; bool exception_in_check_; test_runner(test_runner const&); test_runner& operator=(test_runner const&); public: test_runner(Test const& t) : test_(t), exception_in_check_(false) {} void run() { DISABLE_EXCEPTIONS; test::check_instances check; test::scope = ""; typename Test::data_type x(test_.init()); typename Test::strong_type strong; strong.store(x); try { ENABLE_EXCEPTIONS; call_ignore_extra_parameters<Test, typename Test::data_type, typename Test::strong_type>(&Test::run, test_, x, strong); } catch (...) { try { DISABLE_EXCEPTIONS; call_ignore_extra_parameters<Test, typename Test::data_type const, typename Test::strong_type const>( &Test::check, test_, constant(x), constant(strong)); } catch (...) { exception_in_check_ = true; } throw; } } void end() { if (exception_in_check_) { BOOST_ERROR("Unexcpected exception in test_runner check call."); } } }; // Quick exception testing based on lightweight test namespace lightweight { static int iteration; static int count; struct test_exception { char const* name; test_exception(char const* n) : name(n) {} }; struct test_failure { }; void epoint(char const* name) { ++count; if (count == iteration) { throw test_exception(name); } } template <class Test> void exception_safety(Test const& f, char const* /*name*/) { test_runner<Test> runner(f); iteration = 0; bool success = false; unsigned int failure_count = 0; char const* error_msg = 0; do { int error_count = boost::detail::test_errors(); ++iteration; count = 0; try { runner.run(); success = true; } catch (test_failure) { error_msg = "test_failure caught."; break; } catch (test_exception e) { if (error_count != boost::detail::test_errors()) { BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Iteration: " << iteration << " Error found for epoint: " << e.name << std::endl; } } catch (...) { error_msg = "Unexpected exception."; break; } if (error_count != boost::detail::test_errors()) { ++failure_count; } } while (!success && failure_count < 5); if (error_msg) { BOOST_ERROR(error_msg); } runner.end(); } // // An alternative way to run exception tests. // See merge_exception_tests.cpp for an example. struct exception_looper { bool success; unsigned int failure_count; char const* error_msg; int error_count; exception_looper() : success(false), failure_count(0), error_msg(0) {} void start() { iteration = 0; } bool loop_condition() const { return !error_msg && !success && failure_count < 5; } void start_iteration() { error_count = boost::detail::test_errors(); ++iteration; count = 0; } void successful_run() { success = true; } void test_failure_caught(test_failure const&) { error_msg = "test_failure caught."; } void test_exception_caught(test_exception const& e) { if (error_count != boost::detail::test_errors()) { BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Iteration: " << iteration << " Error found for epoint: " << e.name << std::endl; } } void unexpected_exception_caught() { error_msg = "Unexpected exception."; } void end() { if (error_msg) { BOOST_ERROR(error_msg); } } }; #define EXCEPTION_LOOP(op) \ test::lightweight::exception_looper looper; \ looper.start(); \ while (looper.loop_condition()) { \ looper.start_iteration(); \ try { \ op; \ looper.successful_run(); \ } catch (test::lightweight::test_failure e) { \ looper.test_failure_caught(e); \ } catch (test::lightweight::test_exception e) { \ looper.test_exception_caught(e); \ } catch (...) { \ looper.unexpected_exception_caught(); \ } \ } \ looper.end(); } } #endif
0
repos/unordered/test
repos/unordered/test/helpers/check_return_type.hpp
// Copyright 2005-2009 Daniel James. // 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) #if !defined(BOOST_UNORDERED_TEST_HELPERS_CHECK_RETURN_TYPE_HEADER) #define BOOST_UNORDERED_TEST_HELPERS_CHECK_RETURN_TYPE_HEADER #include <boost/static_assert.hpp> #include <boost/type_traits/is_convertible.hpp> #include <boost/type_traits/is_same.hpp> namespace test { template <class T1> struct check_return_type { template <class T2> static void equals(T2) { BOOST_STATIC_ASSERT((boost::is_same<T1, T2>::value)); } template <class T2> static void equals_ref(T2&) { BOOST_STATIC_ASSERT((boost::is_same<T1, T2>::value)); } template <class T2> static void convertible(T2) { BOOST_STATIC_ASSERT((boost::is_convertible<T2, T1>::value)); } }; } #endif
0
repos/unordered/test
repos/unordered/test/helpers/test.hpp
// Copyright 2006-2009 Daniel James. // 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) #if !defined(BOOST_UNORDERED_TEST_TEST_HEADER) #define BOOST_UNORDERED_TEST_TEST_HEADER #include <boost/core/lightweight_test.hpp> #include <boost/core/lightweight_test_trait.hpp> #include <boost/preprocessor/cat.hpp> #include <boost/preprocessor/stringize.hpp> #include <boost/type_traits/is_nothrow_move_assignable.hpp> #include <boost/type_traits/is_nothrow_move_constructible.hpp> #include <boost/type_traits/is_nothrow_swappable.hpp> #include <boost/type_traits/make_void.hpp> #define UNORDERED_AUTO_TEST(x) \ struct BOOST_PP_CAT(x, _type) : public ::test::registered_test_base \ { \ BOOST_PP_CAT(x, _type) \ () : ::test::registered_test_base(BOOST_PP_STRINGIZE(x)) \ { \ ::test::get_state().add_test(this); \ } \ void run(); \ }; \ BOOST_PP_CAT(x, _type) x; \ void BOOST_PP_CAT(x, _type)::run() #define RUN_TESTS() \ int main(int, char**) \ { \ BOOST_UNORDERED_TEST_COMPILER_INFO() \ ::test::get_state().run_tests(); \ return boost::report_errors(); \ } #define RUN_TESTS_QUIET() \ int main(int, char**) \ { \ BOOST_UNORDERED_TEST_COMPILER_INFO() \ ::test::get_state().run_tests(true); \ return boost::report_errors(); \ } #define UNORDERED_SUB_TEST(x) \ for (int UNORDERED_SUB_TEST_VALUE = ::test::get_state().start_sub_test(x); \ UNORDERED_SUB_TEST_VALUE; \ UNORDERED_SUB_TEST_VALUE = \ ::test::get_state().end_sub_test(x, UNORDERED_SUB_TEST_VALUE)) namespace test { struct registered_test_base { registered_test_base* next; char const* name; explicit registered_test_base(char const* n) : name(n) {} virtual void run() = 0; virtual ~registered_test_base() {} }; struct state { bool is_quiet; registered_test_base* first_test; registered_test_base* last_test; state() : is_quiet(false), first_test(0), last_test(0) {} void add_test(registered_test_base* test) { if (last_test) { last_test->next = test; } else { first_test = test; } last_test = test; } void run_tests(bool quiet = false) { is_quiet = quiet; for (registered_test_base* i = first_test; i; i = i->next) { int error_count = boost::detail::test_errors(); if (!quiet) { BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Running " << i->name << "\n" << std::flush; } i->run(); BOOST_LIGHTWEIGHT_TEST_OSTREAM << std::flush; if (quiet && error_count != boost::detail::test_errors()) { BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Error in: " << i->name << "\n" << std::flush; } } } int start_sub_test(char const* name) { if (!is_quiet) { BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Sub-test: " << name << "\n" << std::flush; } // Add one because it's used as a loop condition. return boost::detail::test_errors() + 1; } int end_sub_test(char const* name, int value) { if (is_quiet && value != boost::detail::test_errors() + 1) { BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Error in sub-test: " << name << "\n" << std::flush; } return 0; } }; // Get the currnet translation unit's test state. static inline state& get_state() { static state instance; return instance; } } // namespace test #if defined(__cplusplus) #define BOOST_UNORDERED_CPLUSPLUS __cplusplus #else #define BOOST_UNORDERED_CPLUSPLUS "(not defined)" #endif #define BOOST_UNORDERED_TEST_COMPILER_INFO() \ { \ BOOST_LIGHTWEIGHT_TEST_OSTREAM \ << "Compiler: " << BOOST_COMPILER << "\n" \ << "Library: " << BOOST_STDLIB << "\n" \ << "__cplusplus: " << BOOST_UNORDERED_CPLUSPLUS << "\n\n" \ << std::flush; \ } #include <boost/preprocessor/cat.hpp> #include <boost/preprocessor/seq/fold_left.hpp> #include <boost/preprocessor/seq/for_each_product.hpp> #include <boost/preprocessor/seq/seq.hpp> #include <boost/preprocessor/seq/to_tuple.hpp> // Run test with every combination of the parameters (a sequence of sequences) #define UNORDERED_TEST(name, parameters) \ BOOST_PP_SEQ_FOR_EACH_PRODUCT(UNORDERED_TEST_OP, ((name))((1))parameters) #define UNORDERED_TEST_REPEAT(name, n, parameters) \ BOOST_PP_SEQ_FOR_EACH_PRODUCT(UNORDERED_TEST_OP, ((name))((n))parameters) #define UNORDERED_TEST_OP(r, product) \ UNORDERED_TEST_OP2(BOOST_PP_SEQ_ELEM(0, product), \ BOOST_PP_SEQ_ELEM(1, product), \ BOOST_PP_SEQ_TAIL(BOOST_PP_SEQ_TAIL(product))) #define UNORDERED_TEST_OP2(name, n, params) \ UNORDERED_AUTO_TEST ( \ BOOST_PP_SEQ_FOLD_LEFT(UNORDERED_TEST_OP_JOIN, name, params)) { \ for (int i = 0; i < n; ++i) \ name BOOST_PP_SEQ_TO_TUPLE(params); \ } #define UNORDERED_TEST_OP_JOIN(s, state, elem) \ BOOST_PP_CAT(state, BOOST_PP_CAT(_, elem)) #define UNORDERED_MULTI_TEST(name, impl, parameters) \ UNORDERED_MULTI_TEST_REPEAT(name, impl, 1, parameters) #define UNORDERED_MULTI_TEST_REPEAT(name, impl, n, parameters) \ UNORDERED_AUTO_TEST (name) { \ BOOST_PP_SEQ_FOR_EACH_PRODUCT( \ UNORDERED_MULTI_TEST_OP, ((impl))((n))parameters) \ } #define UNORDERED_MULTI_TEST_OP(r, product) \ UNORDERED_MULTI_TEST_OP2(BOOST_PP_SEQ_ELEM(0, product), \ BOOST_PP_SEQ_ELEM(1, product), \ BOOST_PP_SEQ_TAIL(BOOST_PP_SEQ_TAIL(product))) // Need to wrap UNORDERED_SUB_TEST in a block to avoid an msvc bug. // https://support.microsoft.com/en-gb/help/315481/bug-too-many-unnested-loops-incorrectly-causes-a-c1061-compiler-error-in-visual-c #define UNORDERED_MULTI_TEST_OP2(name, n, params) \ { \ UNORDERED_SUB_TEST(BOOST_PP_STRINGIZE( \ BOOST_PP_SEQ_FOLD_LEFT(UNORDERED_TEST_OP_JOIN, name, params))) \ { \ for (int i = 0; i < n; ++i) \ name BOOST_PP_SEQ_TO_TUPLE(params); \ } \ } #endif
0
repos/unordered/test
repos/unordered/test/helpers/count.hpp
// Copyright 2008-2009 Daniel James. // Copyright 2024 Braden Ganetsky. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or move at http://www.boost.org/LICENSE_1_0.txt) #if !defined(BOOST_UNORDERED_TEST_HELPERS_COUNT_HEAD) #define BOOST_UNORDERED_TEST_HELPERS_COUNT_HEAD #include <boost/core/lightweight_test.hpp> #include <boost/container_hash/hash.hpp> namespace test { struct object_count { int instances; int constructions; object_count() : instances(0), constructions(0) {} void reset() { *this = object_count(); } void construct() { ++instances; ++constructions; } void destruct() { if (instances == 0) { BOOST_ERROR("Unbalanced constructions."); } else { --instances; } } bool operator==(object_count const& x) const { return instances == x.instances && constructions == x.constructions; } bool operator!=(object_count const& x) const { return !(*this == x); } friend std::ostream& operator<<(std::ostream& out, object_count const& c) { out << "[instances: " << c.instances << ", constructions: " << c.constructions << "]"; return out; } }; // This won't be a problem as I'm only using a single compile unit // in each test (this is actually require by the minimal test // framework). // // boostinspect:nounnamed namespace { object_count global_object_count; } struct counted_object { counted_object() { global_object_count.construct(); } counted_object(counted_object const&) { global_object_count.construct(); } ~counted_object() { global_object_count.destruct(); } }; struct check_instances { int instances_; int constructions_; check_instances() : instances_(global_object_count.instances), constructions_(global_object_count.constructions) { } ~check_instances() { BOOST_TEST(global_object_count.instances == instances_); } int instances() const { return global_object_count.instances - instances_; } int constructions() const { return global_object_count.constructions - constructions_; } }; struct smf_count { int default_constructions = 0; int copy_constructions = 0; int move_constructions = 0; int copy_assignments = 0; int move_assignments = 0; int destructions = 0; #if (BOOST_CXX_VERSION < 201402L) || (defined(_MSC_VER) && _MSC_VER < 1910) smf_count() = default; smf_count(int default_constructions_, int copy_constructions_, int move_constructions_, int copy_assignments_, int move_assignments_, int destructions_) : default_constructions(default_constructions_), copy_constructions(copy_constructions_), move_constructions(move_constructions_), copy_assignments(copy_assignments_), move_assignments(move_assignments_), destructions(destructions_) { } #endif void reset() { *this = smf_count(); } void default_construct() { ++default_constructions; } void copy_construct() { ++copy_constructions; } void move_construct() { ++move_constructions; } void copy_assign() { ++copy_assignments; } void move_assign() { ++move_assignments; } void destruct() { ++destructions; } friend bool operator==(smf_count const& lhs, smf_count const& rhs) { return lhs.default_constructions == rhs.default_constructions && lhs.copy_constructions == rhs.copy_constructions && lhs.move_constructions == rhs.move_constructions && lhs.copy_assignments == rhs.copy_assignments && lhs.move_assignments == rhs.move_assignments && lhs.destructions == rhs.destructions; } friend std::ostream& operator<<(std::ostream& out, smf_count const& c) { out << "[default_constructions: " << c.default_constructions << ", copy_constructions: " << c.copy_constructions << ", move_constructions: " << c.move_constructions << ", copy_assignments: " << c.copy_assignments << ", move_assignments: " << c.move_assignments << ", destructions: " << c.destructions << "]"; return out; } }; template <class Tag> class smf_counted_object { public: static smf_count count; static void reset_count() { count.reset(); } smf_counted_object(int index) : smf_counted_object() { index_ = index; } smf_counted_object() : index_(++running_index) { count.default_construct(); } smf_counted_object(smf_counted_object const& rhs) : index_(rhs.index_) { count.copy_construct(); } smf_counted_object(smf_counted_object&& rhs) noexcept : index_(rhs.index_) { count.move_construct(); } smf_counted_object& operator=(smf_counted_object const& rhs) { count.copy_assign(); index_ = rhs.index_; return *this; } smf_counted_object& operator=(smf_counted_object&& rhs) noexcept { count.move_assign(); index_ = rhs.index_; return *this; } ~smf_counted_object() { count.destruct(); } friend bool operator==( smf_counted_object const& lhs, smf_counted_object const& rhs) { return lhs.index_ == rhs.index_; } friend std::size_t hash_value(smf_counted_object const& x) { return boost::hash<int>()(x.index_); } int index_; private: static int running_index; }; template <class Tag> smf_count smf_counted_object<Tag>::count = {}; template <class Tag> int smf_counted_object<Tag>::running_index = 0; } // namespace test #endif
0
repos/unordered/test
repos/unordered/test/unordered/move_tests.cpp
// Copyright 2008-2009 Daniel James. // Copyright 2022-2023 Christian Mazakas. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or move at http://www.boost.org/LICENSE_1_0.txt) #include "../helpers/unordered.hpp" #include "../helpers/equivalent.hpp" #include "../helpers/invariants.hpp" #include "../helpers/random_values.hpp" #include "../helpers/test.hpp" #include "../helpers/tracker.hpp" #include "../objects/cxx11_allocator.hpp" #include "../objects/test.hpp" #include <boost/core/ignore_unused.hpp> #include <iterator> #if defined(BOOST_MSVC) #pragma warning(disable : 4127) // conditional expression is constant #endif namespace move_tests { test::seed_t initialize_seed(98624); #define BOOST_UNORDERED_TEST_MOVING 1 template <class T> T empty(T*) { return T(); } template <class T> T create(test::random_values<T> const& v, test::object_count& count) { T x(v.begin(), v.end()); count = test::global_object_count; return x; } template <class T> T create(test::random_values<T> const& v, test::object_count& count, typename T::hasher hf, typename T::key_equal eq, typename T::allocator_type al, float mlf) { T x(0, hf, eq, al); x.max_load_factor(mlf); x.insert(v.begin(), v.end()); count = test::global_object_count; return x; } template <class T> void move_construct_tests1(T* ptr, test::random_generator const& generator) { typename T::hasher hf; typename T::key_equal eq; typename T::allocator_type al; { test::check_instances check_; T y(empty(ptr)); BOOST_TEST(y.empty()); BOOST_TEST(test::equivalent(y.hash_function(), hf)); BOOST_TEST(test::equivalent(y.key_eq(), eq)); BOOST_TEST(test::equivalent(y.get_allocator(), al)); #ifdef BOOST_UNORDERED_FOA_TESTS BOOST_TEST(y.max_load_factor() == 0.875); #else BOOST_TEST(y.max_load_factor() == 1.0); #endif test::check_equivalent_keys(y); #ifdef BOOST_UNORDERED_FOA_TESTS using allocator_type = typename T::allocator_type; using value_type = typename boost::allocator_value_type<allocator_type>::type; using pointer = typename boost::allocator_pointer<allocator_type>::type; if (std::is_same<pointer, value_type*>::value) { BOOST_TEST_EQ(test::detail::tracker.count_allocations, 0u); } #else BOOST_TEST_EQ(test::detail::tracker.count_allocations, 0u); #endif } { test::check_instances check_; test::random_values<T> v(1000, generator); test::object_count count; T y(create(v, count)); #if defined(BOOST_HAS_NRVO) BOOST_TEST(count == test::global_object_count); #endif test::check_container(y, v); test::check_equivalent_keys(y); } } template <class T> void move_assign_tests1(T* p, test::random_generator const& generator) { { test::check_instances check_; test::random_values<T> v(500, generator); test::object_count count; T y; y = create(v, count); #if BOOST_UNORDERED_TEST_MOVING && defined(BOOST_HAS_NRVO) BOOST_TEST(count == test::global_object_count); #endif test::check_container(y, v); test::check_equivalent_keys(y); } { test::random_values<T> v; T y; y = empty(p); #ifdef BOOST_UNORDERED_FOA_TESTS using allocator_type = typename T::allocator_type; using value_type = typename boost::allocator_value_type<allocator_type>::type; using pointer = typename boost::allocator_pointer<allocator_type>::type; if (std::is_same<pointer, value_type*>::value) { BOOST_TEST_EQ(test::detail::tracker.count_allocations, 0u); } #else BOOST_TEST_EQ(test::detail::tracker.count_allocations, 0u); #endif test::check_container(y, v); test::check_equivalent_keys(y); } } template <class T> void move_construct_tests2(T*, test::random_generator const& generator) { typename T::hasher hf(1); typename T::key_equal eq(1); typename T::allocator_type al(1); typename T::allocator_type al2(2); test::object_count count; { test::check_instances check_; test::random_values<T> v(500, generator); T y(create(v, count, hf, eq, al, 0.5)); #if defined(BOOST_HAS_NRVO) BOOST_TEST(count == test::global_object_count); #endif test::check_container(y, v); BOOST_TEST(test::equivalent(y.hash_function(), hf)); BOOST_TEST(test::equivalent(y.key_eq(), eq)); BOOST_TEST(test::equivalent(y.get_allocator(), al)); #ifdef BOOST_UNORDERED_FOA_TESTS BOOST_TEST(y.max_load_factor() == 0.875); #else BOOST_TEST(y.max_load_factor() == 0.5); // Not necessarily required. #endif test::check_equivalent_keys(y); } { test::check_instances check_; // TODO: To do this correctly requires the fancy new allocator // stuff. test::random_values<T> v(500, generator); T y(create(v, count, hf, eq, al, 2.0), al2); BOOST_TEST(count != test::global_object_count); test::check_container(y, v); BOOST_TEST(test::equivalent(y.hash_function(), hf)); BOOST_TEST(test::equivalent(y.key_eq(), eq)); BOOST_TEST(test::equivalent(y.get_allocator(), al2)); #ifdef BOOST_UNORDERED_FOA_TESTS BOOST_TEST(y.max_load_factor() == 0.875); #else BOOST_TEST(y.max_load_factor() == 2.0); // Not necessarily required. #endif test::check_equivalent_keys(y); } { test::check_instances check_; test::random_values<T> v(25, generator); T y(create(v, count, hf, eq, al, 1.0), al); BOOST_TEST(count == test::global_object_count); test::check_container(y, v); BOOST_TEST(test::equivalent(y.hash_function(), hf)); BOOST_TEST(test::equivalent(y.key_eq(), eq)); BOOST_TEST(test::equivalent(y.get_allocator(), al)); #ifdef BOOST_UNORDERED_FOA_TESTS BOOST_TEST(y.max_load_factor() == 0.875); #else BOOST_TEST(y.max_load_factor() == 1.0); // Not necessarily required. #endif test::check_equivalent_keys(y); } } template <class T> void move_assign_tests2(T*, test::random_generator const& generator) { typename T::hasher hf(1); typename T::key_equal eq(1); typename T::allocator_type al1(1); typename T::allocator_type al2(2); typedef typename T::allocator_type allocator_type; { test::random_values<T> v(500, generator); test::random_values<T> v2(0, generator); T y(v.begin(), v.end(), 0, hf, eq, al1); test::object_count count; y = create(v2, count, hf, eq, al2, 2.0); BOOST_TEST(y.empty()); test::check_container(y, v2); test::check_equivalent_keys(y); #ifdef BOOST_UNORDERED_FOA_TESTS BOOST_TEST(y.max_load_factor() == 0.875); #else BOOST_TEST(y.max_load_factor() == 2.0); #endif #if defined(BOOST_HAS_NRVO) if (BOOST_UNORDERED_TEST_MOVING ? (bool)allocator_type::is_propagate_on_move : (bool)allocator_type::is_propagate_on_assign) { BOOST_TEST(test::equivalent(y.get_allocator(), al2)); } else { BOOST_TEST(test::equivalent(y.get_allocator(), al1)); } #endif } { test::random_values<T> v(500, generator); test::object_count count; T y(0, hf, eq, al1); y = create(v, count, hf, eq, al2, 0.5); #if defined(BOOST_HAS_NRVO) if (BOOST_UNORDERED_TEST_MOVING && allocator_type::is_propagate_on_move) { BOOST_TEST(count == test::global_object_count); } #endif test::check_container(y, v); test::check_equivalent_keys(y); #ifdef BOOST_UNORDERED_FOA_TESTS BOOST_TEST(y.max_load_factor() == 0.875); #else BOOST_TEST(y.max_load_factor() == 0.5); #endif #if defined(BOOST_HAS_NRVO) if (BOOST_UNORDERED_TEST_MOVING ? (bool)allocator_type::is_propagate_on_move : (bool)allocator_type::is_propagate_on_assign) { BOOST_TEST(test::equivalent(y.get_allocator(), al2)); } else { BOOST_TEST(test::equivalent(y.get_allocator(), al1)); } #endif } { test::random_values<T> v; T y(0, hf, eq, al1); T x(0, hf, eq, al2); x.max_load_factor(0.25); #ifdef BOOST_UNORDERED_FOA_TESTS { using value_type = typename boost::allocator_value_type<allocator_type>::type; using pointer = typename boost::allocator_pointer<allocator_type>::type; if (std::is_same<pointer, value_type*>::value) { BOOST_TEST_EQ(test::detail::tracker.count_allocations, 0u); } } #else BOOST_TEST_EQ(test::detail::tracker.count_allocations, 0u); #endif y = std::move(x); #ifdef BOOST_UNORDERED_FOA_TESTS { using value_type = typename boost::allocator_value_type<allocator_type>::type; using pointer = typename boost::allocator_pointer<allocator_type>::type; if (std::is_same<pointer, value_type*>::value) { BOOST_TEST_EQ(test::detail::tracker.count_allocations, 0u); } } #else BOOST_TEST_EQ(test::detail::tracker.count_allocations, 0u); #endif test::check_container(y, v); test::check_equivalent_keys(y); #ifdef BOOST_UNORDERED_FOA_TESTS BOOST_TEST(y.max_load_factor() == 0.875); #else BOOST_TEST(y.max_load_factor() == 0.25); #endif if (BOOST_UNORDERED_TEST_MOVING ? (bool)allocator_type::is_propagate_on_move : (bool)allocator_type::is_propagate_on_assign) { BOOST_TEST(test::equivalent(y.get_allocator(), al2)); } else { BOOST_TEST(test::equivalent(y.get_allocator(), al1)); } } { test::check_instances check_; test::random_values<T> v(500, generator); T y(0, hf, eq, al1); T x(0, hf, eq, al2); x.max_load_factor(0.25); x.insert(v.begin(), v.end()); test::object_count count = test::global_object_count; y = std::move(x); if (BOOST_UNORDERED_TEST_MOVING && allocator_type::is_propagate_on_move) { BOOST_TEST(count == test::global_object_count); } test::check_container(y, v); test::check_equivalent_keys(y); #ifdef BOOST_UNORDERED_FOA_TESTS BOOST_TEST(y.max_load_factor() == 0.875); #else BOOST_TEST(y.max_load_factor() == 0.25); #endif if (BOOST_UNORDERED_TEST_MOVING ? (bool)allocator_type::is_propagate_on_move : (bool)allocator_type::is_propagate_on_assign) { BOOST_TEST(test::equivalent(y.get_allocator(), al2)); } else { BOOST_TEST(test::equivalent(y.get_allocator(), al1)); } } { test::check_instances check_; test::random_values<T> v1(1000, generator); test::random_values<T> v2(200, generator); T x(0, hf, eq, al2); x.max_load_factor(0.5); x.insert(v2.begin(), v2.end()); test::object_count count1 = test::global_object_count; T y(v1.begin(), v1.end(), 0, hf, eq, al1); y = std::move(x); test::object_count count2 = test::global_object_count; if (BOOST_UNORDERED_TEST_MOVING && allocator_type::is_propagate_on_move) { BOOST_TEST(count1.instances == test::global_object_count.instances); BOOST_TEST( count2.constructions == test::global_object_count.constructions); } test::check_container(y, v2); test::check_equivalent_keys(y); #ifdef BOOST_UNORDERED_FOA_TESTS BOOST_TEST(y.max_load_factor() == 0.875); #else BOOST_TEST(y.max_load_factor() == 0.5); #endif if (BOOST_UNORDERED_TEST_MOVING ? (bool)allocator_type::is_propagate_on_move : (bool)allocator_type::is_propagate_on_assign) { BOOST_TEST(test::equivalent(y.get_allocator(), al2)); } else { BOOST_TEST(test::equivalent(y.get_allocator(), al1)); } } } using test::default_generator; using test::generate_collisions; using test::limited_range; #ifdef BOOST_UNORDERED_FOA_TESTS boost::unordered_flat_map<test::object, test::object, test::hash, test::equal_to, std::allocator<std::pair<test::object const, test::object> > >* test_map_std_alloc; boost::unordered_flat_set<test::object, test::hash, test::equal_to, test::allocator2<test::object> >* test_set; boost::unordered_flat_map<test::object, test::object, test::hash, test::equal_to, test::allocator1<std::pair<test::object const, test::object> > >* test_map; boost::unordered_flat_set<test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::propagate_move> >* test_set_prop_move; boost::unordered_flat_map<test::object, test::object, test::hash, test::equal_to, test::cxx11_allocator<std::pair<test::object const, test::object>, test::propagate_move> >* test_map_prop_move; boost::unordered_flat_set<test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::no_propagate_move> >* test_set_no_prop_move; boost::unordered_flat_map<test::object, test::object, test::hash, test::equal_to, test::cxx11_allocator<std::pair<test::object const, test::object>, test::no_propagate_move> >* test_map_no_prop_move; boost::unordered_node_map<test::object, test::object, test::hash, test::equal_to, std::allocator<std::pair<test::object const, test::object> > >* test_node_map_std_alloc; boost::unordered_node_set<test::object, test::hash, test::equal_to, test::allocator2<test::object> >* test_node_set; boost::unordered_node_map<test::object, test::object, test::hash, test::equal_to, test::allocator1<std::pair<test::object const, test::object> > >* test_node_map; boost::unordered_node_set<test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::propagate_move> >* test_node_set_prop_move; boost::unordered_node_map<test::object, test::object, test::hash, test::equal_to, test::cxx11_allocator<std::pair<test::object const, test::object>, test::propagate_move> >* test_node_map_prop_move; boost::unordered_node_set<test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::no_propagate_move> >* test_node_set_no_prop_move; boost::unordered_node_map<test::object, test::object, test::hash, test::equal_to, test::cxx11_allocator<std::pair<test::object const, test::object>, test::no_propagate_move> >* test_node_map_no_prop_move; // clang-format off UNORDERED_TEST(move_construct_tests1, ((test_map_std_alloc)(test_set)(test_map) (test_set_prop_move)(test_map_prop_move) (test_set_no_prop_move)(test_map_no_prop_move) (test_node_map_std_alloc)(test_node_set)(test_node_map) (test_node_set_prop_move)(test_node_map_prop_move) (test_node_set_no_prop_move)(test_node_map_no_prop_move))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST(move_assign_tests1, ((test_map_std_alloc)(test_set)(test_map) (test_set_prop_move)(test_map_prop_move) (test_set_no_prop_move)(test_map_no_prop_move) (test_node_map_std_alloc)(test_node_set)(test_node_map) (test_node_set_prop_move)(test_node_map_prop_move) (test_node_set_no_prop_move)(test_node_map_no_prop_move))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST(move_construct_tests2, ((test_set)(test_map) (test_set_prop_move)(test_map_prop_move) (test_set_no_prop_move)(test_map_no_prop_move) (test_node_set)(test_node_map) (test_node_set_prop_move)(test_node_map_prop_move) (test_node_set_no_prop_move)(test_node_map_no_prop_move))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST(move_assign_tests2, ((test_set)(test_map) (test_set_prop_move)(test_map_prop_move) (test_set_no_prop_move)(test_map_no_prop_move) (test_node_set)(test_node_map) (test_node_set_prop_move)(test_node_map_prop_move) (test_node_set_no_prop_move)(test_node_map_no_prop_move))( (default_generator)(generate_collisions)(limited_range))) // clang-format on #else boost::unordered_map<test::object, test::object, test::hash, test::equal_to, std::allocator<std::pair<test::object const, test::object> > >* test_map_std_alloc; boost::unordered_set<test::object, test::hash, test::equal_to, test::allocator2<test::object> >* test_set; boost::unordered_multiset<test::object, test::hash, test::equal_to, test::allocator1<test::object> >* test_multiset; boost::unordered_map<test::object, test::object, test::hash, test::equal_to, test::allocator1<std::pair<test::object const, test::object> > >* test_map; boost::unordered_multimap<test::object, test::object, test::hash, test::equal_to, test::allocator2<std::pair<test::object const, test::object> > >* test_multimap; boost::unordered_set<test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::propagate_move> >* test_set_prop_move; boost::unordered_multiset<test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::propagate_move> >* test_multiset_prop_move; boost::unordered_map<test::object, test::object, test::hash, test::equal_to, test::cxx11_allocator<std::pair<test::object const, test::object>, test::propagate_move> >* test_map_prop_move; boost::unordered_multimap<test::object, test::object, test::hash, test::equal_to, test::cxx11_allocator<std::pair<test::object const, test::object>, test::propagate_move> >* test_multimap_prop_move; boost::unordered_set<test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::no_propagate_move> >* test_set_no_prop_move; boost::unordered_multiset<test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::no_propagate_move> >* test_multiset_no_prop_move; boost::unordered_map<test::object, test::object, test::hash, test::equal_to, test::cxx11_allocator<std::pair<test::object const, test::object>, test::no_propagate_move> >* test_map_no_prop_move; boost::unordered_multimap<test::object, test::object, test::hash, test::equal_to, test::cxx11_allocator<std::pair<test::object const, test::object>, test::no_propagate_move> >* test_multimap_no_prop_move; UNORDERED_TEST(move_construct_tests1, ((test_map_std_alloc)(test_set)(test_multiset)(test_map)(test_multimap)(test_set_prop_move)(test_multiset_prop_move)(test_map_prop_move)(test_multimap_prop_move)(test_set_no_prop_move)(test_multiset_no_prop_move)(test_map_no_prop_move)(test_multimap_no_prop_move))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST(move_assign_tests1, ((test_map_std_alloc)(test_set)(test_multiset)(test_map)(test_multimap)(test_set_prop_move)(test_multiset_prop_move)(test_map_prop_move)(test_multimap_prop_move)(test_set_no_prop_move)(test_multiset_no_prop_move)(test_map_no_prop_move)(test_multimap_no_prop_move))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST(move_construct_tests2, ((test_set)(test_multiset)(test_map)(test_multimap)(test_set_prop_move)(test_multiset_prop_move)(test_map_prop_move)(test_multimap_prop_move)(test_set_no_prop_move)(test_multiset_no_prop_move)(test_map_no_prop_move)(test_multimap_no_prop_move))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST(move_assign_tests2, ((test_set)(test_multiset)(test_map)(test_multimap)(test_set_prop_move)(test_multiset_prop_move)(test_map_prop_move)(test_multimap_prop_move)(test_set_no_prop_move)(test_multiset_no_prop_move)(test_map_no_prop_move)(test_multimap_no_prop_move))( (default_generator)(generate_collisions)(limited_range))) #endif } // namespace move_tests RUN_TESTS()
0
repos/unordered/test
repos/unordered/test/unordered/init_type_insert_tests.cpp
// Copyright 2022 Christian Mazakas. // Distributed under the Boost Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or move at http://www.boost.org/LICENSE_1_0.txt) #if !defined(BOOST_UNORDERED_FOA_TESTS) #error "This test is only for the FOA-style conatiners" #endif #include "../helpers/test.hpp" #include "../helpers/unordered.hpp" #include <boost/config.hpp> struct move_only { int x_ = -1; move_only() = default; move_only(int x) : x_{x} {} move_only(move_only const&) = delete; move_only(move_only&&) = default; friend bool operator==(move_only const& lhs, move_only const& rhs) { return lhs.x_ == rhs.x_; } }; namespace std { template <> struct hash<move_only> { std::size_t operator()(move_only const& mo) const noexcept { return std::hash<int>()(mo.x_); } }; } // namespace std #ifndef BOOST_UNORDERED_NO_INIT_TYPE_TESTS struct immovable { int x_ = -1; immovable() = default; immovable(int x) : x_{x} {} immovable(immovable const&) = delete; immovable(immovable&&) = delete; friend bool operator==(immovable const& lhs, immovable const& rhs) { return lhs.x_ == rhs.x_; } }; namespace std { template <> struct hash<immovable> { std::size_t operator()(immovable const& im) const noexcept { return std::hash<int>()(im.x_); } }; } // namespace std #endif struct raii_tracker { static unsigned move_constructs; static unsigned copy_constructs; int x_ = -1; static void reset_counts() { move_constructs = 0; copy_constructs = 0; } raii_tracker() {} raii_tracker(int x) : x_{x} {} raii_tracker(raii_tracker const& rhs) : x_{rhs.x_} { ++copy_constructs; } raii_tracker(raii_tracker&& rhs) noexcept : x_{rhs.x_} { rhs.x_ = -1; ++move_constructs; } friend bool operator==(raii_tracker const& lhs, raii_tracker const& rhs) { return lhs.x_ == rhs.x_; } }; namespace std { template <> struct hash<raii_tracker> { std::size_t operator()(raii_tracker const& rt) const noexcept { return std::hash<int>()(rt.x_); } }; } // namespace std unsigned raii_tracker::move_constructs = 0; unsigned raii_tracker::copy_constructs = 0; static void test_move_only() { int const v = 128; boost::unordered_flat_map<move_only, int, std::hash<move_only> > map; using init_type = decltype(map)::init_type; static_assert(std::is_same<std::pair<move_only, int>, init_type>::value, ""); map.insert(std::make_pair(move_only(1), v)); map.insert({move_only(2), v}); BOOST_TEST_EQ(map.size(), 2u); map.rehash(1024); BOOST_TEST_GE(map.bucket_count(), 1024u); } static void test_insert_tracking() { raii_tracker::reset_counts(); BOOST_TEST_EQ(raii_tracker::copy_constructs, 0u); BOOST_TEST_EQ(raii_tracker::move_constructs, 0u); boost::unordered_flat_map<raii_tracker, raii_tracker, std::hash<raii_tracker> > map; { std::pair<raii_tracker, raii_tracker> value{1, 2}; map.insert(value); BOOST_TEST_EQ(raii_tracker::copy_constructs, 2u); BOOST_TEST_EQ(raii_tracker::move_constructs, 0u); } { std::pair<raii_tracker, raii_tracker> value{2, 3}; map.insert(std::move(value)); BOOST_TEST_EQ(raii_tracker::copy_constructs, 2u); BOOST_TEST_EQ(raii_tracker::move_constructs, 2u); } { std::pair<raii_tracker const, raii_tracker> value{3, 4}; map.insert(value); BOOST_TEST_EQ(raii_tracker::copy_constructs, 4u); BOOST_TEST_EQ(raii_tracker::move_constructs, 2u); } { std::pair<raii_tracker const, raii_tracker> value{4, 5}; map.insert(std::move(value)); BOOST_TEST_EQ(raii_tracker::copy_constructs, 5u); BOOST_TEST_EQ(raii_tracker::move_constructs, 3u); } { map.insert(std::make_pair(5, 6)); BOOST_TEST_EQ(raii_tracker::copy_constructs, 5u); BOOST_TEST_EQ(raii_tracker::move_constructs, 5u); } { map.insert({6, 7}); BOOST_TEST_EQ(raii_tracker::copy_constructs, 5u); BOOST_TEST_EQ(raii_tracker::move_constructs, 7u); } BOOST_TEST_EQ(map.size(), 6u); map.rehash(1024); BOOST_TEST_EQ(raii_tracker::copy_constructs, 5u); BOOST_TEST_EQ(raii_tracker::move_constructs, 7u + 2u * map.size()); } static void test_insert_hint_tracking() { raii_tracker::reset_counts(); BOOST_TEST_EQ(raii_tracker::copy_constructs, 0u); BOOST_TEST_EQ(raii_tracker::move_constructs, 0u); boost::unordered_flat_map<raii_tracker, raii_tracker, std::hash<raii_tracker> > map; { std::pair<raii_tracker, raii_tracker> value{1, 2}; map.insert(map.begin(), value); BOOST_TEST_EQ(raii_tracker::copy_constructs, 2u); BOOST_TEST_EQ(raii_tracker::move_constructs, 0u); } { std::pair<raii_tracker, raii_tracker> value{2, 3}; map.insert(std::move(value)); BOOST_TEST_EQ(raii_tracker::copy_constructs, 2u); BOOST_TEST_EQ(raii_tracker::move_constructs, 2u); } { std::pair<raii_tracker const, raii_tracker> value{3, 4}; map.insert(map.begin(), value); BOOST_TEST_EQ(raii_tracker::copy_constructs, 4u); BOOST_TEST_EQ(raii_tracker::move_constructs, 2u); } { std::pair<raii_tracker const, raii_tracker> value{4, 5}; map.insert(map.begin(), std::move(value)); BOOST_TEST_EQ(raii_tracker::copy_constructs, 5u); BOOST_TEST_EQ(raii_tracker::move_constructs, 3u); } { map.insert(map.begin(), std::make_pair(5, 6)); BOOST_TEST_EQ(raii_tracker::copy_constructs, 5u); BOOST_TEST_EQ(raii_tracker::move_constructs, 5u); } { map.insert(map.begin(), {6, 7}); BOOST_TEST_EQ(raii_tracker::copy_constructs, 5u); BOOST_TEST_EQ(raii_tracker::move_constructs, 7u); } BOOST_TEST_EQ(map.size(), 6u); map.rehash(1024); BOOST_TEST_EQ(raii_tracker::copy_constructs, 5u); BOOST_TEST_EQ(raii_tracker::move_constructs, 7u + 2u * map.size()); } static void test_immovable() { #ifndef BOOST_UNORDERED_NO_INIT_TYPE_TESTS int const v = 128; boost::unordered_node_map<immovable, int, std::hash<immovable> > map; using init_type = decltype(map)::init_type; static_assert(std::is_same<std::pair<immovable, int>, init_type>::value, ""); map.emplace(1, v); map.emplace(2, v); BOOST_TEST_EQ(map.size(), 2u); map.rehash(1024); BOOST_TEST_GE(map.bucket_count(), 1024u); #endif } static void test_insert_node_tracking() { raii_tracker::reset_counts(); BOOST_TEST_EQ(raii_tracker::copy_constructs, 0u); BOOST_TEST_EQ(raii_tracker::move_constructs, 0u); boost::unordered_node_map<raii_tracker, raii_tracker, std::hash<raii_tracker> > map; { std::pair<raii_tracker, raii_tracker> value{1, 2}; map.insert(value); BOOST_TEST_EQ(raii_tracker::copy_constructs, 2u); BOOST_TEST_EQ(raii_tracker::move_constructs, 0u); } { std::pair<raii_tracker, raii_tracker> value{2, 3}; map.insert(std::move(value)); BOOST_TEST_EQ(raii_tracker::copy_constructs, 2u); BOOST_TEST_EQ(raii_tracker::move_constructs, 2u); } { std::pair<raii_tracker const, raii_tracker> value{3, 4}; map.insert(value); BOOST_TEST_EQ(raii_tracker::copy_constructs, 4u); BOOST_TEST_EQ(raii_tracker::move_constructs, 2u); } { std::pair<raii_tracker const, raii_tracker> value{4, 5}; map.insert(std::move(value)); BOOST_TEST_EQ(raii_tracker::copy_constructs, 5u); BOOST_TEST_EQ(raii_tracker::move_constructs, 3u); } { map.insert(std::make_pair(5, 6)); BOOST_TEST_EQ(raii_tracker::copy_constructs, 5u); BOOST_TEST_EQ(raii_tracker::move_constructs, 5u); } { map.insert({6, 7}); BOOST_TEST_EQ(raii_tracker::copy_constructs, 5u); BOOST_TEST_EQ(raii_tracker::move_constructs, 7u); } BOOST_TEST_EQ(map.size(), 6u); map.rehash(1024); BOOST_TEST_EQ(raii_tracker::copy_constructs, 5u); BOOST_TEST_EQ(raii_tracker::move_constructs, 7u); } static void test_insert_hint_node_tracking() { raii_tracker::reset_counts(); BOOST_TEST_EQ(raii_tracker::copy_constructs, 0u); BOOST_TEST_EQ(raii_tracker::move_constructs, 0u); boost::unordered_node_map<raii_tracker, raii_tracker, std::hash<raii_tracker> > map; { std::pair<raii_tracker, raii_tracker> value{1, 2}; map.insert(map.begin(), value); BOOST_TEST_EQ(raii_tracker::copy_constructs, 2u); BOOST_TEST_EQ(raii_tracker::move_constructs, 0u); } { std::pair<raii_tracker, raii_tracker> value{2, 3}; map.insert(std::move(value)); BOOST_TEST_EQ(raii_tracker::copy_constructs, 2u); BOOST_TEST_EQ(raii_tracker::move_constructs, 2u); } { std::pair<raii_tracker const, raii_tracker> value{3, 4}; map.insert(map.begin(), value); BOOST_TEST_EQ(raii_tracker::copy_constructs, 4u); BOOST_TEST_EQ(raii_tracker::move_constructs, 2u); } { std::pair<raii_tracker const, raii_tracker> value{4, 5}; map.insert(map.begin(), std::move(value)); BOOST_TEST_EQ(raii_tracker::copy_constructs, 5u); BOOST_TEST_EQ(raii_tracker::move_constructs, 3u); } { map.insert(map.begin(), std::make_pair(5, 6)); BOOST_TEST_EQ(raii_tracker::copy_constructs, 5u); BOOST_TEST_EQ(raii_tracker::move_constructs, 5u); } { map.insert(map.begin(), {6, 7}); BOOST_TEST_EQ(raii_tracker::copy_constructs, 5u); BOOST_TEST_EQ(raii_tracker::move_constructs, 7u); } BOOST_TEST_EQ(map.size(), 6u); map.rehash(1024); BOOST_TEST_EQ(raii_tracker::copy_constructs, 5u); BOOST_TEST_EQ(raii_tracker::move_constructs, 7u); } int main() { test_move_only(); test_insert_tracking(); test_insert_hint_tracking(); test_immovable(); test_insert_node_tracking(); test_insert_hint_node_tracking(); return boost::report_errors(); }
0
repos/unordered/test
repos/unordered/test/unordered/noexcept_tests.cpp
// Copyright 2013 Daniel James. // Copyright 2022-2023 Christian Mazakas. // 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) #include "../helpers/unordered.hpp" #include "../helpers/fwd.hpp" #include "../helpers/test.hpp" #if defined(BOOST_MSVC) #pragma warning(push) // conditional expression is constant #pragma warning(disable : 4127) #endif namespace noexcept_tests { // Test the noexcept is set correctly for the move constructor. struct hash_possible_exception : boost::hash<int> { hash_possible_exception(hash_possible_exception const&) {} hash_possible_exception& operator=(hash_possible_exception const&) { return *this; } }; struct equal_to_possible_exception : std::equal_to<int> { equal_to_possible_exception(equal_to_possible_exception const&) {} equal_to_possible_exception& operator=(equal_to_possible_exception const&) { return *this; } }; // Test that the move constructor does actually move without throwing // an exception when it claims to. struct test_exception { }; bool throwing_test_exception = false; void test_throw(char const* name) { if (throwing_test_exception) { BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Throw exception in: " << name << std::endl; throw test_exception(); } } template <bool nothrow_move_construct, bool nothrow_move_assign, bool nothrow_swap> class hash_nothrow : boost::hash<int> { typedef boost::hash<int> base; public: hash_nothrow(hash_nothrow&&) noexcept(nothrow_move_construct) { if (!nothrow_move_construct) { test_throw("Move Constructor"); } } hash_nothrow() { test_throw("Constructor"); } hash_nothrow(hash_nothrow const&) { test_throw("Copy"); } hash_nothrow& operator=(hash_nothrow const&) { test_throw("Assign"); return *this; } hash_nothrow& operator=(hash_nothrow&&) noexcept(nothrow_move_assign) { if (!nothrow_move_assign) { test_throw("Move Assign"); } return *this; } std::size_t operator()(int x) const { test_throw("Operator"); return static_cast<base const&>(*this)(x); } friend void swap(hash_nothrow&, hash_nothrow&) noexcept(nothrow_swap) { if (!nothrow_swap) { test_throw("Swap"); } } }; typedef hash_nothrow<true, false, false> hash_nothrow_move_construct; typedef hash_nothrow<false, true, false> hash_nothrow_move_assign; typedef hash_nothrow<false, false, true> hash_nothrow_swap; template <bool nothrow_move_construct, bool nothrow_move_assign, bool nothrow_swap> class equal_to_nothrow { typedef boost::hash<int> base; public: equal_to_nothrow(equal_to_nothrow&&) noexcept(nothrow_move_construct) { if (!nothrow_move_construct) { test_throw("Move Constructor"); } } equal_to_nothrow() { test_throw("Constructor"); } equal_to_nothrow(equal_to_nothrow const&) { test_throw("Copy"); } equal_to_nothrow& operator=(equal_to_nothrow const&) { test_throw("Assign"); return *this; } equal_to_nothrow& operator=(equal_to_nothrow&&) noexcept(nothrow_move_assign) { if (!nothrow_move_assign) { test_throw("Move Assign"); } return *this; } std::size_t operator()(int x, int y) const { test_throw("Operator"); return x == y; } friend void swap(equal_to_nothrow&, equal_to_nothrow&) noexcept(nothrow_swap) { if (!nothrow_swap) { test_throw("Swap"); } } }; typedef equal_to_nothrow<true, false, false> equal_to_nothrow_move_construct; typedef equal_to_nothrow<false, true, false> equal_to_nothrow_move_assign; typedef equal_to_nothrow<false, false, true> equal_to_nothrow_swap; bool have_is_nothrow_move = false; bool have_is_nothrow_move_assign = false; bool have_is_nothrow_swap = false; UNORDERED_AUTO_TEST (check_is_nothrow_move) { BOOST_TEST( !boost::is_nothrow_move_constructible<hash_possible_exception>::value); BOOST_TEST( !boost::is_nothrow_move_assignable<hash_possible_exception>::value); BOOST_TEST(!boost::is_nothrow_swappable<hash_possible_exception>::value); BOOST_TEST((!boost::is_nothrow_move_constructible< equal_to_nothrow<false, false, false> >::value)); BOOST_TEST((!boost::is_nothrow_move_assignable< equal_to_nothrow<false, false, false> >::value)); BOOST_TEST((!boost::is_nothrow_swappable< equal_to_nothrow<false, false, false> >::value)); have_is_nothrow_move = boost::is_nothrow_move_constructible<hash_nothrow_move_construct>::value; have_is_nothrow_move_assign = boost::is_nothrow_move_assignable<hash_nothrow_move_assign>::value; have_is_nothrow_swap = boost::is_nothrow_swappable<hash_nothrow_swap>::value; // Check that the traits work when expected. BOOST_TEST(have_is_nothrow_move); BOOST_TEST(have_is_nothrow_move_assign); BOOST_TEST(have_is_nothrow_swap); BOOST_LIGHTWEIGHT_TEST_OSTREAM << "have_is_nothrow_move: " << have_is_nothrow_move << std::endl << "have_is_nothrow_swap: " << have_is_nothrow_swap << std::endl; } UNORDERED_AUTO_TEST (test_noexcept) { if (have_is_nothrow_move) { #ifdef BOOST_UNORDERED_FOA_TESTS BOOST_TEST((boost::is_nothrow_move_constructible< boost::unordered_flat_set<int> >::value)); BOOST_TEST((boost::is_nothrow_move_constructible< boost::unordered_flat_map<int, int> >::value)); BOOST_TEST((boost::is_nothrow_move_constructible< boost::unordered_node_set<int> >::value)); BOOST_TEST((boost::is_nothrow_move_constructible< boost::unordered_node_map<int, int> >::value)); #else BOOST_TEST((boost::is_nothrow_move_constructible< boost::unordered_set<int> >::value)); BOOST_TEST((boost::is_nothrow_move_constructible< boost::unordered_multiset<int> >::value)); BOOST_TEST((boost::is_nothrow_move_constructible< boost::unordered_map<int, int> >::value)); BOOST_TEST((boost::is_nothrow_move_constructible< boost::unordered_multimap<int, int> >::value)); #endif } #ifdef BOOST_UNORDERED_FOA_TESTS BOOST_TEST( (!boost::is_nothrow_move_constructible< boost::unordered_flat_set<int, hash_possible_exception> >::value)); BOOST_TEST( (!boost::is_nothrow_move_constructible<boost::unordered_flat_set<int, boost::hash<int>, equal_to_possible_exception> >::value)); BOOST_TEST( (!boost::is_nothrow_move_constructible< boost::unordered_node_set<int, hash_possible_exception> >::value)); BOOST_TEST( (!boost::is_nothrow_move_constructible<boost::unordered_node_set<int, boost::hash<int>, equal_to_possible_exception> >::value)); #else BOOST_TEST((!boost::is_nothrow_move_constructible< boost::unordered_set<int, hash_possible_exception> >::value)); BOOST_TEST( (!boost::is_nothrow_move_constructible<boost::unordered_multiset<int, boost::hash<int>, equal_to_possible_exception> >::value)); #endif } template <class X> static void test_nothrow_move_when_noexcept(X*) { if (have_is_nothrow_move) { BOOST_TEST(boost::is_nothrow_move_constructible<X>::value); } throwing_test_exception = false; X x1; x1.insert(10); x1.insert(50); try { throwing_test_exception = true; X x2 = std::move(x1); BOOST_TEST(x2.size() == 2); BOOST_TEST(*x2.begin() == 10 || *x2.begin() == 50); BOOST_TEST(have_is_nothrow_move); } catch (test_exception) { BOOST_TEST(!have_is_nothrow_move); } throwing_test_exception = false; } template <class T> void test_nothrow_move_assign_when_noexcept(T*, test::random_generator const&) { { if (have_is_nothrow_move_assign) { BOOST_TEST(boost::is_nothrow_move_assignable<T>::value); } throwing_test_exception = false; T x1; T x2; x1.insert(10); x1.insert(50); for (int i = 0; i < 100; ++i) { x2.insert(i); } try { throwing_test_exception = true; x2 = std::move(x1); BOOST_TEST(x2.size() == 2); BOOST_TEST(*x2.begin() == 10 || *x2.begin() == 50); BOOST_TEST(have_is_nothrow_move_assign); } catch (test_exception) { BOOST_TEST(!have_is_nothrow_move_assign); } throwing_test_exception = false; } { if (have_is_nothrow_move_assign) { BOOST_TEST(boost::is_nothrow_move_assignable<T>::value); } throwing_test_exception = false; T x1; T x2; x1.insert(10); x1.insert(50); for (int i = 0; i < 100; ++i) { x2.insert(i); } try { throwing_test_exception = true; x1 = std::move(x2); BOOST_TEST(x1.size() == 100); BOOST_TEST(have_is_nothrow_move_assign); } catch (test_exception) { BOOST_TEST(!have_is_nothrow_move_assign); } throwing_test_exception = false; } } template <class X> static void test_nothrow_swap_when_noexcept(X*) { if (have_is_nothrow_swap) { BOOST_TEST(boost::is_nothrow_swappable<X>::value); } throwing_test_exception = false; X x1; X x2; x1.insert(10); x1.insert(50); for (int i = 0; i < 100; ++i) { x2.insert(i); } try { throwing_test_exception = true; x1.swap(x2); BOOST_TEST(x1.size() == 100); BOOST_TEST(x2.size() == 2); BOOST_TEST(*x2.begin() == 10 || *x2.begin() == 50); BOOST_TEST(have_is_nothrow_swap); } catch (test_exception) { BOOST_TEST(!have_is_nothrow_swap); } throwing_test_exception = false; } } // namespace noexcept_tests #if defined(BOOST_MSVC) #pragma warning(pop) #endif template <class T> class allocator1 { allocator1 operator=(allocator1 const&); allocator1 operator=(allocator1&&); public: typedef T value_type; allocator1() {} allocator1(allocator1 const&) {} template <class U> allocator1(allocator1<U> const&) {} T* allocate(std::size_t n) { noexcept_tests::test_throw("Allocate"); return static_cast<T*>(::operator new(n * sizeof(T))); } void deallocate(T* p, std::size_t) { ::operator delete(p); } friend bool operator==(allocator1 const&, allocator1 const&) { return true; } friend bool operator!=(allocator1 const&, allocator1 const&) { return false; } }; template <class T> class allocator2 { allocator2 operator=(allocator2 const&); public: typedef T value_type; typedef boost::true_type propagate_on_container_move_assignment; allocator2() {} allocator2(allocator2 const&) {} template <class U> allocator2(allocator2<U> const&) {} allocator2& operator=(allocator2&&) { return *this; } T* allocate(std::size_t n) { noexcept_tests::test_throw("Allocate"); return static_cast<T*>(::operator new(n * sizeof(T))); } void deallocate(T* p, std::size_t) { ::operator delete(p); } friend bool operator==(allocator2 const&, allocator2 const&) { return true; } friend bool operator!=(allocator2 const&, allocator2 const&) { return false; } }; UNORDERED_AUTO_TEST (prelim_allocator_checks) { BOOST_TEST(boost::allocator_is_always_equal<allocator1<int> >::type::value); BOOST_TEST(!boost::allocator_propagate_on_container_move_assignment< allocator1<int> >::type::value); BOOST_TEST(boost::allocator_is_always_equal<allocator2<int> >::type::value); BOOST_TEST(boost::allocator_propagate_on_container_move_assignment< allocator2<int> >::type::value); } using test::default_generator; #ifdef BOOST_UNORDERED_FOA_TESTS boost::unordered_flat_set<int, noexcept_tests::hash_nothrow_move_construct, noexcept_tests::equal_to_nothrow_move_construct>* throwing_set; boost::unordered_flat_set<int, noexcept_tests::hash_nothrow_swap, noexcept_tests::equal_to_nothrow_swap>* throwing_set2; boost::unordered_flat_set<int, noexcept_tests::hash_nothrow_swap, noexcept_tests::equal_to_nothrow_swap, allocator1<int> >* throwing_set_alloc1; boost::unordered_flat_set<int, noexcept_tests::hash_nothrow_swap, noexcept_tests::equal_to_nothrow_swap, allocator2<int> >* throwing_set_alloc2; boost::unordered_node_set<int, noexcept_tests::hash_nothrow_move_construct, noexcept_tests::equal_to_nothrow_move_construct>* throwing_node_set; boost::unordered_node_set<int, noexcept_tests::hash_nothrow_swap, noexcept_tests::equal_to_nothrow_swap>* throwing_node_set2; boost::unordered_node_set<int, noexcept_tests::hash_nothrow_swap, noexcept_tests::equal_to_nothrow_swap, allocator1<int> >* throwing_node_set_alloc1; boost::unordered_node_set<int, noexcept_tests::hash_nothrow_swap, noexcept_tests::equal_to_nothrow_swap, allocator2<int> >* throwing_node_set_alloc2; // clang-format off UNORDERED_TEST( test_nothrow_move_when_noexcept, ((throwing_set)(throwing_node_set))) UNORDERED_TEST( test_nothrow_swap_when_noexcept, ((throwing_set2)(throwing_node_set2))) UNORDERED_TEST(test_nothrow_move_assign_when_noexcept, ((throwing_set_alloc1)(throwing_set_alloc2) (throwing_node_set_alloc1)(throwing_node_set_alloc2))( (default_generator))) // clang-format on #else boost::unordered_set<int, noexcept_tests::hash_nothrow_move_construct, noexcept_tests::equal_to_nothrow_move_construct>* throwing_set; boost::unordered_set<int, noexcept_tests::hash_nothrow_swap, noexcept_tests::equal_to_nothrow_swap>* throwing_set2; boost::unordered_set<int, noexcept_tests::hash_nothrow_move_assign, noexcept_tests::equal_to_nothrow_move_assign, allocator1<int> >* throwing_set_alloc1; boost::unordered_set<int, noexcept_tests::hash_nothrow_move_assign, noexcept_tests::equal_to_nothrow_move_assign, allocator2<int> >* throwing_set_alloc2; UNORDERED_TEST(test_nothrow_move_when_noexcept, ((throwing_set))) UNORDERED_TEST(test_nothrow_swap_when_noexcept, ((throwing_set2))) UNORDERED_TEST(test_nothrow_move_assign_when_noexcept, ((throwing_set_alloc1)(throwing_set_alloc2))((default_generator))) #endif RUN_TESTS()
0
repos/unordered/test
repos/unordered/test/unordered/mmap_tests.cpp
// Copyright 2023 Christian Mazakas. // Copyright 2023 Joaquin M Lopez Munoz. // 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) #include <boost/config.hpp> #if defined(BOOST_CLANG_VERSION) && BOOST_CLANG_VERSION < 30900 #include <boost/config/pragma_message.hpp> BOOST_PRAGMA_MESSAGE( "This version of clang is incompatible with Boost.Process"); int main() {} #else #include "../helpers/test.hpp" #include <boost/unordered/unordered_flat_map.hpp> #include <boost/unordered/unordered_map.hpp> #include <boost/unordered/unordered_node_map.hpp> #include <boost/unordered/unordered_flat_set.hpp> #include <boost/unordered/unordered_node_set.hpp> #include <boost/unordered/unordered_set.hpp> #include <boost/unordered/concurrent_flat_map.hpp> #include <boost/unordered/concurrent_flat_set.hpp> #include <boost/interprocess/allocators/allocator.hpp> #include <boost/interprocess/containers/string.hpp> #include <boost/interprocess/managed_shared_memory.hpp> #include <boost/process/child.hpp> #include <boost/process/filesystem.hpp> #include <boost/uuid/random_generator.hpp> #include <boost/uuid/uuid_io.hpp> #include <algorithm> #include <iostream> #include <type_traits> #include <vector> #ifndef BOOST_UNORDERED_FOA_MMAP_MAP_TYPE #error "this requires a class template be passed as a macro" #endif using char_allocator = boost::interprocess::allocator<char, boost::interprocess::managed_shared_memory::segment_manager>; using string_type = boost::interprocess::basic_string<char, std::char_traits<char>, char_allocator>; using pair_type = std::pair<const string_type, string_type>; using string_pair_type = std::pair<string_type, string_type>; using string_pair_allocator = boost::interprocess::allocator<string_pair_type, boost::interprocess::managed_shared_memory::segment_manager>; using pair_allocator = boost::interprocess::allocator<pair_type, boost::interprocess::managed_shared_memory::segment_manager>; template <template <class, class, class, class, class> class Map, class MapType = Map<string_type, string_type, boost::hash<string_type>, std::equal_to<string_type>, pair_allocator> > typename std::enable_if< !std::is_same<typename MapType::value_type, string_pair_type>::value, MapType>::type get_container_type() { return {}; } template <template <class, class, class, class> class Set, class SetType = Set<string_pair_type, boost::hash<string_pair_type>, std::equal_to<string_pair_type>, string_pair_allocator> > typename std::enable_if< std::is_same<typename SetType::value_type, string_pair_type>::value, SetType>::type get_container_type() { return {}; } using concurrent_map = decltype( get_container_type<boost::concurrent_flat_map>()); using concurrent_set = decltype( get_container_type<boost::concurrent_flat_set>()); template <class C> struct is_concurrent_container: std::false_type {}; template <typename... Args> struct is_concurrent_container<boost::concurrent_flat_map<Args...> >: std::true_type {}; template <typename... Args> struct is_concurrent_container<boost::concurrent_flat_set<Args...> >: std::true_type {}; static char const* shm_map_name = "shared_map"; template <class C> typename std::enable_if<!is_concurrent_container<C>::value, void>::type parent(std::string const& shm_name_, char const* exe_name, C*) { struct shm_remove { char const* shm_name; shm_remove(char const* shm_name_) : shm_name(shm_name_) { boost::interprocess::shared_memory_object::remove(shm_name); } ~shm_remove() { boost::interprocess::shared_memory_object::remove(shm_name); } } remover{shm_name_.c_str()}; using container_type = C; std::size_t const shm_size = 64 * 1024; auto shm_name = remover.shm_name; boost::interprocess::managed_shared_memory segment( boost::interprocess::create_only, shm_name, shm_size); auto segment_mngr = segment.get_segment_manager(); char_allocator char_alloc(segment_mngr); pair_allocator pair_alloc(segment_mngr); using iterator_type = typename C::iterator; container_type* c = segment.construct<container_type>(shm_map_name)(pair_alloc); iterator_type* it = segment.construct<iterator_type>("shared_iterator")(); auto const old_bc = c->bucket_count(); BOOST_TEST(c->empty()); boost::process::child child(exe_name, shm_name); child.wait(); int ret = child.exit_code(); BOOST_TEST(*it == c->begin()); BOOST_TEST((**it) == *(c->begin())); c->erase(*it); auto inputs = std::vector<std::pair<std::string, std::string> >{{"hello", "world"}}; for (const auto& kvp : inputs) { auto const& key = kvp.first; auto const& value = kvp.second; c->emplace(string_type(key.data(), char_alloc), string_type(value.data(), char_alloc)); } BOOST_TEST_EQ(ret, 0); BOOST_TEST_GT(c->size(), inputs.size()); BOOST_TEST_GT(c->bucket_count(), old_bc); segment.destroy<iterator_type>("shared_iterator"); segment.destroy<container_type>(shm_map_name); } template <class C> typename std::enable_if<!is_concurrent_container<C>::value, void>::type child(std::string const& shm_name, C*) { using container_type = C; using iterator = typename container_type::iterator; boost::interprocess::managed_shared_memory segment( boost::interprocess::open_only, shm_name.c_str()); container_type* c = segment.find<container_type>(shm_map_name).first; iterator* it = segment.find<iterator>("shared_iterator").first; BOOST_TEST(c->empty()); std::vector<std::pair<std::string, std::string> > inputs = { {"aaa", "AAA"}, {"bbb", "BBB"}, {"ccc", "CCCC"}}; if (BOOST_TEST_NE(c, nullptr)) { auto a = segment.get_segment_manager(); for (const auto& input : inputs) { c->emplace(string_type(input.first.c_str(), a), string_type(input.second.c_str(), a)); } c->rehash(c->bucket_count() + 1); if (BOOST_TEST_NE(it, nullptr)) { *it = c->begin(); } } } template <class C> typename std::enable_if<is_concurrent_container<C>::value, void>::type parent(std::string const& shm_name_, char const* exe_name, C*) { struct shm_remove { char const* shm_name; shm_remove(char const* shm_name_) : shm_name(shm_name_) { boost::interprocess::shared_memory_object::remove(shm_name); } ~shm_remove() { boost::interprocess::shared_memory_object::remove(shm_name); } } remover{shm_name_.c_str()}; using container_type = C; std::size_t const shm_size = 64 * 1024; auto shm_name = remover.shm_name; boost::interprocess::managed_shared_memory segment( boost::interprocess::create_only, shm_name, shm_size); auto segment_mngr = segment.get_segment_manager(); char_allocator char_alloc(segment_mngr); pair_allocator pair_alloc(segment_mngr); container_type* c = segment.construct<container_type>(shm_map_name)(pair_alloc); auto const old_bc = c->bucket_count(); BOOST_TEST(c->empty()); boost::process::child child(exe_name, shm_name); child.wait(); int ret = child.exit_code(); auto inputs = std::vector<std::pair<std::string, std::string> >{{"hello", "world"}}; for (const auto& kvp : inputs) { auto const& key = kvp.first; auto const& value = kvp.second; c->emplace(string_type(key.data(), char_alloc), string_type(value.data(), char_alloc)); } BOOST_TEST_EQ(ret, 0); BOOST_TEST_GT(c->size(), inputs.size()); BOOST_TEST_GT(c->bucket_count(), old_bc); segment.destroy<container_type>(shm_map_name); } template <class C> typename std::enable_if<is_concurrent_container<C>::value, void>::type child(std::string const& shm_name, C*) { using container_type = C; boost::interprocess::managed_shared_memory segment( boost::interprocess::open_only, shm_name.c_str()); container_type* c = segment.find<container_type>(shm_map_name).first; BOOST_TEST(c->empty()); std::vector<std::pair<std::string, std::string> > inputs = { {"aaa", "AAA"}, {"bbb", "BBB"}, {"ccc", "CCCC"}}; if (BOOST_TEST_NE(c, nullptr)) { auto a = segment.get_segment_manager(); for (const auto& input : inputs) { c->emplace(string_type(input.first.c_str(), a), string_type(input.second.c_str(), a)); } c->rehash(c->bucket_count() + 1); } } std::string shm_name_sanitize(std::string const& exe_name) { std::string s(exe_name); auto pos = std::remove_if(s.begin(), s.end(), [](char const c) { switch (c) { case '/': case '.': case '\\': case '-': case '_': return true; default: return false; } }); s.erase(pos, s.end()); s = "/" + s; return s.substr(0, 255); } void mmap_test(int argc, char const** argv) { using container_type = decltype(get_container_type<BOOST_UNORDERED_FOA_MMAP_MAP_TYPE>()); if (argc == 1) { auto uuid = to_string(boost::uuids::random_generator()()); auto exe_name = argv[0]; auto shm_name = shm_name_sanitize(std::string(exe_name) + uuid); container_type* p = nullptr; parent(shm_name, exe_name, p); } else { auto shm_name = std::string(argv[1]); container_type* p = nullptr; child(shm_name, p); } } int main(int argc, char const** argv) { mmap_test(argc, argv); return boost::report_errors(); } #endif
0
repos/unordered/test
repos/unordered/test/unordered/erase_tests.cpp
// Copyright 2006-2009 Daniel James. // Copyright 2022 Christian Mazakas. // 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) #include "../helpers/unordered.hpp" #include "../helpers/test.hpp" #include "../objects/test.hpp" #include "../helpers/random_values.hpp" #include "../helpers/tracker.hpp" #include "../helpers/equivalent.hpp" #include "../helpers/helpers.hpp" #include "../helpers/invariants.hpp" #include <vector> #include <cstdlib> namespace erase_tests { test::seed_t initialize_seed(85638); template <class Container> void erase_tests1(Container*, test::random_generator generator) { typedef typename Container::iterator iterator; typedef typename Container::const_iterator c_iterator; BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Erase by key.\n"; { test::check_instances check_; test::random_values<Container> v(1000, generator); Container x(v.begin(), v.end()); int iterations = 0; for (typename test::random_values<Container>::iterator it = v.begin(); it != v.end(); ++it) { std::size_t count = x.count(test::get_key<Container>(*it)); std::size_t old_size = x.size(); BOOST_TEST(count == x.erase(test::get_key<Container>(*it))); BOOST_TEST(x.size() == old_size - count); BOOST_TEST(x.count(test::get_key<Container>(*it)) == 0); BOOST_TEST(x.find(test::get_key<Container>(*it)) == x.end()); if (++iterations % 20 == 0) test::check_equivalent_keys(x); } } BOOST_LIGHTWEIGHT_TEST_OSTREAM << "erase(begin()).\n"; { test::check_instances check_; test::random_values<Container> v(1000, generator); Container x(v.begin(), v.end()); std::size_t size = x.size(); int iterations = 0; while (size > 0 && !x.empty()) { typename Container::key_type key = test::get_key<Container>(*x.begin()); std::size_t count = x.count(key); iterator pos = x.erase(x.begin()); BOOST_TEST(pos == x.begin()); --size; BOOST_TEST(x.count(key) == count - 1); BOOST_TEST(x.size() == size); if (++iterations % 20 == 0) test::check_equivalent_keys(x); } BOOST_TEST(x.empty()); } BOOST_LIGHTWEIGHT_TEST_OSTREAM << "erase(random position).\n"; { test::check_instances check_; test::random_values<Container> v(1000, generator); Container x(v.begin(), v.end()); std::size_t size = x.size(); int iterations = 0; while (size > 0 && !x.empty()) { std::size_t index = test::random_value(x.size()); c_iterator prev, pos, next; if (index == 0) { prev = pos = x.begin(); } else { prev = test::next(x.begin(), index - 1); pos = test::next(prev); } next = test::next(pos); typename Container::key_type key = test::get_key<Container>(*pos); std::size_t count = x.count(key); BOOST_TEST(count > 0); BOOST_TEST(next == x.erase(pos)); --size; if (size > 0) BOOST_TEST(index == 0 ? next == x.begin() : next == test::next(prev)); BOOST_TEST(x.count(key) == count - 1); if (x.count(key) != count - 1) { BOOST_LIGHTWEIGHT_TEST_OSTREAM << count << " => " << x.count(key) << std::endl; } BOOST_TEST(x.size() == size); if (++iterations % 20 == 0) test::check_equivalent_keys(x); } BOOST_TEST(x.empty()); } BOOST_LIGHTWEIGHT_TEST_OSTREAM << "erase(ranges).\n"; { test::check_instances check_; test::random_values<Container> v(500, generator); Container x(v.begin(), v.end()); std::size_t size = x.size(); // I'm actually stretching it a little here, as the standard says it // returns 'the iterator immediately following the erase elements' // and if nothing is erased, then there's nothing to follow. But I // think this is the only sensible option... BOOST_TEST(x.erase(x.end(), x.end()) == x.end()); BOOST_TEST(x.erase(x.begin(), x.begin()) == x.begin()); BOOST_TEST(x.size() == size); test::check_equivalent_keys(x); BOOST_TEST(x.erase(x.begin(), x.end()) == x.end()); BOOST_TEST(x.empty()); BOOST_TEST(x.begin() == x.end()); test::check_equivalent_keys(x); BOOST_TEST(x.erase(x.begin(), x.end()) == x.begin()); test::check_equivalent_keys(x); } BOOST_LIGHTWEIGHT_TEST_OSTREAM << "erase(random ranges).\n"; { test::check_instances check_; Container x; for (int i = 0; i < 100; ++i) { test::random_values<Container> v(1000, generator); x.insert(v.begin(), v.end()); // Note that erase only invalidates the erased iterators. std::vector<c_iterator> iterators; for (c_iterator it = x.cbegin(); it != x.cend(); ++it) { iterators.push_back(it); } iterators.push_back(x.cend()); while (iterators.size() > 1) { std::size_t start = test::random_value(iterators.size()); std::size_t length = test::random_value(iterators.size() - start); x.erase(iterators[start], iterators[start + length]); iterators.erase(test::next(iterators.begin(), start), test::next(iterators.begin(), start + length)); BOOST_TEST(x.size() == iterators.size() - 1); typename std::vector<c_iterator>::const_iterator i2 = iterators.begin(); for (c_iterator i1 = x.cbegin(); i1 != x.cend(); ++i1) { BOOST_TEST(i1 == *i2); ++i2; } BOOST_TEST(x.cend() == *i2); test::check_equivalent_keys(x); } BOOST_TEST(x.empty()); } } BOOST_LIGHTWEIGHT_TEST_OSTREAM << "quick_erase(begin()).\n"; { test::check_instances check_; test::random_values<Container> v(1000, generator); Container x(v.begin(), v.end()); std::size_t size = x.size(); int iterations = 0; while (size > 0 && !x.empty()) { typename Container::key_type key = test::get_key<Container>(*x.begin()); std::size_t count = x.count(key); #ifdef BOOST_UNORDERED_FOA_TESTS x.erase(x.begin()); #else x.quick_erase(x.begin()); #endif --size; BOOST_TEST(x.count(key) == count - 1); BOOST_TEST(x.size() == size); if (++iterations % 20 == 0) test::check_equivalent_keys(x); } BOOST_TEST(x.empty()); } BOOST_LIGHTWEIGHT_TEST_OSTREAM << "quick_erase(random position).\n"; { test::check_instances check_; test::random_values<Container> v(1000, generator); Container x(v.begin(), v.end()); std::size_t size = x.size(); int iterations = 0; while (size > 0 && !x.empty()) { std::size_t index = test::random_value(x.size()); typename Container::const_iterator prev, pos, next; if (index == 0) { prev = pos = x.begin(); } else { prev = test::next(x.begin(), index - 1); pos = test::next(prev); } next = test::next(pos); typename Container::key_type key = test::get_key<Container>(*pos); std::size_t count = x.count(key); BOOST_TEST(count > 0); #ifdef BOOST_UNORDERED_FOA_TESTS x.erase(pos); #else x.quick_erase(pos); #endif --size; if (size > 0) BOOST_TEST(index == 0 ? next == x.begin() : next == test::next(prev)); BOOST_TEST(x.count(key) == count - 1); if (x.count(key) != count - 1) { BOOST_LIGHTWEIGHT_TEST_OSTREAM << count << " => " << x.count(key) << std::endl; } BOOST_TEST(x.size() == size); if (++iterations % 20 == 0) test::check_equivalent_keys(x); } BOOST_TEST(x.empty()); } BOOST_LIGHTWEIGHT_TEST_OSTREAM << "clear().\n"; { test::check_instances check_; test::random_values<Container> v(500, generator); Container x(v.begin(), v.end()); x.clear(); BOOST_TEST(x.empty()); BOOST_TEST(x.begin() == x.end()); } BOOST_LIGHTWEIGHT_TEST_OSTREAM << "\n"; } using test::default_generator; using test::generate_collisions; using test::limited_range; #ifdef BOOST_UNORDERED_FOA_TESTS boost::unordered_flat_set<test::object, test::hash, test::equal_to, test::allocator1<test::object> >* test_set; boost::unordered_flat_map<test::object, test::object, test::hash, test::equal_to, test::allocator1<test::object> >* test_map; boost::unordered_node_set<test::object, test::hash, test::equal_to, test::allocator1<test::object> >* test_node_set; boost::unordered_node_map<test::object, test::object, test::hash, test::equal_to, test::allocator1<test::object> >* test_node_map; // clang-format off UNORDERED_TEST( erase_tests1, ((test_set)(test_map)(test_node_set)(test_node_map))( (default_generator)(generate_collisions)(limited_range))) // clang-format on #else boost::unordered_set<test::object, test::hash, test::equal_to, test::allocator1<test::object> >* test_set; boost::unordered_multiset<test::object, test::hash, test::equal_to, test::allocator2<test::object> >* test_multiset; boost::unordered_map<test::object, test::object, test::hash, test::equal_to, test::allocator1<test::object> >* test_map; boost::unordered_multimap<test::object, test::object, test::hash, test::equal_to, test::allocator2<test::object> >* test_multimap; // clang-format off UNORDERED_TEST( erase_tests1, ((test_set)(test_multiset)(test_map)(test_multimap))( (default_generator)(generate_collisions)(limited_range))) // clang-format on #endif } RUN_TESTS()
0
repos/unordered/test
repos/unordered/test/unordered/link_test_2.cpp
// Copyright 2006-2009 Daniel James. // Copyright 2022-2023 Christian Mazakas. // 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) #include "../helpers/unordered.hpp" #ifdef BOOST_UNORDERED_FOA_TESTS #include <boost/unordered/concurrent_flat_map.hpp> void foo(boost::unordered_flat_set<int>& x1, boost::unordered_flat_map<int, int>& x2, boost::unordered_node_set<int>& x3, boost::unordered_node_map<int, int>& x4, boost::concurrent_flat_map<int, int>& x5) { #if BOOST_WORKAROUND(BOOST_CODEGEARC, BOOST_TESTED_AT(0x0613)) struct dummy { boost::unordered_flat_set<int> x1; boost::unordered_flat_map<int, int> x2; }; #endif x1.insert(1); x2[2] = 2; x3.insert(3); x4.insert(std::make_pair(4, 5)); x5.insert(std::make_pair(5, 6)); } #else void foo(boost::unordered_set<int>& x1, boost::unordered_map<int, int>& x2, boost::unordered_multiset<int>& x3, boost::unordered_multimap<int, int>& x4) { #if BOOST_WORKAROUND(BOOST_CODEGEARC, BOOST_TESTED_AT(0x0613)) struct dummy { boost::unordered_set<int> x1; boost::unordered_map<int, int> x2; boost::unordered_multiset<int> x3; boost::unordered_multimap<int, int> x4; }; #endif x1.insert(1); x2[2] = 2; x3.insert(3); x4.insert(std::make_pair(4, 5)); } #endif
0
repos/unordered/test
repos/unordered/test/unordered/insert_stable_tests.cpp
// Copyright 2007-2009 Daniel James. // 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) // clang-format off #include "../helpers/prefix.hpp" #include <boost/unordered_set.hpp> #include <boost/unordered_map.hpp> #include "../helpers/postfix.hpp" // clang-format on #include "../helpers/test.hpp" namespace insert_stable { struct member { int tag1_; int tag2_; member() : tag1_(0), tag2_(0) {} member(int t1, int t2) : tag1_(t1), tag2_(t2) {} friend bool operator==(member const& x, member const& y) { return x.tag1_ == y.tag1_; } friend bool operator!=(member const& x, member const& y) { return x.tag1_ != y.tag1_; } }; } #ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP namespace boost #else namespace insert_stable #endif { std::size_t hash_value(insert_stable::member const& x) { return static_cast<std::size_t>(x.tag1_); } } // This is no longer supported, as there's no longer an efficient way to get to // the end of a group of equivalent nodes. #if 0 UNORDERED_AUTO_TEST(stable_insert_test1) { boost::unordered_multiset<insert_stable::member> x; x.insert(insert_stable::member(1, 1)); x.insert(insert_stable::member(1, 2)); x.insert(insert_stable::member(1, 3)); BOOST_TEST(x.count(insert_stable::member(1, 4)) == 3); boost::unordered_multiset<insert_stable::member>::const_iterator it = x.begin(), end = x.end(); BOOST_TEST(it != end); if (it != end) { BOOST_TEST(it->tag2_ == 1); ++it; } BOOST_TEST(it != end); if (it != end) { BOOST_TEST(it->tag2_ == 2); ++it; } BOOST_TEST(it != end); if (it != end) { BOOST_TEST(it->tag2_ == 3); ++it; } BOOST_TEST(it == end); } UNORDERED_AUTO_TEST(stable_insert_test2) { boost::unordered_multimap<insert_stable::member, int> x; typedef boost::unordered_multimap<insert_stable::member, int>::const_iterator iterator; iterator it = x.emplace(insert_stable::member(1, 1), 1); it = x.emplace(insert_stable::member(1, 2), 2); it = x.emplace(insert_stable::member(1, 3), 3); BOOST_TEST(x.count(insert_stable::member(1, 4)) == 3); it = x.begin(); iterator end = x.end(); BOOST_TEST(it != end); if (it != end) { BOOST_TEST(it->first.tag2_ == 1 && it->second == 1); ++it; } BOOST_TEST(it != end); if (it != end) { BOOST_TEST(it->first.tag2_ == 2 && it->second == 2); ++it; } BOOST_TEST(it != end); if (it != end) { BOOST_TEST(it->first.tag2_ == 3 && it->second == 3); ++it; } BOOST_TEST(it == end); } #endif RUN_TESTS()
0
repos/unordered/test
repos/unordered/test/unordered/unnecessary_copy_tests.cpp
// Copyright 2006-2009 Daniel James. // 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) // clang-format off #include "../helpers/prefix.hpp" #include <boost/unordered_set.hpp> #include <boost/unordered_map.hpp> #include "../helpers/postfix.hpp" // clang-format on #include "../helpers/test.hpp" #include <boost/tuple/tuple.hpp> namespace unnecessary_copy_tests { struct count_copies { public: static int copies; static int moves; static int id_count; count_copies() : tag_(0), id_(++id_count) { ++copies; trace_op("Default construct"); } explicit count_copies(int tag) : tag_(tag), id_(++id_count) { ++copies; trace_op("Tag construct"); } // This bizarre constructor is an attempt to confuse emplace. // // unordered_map<count_copies, count_copies> x: // x.emplace(count_copies(1), count_copies(2)); // x.emplace(count_copies(1), count_copies(2), count_copies(3)); // // The first emplace should use the single argument constructor twice. // The second emplace should use the single argument contructor for // the key, and this constructor for the value. count_copies(count_copies const&, count_copies const& x) : tag_(x.tag_), id_(++id_count) { ++copies; trace_op("Pair construct"); } count_copies(count_copies const& x) : tag_(x.tag_), id_(++id_count) { ++copies; trace_op("Copy construct"); } count_copies(count_copies&& x) : tag_(x.tag_), id_(++id_count) { x.tag_ = -1; ++moves; trace_op("Move construct"); } count_copies& operator=( count_copies const& p) // Copy assignment { tag_ = p.tag_; ++copies; trace_op("Copy assign"); return *this; } count_copies& operator=(count_copies&& p) // Move assignment { tag_ = p.tag_; ++moves; trace_op("Move assign"); return *this; } ~count_copies() { trace_op("Destruct"); } void trace_op(char const* str) { BOOST_LIGHTWEIGHT_TEST_OSTREAM << str << ": " << tag_ << " (#" << id_ << ")" << std::endl; } int tag_; int id_; }; bool operator==(count_copies const& x, count_copies const& y) { return x.tag_ == y.tag_; } template <class T> T source() { return T(); } void reset() { count_copies::copies = 0; count_copies::moves = 0; BOOST_LIGHTWEIGHT_TEST_OSTREAM << "\nReset\n" << std::endl; } } #if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) namespace boost #else namespace unnecessary_copy_tests #endif { std::size_t hash_value(unnecessary_copy_tests::count_copies const& x) { return static_cast<std::size_t>(x.tag_); } } // Boost.Move doesn't seem to work very well on this compiler. // For example for: // // T x; // // It will default construct T, and then move it in. // For 'T const' it seems to copy. #if defined(__IBMCPP__) && __IBMCPP__ <= 1210 #define EXTRA_CONSTRUCT_COST 1 #else #define EXTRA_CONSTRUCT_COST 0 #endif #define COPY_COUNT(n) \ if (::unnecessary_copy_tests::count_copies::copies != n) { \ BOOST_ERROR("Wrong number of copies."); \ BOOST_LIGHTWEIGHT_TEST_OSTREAM \ << "Number of copies: " \ << ::unnecessary_copy_tests::count_copies::copies << " expecting: " << n \ << std::endl; \ } #define MOVE_COUNT(n) \ if (::unnecessary_copy_tests::count_copies::moves != n) { \ BOOST_ERROR("Wrong number of moves."); \ BOOST_LIGHTWEIGHT_TEST_OSTREAM \ << "Number of moves: " << ::unnecessary_copy_tests::count_copies::moves \ << " expecting: " << n << std::endl; \ } #define COPY_COUNT_RANGE(a, b) \ if (::unnecessary_copy_tests::count_copies::copies < a || \ ::unnecessary_copy_tests::count_copies::copies > b) { \ BOOST_ERROR("Wrong number of copies."); \ BOOST_LIGHTWEIGHT_TEST_OSTREAM \ << "Number of copies: " \ << ::unnecessary_copy_tests::count_copies::copies << " expecting: [" \ << a << ", " << b << "]" << std::endl; \ } #define MOVE_COUNT_RANGE(a, b) \ if (::unnecessary_copy_tests::count_copies::moves < a || \ ::unnecessary_copy_tests::count_copies::moves > b) { \ BOOST_ERROR("Wrong number of moves."); \ BOOST_LIGHTWEIGHT_TEST_OSTREAM \ << "Number of moves: " << ::unnecessary_copy_tests::count_copies::moves \ << " expecting: [" << a << ", " << b << "]" << std::endl; \ } #define COPY_COUNT_EXTRA(a, b) COPY_COUNT_RANGE(a, a + b * EXTRA_CONSTRUCT_COST) #define MOVE_COUNT_EXTRA(a, b) MOVE_COUNT_RANGE(a, a + b * EXTRA_CONSTRUCT_COST) namespace unnecessary_copy_tests { int count_copies::copies; int count_copies::moves; int count_copies::id_count; template <class T> void unnecessary_copy_insert_test(T*) { T x; typename T::value_type a; reset(); x.insert(a); COPY_COUNT(1); MOVE_COUNT(0); } template <class T> void unnecessary_copy_insert_rvalue_set_test(T*) { T x; typename T::value_type a; reset(); x.insert(std::move(a)); COPY_COUNT(0); MOVE_COUNT(1); typename T::value_type a2; reset(); x.insert(std::move(a)); COPY_COUNT(0); MOVE_COUNT((x.size() == 2 ? 1 : 0)); } template <class T> void unnecessary_copy_insert_rvalue_map_test(T*) { // Doesn't currently try to emulate std::pair move construction, // so std::pair's require a copy. Could try emulating it in // construct_from_args. T x; typename T::value_type a; reset(); x.insert(std::move(a)); COPY_COUNT(0); MOVE_COUNT(1); typename T::value_type a2; reset(); x.insert(std::move(a)); COPY_COUNT(0); MOVE_COUNT((x.size() == 2 ? 1 : 0)); } boost::unordered_set<count_copies>* set; boost::unordered_multiset<count_copies>* multiset; boost::unordered_map<int, count_copies>* map; boost::unordered_multimap<int, count_copies>* multimap; UNORDERED_TEST(unnecessary_copy_insert_test, ((set)(multiset)(map)(multimap))) UNORDERED_TEST(unnecessary_copy_insert_rvalue_set_test, ((set)(multiset))) UNORDERED_TEST(unnecessary_copy_insert_rvalue_map_test, ((map)(multimap))) template <class T> void unnecessary_copy_emplace_test(T*) { reset(); T x; typename T::value_type a; COPY_COUNT(1); x.emplace(a); COPY_COUNT(2); } template <class T> void unnecessary_copy_emplace_rvalue_test(T*) { reset(); T x; x.emplace(source<typename T::value_type>()); COPY_COUNT(1); } UNORDERED_TEST( unnecessary_copy_emplace_test, ((set)(multiset)(map)(multimap))) UNORDERED_TEST( unnecessary_copy_emplace_rvalue_test, ((set)(multiset)(map)(multimap))) template <class T> void unnecessary_copy_emplace_std_move_test(T*) { reset(); T x; typename T::value_type a; COPY_COUNT(1); MOVE_COUNT(0); x.emplace(std::move(a)); COPY_COUNT(1); MOVE_COUNT(1); } UNORDERED_TEST( unnecessary_copy_emplace_std_move_test, ((set)(multiset)(map)(multimap))) template <class T> void unnecessary_copy_emplace_boost_move_test(T*) { reset(); T x; typename T::value_type a; COPY_COUNT(1); MOVE_COUNT_EXTRA(0, 1); x.emplace(std::move(a)); COPY_COUNT(1); MOVE_COUNT(1); } UNORDERED_TEST( unnecessary_copy_emplace_boost_move_test, ((set)(multiset)(map)(multimap))) template <class T> void unnecessary_copy_emplace_boost_move_set_test(T*) { reset(); T x; typename T::value_type a; COPY_COUNT(1); MOVE_COUNT(0); x.emplace(std::move(a)); COPY_COUNT(1); MOVE_COUNT(1); } UNORDERED_TEST( unnecessary_copy_emplace_boost_move_set_test, ((set)(multiset))) template <class T> void unnecessary_copy_emplace_boost_move_map_test(T*) { reset(); T x; COPY_COUNT(0); MOVE_COUNT(0); typename T::value_type a; COPY_COUNT(1); MOVE_COUNT_EXTRA(0, 1); x.emplace(std::move(a)); COPY_COUNT(1); MOVE_COUNT(1); } UNORDERED_TEST( unnecessary_copy_emplace_boost_move_map_test, ((map)(multimap))) UNORDERED_AUTO_TEST (unnecessary_copy_emplace_set_test) { // When calling 'source' the object is moved on some compilers, but not // others. So count that here to adjust later. reset(); source<count_copies>(); int source_cost = ::unnecessary_copy_tests::count_copies::moves; // reset(); boost::unordered_set<count_copies> x; count_copies a; x.insert(a); COPY_COUNT(2); MOVE_COUNT(0); // // 0 arguments // // The container will have to create a copy in order to compare with // the existing element. reset(); x.emplace(); // source_cost doesn't make much sense here, but it seems to fit. COPY_COUNT(1); MOVE_COUNT(source_cost); // // 1 argument // // Emplace should be able to tell that there already is an element // without creating a new one. reset(); x.emplace(a); COPY_COUNT(0); MOVE_COUNT(0); // A new object is created by source, but it shouldn't be moved or // copied. reset(); x.emplace(source<count_copies>()); COPY_COUNT(1); MOVE_COUNT(source_cost); // No move should take place. reset(); x.emplace(std::move(a)); COPY_COUNT(0); MOVE_COUNT(0); // Use a new value for cases where a did get moved... count_copies b; // The container will have to create a copy in order to compare with // the existing element. reset(); x.emplace(b.tag_); COPY_COUNT(1); MOVE_COUNT(0); // // 2 arguments // // The container will have to create b copy in order to compare with // the existing element. // // Note to self: If copy_count == 0 it's an error not an optimization. // TODO: Devise a better test. reset(); x.emplace(b, b); COPY_COUNT(1); MOVE_COUNT(0); } UNORDERED_AUTO_TEST (unnecessary_copy_emplace_map_test) { // When calling 'source' the object is moved on some compilers, but not // others. So count that here to adjust later. reset(); source<count_copies>(); int source_cost = ::unnecessary_copy_tests::count_copies::moves; reset(); source<std::pair<count_copies, count_copies> >(); int source_pair_cost = ::unnecessary_copy_tests::count_copies::moves; // reset(); boost::unordered_map<count_copies, count_copies> x; // TODO: Run tests for pairs without const etc. std::pair<count_copies const, count_copies> a; x.emplace(a); COPY_COUNT_EXTRA(4, 1); MOVE_COUNT_EXTRA(0, 1); // // 0 arguments // // COPY_COUNT(1) would be okay here. reset(); x.emplace(); #if BOOST_WORKAROUND(BOOST_MSVC, == 1700) // This is a little odd, Visual C++ 11 seems to move the pair, which // results in one copy (for the const key) and one move (for the // non-const mapped value). Since 'emplace(std::move(a))' (see below) // has the normal result, it must be some odd consequence of how // Visual C++ 11 handles calling move for default arguments. COPY_COUNT(3); MOVE_COUNT(1); #else COPY_COUNT_EXTRA(2, 1); MOVE_COUNT_EXTRA(0, 1); #endif reset(); x.emplace(boost::unordered::piecewise_construct, boost::make_tuple(), boost::make_tuple()); COPY_COUNT(2); MOVE_COUNT(0); // // 1 argument // reset(); x.emplace(a); COPY_COUNT(0); MOVE_COUNT(0); // A new object is created by source, but it shouldn't be moved or // copied. reset(); x.emplace(source<std::pair<count_copies, count_copies> >()); COPY_COUNT(2); MOVE_COUNT(source_pair_cost); #if !(defined(__GNUC__) && __cplusplus < 199900L) && \ !(defined(_MSC_VER) && _MSC_VER < 1600) count_copies part; reset(); std::pair<count_copies const&, count_copies const&> a_ref(part, part); x.emplace(a_ref); COPY_COUNT(2); MOVE_COUNT(0); #endif // No move should take place. // (since a is already in the container) reset(); x.emplace(std::move(a)); COPY_COUNT(0); MOVE_COUNT(0); // // 2 arguments // std::pair<count_copies const, count_copies> b; reset(); x.emplace(b.first, b.second); COPY_COUNT(0); MOVE_COUNT(0); reset(); x.emplace(source<count_copies>(), source<count_copies>()); COPY_COUNT(2); MOVE_COUNT(source_cost * 2); // source<count_copies> creates a single copy. reset(); x.emplace(b.first, source<count_copies>()); COPY_COUNT(1); MOVE_COUNT(source_cost); reset(); x.emplace(count_copies(b.first.tag_), count_copies(b.second.tag_)); COPY_COUNT(2); MOVE_COUNT(0); reset(); x.emplace(boost::unordered::piecewise_construct, boost::make_tuple(boost::ref(b.first)), boost::make_tuple(boost::ref(b.second))); COPY_COUNT(0); MOVE_COUNT(0); reset(); x.emplace(std::piecewise_construct, std::make_tuple(std::ref(b.first)), std::make_tuple(std::ref(b.second))); COPY_COUNT(0); MOVE_COUNT(0); std::pair<count_copies const, count_copies> move_source_trial; reset(); (void)std::make_tuple(std::move(move_source_trial.first)); (void)std::make_tuple(std::move(move_source_trial.second)); int tuple_move_cost = ::unnecessary_copy_tests::count_copies::moves; int tuple_copy_cost = ::unnecessary_copy_tests::count_copies::copies; std::pair<count_copies const, count_copies> move_source; reset(); x.emplace(std::piecewise_construct, std::make_tuple(std::move(move_source.first)), std::make_tuple(std::move(move_source.second))); COPY_COUNT(tuple_copy_cost); MOVE_COUNT(tuple_move_cost); reset(); x.emplace(std::piecewise_construct, std::forward_as_tuple(b.first), std::forward_as_tuple(b.second)); COPY_COUNT(0); MOVE_COUNT(0); } } RUN_TESTS()
0
repos/unordered/test
repos/unordered/test/unordered/deduction_tests.cpp
// Copyright 2017-2018 Daniel James. // 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) #include <boost/core/lightweight_test_trait.hpp> #include <boost/unordered_map.hpp> #include <boost/unordered_set.hpp> #include <iostream> #include <vector> #if BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES #include <boost/unordered/unordered_flat_map.hpp> #include <boost/unordered/unordered_flat_set.hpp> #include <boost/unordered/concurrent_flat_map.hpp> struct hash_equals { template <typename T> bool operator()(T const& x) const { boost::hash<T> hf; return hf(x); } template <typename T> bool operator()(T const& x, T const& y) const { std::equal_to<T> eq; return eq(x, y); } }; template <typename T> struct test_allocator { typedef T value_type; test_allocator() = default; template <typename T2> test_allocator(test_allocator<T2> const&) {} T* allocate(std::size_t n) const { return (T*)(::operator new(sizeof(T) * n)); } void deallocate(T* ptr, std::size_t) const { ::operator delete(ptr); } bool operator==(test_allocator const&) const { return true; } bool operator!=(test_allocator const&) const { return false; } }; template <template <class...> class UnorderedMap> void map_tests() { std::vector<std::pair<int, int> > x; x.push_back(std::make_pair(1, 3)); x.push_back(std::make_pair(5, 10)); test_allocator<std::pair<const int, int> > pair_allocator; hash_equals f; /* template<class InputIterator, class Hash = hash<iter_key_t<InputIterator>>, class Pred = equal_to<iter_key_t<InputIterator>>, class Allocator = allocator<iter_to_alloc_t<InputIterator>>> unordered_map(InputIterator, InputIterator, typename see below::size_type = see below, Hash = Hash(), Pred = Pred(), Allocator = Allocator()) -> unordered_map<iter_key_t<InputIterator>, iter_val_t<InputIterator>, Hash, Pred, Allocator>; */ { UnorderedMap m(x.begin(), x.end()); BOOST_TEST_TRAIT_SAME(decltype(m), UnorderedMap<int, int>); } { UnorderedMap m(x.begin(), x.end(), 0, std::hash<int>()); BOOST_TEST_TRAIT_SAME(decltype(m), UnorderedMap<int, int, std::hash<int> >); } { UnorderedMap m( x.begin(), x.end(), 0, std::hash<int>(), std::equal_to<int>()); BOOST_TEST_TRAIT_SAME( decltype(m), UnorderedMap<int, int, std::hash<int>, std::equal_to<int> >); } { UnorderedMap m(x.begin(), x.end(), 0, std::hash<int>(), std::equal_to<int>(), pair_allocator); BOOST_TEST_TRAIT_SAME( decltype(m), UnorderedMap<int, int, std::hash<int>, std::equal_to<int>, test_allocator<std::pair<const int, int> > >); } /* template<class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, class Allocator = allocator<pair<const Key, T>>> unordered_map(initializer_list<pair<const Key, T>>, typename see below::size_type = see below, Hash = Hash(), Pred = Pred(), Allocator = Allocator()) -> unordered_map<Key, T, Hash, Pred, Allocator>; */ { UnorderedMap m({std::pair<int const, int>(1, 2)}); BOOST_TEST_TRAIT_SAME(decltype(m), UnorderedMap<int, int>); } { UnorderedMap m({std::pair<int, int>(1, 2)}); BOOST_TEST_TRAIT_SAME(decltype(m), UnorderedMap<int, int>); } { UnorderedMap m({std::pair<int const, int>(1, 2)}, 0, std::hash<int>()); BOOST_TEST_TRAIT_SAME(decltype(m), UnorderedMap<int, int, std::hash<int> >); } { UnorderedMap m({std::pair<int, int>(1, 2)}, 0, std::hash<int>()); BOOST_TEST_TRAIT_SAME(decltype(m), UnorderedMap<int, int, std::hash<int> >); } { UnorderedMap m({std::pair<int const, int>(1, 2)}, 0, std::hash<int>(), std::equal_to<int>()); BOOST_TEST_TRAIT_SAME( decltype(m), UnorderedMap<int, int, std::hash<int>, std::equal_to<int> >); } { UnorderedMap m( {std::pair<int, int>(1, 2)}, 0, std::hash<int>(), std::equal_to<int>()); BOOST_TEST_TRAIT_SAME( decltype(m), UnorderedMap<int, int, std::hash<int>, std::equal_to<int> >); } { UnorderedMap m({std::pair<int const, int>(1, 2)}, 0, f, f, pair_allocator); BOOST_TEST_TRAIT_SAME( decltype(m), UnorderedMap<int, int, hash_equals, hash_equals, test_allocator<std::pair<const int, int> > >); } { UnorderedMap m({std::pair<int, int>(1, 2)}, 0, f, f, pair_allocator); BOOST_TEST_TRAIT_SAME( decltype(m), UnorderedMap<int, int, hash_equals, hash_equals, test_allocator<std::pair<const int, int> > >); } /* template<class InputIterator, class Allocator> unordered_map(InputIterator, InputIterator, typename see below::size_type, Allocator) -> unordered_map<iter_key_t<InputIterator>, iter_val_t<InputIterator>, hash<iter_key_t<InputIterator>>, equal_to<iter_key_t<InputIterator>>, Allocator>; */ { UnorderedMap m(x.begin(), x.end(), 0u, pair_allocator); BOOST_TEST_TRAIT_SAME( decltype(m), UnorderedMap<int, int, boost::hash<int>, std::equal_to<int>, test_allocator<std::pair<const int, int> > >); } /* template<class InputIterator, class Allocator> unordered_map(InputIterator, InputIterator, Allocator) -> unordered_map<iter_key_t<InputIterator>, iter_val_t<InputIterator>, hash<iter_key_t<InputIterator>>, equal_to<iter_key_t<InputIterator>>, Allocator>; */ { UnorderedMap m(x.begin(), x.end(), pair_allocator); BOOST_TEST_TRAIT_SAME( decltype(m), UnorderedMap<int, int, boost::hash<int>, std::equal_to<int>, test_allocator<std::pair<const int, int> > >); } /* template<class InputIterator, class Hash, class Allocator> unordered_map(InputIterator, InputIterator, typename see below::size_type, Hash, Allocator) -> unordered_map<iter_key_t<InputIterator>, iter_val_t<InputIterator>, Hash, equal_to<iter_key_t<InputIterator>>, Allocator>; */ { UnorderedMap m(x.begin(), x.end(), 0u, f, pair_allocator); BOOST_TEST_TRAIT_SAME( decltype(m), UnorderedMap<int, int, hash_equals, std::equal_to<int>, test_allocator<std::pair<const int, int> > >); } /* template<class Key, class T, typename Allocator> unordered_map(initializer_list<pair<const Key, T>>, typename see below::size_type, Allocator) -> unordered_map<Key, T, hash<Key>, equal_to<Key>, Allocator>; */ { UnorderedMap m({std::pair<int const, int>(1, 2)}, 0, pair_allocator); BOOST_TEST_TRAIT_SAME( decltype(m), UnorderedMap<int, int, boost::hash<int>, std::equal_to<int>, test_allocator<std::pair<const int, int> > >); } { UnorderedMap m({std::pair<int, int>(1, 2)}, 0, pair_allocator); BOOST_TEST_TRAIT_SAME( decltype(m), UnorderedMap<int, int, boost::hash<int>, std::equal_to<int>, test_allocator<std::pair<const int, int> > >); } /* template<class Key, class T, typename Allocator> unordered_map(initializer_list<pair<const Key, T>>, Allocator) -> unordered_map<Key, T, hash<Key>, equal_to<Key>, Allocator>; */ { UnorderedMap m({std::pair<int const, int>(1, 2)}, pair_allocator); BOOST_TEST_TRAIT_SAME( decltype(m), UnorderedMap<int, int, boost::hash<int>, std::equal_to<int>, test_allocator<std::pair<const int, int> > >); } { UnorderedMap m({std::pair<int, int>(1, 2)}, pair_allocator); BOOST_TEST_TRAIT_SAME( decltype(m), UnorderedMap<int, int, boost::hash<int>, std::equal_to<int>, test_allocator<std::pair<const int, int> > >); } /* template<class Key, class T, class Hash, class Allocator> unordered_map(initializer_list<pair<const Key, T>>, typename see below::size_type, Hash, Allocator) -> unordered_map<Key, T, Hash, equal_to<Key>, Allocator>; */ { UnorderedMap m({std::pair<int const, int>(1, 2)}, 0, f, pair_allocator); BOOST_TEST_TRAIT_SAME( decltype(m), UnorderedMap<int, int, hash_equals, std::equal_to<int>, test_allocator<std::pair<const int, int> > >); } { UnorderedMap m({std::pair<int, int>(1, 2)}, 0, f, pair_allocator); BOOST_TEST_TRAIT_SAME( decltype(m), UnorderedMap<int, int, hash_equals, std::equal_to<int>, test_allocator<std::pair<const int, int> > >); } } template <template <class...> class UnorderedSet> void set_tests() { std::vector<int> y; y.push_back(1); y.push_back(2); hash_equals f; test_allocator<int> int_allocator; /* template<class InputIt, class Hash = std::hash<typename std::iterator_traits<InputIt>::value_type>, class Pred = std::equal_to<typename std::iterator_traits<InputIt>::value_type>, class Alloc = std::allocator<typename std::iterator_traits<InputIt>::value_type>> unordered_set(InputIt, InputIt, typename see below ::size_type = see below, Hash = Hash(), Pred = Pred(), Alloc = Alloc()) -> unordered_set<typename std::iterator_traits<InputIt>::value_type, Hash, Pred, Alloc>; */ { UnorderedSet s(y.begin(), y.end()); BOOST_TEST_TRAIT_SAME(decltype(s), UnorderedSet<int>); } { UnorderedSet s(y.begin(), y.end(), 0, std::hash<int>()); BOOST_TEST_TRAIT_SAME(decltype(s), UnorderedSet<int, std::hash<int> >); } { UnorderedSet s( y.begin(), y.end(), 0, std::hash<int>(), std::equal_to<int>()); BOOST_TEST_TRAIT_SAME( decltype(s), UnorderedSet<int, std::hash<int>, std::equal_to<int> >); } { UnorderedSet s(y.begin(), y.end(), 0, std::hash<int>(), std::equal_to<int>(), int_allocator); BOOST_TEST_TRAIT_SAME( decltype(s), UnorderedSet<int, std::hash<int>, std::equal_to<int>, test_allocator<int> >); } /* template<class T, class Hash = std::hash<T>, class Pred = std::equal_to<T>, class Alloc = std::allocator<T>> unordered_set(std::initializer_list<T>, typename see below::size_type = see below, Hash = Hash(), Pred = Pred(), Alloc = Alloc()) -> unordered_set<T, Hash, Pred, Alloc>; */ { UnorderedSet s({1, 2}); BOOST_TEST_TRAIT_SAME(decltype(s), UnorderedSet<int>); } { UnorderedSet s({1, 2}, 0, std::hash<int>()); BOOST_TEST_TRAIT_SAME(decltype(s), UnorderedSet<int, std::hash<int> >); } { UnorderedSet s({1, 2}, 0, std::hash<int>(), std::equal_to<int>()); BOOST_TEST_TRAIT_SAME( decltype(s), UnorderedSet<int, std::hash<int>, std::equal_to<int> >); } { UnorderedSet s( {1, 2}, 0, std::hash<int>(), std::equal_to<int>(), int_allocator); BOOST_TEST_TRAIT_SAME( decltype(s), UnorderedSet<int, std::hash<int>, std::equal_to<int>, test_allocator<int> >); } { UnorderedSet s({1, 2}, 0, f, f, int_allocator); BOOST_TEST_TRAIT_SAME(decltype(s), UnorderedSet<int, hash_equals, hash_equals, test_allocator<int> >); } /* template<class InputIt, class Alloc> unordered_set(InputIt, InputIt, typename see below::size_type, Alloc) -> unordered_set<typename std::iterator_traits<InputIt>::value_type, std::hash<typename std::iterator_traits<InputIt>::value_type>, std::equal_to<typename std::iterator_traits<InputIt>::value_type>, Alloc>; */ { UnorderedSet s(y.begin(), y.end(), 0u, int_allocator); BOOST_TEST_TRAIT_SAME( decltype(s), UnorderedSet<int, boost::hash<int>, std::equal_to<int>, test_allocator<int> >); } /* template<class InputIt, class Hash, class Alloc> unordered_set(InputIt, InputIt, typename see below::size_type, Hash, Alloc) -> unordered_set<typename std::iterator_traits<InputIt>::value_type, Hash, std::equal_to<typename std::iterator_traits<InputIt>::value_type>, Allocator>; */ { UnorderedSet s(y.begin(), y.end(), 0u, f, int_allocator); BOOST_TEST_TRAIT_SAME(decltype(s), UnorderedSet<int, hash_equals, std::equal_to<int>, test_allocator<int> >); } /* template<class T, class Allocator> unordered_set(std::initializer_list<T>, typename see below::size_type, Allocator) -> unordered_set<T, std::hash<T>, std::equal_to<T>, Alloc>; */ { UnorderedSet s({1, 2}, 0u, int_allocator); BOOST_TEST_TRAIT_SAME( decltype(s), UnorderedSet<int, boost::hash<int>, std::equal_to<int>, test_allocator<int> >); } /* template<class T, class Hash, class Alloc> unordered_set(std::initializer_list<T>, typename see below::size_type, Hash, Alloc) -> unordered_set<T, Hash, std::equal_to<T>, Alloc>; */ { UnorderedSet s({1, 2}, 0u, f, int_allocator); BOOST_TEST_TRAIT_SAME(decltype(s), UnorderedSet<int, hash_equals, std::equal_to<int>, test_allocator<int> >); } /* template<class InputIterator, class Allocator> unordered_set(InputIterator, InputIterator, Allocator) -> unordered_set<iter-value-type<InputIterator>, hash<iter-value-type<InputIterator>>, equal_to<iter-value-type<InputIterator>>, Allocator>; */ { UnorderedSet s(y.begin(), y.end(), int_allocator); BOOST_TEST_TRAIT_SAME( decltype(s), UnorderedSet<int, boost::hash<int>, std::equal_to<int>, test_allocator<int> >); } /* template<class T, class Allocator> unordered_set(initializer_list<T>, Allocator) -> unordered_set<T, hash<T>, equal_to<T>, Allocator>; */ { UnorderedSet s({1, 2}, int_allocator); BOOST_TEST_TRAIT_SAME( decltype(s), UnorderedSet<int, boost::hash<int>, std::equal_to<int>, test_allocator<int> >); } } #endif int main() { std::cout << "BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES: " << BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES << std::endl; #if BOOST_UNORDERED_TEMPLATE_DEDUCTION_GUIDES map_tests<boost::unordered_map>(); map_tests<boost::unordered_multimap>(); map_tests<boost::unordered_flat_map>(); map_tests<boost::concurrent_flat_map>(); set_tests<boost::unordered_set>(); set_tests<boost::unordered_multiset>(); set_tests<boost::unordered_flat_set>(); return boost::report_errors(); #endif }
0
repos/unordered/test
repos/unordered/test/unordered/at_tests.cpp
// Copyright 2007-2009 Daniel James. // Copyright 2022-2023 Christian Mazakas. // 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) #include "../helpers/unordered.hpp" #include "../helpers/test.hpp" #include <string> namespace at_tests { template <class X> static void at_tests(X*) { BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Create Map" << std::endl; X x; X const& x_const(x); BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Check empty container" << std::endl; try { x.at("one"); BOOST_ERROR("Should have thrown."); } catch (std::out_of_range&) { } try { x_const.at("one"); BOOST_ERROR("Should have thrown."); } catch (std::out_of_range&) { } BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Add elements" << std::endl; x["one"] = 1; x["two"] = 2; BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Check existing elements" << std::endl; BOOST_TEST(x.at("one") == 1); BOOST_TEST(x.at("two") == 2); BOOST_TEST(x_const.at("one") == 1); BOOST_TEST(x_const.at("two") == 2); BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Check missing element" << std::endl; try { x.at("three"); BOOST_ERROR("Should have thrown."); } catch (std::out_of_range&) { } try { x_const.at("three"); BOOST_ERROR("Should have thrown."); } catch (std::out_of_range&) { } BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Finished" << std::endl; } #ifdef BOOST_UNORDERED_FOA_TESTS static boost::unordered_flat_map<std::string, int>* test_map; static boost::unordered_node_map<std::string, int>* test_node_map; // clang-format off UNORDERED_TEST(at_tests, ((test_map)(test_node_map))) // clang-format on #else static boost::unordered_map<std::string, int>* test_map; // clang-format off UNORDERED_TEST(at_tests, ((test_map))) // clang-format on #endif } // namespace at_tests RUN_TESTS()
0
repos/unordered/test
repos/unordered/test/unordered/transparent_tests.cpp
// Copyright 2021 Christian Mazakas. // 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) #include "../helpers/unordered.hpp" #include "../helpers/test.hpp" #include <boost/container_hash/hash.hpp> struct key { int x_; static int count_; key(int x) : x_(x) { ++count_; } key(key const& k) : x_(k.x_) { ++count_; } }; int key::count_; std::ostream& operator<<(std::ostream& os, key const& k) { os << "key { x_: " << k.x_ << " }"; return os; } bool operator==(key const& k, int const x) { return k.x_ == x; } bool operator==(int const x, key const& k) { return k.x_ == x; } struct transparent_hasher { typedef void is_transparent; std::size_t operator()(key const& k) const { return boost::hash<int>()(k.x_); } std::size_t operator()(int const k) const { return boost::hash<int>()(k); } }; struct transparent_key_equal { typedef void is_transparent; bool operator()(key const& k1, key const& k2) const { return k1.x_ == k2.x_; } bool operator()(int const x, key const& k1) const { return k1 == x; } bool operator()(key const& k1, int const x) const { return k1 == x; } }; struct hasher { std::size_t operator()(key const& k) const { return boost::hash<int>()(k.x_); } }; struct key_equal { bool operator()(key const& k1, key const& k2) const { return k1.x_ == k2.x_; } }; void count_reset() { key::count_ = 0; } template <class UnorderedMap> void test_map_transparent_count(UnorderedMap*) { count_reset(); UnorderedMap map; map.insert(std::make_pair(0, 1337)); map.insert(std::make_pair(1, 1338)); map.insert(std::make_pair(2, 1339)); map.insert(std::make_pair(0, 1340)); map.insert(std::make_pair(0, 1341)); map.insert(std::make_pair(0, 1342)); int const expected_key_count = key::count_; std::size_t count = 0; count = map.count(0); BOOST_TEST_EQ(count, map.size() - 2); count = map.count(1); BOOST_TEST_EQ(count, 1u); count = map.count(1337); BOOST_TEST_EQ(count, 0u); BOOST_TEST_EQ(key::count_, expected_key_count); } template <class UnorderedMap> void test_map_non_transparent_count(UnorderedMap*) { count_reset(); UnorderedMap map; map.insert(std::make_pair(0, 1337)); map.insert(std::make_pair(1, 1338)); map.insert(std::make_pair(2, 1339)); map.insert(std::make_pair(0, 1340)); map.insert(std::make_pair(0, 1341)); map.insert(std::make_pair(0, 1342)); int key_count = key::count_; std::size_t count = 0; count = map.count(0); ++key_count; BOOST_TEST_EQ(count, map.size() - 2); BOOST_TEST_EQ(key::count_, key_count); count = map.count(1); ++key_count; BOOST_TEST_EQ(count, 1u); count = map.count(1337); ++key_count; BOOST_TEST_EQ(count, 0u); BOOST_TEST_EQ(key::count_, key_count); } template <class UnorderedSet> void test_set_transparent_count(UnorderedSet*) { count_reset(); UnorderedSet set; set.insert(0); set.insert(1); set.insert(2); set.insert(0); set.insert(0); set.insert(0); int const expected_key_count = key::count_; std::size_t count = 0; count = set.count(0); BOOST_TEST_EQ(count, set.size() - 2); count = set.count(1); BOOST_TEST_EQ(count, 1u); count = set.count(1337); BOOST_TEST_EQ(count, 0u); BOOST_TEST_EQ(key::count_, expected_key_count); } template <class UnorderedSet> void test_set_non_transparent_count(UnorderedSet*) { count_reset(); UnorderedSet set; set.insert(0); set.insert(1); set.insert(2); set.insert(0); set.insert(0); set.insert(0); int key_count = key::count_; std::size_t count = 0; count = set.count(0); ++key_count; BOOST_TEST_EQ(count, set.size() - 2); BOOST_TEST_EQ(key::count_, key_count); count = set.count(1); ++key_count; BOOST_TEST_EQ(count, 1u); count = set.count(1337); ++key_count; BOOST_TEST_EQ(count, 0u); BOOST_TEST_EQ(key::count_, key_count); } template <class UnorderedMap> void test_map_transparent_find(UnorderedMap*) { count_reset(); typedef typename UnorderedMap::const_iterator map_iterator; typedef typename UnorderedMap::value_type pair; UnorderedMap map; int n = 5; for (int i = 0; i < n; ++i) { map.insert(std::make_pair(i, i)); } int const expected_key_count = key::count_; // explicitly test `find()` and `find() const` separately // { UnorderedMap& m = map; for (int i = 0; i < n; ++i) { map_iterator pos = m.find(i); BOOST_TEST(pos != m.end()); pair const& p = *pos; int const v = p.second; BOOST_TEST_EQ(v, i); } BOOST_TEST_EQ(key::count_, expected_key_count); map_iterator pos = m.find(1337); BOOST_TEST(pos == m.end()); BOOST_TEST_EQ(key::count_, expected_key_count); } { UnorderedMap const& m = map; for (int i = 0; i < n; ++i) { map_iterator pos = m.find(i); BOOST_TEST(pos != m.end()); pair const& p = *pos; int const v = p.second; BOOST_TEST(v == i); } BOOST_TEST_EQ(key::count_, expected_key_count); map_iterator pos = m.find(1337); BOOST_TEST(pos == m.end()); BOOST_TEST_EQ(key::count_, expected_key_count); } } template <class UnorderedMap> void test_map_non_transparent_find(UnorderedMap*) { count_reset(); typedef typename UnorderedMap::const_iterator map_iterator; typedef typename UnorderedMap::value_type pair; UnorderedMap map; int n = 5; for (int i = 0; i < n; ++i) { map.insert(std::make_pair(i, i)); } int key_count = key::count_; // explicitly test `find()` and `find() const` separately // { UnorderedMap& m = map; for (int i = 0; i < n; ++i) { map_iterator pos = m.find(i); BOOST_TEST(pos != m.end()); pair const& p = *pos; int const v = p.second; BOOST_TEST_EQ(v, i); } BOOST_TEST_EQ(key::count_, n + key_count); map_iterator pos = m.find(1337); BOOST_TEST(pos == m.end()); BOOST_TEST_EQ(key::count_, 1 + n + key_count); key_count = key::count_; } { UnorderedMap const& m = map; for (int i = 0; i < n; ++i) { map_iterator pos = m.find(i); BOOST_TEST(pos != m.end()); pair const& p = *pos; int const v = p.second; BOOST_TEST_EQ(v, i); } BOOST_TEST_EQ(key::count_, n + key_count); map_iterator pos = m.find(1337); BOOST_TEST(pos == m.end()); BOOST_TEST_EQ(key::count_, 1 + n + key_count); } } template <class UnorderedSet> void test_set_transparent_find(UnorderedSet*) { count_reset(); typedef typename UnorderedSet::const_iterator set_iterator; UnorderedSet set; int n = 5; for (int i = 0; i < n; ++i) { set.insert(i); } int const expected_key_count = key::count_; // explicitly test `find()` and `find() const` separately // { UnorderedSet& m = set; for (int i = 0; i < n; ++i) { set_iterator pos = m.find(i); BOOST_TEST(pos != m.end()); BOOST_TEST_EQ(*pos, i); } BOOST_TEST_EQ(key::count_, expected_key_count); set_iterator pos = m.find(1337); BOOST_TEST(pos == m.end()); BOOST_TEST_EQ(key::count_, expected_key_count); } { UnorderedSet const& m = set; for (int i = 0; i < n; ++i) { set_iterator pos = m.find(i); BOOST_TEST(pos != m.end()); BOOST_TEST_EQ(*pos, i); } BOOST_TEST_EQ(key::count_, expected_key_count); set_iterator pos = m.find(1337); BOOST_TEST(pos == m.end()); BOOST_TEST_EQ(key::count_, expected_key_count); } } template <class UnorderedSet> void test_set_non_transparent_find(UnorderedSet*) { count_reset(); typedef typename UnorderedSet::const_iterator set_iterator; UnorderedSet set; int n = 5; for (int i = 0; i < n; ++i) { set.insert(i); } int key_count = key::count_; // explicitly test `find()` and `find() const` separately // { UnorderedSet& m = set; for (int i = 0; i < n; ++i) { set_iterator pos = m.find(i); ++key_count; BOOST_TEST(pos != m.end()); BOOST_TEST_EQ(*pos, i); } BOOST_TEST_EQ(key::count_, key_count); set_iterator pos = m.find(1337); ++key_count; BOOST_TEST(pos == m.end()); BOOST_TEST_EQ(key::count_, key_count); } { UnorderedSet const& m = set; for (int i = 0; i < n; ++i) { set_iterator pos = m.find(i); ++key_count; BOOST_TEST(pos != m.end()); BOOST_TEST_EQ(*pos, i); } BOOST_TEST_EQ(key::count_, key_count); set_iterator pos = m.find(1337); ++key_count; BOOST_TEST(pos == m.end()); BOOST_TEST_EQ(key::count_, key_count); } } template <class UnorderedMap> void test_map_transparent_equal_range(UnorderedMap*) { count_reset(); UnorderedMap unordered_map; // empty tests // // explicitly test `equal_range()` vs `equal_range() const` // { typedef typename UnorderedMap::iterator iterator; typedef std::pair<iterator, iterator> iterator_pair; UnorderedMap& map = unordered_map; BOOST_TEST(map.empty()); iterator_pair iters = map.equal_range(0); iterator begin = iters.first; iterator end = iters.second; BOOST_TEST(begin == end); BOOST_TEST(begin == map.end()); BOOST_TEST_EQ(std::distance(begin, end), 0); } { typedef typename UnorderedMap::const_iterator iterator; typedef std::pair<iterator, iterator> iterator_pair; UnorderedMap const& map = unordered_map; BOOST_TEST(map.empty()); iterator_pair iters = map.equal_range(0); iterator begin = iters.first; iterator end = iters.second; BOOST_TEST(begin == end); BOOST_TEST(begin == map.end()); BOOST_TEST_EQ(std::distance(begin, end), 0); } BOOST_TEST_EQ(key::count_, 0); unordered_map.insert(std::make_pair(0, 1337)); unordered_map.insert(std::make_pair(1, 1338)); unordered_map.insert(std::make_pair(2, 1339)); unordered_map.insert(std::make_pair(0, 1340)); unordered_map.insert(std::make_pair(0, 1341)); unordered_map.insert(std::make_pair(0, 1342)); int const expected_key_count = key::count_; // do this so that multimap tests actually test a range with len > 1 // int const expected_range_len = static_cast<int>(unordered_map.size() - 2); typedef typename UnorderedMap::value_type value_type; // explicitly test `equal_range()` vs `equal_range() const` // { typedef typename UnorderedMap::iterator iterator; typedef std::pair<iterator, iterator> iterator_pair; UnorderedMap& map = unordered_map; iterator_pair iters = map.equal_range(0); iterator begin = iters.first; iterator end = iters.second; BOOST_TEST(begin != end); BOOST_TEST(begin != map.end()); BOOST_TEST_EQ(std::distance(begin, end), expected_range_len); for (iterator pos = begin; pos != end; ++pos) { value_type const& val = *pos; BOOST_TEST_EQ(val.first.x_, 0); } iters = map.equal_range(1); begin = iters.first; end = iters.second; BOOST_TEST(begin != end); BOOST_TEST(begin != map.end()); BOOST_TEST_EQ(std::distance(begin, end), 1); value_type const& val = *begin; BOOST_TEST_EQ(val.first, 1); BOOST_TEST_EQ(val.second, 1338); iters = map.equal_range(1337); begin = iters.first; end = iters.second; BOOST_TEST(begin == end); BOOST_TEST(begin == map.end()); BOOST_TEST_EQ(std::distance(begin, end), 0); BOOST_TEST_EQ(key::count_, expected_key_count); } { typedef typename UnorderedMap::const_iterator iterator; typedef std::pair<iterator, iterator> iterator_pair; UnorderedMap const& map = unordered_map; iterator_pair iters = map.equal_range(0); iterator begin = iters.first; iterator end = iters.second; BOOST_TEST(begin != end); BOOST_TEST(begin != map.end()); BOOST_TEST_EQ(std::distance(begin, end), expected_range_len); for (iterator pos = begin; pos != end; ++pos) { value_type const& val = *begin; BOOST_TEST_EQ(val.first.x_, 0); } iters = map.equal_range(1); begin = iters.first; end = iters.second; BOOST_TEST(begin != end); BOOST_TEST(begin != map.end()); BOOST_TEST_EQ(std::distance(begin, end), 1); value_type const& val = *begin; BOOST_TEST_EQ(val.first, 1); BOOST_TEST_EQ(val.second, 1338); iters = map.equal_range(1337); begin = iters.first; end = iters.second; BOOST_TEST(begin == end); BOOST_TEST(begin == map.end()); BOOST_TEST_EQ(std::distance(begin, end), 0); BOOST_TEST_EQ(key::count_, expected_key_count); } } template <class UnorderedMap> void test_map_non_transparent_equal_range(UnorderedMap*) { count_reset(); UnorderedMap unordered_map; // empty tests // // explicitly test `equal_range()` vs `equal_range() const` // { typedef typename UnorderedMap::iterator iterator; typedef std::pair<iterator, iterator> iterator_pair; UnorderedMap& map = unordered_map; BOOST_TEST(map.empty()); iterator_pair iters = map.equal_range(0); iterator begin = iters.first; iterator end = iters.second; BOOST_TEST(begin == end); BOOST_TEST(begin == map.end()); BOOST_TEST_EQ(std::distance(begin, end), 0); } { typedef typename UnorderedMap::const_iterator iterator; typedef std::pair<iterator, iterator> iterator_pair; UnorderedMap const& map = unordered_map; BOOST_TEST(map.empty()); iterator_pair iters = map.equal_range(0); iterator begin = iters.first; iterator end = iters.second; BOOST_TEST(begin == end); BOOST_TEST(begin == map.end()); BOOST_TEST_EQ(std::distance(begin, end), 0); } BOOST_TEST_EQ(key::count_, 2); unordered_map.insert(std::make_pair(0, 1337)); unordered_map.insert(std::make_pair(1, 1338)); unordered_map.insert(std::make_pair(2, 1339)); unordered_map.insert(std::make_pair(0, 1340)); unordered_map.insert(std::make_pair(0, 1341)); unordered_map.insert(std::make_pair(0, 1342)); int key_count = key::count_; // do this so that multimap tests actually test a range with len > 1 // int const expected_range_len = static_cast<int>(unordered_map.size() - 2); typedef typename UnorderedMap::value_type value_type; // explicitly test `equal_range()` vs `equal_range() const` // { typedef typename UnorderedMap::iterator iterator; typedef std::pair<iterator, iterator> iterator_pair; UnorderedMap& map = unordered_map; iterator_pair iters = map.equal_range(0); iterator begin = iters.first; iterator end = iters.second; BOOST_TEST(begin != end); BOOST_TEST(begin != map.end()); BOOST_TEST_EQ(std::distance(begin, end), expected_range_len); for (iterator pos = begin; pos != end; ++pos) { value_type const& val = *begin; BOOST_TEST_EQ(val.first.x_, 0); } iters = map.equal_range(1); begin = iters.first; end = iters.second; BOOST_TEST(begin != end); BOOST_TEST(begin != map.end()); BOOST_TEST_EQ(std::distance(begin, end), 1); value_type const& val = *begin; BOOST_TEST_EQ(val.first, 1); BOOST_TEST_EQ(val.second, 1338); iters = map.equal_range(1337); begin = iters.first; end = iters.second; BOOST_TEST(begin == end); BOOST_TEST(begin == map.end()); BOOST_TEST_EQ(std::distance(begin, end), 0); BOOST_TEST_EQ(key::count_, 3 + key_count); key_count += 3; } { typedef typename UnorderedMap::const_iterator iterator; typedef std::pair<iterator, iterator> iterator_pair; UnorderedMap const& map = unordered_map; iterator_pair iters = map.equal_range(0); iterator begin = iters.first; iterator end = iters.second; BOOST_TEST(begin != end); BOOST_TEST(begin != map.end()); BOOST_TEST_EQ(std::distance(begin, end), expected_range_len); for (iterator pos = begin; pos != end; ++pos) { value_type const& val = *pos; BOOST_TEST_EQ(val.first.x_, 0); } iters = map.equal_range(1); begin = iters.first; end = iters.second; BOOST_TEST(begin != end); BOOST_TEST(begin != map.end()); BOOST_TEST_EQ(std::distance(begin, end), 1); value_type const& val = *begin; BOOST_TEST_EQ(val.first, 1); BOOST_TEST_EQ(val.second, 1338); iters = map.equal_range(1337); begin = iters.first; end = iters.second; BOOST_TEST(begin == end); BOOST_TEST(begin == map.end()); BOOST_TEST_EQ(std::distance(begin, end), 0); BOOST_TEST_EQ(key::count_, 3 + key_count); } } template <class UnorderedSet> void test_set_transparent_equal_range(UnorderedSet*) { count_reset(); UnorderedSet unordered_set; // empty tests // // explicitly test `equal_range()` vs `equal_range() const` // { typedef typename UnorderedSet::iterator iterator; typedef std::pair<iterator, iterator> iterator_pair; UnorderedSet& set = unordered_set; BOOST_TEST(set.empty()); iterator_pair iters = set.equal_range(0); iterator begin = iters.first; iterator end = iters.second; BOOST_TEST(begin == end); BOOST_TEST(begin == set.end()); BOOST_TEST_EQ(std::distance(begin, end), 0); } { typedef typename UnorderedSet::const_iterator iterator; typedef std::pair<iterator, iterator> iterator_pair; UnorderedSet const& set = unordered_set; BOOST_TEST(set.empty()); iterator_pair iters = set.equal_range(0); iterator begin = iters.first; iterator end = iters.second; BOOST_TEST(begin == end); BOOST_TEST(begin == set.end()); BOOST_TEST_EQ(std::distance(begin, end), 0); } BOOST_TEST_EQ(key::count_, 0); unordered_set.insert(0); unordered_set.insert(1); unordered_set.insert(2); unordered_set.insert(0); unordered_set.insert(0); unordered_set.insert(0); int const expected_key_count = key::count_; // do this so that multiset tests actually test a range with len > 1 // int const expected_range_len = static_cast<int>(unordered_set.size() - 2); typedef typename UnorderedSet::value_type value_type; // explicitly test `equal_range()` vs `equal_range() const` // { typedef typename UnorderedSet::iterator iterator; typedef std::pair<iterator, iterator> iterator_pair; UnorderedSet& set = unordered_set; iterator_pair iters = set.equal_range(0); iterator begin = iters.first; iterator end = iters.second; BOOST_TEST(begin != end); BOOST_TEST(begin != set.end()); BOOST_TEST_EQ(std::distance(begin, end), expected_range_len); for (iterator pos = begin; pos != end; ++pos) { value_type const& val = *pos; BOOST_TEST_EQ(val, 0); } iters = set.equal_range(1); begin = iters.first; end = iters.second; BOOST_TEST(begin != end); BOOST_TEST(begin != set.end()); BOOST_TEST_EQ(std::distance(begin, end), 1); value_type const& val = *begin; BOOST_TEST_EQ(val, 1); iters = set.equal_range(1337); begin = iters.first; end = iters.second; BOOST_TEST(begin == end); BOOST_TEST(begin == set.end()); BOOST_TEST_EQ(std::distance(begin, end), 0); BOOST_TEST_EQ(key::count_, expected_key_count); } { typedef typename UnorderedSet::const_iterator iterator; typedef std::pair<iterator, iterator> iterator_pair; UnorderedSet const& set = unordered_set; iterator_pair iters = set.equal_range(0); iterator begin = iters.first; iterator end = iters.second; BOOST_TEST(begin != end); BOOST_TEST(begin != set.end()); BOOST_TEST_EQ(std::distance(begin, end), expected_range_len); for (iterator pos = begin; pos != end; ++pos) { value_type const& val = *begin; BOOST_TEST_EQ(val, 0); } iters = set.equal_range(1); begin = iters.first; end = iters.second; BOOST_TEST(begin != end); BOOST_TEST(begin != set.end()); BOOST_TEST_EQ(std::distance(begin, end), 1); value_type const& val = *begin; BOOST_TEST_EQ(val, 1); iters = set.equal_range(1337); begin = iters.first; end = iters.second; BOOST_TEST(begin == end); BOOST_TEST(begin == set.end()); BOOST_TEST_EQ(std::distance(begin, end), 0); BOOST_TEST_EQ(key::count_, expected_key_count); } } template <class UnorderedSet> void test_set_non_transparent_equal_range(UnorderedSet*) { count_reset(); UnorderedSet unordered_set; // empty tests // // explicitly test `equal_range()` vs `equal_range() const` // { typedef typename UnorderedSet::iterator iterator; typedef std::pair<iterator, iterator> iterator_pair; UnorderedSet& set = unordered_set; BOOST_TEST(set.empty()); iterator_pair iters = set.equal_range(0); iterator begin = iters.first; iterator end = iters.second; BOOST_TEST(begin == end); BOOST_TEST(begin == set.end()); BOOST_TEST_EQ(std::distance(begin, end), 0); } { typedef typename UnorderedSet::const_iterator iterator; typedef std::pair<iterator, iterator> iterator_pair; UnorderedSet const& set = unordered_set; BOOST_TEST(set.empty()); iterator_pair iters = set.equal_range(0); iterator begin = iters.first; iterator end = iters.second; BOOST_TEST(begin == end); BOOST_TEST(begin == set.end()); BOOST_TEST_EQ(std::distance(begin, end), 0); } BOOST_TEST_EQ(key::count_, 2); unordered_set.insert(0); unordered_set.insert(1); unordered_set.insert(2); unordered_set.insert(0); unordered_set.insert(0); unordered_set.insert(0); int key_count = key::count_; // do this so that multiset tests actually test a range with len > 1 // int const expected_range_len = static_cast<int>(unordered_set.size() - 2); typedef typename UnorderedSet::value_type value_type; // explicitly test `equal_range()` vs `equal_range() const` // { typedef typename UnorderedSet::iterator iterator; typedef std::pair<iterator, iterator> iterator_pair; UnorderedSet& set = unordered_set; iterator_pair iters = set.equal_range(0); iterator begin = iters.first; iterator end = iters.second; BOOST_TEST(begin != end); BOOST_TEST(begin != set.end()); BOOST_TEST_EQ(std::distance(begin, end), expected_range_len); for (iterator pos = begin; pos != end; ++pos) { value_type const& val = *begin; BOOST_TEST_EQ(val, 0); } iters = set.equal_range(1); begin = iters.first; end = iters.second; BOOST_TEST(begin != end); BOOST_TEST(begin != set.end()); BOOST_TEST_EQ(std::distance(begin, end), 1); value_type const& val = *begin; BOOST_TEST_EQ(val, 1); iters = set.equal_range(1337); begin = iters.first; end = iters.second; BOOST_TEST(begin == end); BOOST_TEST(begin == set.end()); BOOST_TEST_EQ(std::distance(begin, end), 0); BOOST_TEST_EQ(key::count_, 3 + key_count); key_count += 3; } { typedef typename UnorderedSet::const_iterator iterator; typedef std::pair<iterator, iterator> iterator_pair; UnorderedSet const& set = unordered_set; iterator_pair iters = set.equal_range(0); iterator begin = iters.first; iterator end = iters.second; BOOST_TEST(begin != end); BOOST_TEST(begin != set.end()); BOOST_TEST_EQ(std::distance(begin, end), expected_range_len); for (iterator pos = begin; pos != end; ++pos) { value_type const& val = *pos; BOOST_TEST_EQ(val, 0); } iters = set.equal_range(1); begin = iters.first; end = iters.second; BOOST_TEST(begin != end); BOOST_TEST(begin != set.end()); BOOST_TEST_EQ(std::distance(begin, end), 1); value_type const& val = *begin; BOOST_TEST_EQ(val, 1); iters = set.equal_range(1337); begin = iters.first; end = iters.second; BOOST_TEST(begin == end); BOOST_TEST(begin == set.end()); BOOST_TEST_EQ(std::distance(begin, end), 0); BOOST_TEST_EQ(key::count_, 3 + key_count); } } template <class UnorderedMap> struct convertible_to_iterator { operator typename UnorderedMap::iterator() { return typename UnorderedMap::iterator(); } }; template <class UnorderedMap> struct convertible_to_const_iterator { operator typename UnorderedMap::const_iterator() { return typename UnorderedMap::const_iterator(); } }; #ifdef BOOST_UNORDERED_FOA_TESTS typedef boost::unordered_flat_map<int, int, transparent_hasher, transparent_key_equal> transparent_unordered_map; #else typedef boost::unordered_map<int, int, transparent_hasher, transparent_key_equal> transparent_unordered_map; #endif // test that in the presence of the member function template `erase()`, we still // invoke the correct iterator overloads when the type is implicitly convertible // transparent_unordered_map::iterator map_erase_overload_compile_test() { convertible_to_iterator<transparent_unordered_map> c; transparent_unordered_map map; transparent_unordered_map::iterator pos = map.begin(); pos = c; return map.erase(c); } transparent_unordered_map::const_iterator map_erase_const_overload_compile_test() { convertible_to_const_iterator<transparent_unordered_map> c; transparent_unordered_map map; transparent_unordered_map::const_iterator pos = map.begin(); pos = c; return map.erase(c); } #ifndef BOOST_UNORDERED_FOA_TESTS typedef boost::unordered_multimap<int, int, transparent_hasher, transparent_key_equal> transparent_unordered_multimap; transparent_unordered_multimap::iterator multimap_erase_overload_compile_test() { convertible_to_iterator<transparent_unordered_multimap> c; transparent_unordered_multimap map; transparent_unordered_multimap::iterator pos = map.begin(); pos = c; return map.erase(c); } transparent_unordered_multimap::const_iterator multimap_erase_const_overload_compile_test() { convertible_to_const_iterator<transparent_unordered_multimap> c; transparent_unordered_multimap map; transparent_unordered_multimap::const_iterator pos = map.begin(); pos = c; return map.erase(c); } #endif template <class UnorderedMap> void test_map_transparent_erase(UnorderedMap*) { count_reset(); UnorderedMap map; std::size_t num_erased = 0; num_erased = map.erase(0); BOOST_TEST(map.empty()); BOOST_TEST_EQ(num_erased, 0u); BOOST_TEST_EQ(key::count_, 0); map.insert(std::make_pair(0, 1337)); map.insert(std::make_pair(1, 1338)); map.insert(std::make_pair(2, 1339)); map.insert(std::make_pair(0, 1340)); map.insert(std::make_pair(0, 1341)); map.insert(std::make_pair(0, 1342)); BOOST_TEST(map.find(0) != map.end()); int const expected_key_count = key::count_; std::size_t const expected_num_erased = map.size() - 2; num_erased = map.erase(0); BOOST_TEST_EQ(num_erased, expected_num_erased); BOOST_TEST_EQ(map.size(), 2u); BOOST_TEST(map.find(0) == map.end()); num_erased = map.erase(1); BOOST_TEST_EQ(num_erased, 1u); BOOST_TEST_EQ(map.size(), 1u); BOOST_TEST(map.find(1) == map.end()); num_erased = map.erase(1337); BOOST_TEST_EQ(num_erased, 0u); BOOST_TEST_EQ(map.size(), 1u); BOOST_TEST_EQ(key::count_, expected_key_count); } template <class UnorderedMap> void test_map_non_transparent_erase(UnorderedMap*) { count_reset(); UnorderedMap map; std::size_t num_erased = 0; num_erased = map.erase(0); BOOST_TEST(map.empty()); BOOST_TEST_EQ(num_erased, 0u); BOOST_TEST_EQ(key::count_, 1); map.insert(std::make_pair(0, 1337)); map.insert(std::make_pair(1, 1338)); map.insert(std::make_pair(2, 1339)); map.insert(std::make_pair(0, 1340)); map.insert(std::make_pair(0, 1341)); map.insert(std::make_pair(0, 1342)); std::size_t const expected_num_erased = map.size() - 2; BOOST_TEST(map.find(0) != map.end()); int key_count = key::count_; num_erased = map.erase(0); ++key_count; BOOST_TEST_EQ(key::count_, key_count); BOOST_TEST_EQ(num_erased, expected_num_erased); BOOST_TEST_EQ(map.size(), 2u); BOOST_TEST(map.find(0) == map.end()); ++key_count; BOOST_TEST_EQ(key::count_, key_count); num_erased = map.erase(1); ++key_count; BOOST_TEST_EQ(num_erased, 1u); BOOST_TEST_EQ(map.size(), 1u); BOOST_TEST(map.find(1) == map.end()); ++key_count; num_erased = map.erase(1337); ++key_count; BOOST_TEST_EQ(num_erased, 0u); BOOST_TEST_EQ(map.size(), 1u); BOOST_TEST_EQ(key::count_, key_count); } #if BOOST_UNORDERED_FOA_TESTS typedef boost::unordered_flat_set<int, transparent_hasher, transparent_key_equal> transparent_unordered_set; #else typedef boost::unordered_set<int, transparent_hasher, transparent_key_equal> transparent_unordered_set; typedef boost::unordered_multiset<int, transparent_hasher, transparent_key_equal> transparent_unordered_multiset; #endif transparent_unordered_set::iterator set_erase_overload_compile_test() { convertible_to_iterator<transparent_unordered_set> c; transparent_unordered_set set; transparent_unordered_set::iterator pos = set.begin(); pos = c; return set.erase(c); } transparent_unordered_set::const_iterator set_erase_const_overload_compile_test() { convertible_to_const_iterator<transparent_unordered_set> c; transparent_unordered_set set; transparent_unordered_set::const_iterator pos = set.begin(); pos = c; return set.erase(c); } #ifndef BOOST_UNORDERED_FOA_TESTS transparent_unordered_multiset::iterator multiset_erase_overload_compile_test() { convertible_to_iterator<transparent_unordered_multiset> c; transparent_unordered_multiset set; transparent_unordered_multiset::iterator pos = set.begin(); pos = c; return set.erase(c); } transparent_unordered_multiset::const_iterator multiset_erase_const_overload_compile_test() { convertible_to_const_iterator<transparent_unordered_multiset> c; transparent_unordered_multiset set; transparent_unordered_multiset::const_iterator pos = set.begin(); pos = c; return set.erase(c); } #endif template <class UnorderedSet> void test_set_transparent_erase(UnorderedSet*) { count_reset(); UnorderedSet set; std::size_t num_erased = 0; num_erased = set.erase(0); BOOST_TEST(set.empty()); BOOST_TEST_EQ(num_erased, 0u); BOOST_TEST_EQ(key::count_, 0); set.insert(0); set.insert(1); set.insert(2); set.insert(0); set.insert(0); set.insert(0); BOOST_TEST(set.find(0) != set.end()); int const expected_key_count = key::count_; std::size_t const expected_num_erased = set.size() - 2; num_erased = set.erase(0); BOOST_TEST_EQ(num_erased, expected_num_erased); BOOST_TEST_EQ(set.size(), 2u); BOOST_TEST(set.find(0) == set.end()); num_erased = set.erase(1); BOOST_TEST_EQ(num_erased, 1u); BOOST_TEST_EQ(set.size(), 1u); BOOST_TEST(set.find(1) == set.end()); num_erased = set.erase(1337); BOOST_TEST_EQ(num_erased, 0u); BOOST_TEST_EQ(set.size(), 1u); BOOST_TEST_EQ(key::count_, expected_key_count); } template <class UnorderedSet> void test_set_non_transparent_erase(UnorderedSet*) { count_reset(); UnorderedSet set; std::size_t num_erased = 0; num_erased = set.erase(0); BOOST_TEST(set.empty()); BOOST_TEST_EQ(num_erased, 0u); BOOST_TEST_EQ(key::count_, 1); set.insert(0); set.insert(1); set.insert(2); set.insert(0); set.insert(0); set.insert(0); std::size_t const expected_num_erased = set.size() - 2; BOOST_TEST(set.find(0) != set.end()); int key_count = key::count_; num_erased = set.erase(0); ++key_count; BOOST_TEST_EQ(key::count_, key_count); BOOST_TEST_EQ(num_erased, expected_num_erased); BOOST_TEST_EQ(set.size(), 2u); BOOST_TEST(set.find(0) == set.end()); ++key_count; BOOST_TEST_EQ(key::count_, key_count); num_erased = set.erase(1); ++key_count; BOOST_TEST_EQ(num_erased, 1u); BOOST_TEST_EQ(set.size(), 1u); BOOST_TEST(set.find(1) == set.end()); ++key_count; num_erased = set.erase(1337); ++key_count; BOOST_TEST_EQ(num_erased, 0u); BOOST_TEST_EQ(set.size(), 1u); BOOST_TEST_EQ(key::count_, key_count); } #ifndef BOOST_UNORDERED_FOA_TESTS // test that in the presence of the member function template `extract()`, we // still invoke the correct iterator overloads when the type is implicitly // convertible // transparent_unordered_map::node_type map_extract_const_overload_compile_test() { convertible_to_const_iterator<transparent_unordered_map> c; transparent_unordered_map map; transparent_unordered_map::const_iterator pos = map.begin(); pos = c; return map.extract(c); } transparent_unordered_multimap::node_type multimap_extract_const_overload_compile_test() { convertible_to_const_iterator<transparent_unordered_multimap> c; transparent_unordered_multimap map; transparent_unordered_multimap::const_iterator pos = map.begin(); pos = c; return map.extract(c); } #endif template <class UnorderedMap> void test_map_transparent_extract(UnorderedMap*) { typedef typename UnorderedMap::node_type node_type; typedef typename UnorderedMap::const_iterator const_iterator; typedef std::pair<const_iterator, const_iterator> const_iterator_pair; count_reset(); UnorderedMap map; node_type nh = map.extract(0); BOOST_TEST(nh.empty()); BOOST_TEST_EQ(key::count_, 0); map.insert(std::make_pair(0, 1337)); map.insert(std::make_pair(1, 1338)); map.insert(std::make_pair(2, 1339)); map.insert(std::make_pair(0, 1340)); map.insert(std::make_pair(0, 1341)); map.insert(std::make_pair(0, 1342)); std::size_t const map_size = map.size(); int const expected_key_count = key::count_; nh = map.extract(0); BOOST_TEST_EQ(map.size(), map_size - 1); BOOST_TEST_EQ(nh.key().x_, 0); const_iterator_pair rng = map.equal_range(0); for (const_iterator pos = rng.first; pos != rng.second; ++pos) { BOOST_TEST_NE(pos->second, nh.mapped()); } nh = map.extract(1337); BOOST_TEST(nh.empty()); BOOST_TEST_EQ(key::count_, expected_key_count); } template <class UnorderedMap> void test_map_non_transparent_extract(UnorderedMap*) { typedef typename UnorderedMap::node_type node_type; typedef typename UnorderedMap::const_iterator const_iterator; typedef std::pair<const_iterator, const_iterator> const_iterator_pair; count_reset(); UnorderedMap map; node_type nh = map.extract(0); BOOST_TEST(nh.empty()); BOOST_TEST_EQ(key::count_, 1); map.insert(std::make_pair(0, 1337)); map.insert(std::make_pair(1, 1338)); map.insert(std::make_pair(2, 1339)); map.insert(std::make_pair(0, 1340)); map.insert(std::make_pair(0, 1341)); map.insert(std::make_pair(0, 1342)); std::size_t const map_size = map.size(); int key_count = key::count_; nh = map.extract(0); ++key_count; BOOST_TEST_EQ(map.size(), map_size - 1); BOOST_TEST_EQ(nh.key().x_, 0); BOOST_TEST_EQ(key::count_, key_count); const_iterator_pair rng = map.equal_range(0); ++key_count; for (const_iterator pos = rng.first; pos != rng.second; ++pos) { BOOST_TEST_NE(pos->second, nh.mapped()); } nh = map.extract(1337); ++key_count; BOOST_TEST(nh.empty()); BOOST_TEST_EQ(key::count_, key_count); } template <class UnorderedMap> void test_map_transparent_try_emplace(UnorderedMap*) { count_reset(); typedef typename UnorderedMap::iterator iterator; UnorderedMap map; map.insert(std::make_pair(0, 1337)); map.insert(std::make_pair(1, 1338)); map.insert(std::make_pair(2, 1339)); map.insert(std::make_pair(0, 1340)); map.insert(std::make_pair(0, 1341)); map.insert(std::make_pair(0, 1342)); int key_count = key::count_; std::pair<iterator, bool> r = map.try_emplace(0, 7331); BOOST_TEST(r.first == map.find(0)); BOOST_TEST_NOT(r.second); BOOST_TEST_EQ(key::count_, key_count); r = map.try_emplace(4, 7331); BOOST_TEST(r.first == map.find(4)); BOOST_TEST(r.second); BOOST_TEST_EQ(key::count_, key_count + 1); key_count = key::count_; iterator p = map.try_emplace(map.cbegin(), 0, 7331); BOOST_TEST(p == map.find(0)); BOOST_TEST_EQ(key::count_, key_count); p = map.try_emplace(map.begin(), 5, 7331); BOOST_TEST(p == map.find(5)); BOOST_TEST_EQ(key::count_, key_count + 1); } template <class UnorderedMap> void test_map_non_transparent_try_emplace(UnorderedMap*) { count_reset(); typedef typename UnorderedMap::iterator iterator; UnorderedMap map; map.insert(std::make_pair(0, 1337)); map.insert(std::make_pair(1, 1338)); map.insert(std::make_pair(2, 1339)); map.insert(std::make_pair(0, 1340)); map.insert(std::make_pair(0, 1341)); map.insert(std::make_pair(0, 1342)); int key_count = key::count_; std::pair<iterator, bool> r = map.try_emplace(0, 7331); BOOST_TEST_EQ(key::count_, key_count + 1); BOOST_TEST(r.first == map.find(0)); BOOST_TEST_NOT(r.second); key_count = key::count_; r = map.try_emplace(4, 7331); BOOST_TEST_EQ(key::count_, key_count + 2); BOOST_TEST(r.first == map.find(4)); BOOST_TEST(r.second); key_count = key::count_; iterator p = map.try_emplace(map.cbegin(), 0, 7331); BOOST_TEST_EQ(key::count_, key_count + 1); BOOST_TEST(p == map.find(0)); key_count = key::count_; p = map.try_emplace(map.begin(), 5, 7331); BOOST_TEST_EQ(key::count_, key_count + 2); BOOST_TEST(p == map.find(5)); } template <class UnorderedMap> void test_map_transparent_insert_or_assign(UnorderedMap*) { count_reset(); typedef typename UnorderedMap::iterator iterator; UnorderedMap map; map.insert(std::make_pair(0, 1337)); map.insert(std::make_pair(1, 1338)); map.insert(std::make_pair(2, 1339)); map.insert(std::make_pair(0, 1340)); map.insert(std::make_pair(0, 1341)); map.insert(std::make_pair(0, 1342)); int key_count = key::count_; std::pair<iterator, bool> r = map.insert_or_assign(0, 7331); BOOST_TEST(r.first == map.find(0)); BOOST_TEST_EQ(r.first->second, 7331); BOOST_TEST_NOT(r.second); BOOST_TEST_EQ(key::count_, key_count); r = map.insert_or_assign(4, 7331); BOOST_TEST(r.first == map.find(4)); BOOST_TEST(r.second); BOOST_TEST_EQ(key::count_, key_count + 1); key_count = key::count_; iterator p = map.insert_or_assign(map.cbegin(), 0, 1111); BOOST_TEST(p == map.find(0)); BOOST_TEST_EQ(p->second, 1111); BOOST_TEST_EQ(key::count_, key_count); p = map.insert_or_assign(map.begin(), 5, 7331); BOOST_TEST(p == map.find(5)); BOOST_TEST_EQ(key::count_, key_count + 1); } template <class UnorderedMap> void test_map_non_transparent_insert_or_assign(UnorderedMap*) { count_reset(); typedef typename UnorderedMap::iterator iterator; UnorderedMap map; map.insert(std::make_pair(0, 1337)); map.insert(std::make_pair(1, 1338)); map.insert(std::make_pair(2, 1339)); map.insert(std::make_pair(0, 1340)); map.insert(std::make_pair(0, 1341)); map.insert(std::make_pair(0, 1342)); int key_count = key::count_; std::pair<iterator, bool> r = map.insert_or_assign(0, 7331); BOOST_TEST_EQ(key::count_, key_count + 1); BOOST_TEST(r.first == map.find(0)); BOOST_TEST_EQ(r.first->second, 7331); BOOST_TEST_NOT(r.second); key_count = key::count_; r = map.insert_or_assign(4, 7331); BOOST_TEST_EQ(key::count_, key_count + 2); BOOST_TEST(r.first == map.find(4)); BOOST_TEST(r.second); key_count = key::count_; iterator p = map.insert_or_assign(map.cbegin(), 0, 1111); BOOST_TEST_EQ(key::count_, key_count + 1); BOOST_TEST(p == map.find(0)); BOOST_TEST_EQ(p->second, 1111); key_count = key::count_; p = map.insert_or_assign(map.begin(), 5, 7331); BOOST_TEST_EQ(key::count_, key_count + 2); BOOST_TEST(p == map.find(5)); } template <class UnorderedMap> void test_map_transparent_subscript(UnorderedMap*) { count_reset(); UnorderedMap map; map[0] = 1337; map[1] = 1338; map[2] = 1339; map[0] = 1340; map[0] = 1341; map[0] = 1342; int key_count = key::count_; map[0] = 7331; BOOST_TEST_EQ(key::count_, key_count); map[4] = 7331; BOOST_TEST_EQ(key::count_, key_count + 1); } template <class UnorderedMap> void test_map_non_transparent_subscript(UnorderedMap*) { count_reset(); UnorderedMap map; map[0] = 1337; map[1] = 1338; map[2] = 1339; map[0] = 1340; map[0] = 1341; map[0] = 1342; int key_count = key::count_; map[0] = 7331; BOOST_TEST_EQ(key::count_, key_count + 1); key_count = key::count_; map[4] = 7331; BOOST_TEST_EQ(key::count_, key_count + 2); } template <class UnorderedMap> void test_map_transparent_at(UnorderedMap*) { count_reset(); UnorderedMap map; map.insert(std::make_pair(0, 1337)); map.insert(std::make_pair(1, 1338)); map.insert(std::make_pair(2, 1339)); map.insert(std::make_pair(0, 1340)); map.insert(std::make_pair(0, 1341)); map.insert(std::make_pair(0, 1342)); int key_count = key::count_; map.at(0) = 7331; BOOST_TEST_EQ(key::count_, key_count); BOOST_TEST_THROWS(map.at(4), std::out_of_range) BOOST_TEST_EQ(key::count_, key_count); UnorderedMap const& m = map; BOOST_TEST_EQ(m.at(0), 7331); BOOST_TEST_EQ(key::count_, key_count); BOOST_TEST_THROWS(m.at(4), std::out_of_range) BOOST_TEST_EQ(key::count_, key_count); } template <class UnorderedMap> void test_map_non_transparent_at(UnorderedMap*) { count_reset(); UnorderedMap map; map.insert(std::make_pair(0, 1337)); map.insert(std::make_pair(1, 1338)); map.insert(std::make_pair(2, 1339)); map.insert(std::make_pair(0, 1340)); map.insert(std::make_pair(0, 1341)); map.insert(std::make_pair(0, 1342)); int key_count = key::count_; map.at(0) = 7331; BOOST_TEST_EQ(key::count_, key_count + 1); key_count = key::count_; BOOST_TEST_THROWS(map.at(4), std::out_of_range) BOOST_TEST_EQ(key::count_, key_count + 1); key_count = key::count_; UnorderedMap const& m = map; BOOST_TEST_EQ(m.at(0), 7331); BOOST_TEST_EQ(key::count_, key_count + 1); key_count = key::count_; BOOST_TEST_THROWS(m.at(4), std::out_of_range) BOOST_TEST_EQ(key::count_, key_count + 1); } template <class UnorderedMap> void test_map_transparent_bucket(UnorderedMap*) { #ifndef BOOST_UNORDERED_FOA_TESTS count_reset(); UnorderedMap map; map.insert(std::make_pair(0, 1337)); map.insert(std::make_pair(1, 1338)); map.insert(std::make_pair(2, 1339)); map.insert(std::make_pair(0, 1340)); map.insert(std::make_pair(0, 1341)); map.insert(std::make_pair(0, 1342)); int key_count = key::count_; map.bucket(0); map.bucket(4); BOOST_TEST_EQ(key::count_, key_count); #endif } template <class UnorderedMap> void test_map_non_transparent_bucket(UnorderedMap*) { #ifndef BOOST_UNORDERED_FOA_TESTS count_reset(); UnorderedMap map; map.insert(std::make_pair(0, 1337)); map.insert(std::make_pair(1, 1338)); map.insert(std::make_pair(2, 1339)); map.insert(std::make_pair(0, 1340)); map.insert(std::make_pair(0, 1341)); map.insert(std::make_pair(0, 1342)); int key_count = key::count_; map.bucket(0); map.bucket(4); BOOST_TEST_EQ(key::count_, key_count + 2); #endif } #ifndef BOOST_UNORDERED_FOA_TESTS transparent_unordered_set::node_type set_extract_overload_compile_test() { convertible_to_iterator<transparent_unordered_set> c; transparent_unordered_set set; transparent_unordered_set::iterator pos = set.begin(); pos = c; return set.extract(c); } transparent_unordered_set::node_type set_extract_const_overload_compile_test() { convertible_to_const_iterator<transparent_unordered_set> c; transparent_unordered_set set; transparent_unordered_set::const_iterator pos = set.begin(); pos = c; return set.extract(c); } transparent_unordered_multiset::node_type multiset_extract_overload_compile_test() { convertible_to_iterator<transparent_unordered_multiset> c; transparent_unordered_multiset set; transparent_unordered_multiset::iterator pos = set.begin(); pos = c; return set.extract(c); } transparent_unordered_multiset::node_type multiset_extract_const_overload_compile_test() { convertible_to_const_iterator<transparent_unordered_multiset> c; transparent_unordered_multiset set; transparent_unordered_multiset::const_iterator pos = set.begin(); pos = c; return set.extract(c); } #endif template <class UnorderedSet> void test_set_transparent_extract(UnorderedSet*) { typedef typename UnorderedSet::node_type node_type; count_reset(); UnorderedSet set; node_type nh = set.extract(0); BOOST_TEST(nh.empty()); BOOST_TEST_EQ(key::count_, 0); set.insert(0); set.insert(1); set.insert(2); set.insert(0); set.insert(0); set.insert(0); std::size_t const set_size = set.size(); int const expected_key_count = key::count_; std::size_t count = 0; nh = set.extract(0); count = set.count(0); BOOST_TEST_EQ(set.size(), set_size - 1); BOOST_TEST_EQ(nh.value(), 0); BOOST_TEST_EQ(count, set_size - 3); set.insert(std::move(nh)); nh = set.extract(1); count = set.count(1); BOOST_TEST_EQ(set.size(), set_size - 1); BOOST_TEST_EQ(nh.value(), 1); BOOST_TEST_EQ(count, 0u); set.insert(std::move(nh)); nh = set.extract(1337); BOOST_TEST(nh.empty()); BOOST_TEST_EQ(set.size(), set_size); BOOST_TEST_EQ(key::count_, expected_key_count); } template <class UnorderedSet> void test_set_non_transparent_extract(UnorderedSet*) { typedef typename UnorderedSet::node_type node_type; count_reset(); UnorderedSet set; node_type nh = set.extract(0); BOOST_TEST(nh.empty()); BOOST_TEST_EQ(key::count_, 1); set.insert(0); set.insert(1); set.insert(2); set.insert(0); set.insert(0); set.insert(0); std::size_t const set_size = set.size(); int key_count = key::count_; std::size_t count = 0; nh = set.extract(0); ++key_count; count = set.count(0); ++key_count; BOOST_TEST_EQ(set.size(), set_size - 1); BOOST_TEST_EQ(nh.value(), 0); BOOST_TEST_EQ(count, set_size - 3); set.insert(std::move(nh)); nh = set.extract(1); ++key_count; count = set.count(1); ++key_count; BOOST_TEST_EQ(set.size(), set_size - 1); BOOST_TEST_EQ(nh.value(), 1); BOOST_TEST_EQ(count, 0u); set.insert(std::move(nh)); nh = set.extract(1337); ++key_count; BOOST_TEST(nh.empty()); BOOST_TEST_EQ(set.size(), set_size); BOOST_TEST_EQ(key::count_, key_count); } template <class UnorderedSet> void test_set_transparent_bucket(UnorderedSet*) { #ifndef BOOST_UNORDERED_FOA_TESTS count_reset(); UnorderedSet set; set.insert(0); set.insert(1); set.insert(2); set.insert(0); set.insert(0); set.insert(0); int key_count = key::count_; set.bucket(0); set.bucket(4); BOOST_TEST_EQ(key::count_, key_count); #endif } template <class UnorderedSet> void test_set_non_transparent_bucket(UnorderedSet*) { #ifndef BOOST_UNORDERED_FOA_TESTS count_reset(); UnorderedSet set; set.insert(0); set.insert(1); set.insert(2); set.insert(0); set.insert(0); set.insert(0); int key_count = key::count_; set.bucket(0); set.bucket(4); BOOST_TEST_EQ(key::count_, key_count + 2); #endif } template <class UnorderedSet> void test_set_transparent_insert(UnorderedSet*) { count_reset(); typedef typename UnorderedSet::iterator iterator; UnorderedSet set; set.insert(0); set.insert(1); set.insert(2); set.insert(0); set.insert(0); set.insert(0); int key_count = key::count_; std::pair<iterator, bool> p = set.insert(0); BOOST_TEST(p.first == set.find(0)); BOOST_TEST_NOT(p.second); BOOST_TEST_EQ(key::count_, key_count); key_count = key::count_; p = set.insert(4); BOOST_TEST(p.first == set.find(4)); BOOST_TEST(p.second); BOOST_TEST_EQ(key::count_, key_count + 1); key_count = key::count_; iterator pos = set.insert(set.begin(), 0); BOOST_TEST(pos == set.find(0)); BOOST_TEST_EQ(key::count_, key_count); key_count = key::count_; pos = set.insert(set.begin(), 5); BOOST_TEST(pos == set.find(5)); BOOST_TEST_EQ(key::count_, key_count + 1); // check for collisions with insert(iterator, iterator) // note: this precludes Key from being convertible to an iterator which isn't // explicitly stated by p2363r3 // set.insert(set.begin(), set.end()); } template <class UnorderedSet> void test_set_non_transparent_insert(UnorderedSet*) { count_reset(); typedef typename UnorderedSet::iterator iterator; UnorderedSet set; set.insert(0); set.insert(1); set.insert(2); set.insert(0); set.insert(0); set.insert(0); int key_count = key::count_; std::pair<iterator, bool> p = set.insert(0); BOOST_TEST_EQ(key::count_, key_count + 1); BOOST_TEST(p.first == set.find(0)); BOOST_TEST_NOT(p.second); key_count = key::count_; p = set.insert(4); BOOST_TEST_EQ(key::count_, key_count + 2); BOOST_TEST(p.first == set.find(4)); BOOST_TEST(p.second); key_count = key::count_; iterator pos = set.insert(set.begin(), 0); BOOST_TEST_EQ(key::count_, key_count + 1); BOOST_TEST(pos == set.find(0)); key_count = key::count_; pos = set.insert(set.begin(), 5); BOOST_TEST_EQ(key::count_, key_count + 2); BOOST_TEST(pos == set.find(5)); set.insert(set.begin(), set.end()); } template <class Key, class T, class Hash, class KeyEqual> struct map_type { #ifdef BOOST_UNORDERED_FOA_TESTS typedef boost::unordered_flat_map<Key, T, Hash, KeyEqual> type; #else typedef boost::unordered_map<Key, T, Hash, KeyEqual> type; #endif }; #ifdef BOOST_UNORDERED_FOA_TESTS static boost::unordered_flat_map<key, int, transparent_hasher, transparent_key_equal>* test_trans_map; static boost::unordered_flat_map<key, int, hasher, key_equal>* test_map1; static boost::unordered_flat_map<key, int, transparent_hasher, key_equal>* test_map2; static boost::unordered_flat_map<key, int, hasher, transparent_key_equal>* test_map3; static boost::unordered_node_map<key, int, transparent_hasher, transparent_key_equal>* test_trans_node_map; static boost::unordered_node_map<key, int, hasher, key_equal>* test_node_map1; static boost::unordered_node_map<key, int, transparent_hasher, key_equal>* test_node_map2; static boost::unordered_node_map<key, int, hasher, transparent_key_equal>* test_node_map3; // clang-format off UNORDERED_TEST(test_map_transparent_count, ((test_trans_map)(test_trans_node_map))) UNORDERED_TEST(test_map_transparent_find, ((test_trans_map)(test_trans_node_map))) UNORDERED_TEST(test_map_transparent_equal_range, ((test_trans_map)(test_trans_node_map))) UNORDERED_TEST(test_map_transparent_erase, ((test_trans_map)(test_trans_node_map))) UNORDERED_TEST(test_map_transparent_extract, ((test_trans_node_map))) UNORDERED_TEST(test_map_transparent_try_emplace, ((test_trans_map)(test_trans_node_map))) UNORDERED_TEST(test_map_transparent_insert_or_assign, ((test_trans_map)(test_trans_node_map))) UNORDERED_TEST(test_map_transparent_subscript, ((test_trans_map)(test_trans_node_map))) UNORDERED_TEST(test_map_transparent_at, ((test_trans_map)(test_trans_node_map))) UNORDERED_TEST(test_map_transparent_bucket, ((test_trans_map)(test_trans_node_map))) UNORDERED_TEST(test_map_non_transparent_count, ((test_map1)(test_map2)(test_map3) (test_node_map1)(test_node_map2)(test_node_map3))) UNORDERED_TEST(test_map_non_transparent_find, ((test_map1)(test_map2)(test_map3) (test_node_map1)(test_node_map2)(test_node_map3))) UNORDERED_TEST(test_map_non_transparent_equal_range, ((test_map1)(test_map2)(test_map3) (test_node_map1)(test_node_map2)(test_node_map3))) UNORDERED_TEST(test_map_non_transparent_erase, ((test_map1)(test_map2)(test_map3) (test_node_map1)(test_node_map2)(test_node_map3))) UNORDERED_TEST(test_map_non_transparent_extract, ((test_node_map1)(test_node_map2)(test_node_map3))) UNORDERED_TEST(test_map_non_transparent_try_emplace, ((test_map1)(test_map2)(test_map3) (test_node_map1)(test_node_map2)(test_node_map3))) UNORDERED_TEST(test_map_non_transparent_insert_or_assign, ((test_map1)(test_map2)(test_map3) (test_node_map1)(test_node_map2)(test_node_map3))) UNORDERED_TEST(test_map_non_transparent_subscript, ((test_map1)(test_map2)(test_map3) (test_node_map1)(test_node_map2)(test_node_map3))) UNORDERED_TEST(test_map_non_transparent_at, ((test_map1)(test_map2)(test_map3) (test_node_map1)(test_node_map2)(test_node_map3))) UNORDERED_TEST(test_map_non_transparent_bucket, ((test_map1)(test_map2)(test_map3) (test_node_map1)(test_node_map2)(test_node_map3))) // clang-format on #else static boost::unordered_map<key, int, transparent_hasher, transparent_key_equal>* test_trans_map; static boost::unordered_map<key, int, hasher, key_equal>* test_map1; static boost::unordered_map<key, int, transparent_hasher, key_equal>* test_map2; static boost::unordered_map<key, int, hasher, transparent_key_equal>* test_map3; static boost::unordered_multimap<key, int, transparent_hasher, transparent_key_equal>* test_trans_multimap; static boost::unordered_multimap<key, int, hasher, key_equal>* test_multimap1; static boost::unordered_multimap<key, int, transparent_hasher, key_equal>* test_multimap2; static boost::unordered_multimap<key, int, hasher, transparent_key_equal>* test_multimap3; // clang-format off UNORDERED_TEST(test_map_transparent_count, ((test_trans_map)(test_trans_multimap))) UNORDERED_TEST(test_map_transparent_find, ((test_trans_map)(test_trans_multimap))) UNORDERED_TEST(test_map_transparent_equal_range, ((test_trans_map)(test_trans_multimap))) UNORDERED_TEST(test_map_transparent_erase, ((test_trans_map)(test_trans_multimap))) UNORDERED_TEST(test_map_transparent_extract, ((test_trans_map)(test_trans_multimap))) UNORDERED_TEST(test_map_transparent_try_emplace, ((test_trans_map))) UNORDERED_TEST(test_map_transparent_insert_or_assign, ((test_trans_map))) UNORDERED_TEST(test_map_transparent_subscript, ((test_trans_map))) UNORDERED_TEST(test_map_transparent_at, ((test_trans_map))) UNORDERED_TEST(test_map_transparent_bucket, ((test_trans_map)(test_trans_multimap))) UNORDERED_TEST(test_map_non_transparent_count, ((test_map1)(test_map2)(test_map3) (test_multimap1)(test_multimap2)(test_multimap3))) UNORDERED_TEST(test_map_non_transparent_find, ((test_map1)(test_map2)(test_map3) (test_multimap1)(test_multimap2)(test_multimap3))) UNORDERED_TEST(test_map_non_transparent_equal_range, ((test_map1)(test_map2)(test_map3) (test_multimap1)(test_multimap2)(test_multimap3))) UNORDERED_TEST(test_map_non_transparent_erase, ((test_map1)(test_map2)(test_map3) (test_multimap1)(test_multimap2)(test_multimap3))) UNORDERED_TEST(test_map_non_transparent_extract, ((test_map1)(test_map2)(test_map3) (test_multimap1)(test_multimap2)(test_multimap3))) UNORDERED_TEST(test_map_non_transparent_try_emplace, ((test_map1)(test_map2)(test_map3))) UNORDERED_TEST(test_map_non_transparent_insert_or_assign, ((test_map1)(test_map2)(test_map3))) UNORDERED_TEST(test_map_non_transparent_subscript, ((test_map1)(test_map2)(test_map3))) UNORDERED_TEST(test_map_non_transparent_at, ((test_map1)(test_map2)(test_map3))) UNORDERED_TEST(test_map_non_transparent_bucket, ((test_map1)(test_map2)(test_map3) (test_multimap1)(test_multimap2)(test_multimap3))) // clang-format on #endif #ifdef BOOST_UNORDERED_FOA_TESTS static boost::unordered_flat_set<key, transparent_hasher, transparent_key_equal>* test_trans_set; static boost::unordered_node_set<key, transparent_hasher, transparent_key_equal>* test_trans_node_set; static boost::unordered_flat_set<key, hasher, key_equal>* test_set1; static boost::unordered_flat_set<key, transparent_hasher, key_equal>* test_set2; static boost::unordered_flat_set<key, hasher, transparent_key_equal>* test_set3; static boost::unordered_node_set<key, hasher, key_equal>* test_node_set1; static boost::unordered_node_set<key, transparent_hasher, key_equal>* test_node_set2; static boost::unordered_node_set<key, hasher, transparent_key_equal>* test_node_set3; // clang-format off UNORDERED_TEST(test_set_transparent_count, ((test_trans_set)(test_trans_node_set))) UNORDERED_TEST(test_set_transparent_find, ((test_trans_set)(test_trans_node_set))) UNORDERED_TEST(test_set_transparent_erase, ((test_trans_set)(test_trans_node_set))) UNORDERED_TEST(test_set_transparent_equal_range, ((test_trans_set)(test_trans_node_set))) UNORDERED_TEST(test_set_transparent_extract, ((test_trans_node_set))) UNORDERED_TEST(test_set_transparent_bucket, ((test_trans_set)(test_trans_node_set))) UNORDERED_TEST(test_set_transparent_insert, ((test_trans_set)(test_trans_node_set))) UNORDERED_TEST(test_set_non_transparent_count, ((test_set1)(test_set2)(test_set3) (test_node_set1)(test_node_set2)(test_node_set3))) UNORDERED_TEST(test_set_non_transparent_find, ((test_set1)(test_set2)(test_set3) (test_node_set1)(test_node_set2)(test_node_set3))) UNORDERED_TEST(test_set_non_transparent_erase, ((test_set1)(test_set2)(test_set3) (test_node_set1)(test_node_set2)(test_node_set3))) UNORDERED_TEST(test_set_non_transparent_equal_range, ((test_set1)(test_set2)(test_set3) (test_node_set1)(test_node_set2)(test_node_set3))) UNORDERED_TEST(test_set_non_transparent_extract, ((test_node_set1)(test_node_set2)(test_node_set3))) UNORDERED_TEST(test_set_non_transparent_bucket, ((test_set1)(test_set2)(test_set3) (test_node_set1)(test_node_set2)(test_node_set3))) UNORDERED_TEST(test_set_non_transparent_insert, ((test_set1)(test_set2)(test_set3) (test_node_set1)(test_node_set2)(test_node_set3))) // clang-format on #else static boost::unordered_set<key, transparent_hasher, transparent_key_equal>* test_trans_set; static boost::unordered_multiset<key, transparent_hasher, transparent_key_equal>* test_trans_multiset; static boost::unordered_set<key, hasher, key_equal>* test_set1; static boost::unordered_set<key, transparent_hasher, key_equal>* test_set2; static boost::unordered_set<key, hasher, transparent_key_equal>* test_set3; static boost::unordered_multiset<key, hasher, key_equal>* test_multiset1; static boost::unordered_multiset<key, transparent_hasher, key_equal>* test_multiset2; static boost::unordered_multiset<key, hasher, transparent_key_equal>* test_multiset3; // clang-format off UNORDERED_TEST(test_set_transparent_count, ((test_trans_set)(test_trans_multiset))) UNORDERED_TEST(test_set_transparent_find, ((test_trans_set)(test_trans_multiset))) UNORDERED_TEST(test_set_transparent_erase, ((test_trans_set)(test_trans_multiset))) UNORDERED_TEST(test_set_transparent_equal_range, ((test_trans_set)(test_trans_multiset))) UNORDERED_TEST(test_set_transparent_extract, ((test_trans_set)(test_trans_multiset))) UNORDERED_TEST(test_set_transparent_bucket, ((test_trans_set)(test_trans_multiset))) UNORDERED_TEST(test_set_transparent_insert, ((test_trans_set))) UNORDERED_TEST(test_set_non_transparent_count, ((test_set1)(test_set2)(test_set3) (test_multiset1)(test_multiset2)(test_multiset3))) UNORDERED_TEST(test_set_non_transparent_find, ((test_set1)(test_set2)(test_set3) (test_multiset1)(test_multiset2)(test_multiset3))) UNORDERED_TEST(test_set_non_transparent_erase, ((test_set1)(test_set2)(test_set3) (test_multiset1)(test_multiset2)(test_multiset3))) UNORDERED_TEST(test_set_non_transparent_equal_range, ((test_set1)(test_set2)(test_set3) (test_multiset1)(test_multiset2)(test_multiset3))) UNORDERED_TEST(test_set_non_transparent_extract, ((test_set1)(test_set2)(test_set3) (test_multiset1)(test_multiset2)(test_multiset3))) UNORDERED_TEST(test_set_non_transparent_bucket, ((test_set1)(test_set2)(test_set3) (test_multiset1)(test_multiset2)(test_multiset3))) UNORDERED_TEST(test_set_non_transparent_insert, ((test_set1)(test_set2)(test_set3))) // clang-format on #endif RUN_TESTS()
0
repos/unordered/test
repos/unordered/test/unordered/constructor_tests.cpp
// Copyright 2006-2010 Daniel James. // Copyright (C) 2022-2023 Christian Mazakas // 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) #include "../helpers/unordered.hpp" #include "../helpers/equivalent.hpp" #include "../helpers/input_iterator.hpp" #include "../helpers/invariants.hpp" #include "../helpers/random_values.hpp" #include "../helpers/test.hpp" #include "../helpers/tracker.hpp" #include "../objects/test.hpp" #include <vector> namespace constructor_tests { test::seed_t initialize_seed(356730); template <class T> void constructor_tests1(T*, test::random_generator generator) { typename T::hasher hf; typename T::key_equal eq; typename T::allocator_type al; UNORDERED_SUB_TEST("Construct 1") { test::check_instances check_; T x(0, hf, eq); BOOST_TEST(x.empty()); BOOST_TEST(test::equivalent(x.hash_function(), hf)); BOOST_TEST(test::equivalent(x.key_eq(), eq)); BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_equivalent_keys(x); } UNORDERED_SUB_TEST("Construct 2") { test::check_instances check_; T x(100, hf); BOOST_TEST(x.empty()); BOOST_TEST(x.bucket_count() >= 100); BOOST_TEST(test::equivalent(x.hash_function(), hf)); BOOST_TEST(test::equivalent(x.key_eq(), eq)); BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_equivalent_keys(x); } UNORDERED_SUB_TEST("Construct 3") { test::check_instances check_; T x(2000); BOOST_TEST(x.empty()); BOOST_TEST(x.bucket_count() >= 2000); BOOST_TEST(test::equivalent(x.hash_function(), hf)); BOOST_TEST(test::equivalent(x.key_eq(), eq)); BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_equivalent_keys(x); } UNORDERED_SUB_TEST("Construct 4") { test::check_instances check_; T x; BOOST_TEST(x.empty()); BOOST_TEST(test::equivalent(x.hash_function(), hf)); BOOST_TEST(test::equivalent(x.key_eq(), eq)); BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_equivalent_keys(x); } UNORDERED_SUB_TEST("Construct 5") { test::check_instances check_; test::random_values<T> v(1000, generator); T x(v.begin(), v.end(), 10000, hf, eq); BOOST_TEST(x.bucket_count() >= 10000); BOOST_TEST(test::equivalent(x.hash_function(), hf)); BOOST_TEST(test::equivalent(x.key_eq(), eq)); BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_container(x, v); test::check_equivalent_keys(x); } UNORDERED_SUB_TEST("Construct 6") { test::check_instances check_; test::random_values<T> v(10, generator); T x(v.begin(), v.end(), 10000, hf); BOOST_TEST(x.bucket_count() >= 10000); BOOST_TEST(test::equivalent(x.hash_function(), hf)); BOOST_TEST(test::equivalent(x.key_eq(), eq)); BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_container(x, v); test::check_equivalent_keys(x); } UNORDERED_SUB_TEST("Construct 7") { test::check_instances check_; test::random_values<T> v(100, generator); T x(v.begin(), v.end(), 100); BOOST_TEST(x.bucket_count() >= 100); BOOST_TEST(test::equivalent(x.hash_function(), hf)); BOOST_TEST(test::equivalent(x.key_eq(), eq)); BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_container(x, v); test::check_equivalent_keys(x); } UNORDERED_SUB_TEST("Construct 8") { test::check_instances check_; test::random_values<T> v(1, generator); T x(v.begin(), v.end()); BOOST_TEST(test::equivalent(x.hash_function(), hf)); BOOST_TEST(test::equivalent(x.key_eq(), eq)); BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_container(x, v); test::check_equivalent_keys(x); } UNORDERED_SUB_TEST("Construct 9") { test::check_instances check_; T x(0, hf, eq, al); BOOST_TEST(x.empty()); BOOST_TEST(test::equivalent(x.hash_function(), hf)); BOOST_TEST(test::equivalent(x.key_eq(), eq)); BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_equivalent_keys(x); } UNORDERED_SUB_TEST("Construct 10") { test::check_instances check_; test::random_values<T> v(1000, generator); T x(v.begin(), v.end(), 10000, hf, eq, al); BOOST_TEST(x.bucket_count() >= 10000); BOOST_TEST(test::equivalent(x.hash_function(), hf)); BOOST_TEST(test::equivalent(x.key_eq(), eq)); BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_container(x, v); test::check_equivalent_keys(x); } UNORDERED_SUB_TEST("Construct 11") { test::check_instances check_; T x(al); BOOST_TEST(x.empty()); BOOST_TEST(test::equivalent(x.hash_function(), hf)); BOOST_TEST(test::equivalent(x.key_eq(), eq)); BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_equivalent_keys(x); } UNORDERED_SUB_TEST("Construct 12") { test::check_instances check_; test::random_values<T> v(1000, generator); T x(v.begin(), v.end(), al); BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_container(x, v); } } template <class T> void constructor_tests2(T*, test::random_generator const& generator) { typename T::hasher hf; typename T::hasher hf1(1); typename T::hasher hf2(2); typename T::key_equal eq; typename T::key_equal eq1(1); typename T::key_equal eq2(2); typename T::allocator_type al; typename T::allocator_type al1(1); typename T::allocator_type al2(2); UNORDERED_SUB_TEST("Construct 1") { test::check_instances check_; T x(10000, hf1, eq1); BOOST_TEST(x.bucket_count() >= 10000); BOOST_TEST(test::equivalent(x.hash_function(), hf1)); BOOST_TEST(test::equivalent(x.key_eq(), eq1)); BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_equivalent_keys(x); } UNORDERED_SUB_TEST("Construct 2") { test::check_instances check_; T x(100, hf1); BOOST_TEST(x.empty()); BOOST_TEST(x.bucket_count() >= 100); BOOST_TEST(test::equivalent(x.hash_function(), hf1)); BOOST_TEST(test::equivalent(x.key_eq(), eq)); BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_equivalent_keys(x); } UNORDERED_SUB_TEST("Construct 3") { test::check_instances check_; test::random_values<T> v(100, generator); T x(v.begin(), v.end(), 0, hf1, eq1); BOOST_TEST(test::equivalent(x.hash_function(), hf1)); BOOST_TEST(test::equivalent(x.key_eq(), eq1)); BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_container(x, v); test::check_equivalent_keys(x); } UNORDERED_SUB_TEST("Construct 4") { test::check_instances check_; test::random_values<T> v(5, generator); T x(v.begin(), v.end(), 1000, hf1); BOOST_TEST(x.bucket_count() >= 1000); BOOST_TEST(test::equivalent(x.hash_function(), hf1)); BOOST_TEST(test::equivalent(x.key_eq(), eq)); BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_container(x, v); test::check_equivalent_keys(x); } UNORDERED_SUB_TEST("Construct 5") { test::check_instances check_; test::random_values<T> v(100, generator); T x(v.begin(), v.end(), 0, hf, eq, al1); T y(x.begin(), x.end(), 0, hf1, eq1, al2); test::check_container(x, v); test::check_container(y, x); test::check_equivalent_keys(x); test::check_equivalent_keys(y); } UNORDERED_SUB_TEST("Construct 6") { test::check_instances check_; test::random_values<T> v(100, generator); T x(v.begin(), v.end(), 0, hf1, eq1); T y(x.begin(), x.end(), 0, hf, eq); test::check_container(x, v); test::check_container(y, x); test::check_equivalent_keys(x); test::check_equivalent_keys(y); } UNORDERED_SUB_TEST("Construct 7") { test::check_instances check_; test::random_values<T> v(100, generator); T x(v.begin(), v.end(), 0, hf1, eq1); T y(x.begin(), x.end(), 0, hf2, eq2); test::check_container(x, v); test::check_container(y, x); test::check_equivalent_keys(x); test::check_equivalent_keys(y); } UNORDERED_SUB_TEST("Construct 8 - from input iterator") { test::check_instances check_; test::random_values<T> v(100, generator); typename test::random_values<T>::const_iterator v_begin = v.begin(), v_end = v.end(); T x(test::input_iterator(v_begin), test::input_iterator(v_end), 0, hf1, eq1); typename T::const_iterator x_begin = x.begin(), x_end = x.end(); T y(test::input_iterator(x_begin), test::input_iterator(x_end), 0, hf2, eq2); test::check_container(x, v); test::check_container(y, x); test::check_equivalent_keys(x); test::check_equivalent_keys(y); } UNORDERED_SUB_TEST("Construct 8.5 - from copy iterator") { test::check_instances check_; test::random_values<T> v(100, generator); T x(test::copy_iterator(v.begin()), test::copy_iterator(v.end()), 0, hf1, eq1); T y(test::copy_iterator(x.begin()), test::copy_iterator(x.end()), 0, hf2, eq2); test::check_container(x, v); test::check_container(y, x); test::check_equivalent_keys(x); test::check_equivalent_keys(y); } UNORDERED_SUB_TEST("Construct 9") { test::check_instances check_; test::random_values<T> v(100, generator); T x(50); BOOST_TEST(x.bucket_count() >= 50); x.max_load_factor(10); BOOST_TEST(x.bucket_count() >= 50); x.insert(v.begin(), v.end()); BOOST_TEST(x.bucket_count() >= 50); test::check_container(x, v); test::check_equivalent_keys(x); } typedef typename T::value_type value_type; std::initializer_list<value_type> list; test::random_values<T> v(3, generator); std::vector<value_type> vec(v.begin(), v.end()); BOOST_ASSERT(vec.size() >= 3); // create a new vector here because erase() requires assignability which is // deleted for some of the test types // std::vector<value_type> expected(vec.begin(), vec.begin() + 3); UNORDERED_SUB_TEST("Initializer list construct 1") { test::check_instances check_; { T x(list); BOOST_TEST(x.empty()); BOOST_TEST(test::equivalent(x.hash_function(), hf)); BOOST_TEST(test::equivalent(x.key_eq(), eq)); BOOST_TEST(test::equivalent(x.get_allocator(), al)); } { T x{vec[0], vec[1], vec[2]}; BOOST_TEST_NOT(x.empty()); BOOST_TEST_GT(x.bucket_count(), 0u); BOOST_TEST(test::equivalent(x.hash_function(), hf)); BOOST_TEST(test::equivalent(x.key_eq(), eq)); BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_container(x, expected); } } UNORDERED_SUB_TEST("Initializer list construct 2") { test::check_instances check_; { T x(list, 1000); BOOST_TEST(x.empty()); BOOST_TEST(x.bucket_count() >= 1000); BOOST_TEST(test::equivalent(x.hash_function(), hf)); BOOST_TEST(test::equivalent(x.key_eq(), eq)); BOOST_TEST(test::equivalent(x.get_allocator(), al)); } { T x({vec[0], vec[1], vec[2]}, 1000); BOOST_TEST_NOT(x.empty()); BOOST_TEST(x.bucket_count() >= 1000); BOOST_TEST(test::equivalent(x.hash_function(), hf)); BOOST_TEST(test::equivalent(x.key_eq(), eq)); BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_container(x, expected); } } UNORDERED_SUB_TEST("Initializer list construct 3") { { test::check_instances check_; T x(list, 10, hf1); BOOST_TEST(x.empty()); BOOST_TEST(x.bucket_count() >= 10); BOOST_TEST(test::equivalent(x.hash_function(), hf1)); BOOST_TEST(test::equivalent(x.key_eq(), eq)); BOOST_TEST(test::equivalent(x.get_allocator(), al)); } { test::check_instances check_; T x({vec[0], vec[1], vec[2]}, 10, hf1); BOOST_TEST_NOT(x.empty()); BOOST_TEST(x.bucket_count() >= 10); BOOST_TEST(test::equivalent(x.hash_function(), hf1)); BOOST_TEST(test::equivalent(x.key_eq(), eq)); BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_container(x, expected); } } UNORDERED_SUB_TEST("Initializer list construct 4") { { test::check_instances check_; T x(list, 10, hf1, eq1); BOOST_TEST(x.empty()); BOOST_TEST(x.bucket_count() >= 10); BOOST_TEST(test::equivalent(x.hash_function(), hf1)); BOOST_TEST(test::equivalent(x.key_eq(), eq1)); BOOST_TEST(test::equivalent(x.get_allocator(), al)); } { test::check_instances check_; T x({vec[0], vec[1], vec[2]}, 10, hf1, eq1); BOOST_TEST_NOT(x.empty()); BOOST_TEST(x.bucket_count() >= 10); BOOST_TEST(test::equivalent(x.hash_function(), hf1)); BOOST_TEST(test::equivalent(x.key_eq(), eq1)); BOOST_TEST(test::equivalent(x.get_allocator(), al)); test::check_container(x, expected); } } UNORDERED_SUB_TEST("Initializer list construct 5") { { test::check_instances check_; T x(list, 10, hf1, eq1, al1); BOOST_TEST(x.empty()); BOOST_TEST(x.bucket_count() >= 10); BOOST_TEST(test::equivalent(x.hash_function(), hf1)); BOOST_TEST(test::equivalent(x.key_eq(), eq1)); BOOST_TEST(test::equivalent(x.get_allocator(), al1)); } { test::check_instances check_; T x({vec[0], vec[1], vec[2]}, 10, hf1, eq1, al1); BOOST_TEST_NOT(x.empty()); BOOST_TEST(x.bucket_count() >= 10); BOOST_TEST(test::equivalent(x.hash_function(), hf1)); BOOST_TEST(test::equivalent(x.key_eq(), eq1)); BOOST_TEST(test::equivalent(x.get_allocator(), al1)); test::check_container(x, expected); } } UNORDERED_SUB_TEST("Initializer list construct 6") { { test::check_instances check_; T x(list, 10, al1); BOOST_TEST(x.empty()); BOOST_TEST(x.bucket_count() >= 10); BOOST_TEST(test::equivalent(x.get_allocator(), al1)); } { test::check_instances check_; T x({vec[0], vec[1], vec[2]}, 10, al1); BOOST_TEST_NOT(x.empty()); BOOST_TEST(x.bucket_count() >= 10); BOOST_TEST(test::equivalent(x.get_allocator(), al1)); test::check_container(x, expected); } } UNORDERED_SUB_TEST("Initializer list construct 7") { { test::check_instances check_; T x(list, 10, hf1, al1); BOOST_TEST(x.empty()); BOOST_TEST(x.bucket_count() >= 10); BOOST_TEST(test::equivalent(x.hash_function(), hf1)); BOOST_TEST(test::equivalent(x.get_allocator(), al1)); } { test::check_instances check_; T x({vec[0], vec[1], vec[2]}, 10, hf1, al1); BOOST_TEST_NOT(x.empty()); BOOST_TEST(x.bucket_count() >= 10); BOOST_TEST(test::equivalent(x.hash_function(), hf1)); BOOST_TEST(test::equivalent(x.get_allocator(), al1)); test::check_container(x, expected); } } UNORDERED_SUB_TEST("Initializer list construct 8") { test::check_instances check_; { T x(list, al1); BOOST_TEST(x.empty()); BOOST_TEST(test::equivalent(x.get_allocator(), al1)); } { T x({vec[0], vec[1], vec[2]}, al1); BOOST_TEST(test::equivalent(x.get_allocator(), al1)); test::check_container(x, expected); } } } template <class T> void no_alloc_default_construct_test(T*, test::random_generator) { #ifdef BOOST_UNORDERED_FOA_TESTS using allocator_type = typename T::allocator_type; using value_type = typename boost::allocator_value_type<allocator_type>::type; using pointer = typename boost::allocator_pointer<allocator_type>::type; static_assert(std::is_same<pointer, value_type*>::value, "only raw pointers for this test"); #endif UNORDERED_SUB_TEST("Construct 1") { T x; BOOST_TEST_EQ(x.bucket_count(), 0u); BOOST_TEST_EQ(test::detail::tracker.count_allocations, 0u); } UNORDERED_SUB_TEST("Construct 2") { { T x(0); BOOST_TEST_EQ(x.bucket_count(), 0u); BOOST_TEST_EQ(test::detail::tracker.count_allocations, 0u); } { T x(1); BOOST_TEST_GT(x.bucket_count(), 0u); BOOST_TEST_GT(test::detail::tracker.count_allocations, 0u); } } UNORDERED_SUB_TEST("Construct 3") { test::random_values<T> v; T x(v.begin(), v.end()); BOOST_TEST_EQ(x.bucket_count(), 0u); BOOST_TEST_EQ(test::detail::tracker.count_allocations, 0u); } UNORDERED_SUB_TEST("Construct 4") { { test::random_values<T> v; T x(v.begin(), v.end(), 0); BOOST_TEST_EQ(x.bucket_count(), 0u); BOOST_TEST_EQ(test::detail::tracker.count_allocations, 0u); } { test::random_values<T> v; T x(v.begin(), v.end(), 1); BOOST_TEST_GT(x.bucket_count(), 0u); BOOST_TEST_GT(test::detail::tracker.count_allocations, 0u); } } UNORDERED_SUB_TEST("Construct 5") { typename T::allocator_type al; { T x(al); BOOST_TEST_EQ(x.bucket_count(), 0u); BOOST_TEST_EQ(test::detail::tracker.count_allocations, 0u); } } UNORDERED_SUB_TEST("Construct 6") { typename T::allocator_type al; T x(0, al); BOOST_TEST_EQ(x.bucket_count(), 0u); BOOST_TEST_EQ(test::detail::tracker.count_allocations, 0u); } UNORDERED_SUB_TEST("Initializer list 1") { std::initializer_list<typename T::value_type> list; T x(list); BOOST_TEST_EQ(x.bucket_count(), 0u); BOOST_TEST_EQ(test::detail::tracker.count_allocations, 0u); } UNORDERED_SUB_TEST("Initializer list 2") { { std::initializer_list<typename T::value_type> list; T x(list, 0); BOOST_TEST_EQ(x.bucket_count(), 0u); BOOST_TEST_EQ(test::detail::tracker.count_allocations, 0u); } { std::initializer_list<typename T::value_type> list; T x(list, 1); BOOST_TEST_GT(x.bucket_count(), 0u); BOOST_TEST_GT(test::detail::tracker.count_allocations, 0u); } } } template <class T> void map_constructor_test(T*, test::random_generator const& generator) { typedef test::list< std::pair<typename T::key_type, typename T::mapped_type> > list; test::random_values<T> v(1000, generator); list l(v.begin(), v.end()); T x(l.begin(), l.end()); test::check_container(x, v); test::check_equivalent_keys(x); } using test::default_generator; using test::generate_collisions; using test::limited_range; #ifdef BOOST_UNORDERED_FOA_TESTS boost::unordered_flat_map<test::object, test::object, test::hash, test::equal_to, std::allocator<test::object> >* test_map_std_alloc; boost::unordered_flat_set<test::object, test::hash, test::equal_to, test::allocator1<test::object> >* test_set_raw_ptr; boost::unordered_node_set<test::object, test::hash, test::equal_to, test::allocator1<test::object> >* test_node_set_raw_ptr; boost::unordered_flat_map<test::object, test::object, test::hash, test::equal_to, test::allocator1<test::object> >* test_map_raw_ptr; boost::unordered_node_map<test::object, test::object, test::hash, test::equal_to, test::allocator1<test::object> >* test_node_map_raw_ptr; boost::unordered_flat_set<test::object, test::hash, test::equal_to, test::allocator1<test::object> >* test_set; boost::unordered_node_set<test::object, test::hash, test::equal_to, test::allocator1<test::object> >* test_node_set; boost::unordered_flat_map<test::object, test::object, test::hash, test::equal_to, test::allocator2<test::object> >* test_map; boost::unordered_node_map<test::object, test::object, test::hash, test::equal_to, test::allocator2<test::object> >* test_node_map; UNORDERED_TEST(constructor_tests1, ((test_map_std_alloc)(test_set)(test_node_set)(test_map)(test_node_map))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST(constructor_tests2, ((test_set)(test_node_set)(test_map)(test_node_map))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST(map_constructor_test, ((test_map_std_alloc)(test_map)(test_node_map))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST(no_alloc_default_construct_test, ((test_set_raw_ptr)(test_node_set_raw_ptr)(test_map_raw_ptr)(test_node_map_raw_ptr))( (default_generator)(generate_collisions)(limited_range))) #else boost::unordered_map<test::object, test::object, test::hash, test::equal_to, std::allocator<test::object> >* test_map_std_alloc; boost::unordered_set<test::object, test::hash, test::equal_to, test::allocator1<test::object> >* test_set; boost::unordered_multiset<test::object, test::hash, test::equal_to, test::allocator2<test::object> >* test_multiset; boost::unordered_map<test::object, test::object, test::hash, test::equal_to, test::allocator2<test::object> >* test_map; boost::unordered_multimap<test::object, test::object, test::hash, test::equal_to, test::allocator1<test::object> >* test_multimap; UNORDERED_TEST(constructor_tests1, ((test_map_std_alloc)(test_set)(test_multiset)(test_map)(test_multimap))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST(constructor_tests2, ((test_set)(test_multiset)(test_map)(test_multimap))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST(map_constructor_test, ((test_map_std_alloc)(test_map)(test_multimap))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST(no_alloc_default_construct_test, ((test_set)(test_multiset)(test_map)(test_multimap))( (default_generator)(generate_collisions)(limited_range))) #endif UNORDERED_AUTO_TEST (test_default_initializer_list) { std::initializer_list<int> init; #ifdef BOOST_UNORDERED_FOA_TESTS boost::unordered_flat_set<int> x1 = init; boost::unordered_node_set<int> x2 = init; BOOST_TEST(x2.empty()); #else boost::unordered_set<int> x1 = init; #endif BOOST_TEST(x1.empty()); } UNORDERED_AUTO_TEST (test_initializer_list) { #ifdef BOOST_UNORDERED_FOA_TESTS boost::unordered_flat_set<int> x1 = {2, 10, 45, -5}; boost::unordered_node_set<int> x2 = {2, 10, 45, -5}; BOOST_TEST(x2.find(10) != x2.end()); BOOST_TEST(x2.find(46) == x2.end()); #else boost::unordered_set<int> x1 = {2, 10, 45, -5}; #endif BOOST_TEST(x1.find(10) != x1.end()); BOOST_TEST(x1.find(46) == x1.end()); } } // namespace constructor_tests RUN_TESTS_QUIET()
0
repos/unordered/test
repos/unordered/test/unordered/node_handle_tests.cpp
// Copyright 2016 Daniel James. // Copyright 2023 Christian Mazakas // 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) #include <boost/config.hpp> #include "../helpers/postfix.hpp" #include "../helpers/prefix.hpp" #include "../helpers/unordered.hpp" #include "../helpers/helpers.hpp" #include "../helpers/metafunctions.hpp" #include "../helpers/test.hpp" #include <boost/core/pointer_traits.hpp> #include <boost/static_assert.hpp> #include <boost/type_traits/is_same.hpp> #include <set> #include <string> #if defined(BOOST_GCC) && BOOST_GCC >= 130000 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wself-move" #endif template <template <class Key, class T, class Hash = boost::hash<Key>, class Pred = std::equal_to<Key>, class Allocator = std::allocator<std::pair<Key const, T> > > class Map> static void example1() { typedef typename Map<int, std::string>::insert_return_type insert_return_type; Map<int, std::string> src; src.emplace(1, "one"); src.emplace(2, "two"); src.emplace(3, "buckle my shoe"); Map<int, std::string> dst; dst.emplace(3, "three"); dst.insert(src.extract(src.find(1))); dst.insert(src.extract(2)); insert_return_type r = dst.insert(src.extract(3)); BOOST_TEST(src.empty()); BOOST_TEST(dst.size() == 3); BOOST_TEST(dst[1] == "one"); BOOST_TEST(dst[2] == "two"); BOOST_TEST(dst[3] == "three"); BOOST_TEST(!r.inserted); BOOST_TEST(r.position == dst.find(3)); BOOST_TEST(r.node.mapped() == "buckle my shoe"); } template <template <class Key, class Hash = boost::hash<Key>, class Pred = std::equal_to<Key>, class Allocator = std::allocator<Key> > class Set> static void example2() { Set<int> src; src.insert(1); src.insert(3); src.insert(5); Set<int> dst; dst.insert(2); dst.insert(4); dst.insert(5); // dst.merge(src); // Merge src into dst. // src == {5} // dst == {1, 2, 3, 4, 5} } template <template <class Key, class Hash = boost::hash<Key>, class Pred = std::equal_to<Key>, class Allocator = std::allocator<Key> > class Set> static void example3() { typedef typename Set<int>::iterator iterator; Set<int> src; src.insert(1); src.insert(3); src.insert(5); Set<int> dst; dst.insert(2); dst.insert(4); dst.insert(5); for (iterator i = src.begin(); i != src.end();) { std::pair<iterator, iterator> p = dst.equal_range(*i); if (p.first == p.second) dst.insert(p.first, src.extract(i++)); else ++i; } BOOST_TEST(src.size() == 1); BOOST_TEST(*src.begin() == 5); std::set<int> dst2(dst.begin(), dst.end()); std::set<int>::iterator it = dst2.begin(); BOOST_TEST(*it++ == 1); BOOST_TEST(*it++ == 2); BOOST_TEST(*it++ == 3); BOOST_TEST(*it++ == 4); BOOST_TEST(*it++ == 5); BOOST_TEST(it == dst2.end()); } template <template <class Key, class T, class Hash = boost::hash<Key>, class Pred = std::equal_to<Key>, class Allocator = std::allocator<std::pair<Key const, T> > > class Map, template <class Key, class Hash = boost::hash<Key>, class Pred = std::equal_to<Key>, class Allocator = std::allocator<Key> > class Set> static void failed_insertion_with_hint() { { Set<int> src; Set<int> dst; src.emplace(10); src.emplace(20); dst.emplace(10); dst.emplace(20); typename Set<int>::node_type nh = src.extract(10); BOOST_TEST(dst.insert(dst.find(10), std::move(nh)) == dst.find(10)); BOOST_TEST(nh); BOOST_TEST(!nh.empty()); BOOST_TEST(nh.value() == 10); BOOST_TEST(dst.insert(dst.find(20), std::move(nh)) == dst.find(10)); BOOST_TEST(nh); BOOST_TEST(!nh.empty()); BOOST_TEST(nh.value() == 10); BOOST_TEST(src.count(10) == 0); BOOST_TEST(src.count(20) == 1); BOOST_TEST(dst.count(10) == 1); BOOST_TEST(dst.count(20) == 1); } { Map<int, int> src; Map<int, int> dst; src.emplace(10, 30); src.emplace(20, 5); dst.emplace(10, 20); dst.emplace(20, 2); typename Map<int, int>::node_type nh = src.extract(10); BOOST_TEST(dst.insert(dst.find(10), std::move(nh)) == dst.find(10)); BOOST_TEST(nh); BOOST_TEST(!nh.empty()); BOOST_TEST(nh.key() == 10); BOOST_TEST(nh.mapped() == 30); BOOST_TEST(dst[10] == 20); BOOST_TEST(dst.insert(dst.find(20), std::move(nh)) == dst.find(10)); BOOST_TEST(nh); BOOST_TEST(!nh.empty()); BOOST_TEST(nh.key() == 10); BOOST_TEST(nh.mapped() == 30); BOOST_TEST(dst[10] == 20); BOOST_TEST(src.count(10) == 0); BOOST_TEST(src.count(20) == 1); BOOST_TEST(dst.count(10) == 1); BOOST_TEST(dst.count(20) == 1); } } template <typename NodeHandle> bool node_handle_compare( NodeHandle const& nh, typename NodeHandle::value_type const& x) { return x == nh.value(); } template <typename NodeHandle> bool node_handle_compare( NodeHandle const& nh, std::pair<typename NodeHandle::key_type const, typename NodeHandle::mapped_type> const& x) { return x.first == nh.key() && x.second == nh.mapped(); } template <typename Container> void node_handle_tests_impl(Container& c) { typedef typename Container::node_type node_type; typename Container::value_type value = *c.begin(); node_type n1; BOOST_TEST(!n1); BOOST_TEST(n1.empty()); node_type n2 = c.extract(c.begin()); BOOST_TEST(n2); BOOST_TEST(!n2.empty()); node_handle_compare(n2, value); node_type n3 = std::move(n2); BOOST_TEST(n3); BOOST_TEST(!n2); node_handle_compare(n3, value); // TODO: Check that n2 doesn't have an allocator? // Maybe by swapping and observing that the allocator is // swapped rather than moved? n1 = std::move(n3); BOOST_TEST(n1); BOOST_TEST(!n3); node_handle_compare(n1, value); // Self move-assignment empties the node_handle. n1 = std::move(n1); BOOST_TEST(!n1); n3 = std::move(n3); BOOST_TEST(!n3); typename Container::value_type value1 = *c.begin(); n1 = c.extract(c.begin()); typename Container::value_type value2 = *c.begin(); n2 = c.extract(c.begin()); n3 = node_type(); node_handle_compare(n1, value1); node_handle_compare(n2, value2); n1.swap(n2); BOOST_TEST(n1); BOOST_TEST(n2); node_handle_compare(n1, value2); node_handle_compare(n2, value1); BOOST_TEST(n1); BOOST_TEST(!n3); n1.swap(n3); BOOST_TEST(!n1); BOOST_TEST(n3); node_handle_compare(n3, value2); BOOST_TEST(!n1); BOOST_TEST(n2); n1.swap(n2); BOOST_TEST(n1); BOOST_TEST(!n2); node_handle_compare(n1, value1); node_type n4; BOOST_TEST(!n2); BOOST_TEST(!n4); n2.swap(n4); BOOST_TEST(!n2); BOOST_TEST(!n4); } template <template <class Key, class T, class Hash = boost::hash<Key>, class Pred = std::equal_to<Key>, class Allocator = std::allocator<std::pair<Key const, T> > > class Map, template <class Key, class Hash = boost::hash<Key>, class Pred = std::equal_to<Key>, class Allocator = std::allocator<Key> > class Set> static void node_handle_tests() { Set<int> x1; x1.emplace(100); x1.emplace(140); x1.emplace(-55); node_handle_tests_impl(x1); Map<int, std::string> x2; x2.emplace(10, "ten"); x2.emplace(-23, "twenty"); x2.emplace(-76, "thirty"); node_handle_tests_impl(x2); } #ifdef BOOST_UNORDERED_FOA_TESTS template <class X> typename X::iterator insert_empty_node(X& x) { typedef typename X::node_type node_type; return x.insert(node_type()).position; } #else template <class Key, class T, class Hash, class KeyEqual, class Allocator> typename boost::unordered_map<Key, T, Hash, KeyEqual, Allocator>::iterator insert_empty_node(boost::unordered_map<Key, T, Hash, KeyEqual, Allocator>& c) { typedef typename boost::unordered_map<Key, T, Hash, KeyEqual, Allocator>::node_type node_type; return c.insert(node_type()).position; } template <class T, class Hash, class KeyEqual, class Allocator> typename boost::unordered_set<T, Hash, KeyEqual, Allocator>::iterator insert_empty_node(boost::unordered_set<T, Hash, KeyEqual, Allocator>& c) { typedef typename boost::unordered_set<T, Hash, KeyEqual, Allocator>::node_type node_type; return c.insert(node_type()).position; } template <class Key, class T, class Hash, class KeyEqual, class Allocator> typename boost::unordered_multimap<Key, T, Hash, KeyEqual, Allocator>::iterator insert_empty_node( boost::unordered_multimap<Key, T, Hash, KeyEqual, Allocator>& c) { typedef typename boost::unordered_multimap<Key, T, Hash, KeyEqual, Allocator>::node_type node_type; return c.insert(node_type()); } template <class T, class Hash, class KeyEqual, class Allocator> typename boost::unordered_multiset<T, Hash, KeyEqual, Allocator>::iterator insert_empty_node(boost::unordered_multiset<T, Hash, KeyEqual, Allocator>& c) { typedef typename boost::unordered_multiset<T, Hash, KeyEqual, Allocator>::node_type node_type; return c.insert(node_type()); } #endif template <typename Container1, typename Container2> static void insert_node_handle_unique(Container1& c1, Container2& c2) { typedef typename Container1::node_type node_type; typedef typename Container1::value_type value_type; BOOST_STATIC_ASSERT( (boost::is_same<node_type, typename Container2::node_type>::value)); typedef typename Container1::iterator iterator1; typedef typename Container2::iterator iterator2; typedef typename Container2::insert_return_type insert_return_type2; Container1 c1_copy(c1); Container2 c2_copy; iterator1 r1 = insert_empty_node(c1); insert_return_type2 r2 = c2.insert(node_type()); BOOST_TEST(r1 == c1.end()); BOOST_TEST(!r2.inserted); BOOST_TEST(!r2.node); BOOST_TEST(r2.position == c2.end()); while (!c1.empty()) { value_type v = *c1.begin(); value_type const* v_ptr = boost::to_address(c1.begin()); std::size_t count = c2.count(test::get_key<Container1>(v)); insert_return_type2 r = c2.insert(c1.extract(c1.begin())); if (!count) { BOOST_TEST(r.inserted); BOOST_TEST_EQ(c2.count(test::get_key<Container1>(v)), count + 1); BOOST_TEST(r.position != c2.end()); BOOST_TEST(boost::to_address(r.position) == v_ptr); BOOST_TEST(!r.node); } else { BOOST_TEST(!r.inserted); BOOST_TEST_EQ(c2.count(test::get_key<Container1>(v)), count); BOOST_TEST(r.position != c2.end()); BOOST_TEST( test::get_key<Container2>(*r.position) == test::get_key<Container2>(v)); BOOST_TEST(r.node); node_handle_compare(r.node, v); } } while (!c1_copy.empty()) { value_type v = *c1_copy.begin(); value_type const* v_ptr = boost::to_address(c1_copy.begin()); std::size_t count = c2_copy.count(test::get_key<Container1>(v)); iterator2 pos = c2_copy.insert(c2_copy.begin(), c1_copy.extract(c1_copy.begin())); if (!count) { BOOST_TEST_EQ(c2_copy.count(test::get_key<Container1>(v)), count + 1); BOOST_TEST(pos != c2.end()); BOOST_TEST(boost::to_address(pos) == v_ptr); } else { BOOST_TEST_EQ(c2_copy.count(test::get_key<Container1>(v)), count); BOOST_TEST(pos != c2_copy.end()); BOOST_TEST( test::get_key<Container2>(*pos) == test::get_key<Container2>(v)); } } } template <typename Container1, typename Container2> static void insert_node_handle_unique2(Container1& c1, Container2& c2) { typedef typename Container1::node_type node_type; typedef typename Container1::value_type value_type; BOOST_STATIC_ASSERT( (boost::is_same<node_type, typename Container2::node_type>::value)); // typedef typename Container1::insert_return_type // insert_return_type1; typedef typename Container2::insert_return_type insert_return_type2; while (!c1.empty()) { value_type v = *c1.begin(); value_type const* v_ptr = boost::to_address(c1.begin()); std::size_t count = c2.count(test::get_key<Container1>(v)); insert_return_type2 r = c2.insert(c1.extract(test::get_key<Container1>(v))); if (r.inserted) { BOOST_TEST_EQ(c2.count(test::get_key<Container1>(v)), count + 1); BOOST_TEST(r.position != c2.end()); BOOST_TEST(boost::to_address(r.position) == v_ptr); BOOST_TEST(!r.node); } else { BOOST_TEST_EQ(c2.count(test::get_key<Container1>(v)), count); BOOST_TEST(r.position != c2.end()); BOOST_TEST( test::get_key<Container2>(*r.position) == test::get_key<Container2>(v)); BOOST_TEST(r.node); node_handle_compare(r.node, v); } } } struct hash_thing { std::size_t operator()(int x) const { return static_cast<std::size_t>(x * 13 + 5); } }; #ifdef BOOST_UNORDERED_FOA_TESTS UNORDERED_AUTO_TEST (examples) { example1<boost::unordered_node_map>(); example2<boost::unordered_node_set>(); example3<boost::unordered_node_set>(); failed_insertion_with_hint<boost::unordered_node_map, boost::unordered_node_set>(); node_handle_tests<boost::unordered_node_map, boost::unordered_node_set>(); } UNORDERED_AUTO_TEST (insert_node_handle_unique_tests) { { boost::unordered_node_set<int> x1; boost::unordered_node_set<int> x2; x1.emplace(100); x1.emplace(140); x1.emplace(-55); x2.emplace(140); insert_node_handle_unique(x1, x2); BOOST_TEST(x2.size() == 3); } { boost::unordered_node_set<int> x1; boost::unordered_node_set<int> x2; x1.emplace(100); x1.emplace(140); x1.emplace(-55); x2.emplace(140); insert_node_handle_unique(x1, x2); BOOST_TEST(x2.size() == 3); } { boost::unordered_node_map<int, int, hash_thing> x1; boost::unordered_node_map<int, int> x2; x1.emplace(67, 50); x1.emplace(23, 45); x1.emplace(18, 19); x2.emplace(23, 50); x2.emplace(12, 49); insert_node_handle_unique(x1, x2); BOOST_TEST(x2.size() == 4); } { boost::unordered_node_map<int, int, hash_thing> x1; boost::unordered_node_map<int, int> x2; x1.emplace(67, 50); x1.emplace(23, 45); x1.emplace(18, 19); x2.emplace(23, 50); x2.emplace(12, 49); insert_node_handle_unique(x1, x2); BOOST_TEST(x2.size() == 4); } } UNORDERED_AUTO_TEST (insert_node_handle_unique_tests2) { { boost::unordered_node_set<int> x1; boost::unordered_node_set<int> x2; x1.emplace(100); x1.emplace(140); x1.emplace(-55); x2.emplace(140); insert_node_handle_unique2(x1, x2); BOOST_TEST(x2.size() == 3); } { boost::unordered_node_set<int> x1; boost::unordered_node_set<int> x2; x1.emplace(100); x1.emplace(140); x1.emplace(-55); x2.emplace(140); insert_node_handle_unique2(x1, x2); BOOST_TEST(x2.size() == 3); } { boost::unordered_node_map<int, int, hash_thing> x1; boost::unordered_node_map<int, int> x2; x1.emplace(67, 50); x1.emplace(23, 45); x1.emplace(18, 19); x2.emplace(23, 50); x2.emplace(12, 49); insert_node_handle_unique2(x1, x2); BOOST_TEST(x2.size() == 4); } { boost::unordered_node_map<int, int, hash_thing> x1; boost::unordered_node_map<int, int> x2; x1.emplace(67, 50); x1.emplace(23, 45); x1.emplace(18, 19); x2.emplace(23, 50); x2.emplace(12, 49); insert_node_handle_unique2(x1, x2); BOOST_TEST(x2.size() == 4); } } #else UNORDERED_AUTO_TEST (examples) { example1<boost::unordered_map>(); example2<boost::unordered_set>(); example3<boost::unordered_set>(); failed_insertion_with_hint<boost::unordered_map, boost::unordered_set>(); node_handle_tests<boost::unordered_map, boost::unordered_set>(); } template <typename Container1, typename Container2> void insert_node_handle_equiv(Container1& c1, Container2& c2) { typedef typename Container1::node_type node_type; typedef typename Container1::value_type value_type; BOOST_STATIC_ASSERT( (boost::is_same<node_type, typename Container2::node_type>::value)); typedef typename Container1::iterator iterator1; typedef typename Container2::iterator iterator2; iterator1 r1 = insert_empty_node(c1); iterator2 r2 = c2.insert(node_type()); BOOST_TEST(r1 == c1.end()); BOOST_TEST(r2 == c2.end()); while (!c1.empty()) { value_type v = *c1.begin(); value_type const* v_ptr = boost::to_address(c1.begin()); std::size_t count = c2.count(test::get_key<Container1>(v)); iterator2 r = c2.insert(c1.extract(c1.begin())); BOOST_TEST_EQ(c2.count(test::get_key<Container1>(v)), count + 1); BOOST_TEST(r != c2.end()); BOOST_TEST(boost::to_address(r) == v_ptr); } } UNORDERED_AUTO_TEST (insert_node_handle_unique_tests) { { boost::unordered_set<int> x1; boost::unordered_set<int> x2; x1.emplace(100); x1.emplace(140); x1.emplace(-55); x2.emplace(140); insert_node_handle_unique(x1, x2); BOOST_TEST(x2.size() == 3); } { boost::unordered_multiset<int> x1; boost::unordered_set<int> x2; x1.emplace(100); x1.emplace(140); x1.emplace(-55); x2.emplace(140); insert_node_handle_unique(x1, x2); BOOST_TEST(x2.size() == 3); } { boost::unordered_map<int, int, hash_thing> x1; boost::unordered_map<int, int> x2; x1.emplace(67, 50); x1.emplace(23, 45); x1.emplace(18, 19); x2.emplace(23, 50); x2.emplace(12, 49); insert_node_handle_unique(x1, x2); BOOST_TEST(x2.size() == 4); } { boost::unordered_multimap<int, int, hash_thing> x1; boost::unordered_map<int, int> x2; x1.emplace(67, 50); x1.emplace(23, 45); x1.emplace(18, 19); x2.emplace(23, 50); x2.emplace(12, 49); insert_node_handle_unique(x1, x2); BOOST_TEST(x2.size() == 4); } } UNORDERED_AUTO_TEST (insert_node_handle_equiv_tests) { { boost::unordered_multimap<int, int, hash_thing> x1; boost::unordered_multimap<int, int> x2; x1.emplace(67, 50); x1.emplace(67, 100); x1.emplace(23, 45); x1.emplace(18, 19); x2.emplace(23, 50); x2.emplace(12, 49); insert_node_handle_equiv(x1, x2); BOOST_TEST(x2.size() == 6); } { boost::unordered_map<int, int, hash_thing> x1; boost::unordered_multimap<int, int> x2; x1.emplace(67, 50); x1.emplace(67, 100); x1.emplace(23, 45); x1.emplace(18, 19); x2.emplace(23, 50); x2.emplace(12, 49); insert_node_handle_equiv(x1, x2); BOOST_TEST(x2.size() == 5); } { boost::unordered_multiset<int, hash_thing> x1; boost::unordered_multiset<int> x2; x1.emplace(67); x1.emplace(67); x1.emplace(23); x1.emplace(18); x2.emplace(23); x2.emplace(12); insert_node_handle_equiv(x1, x2); BOOST_TEST(x2.size() == 6); } { boost::unordered_set<int, hash_thing> x1; boost::unordered_multiset<int> x2; x1.emplace(67); x1.emplace(67); x1.emplace(23); x1.emplace(18); x2.emplace(23); x2.emplace(12); insert_node_handle_equiv(x1, x2); BOOST_TEST(x2.size() == 5); } } UNORDERED_AUTO_TEST (insert_node_handle_unique_tests2) { { boost::unordered_set<int> x1; boost::unordered_set<int> x2; x1.emplace(100); x1.emplace(140); x1.emplace(-55); x2.emplace(140); insert_node_handle_unique2(x1, x2); BOOST_TEST(x2.size() == 3); } { boost::unordered_multiset<int> x1; boost::unordered_set<int> x2; x1.emplace(100); x1.emplace(140); x1.emplace(-55); x2.emplace(140); insert_node_handle_unique2(x1, x2); BOOST_TEST(x2.size() == 3); } { boost::unordered_map<int, int, hash_thing> x1; boost::unordered_map<int, int> x2; x1.emplace(67, 50); x1.emplace(23, 45); x1.emplace(18, 19); x2.emplace(23, 50); x2.emplace(12, 49); insert_node_handle_unique2(x1, x2); BOOST_TEST(x2.size() == 4); } { boost::unordered_multimap<int, int, hash_thing> x1; boost::unordered_map<int, int> x2; x1.emplace(67, 50); x1.emplace(23, 45); x1.emplace(18, 19); x2.emplace(23, 50); x2.emplace(12, 49); insert_node_handle_unique2(x1, x2); BOOST_TEST(x2.size() == 4); } } #endif RUN_TESTS()
0
repos/unordered/test
repos/unordered/test/unordered/insert_tests.cpp
// Copyright 2006-2010 Daniel James. // Copyright (C) 2022-2023 Christian Mazakas // 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) #if !defined(PIECEWISE_TEST_NAME) #include "../helpers/unordered.hpp" #include "../helpers/test.hpp" #include "../objects/test.hpp" #include "../helpers/random_values.hpp" #include "../helpers/tracker.hpp" #include "../helpers/equivalent.hpp" #include "../helpers/invariants.hpp" #include "../helpers/input_iterator.hpp" #include "../helpers/helpers.hpp" #include <boost/tuple/tuple.hpp> #include <vector> namespace insert_tests { test::seed_t initialize_seed(243432); template <class X> void unique_insert_tests1(X*, test::random_generator generator) { test::check_instances check_; typedef typename X::iterator iterator; typedef test::ordered<X> ordered; UNORDERED_SUB_TEST("insert(value) tests for containers with unique keys") { X x; test::ordered<X> tracker = test::create_ordered(x); test::random_values<X> v(1000, generator); for (typename test::random_values<X>::iterator it = v.begin(); it != v.end(); ++it) { typename X::size_type old_bucket_count = x.bucket_count(); float b = x.max_load_factor(); std::pair<iterator, bool> r1 = x.insert(*it); std::pair<typename ordered::iterator, bool> r2 = tracker.insert(*it); BOOST_TEST(r1.second == r2.second); BOOST_TEST(*r1.first == *r2.first); tracker.compare_key(x, *it); if (static_cast<double>(x.size()) <= b * static_cast<double>(old_bucket_count)) BOOST_TEST(x.bucket_count() == old_bucket_count); } test::check_equivalent_keys(x); } UNORDERED_SUB_TEST("insert(rvalue) tests for containers with unique keys") { X x; test::ordered<X> tracker = test::create_ordered(x); test::random_values<X> v(1000, generator); for (typename test::random_values<X>::iterator it = v.begin(); it != v.end(); ++it) { typename X::size_type old_bucket_count = x.bucket_count(); float b = x.max_load_factor(); typename X::value_type value = *it; std::pair<iterator, bool> r1 = x.insert(std::move(value)); std::pair<typename ordered::iterator, bool> r2 = tracker.insert(*it); BOOST_TEST(r1.second == r2.second); BOOST_TEST(*r1.first == *r2.first); tracker.compare_key(x, *it); if (static_cast<double>(x.size()) <= b * static_cast<double>(old_bucket_count)) BOOST_TEST(x.bucket_count() == old_bucket_count); } test::check_equivalent_keys(x); } } template <class X> void equivalent_insert_tests1(X*, test::random_generator generator) { test::check_instances check_; UNORDERED_SUB_TEST( "insert(value) tests for containers with equivalent keys") { X x; test::ordered<X> tracker = test::create_ordered(x); test::random_values<X> v(1000, generator); for (typename test::random_values<X>::iterator it = v.begin(); it != v.end(); ++it) { typename X::size_type old_bucket_count = x.bucket_count(); float b = x.max_load_factor(); typename X::iterator r1 = x.insert(*it); typename test::ordered<X>::iterator r2 = tracker.insert(*it); BOOST_TEST(*r1 == *r2); tracker.compare_key(x, *it); if (static_cast<double>(x.size()) <= b * static_cast<double>(old_bucket_count)) BOOST_TEST(x.bucket_count() == old_bucket_count); } test::check_equivalent_keys(x); } UNORDERED_SUB_TEST( "insert(rvalue) tests for containers with equivalent keys") { X x; test::ordered<X> tracker = test::create_ordered(x); test::random_values<X> v(1000, generator); for (typename test::random_values<X>::iterator it = v.begin(); it != v.end(); ++it) { typename X::size_type old_bucket_count = x.bucket_count(); float b = x.max_load_factor(); typename X::value_type value = *it; typename X::iterator r1 = x.insert(std::move(value)); typename test::ordered<X>::iterator r2 = tracker.insert(*it); BOOST_TEST(*r1 == *r2); tracker.compare_key(x, *it); if (static_cast<double>(x.size()) <= b * static_cast<double>(old_bucket_count)) BOOST_TEST(x.bucket_count() == old_bucket_count); } test::check_equivalent_keys(x); } } template <class X> void insert_tests2(X*, test::random_generator generator) { typedef typename test::ordered<X> tracker_type; typedef typename X::iterator iterator; typedef typename X::const_iterator const_iterator; typedef typename tracker_type::iterator tracker_iterator; UNORDERED_SUB_TEST("insert(begin(), value) tests") { test::check_instances check_; X x; tracker_type tracker = test::create_ordered(x); test::random_values<X> v(1000, generator); for (typename test::random_values<X>::iterator it = v.begin(); it != v.end(); ++it) { typename X::size_type old_bucket_count = x.bucket_count(); float b = x.max_load_factor(); iterator r1 = x.insert(x.begin(), *it); tracker_iterator r2 = tracker.insert(tracker.begin(), *it); BOOST_TEST(*r1 == *r2); tracker.compare_key(x, *it); if (static_cast<double>(x.size()) <= b * static_cast<double>(old_bucket_count)) BOOST_TEST(x.bucket_count() == old_bucket_count); } tracker.compare(x); test::check_equivalent_keys(x); } UNORDERED_SUB_TEST("insert(end(), value) tests") { test::check_instances check_; X x; X const& x_const = x; tracker_type tracker = test::create_ordered(x); test::random_values<X> v(100, generator); for (typename test::random_values<X>::iterator it = v.begin(); it != v.end(); ++it) { typename X::size_type old_bucket_count = x.bucket_count(); float b = x.max_load_factor(); const_iterator r1 = x.insert(x_const.end(), *it); tracker_iterator r2 = tracker.insert(tracker.end(), *it); BOOST_TEST(*r1 == *r2); tracker.compare_key(x, *it); if (static_cast<double>(x.size()) <= b * static_cast<double>(old_bucket_count)) BOOST_TEST(x.bucket_count() == old_bucket_count); } tracker.compare(x); test::check_equivalent_keys(x); } UNORDERED_SUB_TEST("insert(pos, value) tests") { test::check_instances check_; X x; const_iterator pos = x.begin(); tracker_type tracker = test::create_ordered(x); test::random_values<X> v(1000, generator); for (typename test::random_values<X>::iterator it = v.begin(); it != v.end(); ++it) { typename X::size_type old_bucket_count = x.bucket_count(); float b = x.max_load_factor(); pos = x.insert(pos, *it); tracker_iterator r2 = tracker.insert(tracker.begin(), *it); BOOST_TEST(*pos == *r2); tracker.compare_key(x, *it); if (static_cast<double>(x.size()) <= b * static_cast<double>(old_bucket_count)) BOOST_TEST(x.bucket_count() == old_bucket_count); } tracker.compare(x); test::check_equivalent_keys(x); } UNORDERED_SUB_TEST("insert(pos, rvalue) tests") { test::check_instances check_; X x; const_iterator pos = x.begin(); tracker_type tracker = test::create_ordered(x); test::random_values<X> v(1000, generator); for (typename test::random_values<X>::iterator it = v.begin(); it != v.end(); ++it) { typename X::size_type old_bucket_count = x.bucket_count(); float b = x.max_load_factor(); typename X::value_type value = *it; pos = x.insert(pos, std::move(value)); tracker_iterator r2 = tracker.insert(tracker.begin(), *it); BOOST_TEST(*pos == *r2); tracker.compare_key(x, *it); if (static_cast<double>(x.size()) <= b * static_cast<double>(old_bucket_count)) BOOST_TEST(x.bucket_count() == old_bucket_count); } tracker.compare(x); test::check_equivalent_keys(x); } UNORDERED_SUB_TEST("insert single item range tests") { test::check_instances check_; X x; tracker_type tracker = test::create_ordered(x); test::random_values<X> v(1000, generator); for (typename test::random_values<X>::iterator it = v.begin(); it != v.end(); ++it) { typename X::size_type old_bucket_count = x.bucket_count(); float b = x.max_load_factor(); x.insert(it, test::next(it)); tracker.insert(*it); tracker.compare_key(x, *it); if (static_cast<double>(x.size()) <= b * static_cast<double>(old_bucket_count)) BOOST_TEST(x.bucket_count() == old_bucket_count); } tracker.compare(x); test::check_equivalent_keys(x); } UNORDERED_SUB_TEST("insert range tests") { test::check_instances check_; X x; test::random_values<X> v(1000, generator); x.insert(v.begin(), v.end()); test::check_container(x, v); test::check_equivalent_keys(x); } UNORDERED_SUB_TEST("insert range with rehash tests") { test::check_instances check_; X x; test::random_values<X> v(1000, generator); x.insert(*v.begin()); x.clear(); x.insert(v.begin(), v.end()); test::check_container(x, v); test::check_equivalent_keys(x); } UNORDERED_SUB_TEST("insert input iterator range tests") { test::check_instances check_; X x; test::random_values<X> v(1000, generator); typename test::random_values<X>::const_iterator begin = v.begin(), end = v.end(); x.insert(test::input_iterator(begin), test::input_iterator(end)); test::check_container(x, v); test::check_equivalent_keys(x); } UNORDERED_SUB_TEST("insert copy iterator range tests") { test::check_instances check_; X x; test::random_values<X> v(1000, generator); x.insert(test::copy_iterator(v.begin()), test::copy_iterator(v.end())); test::check_container(x, v); test::check_equivalent_keys(x); } UNORDERED_SUB_TEST("insert copy iterator range test 2") { test::check_instances check_; X x; test::random_values<X> v1(500, generator); test::random_values<X> v2(500, generator); x.insert(test::copy_iterator(v1.begin()), test::copy_iterator(v1.end())); x.insert(test::copy_iterator(v2.begin()), test::copy_iterator(v2.end())); test::check_equivalent_keys(x); } UNORDERED_SUB_TEST("insert various ranges") { for (int i = 0; i < 100; ++i) { X x; test::ordered<X> tracker = test::create_ordered(x); test::random_values<X> v(1000, generator); for (typename test::random_values<X>::iterator it = v.begin(); it != v.end();) { typename X::size_type old_bucket_count = x.bucket_count(); float b = x.max_load_factor(); typename test::random_values<X>::iterator next = it; for (std::size_t j = test::random_value(20); j > 0; ++j) { ++next; if (next == v.end()) { break; } } x.insert(it, next); tracker.insert(it, next); it = next; tracker.compare(x); // Slow, but I can't see any other way. if (static_cast<double>(x.size()) <= b * static_cast<double>(old_bucket_count)) BOOST_TEST(x.bucket_count() == old_bucket_count); } test::check_equivalent_keys(x); } } } template <class X> void unique_emplace_tests1(X*, test::random_generator generator) { typedef typename X::iterator iterator; typedef test::ordered<X> ordered; X x; test::ordered<X> tracker = test::create_ordered(x); test::random_values<X> v(1000, generator); for (typename test::random_values<X>::iterator it = v.begin(); it != v.end(); ++it) { typename X::size_type old_bucket_count = x.bucket_count(); float b = x.max_load_factor(); std::pair<iterator, bool> r1 = x.emplace(*it); std::pair<typename ordered::iterator, bool> r2 = tracker.insert(*it); BOOST_TEST(r1.second == r2.second); BOOST_TEST(*r1.first == *r2.first); tracker.compare_key(x, *it); if (static_cast<double>(x.size()) <= b * static_cast<double>(old_bucket_count)) BOOST_TEST(x.bucket_count() == old_bucket_count); } tracker.compare(x); test::check_equivalent_keys(x); } template <class X> void equivalent_emplace_tests1(X*, test::random_generator generator) { X x; test::ordered<X> tracker = test::create_ordered(x); test::random_values<X> v(1000, generator); for (typename test::random_values<X>::iterator it = v.begin(); it != v.end(); ++it) { typename X::size_type old_bucket_count = x.bucket_count(); float b = x.max_load_factor(); typename X::iterator r1 = x.emplace(*it); typename test::ordered<X>::iterator r2 = tracker.insert(*it); BOOST_TEST(*r1 == *r2); tracker.compare_key(x, *it); if (static_cast<double>(x.size()) <= b * static_cast<double>(old_bucket_count)) BOOST_TEST(x.bucket_count() == old_bucket_count); } tracker.compare(x); test::check_equivalent_keys(x); } template <class X> void move_emplace_tests(X*, test::random_generator generator) { X x; test::ordered<X> tracker = test::create_ordered(x); test::random_values<X> v(1000, generator); for (typename test::random_values<X>::iterator it = v.begin(); it != v.end(); ++it) { typename X::size_type old_bucket_count = x.bucket_count(); float b = x.max_load_factor(); typename X::value_type value = *it; x.emplace(std::move(value)); tracker.insert(*it); tracker.compare_key(x, *it); if (static_cast<double>(x.size()) <= b * static_cast<double>(old_bucket_count)) BOOST_TEST(x.bucket_count() == old_bucket_count); } tracker.compare(x); test::check_equivalent_keys(x); } template <class X> void default_emplace_tests(X*, test::random_generator) { bool is_unique = test::has_unique_keys<X>::value; X x; x.emplace(); BOOST_TEST(x.size() == 1); x.emplace(); BOOST_TEST(x.size() == (is_unique ? 1u : 2u)); x.emplace(); BOOST_TEST(x.size() == (is_unique ? 1u : 3u)); typename X::value_type y; BOOST_TEST(x.count(test::get_key<X>(y)) == (is_unique ? 1u : 3u)); BOOST_TEST(*x.equal_range(test::get_key<X>(y)).first == y); x.emplace(y); BOOST_TEST(x.size() == (is_unique ? 1u : 4u)); BOOST_TEST(x.count(test::get_key<X>(y)) == (is_unique ? 1u : 4u)); BOOST_TEST(*x.equal_range(test::get_key<X>(y)).first == y); x.clear(); BOOST_TEST(x.empty()); x.emplace(y); BOOST_TEST(x.size() == 1); x.emplace(y); BOOST_TEST(x.size() == (is_unique ? 1u : 2u)); BOOST_TEST(x.count(test::get_key<X>(y)) == (is_unique ? 1u : 2u)); BOOST_TEST(*x.equal_range(test::get_key<X>(y)).first == y); } template <class X> void map_tests(X*, test::random_generator generator) { X x; test::ordered<X> tracker = test::create_ordered(x); test::random_values<X> v(1000, generator); for (typename test::random_values<X>::iterator it = v.begin(); it != v.end(); ++it) { typename X::size_type old_bucket_count = x.bucket_count(); float b = x.max_load_factor(); x[it->first] = it->second; tracker[it->first] = it->second; tracker.compare_key(x, *it); if (static_cast<double>(x.size()) <= b * static_cast<double>(old_bucket_count)) BOOST_TEST(x.bucket_count() == old_bucket_count); } tracker.compare(x); test::check_equivalent_keys(x); } template <class X> void map_tests2(X*, test::random_generator generator) { typedef typename X::iterator iterator; UNORDERED_SUB_TEST("insert_or_assign") { test::check_instances check_; X x; test::ordered<X> tracker = test::create_ordered(x); test::random_values<X> v(1000, generator); for (typename test::random_values<X>::iterator it = v.begin(); it != v.end(); ++it) { typename X::size_type old_bucket_count = x.bucket_count(); float b = x.max_load_factor(); std::pair<iterator, bool> r = x.insert_or_assign(it->first, it->second); BOOST_TEST(*r.first == *it); tracker[it->first] = it->second; tracker.compare_key(x, *it); if (static_cast<double>(x.size()) < b * static_cast<double>(old_bucket_count)) BOOST_TEST(x.bucket_count() == old_bucket_count); } tracker.compare(x); test::check_equivalent_keys(x); } UNORDERED_SUB_TEST("insert_or_assign(begin)") { test::check_instances check_; X x; test::ordered<X> tracker = test::create_ordered(x); test::random_values<X> v(1000, generator); for (typename test::random_values<X>::iterator it = v.begin(); it != v.end(); ++it) { typename X::size_type old_bucket_count = x.bucket_count(); float b = x.max_load_factor(); iterator r = x.insert_or_assign(x.begin(), it->first, it->second); BOOST_TEST(*r == *it); tracker[it->first] = it->second; tracker.compare_key(x, *it); if (static_cast<double>(x.size()) < b * static_cast<double>(old_bucket_count)) BOOST_TEST(x.bucket_count() == old_bucket_count); } tracker.compare(x); test::check_equivalent_keys(x); } UNORDERED_SUB_TEST("insert_or_assign(end)") { test::check_instances check_; X x; test::ordered<X> tracker = test::create_ordered(x); test::random_values<X> v(1000, generator); for (typename test::random_values<X>::iterator it = v.begin(); it != v.end(); ++it) { typename X::size_type old_bucket_count = x.bucket_count(); float b = x.max_load_factor(); iterator r = x.insert_or_assign(x.end(), it->first, it->second); BOOST_TEST(*r == *it); tracker[it->first] = it->second; tracker.compare_key(x, *it); if (static_cast<double>(x.size()) < b * static_cast<double>(old_bucket_count)) BOOST_TEST(x.bucket_count() == old_bucket_count); } tracker.compare(x); test::check_equivalent_keys(x); } UNORDERED_SUB_TEST("insert_or_assign(last)") { test::check_instances check_; X x; test::ordered<X> tracker = test::create_ordered(x); iterator last = x.begin(); test::random_values<X> v(1000, generator); for (typename test::random_values<X>::iterator it = v.begin(); it != v.end(); ++it) { typename X::size_type old_bucket_count = x.bucket_count(); float b = x.max_load_factor(); iterator r = x.insert_or_assign(last, it->first, it->second); BOOST_TEST(*r == *it); tracker[it->first] = it->second; tracker.compare_key(x, *it); if (static_cast<double>(x.size()) < b * static_cast<double>(old_bucket_count)) BOOST_TEST(x.bucket_count() == old_bucket_count); last = r; } tracker.compare(x); test::check_equivalent_keys(x); } } template <class X> void set_tests(X*, test::random_generator) { // prove that our insert(iterator, iterator) implementation honors // Cpp17EmplaceConstructible // X x; std::vector<int> v; v.reserve(1000); for (unsigned i = 0; i < 1000; ++i) { v.push_back(static_cast<int>(i)); } x.insert(v.begin(), v.end()); BOOST_TEST_EQ(x.size(), 1000u); } struct pointer_constructible { int x; pointer_constructible(int x_) : x(x_) {} pointer_constructible(pointer_constructible const& p) : x(p.x) {} pointer_constructible(pointer_constructible* const&) : x(-1) {} pointer_constructible(pointer_constructible*&&) : x(-1) {} }; struct pointer_constructible_hash { typedef void is_transparent; std::size_t operator()(pointer_constructible const& p) const { return boost::hash<int>()(p.x); } }; struct pointer_constructible_equal_to { typedef void is_transparent; bool operator()( pointer_constructible const& lhs, pointer_constructible const& rhs) const { return lhs.x == rhs.x; } }; template <class X> static void set_tests2(X*) { X set, set2; pointer_constructible pc(1337); pointer_constructible* const addr_pc = &pc; set.insert(pc); // 1337 set.insert(&pc); // -1 set.insert(addr_pc); // -1 BOOST_TEST_EQ(set.size(), 2u); BOOST_TEST(set.find(pc) != set.end()); BOOST_TEST(set.find(-1) != set.end()); BOOST_TEST(set.find(-2) == set.end()); set2 = set; BOOST_TEST_EQ(set2.size(), 2u); BOOST_TEST(set2.find(pc) != set2.end()); BOOST_TEST(set2.find(-1) != set2.end()); BOOST_TEST(set2.find(-2) == set2.end()); set.rehash(set.bucket_count() + 1); BOOST_TEST_EQ(set.size(), 2u); BOOST_TEST(set.find(pc) != set.end()); BOOST_TEST(set.find(-1) != set.end()); BOOST_TEST(set.find(-2) == set.end()); } template <class X> void try_emplace_tests(X*, test::random_generator generator) { typedef typename X::iterator iterator; UNORDERED_SUB_TEST("try_emplace(key, value)") { test::check_instances check_; X x; test::ordered<X> tracker = test::create_ordered(x); test::random_values<X> v(1000, generator); for (typename test::random_values<X>::iterator it = v.begin(); it != v.end(); ++it) { typename X::size_type old_bucket_count = x.bucket_count(); float b = x.max_load_factor(); iterator pos = x.find(it->first); bool found = pos != x.end(); std::pair<typename X::iterator, bool> r = x.try_emplace(it->first, it->second); if (found) { BOOST_TEST(pos == r.first); BOOST_TEST(!r.second); } else { BOOST_TEST(r.second); } BOOST_TEST_EQ(r.first->first, it->first); BOOST_TEST_EQ(r.first->second, it->second); tracker.insert(*it); tracker.compare_key(x, *it); if (static_cast<double>(x.size()) < b * static_cast<double>(old_bucket_count)) BOOST_TEST(x.bucket_count() == old_bucket_count); } test::check_equivalent_keys(x); } typedef typename X::iterator iterator; UNORDERED_SUB_TEST("try_emplace(begin(), key, value)") { test::check_instances check_; X x; test::ordered<X> tracker = test::create_ordered(x); test::random_values<X> v(1000, generator); for (typename test::random_values<X>::iterator it = v.begin(); it != v.end(); ++it) { typename X::size_type old_bucket_count = x.bucket_count(); float b = x.max_load_factor(); iterator pos = x.find(it->first); bool found = pos != x.end(); typename X::iterator r = x.try_emplace(r.begin(), it->first, it->second); if (found) { BOOST_TEST(pos == r); } BOOST_TEST_EQ(r->first, it->first); BOOST_TEST_EQ(r->second, it->second); tracker.insert(*it); tracker.compare_key(x, *it); if (static_cast<double>(x.size()) < b * static_cast<double>(old_bucket_count)) BOOST_TEST(x.bucket_count() == old_bucket_count); } test::check_equivalent_keys(x); } typedef typename X::iterator iterator; UNORDERED_SUB_TEST("try_emplace(end(), key, value)") { test::check_instances check_; X x; test::ordered<X> tracker = test::create_ordered(x); test::random_values<X> v(1000, generator); for (typename test::random_values<X>::iterator it = v.begin(); it != v.end(); ++it) { typename X::size_type old_bucket_count = x.bucket_count(); float b = x.max_load_factor(); iterator pos = x.find(it->first); bool found = pos != x.end(); typename X::iterator r = x.try_emplace(r.end(), it->first, it->second); if (found) { BOOST_TEST(pos == r); } BOOST_TEST_EQ(r->first, it->first); BOOST_TEST_EQ(r->second, it->second); tracker.insert(*it); tracker.compare_key(x, *it); if (static_cast<double>(x.size()) < b * static_cast<double>(old_bucket_count)) BOOST_TEST(x.bucket_count() == old_bucket_count); } test::check_equivalent_keys(x); } typedef typename X::iterator iterator; UNORDERED_SUB_TEST("try_emplace(pos, key, value)") { test::check_instances check_; X x; test::ordered<X> tracker = test::create_ordered(x); test::random_values<X> v(1000, generator); for (typename test::random_values<X>::iterator it = v.begin(); it != v.end(); ++it) { typename X::size_type old_bucket_count = x.bucket_count(); float b = x.max_load_factor(); iterator pos = x.find(it->first); bool found = pos != x.end(); typename X::iterator r = x.try_emplace(pos, it->first, it->second); if (found) { BOOST_TEST(pos == r); } BOOST_TEST_EQ(r->first, it->first); BOOST_TEST_EQ(r->second, it->second); tracker.insert(*it); tracker.compare_key(x, *it); if (static_cast<double>(x.size()) < b * static_cast<double>(old_bucket_count)) BOOST_TEST(x.bucket_count() == old_bucket_count); } test::check_equivalent_keys(x); } } // Some tests for when the range's value type doesn't match the container's // value type. template <class X> void map_insert_range_test1(X*, test::random_generator generator) { test::check_instances check_; typedef test::list< std::pair<typename X::key_type, typename X::mapped_type> > list; test::random_values<X> v(1000, generator); list l(v.begin(), v.end()); X x; x.insert(l.begin(), l.end()); test::check_equivalent_keys(x); } template <class X> void map_insert_range_test2(X*, test::random_generator generator) { test::check_instances check_; typedef test::list< std::pair<typename X::key_type const, test::implicitly_convertible> > list; test::random_values< boost::unordered_map<typename X::key_type, test::implicitly_convertible> > v(1000, generator); list l(v.begin(), v.end()); X x; x.insert(l.begin(), l.end()); test::check_equivalent_keys(x); } using test::default_generator; using test::generate_collisions; using test::limited_range; #ifdef BOOST_UNORDERED_FOA_TESTS boost::unordered_flat_set<test::movable, test::hash, test::equal_to, std::allocator<test::movable> >* test_set_std_alloc; boost::unordered_node_set<test::movable, test::hash, test::equal_to, std::allocator<test::movable> >* test_node_set_std_alloc; boost::unordered_flat_set<test::object, test::hash, test::equal_to, test::allocator1<test::object> >* test_set; boost::unordered_node_set<test::movable, test::hash, test::equal_to, test::allocator1<test::object> >* test_node_set; boost::unordered_flat_map<test::movable, test::movable, test::hash, test::equal_to, test::allocator2<test::movable> >* test_map; boost::unordered_node_map<test::movable, test::movable, test::hash, test::equal_to, test::allocator2<test::movable> >* test_node_map; boost::unordered_flat_set<pointer_constructible, pointer_constructible_hash, pointer_constructible_equal_to, test::allocator1<pointer_constructible> >* test_pc_set; boost::unordered_node_set<pointer_constructible, pointer_constructible_hash, pointer_constructible_equal_to, test::allocator1<pointer_constructible> >* test_pc_node_set; UNORDERED_TEST(unique_insert_tests1, ((test_set_std_alloc)(test_node_set_std_alloc) (test_set)(test_node_set)(test_map)(test_node_map))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST( insert_tests2, ((test_set)(test_node_set)(test_map)(test_node_map))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST(unique_emplace_tests1, ((test_set_std_alloc)(test_set)(test_node_set)(test_map)(test_node_map))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST(move_emplace_tests, ((test_set_std_alloc)(test_set)(test_node_set)(test_map)(test_node_map))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST(default_emplace_tests, ((test_set_std_alloc)(test_set)(test_node_set)(test_map)(test_node_map))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST(map_tests, ((test_map)(test_node_map)) ((default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST( map_tests2, ((test_map)(test_node_map))((default_generator)(generate_collisions))) UNORDERED_TEST(map_insert_range_test1, ((test_map)(test_node_map))((default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST(map_insert_range_test2, ((test_map)(test_node_map))((default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST( set_tests, ((test_set_std_alloc)(test_set)(test_node_set))((default_generator))) UNORDERED_TEST(set_tests2, ((test_pc_set)(test_pc_node_set))) #else boost::unordered_set<test::movable, test::hash, test::equal_to, std::allocator<test::movable> >* test_set_std_alloc; boost::unordered_multimap<test::object, test::object, test::hash, test::equal_to, std::allocator<test::object> >* test_multimap_std_alloc; boost::unordered_set<test::object, test::hash, test::equal_to, test::allocator1<test::object> >* test_set; boost::unordered_multiset<test::movable, test::hash, test::equal_to, test::allocator2<test::movable> >* test_multiset; boost::unordered_map<test::movable, test::movable, test::hash, test::equal_to, test::allocator2<test::movable> >* test_map; boost::unordered_multimap<test::object, test::object, test::hash, test::equal_to, test::allocator1<test::object> >* test_multimap; boost::unordered_set<pointer_constructible, pointer_constructible_hash, pointer_constructible_equal_to, test::allocator1<pointer_constructible> >* test_pc_set; UNORDERED_TEST(unique_insert_tests1, ((test_set_std_alloc)(test_set)(test_map))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST(equivalent_insert_tests1, ((test_multimap_std_alloc)(test_multiset)(test_multimap))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST(insert_tests2, ((test_multimap_std_alloc)(test_set)(test_multiset)(test_map)(test_multimap))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST(unique_emplace_tests1, ((test_set_std_alloc)(test_set)(test_map))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST(equivalent_emplace_tests1, ((test_multimap_std_alloc)(test_multiset)(test_multimap))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST(move_emplace_tests, ((test_set_std_alloc)(test_multimap_std_alloc)(test_set)(test_map)(test_multiset)(test_multimap))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST(default_emplace_tests, ((test_set_std_alloc)(test_multimap_std_alloc)(test_set)(test_map)(test_multiset)(test_multimap))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST(map_tests, ((test_map))((default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST( map_tests2, ((test_map))((default_generator)(generate_collisions))) UNORDERED_TEST(map_insert_range_test1, ((test_multimap_std_alloc)(test_map)(test_multimap))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST(map_insert_range_test2, ((test_multimap_std_alloc)(test_map)(test_multimap))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST( set_tests, ((test_set_std_alloc)(test_set)(test_multiset))((default_generator))) UNORDERED_TEST(set_tests2, ((test_pc_set))) #endif struct initialize_from_two_ints { int a, b; friend std::size_t hash_value(initialize_from_two_ints const& x) { return static_cast<std::size_t>(x.a + x.b); } bool operator==(initialize_from_two_ints const& x) const { return a == x.a && b == x.b; } }; template <template <class Key, class Hash = boost::hash<Key>, class Pred = std::equal_to<Key>, class Allocator = std::allocator<Key> > class Set> static void insert_initializer_list_set_impl() { Set<int> set; set.insert({1, 2, 3, 1}); BOOST_TEST_EQ(set.size(), 3u); BOOST_TEST(set.find(1) != set.end()); BOOST_TEST(set.find(4) == set.end()); Set<initialize_from_two_ints> set2; #if defined(__GNUC__) && (__GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5)) set2.insert({{1, 2}}); #else set2.insert({1, 2}); #endif BOOST_TEST(set2.size() == 1); BOOST_TEST(set2.find({1, 2}) != set2.end()); BOOST_TEST(set2.find({2, 1}) == set2.end()); set2.insert({{3, 4}, {5, 6}, {7, 8}}); BOOST_TEST(set2.size() == 4); BOOST_TEST(set2.find({1, 2}) != set2.end()); BOOST_TEST(set2.find({3, 4}) != set2.end()); BOOST_TEST(set2.find({5, 6}) != set2.end()); BOOST_TEST(set2.find({7, 8}) != set2.end()); BOOST_TEST(set2.find({8, 7}) == set2.end()); set2.insert({{2, 1}, {3, 4}}); BOOST_TEST(set2.size() == 5); BOOST_TEST(set2.find({1, 2}) != set2.end()); BOOST_TEST(set2.find({2, 1}) != set2.end()); BOOST_TEST(set2.find({3, 4}) != set2.end()); BOOST_TEST(set2.find({5, 6}) != set2.end()); BOOST_TEST(set2.find({7, 8}) != set2.end()); BOOST_TEST(set2.find({8, 7}) == set2.end()); } UNORDERED_AUTO_TEST (insert_initializer_list_set) { #ifdef BOOST_UNORDERED_FOA_TESTS insert_initializer_list_set_impl<boost::unordered_flat_set>(); insert_initializer_list_set_impl<boost::unordered_node_set>(); #else insert_initializer_list_set_impl<boost::unordered_set>(); boost::unordered_set<int> set; #endif } #ifndef BOOST_UNORDERED_FOA_TESTS #if !BOOST_WORKAROUND(BOOST_MSVC, == 1800) UNORDERED_AUTO_TEST (insert_initializer_list_multiset) { boost::unordered_multiset<std::string> multiset; // multiset.insert({}); BOOST_TEST(multiset.empty()); multiset.insert({"a"}); BOOST_TEST_EQ(multiset.size(), 1u); BOOST_TEST(multiset.find("a") != multiset.end()); BOOST_TEST(multiset.find("b") == multiset.end()); multiset.insert({"a", "b"}); BOOST_TEST(multiset.size() == 3); BOOST_TEST_EQ(multiset.count("a"), 2u); BOOST_TEST_EQ(multiset.count("b"), 1u); BOOST_TEST_EQ(multiset.count("c"), 0u); } #endif #endif template <class X> static void insert_initializer_list_map(X*) { X map; BOOST_TEST(map.empty()); map.insert({{"a", "b"}, {"a", "b"}, {"d", ""}}); BOOST_TEST_EQ(map.size(), 2u); } #ifdef BOOST_UNORDERED_FOA_TESTS static boost::unordered_flat_map<std::string, std::string>* test_str_map; static boost::unordered_node_map<std::string, std::string>* test_str_node_map; // clang-format off UNORDERED_TEST(insert_initializer_list_map, ((test_str_map)(test_str_node_map))) // clang-format on #else static boost::unordered_map<std::string, std::string>* test_str_map; // clang-format off UNORDERED_TEST(insert_initializer_list_map, ((test_str_map))) // clang-format on #endif #ifndef BOOST_UNORDERED_FOA_TESTS UNORDERED_AUTO_TEST (insert_initializer_list_multimap) { boost::unordered_multimap<std::string, std::string> multimap; // multimap.insert({}); BOOST_TEST(multimap.empty()); multimap.insert({{"a", "b"}, {"a", "b"}, {"d", ""}}); BOOST_TEST_EQ(multimap.size(), 3u); BOOST_TEST_EQ(multimap.count("a"), 2u); } #endif struct overloaded_constructor { overloaded_constructor(int x1_ = 1, int x2_ = 2, int x3_ = 3, int x4_ = 4) : x1(x1_), x2(x2_), x3(x3_), x4(x4_) { } int x1, x2, x3, x4; bool operator==(overloaded_constructor const& rhs) const { return x1 == rhs.x1 && x2 == rhs.x2 && x3 == rhs.x3 && x4 == rhs.x4; } friend std::size_t hash_value(overloaded_constructor const& x) { std::size_t hash = 0; boost::hash_combine(hash, x.x1); boost::hash_combine(hash, x.x2); boost::hash_combine(hash, x.x3); boost::hash_combine(hash, x.x4); return hash; } }; template <class X> static void map_emplace_test(X*) { X x; x.emplace(); BOOST_TEST( x.find(0) != x.end() && x.find(0)->second == overloaded_constructor()); x.emplace(2, 3); BOOST_TEST( x.find(2) != x.end() && x.find(2)->second == overloaded_constructor(3)); x.try_emplace(5); BOOST_TEST( x.find(5) != x.end() && x.find(5)->second == overloaded_constructor()); } #ifndef BOOST_UNORDERED_FOA_TESTS template <class X> static void multimap_emplace_test(X*) { X x; x.emplace(); BOOST_TEST( x.find(0) != x.end() && x.find(0)->second == overloaded_constructor()); x.emplace(2, 3); BOOST_TEST( x.find(2) != x.end() && x.find(2)->second == overloaded_constructor(3)); } #endif #ifdef BOOST_UNORDERED_FOA_TESTS static boost::unordered_flat_map<int, overloaded_constructor, test::hash, test::equal_to, test::allocator1<std::pair<int const, overloaded_constructor> > >* test_oc_map; static boost::unordered_node_map<int, overloaded_constructor, test::hash, test::equal_to, test::allocator1<std::pair<int const, overloaded_constructor> > >* test_oc_node_map; UNORDERED_TEST(map_emplace_test, ((test_oc_map)(test_oc_node_map))) #else static boost::unordered_map<int, overloaded_constructor, test::hash, test::equal_to, test::allocator1<std::pair<int const, overloaded_constructor> > >* test_oc_map; static boost::unordered_multimap<int, overloaded_constructor, test::hash, test::equal_to, test::allocator1<std::pair<int const, overloaded_constructor> > >* test_oc_multimap; UNORDERED_TEST(map_emplace_test, ((test_oc_map))) UNORDERED_TEST(multimap_emplace_test, ((test_oc_multimap))) #endif template <class X> static void set_emplace_test(X*) { X x; overloaded_constructor check; x.emplace(); BOOST_TEST(x.find(check) != x.end() && *x.find(check) == check); x.clear(); x.emplace(1); check = overloaded_constructor(1); BOOST_TEST(x.find(check) != x.end() && *x.find(check) == check); x.clear(); x.emplace(2, 3); check = overloaded_constructor(2, 3); BOOST_TEST(x.find(check) != x.end() && *x.find(check) == check); x.clear(); x.emplace(4, 5, 6); check = overloaded_constructor(4, 5, 6); BOOST_TEST(x.find(check) != x.end() && *x.find(check) == check); x.clear(); x.emplace(7, 8, 9, 10); check = overloaded_constructor(7, 8, 9, 10); BOOST_TEST(x.find(check) != x.end() && *x.find(check) == check); } #ifdef BOOST_UNORDERED_FOA_TESTS static boost::unordered_flat_set<overloaded_constructor>* test_oc_set; static boost::unordered_node_set<overloaded_constructor>* test_oc_node_set; UNORDERED_TEST(set_emplace_test, ((test_oc_set)(test_oc_node_set))) #else static boost::unordered_set<overloaded_constructor>* test_oc_set; static boost::unordered_multiset<overloaded_constructor>* test_oc_multiset; UNORDERED_TEST(set_emplace_test, ((test_oc_set)(test_oc_multiset))) #endif struct derived_from_piecewise_construct_t : boost::unordered::piecewise_construct_t { }; derived_from_piecewise_construct_t piecewise_rvalue() { return derived_from_piecewise_construct_t(); } struct convertible_to_piecewise { operator boost::unordered::piecewise_construct_t() const { return boost::unordered::piecewise_construct; } }; #ifndef BOOST_UNORDERED_FOA_TESTS UNORDERED_AUTO_TEST (map_emplace_test2) { { boost::unordered_map<overloaded_constructor, overloaded_constructor, boost::hash<overloaded_constructor>, std::equal_to<overloaded_constructor>, test::allocator1< std::pair<overloaded_constructor const, overloaded_constructor> > > x; x.emplace(boost::unordered::piecewise_construct, boost::make_tuple(), boost::make_tuple()); BOOST_TEST( x.find(overloaded_constructor()) != x.end() && x.find(overloaded_constructor())->second == overloaded_constructor()); x.emplace( convertible_to_piecewise(), boost::make_tuple(1), boost::make_tuple()); BOOST_TEST( x.find(overloaded_constructor(1)) != x.end() && x.find(overloaded_constructor(1))->second == overloaded_constructor()); x.emplace(piecewise_rvalue(), boost::make_tuple(2, 3), boost::make_tuple(4, 5, 6)); BOOST_TEST(x.find(overloaded_constructor(2, 3)) != x.end() && x.find(overloaded_constructor(2, 3))->second == overloaded_constructor(4, 5, 6)); derived_from_piecewise_construct_t d; x.emplace(d, boost::make_tuple(9, 3, 1), boost::make_tuple(10)); BOOST_TEST(x.find(overloaded_constructor(9, 3, 1)) != x.end() && x.find(overloaded_constructor(9, 3, 1))->second == overloaded_constructor(10)); x.clear(); x.try_emplace(overloaded_constructor()); BOOST_TEST( x.find(overloaded_constructor()) != x.end() && x.find(overloaded_constructor())->second == overloaded_constructor()); x.try_emplace(1); BOOST_TEST( x.find(overloaded_constructor(1)) != x.end() && x.find(overloaded_constructor(1))->second == overloaded_constructor()); x.try_emplace(overloaded_constructor(2, 3), 4, 5, 6); BOOST_TEST(x.find(overloaded_constructor(2, 3)) != x.end() && x.find(overloaded_constructor(2, 3))->second == overloaded_constructor(4, 5, 6)); x.clear(); x.try_emplace(x.begin(), overloaded_constructor()); BOOST_TEST( x.find(overloaded_constructor()) != x.end() && x.find(overloaded_constructor())->second == overloaded_constructor()); x.try_emplace(x.end(), 1); BOOST_TEST( x.find(overloaded_constructor(1)) != x.end() && x.find(overloaded_constructor(1))->second == overloaded_constructor()); x.try_emplace(x.begin(), overloaded_constructor(2, 3), 4, 5, 6); BOOST_TEST(x.find(overloaded_constructor(2, 3)) != x.end() && x.find(overloaded_constructor(2, 3))->second == overloaded_constructor(4, 5, 6)); } { boost::unordered_multimap<overloaded_constructor, overloaded_constructor, boost::hash<overloaded_constructor>, std::equal_to<overloaded_constructor>, test::allocator1< std::pair<overloaded_constructor const, overloaded_constructor> > > x; x.emplace(boost::unordered::piecewise_construct, boost::make_tuple(), boost::make_tuple()); BOOST_TEST( x.find(overloaded_constructor()) != x.end() && x.find(overloaded_constructor())->second == overloaded_constructor()); x.emplace( convertible_to_piecewise(), boost::make_tuple(1), boost::make_tuple()); BOOST_TEST( x.find(overloaded_constructor(1)) != x.end() && x.find(overloaded_constructor(1))->second == overloaded_constructor()); x.emplace(piecewise_rvalue(), boost::make_tuple(2, 3), boost::make_tuple(4, 5, 6)); BOOST_TEST(x.find(overloaded_constructor(2, 3)) != x.end() && x.find(overloaded_constructor(2, 3))->second == overloaded_constructor(4, 5, 6)); derived_from_piecewise_construct_t d; x.emplace(d, boost::make_tuple(9, 3, 1), boost::make_tuple(10)); BOOST_TEST(x.find(overloaded_constructor(9, 3, 1)) != x.end() && x.find(overloaded_constructor(9, 3, 1))->second == overloaded_constructor(10)); } } UNORDERED_AUTO_TEST (set_emplace_test2) { boost::unordered_set< std::pair<overloaded_constructor, overloaded_constructor> > x; std::pair<overloaded_constructor, overloaded_constructor> check; x.emplace(boost::unordered::piecewise_construct, boost::make_tuple(), boost::make_tuple()); BOOST_TEST(x.find(check) != x.end() && *x.find(check) == check); x.clear(); x.emplace(boost::unordered::piecewise_construct, boost::make_tuple(1), boost::make_tuple(2, 3)); check = std::make_pair(overloaded_constructor(1), overloaded_constructor(2, 3)); BOOST_TEST(x.find(check) != x.end() && *x.find(check) == check); } #endif // Use the preprocessor to generate tests using different combinations of // boost/std piecewise_construct_t/tuple. #ifndef BOOST_UNORDERED_FOA_TESTS static boost::unordered_map<overloaded_constructor, overloaded_constructor, boost::hash<overloaded_constructor>, std::equal_to<overloaded_constructor>, test::allocator1<std::pair<overloaded_constructor const, overloaded_constructor> > >* test_pw_oc_map; static boost::unordered_set<std::pair<overloaded_constructor, overloaded_constructor> >* test_pair_oc_set; #define PIECEWISE_TEST_NAME boost_tuple_piecewise_tests #define PIECEWISE_NAMESPACE boost::unordered #define TUPLE_NAMESPACE boost #define EMULATING_PIECEWISE_CONSTRUCTION 1 #include "./insert_tests.cpp" #define PIECEWISE_TEST_NAME std_tuple_boost_piecewise_tests #define PIECEWISE_NAMESPACE boost::unordered #define TUPLE_NAMESPACE std #define EMULATING_PIECEWISE_CONSTRUCTION 0 #include "./insert_tests.cpp" #define PIECEWISE_TEST_NAME boost_tuple_std_piecewise_tests #define PIECEWISE_NAMESPACE std #define TUPLE_NAMESPACE boost #define EMULATING_PIECEWISE_CONSTRUCTION 1 #include "./insert_tests.cpp" #endif #ifdef BOOST_UNORDERED_FOA_TESTS static boost::unordered_flat_set<std::pair<overloaded_constructor, overloaded_constructor> >* test_pair_oc_set; static boost::unordered_node_set<std::pair<overloaded_constructor, overloaded_constructor> >* test_pair_oc_node_set; #endif #define PIECEWISE_TEST_NAME std_piecewise_tests #define PIECEWISE_NAMESPACE std #define TUPLE_NAMESPACE std #define EMULATING_PIECEWISE_CONSTRUCTION 0 #include "./insert_tests.cpp" } RUN_TESTS_QUIET() #else // PIECEWISE_TEST_NAME #define MAP_PIECEWISE_TEST BOOST_PP_CAT(map_, PIECEWISE_TEST_NAME) #define SET_PIECEWISE_TEST BOOST_PP_CAT(set_, PIECEWISE_TEST_NAME) template <class X> static void MAP_PIECEWISE_TEST(X*) { X x; x.emplace(PIECEWISE_NAMESPACE::piecewise_construct, TUPLE_NAMESPACE::make_tuple(), TUPLE_NAMESPACE::make_tuple()); BOOST_TEST( x.find(overloaded_constructor()) != x.end() && x.find(overloaded_constructor())->second == overloaded_constructor()); x.emplace(convertible_to_piecewise(), TUPLE_NAMESPACE::make_tuple(1), TUPLE_NAMESPACE::make_tuple()); BOOST_TEST( x.find(overloaded_constructor(1)) != x.end() && x.find(overloaded_constructor(1))->second == overloaded_constructor()); x.emplace(piecewise_rvalue(), TUPLE_NAMESPACE::make_tuple(2, 3), TUPLE_NAMESPACE::make_tuple(4, 5, 6)); BOOST_TEST(x.find(overloaded_constructor(2, 3)) != x.end() && x.find(overloaded_constructor(2, 3))->second == overloaded_constructor(4, 5, 6)); derived_from_piecewise_construct_t d; x.emplace( d, TUPLE_NAMESPACE::make_tuple(9, 3, 1), TUPLE_NAMESPACE::make_tuple(10)); BOOST_TEST(x.find(overloaded_constructor(9, 3, 1)) != x.end() && x.find(overloaded_constructor(9, 3, 1))->second == overloaded_constructor(10)); x.clear(); x.try_emplace(overloaded_constructor()); BOOST_TEST( x.find(overloaded_constructor()) != x.end() && x.find(overloaded_constructor())->second == overloaded_constructor()); x.try_emplace(1); BOOST_TEST( x.find(overloaded_constructor(1)) != x.end() && x.find(overloaded_constructor(1))->second == overloaded_constructor()); x.try_emplace(overloaded_constructor(2, 3), 4, 5, 6); BOOST_TEST(x.find(overloaded_constructor(2, 3)) != x.end() && x.find(overloaded_constructor(2, 3))->second == overloaded_constructor(4, 5, 6)); } template <class X> static void SET_PIECEWISE_TEST(X*) { X x; std::pair<overloaded_constructor, overloaded_constructor> check; x.emplace(PIECEWISE_NAMESPACE::piecewise_construct, TUPLE_NAMESPACE::make_tuple(), TUPLE_NAMESPACE::make_tuple()); BOOST_TEST(x.find(check) != x.end() && *x.find(check) == check); x.clear(); x.emplace(PIECEWISE_NAMESPACE::piecewise_construct, TUPLE_NAMESPACE::make_tuple(1), TUPLE_NAMESPACE::make_tuple(2, 3)); check = std::make_pair(overloaded_constructor(1), overloaded_constructor(2, 3)); BOOST_TEST(x.find(check) != x.end() && *x.find(check) == check); } #if defined(BOOST_UNORDERED_FOA_TESTS) static boost::unordered_flat_map<overloaded_constructor, overloaded_constructor, boost::hash<overloaded_constructor>, std::equal_to<overloaded_constructor>, test::allocator1<std::pair<overloaded_constructor const, overloaded_constructor> > >* test_pw_oc_map; static boost::unordered_node_map<overloaded_constructor, overloaded_constructor, boost::hash<overloaded_constructor>, std::equal_to<overloaded_constructor>, test::allocator1<std::pair<overloaded_constructor const, overloaded_constructor> > >* test_pw_oc_node_map; // clang-format off UNORDERED_TEST(MAP_PIECEWISE_TEST, ((test_pw_oc_map)(test_pw_oc_node_map))) // clang-format on #else // clang-format off UNORDERED_TEST(MAP_PIECEWISE_TEST, ((test_pw_oc_map))) // clang-format on #endif #ifndef BOOST_UNORDERED_FOA_TESTS UNORDERED_AUTO_TEST (BOOST_PP_CAT(multimap_, PIECEWISE_TEST_NAME)) { { boost::unordered_multimap<overloaded_constructor, overloaded_constructor, boost::hash<overloaded_constructor>, std::equal_to<overloaded_constructor>, test::allocator1< std::pair<overloaded_constructor const, overloaded_constructor> > > x; x.emplace(PIECEWISE_NAMESPACE::piecewise_construct, TUPLE_NAMESPACE::make_tuple(), TUPLE_NAMESPACE::make_tuple()); BOOST_TEST( x.find(overloaded_constructor()) != x.end() && x.find(overloaded_constructor())->second == overloaded_constructor()); x.emplace(convertible_to_piecewise(), TUPLE_NAMESPACE::make_tuple(1), TUPLE_NAMESPACE::make_tuple()); BOOST_TEST( x.find(overloaded_constructor(1)) != x.end() && x.find(overloaded_constructor(1))->second == overloaded_constructor()); x.emplace(piecewise_rvalue(), TUPLE_NAMESPACE::make_tuple(2, 3), TUPLE_NAMESPACE::make_tuple(4, 5, 6)); BOOST_TEST(x.find(overloaded_constructor(2, 3)) != x.end() && x.find(overloaded_constructor(2, 3))->second == overloaded_constructor(4, 5, 6)); derived_from_piecewise_construct_t d; x.emplace(d, TUPLE_NAMESPACE::make_tuple(9, 3, 1), TUPLE_NAMESPACE::make_tuple(10)); BOOST_TEST(x.find(overloaded_constructor(9, 3, 1)) != x.end() && x.find(overloaded_constructor(9, 3, 1))->second == overloaded_constructor(10)); } } #endif #ifdef BOOST_UNORDERED_FOA_TESTS // clang-format off UNORDERED_TEST(SET_PIECEWISE_TEST, ((test_pair_oc_set)(test_pair_oc_node_set))) // clang-format on #else // clang-format off UNORDERED_TEST(SET_PIECEWISE_TEST, ((test_pair_oc_set))) // clang-format on #endif #undef PIECEWISE_TEST_NAME #undef PIECEWISE_NAMESPACE #undef TUPLE_NAMESPACE #undef EMULATING_PIECEWISE_CONSTRUCTION #endif
0
repos/unordered/test
repos/unordered/test/unordered/insert_node_type_fail.cpp
// Copyright 2017 Daniel James. // 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) #include <boost/unordered_map.hpp> #include <boost/unordered_set.hpp> int main() { #if defined(UNORDERED_TEST_MAP) typedef boost::unordered_map<int, int> container; container x; x.emplace(1, 1); #elif defined(UNORDERED_TEST_MULTIMAP) typedef boost::unordered_multimap<int, int> container; container x; #elif defined(UNORDERED_TEST_SET) typedef boost::unordered_set<int> container; container x; x.emplace(1); #elif defined(UNORDERED_TEST_MULTISET) typedef boost::unordered_multiset<int> container; container x; x.emplace(1); #else #define UNORDERED_ERROR #endif #if !defined(UNORDERED_ERROR) container::node_type n = x.extract(x.begin()); x.insert(n); #endif }
0
repos/unordered/test
repos/unordered/test/unordered/self_include_tests_obj.cpp
#ifndef BOOST_UNORDERED_HEADER #error "this test requires a class template be passed as a macro" #endif #define STRINGIZE(text) STRINGIZE_I(text) #define STRINGIZE_I(...) #__VA_ARGS__ #define HEADER STRINGIZE(BOOST_UNORDERED_HEADER) #include HEADER
0
repos/unordered/test
repos/unordered/test/unordered/swap_tests.cpp
// Copyright 2006-2009 Daniel James. // Copyright 2022-2023 Christian Mazakas. // 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) #include "../helpers/unordered.hpp" #include <boost/config.hpp> #include <algorithm> #include <iterator> #include "../helpers/test.hpp" #include "../objects/test.hpp" #include "../objects/cxx11_allocator.hpp" #include "../helpers/random_values.hpp" #include "../helpers/tracker.hpp" #include "../helpers/invariants.hpp" #if defined(BOOST_MSVC) #pragma warning(disable : 4127) // conditional expression is constant #endif namespace swap_tests { test::seed_t initialize_seed(783472); template <class X> void swap_test_impl(X& x1, X& x2) { test::ordered<X> tracker1 = test::create_ordered(x1); test::ordered<X> tracker2 = test::create_ordered(x2); tracker1.insert_range(x1.begin(), x1.end()); tracker2.insert_range(x2.begin(), x2.end()); x1.swap(x2); tracker1.compare(x2); tracker2.compare(x1); } template <class X> void swap_tests1(X*, test::random_generator generator) { { test::check_instances check_; X x; swap_test_impl(x, x); } { test::check_instances check_; X x, y; swap_test_impl(x, y); } { test::check_instances check_; test::random_values<X> v(1000, generator); X x, y(v.begin(), v.end()); swap_test_impl(x, y); swap_test_impl(x, y); } { test::check_instances check_; test::random_values<X> vx(1000, generator), vy(1000, generator); X x(vx.begin(), vx.end()), y(vy.begin(), vy.end()); swap_test_impl(x, y); swap_test_impl(x, y); } } template <class X> void swap_tests2(X* ptr, test::random_generator generator) { swap_tests1(ptr, generator); typedef typename X::hasher hasher; typedef typename X::key_equal key_equal; typedef typename X::allocator_type allocator_type; { test::check_instances check_; X x(0, hasher(1), key_equal(1)); X y(0, hasher(2), key_equal(2)); swap_test_impl(x, y); } { test::check_instances check_; test::random_values<X> v(1000, generator); X x(v.begin(), v.end(), 0, hasher(1), key_equal(1)); X y(0, hasher(2), key_equal(2)); swap_test_impl(x, y); } { test::check_instances check_; test::random_values<X> vx(100, generator), vy(50, generator); X x(vx.begin(), vx.end(), 0, hasher(1), key_equal(1)); X y(vy.begin(), vy.end(), 0, hasher(2), key_equal(2)); swap_test_impl(x, y); swap_test_impl(x, y); } { test::force_equal_allocator force_(!allocator_type::is_propagate_on_swap); test::check_instances check_; test::random_values<X> vx(50, generator), vy(100, generator); X x(vx.begin(), vx.end(), 0, hasher(), key_equal(), allocator_type(1)); X y(vy.begin(), vy.end(), 0, hasher(), key_equal(), allocator_type(2)); if (allocator_type::is_propagate_on_swap || x.get_allocator() == y.get_allocator()) { swap_test_impl(x, y); } } { test::force_equal_allocator force_(!allocator_type::is_propagate_on_swap); test::check_instances check_; test::random_values<X> vx(100, generator), vy(100, generator); X x(vx.begin(), vx.end(), 0, hasher(1), key_equal(1), allocator_type(1)); X y(vy.begin(), vy.end(), 0, hasher(2), key_equal(2), allocator_type(2)); if (allocator_type::is_propagate_on_swap || x.get_allocator() == y.get_allocator()) { swap_test_impl(x, y); swap_test_impl(x, y); } } } using test::default_generator; using test::generate_collisions; using test::limited_range; template <typename T> bool is_propagate(T*) { return T::allocator_type::is_propagate_on_swap; } #ifdef BOOST_UNORDERED_FOA_TESTS boost::unordered_flat_map<test::object, test::object, test::hash, test::equal_to, std::allocator<test::object> >* test_map_std_alloc; boost::unordered_flat_set<test::object, test::hash, test::equal_to, test::allocator1<test::object> >* test_set; boost::unordered_flat_map<test::object, test::object, test::hash, test::equal_to, test::allocator1<test::object> >* test_map; boost::unordered_flat_set<test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::propagate_swap> >* test_set_prop_swap; boost::unordered_flat_map<test::object, test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::propagate_swap> >* test_map_prop_swap; boost::unordered_flat_set<test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::no_propagate_swap> >* test_set_no_prop_swap; boost::unordered_flat_map<test::object, test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::no_propagate_swap> >* test_map_no_prop_swap; boost::unordered_node_map<test::object, test::object, test::hash, test::equal_to, std::allocator<test::object> >* test_node_map_std_alloc; boost::unordered_node_set<test::object, test::hash, test::equal_to, test::allocator1<test::object> >* test_node_set; boost::unordered_node_map<test::object, test::object, test::hash, test::equal_to, test::allocator1<test::object> >* test_node_map; boost::unordered_node_set<test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::propagate_swap> >* test_node_set_prop_swap; boost::unordered_node_map<test::object, test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::propagate_swap> >* test_node_map_prop_swap; boost::unordered_node_set<test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::no_propagate_swap> >* test_node_set_no_prop_swap; boost::unordered_node_map<test::object, test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::no_propagate_swap> >* test_node_map_no_prop_swap; UNORDERED_AUTO_TEST (check_traits) { BOOST_TEST(!is_propagate(test_set)); BOOST_TEST(is_propagate(test_set_prop_swap)); BOOST_TEST(!is_propagate(test_set_no_prop_swap)); BOOST_TEST(!is_propagate(test_node_set)); BOOST_TEST(is_propagate(test_node_set_prop_swap)); BOOST_TEST(!is_propagate(test_node_set_no_prop_swap)); } // clang-format off UNORDERED_TEST(swap_tests1, ((test_map_std_alloc)(test_set)(test_map) (test_set_prop_swap)(test_map_prop_swap) (test_set_no_prop_swap)(test_map_no_prop_swap) (test_node_map_std_alloc)(test_node_set)(test_node_map) (test_node_set_prop_swap)(test_node_map_prop_swap) (test_node_set_no_prop_swap)(test_node_map_no_prop_swap))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST(swap_tests2, ((test_set)(test_map) (test_set_prop_swap)(test_map_prop_swap) (test_set_no_prop_swap)(test_map_no_prop_swap) (test_node_set)(test_node_map) (test_node_set_prop_swap)(test_node_map_prop_swap) (test_node_set_no_prop_swap)(test_node_map_no_prop_swap))( (default_generator)(generate_collisions)(limited_range))) // clang-format on #else boost::unordered_map<test::object, test::object, test::hash, test::equal_to, std::allocator<test::object> >* test_map_std_alloc; boost::unordered_set<test::object, test::hash, test::equal_to, test::allocator1<test::object> >* test_set; boost::unordered_multiset<test::object, test::hash, test::equal_to, test::allocator2<test::object> >* test_multiset; boost::unordered_map<test::object, test::object, test::hash, test::equal_to, test::allocator1<test::object> >* test_map; boost::unordered_multimap<test::object, test::object, test::hash, test::equal_to, test::allocator2<test::object> >* test_multimap; boost::unordered_set<test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::propagate_swap> >* test_set_prop_swap; boost::unordered_multiset<test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::propagate_swap> >* test_multiset_prop_swap; boost::unordered_map<test::object, test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::propagate_swap> >* test_map_prop_swap; boost::unordered_multimap<test::object, test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::propagate_swap> >* test_multimap_prop_swap; boost::unordered_set<test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::no_propagate_swap> >* test_set_no_prop_swap; boost::unordered_multiset<test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::no_propagate_swap> >* test_multiset_no_prop_swap; boost::unordered_map<test::object, test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::no_propagate_swap> >* test_map_no_prop_swap; boost::unordered_multimap<test::object, test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::no_propagate_swap> >* test_multimap_no_prop_swap; UNORDERED_AUTO_TEST (check_traits) { BOOST_TEST(!is_propagate(test_set)); BOOST_TEST(is_propagate(test_set_prop_swap)); BOOST_TEST(!is_propagate(test_set_no_prop_swap)); } UNORDERED_TEST( swap_tests1, ((test_map_std_alloc)(test_set)(test_multiset)(test_map)( test_multimap)(test_set_prop_swap)(test_multiset_prop_swap)( test_map_prop_swap)(test_multimap_prop_swap)( test_set_no_prop_swap)(test_multiset_no_prop_swap)( test_map_no_prop_swap)(test_multimap_no_prop_swap))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST(swap_tests2, ((test_set)(test_multiset)(test_map)(test_multimap)(test_set_prop_swap)( test_multiset_prop_swap)(test_map_prop_swap)(test_multimap_prop_swap)( test_set_no_prop_swap)(test_multiset_no_prop_swap)(test_map_no_prop_swap)( test_multimap_no_prop_swap))( (default_generator)(generate_collisions)(limited_range))) #endif } RUN_TESTS()
0
repos/unordered/test
repos/unordered/test/unordered/scary_tests.cpp
// Copyright 2022-2023 Christian Mazakas. // 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) #include "../helpers/test.hpp" #include "../helpers/unordered.hpp" #include "../objects/test.hpp" #include <memory> struct hash1 { template <class Key> std::size_t operator()(Key const&) const { return 1337; } }; struct hash2 { template <class Key> std::size_t operator()(Key const&) const { return 7331; } }; struct equal1 { template <class T> bool operator==(T const&) const { return true; } }; struct equal2 { template <class T> bool operator==(T const&) const { return true; } }; /////////////////////////////////////////////////////////////////////////////// // we define two duplicated allocators here, each one having the same smart // pointer type // we want to prove in our test that different allocators with the same pointers // (either fancy or raw) work equally well for our SCARY iterators // template <class T> struct allocator1 { #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS public: #else template <class> friend struct allocator1; #endif public: typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; typedef test::void_ptr void_pointer; typedef test::void_const_ptr const_void_pointer; typedef test::ptr<T> pointer; typedef test::const_ptr<T> const_pointer; typedef T& reference; typedef T const& const_reference; typedef T value_type; template <class U> struct rebind { typedef allocator1<U> other; }; allocator1() {} template <class Y> allocator1(allocator1<Y> const&) {} allocator1(allocator1 const&) {} ~allocator1() {} pointer address(reference r) { return pointer(&r); } const_pointer address(const_reference r) { return const_pointer(&r); } pointer allocate(size_type n) { pointer p(static_cast<T*>(::operator new(n * sizeof(T)))); return p; } pointer allocate(size_type n, void const*) { pointer ptr(static_cast<T*>(::operator new(n * sizeof(T)))); return ptr; } void deallocate(pointer p, size_type) { ::operator delete((void*)p.operator->()); } template <class U, class... Args> void construct(U* p, Args&&... args) { new (p) U(std::forward<Args>(args)...); } // msvc-12.0 and msvc-14.0 seem to eliminate the destructor call as we're only // ever using it with an int with has a trivial destructor so it eliminates // the code and generates a warning about an unused variable // template <class U> void destroy(U* p) { (void)p; p->~U(); } size_type max_size() const { return (std::numeric_limits<size_type>::max)(); } bool operator==(allocator1 const&) const { return true; } bool operator!=(allocator1 const&) const { return false; } enum { is_select_on_copy = false, is_propagate_on_swap = false, is_propagate_on_assign = false, is_propagate_on_move = false }; }; template <class T> struct allocator2 { #ifdef BOOST_NO_MEMBER_TEMPLATE_FRIENDS public: #else template <class> friend struct allocator2; #endif public: typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; typedef test::void_ptr void_pointer; typedef test::void_const_ptr const_void_pointer; typedef test::ptr<T> pointer; typedef test::const_ptr<T> const_pointer; typedef T& reference; typedef T const& const_reference; typedef T value_type; template <class U> struct rebind { typedef allocator2<U> other; }; allocator2() {} template <class Y> allocator2(allocator2<Y> const&) {} allocator2(allocator2 const&) {} ~allocator2() {} pointer address(reference r) { return pointer(&r); } const_pointer address(const_reference r) { return const_pointer(&r); } pointer allocate(size_type n) { pointer p(static_cast<T*>(::operator new(n * sizeof(T)))); return p; } pointer allocate(size_type n, void const*) { pointer ptr(static_cast<T*>(::operator new(n * sizeof(T)))); return ptr; } void deallocate(pointer p, size_type) { ::operator delete((void*)p.ptr_); } template <class U, class... Args> void construct(U* p, Args&&... args) { new (p) U(std::forward<Args>(args)...); } // msvc-12.0 and msvc-14.0 seem to eliminate the destructor call as we're only // ever using it with an int with has a trivial destructor so it eliminates // the code and generates a warning about an unused variable // template <class U> void destroy(U* p) { (void)p; p->~U(); } size_type max_size() const { return (std::numeric_limits<size_type>::max)(); } bool operator==(allocator2 const&) const { return true; } bool operator!=(allocator2 const&) const { return false; } enum { is_select_on_copy = false, is_propagate_on_swap = false, is_propagate_on_assign = false, is_propagate_on_move = false }; }; template <class C1, class C2> void scary_test() { C1 x; C2 y; typename C2::iterator begin(x.begin()); BOOST_TEST(begin == x.end()); typename C2::const_iterator cbegin(x.cbegin()); BOOST_TEST(cbegin == x.cend()); #ifndef BOOST_UNORDERED_FOA_TESTS typename C2::local_iterator lbegin(x.begin(0)); BOOST_TEST(lbegin == x.end(0)); typename C2::const_local_iterator clbegin(x.cbegin(0)); BOOST_TEST(clbegin == x.cend(0)); #endif } template < template <class Key, class T, class Hash, class KeyEqual, class Allocator> class Map> void map_scary_test() { typedef std::pair<int const, int> value_type; typedef std::allocator<value_type> std_allocator_type; typedef Map<int, int, hash1, std::equal_to<int>, std_allocator_type> hash1_unordered_map; typedef Map<int, int, hash2, std::equal_to<int>, std_allocator_type> hash2_unordered_map; typedef Map<int, int, boost::hash<int>, equal1, std_allocator_type> equal1_unordered_map; typedef Map<int, int, boost::hash<int>, equal2, std_allocator_type> equal2_unordered_map; // test allocators with a raw pointer as their `::pointer` type // typedef Map<int, int, boost::hash<int>, std::equal_to<int>, test::allocator1<value_type> > alloc1_unordered_map; typedef Map<int, int, boost::hash<int>, std::equal_to<int>, std_allocator_type> std_alloc_unordered_map; // test allocators with a fancy pointer as their `::pointer` type // typedef Map<int, int, boost::hash<int>, std::equal_to<int>, allocator1<value_type> > fancy1_unordered_map; typedef Map<int, int, boost::hash<int>, std::equal_to<int>, allocator2<value_type> > fancy2_unordered_map; scary_test<alloc1_unordered_map, std_alloc_unordered_map>(); scary_test<hash1_unordered_map, hash2_unordered_map>(); scary_test<equal1_unordered_map, equal2_unordered_map>(); scary_test<fancy1_unordered_map, fancy2_unordered_map>(); } template <template <class Key, class Hash, class KeyEqual, class Allocator> class Set> void set_scary_test() { typedef int value_type; typedef std::allocator<value_type> std_allocator_type; typedef Set<int, hash1, std::equal_to<int>, std_allocator_type> hash1_unordered_set; typedef Set<int, hash2, std::equal_to<int>, std_allocator_type> hash2_unordered_set; typedef Set<int, boost::hash<int>, equal1, std_allocator_type> equal1_unordered_set; typedef Set<int, boost::hash<int>, equal2, std_allocator_type> equal2_unordered_set; // test allocators with a raw pointer as their `::pointer` type // typedef Set<int, boost::hash<int>, std::equal_to<int>, test::allocator1<value_type> > alloc1_unordered_set; typedef Set<int, boost::hash<int>, std::equal_to<int>, std_allocator_type> std_alloc_unordered_set; // test allocators with a fancy pointer as their `::pointer` type // typedef Set<int, boost::hash<int>, std::equal_to<int>, allocator1<value_type> > fancy1_unordered_set; typedef Set<int, boost::hash<int>, std::equal_to<int>, allocator2<value_type> > fancy2_unordered_set; scary_test<alloc1_unordered_set, std_alloc_unordered_set>(); scary_test<hash1_unordered_set, hash2_unordered_set>(); scary_test<equal1_unordered_set, equal2_unordered_set>(); scary_test<fancy1_unordered_set, fancy2_unordered_set>(); } UNORDERED_AUTO_TEST (scary_tests) { #ifdef BOOST_UNORDERED_FOA_TESTS map_scary_test<boost::unordered_flat_map>(); map_scary_test<boost::unordered_node_map>(); set_scary_test<boost::unordered_flat_set>(); set_scary_test<boost::unordered_node_set>(); #else map_scary_test<boost::unordered_map>(); map_scary_test<boost::unordered_multimap>(); set_scary_test<boost::unordered_set>(); set_scary_test<boost::unordered_multiset>(); #endif } RUN_TESTS()
0
repos/unordered/test
repos/unordered/test/unordered/assign_tests.cpp
// Copyright 2006-2009 Daniel James. // Copyright 2022-2023 Christian Mazakas. // 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) #include "../helpers/unordered.hpp" #include "../helpers/test.hpp" #include "../objects/test.hpp" #include "../objects/cxx11_allocator.hpp" #include "../helpers/random_values.hpp" #include "../helpers/tracker.hpp" #include "../helpers/equivalent.hpp" #if defined(BOOST_MSVC) #pragma warning(disable : 4127) // conditional expression is constant #endif #if defined(__clang__) && defined(__has_warning) #if __has_warning("-Wself-assign-overloaded") #pragma clang diagnostic ignored "-Wself-assign-overloaded" #endif #endif namespace assign_tests { test::seed_t initialize_seed(96785); template <class T> void assign_tests1(T*, test::random_generator generator) { typename T::hasher hf; typename T::key_equal eq; BOOST_LIGHTWEIGHT_TEST_OSTREAM << "assign_tests1.1\n"; { test::check_instances check_; T x; x = x; BOOST_TEST(x.empty()); BOOST_TEST(test::equivalent(x.hash_function(), hf)); BOOST_TEST(test::equivalent(x.key_eq(), eq)); } BOOST_LIGHTWEIGHT_TEST_OSTREAM << "assign_tests1.2\n"; { test::check_instances check_; test::random_values<T> v(1000, generator); T x(v.begin(), v.end()); test::ordered<T> tracker = test::create_ordered(x); tracker.insert_range(v.begin(), v.end()); x = x; tracker.compare(x); T y; y.max_load_factor(x.max_load_factor() / 20); float mlf = x.max_load_factor(); y = x; tracker.compare(x); tracker.compare(y); BOOST_TEST(x.max_load_factor() == mlf); BOOST_TEST(y.max_load_factor() == mlf); BOOST_TEST(y.load_factor() <= y.max_load_factor()); } } template <class T> void assign_tests2(T*, test::random_generator generator) { typename T::hasher hf1(1); typename T::hasher hf2(2); typename T::key_equal eq1(1); typename T::key_equal eq2(2); typename T::allocator_type al1(1); typename T::allocator_type al2(2); typedef typename T::allocator_type allocator_type; BOOST_LIGHTWEIGHT_TEST_OSTREAM << "assign_tests2.0 - empty container\n"; { test::check_instances check_; T x1(0, hf1, eq1); T x2(0, hf2, eq2); x2 = x1; BOOST_TEST(test::equivalent(x1.hash_function(), hf1)); BOOST_TEST(test::equivalent(x1.key_eq(), eq1)); BOOST_TEST(test::equivalent(x2.hash_function(), hf1)); BOOST_TEST(test::equivalent(x2.key_eq(), eq1)); test::check_container(x1, x2); } BOOST_LIGHTWEIGHT_TEST_OSTREAM << "assign_tests2.1\n"; { test::check_instances check_; test::random_values<T> v(1000, generator); T x1(v.begin(), v.end(), 0, hf1, eq1); T x2(0, hf2, eq2); x2 = x1; BOOST_TEST(test::equivalent(x1.hash_function(), hf1)); BOOST_TEST(test::equivalent(x1.key_eq(), eq1)); BOOST_TEST(test::equivalent(x2.hash_function(), hf1)); BOOST_TEST(test::equivalent(x2.key_eq(), eq1)); test::check_container(x1, v); test::check_container(x2, v); BOOST_TEST(x2.load_factor() <= x2.max_load_factor()); } BOOST_LIGHTWEIGHT_TEST_OSTREAM << "assign_tests2.1a\n"; { test::check_instances check_; test::random_values<T> v1(0, generator); test::random_values<T> v2(1000, generator); T x1(0, hf2, eq2); T x2(v2.begin(), v2.end(), 0, hf1, eq1); x2 = x1; BOOST_TEST(test::equivalent(x1.hash_function(), hf2)); BOOST_TEST(test::equivalent(x1.key_eq(), eq2)); BOOST_TEST(test::equivalent(x2.hash_function(), hf2)); BOOST_TEST(test::equivalent(x2.key_eq(), eq2)); test::check_container(x1, v1); test::check_container(x2, v1); BOOST_TEST(x2.load_factor() <= x2.max_load_factor()); } BOOST_LIGHTWEIGHT_TEST_OSTREAM << "assign_tests2.2\n"; { test::check_instances check_; test::random_values<T> v1(100, generator), v2(100, generator); T x1(v1.begin(), v1.end(), 0, hf1, eq1, al1); T x2(v2.begin(), v2.end(), 0, hf2, eq2, al2); x2 = x1; BOOST_TEST(test::equivalent(x2.hash_function(), hf1)); BOOST_TEST(test::equivalent(x2.key_eq(), eq1)); if (allocator_type::is_propagate_on_assign) { BOOST_TEST(test::equivalent(x2.get_allocator(), al1)); BOOST_TEST(!test::equivalent(x2.get_allocator(), al2)); } else { BOOST_TEST(test::equivalent(x2.get_allocator(), al2)); BOOST_TEST(!test::equivalent(x2.get_allocator(), al1)); } test::check_container(x1, v1); test::check_container(x2, v1); BOOST_TEST(x2.load_factor() <= x2.max_load_factor()); } BOOST_LIGHTWEIGHT_TEST_OSTREAM << "assign_tests2.3\n"; { test::check_instances check_; test::random_values<T> v1(100, generator), v2(1000, generator); T x1(v1.begin(), v1.end(), 0, hf1, eq1, al1); T x2(v2.begin(), v2.end(), 0, hf2, eq2, al2); x2 = x1; BOOST_TEST(test::equivalent(x2.hash_function(), hf1)); BOOST_TEST(test::equivalent(x2.key_eq(), eq1)); if (allocator_type::is_propagate_on_assign) { BOOST_TEST(test::equivalent(x2.get_allocator(), al1)); BOOST_TEST(!test::equivalent(x2.get_allocator(), al2)); } else { BOOST_TEST(test::equivalent(x2.get_allocator(), al2)); BOOST_TEST(!test::equivalent(x2.get_allocator(), al1)); } test::check_container(x1, v1); test::check_container(x2, v1); BOOST_TEST(x2.load_factor() <= x2.max_load_factor()); } BOOST_LIGHTWEIGHT_TEST_OSTREAM << "assign_tests2.4\n"; { test::check_instances check_; test::random_values<T> v1(1000, generator), v2(100, generator); T x1(v1.begin(), v1.end(), 0, hf1, eq1, al1); T x2(v2.begin(), v2.end(), 0, hf2, eq2, al2); x2 = x1; BOOST_TEST(test::equivalent(x2.hash_function(), hf1)); BOOST_TEST(test::equivalent(x2.key_eq(), eq1)); if (allocator_type::is_propagate_on_assign) { BOOST_TEST(test::equivalent(x2.get_allocator(), al1)); BOOST_TEST(!test::equivalent(x2.get_allocator(), al2)); } else { BOOST_TEST(test::equivalent(x2.get_allocator(), al2)); BOOST_TEST(!test::equivalent(x2.get_allocator(), al1)); } test::check_container(x1, v1); test::check_container(x2, v1); BOOST_TEST(x2.load_factor() <= x2.max_load_factor()); } BOOST_LIGHTWEIGHT_TEST_OSTREAM << "gh205\n"; { // https://github.com/boostorg/unordered/issues/205 { // A=B // assign no-allocated to empty-but-allocated test::check_instances check_; test::random_values<T> v1(1, generator); T x1(v1.begin(), v1.end(), 0, hf1, eq1, al1); T x2(0, hf2, eq2, al2); x1.clear(); x1 = x2; BOOST_TEST(x1.empty()); BOOST_TEST(x1.begin() == x1.end()); BOOST_TEST(x2.empty()); BOOST_TEST(x2.begin() == x2.end()); } { // B=A // assign empty-but-allocated to no-allocated test::check_instances check_; test::random_values<T> v1(1, generator); T x1(v1.begin(), v1.end(), 0, hf1, eq1, al1); T x2(0, hf2, eq2, al2); x1.clear(); x2 = x1; BOOST_TEST(x2.empty()); BOOST_TEST(x2.begin() == x2.end()); BOOST_TEST(x1.empty()); BOOST_TEST(x1.begin() == x1.end()); } { // A=A // assign empty-but-allocated to empty-but-allocated test::check_instances check_; test::random_values<T> v1(1, generator); test::random_values<T> v2(1, generator); T x1(v1.begin(), v1.end(), 0, hf1, eq1, al1); T x2(v2.begin(), v2.end(), 0, hf2, eq2, al2); x1.clear(); x2.clear(); x1 = x2; BOOST_TEST(x1.empty()); BOOST_TEST(x1.begin() == x1.end()); BOOST_TEST(x2.empty()); BOOST_TEST(x2.begin() == x2.end()); } { // B=B // assign no-allocated to no-allocated test::check_instances check_; T x1(0, hf1, eq1, al1); T x2(0, hf2, eq2, al2); x1 = x2; BOOST_TEST(x2.empty()); BOOST_TEST(x2.begin() == x2.end()); BOOST_TEST(x1.empty()); BOOST_TEST(x1.begin() == x1.end()); } #ifdef BOOST_UNORDERED_FOA_TESTS { // check that optimized copying preserves the anti-drift mechanism test::check_instances check_; test::random_values<T> v1(2000, generator); test::random_values<T> v2(2000, generator); T x1(v1.begin(), v1.end(), 0, hf1, eq1, al1); T x2(v2.begin(), v2.end(), 0, hf2, eq2, al2); auto ml = x1.max_load(); while (ml == x1.max_load() && x1.size()) { x1.erase(x1.begin()); }; BOOST_TEST_EQ(x1.bucket_count(), x2.bucket_count()); x2 = x1; if (x1.max_load() != x2.max_load()) { BOOST_TEST(boost::allocator_propagate_on_container_copy_assignment< typename T::allocator_type>::type::value); } } #endif } } using test::default_generator; using test::generate_collisions; using test::limited_range; template <typename T> bool is_propagate(T*) { return T::allocator_type::is_propagate_on_assign; } #ifdef BOOST_UNORDERED_FOA_TESTS boost::unordered_flat_map<test::object, test::object, test::hash, test::equal_to, std::allocator<test::object> >* test_map_std_alloc; boost::unordered_node_map<test::object, test::object, test::hash, test::equal_to, std::allocator<test::object> >* test_node_map_std_alloc; boost::unordered_flat_set<test::object, test::hash, test::equal_to, test::allocator1<test::object> >* test_set; boost::unordered_node_set<test::object, test::hash, test::equal_to, test::allocator1<test::object> >* test_node_set; boost::unordered_flat_map<test::object, test::object, test::hash, test::equal_to, test::allocator2<test::object> >* test_map; boost::unordered_node_map<test::object, test::object, test::hash, test::equal_to, test::allocator2<test::object> >* test_node_map; boost::unordered_flat_set<test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::propagate_assign> >* test_set_prop_assign; boost::unordered_node_set<test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::propagate_assign> >* test_node_set_prop_assign; boost::unordered_flat_map<test::object, test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::propagate_assign> >* test_map_prop_assign; boost::unordered_node_map<test::object, test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::propagate_assign> >* test_node_map_prop_assign; boost::unordered_flat_set<test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::no_propagate_assign> >* test_set_no_prop_assign; boost::unordered_node_set<test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::no_propagate_assign> >* test_node_set_no_prop_assign; boost::unordered_flat_map<test::object, test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::no_propagate_assign> >* test_map_no_prop_assign; boost::unordered_node_map<test::object, test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::no_propagate_assign> >* test_node_map_no_prop_assign; UNORDERED_AUTO_TEST (check_traits) { BOOST_TEST(!is_propagate(test_set)); BOOST_TEST(is_propagate(test_set_prop_assign)); BOOST_TEST(!is_propagate(test_set_no_prop_assign)); BOOST_TEST(!is_propagate(test_node_set)); BOOST_TEST(is_propagate(test_node_set_prop_assign)); BOOST_TEST(!is_propagate(test_node_set_no_prop_assign)); } UNORDERED_TEST(assign_tests1, ((test_map_std_alloc)(test_node_map_std_alloc) (test_set)(test_node_set) (test_map)(test_node_map) (test_set_prop_assign)(test_node_set_prop_assign) (test_map_prop_assign)(test_node_map_prop_assign) (test_set_no_prop_assign)(test_node_set_no_prop_assign) (test_map_no_prop_assign)(test_node_map_no_prop_assign))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST(assign_tests2, ((test_set)(test_node_set) (test_map)(test_node_map) (test_set_prop_assign)(test_node_set_prop_assign) (test_map_prop_assign)(test_node_map_prop_assign) (test_set_no_prop_assign)(test_node_set_no_prop_assign) (test_map_no_prop_assign)(test_node_map_no_prop_assign))( (default_generator)(generate_collisions)(limited_range))) #else boost::unordered_map<test::object, test::object, test::hash, test::equal_to, std::allocator<test::object> >* test_map_std_alloc; boost::unordered_set<test::object, test::hash, test::equal_to, test::allocator1<test::object> >* test_set; boost::unordered_multiset<test::object, test::hash, test::equal_to, test::allocator2<test::object> >* test_multiset; boost::unordered_map<test::object, test::object, test::hash, test::equal_to, test::allocator2<test::object> >* test_map; boost::unordered_multimap<test::object, test::object, test::hash, test::equal_to, test::allocator1<test::object> >* test_multimap; boost::unordered_set<test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::propagate_assign> >* test_set_prop_assign; boost::unordered_multiset<test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::propagate_assign> >* test_multiset_prop_assign; boost::unordered_map<test::object, test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::propagate_assign> >* test_map_prop_assign; boost::unordered_multimap<test::object, test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::propagate_assign> >* test_multimap_prop_assign; boost::unordered_set<test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::no_propagate_assign> >* test_set_no_prop_assign; boost::unordered_multiset<test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::no_propagate_assign> >* test_multiset_no_prop_assign; boost::unordered_map<test::object, test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::no_propagate_assign> >* test_map_no_prop_assign; boost::unordered_multimap<test::object, test::object, test::hash, test::equal_to, test::cxx11_allocator<test::object, test::no_propagate_assign> >* test_multimap_no_prop_assign; UNORDERED_AUTO_TEST (check_traits) { BOOST_TEST(!is_propagate(test_set)); BOOST_TEST(is_propagate(test_set_prop_assign)); BOOST_TEST(!is_propagate(test_set_no_prop_assign)); } UNORDERED_TEST(assign_tests1, ((test_map_std_alloc)(test_set)(test_multiset)(test_map)(test_multimap)( test_set_prop_assign)(test_multiset_prop_assign)(test_map_prop_assign)( test_multimap_prop_assign)(test_set_no_prop_assign)( test_multiset_no_prop_assign)(test_map_no_prop_assign)( test_multimap_no_prop_assign))( (default_generator)(generate_collisions)(limited_range))) UNORDERED_TEST( assign_tests2, ((test_set)(test_multiset)(test_map)(test_multimap)( test_set_prop_assign)(test_multiset_prop_assign)( test_map_prop_assign)(test_multimap_prop_assign)( test_set_no_prop_assign)(test_multiset_no_prop_assign)( test_map_no_prop_assign)(test_multimap_no_prop_assign))( (default_generator)(generate_collisions)(limited_range))) #endif UNORDERED_AUTO_TEST (assign_default_initializer_list) { BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Initializer List Tests\n"; std::initializer_list<std::pair<int const, int> > init; #ifdef BOOST_UNORDERED_FOA_TESTS boost::unordered_flat_map<int, int> x1; boost::unordered_node_map<int, int> x2; x2[25] = 3; x2[16] = 10; BOOST_TEST(!x2.empty()); x2 = init; BOOST_TEST(x2.empty()); #else boost::unordered_map<int, int> x1; #endif x1[25] = 3; x1[16] = 10; BOOST_TEST(!x1.empty()); x1 = init; BOOST_TEST(x1.empty()); } UNORDERED_AUTO_TEST (assign_initializer_list) { BOOST_LIGHTWEIGHT_TEST_OSTREAM << "Initializer List Tests\n"; #ifdef BOOST_UNORDERED_FOA_TESTS boost::unordered_flat_set<int> x; boost::unordered_node_set<int> y; y.insert(10); y.insert(20); y = {1, 2, -10}; BOOST_TEST(y.find(10) == y.end()); BOOST_TEST(y.find(-10) != y.end()); #else boost::unordered_set<int> x; #endif x.insert(10); x.insert(20); x = {1, 2, -10}; BOOST_TEST(x.find(10) == x.end()); BOOST_TEST(x.find(-10) != x.end()); } } RUN_TESTS()