2006-05-21 17:14:11 +00:00
|
|
|
|
2009-03-09 20:56:23 +00:00
|
|
|
// Copyright 2006-2009 Daniel James.
|
2023-02-14 10:35:17 -08:00
|
|
|
// Copyright 2022-2023 Christian Mazakas.
|
2006-07-01 22:31:26 +00:00
|
|
|
// 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)
|
2006-05-21 17:14:11 +00:00
|
|
|
|
2022-10-20 15:25:40 -07:00
|
|
|
#include "../helpers/unordered.hpp"
|
2012-04-08 15:29:15 +00:00
|
|
|
|
2022-10-26 13:45:53 -07:00
|
|
|
#include "../helpers/metafunctions.hpp"
|
2006-05-21 17:14:11 +00:00
|
|
|
#include "../helpers/random_values.hpp"
|
2022-10-26 13:45:53 -07:00
|
|
|
#include "../helpers/test.hpp"
|
2006-05-21 17:14:11 +00:00
|
|
|
#include "../helpers/tracker.hpp"
|
2012-09-26 08:09:26 +00:00
|
|
|
#include "../objects/test.hpp"
|
2006-05-21 17:14:11 +00:00
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
namespace rehash_tests {
|
2008-03-24 17:03:15 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
test::seed_t initialize_seed(2974);
|
2007-12-06 11:42:28 +00:00
|
|
|
|
2022-10-26 13:45:53 -07:00
|
|
|
static int count_allocations;
|
|
|
|
|
template <class T> struct monotonic_allocator
|
|
|
|
|
{
|
|
|
|
|
typedef T value_type;
|
|
|
|
|
monotonic_allocator() {}
|
|
|
|
|
monotonic_allocator(monotonic_allocator const&) {}
|
|
|
|
|
|
|
|
|
|
template <class U> monotonic_allocator(monotonic_allocator<U> const&) {}
|
|
|
|
|
|
|
|
|
|
friend bool operator==(
|
|
|
|
|
monotonic_allocator const&, monotonic_allocator const&)
|
|
|
|
|
{
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
friend bool operator!=(
|
|
|
|
|
monotonic_allocator const&, monotonic_allocator const&)
|
|
|
|
|
{
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
T* allocate(std::size_t n)
|
|
|
|
|
{
|
|
|
|
|
++count_allocations;
|
|
|
|
|
return static_cast<T*>(::operator new(sizeof(T) * n));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void deallocate(T* p, std::size_t) { ::operator delete(p); }
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void reset_counts() { count_allocations = 0; }
|
|
|
|
|
|
2018-01-27 09:39:59 +00:00
|
|
|
template <class X> bool postcondition(X const& x, typename X::size_type n)
|
2017-06-11 20:55:59 +01:00
|
|
|
{
|
2016-09-18 12:22:48 +01:00
|
|
|
return static_cast<double>(x.bucket_count()) >=
|
2017-06-11 20:55:59 +01:00
|
|
|
static_cast<double>(x.size()) / x.max_load_factor() &&
|
2017-02-19 13:05:17 +00:00
|
|
|
x.bucket_count() >= n;
|
2017-06-11 20:55:59 +01:00
|
|
|
}
|
2006-05-21 17:14:11 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
template <class X> void rehash_empty_test1(X*)
|
|
|
|
|
{
|
2006-05-21 17:14:11 +00:00
|
|
|
X x;
|
|
|
|
|
|
|
|
|
|
x.rehash(10000);
|
2009-05-27 17:44:09 +00:00
|
|
|
BOOST_TEST(postcondition(x, 10000));
|
2006-05-21 17:14:11 +00:00
|
|
|
|
|
|
|
|
x.rehash(0);
|
2009-05-27 17:44:09 +00:00
|
|
|
BOOST_TEST(postcondition(x, 0));
|
2012-09-26 08:09:26 +00:00
|
|
|
|
|
|
|
|
x.rehash(10000000);
|
|
|
|
|
BOOST_TEST(postcondition(x, 10000000));
|
2017-06-11 20:55:59 +01:00
|
|
|
}
|
2006-05-21 17:14:11 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
template <class X>
|
|
|
|
|
void rehash_empty_test2(X*, test::random_generator generator)
|
|
|
|
|
{
|
2009-10-04 10:37:36 +00:00
|
|
|
test::random_values<X> v(1000, generator);
|
|
|
|
|
test::ordered<X> tracker;
|
|
|
|
|
|
|
|
|
|
X x;
|
|
|
|
|
|
|
|
|
|
x.rehash(10000);
|
|
|
|
|
BOOST_TEST(postcondition(x, 10000));
|
|
|
|
|
|
|
|
|
|
tracker.insert_range(v.begin(), v.end());
|
|
|
|
|
x.insert(v.begin(), v.end());
|
|
|
|
|
tracker.compare(x);
|
|
|
|
|
|
|
|
|
|
BOOST_TEST(postcondition(x, 10000));
|
2017-02-19 13:05:17 +00:00
|
|
|
|
2012-09-26 08:09:26 +00:00
|
|
|
x.rehash(10000000);
|
|
|
|
|
tracker.compare(x);
|
|
|
|
|
BOOST_TEST(postcondition(x, 10000000));
|
2017-06-11 20:55:59 +01:00
|
|
|
}
|
2009-10-04 10:37:36 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
template <class X>
|
|
|
|
|
void rehash_empty_test3(X*, test::random_generator generator)
|
|
|
|
|
{
|
2009-10-04 10:37:36 +00:00
|
|
|
test::random_values<X> v(1000, generator);
|
|
|
|
|
test::ordered<X> tracker;
|
|
|
|
|
|
|
|
|
|
X x;
|
|
|
|
|
|
|
|
|
|
x.rehash(0);
|
|
|
|
|
BOOST_TEST(postcondition(x, 0));
|
|
|
|
|
|
|
|
|
|
tracker.insert_range(v.begin(), v.end());
|
|
|
|
|
x.insert(v.begin(), v.end());
|
|
|
|
|
tracker.compare(x);
|
|
|
|
|
|
|
|
|
|
BOOST_TEST(postcondition(x, 0));
|
2017-06-11 20:55:59 +01:00
|
|
|
}
|
2009-10-04 10:37:36 +00:00
|
|
|
|
2022-09-01 15:11:50 -07:00
|
|
|
template <class X> void rehash_empty_tracking(X*, test::random_generator)
|
|
|
|
|
{
|
|
|
|
|
// valid for all load factors
|
|
|
|
|
float const max_load_factors[] = {
|
|
|
|
|
0.5f, 1.0f, 1e6f, std::numeric_limits<float>::infinity()};
|
|
|
|
|
|
|
|
|
|
std::size_t const max_load_factors_len =
|
|
|
|
|
sizeof(max_load_factors) / sizeof(*max_load_factors);
|
|
|
|
|
|
|
|
|
|
for (std::size_t i = 0; i < max_load_factors_len; ++i) {
|
|
|
|
|
X x;
|
|
|
|
|
BOOST_TEST_EQ(x.size(), 0u);
|
|
|
|
|
BOOST_TEST_EQ(test::detail::tracker.count_allocations, 0u);
|
|
|
|
|
|
|
|
|
|
x.max_load_factor(max_load_factors[i]);
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
BOOST_TEST_EQ(x.bucket_count(), 0u);
|
|
|
|
|
|
|
|
|
|
x.rehash(0);
|
|
|
|
|
BOOST_TEST_EQ(x.bucket_count(), 0u);
|
|
|
|
|
BOOST_TEST_EQ(test::detail::tracker.count_allocations, 0u);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
BOOST_TEST_EQ(x.bucket_count(), 0u);
|
|
|
|
|
|
|
|
|
|
x.rehash(1000);
|
|
|
|
|
BOOST_TEST_GE(x.bucket_count(), 1000u);
|
|
|
|
|
BOOST_TEST_GT(test::detail::tracker.count_allocations, 0u);
|
|
|
|
|
|
|
|
|
|
x.rehash(0);
|
|
|
|
|
BOOST_TEST_EQ(x.bucket_count(), 0u);
|
|
|
|
|
BOOST_TEST_EQ(test::detail::tracker.count_allocations, 0u);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
BOOST_TEST_EQ(x.bucket_count(), 0u);
|
|
|
|
|
|
|
|
|
|
x.rehash(1000);
|
|
|
|
|
BOOST_TEST_GE(x.bucket_count(), 1000u);
|
|
|
|
|
BOOST_TEST_GT(test::detail::tracker.count_allocations, 0u);
|
|
|
|
|
|
|
|
|
|
x.rehash(10);
|
|
|
|
|
BOOST_TEST_GE(x.bucket_count(), 10u);
|
|
|
|
|
BOOST_TEST_LT(x.bucket_count(), 1000u);
|
|
|
|
|
BOOST_TEST_GT(test::detail::tracker.count_allocations, 0u);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
BOOST_TEST_GT(x.bucket_count(), 0u);
|
|
|
|
|
BOOST_TEST_LT(x.bucket_count(), 1000u);
|
|
|
|
|
|
|
|
|
|
x.rehash(1000);
|
|
|
|
|
BOOST_TEST_GE(x.bucket_count(), 1000u);
|
|
|
|
|
BOOST_TEST_GT(test::detail::tracker.count_allocations, 0u);
|
|
|
|
|
|
|
|
|
|
x.rehash(0);
|
|
|
|
|
BOOST_TEST_EQ(x.bucket_count(), 0u);
|
|
|
|
|
BOOST_TEST_EQ(test::detail::tracker.count_allocations, 0u);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (std::size_t i = 0; i < max_load_factors_len; ++i) {
|
|
|
|
|
typedef typename X::size_type size_type;
|
|
|
|
|
|
|
|
|
|
X x;
|
|
|
|
|
BOOST_TEST_EQ(x.size(), 0u);
|
|
|
|
|
BOOST_TEST_EQ(test::detail::tracker.count_allocations, 0u);
|
|
|
|
|
|
2022-10-07 10:56:35 -07:00
|
|
|
#ifdef BOOST_UNORDERED_FOA_TESTS
|
|
|
|
|
float const mlf = boost::unordered::detail::foa::mlf;
|
|
|
|
|
x.max_load_factor(max_load_factors[i]);
|
|
|
|
|
#else
|
2022-09-01 15:11:50 -07:00
|
|
|
float const mlf = max_load_factors[i];
|
|
|
|
|
x.max_load_factor(mlf);
|
2022-10-07 10:56:35 -07:00
|
|
|
#endif
|
2022-09-01 15:11:50 -07:00
|
|
|
|
|
|
|
|
{
|
|
|
|
|
BOOST_TEST_EQ(x.bucket_count(), 0u);
|
|
|
|
|
|
|
|
|
|
x.reserve(0);
|
|
|
|
|
BOOST_TEST_EQ(x.bucket_count(), 0u);
|
|
|
|
|
BOOST_TEST_EQ(test::detail::tracker.count_allocations, 0u);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
BOOST_TEST_EQ(x.bucket_count(), 0u);
|
|
|
|
|
|
|
|
|
|
x.reserve(1000);
|
|
|
|
|
BOOST_TEST_GE(
|
|
|
|
|
x.bucket_count(), static_cast<size_type>(std::ceil(1000 / mlf)));
|
|
|
|
|
BOOST_TEST_GT(test::detail::tracker.count_allocations, 0u);
|
|
|
|
|
|
|
|
|
|
x.reserve(0);
|
|
|
|
|
BOOST_TEST_EQ(x.bucket_count(), 0u);
|
|
|
|
|
BOOST_TEST_EQ(test::detail::tracker.count_allocations, 0u);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
BOOST_TEST_EQ(x.bucket_count(), 0u);
|
|
|
|
|
|
|
|
|
|
x.reserve(1000);
|
|
|
|
|
BOOST_TEST_GE(
|
|
|
|
|
x.bucket_count(), static_cast<size_type>(std::ceil(1000 / mlf)));
|
|
|
|
|
BOOST_TEST_GT(test::detail::tracker.count_allocations, 0u);
|
|
|
|
|
|
|
|
|
|
x.reserve(10);
|
|
|
|
|
BOOST_TEST_GE(
|
|
|
|
|
x.bucket_count(), static_cast<size_type>(std::ceil(10 / mlf)));
|
|
|
|
|
BOOST_TEST_LT(x.bucket_count(), 1000u);
|
|
|
|
|
BOOST_TEST_GT(test::detail::tracker.count_allocations, 0u);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
BOOST_TEST_GT(x.bucket_count(), 0u);
|
|
|
|
|
BOOST_TEST_LT(x.bucket_count(), 1000u);
|
|
|
|
|
|
|
|
|
|
x.reserve(1000);
|
|
|
|
|
BOOST_TEST_GE(
|
|
|
|
|
x.bucket_count(), static_cast<size_type>(std::ceil(1000 / mlf)));
|
|
|
|
|
BOOST_TEST_GT(test::detail::tracker.count_allocations, 0u);
|
|
|
|
|
|
|
|
|
|
x.reserve(0);
|
|
|
|
|
BOOST_TEST_EQ(x.bucket_count(), 0u);
|
|
|
|
|
BOOST_TEST_EQ(test::detail::tracker.count_allocations, 0u);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
template <class X>
|
|
|
|
|
void rehash_nonempty_tracking(X*, test::random_generator generator)
|
|
|
|
|
{
|
|
|
|
|
test::random_values<X> const v(1000, generator);
|
|
|
|
|
|
|
|
|
|
typedef typename X::size_type size_type;
|
|
|
|
|
|
|
|
|
|
float const max_load_factors[] = {0.5f, 1.0f, 1e2f};
|
|
|
|
|
|
|
|
|
|
size_type const max_load_factors_len =
|
|
|
|
|
sizeof(max_load_factors) / sizeof(*max_load_factors);
|
|
|
|
|
|
|
|
|
|
for (size_type i = 0; i < max_load_factors_len; ++i) {
|
|
|
|
|
float const mlf = max_load_factors[i];
|
|
|
|
|
|
|
|
|
|
X x(v.begin(), v.end());
|
|
|
|
|
BOOST_TEST_GT(x.size(), 0u);
|
|
|
|
|
BOOST_TEST_GT(test::detail::tracker.count_allocations, 0u);
|
|
|
|
|
|
|
|
|
|
x.max_load_factor(mlf);
|
|
|
|
|
|
|
|
|
|
size_type bucket_count = x.bucket_count();
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
BOOST_TEST_GT(x.bucket_count(), 0u);
|
|
|
|
|
|
|
|
|
|
x.rehash(0);
|
|
|
|
|
BOOST_TEST_GE(x.bucket_count(),
|
|
|
|
|
static_cast<size_type>(
|
|
|
|
|
std::floor(static_cast<float>(x.size()) / x.max_load_factor())));
|
|
|
|
|
BOOST_TEST_GT(test::detail::tracker.count_allocations, 0u);
|
|
|
|
|
|
|
|
|
|
bucket_count = x.bucket_count();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
BOOST_TEST_GT(bucket_count, 0u);
|
|
|
|
|
|
|
|
|
|
x.rehash(2 * x.bucket_count());
|
|
|
|
|
BOOST_TEST_GT(x.bucket_count(), bucket_count);
|
|
|
|
|
|
|
|
|
|
bucket_count = x.bucket_count();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
float const old_mlf = x.max_load_factor();
|
|
|
|
|
|
|
|
|
|
BOOST_TEST_GT(bucket_count, 0u);
|
|
|
|
|
|
|
|
|
|
x.rehash(bucket_count / 4);
|
|
|
|
|
BOOST_TEST_LT(x.bucket_count(), bucket_count);
|
|
|
|
|
|
|
|
|
|
x.max_load_factor(std::numeric_limits<float>::infinity());
|
|
|
|
|
x.rehash(0);
|
|
|
|
|
BOOST_TEST_GT(x.bucket_count(), 0u);
|
|
|
|
|
|
|
|
|
|
x.max_load_factor(old_mlf);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
std::size_t const max_load =
|
|
|
|
|
static_cast<std::size_t>(static_cast<double>(x.max_load_factor()) *
|
|
|
|
|
static_cast<double>(x.bucket_count()));
|
|
|
|
|
|
|
|
|
|
while (x.size() < max_load) {
|
|
|
|
|
test::random_values<X> const t(max_load, generator);
|
|
|
|
|
typename test::random_values<X>::const_iterator pos = t.begin();
|
|
|
|
|
typename test::random_values<X>::const_iterator end = t.end();
|
|
|
|
|
for (; pos != end; ++pos) {
|
|
|
|
|
x.insert(*pos);
|
|
|
|
|
if (x.size() == max_load) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (x.size() > max_load) {
|
|
|
|
|
x.erase(x.begin());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BOOST_TEST_EQ(x.size(), max_load);
|
|
|
|
|
|
|
|
|
|
bucket_count = x.bucket_count();
|
|
|
|
|
x.rehash(x.bucket_count());
|
|
|
|
|
BOOST_TEST_EQ(x.bucket_count(), bucket_count);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (size_type i = 0; i < max_load_factors_len; ++i) {
|
|
|
|
|
X x(v.begin(), v.end());
|
|
|
|
|
BOOST_TEST_GT(x.size(), 0u);
|
|
|
|
|
BOOST_TEST_GT(test::detail::tracker.count_allocations, 0u);
|
|
|
|
|
|
|
|
|
|
float const mlf = max_load_factors[i];
|
|
|
|
|
x.max_load_factor(mlf);
|
|
|
|
|
|
|
|
|
|
size_type bucket_count = x.bucket_count();
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
BOOST_TEST_GT(x.bucket_count(), 0u);
|
|
|
|
|
|
|
|
|
|
x.reserve(0);
|
|
|
|
|
BOOST_TEST_GE(x.bucket_count(),
|
|
|
|
|
static_cast<size_type>(
|
|
|
|
|
std::floor(static_cast<float>(x.size()) / x.max_load_factor())));
|
|
|
|
|
BOOST_TEST_GT(test::detail::tracker.count_allocations, 0u);
|
|
|
|
|
|
|
|
|
|
bucket_count = x.bucket_count();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
BOOST_TEST_GT(x.bucket_count(), 0u);
|
|
|
|
|
|
|
|
|
|
x.reserve(
|
2022-10-26 13:45:53 -07:00
|
|
|
2 *
|
|
|
|
|
(static_cast<size_type>(
|
|
|
|
|
std::floor(static_cast<float>(x.size()) / x.max_load_factor()) +
|
|
|
|
|
std::floor(static_cast<float>(x.size()) * x.max_load_factor()))));
|
2022-09-01 15:11:50 -07:00
|
|
|
|
|
|
|
|
BOOST_TEST_GT(x.bucket_count(), bucket_count);
|
|
|
|
|
|
|
|
|
|
bucket_count = x.bucket_count();
|
|
|
|
|
BOOST_TEST_GT(bucket_count, 1u);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
float const old_mlf = x.max_load_factor();
|
|
|
|
|
|
|
|
|
|
BOOST_TEST_GT(bucket_count, 4u);
|
|
|
|
|
|
|
|
|
|
x.reserve(bucket_count / 4);
|
|
|
|
|
BOOST_TEST_LT(x.bucket_count(), bucket_count);
|
|
|
|
|
|
|
|
|
|
x.max_load_factor(std::numeric_limits<float>::infinity());
|
|
|
|
|
x.reserve(0);
|
|
|
|
|
BOOST_TEST_GT(x.bucket_count(), 0u);
|
|
|
|
|
|
|
|
|
|
x.max_load_factor(old_mlf);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
std::size_t const max_load =
|
|
|
|
|
static_cast<std::size_t>(static_cast<double>(x.max_load_factor()) *
|
|
|
|
|
static_cast<double>(x.bucket_count()));
|
|
|
|
|
|
|
|
|
|
while (x.size() < max_load) {
|
|
|
|
|
test::random_values<X> const t(max_load, generator);
|
|
|
|
|
typename test::random_values<X>::const_iterator pos = t.begin();
|
|
|
|
|
typename test::random_values<X>::const_iterator end = t.end();
|
|
|
|
|
for (; pos != end; ++pos) {
|
|
|
|
|
x.insert(*pos);
|
|
|
|
|
if (x.size() == max_load) {
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
while (x.size() > max_load) {
|
|
|
|
|
x.erase(x.begin());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BOOST_TEST_EQ(x.size(), max_load);
|
|
|
|
|
|
|
|
|
|
bucket_count = x.bucket_count();
|
|
|
|
|
x.reserve(x.size());
|
|
|
|
|
BOOST_TEST_EQ(x.bucket_count(), bucket_count);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-26 13:45:53 -07:00
|
|
|
template <class X> void rehash_stability(X*, test::random_generator generator)
|
|
|
|
|
{
|
|
|
|
|
reset_counts();
|
|
|
|
|
|
|
|
|
|
typedef typename X::size_type size_type;
|
|
|
|
|
|
|
|
|
|
size_type bucket_count = 100;
|
|
|
|
|
X x(bucket_count);
|
|
|
|
|
|
|
|
|
|
size_type num_elems = x.bucket_count() - 1;
|
|
|
|
|
|
|
|
|
|
test::random_values<X> v(num_elems, generator);
|
|
|
|
|
test::ordered<X> tracker;
|
|
|
|
|
tracker.insert_range(v.begin(), v.end());
|
|
|
|
|
|
|
|
|
|
typename test::random_values<X>::iterator pos = v.begin();
|
|
|
|
|
for (size_type i = 0; i < num_elems; ++i) {
|
|
|
|
|
x.insert(*pos);
|
|
|
|
|
++pos;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int const old_count = count_allocations;
|
|
|
|
|
x.rehash(0);
|
|
|
|
|
|
|
|
|
|
BOOST_TEST_EQ(count_allocations, old_count);
|
|
|
|
|
tracker.compare(x);
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-14 10:35:17 -08:00
|
|
|
template <class X>
|
|
|
|
|
void rehash_node_stability(X*, test::random_generator generator)
|
|
|
|
|
{
|
|
|
|
|
typedef typename X::value_type value_type;
|
|
|
|
|
std::set<value_type const*> elements;
|
|
|
|
|
|
|
|
|
|
test::random_values<X> v(1000, generator);
|
|
|
|
|
test::ordered<X> tracker;
|
|
|
|
|
tracker.insert_range(v.begin(), v.end());
|
|
|
|
|
|
|
|
|
|
X x(v.begin(), v.end());
|
|
|
|
|
|
|
|
|
|
typedef typename X::iterator iterator;
|
|
|
|
|
for (iterator pos = x.begin(); pos != x.end(); ++pos) {
|
2023-09-27 12:01:46 -07:00
|
|
|
elements.insert(std::addressof(*pos));
|
2023-02-14 10:35:17 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
x.rehash(2 * x.bucket_count());
|
|
|
|
|
|
|
|
|
|
for (iterator pos = x.begin(); pos != x.end(); ++pos) {
|
|
|
|
|
if (!BOOST_TEST(
|
2023-09-27 12:01:46 -07:00
|
|
|
elements.find(std::addressof(*pos)) != elements.end())) {
|
2023-02-14 10:35:17 -08:00
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
tracker.compare(x);
|
|
|
|
|
}
|
|
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
template <class X> void rehash_test1(X*, test::random_generator generator)
|
|
|
|
|
{
|
Merge test improvements, pdf documentation improvements, some implementation
tweaks.
Merged revisions 45747-46030 via svnmerge from
https://svn.boost.org/svn/boost/branches/unordered/trunk
................
r45747 | danieljames | 2008-05-25 18:03:30 +0100 (Sun, 25 May 2008) | 1 line
Remove /branches/unordered/dev from svnmerge tracking.
................
r45874 | danieljames | 2008-05-28 18:54:53 +0100 (Wed, 28 May 2008) | 1 line
Merge from trunk.
................
r45881 | danieljames | 2008-05-29 00:10:37 +0100 (Thu, 29 May 2008) | 2 lines
Make it possible to use a custom generator in more places.
................
r45882 | danieljames | 2008-05-29 00:10:56 +0100 (Thu, 29 May 2008) | 2 lines
Remove several unused parameters.
................
r45883 | danieljames | 2008-05-29 00:11:06 +0100 (Thu, 29 May 2008) | 2 lines
No need to run move_construct_tests1 from move_construct_tests2, already calling it directly.
................
r45884 | danieljames | 2008-05-29 00:11:15 +0100 (Thu, 29 May 2008) | 2 lines
Remove unused 'construct' as in trunk.
................
r45885 | danieljames | 2008-05-29 00:11:25 +0100 (Thu, 29 May 2008) | 2 lines
More consistent implementations of insert_impl.
................
r45886 | danieljames | 2008-05-29 00:11:34 +0100 (Thu, 29 May 2008) | 2 lines
No need to use the single argument version of methods when the variadic version is available. Frees up the non-variadic version for overloading to emulate variadic methods.
................
r45887 | danieljames | 2008-05-29 00:11:44 +0100 (Thu, 29 May 2008) | 2 lines
Add another test, mainly to avoid an unused parameter warning.
................
r45888 | danieljames | 2008-05-29 00:11:54 +0100 (Thu, 29 May 2008) | 2 lines
Adjust the pixels per inch of the buckets diagram so it'll fit on the page.
................
r45889 | danieljames | 2008-05-29 00:15:49 +0100 (Thu, 29 May 2008) | 1 line
Improve pdf output, thanks to John Maddock.
................
r45890 | danieljames | 2008-05-29 00:17:45 +0100 (Thu, 29 May 2008) | 1 line
Add an svg version of the bucket diagram.
................
r45891 | danieljames | 2008-05-29 00:18:11 +0100 (Thu, 29 May 2008) | 1 line
Remove the original dia buckets diagram, I'm not using it anymore.
................
r46025 | danieljames | 2008-06-01 18:39:51 +0100 (Sun, 01 Jun 2008) | 1 line
Initialise merging from doc.
................
r46030 | danieljames | 2008-06-01 18:54:36 +0100 (Sun, 01 Jun 2008) | 29 lines
Merge in documentation improvements from the doc branch.
Merged revisions 45892-46020 via svnmerge from
https://svn.boost.org/svn/boost/branches/doc
........
r45892 | danieljames | 2008-05-29 00:30:07 +0100 (Thu, 29 May 2008) | 1 line
Merge latest changes from unordered.
........
r46017 | danieljames | 2008-06-01 18:18:15 +0100 (Sun, 01 Jun 2008) | 2 lines
Use both PNG and SVG versions of the buckets diagram.
........
r46018 | danieljames | 2008-06-01 18:18:27 +0100 (Sun, 01 Jun 2008) | 2 lines
Improved function summary tables in unordered documenations.
........
r46019 | danieljames | 2008-06-01 18:18:39 +0100 (Sun, 01 Jun 2008) | 3 lines
I'd hacked the bibliography to avoid showing the title twice, but this was
causing problems when generating PDFs, so show the title twice.
........
r46020 | danieljames | 2008-06-01 18:18:52 +0100 (Sun, 01 Jun 2008) | 3 lines
Don't use the compact boostbook refernce style in the standalone documentation
as it is too wide for printing out.
........
................
[SVN r46031]
2008-06-01 18:00:53 +00:00
|
|
|
test::random_values<X> v(1000, generator);
|
2006-05-21 17:14:11 +00:00
|
|
|
test::ordered<X> tracker;
|
2006-06-12 23:30:46 +00:00
|
|
|
tracker.insert_range(v.begin(), v.end());
|
2006-05-21 17:14:11 +00:00
|
|
|
X x(v.begin(), v.end());
|
|
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
x.rehash(0);
|
|
|
|
|
BOOST_TEST(postcondition(x, 0));
|
2006-05-21 17:14:11 +00:00
|
|
|
tracker.compare(x);
|
|
|
|
|
|
|
|
|
|
x.max_load_factor(0.25);
|
2017-02-19 13:05:17 +00:00
|
|
|
x.rehash(0);
|
|
|
|
|
BOOST_TEST(postcondition(x, 0));
|
2006-05-21 17:14:11 +00:00
|
|
|
tracker.compare(x);
|
|
|
|
|
|
|
|
|
|
x.max_load_factor(50.0);
|
2017-02-19 13:05:17 +00:00
|
|
|
x.rehash(0);
|
|
|
|
|
BOOST_TEST(postcondition(x, 0));
|
2006-05-21 17:14:11 +00:00
|
|
|
tracker.compare(x);
|
|
|
|
|
|
2017-02-19 13:05:17 +00:00
|
|
|
x.rehash(1000);
|
|
|
|
|
BOOST_TEST(postcondition(x, 1000));
|
2006-05-21 17:14:11 +00:00
|
|
|
tracker.compare(x);
|
2017-06-11 20:55:59 +01:00
|
|
|
}
|
2006-05-21 17:14:11 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
template <class X> void reserve_empty_test1(X*)
|
|
|
|
|
{
|
2012-09-26 08:09:26 +00:00
|
|
|
X x;
|
|
|
|
|
|
|
|
|
|
x.reserve(10000);
|
|
|
|
|
BOOST_TEST(x.bucket_count() >= 10000);
|
|
|
|
|
|
|
|
|
|
x.reserve(0);
|
|
|
|
|
|
|
|
|
|
x.reserve(10000000);
|
|
|
|
|
BOOST_TEST(x.bucket_count() >= 10000000);
|
2017-06-11 20:55:59 +01:00
|
|
|
}
|
2012-09-26 08:09:26 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
template <class X> void reserve_empty_test2(X*)
|
|
|
|
|
{
|
2012-09-26 08:09:26 +00:00
|
|
|
X x;
|
|
|
|
|
x.max_load_factor(0.25);
|
|
|
|
|
|
2022-10-07 10:56:35 -07:00
|
|
|
#ifdef BOOST_UNORDERED_FOA_TESTS
|
|
|
|
|
x.reserve(10000);
|
|
|
|
|
BOOST_TEST(x.bucket_count() >= 10000);
|
|
|
|
|
|
|
|
|
|
x.reserve(0);
|
|
|
|
|
|
|
|
|
|
x.reserve(10000000);
|
|
|
|
|
BOOST_TEST(x.bucket_count() >= 10000000);
|
|
|
|
|
#else
|
2012-09-26 08:09:26 +00:00
|
|
|
x.reserve(10000);
|
|
|
|
|
BOOST_TEST(x.bucket_count() >= 40000);
|
|
|
|
|
|
|
|
|
|
x.reserve(0);
|
|
|
|
|
|
|
|
|
|
x.reserve(10000000);
|
|
|
|
|
BOOST_TEST(x.bucket_count() >= 40000000);
|
2022-10-07 10:56:35 -07:00
|
|
|
#endif
|
2017-06-11 20:55:59 +01:00
|
|
|
}
|
2012-09-26 08:09:26 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
template <class X> void reserve_test1(X*, test::random_generator generator)
|
|
|
|
|
{
|
2017-02-19 13:05:17 +00:00
|
|
|
for (int random_mlf = 0; random_mlf < 2; ++random_mlf) {
|
2017-06-11 20:55:59 +01:00
|
|
|
for (std::size_t i = 1; i < 2000; i += i < 50 ? 1 : 13) {
|
|
|
|
|
test::random_values<X> v(i, generator);
|
|
|
|
|
|
|
|
|
|
test::ordered<X> tracker;
|
|
|
|
|
tracker.insert_range(v.begin(), v.end());
|
|
|
|
|
|
|
|
|
|
X x;
|
|
|
|
|
x.max_load_factor(
|
|
|
|
|
random_mlf ? static_cast<float>(std::rand() % 1000) / 500.0f + 0.5f
|
|
|
|
|
: 1.0f);
|
|
|
|
|
x.reserve(test::has_unique_keys<X>::value ? i : v.size());
|
|
|
|
|
|
|
|
|
|
// Insert an element before the range insert, otherwise there are
|
|
|
|
|
// no iterators to invalidate in the range insert, and it can
|
|
|
|
|
// rehash.
|
|
|
|
|
typename test::random_values<X>::iterator it = v.begin();
|
|
|
|
|
x.insert(*it);
|
|
|
|
|
++it;
|
|
|
|
|
|
|
|
|
|
std::size_t bucket_count = x.bucket_count();
|
|
|
|
|
x.insert(it, v.end());
|
|
|
|
|
BOOST_TEST(bucket_count == x.bucket_count());
|
|
|
|
|
tracker.compare(x);
|
|
|
|
|
}
|
2012-05-07 18:10:04 +00:00
|
|
|
}
|
2017-06-11 20:55:59 +01:00
|
|
|
}
|
2012-05-07 18:10:04 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
template <class X> void reserve_test2(X*, test::random_generator generator)
|
|
|
|
|
{
|
2017-02-19 13:05:17 +00:00
|
|
|
for (int random_mlf = 0; random_mlf < 2; ++random_mlf) {
|
2017-06-11 20:55:59 +01:00
|
|
|
for (std::size_t i = 0; i < 2000; i += i < 50 ? 1 : 13) {
|
|
|
|
|
test::random_values<X> v(i, generator);
|
2012-05-07 18:10:04 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
test::ordered<X> tracker;
|
|
|
|
|
tracker.insert_range(v.begin(), v.end());
|
2012-05-07 18:10:04 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
X x;
|
|
|
|
|
x.max_load_factor(
|
|
|
|
|
random_mlf ? static_cast<float>(std::rand() % 1000) / 500.0f + 0.5f
|
|
|
|
|
: 1.0f);
|
2012-05-07 18:10:04 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
x.reserve(test::has_unique_keys<X>::value ? i : v.size());
|
2012-05-07 18:10:04 +00:00
|
|
|
|
2017-06-11 20:55:59 +01:00
|
|
|
std::size_t bucket_count = x.bucket_count();
|
|
|
|
|
for (typename test::random_values<X>::iterator it = v.begin();
|
|
|
|
|
it != v.end(); ++it) {
|
|
|
|
|
x.insert(*it);
|
2012-05-07 10:58:32 +00:00
|
|
|
}
|
2017-06-11 20:55:59 +01:00
|
|
|
|
|
|
|
|
BOOST_TEST(bucket_count == x.bucket_count());
|
|
|
|
|
tracker.compare(x);
|
|
|
|
|
}
|
2012-05-07 10:58:32 +00:00
|
|
|
}
|
2017-06-11 20:55:59 +01:00
|
|
|
}
|
2012-05-07 10:58:32 +00:00
|
|
|
|
2022-10-07 10:56:35 -07:00
|
|
|
using test::default_generator;
|
|
|
|
|
using test::generate_collisions;
|
|
|
|
|
using test::limited_range;
|
|
|
|
|
|
|
|
|
|
#ifdef BOOST_UNORDERED_FOA_TESTS
|
|
|
|
|
boost::unordered_flat_set<int>* int_set_ptr;
|
|
|
|
|
boost::unordered_flat_map<test::movable, test::movable, test::hash,
|
|
|
|
|
test::equal_to, test::allocator2<test::movable> >* test_map_ptr;
|
|
|
|
|
|
|
|
|
|
boost::unordered_flat_set<test::object, test::hash, test::equal_to,
|
|
|
|
|
test::allocator1<test::object> >* test_set_tracking;
|
|
|
|
|
boost::unordered_flat_map<test::object, test::object, test::hash,
|
|
|
|
|
test::equal_to,
|
|
|
|
|
test::allocator1<std::pair<test::object const, test::object> > >*
|
|
|
|
|
test_map_tracking;
|
|
|
|
|
|
2022-10-26 13:45:53 -07:00
|
|
|
boost::unordered_flat_set<test::object, test::hash, test::equal_to,
|
|
|
|
|
monotonic_allocator<test::object> >* test_set_monotonic;
|
|
|
|
|
boost::unordered_flat_map<test::object, test::object, test::hash,
|
|
|
|
|
test::equal_to,
|
|
|
|
|
monotonic_allocator<std::pair<test::object const, test::object> > >*
|
|
|
|
|
test_map_monotonic;
|
|
|
|
|
|
2023-02-14 10:35:17 -08:00
|
|
|
boost::unordered_node_set<int>* int_node_set_ptr;
|
|
|
|
|
boost::unordered_node_map<test::movable, test::movable, test::hash,
|
|
|
|
|
test::equal_to, test::allocator2<test::movable> >* test_node_map_ptr;
|
|
|
|
|
|
|
|
|
|
boost::unordered_node_set<test::object, test::hash, test::equal_to,
|
|
|
|
|
test::allocator1<test::object> >* test_node_set_tracking;
|
|
|
|
|
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_tracking;
|
|
|
|
|
|
|
|
|
|
boost::unordered_node_set<test::object, test::hash, test::equal_to,
|
|
|
|
|
monotonic_allocator<test::object> >* test_node_set_monotonic;
|
|
|
|
|
boost::unordered_node_map<test::object, test::object, test::hash,
|
|
|
|
|
test::equal_to,
|
|
|
|
|
monotonic_allocator<std::pair<test::object const, test::object> > >*
|
|
|
|
|
test_node_map_monotonic;
|
|
|
|
|
|
|
|
|
|
// clang-format off
|
|
|
|
|
UNORDERED_TEST(rehash_empty_test1,
|
|
|
|
|
((int_set_ptr)(test_map_ptr)
|
|
|
|
|
(int_node_set_ptr)(test_node_map_ptr)))
|
2022-10-07 10:56:35 -07:00
|
|
|
UNORDERED_TEST(rehash_empty_test2,
|
2023-02-14 10:35:17 -08:00
|
|
|
((int_set_ptr)(test_map_ptr)
|
|
|
|
|
(int_node_set_ptr)(test_node_map_ptr))(
|
2022-10-07 10:56:35 -07:00
|
|
|
(default_generator)(generate_collisions)(limited_range)))
|
|
|
|
|
UNORDERED_TEST(rehash_empty_test3,
|
2023-02-14 10:35:17 -08:00
|
|
|
((int_set_ptr)(test_map_ptr)
|
|
|
|
|
(int_node_set_ptr)(test_node_map_ptr))(
|
|
|
|
|
(default_generator)(generate_collisions)(limited_range)))
|
|
|
|
|
UNORDERED_TEST(rehash_test1,
|
|
|
|
|
((int_set_ptr)(test_map_ptr)
|
|
|
|
|
(int_node_set_ptr)(test_node_map_ptr))(
|
|
|
|
|
(default_generator)(generate_collisions)(limited_range)))
|
|
|
|
|
UNORDERED_TEST(reserve_empty_test1,
|
|
|
|
|
((int_set_ptr)(test_map_ptr)(int_node_set_ptr)(test_node_map_ptr)))
|
|
|
|
|
UNORDERED_TEST(reserve_empty_test2,
|
|
|
|
|
((int_set_ptr)(test_map_ptr)(int_node_set_ptr)(test_node_map_ptr)))
|
|
|
|
|
UNORDERED_TEST(reserve_test1,
|
|
|
|
|
((int_set_ptr)(test_map_ptr)(int_node_set_ptr)(test_node_map_ptr))(
|
|
|
|
|
(default_generator)(generate_collisions)(limited_range)))
|
|
|
|
|
UNORDERED_TEST(reserve_test2,
|
|
|
|
|
((int_set_ptr)(test_map_ptr)(int_node_set_ptr)(test_node_map_ptr))(
|
2022-10-07 10:56:35 -07:00
|
|
|
(default_generator)(generate_collisions)(limited_range)))
|
|
|
|
|
UNORDERED_TEST(rehash_empty_tracking,
|
2023-02-14 10:35:17 -08:00
|
|
|
((test_set_tracking)(test_map_tracking)
|
|
|
|
|
(test_node_set_tracking)(test_node_map_tracking))(
|
2022-10-07 10:56:35 -07:00
|
|
|
(default_generator)(generate_collisions)(limited_range)))
|
2023-02-14 10:35:17 -08:00
|
|
|
UNORDERED_TEST(rehash_nonempty_tracking,
|
|
|
|
|
((test_set_tracking)(test_map_tracking)
|
|
|
|
|
(test_node_set_tracking)(test_node_map_tracking))(
|
|
|
|
|
(default_generator)(limited_range)))
|
|
|
|
|
UNORDERED_TEST(rehash_stability,
|
|
|
|
|
((test_set_monotonic)(test_map_monotonic)
|
|
|
|
|
(test_node_set_monotonic)(test_node_map_monotonic))(
|
|
|
|
|
(default_generator)(limited_range)))
|
|
|
|
|
UNORDERED_TEST(rehash_node_stability,
|
|
|
|
|
((int_node_set_ptr)(test_node_map_ptr)
|
|
|
|
|
(test_node_set_tracking)(test_node_map_tracking))(
|
|
|
|
|
(default_generator)(generate_collisions)(limited_range)))
|
|
|
|
|
// clang-format on
|
2022-10-07 10:56:35 -07:00
|
|
|
#else
|
2017-06-11 20:55:59 +01:00
|
|
|
boost::unordered_set<int>* int_set_ptr;
|
|
|
|
|
boost::unordered_multiset<test::object, test::hash, test::equal_to,
|
2012-09-26 08:09:26 +00:00
|
|
|
test::allocator2<test::object> >* test_multiset_ptr;
|
2017-06-11 20:55:59 +01:00
|
|
|
boost::unordered_map<test::movable, test::movable, test::hash, test::equal_to,
|
2012-09-26 08:09:26 +00:00
|
|
|
test::allocator2<test::movable> >* test_map_ptr;
|
2017-06-11 20:55:59 +01:00
|
|
|
boost::unordered_multimap<int, int>* int_multimap_ptr;
|
2008-03-24 17:03:15 +00:00
|
|
|
|
2022-09-01 15:11:50 -07:00
|
|
|
boost::unordered_set<test::object, test::hash, test::equal_to,
|
|
|
|
|
test::allocator1<test::object> >* test_set_tracking;
|
|
|
|
|
boost::unordered_multiset<test::object, test::hash, test::equal_to,
|
|
|
|
|
test::allocator1<test::object> >* test_multiset_tracking;
|
|
|
|
|
boost::unordered_map<test::object, test::object, test::hash, test::equal_to,
|
|
|
|
|
test::allocator1<std::pair<test::object const, test::object> > >*
|
|
|
|
|
test_map_tracking;
|
|
|
|
|
boost::unordered_multimap<test::object, test::object, test::hash,
|
|
|
|
|
test::equal_to,
|
|
|
|
|
test::allocator1<std::pair<test::object const, test::object> > >*
|
|
|
|
|
test_multimap_tracking;
|
|
|
|
|
|
2022-10-26 13:45:53 -07:00
|
|
|
boost::unordered_set<test::object, test::hash, test::equal_to,
|
|
|
|
|
monotonic_allocator<test::object> >* test_set_monotonic;
|
|
|
|
|
boost::unordered_multiset<test::object, test::hash, test::equal_to,
|
|
|
|
|
monotonic_allocator<test::object> >* test_multiset_monotonic;
|
|
|
|
|
boost::unordered_map<test::object, test::object, test::hash, test::equal_to,
|
|
|
|
|
monotonic_allocator<std::pair<test::object const, test::object> > >*
|
|
|
|
|
test_map_monotonic;
|
|
|
|
|
boost::unordered_multimap<test::object, test::object, test::hash,
|
|
|
|
|
test::equal_to,
|
|
|
|
|
monotonic_allocator<std::pair<test::object const, test::object> > >*
|
|
|
|
|
test_multimap_monotonic;
|
|
|
|
|
|
2023-02-14 10:35:17 -08:00
|
|
|
// clang-format off
|
2017-06-11 20:55:59 +01:00
|
|
|
UNORDERED_TEST(rehash_empty_test1,
|
2017-02-19 13:05:17 +00:00
|
|
|
((int_set_ptr)(test_multiset_ptr)(test_map_ptr)(int_multimap_ptr)))
|
2017-06-11 20:55:59 +01:00
|
|
|
UNORDERED_TEST(rehash_empty_test2,
|
2017-02-19 13:05:17 +00:00
|
|
|
((int_set_ptr)(test_multiset_ptr)(test_map_ptr)(int_multimap_ptr))(
|
2017-10-05 10:54:22 +01:00
|
|
|
(default_generator)(generate_collisions)(limited_range)))
|
2017-06-11 20:55:59 +01:00
|
|
|
UNORDERED_TEST(rehash_empty_test3,
|
2017-02-19 13:05:17 +00:00
|
|
|
((int_set_ptr)(test_multiset_ptr)(test_map_ptr)(int_multimap_ptr))(
|
2017-10-05 10:54:22 +01:00
|
|
|
(default_generator)(generate_collisions)(limited_range)))
|
2017-06-11 20:55:59 +01:00
|
|
|
UNORDERED_TEST(rehash_test1,
|
2017-02-19 13:05:17 +00:00
|
|
|
((int_set_ptr)(test_multiset_ptr)(test_map_ptr)(int_multimap_ptr))(
|
2017-10-05 10:54:22 +01:00
|
|
|
(default_generator)(generate_collisions)(limited_range)))
|
2017-06-11 20:55:59 +01:00
|
|
|
UNORDERED_TEST(reserve_empty_test1,
|
2017-02-19 13:05:17 +00:00
|
|
|
((int_set_ptr)(test_multiset_ptr)(test_map_ptr)(int_multimap_ptr)))
|
2017-06-11 20:55:59 +01:00
|
|
|
UNORDERED_TEST(reserve_empty_test2,
|
2017-02-19 13:05:17 +00:00
|
|
|
((int_set_ptr)(test_multiset_ptr)(test_map_ptr)(int_multimap_ptr)))
|
2017-06-11 20:55:59 +01:00
|
|
|
UNORDERED_TEST(reserve_test1,
|
2017-02-19 13:05:17 +00:00
|
|
|
((int_set_ptr)(test_multiset_ptr)(test_map_ptr)(int_multimap_ptr))(
|
2017-10-05 10:54:22 +01:00
|
|
|
(default_generator)(generate_collisions)(limited_range)))
|
2017-06-11 20:55:59 +01:00
|
|
|
UNORDERED_TEST(reserve_test2,
|
2017-02-19 13:05:17 +00:00
|
|
|
((int_set_ptr)(test_multiset_ptr)(test_map_ptr)(int_multimap_ptr))(
|
2017-10-05 10:54:22 +01:00
|
|
|
(default_generator)(generate_collisions)(limited_range)))
|
2022-09-01 15:11:50 -07:00
|
|
|
UNORDERED_TEST(rehash_empty_tracking,
|
|
|
|
|
((test_set_tracking)(test_multiset_tracking)(test_map_tracking)(test_multimap_tracking))(
|
|
|
|
|
(default_generator)(generate_collisions)(limited_range)))
|
|
|
|
|
UNORDERED_TEST(rehash_nonempty_tracking,
|
|
|
|
|
((test_set_tracking)(test_multiset_tracking)(test_map_tracking)(test_multimap_tracking))(
|
|
|
|
|
(default_generator)(generate_collisions)(limited_range)))
|
2022-10-26 13:45:53 -07:00
|
|
|
UNORDERED_TEST(rehash_stability,
|
|
|
|
|
((test_set_monotonic)(test_multiset_monotonic)(test_map_monotonic)(test_multimap_monotonic))(
|
|
|
|
|
(default_generator)(limited_range)))
|
2023-02-14 10:35:17 -08:00
|
|
|
UNORDERED_TEST(rehash_node_stability,
|
|
|
|
|
((int_set_ptr)(test_map_ptr)(test_set_tracking)(test_map_tracking)
|
|
|
|
|
(test_multiset_ptr)(int_multimap_ptr)
|
|
|
|
|
(test_multiset_tracking)(test_multimap_tracking))(
|
|
|
|
|
(default_generator)(generate_collisions)(limited_range)))
|
|
|
|
|
// clang-format on
|
2022-10-07 10:56:35 -07:00
|
|
|
#endif
|
2022-10-26 13:45:53 -07:00
|
|
|
} // namespace rehash_tests
|
2008-03-24 17:03:15 +00:00
|
|
|
|
|
|
|
|
RUN_TESTS()
|