]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/unordered/test/exception/copy_exception_tests.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / unordered / test / exception / copy_exception_tests.cpp
1
2 // Copyright 2006-2009 Daniel James.
3 // Distributed under the Boost Software License, Version 1.0. (See accompanying
4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6 #include "./containers.hpp"
7
8 #include "../helpers/invariants.hpp"
9 #include "../helpers/random_values.hpp"
10 #include "../helpers/tracker.hpp"
11
12 template <typename T> inline void avoid_unused_warning(T const&) {}
13
14 test::seed_t initialize_seed(73041);
15
16 template <class T> struct copy_test1 : public test::exception_base
17 {
18 T x;
19
20 void run() const
21 {
22 T y(x);
23
24 DISABLE_EXCEPTIONS;
25 BOOST_TEST(y.empty());
26 test::check_equivalent_keys(y);
27 }
28 };
29
30 template <class T> struct copy_test2 : public test::exception_base
31 {
32 test::random_values<T> values;
33 T x;
34
35 copy_test2() : values(5, test::limited_range), x(values.begin(), values.end())
36 {
37 }
38
39 void run() const
40 {
41 T y(x);
42
43 DISABLE_EXCEPTIONS;
44 test::check_container(y, this->values);
45 test::check_equivalent_keys(y);
46 }
47 };
48
49 template <class T> struct copy_test3 : public test::exception_base
50 {
51 test::random_values<T> values;
52 T x;
53
54 copy_test3() : values(100), x(values.begin(), values.end()) {}
55
56 void run() const
57 {
58 T y(x);
59
60 DISABLE_EXCEPTIONS;
61 test::check_container(y, this->values);
62 test::check_equivalent_keys(y);
63 }
64 };
65
66 template <class T> struct copy_test3a : public test::exception_base
67 {
68 test::random_values<T> values;
69 T x;
70
71 copy_test3a()
72 : values(100, test::limited_range), x(values.begin(), values.end())
73 {
74 }
75
76 void run() const
77 {
78 T y(x);
79
80 DISABLE_EXCEPTIONS;
81 test::check_container(y, this->values);
82 test::check_equivalent_keys(y);
83 }
84 };
85
86 template <class T> struct copy_with_allocator_test : public test::exception_base
87 {
88 test::random_values<T> values;
89 T x;
90 test::exception::allocator<test::exception::object> allocator;
91
92 copy_with_allocator_test() : values(100), x(values.begin(), values.end()) {}
93
94 void run() const
95 {
96 T y(x, allocator);
97
98 DISABLE_EXCEPTIONS;
99 test::check_container(y, this->values);
100 test::check_equivalent_keys(y);
101 }
102 };
103
104 // clang-format off
105 EXCEPTION_TESTS(
106 (copy_test1)(copy_test2)(copy_test3)(copy_test3a)(copy_with_allocator_test),
107 CONTAINER_SEQ)
108 // clang-format on
109
110 RUN_TESTS()