Add foa-based node containers to the exception tests

This commit is contained in:
Christian Mazakas
2023-02-14 10:39:28 -08:00
parent e96ec1e79a
commit 8c0c230f78
3 changed files with 73 additions and 9 deletions

View File

@ -1,6 +1,6 @@
// Copyright 2006-2009 Daniel James.
// Copyright 2022 Christian Mazakas.
// Copyright 2022-2023 Christian Mazakas.
// 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)
#include "./containers.hpp"
@ -229,10 +229,12 @@ using test::generate_collisions;
#ifdef BOOST_UNORDERED_FOA_TESTS
test_set* test_set_;
test_map* test_map_;
test_node_set* test_node_set_;
test_node_map* test_node_map_;
// clang-format off
UNORDERED_TEST(insert_exception_test,
((test_set_)(test_map_))
((test_set_)(test_map_)(test_node_set_)(test_node_map_))
((insert_lvalue)(insert_lvalue_begin)(insert_lvalue_end)
(insert_lvalue_pos)(insert_single_item_range)
(emplace_lvalue)(emplace_lvalue_begin)(emplace_lvalue_end)
@ -242,7 +244,7 @@ UNORDERED_TEST(insert_exception_test,
)
UNORDERED_TEST(insert_rehash_exception_test,
((test_set_)(test_map_))
((test_set_)(test_map_)(test_node_set_)(test_node_map_))
((insert_lvalue)(insert_lvalue_begin)(insert_lvalue_end)
(insert_lvalue_pos)(insert_single_item_range)
(emplace_lvalue)(emplace_lvalue_begin)(emplace_lvalue_end)
@ -314,15 +316,16 @@ struct pair_emplace2_type : inserter_base
#ifdef BOOST_UNORDERED_FOA_TESTS
test_pair_set* test_pair_set_;
test_pair_node_set* test_pair_node_set_;
// clang-format off
UNORDERED_TEST(insert_exception_test,
((test_pair_set_)(test_map_))
((test_pair_set_)(test_map_)(test_pair_node_set_)(test_node_map_))
((pair_emplace)(pair_emplace2))
((default_generator)(limited_range)(generate_collisions))
)
UNORDERED_TEST(insert_rehash_exception_test,
((test_pair_set_)(test_map_))
((test_pair_set_)(test_map_)(test_pair_node_set_)(test_node_map_))
((pair_emplace)(pair_emplace2))
((default_generator)(limited_range)(generate_collisions))
)
@ -399,6 +402,20 @@ struct map_insert_or_assign_type : map_inserter_base
}
} map_insert_or_assign;
#ifdef BOOST_UNORDERED_FOA_TESTS
// clang-format off
UNORDERED_TEST(insert_exception_test,
((test_map_)(test_node_map_))
((try_emplace)(try_emplace2)(map_insert_operator)(map_insert_or_assign))
((default_generator)(limited_range)(generate_collisions))
)
UNORDERED_TEST(insert_rehash_exception_test,
((test_map_)(test_node_map_))
((try_emplace)(try_emplace2)(map_insert_operator)(map_insert_or_assign))
((default_generator)(limited_range)(generate_collisions))
)
// clang-format on
#else
// clang-format off
UNORDERED_TEST(insert_exception_test,
((test_map_))
@ -411,6 +428,7 @@ UNORDERED_TEST(insert_rehash_exception_test,
((default_generator)(limited_range)(generate_collisions))
)
// clang-format on
#endif
// Range insert tests
@ -459,12 +477,12 @@ void insert_range_rehash_exception_test(T*, test::random_generator gen)
#ifdef BOOST_UNORDERED_FOA_TESTS
// clang-format off
UNORDERED_TEST(insert_range_exception_test,
((test_set_)(test_map_))
((test_set_)(test_map_)(test_node_set_)(test_node_map_))
((default_generator)(limited_range)(generate_collisions))
)
UNORDERED_TEST(insert_range_rehash_exception_test,
((test_set_)(test_map_))
((test_set_)(test_map_)(test_node_set_)(test_node_map_))
((default_generator)(limited_range)(generate_collisions))
)
// clang-format on

View File

@ -1,6 +1,6 @@
// Copyright 2017-2018 Daniel James.
// Copyright 2022 Christian Mazakas.
// Copyright 2022-2023 Christian Mazakas.
// 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)
@ -64,6 +64,12 @@ boost::unordered_flat_set<test::exception::object, test::exception::hash,
boost::unordered_flat_map<test::exception::object, test::exception::object,
test::exception::hash, test::exception::equal_to,
test::exception::allocator2<test::exception::object> >* test_map_;
boost::unordered_node_set<test::exception::object, test::exception::hash,
test::exception::equal_to,
test::exception::allocator<test::exception::object> >* test_node_set_;
boost::unordered_node_map<test::exception::object, test::exception::object,
test::exception::hash, test::exception::equal_to,
test::exception::allocator2<test::exception::object> >* test_node_map_;
// clang-format off
UNORDERED_MULTI_TEST(set_merge, merge_exception_test,
@ -99,6 +105,40 @@ UNORDERED_MULTI_TEST(map_merge_collisions, merge_exception_test,
((generate_collisions))
((generate_collisions))
)
UNORDERED_MULTI_TEST(node_set_merge, merge_exception_test,
((test_node_set_))
((test_node_set_))
(/* (0x0000)(0x6400) */(0x0064)/* (0x0a64)(0x3232) */)
((0x0000)(0x0001)(0x0102))
((default_generator)(limited_range))
((default_generator)(limited_range))
)
UNORDERED_MULTI_TEST(node_map_merge, merge_exception_test,
((test_node_map_))
((test_node_map_))
((0x0000)(0x6400)(0x0064)(0x0a64)(0x3232))
((0x0101)(0x0200)(0x0201))
((default_generator)(limited_range))
((default_generator)(limited_range))
)
// Run fewer generate_collisions tests, as they're slow.
UNORDERED_MULTI_TEST(node_set_merge_collisions, merge_exception_test,
((test_node_set_))
((test_node_set_))
((0x0a0a))
((0x0202)(0x0100)(0x0201))
((generate_collisions))
((generate_collisions))
)
UNORDERED_MULTI_TEST(node_map_merge_collisions, merge_exception_test,
((test_node_map_))
((test_node_map_))
((0x0a0a))
((0x0000)(0x0002)(0x0102))
((generate_collisions))
((generate_collisions))
)
// clang-format on
#else
boost::unordered_set<test::exception::object, test::exception::hash,
test::exception::equal_to,

View File

@ -247,8 +247,14 @@ using unordered_flat_set = boost::unordered_flat_set<int, boost::hash<int>,
std::equal_to<int>, test::allocator1<int> >;
using unordered_flat_map = boost::unordered_flat_map<int, int, boost::hash<int>,
std::equal_to<int>, test::allocator1<std::pair<int const, int> > >;
using unordered_node_set = boost::unordered_node_set<int, boost::hash<int>,
std::equal_to<int>, test::allocator1<int> >;
using unordered_node_map = boost::unordered_node_map<int, int, boost::hash<int>,
std::equal_to<int>, test::allocator1<std::pair<int const, int> > >;
#define SWAP_CONTAINER_SEQ (unordered_flat_set)(unordered_flat_map)
#define SWAP_CONTAINER_SEQ \
(unordered_flat_set)(unordered_flat_map) \
(unordered_node_set)(unordered_node_map)
#else