forked from boostorg/unordered
Update insert_tests to handle new open-addressing table implementation
This commit is contained in:
@ -5,6 +5,9 @@
|
|||||||
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
import testing ;
|
import testing ;
|
||||||
|
import ../../config/checks/config : requires ;
|
||||||
|
|
||||||
|
CPP14 = [ requires cxx14 ] ;
|
||||||
|
|
||||||
# Adding -Wundef is blocked on (at least)
|
# Adding -Wundef is blocked on (at least)
|
||||||
# https://github.com/boostorg/type_traits/issues/165
|
# https://github.com/boostorg/type_traits/issues/165
|
||||||
@ -49,6 +52,7 @@ run unordered/copy_tests.cpp ;
|
|||||||
run unordered/move_tests.cpp ;
|
run unordered/move_tests.cpp ;
|
||||||
run unordered/assign_tests.cpp ;
|
run unordered/assign_tests.cpp ;
|
||||||
run unordered/insert_tests.cpp ;
|
run unordered/insert_tests.cpp ;
|
||||||
|
run unordered/insert_tests.cpp : : : $(CPP14) <define>BOOST_UNORDERED_FOA_TESTS : foa_insert_tests ;
|
||||||
run unordered/insert_stable_tests.cpp ;
|
run unordered/insert_stable_tests.cpp ;
|
||||||
run unordered/insert_hint_tests.cpp ;
|
run unordered/insert_hint_tests.cpp ;
|
||||||
run unordered/emplace_tests.cpp ;
|
run unordered/emplace_tests.cpp ;
|
||||||
|
@ -58,6 +58,7 @@ namespace test {
|
|||||||
std::cerr << x1.count(key) << "," << count << "\n";
|
std::cerr << x1.count(key) << "," << count << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef BOOST_UNORDERED_FOA_TESTS
|
||||||
// Check that the keys are in the correct bucket and are
|
// Check that the keys are in the correct bucket and are
|
||||||
// adjacent in the bucket.
|
// adjacent in the bucket.
|
||||||
typename X::size_type bucket = x1.bucket(key);
|
typename X::size_type bucket = x1.bucket(key);
|
||||||
@ -86,6 +87,7 @@ namespace test {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
// Check that size matches up.
|
// Check that size matches up.
|
||||||
@ -104,6 +106,7 @@ namespace test {
|
|||||||
if (fabs(x1.load_factor() - load_factor) > x1.load_factor() / 64)
|
if (fabs(x1.load_factor() - load_factor) > x1.load_factor() / 64)
|
||||||
BOOST_ERROR("x1.load_factor() doesn't match actual load_factor.");
|
BOOST_ERROR("x1.load_factor() doesn't match actual load_factor.");
|
||||||
|
|
||||||
|
#ifndef BOOST_UNORDERED_FOA_TESTS
|
||||||
// Check that size in the buckets matches up.
|
// Check that size in the buckets matches up.
|
||||||
|
|
||||||
typename X::size_type bucket_size = 0;
|
typename X::size_type bucket_size = 0;
|
||||||
@ -120,6 +123,7 @@ namespace test {
|
|||||||
BOOST_ERROR("x1.size() doesn't match bucket size.");
|
BOOST_ERROR("x1.size() doesn't match bucket size.");
|
||||||
std::cout << x1.size() << "/" << bucket_size << std::endl;
|
std::cout << x1.size() << "/" << bucket_size << std::endl;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,10 @@
|
|||||||
#include "../helpers/postfix.hpp"
|
#include "../helpers/postfix.hpp"
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
|
#ifdef BOOST_UNORDERED_FOA_TESTS
|
||||||
|
#include <boost/unordered/unordered_flat_map.hpp>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "../helpers/test.hpp"
|
#include "../helpers/test.hpp"
|
||||||
#include "../objects/test.hpp"
|
#include "../objects/test.hpp"
|
||||||
#include "../helpers/random_values.hpp"
|
#include "../helpers/random_values.hpp"
|
||||||
@ -884,13 +888,24 @@ namespace insert_tests {
|
|||||||
boost::unordered_multimap<test::object, test::object, test::hash,
|
boost::unordered_multimap<test::object, test::object, test::hash,
|
||||||
test::equal_to, test::allocator1<test::object> >* test_multimap;
|
test::equal_to, test::allocator1<test::object> >* test_multimap;
|
||||||
|
|
||||||
|
#ifdef BOOST_UNORDERED_FOA_TESTS
|
||||||
|
boost::unordered::unordered_flat_map<test::movable, test::movable, test::hash,
|
||||||
|
test::equal_to, test::allocator2<test::movable> >* test_flat_map;
|
||||||
|
#endif
|
||||||
|
|
||||||
using test::default_generator;
|
using test::default_generator;
|
||||||
using test::generate_collisions;
|
using test::generate_collisions;
|
||||||
using test::limited_range;
|
using test::limited_range;
|
||||||
|
|
||||||
|
#ifdef BOOST_UNORDERED_FOA_TESTS
|
||||||
|
UNORDERED_TEST(unique_insert_tests1,
|
||||||
|
((test_set_std_alloc)(test_set)(test_map)(test_flat_map))(
|
||||||
|
(default_generator)(generate_collisions)(limited_range)))
|
||||||
|
#else
|
||||||
UNORDERED_TEST(unique_insert_tests1,
|
UNORDERED_TEST(unique_insert_tests1,
|
||||||
((test_set_std_alloc)(test_set)(test_map))(
|
((test_set_std_alloc)(test_set)(test_map))(
|
||||||
(default_generator)(generate_collisions)(limited_range)))
|
(default_generator)(generate_collisions)(limited_range)))
|
||||||
|
#endif
|
||||||
|
|
||||||
UNORDERED_TEST(equivalent_insert_tests1,
|
UNORDERED_TEST(equivalent_insert_tests1,
|
||||||
((test_multimap_std_alloc)(test_multiset)(test_multimap))(
|
((test_multimap_std_alloc)(test_multiset)(test_multimap))(
|
||||||
|
Reference in New Issue
Block a user