26 #include <boost/mpl/list.hpp>
27 #include <boost/test/unit_test.hpp>
38 BOOST_AUTO_TEST_SUITE(test_robin_set)
46 std::equal_to<move_only_test>,
51 std::equal_to<self_reference_member_test>,
55 std::equal_to<move_only_test>,
61 using key_t =
typename HSet::key_type;
63 const std::size_t nb_values = 1000;
65 typename HSet::iterator it;
68 for (std::size_t i = 0; i < nb_values; i++) {
69 std::tie(it, inserted) =
set.insert(utils::get_key<key_t>(i));
71 BOOST_CHECK_EQUAL(*it, utils::get_key<key_t>(i));
72 BOOST_CHECK(inserted);
74 BOOST_CHECK_EQUAL(
set.size(), nb_values);
76 for (std::size_t i = 0; i < nb_values; i++) {
77 std::tie(it, inserted) =
set.insert(utils::get_key<key_t>(i));
79 BOOST_CHECK_EQUAL(*it, utils::get_key<key_t>(i));
80 BOOST_CHECK(!inserted);
83 for (std::size_t i = 0; i < nb_values; i++) {
84 it =
set.find(utils::get_key<key_t>(i));
86 BOOST_CHECK_EQUAL(*it, utils::get_key<key_t>(i));
97 BOOST_CHECK(set1 == set1_copy);
98 BOOST_CHECK(set1_copy == set1);
100 BOOST_CHECK(set1 != set2);
101 BOOST_CHECK(set2 != set1);
103 BOOST_CHECK(set1 != set3);
104 BOOST_CHECK(set3 != set1);
106 BOOST_CHECK(set1 != set4);
107 BOOST_CHECK(set4 != set1);
109 BOOST_CHECK(set2 != set3);
110 BOOST_CHECK(set3 != set2);
112 BOOST_CHECK(set2 != set4);
113 BOOST_CHECK(set4 != set2);
115 BOOST_CHECK(set3 != set4);
116 BOOST_CHECK(set4 != set3);
126 set.insert(value_ptr);
127 set.emplace(value_ptr);
129 BOOST_CHECK_EQUAL(
set.size(), 1);
130 BOOST_CHECK_EQUAL(**
set.begin(), value);
140 const std::size_t nb_values = 1000;
143 for (std::size_t i = 0; i < nb_values + 40; i++) {
144 set.insert(utils::get_key<move_only_test>(i));
147 for (std::size_t i = nb_values; i < nb_values + 40; i++) {
148 set.erase(utils::get_key<move_only_test>(i));
150 BOOST_CHECK_EQUAL(
set.size(), nb_values);
153 set.serialize(serial);
156 auto set_deserialized = decltype(
set)::
deserialize(dserial,
true);
157 BOOST_CHECK(
set == set_deserialized);
161 BOOST_CHECK(set_deserialized ==
set);
168 auto it =
set.find(4);
169 BOOST_CHECK(it !=
set.end());
171 BOOST_CHECK(
set.size() == 0);
174 BOOST_AUTO_TEST_SUITE_END()