26 #include <boost/mpl/list.hpp>
27 #include <boost/test/unit_test.hpp>
35 BOOST_AUTO_TEST_SUITE(test_policy)
38 boost::mpl::list<tsl::rh::power_of_two_growth_policy<2>,
46 std::size_t bucket_count = 0;
47 Policy policy(bucket_count);
49 BOOST_CHECK_EQUAL(policy.bucket_for_hash(0), 0);
50 BOOST_CHECK_EQUAL(bucket_count, 0);
52 #ifndef TSL_RH_NO_EXCEPTIONS
53 bool exception_thrown =
false;
56 const std::size_t previous_bucket_count = bucket_count;
58 bucket_count = policy.next_bucket_count();
59 policy = Policy(bucket_count);
61 BOOST_CHECK_EQUAL(policy.bucket_for_hash(0), 0);
62 BOOST_CHECK(bucket_count > previous_bucket_count);
64 }
catch (
const std::length_error&) {
65 exception_thrown =
true;
68 BOOST_CHECK(exception_thrown);
75 std::size_t bucket_count = 0;
76 Policy policy(bucket_count);
78 BOOST_CHECK_EQUAL(policy.bucket_for_hash(0), 0);
84 std::size_t bucket_count = 0;
85 Policy policy(bucket_count);
87 bucket_count = policy.max_bucket_count();
88 Policy policy2(bucket_count);
90 bucket_count = std::numeric_limits<std::size_t>::max();
93 bucket_count = policy.max_bucket_count() + 1;
97 BOOST_AUTO_TEST_SUITE_END()