]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/unordered/test/exception/copy_exception_tests.cpp
add subtree-ish sources for 12.0.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 #include "../helpers/random_values.hpp"
8
9 template <typename T> inline void avoid_unused_warning(T const&) {}
10
11 test::seed_t initialize_seed(73041);
12
13 template <class T>
14 struct copy_test1 : public test::exception_base
15 {
16 T x;
17
18 void run() const {
19 T y(x);
20 avoid_unused_warning(y);
21 }
22 };
23
24 template <class T>
25 struct copy_test2 : public test::exception_base
26 {
27 test::random_values<T> values;
28 T x;
29
30 copy_test2() : values(5), x(values.begin(), values.end()) {}
31
32 void run() const {
33 T y(x);
34 avoid_unused_warning(y);
35 }
36 };
37
38 template <class T>
39 struct copy_test3 : public test::exception_base
40 {
41 test::random_values<T> values;
42 T x;
43
44 copy_test3() : values(100), x(values.begin(), values.end()) {}
45
46 void run() const {
47 T y(x);
48 avoid_unused_warning(y);
49 }
50 };
51
52 template <class T>
53 struct copy_with_allocator_test : public test::exception_base
54 {
55 test::random_values<T> values;
56 T x;
57 test::exception::allocator<test::exception::object> allocator;
58
59 copy_with_allocator_test() : values(100), x(values.begin(), values.end()) {}
60
61 void run() const {
62 T y(x, allocator);
63 avoid_unused_warning(y);
64 }
65 };
66
67 EXCEPTION_TESTS(
68 (copy_test1)(copy_test2)(copy_test3)(copy_with_allocator_test),
69 CONTAINER_SEQ)
70 RUN_TESTS()