]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/smart_ptr/test/make_unique_args_test.cpp
2 (c) 2014 Glen Joseph Fernandes
3 <glenjofe -at- gmail.com>
5 Distributed under the Boost Software
7 http://boost.org/LICENSE_1_0.txt
9 #include <boost/config.hpp>
10 #if !defined(BOOST_NO_CXX11_SMART_PTR)
11 #include <boost/detail/lightweight_test.hpp>
12 #include <boost/smart_ptr/make_unique.hpp>
16 static unsigned int instances
;
18 explicit type(int v1
= 0,
27 : sum(v1
+ v2
+ v3
+ v4
+ v5
+ v6
+ v7
+ v8
+ v9
) {
39 type
& operator=(const type
&);
42 unsigned int type::instances
= 0;
46 BOOST_TEST(type::instances
== 0);
48 std::unique_ptr
<type
> a1
= boost::make_unique
<type
>();
49 BOOST_TEST(a1
.get() != 0);
50 BOOST_TEST(type::instances
== 1);
51 BOOST_TEST(a1
->sum
== 0);
53 BOOST_TEST(type::instances
== 0);
56 #if !defined( BOOST_NO_CXX11_VARIADIC_TEMPLATES )
58 std::unique_ptr
<type
> a1
= boost::make_unique
<type
>(1);
59 BOOST_TEST(a1
.get() != 0);
60 BOOST_TEST(type::instances
== 1);
61 BOOST_TEST(a1
->sum
== 1);
63 BOOST_TEST(type::instances
== 0);
67 std::unique_ptr
<type
> a1
= boost::make_unique
<type
>(1, 2);
68 BOOST_TEST(a1
.get() != 0);
69 BOOST_TEST(type::instances
== 1);
70 BOOST_TEST(a1
->sum
== 1 + 2);
72 BOOST_TEST(type::instances
== 0);
76 std::unique_ptr
<type
> a1
= boost::make_unique
<type
>(1, 2, 3);
77 BOOST_TEST(a1
.get() != 0);
78 BOOST_TEST(type::instances
== 1);
79 BOOST_TEST(a1
->sum
== 1 + 2 + 3);
81 BOOST_TEST(type::instances
== 0);
85 std::unique_ptr
<type
> a1
= boost::make_unique
<type
>(1, 2, 3, 4);
86 BOOST_TEST(a1
.get() != 0);
87 BOOST_TEST(type::instances
== 1);
88 BOOST_TEST(a1
->sum
== 1 + 2 + 3 + 4);
90 BOOST_TEST(type::instances
== 0);
94 std::unique_ptr
<type
> a1
= boost::make_unique
<type
>(1, 2, 3, 4, 5);
95 BOOST_TEST(a1
.get() != 0);
96 BOOST_TEST(type::instances
== 1);
97 BOOST_TEST(a1
->sum
== 1 + 2 + 3 + 4 + 5);
99 BOOST_TEST(type::instances
== 0);
103 std::unique_ptr
<type
> a1
= boost::make_unique
<type
>(1, 2, 3, 4, 5, 6);
104 BOOST_TEST(a1
.get() != 0);
105 BOOST_TEST(type::instances
== 1);
106 BOOST_TEST(a1
->sum
== 1 + 2 + 3 + 4 + 5 + 6);
108 BOOST_TEST(type::instances
== 0);
112 std::unique_ptr
<type
> a1
= boost::make_unique
<type
>(1, 2, 3, 4, 5, 6, 7);
113 BOOST_TEST(a1
.get() != 0);
114 BOOST_TEST(type::instances
== 1);
115 BOOST_TEST(a1
->sum
== 1 + 2 + 3 + 4 + 5 + 6 + 7);
117 BOOST_TEST(type::instances
== 0);
121 std::unique_ptr
<type
> a1
= boost::make_unique
<type
>(1, 2, 3, 4, 5, 6, 7, 8);
122 BOOST_TEST(a1
.get() != 0);
123 BOOST_TEST(type::instances
== 1);
124 BOOST_TEST(a1
->sum
== 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8);
126 BOOST_TEST(type::instances
== 0);
130 std::unique_ptr
<type
> a1
= boost::make_unique
<type
>(1, 2, 3, 4, 5, 6, 7, 8, 9);
131 BOOST_TEST(a1
.get() != 0);
132 BOOST_TEST(type::instances
== 1);
133 BOOST_TEST(a1
->sum
== 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9);
135 BOOST_TEST(type::instances
== 0);
139 return boost::report_errors();