forked from boostorg/unordered
Update assign_exception_tests to assert strong guarantee around Hash, KeyEqual pairing
This commit is contained in:
@ -60,6 +60,9 @@ template <class T> struct assign_base : public test::exception_base
|
|||||||
test::random_values<T> x_values, y_values;
|
test::random_values<T> x_values, y_values;
|
||||||
T x, y;
|
T x, y;
|
||||||
|
|
||||||
|
int t1;
|
||||||
|
int t2;
|
||||||
|
|
||||||
typedef typename T::hasher hasher;
|
typedef typename T::hasher hasher;
|
||||||
typedef typename T::key_equal key_equal;
|
typedef typename T::key_equal key_equal;
|
||||||
typedef typename T::allocator_type allocator_type;
|
typedef typename T::allocator_type allocator_type;
|
||||||
@ -67,7 +70,10 @@ template <class T> struct assign_base : public test::exception_base
|
|||||||
assign_base(int tag1, int tag2, float mlf1 = 1.0, float mlf2 = 1.0)
|
assign_base(int tag1, int tag2, float mlf1 = 1.0, float mlf2 = 1.0)
|
||||||
: x_values(), y_values(),
|
: x_values(), y_values(),
|
||||||
x(0, hasher(tag1), key_equal(tag1), allocator_type(tag1)),
|
x(0, hasher(tag1), key_equal(tag1), allocator_type(tag1)),
|
||||||
y(0, hasher(tag2), key_equal(tag2), allocator_type(tag2))
|
y(0, hasher(tag2), key_equal(tag2), allocator_type(tag2)),
|
||||||
|
t1(tag1),
|
||||||
|
t2(tag2)
|
||||||
|
|
||||||
{
|
{
|
||||||
x.max_load_factor(mlf1);
|
x.max_load_factor(mlf1);
|
||||||
y.max_load_factor(mlf2);
|
y.max_load_factor(mlf2);
|
||||||
@ -89,6 +95,22 @@ template <class T> struct assign_base : public test::exception_base
|
|||||||
{
|
{
|
||||||
test::check_equivalent_keys(x1);
|
test::check_equivalent_keys(x1);
|
||||||
|
|
||||||
|
if (x1.hash_function() == hasher(t1)) {
|
||||||
|
BOOST_TEST(x1.key_eq() == key_equal(t1));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x1.hash_function() == hasher(t2)) {
|
||||||
|
BOOST_TEST(x1.key_eq() == key_equal(t2));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x1.key_eq() == key_equal(t1)) {
|
||||||
|
BOOST_TEST(x1.hash_function() == hasher(t1));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (x1.key_eq() == key_equal(t2)) {
|
||||||
|
BOOST_TEST(x1.hash_function() == hasher(t2));
|
||||||
|
}
|
||||||
|
|
||||||
// If the container is empty at the point of the exception, the
|
// If the container is empty at the point of the exception, the
|
||||||
// internal structure is hidden, this exposes it, at the cost of
|
// internal structure is hidden, this exposes it, at the cost of
|
||||||
// messing up the data.
|
// messing up the data.
|
||||||
|
Reference in New Issue
Block a user