mirror of
https://github.com/boostorg/unordered.git
synced 2025-07-31 03:47:16 +02:00
Add find()
test support for multimap
This commit is contained in:
@ -164,11 +164,10 @@ template <class UnorderedMap> void test_transparent_find()
|
|||||||
int n = 5;
|
int n = 5;
|
||||||
|
|
||||||
for (int i = 0; i < n; ++i) {
|
for (int i = 0; i < n; ++i) {
|
||||||
map[key(i)] = i;
|
map.insert(std::make_pair(i, i));
|
||||||
}
|
}
|
||||||
|
|
||||||
int const expected_key_count = 2 * n;
|
int const expected_key_count = key::count_;
|
||||||
BOOST_TEST_EQ(key::count_, expected_key_count);
|
|
||||||
|
|
||||||
// explicitly test `find()` and `find() const` separately
|
// explicitly test `find()` and `find() const` separately
|
||||||
//
|
//
|
||||||
@ -226,12 +225,10 @@ template <class UnorderedMap> void test_non_transparent_find()
|
|||||||
int n = 5;
|
int n = 5;
|
||||||
|
|
||||||
for (int i = 0; i < n; ++i) {
|
for (int i = 0; i < n; ++i) {
|
||||||
map[key(i)] = i;
|
map.insert(std::make_pair(i, i));
|
||||||
}
|
}
|
||||||
|
|
||||||
int key_count = 2 * n;
|
int key_count = key::count_;
|
||||||
|
|
||||||
BOOST_TEST_EQ(key::count_, key_count);
|
|
||||||
|
|
||||||
// explicitly test `find()` and `find() const` separately
|
// explicitly test `find()` and `find() const` separately
|
||||||
//
|
//
|
||||||
@ -738,7 +735,8 @@ template <class UnorderedMap> void test_non_transparent_extract()
|
|||||||
BOOST_TEST_EQ(key::count_, key_count);
|
BOOST_TEST_EQ(key::count_, key_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
UNORDERED_AUTO_TEST (unordered_map_transparent_count) {
|
void test_unordered_map()
|
||||||
|
{
|
||||||
{
|
{
|
||||||
typedef boost::unordered_map<key, int, transparent_hasher,
|
typedef boost::unordered_map<key, int, transparent_hasher,
|
||||||
transparent_key_equal>
|
transparent_key_equal>
|
||||||
@ -790,4 +788,47 @@ UNORDERED_AUTO_TEST (unordered_map_transparent_count) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void test_unordered_multimap()
|
||||||
|
{
|
||||||
|
{
|
||||||
|
typedef boost::unordered_multimap<key, int, transparent_hasher,
|
||||||
|
transparent_key_equal>
|
||||||
|
unordered_multimap;
|
||||||
|
|
||||||
|
test_transparent_find<unordered_multimap>();
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// non-transparent Hash, non-transparent KeyEqual
|
||||||
|
//
|
||||||
|
typedef boost::unordered_multimap<key, int, hasher, key_equal>
|
||||||
|
unordered_multimap;
|
||||||
|
|
||||||
|
test_non_transparent_find<unordered_multimap>();
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// transparent Hash, non-transparent KeyEqual
|
||||||
|
//
|
||||||
|
typedef boost::unordered_multimap<key, int, transparent_hasher, key_equal>
|
||||||
|
unordered_multimap;
|
||||||
|
|
||||||
|
test_non_transparent_find<unordered_multimap>();
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
// non-transparent Hash, transparent KeyEqual
|
||||||
|
//
|
||||||
|
typedef boost::unordered_multimap<key, int, hasher, transparent_key_equal>
|
||||||
|
unordered_multimap;
|
||||||
|
|
||||||
|
test_non_transparent_find<unordered_multimap>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
UNORDERED_AUTO_TEST (transparent_ops) {
|
||||||
|
test_unordered_map();
|
||||||
|
test_unordered_multimap();
|
||||||
|
}
|
||||||
|
|
||||||
RUN_TESTS()
|
RUN_TESTS()
|
||||||
|
Reference in New Issue
Block a user