| 1 | |
| 2 | // Copyright 2006-2009 Daniel James. |
| 3 | // Copyright (C) 2022-2023 Christian Mazakas |
| 4 | // Distributed under the Boost Software License, Version 1.0. (See accompanying |
| 5 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 6 | |
| 7 | #include "../helpers/unordered.hpp" |
| 8 | |
| 9 | #include "../helpers/equivalent.hpp" |
| 10 | #include "../helpers/invariants.hpp" |
| 11 | #include "../helpers/random_values.hpp" |
| 12 | #include "../helpers/test.hpp" |
| 13 | #include "../helpers/tracker.hpp" |
| 14 | #include "../objects/cxx11_allocator.hpp" |
| 15 | #include "../objects/test.hpp" |
| 16 | |
| 17 | test::seed_t initialize_seed(9063); |
| 18 | |
| 19 | namespace copy_tests { |
| 20 | |
| 21 | template <class T> |
| 22 | void copy_construct_tests1(T*, test::random_generator const& generator) |
| 23 | { |
| 24 | typedef typename T::allocator_type allocator_type; |
| 25 | |
| 26 | typename T::hasher hf; |
| 27 | typename T::key_equal eq; |
| 28 | typename T::allocator_type al; |
| 29 | |
| 30 | { |
| 31 | test::check_instances check_; |
| 32 | |
| 33 | T x; |
| 34 | T y(x); |
| 35 | BOOST_TEST(y.empty()); |
| 36 | BOOST_TEST(test::equivalent(y.hash_function(), hf)); |
| 37 | BOOST_TEST(test::equivalent(y.key_eq(), eq)); |
| 38 | BOOST_TEST(test::equivalent(y.get_allocator(), al)); |
| 39 | BOOST_TEST(x.max_load_factor() == y.max_load_factor()); |
| 40 | BOOST_TEST(test::selected_count(y.get_allocator()) == |
| 41 | (allocator_type::is_select_on_copy)); |
| 42 | BOOST_TEST(test::detail::tracker.count_allocations == 0); |
| 43 | test::check_equivalent_keys(y); |
| 44 | } |
| 45 | |
| 46 | { |
| 47 | test::check_instances check_; |
| 48 | |
| 49 | T x(0); |
| 50 | T y(x); |
| 51 | BOOST_TEST(y.empty()); |
| 52 | BOOST_TEST(test::equivalent(y.hash_function(), hf)); |
| 53 | BOOST_TEST(test::equivalent(y.key_eq(), eq)); |
| 54 | BOOST_TEST(test::equivalent(y.get_allocator(), al)); |
| 55 | BOOST_TEST(x.max_load_factor() == y.max_load_factor()); |
| 56 | BOOST_TEST(test::selected_count(y.get_allocator()) == |
| 57 | (allocator_type::is_select_on_copy)); |
| 58 | BOOST_TEST(test::detail::tracker.count_allocations == 0); |
| 59 | test::check_equivalent_keys(y); |
| 60 | } |
| 61 | |
| 62 | { |
| 63 | test::check_instances check_; |
| 64 | |
| 65 | test::random_values<T> v(1000, generator); |
| 66 | |
| 67 | T x(v.begin(), v.end()); |
| 68 | T y(x); |
| 69 | test::unordered_equivalence_tester<T> equivalent(x); |
| 70 | BOOST_TEST(equivalent(y)); |
| 71 | BOOST_TEST(test::selected_count(y.get_allocator()) == |
| 72 | (allocator_type::is_select_on_copy)); |
| 73 | test::check_equivalent_keys(y); |
| 74 | } |
| 75 | |
| 76 | { |
| 77 | test::check_instances check_; |
| 78 | |
| 79 | // In this test I drop the original containers max load factor, so it |
| 80 | // is much lower than the load factor. The hash table is not allowed |
| 81 | // to rehash, but the destination container should probably allocate |
| 82 | // enough buckets to decrease the load factor appropriately. |
| 83 | test::random_values<T> v(1000, generator); |
| 84 | T x(v.begin(), v.end()); |
| 85 | x.max_load_factor(x.load_factor() / 4); |
| 86 | T y(x); |
| 87 | test::unordered_equivalence_tester<T> equivalent(x); |
| 88 | BOOST_TEST(equivalent(y)); |
| 89 | // This isn't guaranteed: |
| 90 | BOOST_TEST(y.load_factor() < y.max_load_factor()); |
| 91 | BOOST_TEST(test::selected_count(y.get_allocator()) == |
| 92 | (allocator_type::is_select_on_copy)); |
| 93 | test::check_equivalent_keys(y); |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | template <class T> |
| 98 | void copy_construct_tests2(T*, test::random_generator const& generator) |
| 99 | { |
| 100 | typename T::hasher hf(1); |
| 101 | typename T::key_equal eq(1); |
| 102 | typename T::allocator_type al(1); |
| 103 | typename T::allocator_type al2(2); |
| 104 | |
| 105 | typedef typename T::allocator_type allocator_type; |
| 106 | |
| 107 | { |
| 108 | test::check_instances check_; |
| 109 | |
| 110 | T x(0, hf, eq, al); |
| 111 | T y(x); |
| 112 | BOOST_TEST(y.empty()); |
| 113 | BOOST_TEST(test::equivalent(y.hash_function(), hf)); |
| 114 | BOOST_TEST(test::equivalent(y.key_eq(), eq)); |
| 115 | BOOST_TEST(test::equivalent(y.get_allocator(), al)); |
| 116 | BOOST_TEST(x.max_load_factor() == y.max_load_factor()); |
| 117 | BOOST_TEST(test::selected_count(y.get_allocator()) == |
| 118 | (allocator_type::is_select_on_copy)); |
| 119 | BOOST_TEST(test::detail::tracker.count_allocations == 0); |
| 120 | test::check_equivalent_keys(y); |
| 121 | } |
| 122 | |
| 123 | { |
| 124 | test::check_instances check_; |
| 125 | |
| 126 | T x(10000, hf, eq, al); |
| 127 | T y(x); |
| 128 | BOOST_TEST(y.empty()); |
| 129 | BOOST_TEST(test::equivalent(y.hash_function(), hf)); |
| 130 | BOOST_TEST(test::equivalent(y.key_eq(), eq)); |
| 131 | BOOST_TEST(test::equivalent(y.get_allocator(), al)); |
| 132 | BOOST_TEST(x.max_load_factor() == y.max_load_factor()); |
| 133 | BOOST_TEST(test::selected_count(y.get_allocator()) == |
| 134 | (allocator_type::is_select_on_copy)); |
| 135 | test::check_equivalent_keys(y); |
| 136 | } |
| 137 | |
| 138 | { |
| 139 | test::check_instances check_; |
| 140 | |
| 141 | T x(0, hf, eq, al); |
| 142 | T y(x, al2); |
| 143 | BOOST_TEST(y.empty()); |
| 144 | BOOST_TEST(test::equivalent(y.hash_function(), hf)); |
| 145 | BOOST_TEST(test::equivalent(y.key_eq(), eq)); |
| 146 | BOOST_TEST(test::equivalent(y.get_allocator(), al2)); |
| 147 | BOOST_TEST(x.max_load_factor() == y.max_load_factor()); |
| 148 | BOOST_TEST(test::selected_count(y.get_allocator()) == 0); |
| 149 | BOOST_TEST(test::detail::tracker.count_allocations == 0); |
| 150 | test::check_equivalent_keys(y); |
| 151 | } |
| 152 | |
| 153 | { |
| 154 | test::check_instances check_; |
| 155 | |
| 156 | T x(1000, hf, eq, al); |
| 157 | T y(x, al2); |
| 158 | BOOST_TEST(y.empty()); |
| 159 | BOOST_TEST(test::equivalent(y.hash_function(), hf)); |
| 160 | BOOST_TEST(test::equivalent(y.key_eq(), eq)); |
| 161 | BOOST_TEST(test::equivalent(y.get_allocator(), al2)); |
| 162 | BOOST_TEST(x.max_load_factor() == y.max_load_factor()); |
| 163 | BOOST_TEST(test::selected_count(y.get_allocator()) == 0); |
| 164 | test::check_equivalent_keys(y); |
| 165 | } |
| 166 | |
| 167 | { |
| 168 | test::check_instances check_; |
| 169 | |
| 170 | test::random_values<T> v; |
| 171 | |
| 172 | T x(v.begin(), v.end(), 0, hf, eq, al); |
| 173 | T y(x); |
| 174 | test::unordered_equivalence_tester<T> equivalent(x); |
| 175 | BOOST_TEST(equivalent(y)); |
| 176 | test::check_equivalent_keys(y); |
| 177 | BOOST_TEST(test::selected_count(y.get_allocator()) == |
| 178 | (allocator_type::is_select_on_copy)); |
| 179 | BOOST_TEST(test::equivalent(y.get_allocator(), al)); |
| 180 | BOOST_TEST(test::detail::tracker.count_allocations == 0); |
| 181 | } |
| 182 | |
| 183 | { |
| 184 | test::check_instances check_; |
| 185 | |
| 186 | test::random_values<T> v(1000, generator); |
| 187 | |
| 188 | T x(v.begin(), v.end(), 0, hf, eq, al); |
| 189 | T y(x); |
| 190 | test::unordered_equivalence_tester<T> equivalent(x); |
| 191 | BOOST_TEST(equivalent(y)); |
| 192 | test::check_equivalent_keys(y); |
| 193 | BOOST_TEST(test::selected_count(y.get_allocator()) == |
| 194 | (allocator_type::is_select_on_copy)); |
| 195 | BOOST_TEST(test::equivalent(y.get_allocator(), al)); |
| 196 | } |
| 197 | |
| 198 | { |
| 199 | test::check_instances check_; |
| 200 | |
| 201 | test::random_values<T> v; |
| 202 | |
| 203 | T x(v.begin(), v.end(), 0, hf, eq, al); |
| 204 | T y(x, al2); |
| 205 | test::unordered_equivalence_tester<T> equivalent(x); |
| 206 | BOOST_TEST(equivalent(y)); |
| 207 | test::check_equivalent_keys(y); |
| 208 | BOOST_TEST(test::selected_count(y.get_allocator()) == 0); |
| 209 | BOOST_TEST(test::equivalent(y.get_allocator(), al2)); |
| 210 | BOOST_TEST(test::detail::tracker.count_allocations == 0); |
| 211 | } |
| 212 | |
| 213 | { |
| 214 | test::check_instances check_; |
| 215 | |
| 216 | test::random_values<T> v(500, generator); |
| 217 | |
| 218 | T x(v.begin(), v.end(), 0, hf, eq, al); |
| 219 | T y(x, al2); |
| 220 | test::unordered_equivalence_tester<T> equivalent(x); |
| 221 | BOOST_TEST(equivalent(y)); |
| 222 | test::check_equivalent_keys(y); |
| 223 | BOOST_TEST(test::selected_count(y.get_allocator()) == 0); |
| 224 | BOOST_TEST(test::equivalent(y.get_allocator(), al2)); |
| 225 | } |
| 226 | } |
| 227 | |
| 228 | template <class T> |
| 229 | void copy_construct_tests_std_allocator1( |
| 230 | T*, test::random_generator const& generator) |
| 231 | { |
| 232 | typename T::hasher hf; |
| 233 | typename T::key_equal eq; |
| 234 | typename T::allocator_type al; |
| 235 | |
| 236 | { |
| 237 | test::check_instances check_; |
| 238 | |
| 239 | T x; |
| 240 | T y(x); |
| 241 | BOOST_TEST(y.empty()); |
| 242 | BOOST_TEST(test::equivalent(y.hash_function(), hf)); |
| 243 | BOOST_TEST(test::equivalent(y.key_eq(), eq)); |
| 244 | BOOST_TEST(test::equivalent(y.get_allocator(), al)); |
| 245 | BOOST_TEST(x.max_load_factor() == y.max_load_factor()); |
| 246 | BOOST_TEST(test::detail::tracker.count_allocations == 0); |
| 247 | test::check_equivalent_keys(y); |
| 248 | } |
| 249 | |
| 250 | { |
| 251 | test::check_instances check_; |
| 252 | |
| 253 | T x(0); |
| 254 | T y(x); |
| 255 | BOOST_TEST(y.empty()); |
| 256 | BOOST_TEST(test::equivalent(y.hash_function(), hf)); |
| 257 | BOOST_TEST(test::equivalent(y.key_eq(), eq)); |
| 258 | BOOST_TEST(test::equivalent(y.get_allocator(), al)); |
| 259 | BOOST_TEST(x.max_load_factor() == y.max_load_factor()); |
| 260 | BOOST_TEST(test::detail::tracker.count_allocations == 0); |
| 261 | test::check_equivalent_keys(y); |
| 262 | } |
| 263 | |
| 264 | { |
| 265 | test::check_instances check_; |
| 266 | |
| 267 | test::random_values<T> v(1000, generator); |
| 268 | |
| 269 | T x(v.begin(), v.end()); |
| 270 | T y(x); |
| 271 | test::unordered_equivalence_tester<T> equivalent(x); |
| 272 | BOOST_TEST(equivalent(y)); |
| 273 | test::check_equivalent_keys(y); |
| 274 | } |
| 275 | |
| 276 | { |
| 277 | test::check_instances check_; |
| 278 | |
| 279 | // In this test I drop the original containers max load factor, so it |
| 280 | // is much lower than the load factor. The hash table is not allowed |
| 281 | // to rehash, but the destination container should probably allocate |
| 282 | // enough buckets to decrease the load factor appropriately. |
| 283 | test::random_values<T> v(1000, generator); |
| 284 | T x(v.begin(), v.end()); |
| 285 | x.max_load_factor(x.load_factor() / 4); |
| 286 | T y(x); |
| 287 | test::unordered_equivalence_tester<T> equivalent(x); |
| 288 | BOOST_TEST(equivalent(y)); |
| 289 | // This isn't guaranteed: |
| 290 | BOOST_TEST(y.load_factor() < y.max_load_factor()); |
| 291 | test::check_equivalent_keys(y); |
| 292 | } |
| 293 | } |
| 294 | |
| 295 | template <class T> |
| 296 | void copy_construct_tests_std_allocator2( |
| 297 | T*, test::random_generator const& generator) |
| 298 | { |
| 299 | typename T::hasher hf(1); |
| 300 | typename T::key_equal eq(1); |
| 301 | typename T::allocator_type al; |
| 302 | |
| 303 | { |
| 304 | test::check_instances check_; |
| 305 | |
| 306 | T x(0, hf, eq, al); |
| 307 | T y(x); |
| 308 | BOOST_TEST(y.empty()); |
| 309 | BOOST_TEST(test::equivalent(y.hash_function(), hf)); |
| 310 | BOOST_TEST(test::equivalent(y.key_eq(), eq)); |
| 311 | BOOST_TEST(test::equivalent(y.get_allocator(), al)); |
| 312 | BOOST_TEST(x.max_load_factor() == y.max_load_factor()); |
| 313 | BOOST_TEST(test::detail::tracker.count_allocations == 0); |
| 314 | test::check_equivalent_keys(y); |
| 315 | } |
| 316 | |
| 317 | { |
| 318 | test::check_instances check_; |
| 319 | |
| 320 | T x(10000, hf, eq, al); |
| 321 | T y(x); |
| 322 | BOOST_TEST(y.empty()); |
| 323 | BOOST_TEST(test::equivalent(y.hash_function(), hf)); |
| 324 | BOOST_TEST(test::equivalent(y.key_eq(), eq)); |
| 325 | BOOST_TEST(test::equivalent(y.get_allocator(), al)); |
| 326 | BOOST_TEST(x.max_load_factor() == y.max_load_factor()); |
| 327 | test::check_equivalent_keys(y); |
| 328 | } |
| 329 | |
| 330 | { |
| 331 | test::check_instances check_; |
| 332 | |
| 333 | T x(0, hf, eq, al); |
| 334 | T y(x, al); |
| 335 | BOOST_TEST(y.empty()); |
| 336 | BOOST_TEST(test::equivalent(y.hash_function(), hf)); |
| 337 | BOOST_TEST(test::equivalent(y.key_eq(), eq)); |
| 338 | BOOST_TEST(test::equivalent(y.get_allocator(), al)); |
| 339 | BOOST_TEST(x.max_load_factor() == y.max_load_factor()); |
| 340 | BOOST_TEST(test::selected_count(y.get_allocator()) == 0); |
| 341 | BOOST_TEST(test::detail::tracker.count_allocations == 0); |
| 342 | test::check_equivalent_keys(y); |
| 343 | } |
| 344 | |
| 345 | { |
| 346 | test::check_instances check_; |
| 347 | |
| 348 | T x(1000, hf, eq, al); |
| 349 | T y(x, al); |
| 350 | BOOST_TEST(y.empty()); |
| 351 | BOOST_TEST(test::equivalent(y.hash_function(), hf)); |
| 352 | BOOST_TEST(test::equivalent(y.key_eq(), eq)); |
| 353 | BOOST_TEST(test::equivalent(y.get_allocator(), al)); |
| 354 | BOOST_TEST(x.max_load_factor() == y.max_load_factor()); |
| 355 | BOOST_TEST(test::selected_count(y.get_allocator()) == 0); |
| 356 | test::check_equivalent_keys(y); |
| 357 | } |
| 358 | |
| 359 | { |
| 360 | test::check_instances check_; |
| 361 | |
| 362 | test::random_values<T> v; |
| 363 | |
| 364 | T x(v.begin(), v.end(), 0, hf, eq, al); |
| 365 | T y(x); |
| 366 | test::unordered_equivalence_tester<T> equivalent(x); |
| 367 | BOOST_TEST(equivalent(y)); |
| 368 | test::check_equivalent_keys(y); |
| 369 | BOOST_TEST(test::equivalent(y.get_allocator(), al)); |
| 370 | BOOST_TEST(test::detail::tracker.count_allocations == 0); |
| 371 | } |
| 372 | |
| 373 | { |
| 374 | test::check_instances check_; |
| 375 | |
| 376 | test::random_values<T> v(1000, generator); |
| 377 | |
| 378 | T x(v.begin(), v.end(), 0, hf, eq, al); |
| 379 | T y(x); |
| 380 | test::unordered_equivalence_tester<T> equivalent(x); |
| 381 | BOOST_TEST(equivalent(y)); |
| 382 | test::check_equivalent_keys(y); |
| 383 | BOOST_TEST(test::equivalent(y.get_allocator(), al)); |
| 384 | } |
| 385 | |
| 386 | { |
| 387 | test::check_instances check_; |
| 388 | |
| 389 | test::random_values<T> v; |
| 390 | |
| 391 | T x(v.begin(), v.end(), 0, hf, eq, al); |
| 392 | T y(x, al); |
| 393 | test::unordered_equivalence_tester<T> equivalent(x); |
| 394 | BOOST_TEST(equivalent(y)); |
| 395 | test::check_equivalent_keys(y); |
| 396 | BOOST_TEST(test::selected_count(y.get_allocator()) == 0); |
| 397 | BOOST_TEST(test::equivalent(y.get_allocator(), al)); |
| 398 | BOOST_TEST(test::detail::tracker.count_allocations == 0); |
| 399 | } |
| 400 | |
| 401 | { |
| 402 | test::check_instances check_; |
| 403 | |
| 404 | test::random_values<T> v(500, generator); |
| 405 | |
| 406 | T x(v.begin(), v.end(), 0, hf, eq, al); |
| 407 | T y(x, al); |
| 408 | test::unordered_equivalence_tester<T> equivalent(x); |
| 409 | BOOST_TEST(equivalent(y)); |
| 410 | test::check_equivalent_keys(y); |
| 411 | BOOST_TEST(test::selected_count(y.get_allocator()) == 0); |
| 412 | BOOST_TEST(test::equivalent(y.get_allocator(), al)); |
| 413 | } |
| 414 | } |
| 415 | |
| 416 | using test::default_generator; |
| 417 | using test::generate_collisions; |
| 418 | using test::limited_range; |
| 419 | |
| 420 | #ifdef BOOST_UNORDERED_FOA_TESTS |
| 421 | template <class T> struct allocator |
| 422 | { |
| 423 | using value_type = T; |
| 424 | |
| 425 | allocator() = default; |
| 426 | allocator(allocator const&) = default; |
| 427 | allocator(allocator&&) = default; |
| 428 | |
| 429 | template <class U> allocator(allocator<U> const&) {} |
| 430 | |
| 431 | T* allocate(std::size_t n) |
| 432 | { |
| 433 | return static_cast<T*>(::operator new(sizeof(value_type) * n)); |
| 434 | } |
| 435 | |
| 436 | void deallocate(T* p, std::size_t) { ::operator delete(p); } |
| 437 | |
| 438 | friend inline bool operator==(allocator const&, allocator const&) |
| 439 | { |
| 440 | return true; |
| 441 | } |
| 442 | |
| 443 | friend inline bool operator!=(allocator const&, allocator const&) |
| 444 | { |
| 445 | return false; |
| 446 | } |
| 447 | }; |
| 448 | |
| 449 | boost::unordered_flat_set<test::object, test::hash, test::equal_to, |
| 450 | test::allocator1<test::object> >* test_set; |
| 451 | boost::unordered_flat_map<test::object, test::object, test::hash, |
| 452 | test::equal_to, test::allocator1<test::object> >* test_map; |
| 453 | |
| 454 | boost::unordered_flat_set<test::object, test::hash, test::equal_to, |
| 455 | test::cxx11_allocator<test::object, test::select_copy> >* |
| 456 | test_set_select_copy; |
| 457 | boost::unordered_flat_map<test::object, test::object, test::hash, |
| 458 | test::equal_to, test::cxx11_allocator<test::object, test::select_copy> >* |
| 459 | test_map_select_copy; |
| 460 | |
| 461 | boost::unordered_flat_set<test::object, test::hash, test::equal_to, |
| 462 | test::cxx11_allocator<test::object, test::no_select_copy> >* |
| 463 | test_set_no_select_copy; |
| 464 | boost::unordered_flat_map<test::object, test::object, test::hash, |
| 465 | test::equal_to, test::cxx11_allocator<test::object, test::no_select_copy> >* |
| 466 | test_map_no_select_copy; |
| 467 | |
| 468 | boost::unordered_flat_set<int, test::hash, test::equal_to, |
| 469 | test::allocator1<int> >* test_set_trivially_copyable; |
| 470 | boost::unordered_flat_map<int, int, test::hash, test::equal_to, |
| 471 | test::allocator1<std::pair<int const, int> > >* test_map_trivially_copyable; |
| 472 | |
| 473 | boost::unordered_flat_set<int, test::hash, test::equal_to, |
| 474 | std::allocator<int> >* test_set_trivially_copyable_std_allocator; |
| 475 | boost::unordered_flat_map<int, int, test::hash, test::equal_to, |
| 476 | std::allocator<std::pair<int const, int> > >* |
| 477 | test_map_trivially_copyable_std_allocator; |
| 478 | |
| 479 | boost::unordered_flat_set<int, test::hash, test::equal_to, allocator<int> >* |
| 480 | test_set_trivially_copyable_no_construct; |
| 481 | boost::unordered_flat_map<int, int, test::hash, test::equal_to, |
| 482 | allocator<std::pair<int const, int> > >* |
| 483 | test_map_trivially_copyable_no_construct; |
| 484 | |
| 485 | boost::unordered_node_set<test::object, test::hash, test::equal_to, |
| 486 | test::allocator1<test::object> >* test_node_set; |
| 487 | boost::unordered_node_map<test::object, test::object, test::hash, |
| 488 | test::equal_to, test::allocator1<test::object> >* test_node_map; |
| 489 | |
| 490 | boost::unordered_node_set<test::object, test::hash, test::equal_to, |
| 491 | test::cxx11_allocator<test::object, test::select_copy> >* |
| 492 | test_node_set_select_copy; |
| 493 | boost::unordered_node_map<test::object, test::object, test::hash, |
| 494 | test::equal_to, test::cxx11_allocator<test::object, test::select_copy> >* |
| 495 | test_node_map_select_copy; |
| 496 | |
| 497 | boost::unordered_node_set<test::object, test::hash, test::equal_to, |
| 498 | test::cxx11_allocator<test::object, test::no_select_copy> >* |
| 499 | test_node_set_no_select_copy; |
| 500 | boost::unordered_node_map<test::object, test::object, test::hash, |
| 501 | test::equal_to, test::cxx11_allocator<test::object, test::no_select_copy> >* |
| 502 | test_node_map_no_select_copy; |
| 503 | |
| 504 | boost::unordered_node_set<int, test::hash, test::equal_to, |
| 505 | test::allocator1<int> >* test_node_set_trivially_copyable; |
| 506 | boost::unordered_node_map<int, int, test::hash, test::equal_to, |
| 507 | test::allocator1<std::pair<int const, int> > >* |
| 508 | test_node_map_trivially_copyable; |
| 509 | |
| 510 | boost::unordered_node_set<int, test::hash, test::equal_to, |
| 511 | std::allocator<int> >* test_node_set_trivially_copyable_std_allocator; |
| 512 | boost::unordered_node_map<int, int, test::hash, test::equal_to, |
| 513 | std::allocator<std::pair<int const, int> > >* |
| 514 | test_node_map_trivially_copyable_std_allocator; |
| 515 | |
| 516 | boost::unordered_node_set<int, test::hash, test::equal_to, allocator<int> >* |
| 517 | test_node_set_trivially_copyable_no_construct; |
| 518 | boost::unordered_node_map<int, int, test::hash, test::equal_to, |
| 519 | allocator<std::pair<int const, int> > >* |
| 520 | test_node_map_trivially_copyable_no_construct; |
| 521 | |
| 522 | // clang-format off |
| 523 | UNORDERED_TEST(copy_construct_tests1, |
| 524 | ((test_set)(test_map)(test_set_select_copy)(test_map_select_copy) |
| 525 | (test_set_no_select_copy)(test_map_no_select_copy) |
| 526 | (test_set_trivially_copyable)(test_map_trivially_copyable) |
| 527 | (test_node_set)(test_node_map)(test_node_set_select_copy)(test_node_map_select_copy) |
| 528 | (test_node_set_no_select_copy)(test_node_map_no_select_copy) |
| 529 | (test_node_set_trivially_copyable)(test_node_map_trivially_copyable)) |
| 530 | ((default_generator)(generate_collisions)(limited_range))) |
| 531 | |
| 532 | UNORDERED_TEST(copy_construct_tests2, |
| 533 | ((test_set)(test_map)(test_set_select_copy)(test_map_select_copy) |
| 534 | (test_set_no_select_copy)(test_map_no_select_copy) |
| 535 | (test_set_trivially_copyable)(test_map_trivially_copyable) |
| 536 | (test_node_set)(test_node_map)(test_node_set_select_copy)(test_node_map_select_copy) |
| 537 | (test_node_set_no_select_copy)(test_node_map_no_select_copy) |
| 538 | (test_node_set_trivially_copyable)(test_node_map_trivially_copyable)) |
| 539 | ((default_generator)(generate_collisions)(limited_range))) |
| 540 | |
| 541 | UNORDERED_TEST(copy_construct_tests_std_allocator1, |
| 542 | ((test_set_trivially_copyable_std_allocator) |
| 543 | (test_map_trivially_copyable_std_allocator) |
| 544 | (test_set_trivially_copyable_no_construct) |
| 545 | (test_map_trivially_copyable_no_construct) |
| 546 | (test_node_set_trivially_copyable_std_allocator) |
| 547 | (test_node_map_trivially_copyable_std_allocator) |
| 548 | (test_node_set_trivially_copyable_no_construct) |
| 549 | (test_node_map_trivially_copyable_no_construct)) |
| 550 | ((default_generator)(generate_collisions)(limited_range))) |
| 551 | |
| 552 | UNORDERED_TEST(copy_construct_tests_std_allocator2, |
| 553 | ((test_set_trivially_copyable_std_allocator) |
| 554 | (test_map_trivially_copyable_std_allocator) |
| 555 | (test_set_trivially_copyable_no_construct) |
| 556 | (test_map_trivially_copyable_no_construct) |
| 557 | (test_node_set_trivially_copyable_std_allocator) |
| 558 | (test_node_map_trivially_copyable_std_allocator) |
| 559 | (test_node_set_trivially_copyable_no_construct) |
| 560 | (test_node_map_trivially_copyable_no_construct)) |
| 561 | ((default_generator)(generate_collisions)(limited_range))) |
| 562 | // clang-format on |
| 563 | #else |
| 564 | boost::unordered_set<test::object, test::hash, test::equal_to, |
| 565 | test::allocator1<test::object> >* test_set; |
| 566 | boost::unordered_multiset<test::object, test::hash, test::equal_to, |
| 567 | test::allocator2<test::object> >* test_multiset; |
| 568 | boost::unordered_map<test::object, test::object, test::hash, test::equal_to, |
| 569 | test::allocator1<test::object> >* test_map; |
| 570 | boost::unordered_multimap<test::object, test::object, test::hash, |
| 571 | test::equal_to, test::allocator2<test::object> >* test_multimap; |
| 572 | |
| 573 | boost::unordered_set<test::object, test::hash, test::equal_to, |
| 574 | test::cxx11_allocator<test::object, test::select_copy> >* |
| 575 | test_set_select_copy; |
| 576 | boost::unordered_multiset<test::object, test::hash, test::equal_to, |
| 577 | test::cxx11_allocator<test::object, test::select_copy> >* |
| 578 | test_multiset_select_copy; |
| 579 | boost::unordered_map<test::object, test::object, test::hash, test::equal_to, |
| 580 | test::cxx11_allocator<test::object, test::select_copy> >* |
| 581 | test_map_select_copy; |
| 582 | boost::unordered_multimap<test::object, test::object, test::hash, |
| 583 | test::equal_to, test::cxx11_allocator<test::object, test::select_copy> >* |
| 584 | test_multimap_select_copy; |
| 585 | |
| 586 | boost::unordered_set<test::object, test::hash, test::equal_to, |
| 587 | test::cxx11_allocator<test::object, test::no_select_copy> >* |
| 588 | test_set_no_select_copy; |
| 589 | boost::unordered_multiset<test::object, test::hash, test::equal_to, |
| 590 | test::cxx11_allocator<test::object, test::no_select_copy> >* |
| 591 | test_multiset_no_select_copy; |
| 592 | boost::unordered_map<test::object, test::object, test::hash, test::equal_to, |
| 593 | test::cxx11_allocator<test::object, test::no_select_copy> >* |
| 594 | test_map_no_select_copy; |
| 595 | boost::unordered_multimap<test::object, test::object, test::hash, |
| 596 | test::equal_to, test::cxx11_allocator<test::object, test::no_select_copy> >* |
| 597 | test_multimap_no_select_copy; |
| 598 | |
| 599 | // clang-format off |
| 600 | UNORDERED_TEST(copy_construct_tests1, |
| 601 | ((test_set)(test_multiset)(test_map)(test_multimap) |
| 602 | (test_set_select_copy)(test_multiset_select_copy) |
| 603 | (test_map_select_copy)(test_multimap_select_copy) |
| 604 | (test_set_no_select_copy)(test_multiset_no_select_copy) |
| 605 | (test_map_no_select_copy)(test_multimap_no_select_copy))( |
| 606 | (default_generator)(generate_collisions)(limited_range))) |
| 607 | |
| 608 | UNORDERED_TEST(copy_construct_tests2, |
| 609 | ((test_set)(test_multiset)(test_map)(test_multimap) |
| 610 | (test_set_select_copy)(test_multiset_select_copy) |
| 611 | (test_map_select_copy)(test_multimap_select_copy) |
| 612 | (test_set_no_select_copy)(test_multiset_no_select_copy) |
| 613 | (test_map_no_select_copy)(test_multimap_no_select_copy))( |
| 614 | (default_generator)(generate_collisions)(limited_range))) |
| 615 | // clang-format on |
| 616 | #endif |
| 617 | } // namespace copy_tests |
| 618 | |
| 619 | RUN_TESTS() |
| 620 | |