Go to the source code of this file.
|
| TEST_CASE ("unique_ptr to array construction from pointer", "[unique_ptr][array][constructor]") |
|
| TEST_CASE ("unique_ptr to array move constructor", "[unique_ptr][array][constructor]") |
|
| TEST_CASE ("unique_ptr to array move constructor from std::unique_ptr", "[unique_ptr][array][constructor]") |
|
| TEST_CASE ("unique_ptr to array construction from pointer and non reference " "deleter", "[unique_ptr][array][constructor]") |
|
| TEST_CASE ("unique_ptr to array construction from pointer and reference deleter", "[unique_ptr][array][constructor]") |
|
| TEST_CASE ("unique_ptr to array construction from pointer and move reference " "deleter", "[unique_ptr][array][constructor]") |
|
| TEST_CASE ("unique_ptr to array construction from convertible pointer and copy " "deleter", "[unique_ptr][array][constructor]") |
|
| TEST_CASE ("unique_ptr to array construction from convertible pointer and move " "deleter", "[unique_ptr][array][constructor]") |
|
◆ TEST_CASE() [1/8]
TEST_CASE |
( |
"unique_ptr to array construction from pointer" |
, |
|
|
"" |
[unique_ptr][array][constructor] |
|
) |
| |
◆ TEST_CASE() [2/8]
TEST_CASE |
( |
"unique_ptr to array move constructor" |
, |
|
|
"" |
[unique_ptr][array][constructor] |
|
) |
| |
◆ TEST_CASE() [3/8]
TEST_CASE |
( |
"unique_ptr to array move constructor from std::unique_ptr" |
, |
|
|
"" |
[unique_ptr][array][constructor] |
|
) |
| |
◆ TEST_CASE() [4/8]
TEST_CASE |
( |
"unique_ptr to array construction from pointer and non reference " "deleter" |
, |
|
|
"" |
[unique_ptr][array][constructor] |
|
) |
| |
Definition at line 67 of file unique_ptr_to_array_construction.cpp.
70 REQUIRE(Foo::object_count() == 0);
72 REQUIRE(Deleter<1>::object_count() == 1);
74 REQUIRE(Deleter<2>::object_count() == 1);
76 std::unique_ptr<Foo[], Deleter<1>> foo1(
new Foo[10], d1);
77 REQUIRE(Foo::object_count() == 10);
80 REQUIRE(Foo::object_count() == 20);
81 REQUIRE(Deleter<2>::object_count() == Deleter<1>::object_count());
83 REQUIRE(foo2.get() !=
nullptr);
84 REQUIRE(Deleter<2>::deleter_calls() == 0);
86 REQUIRE(Foo::object_count() == 0);
87 REQUIRE(Deleter<2>::object_count() == Deleter<1>::object_count());
88 REQUIRE(Deleter<2>::deleter_calls() == 1);
unique_ptr that manages a single object
◆ TEST_CASE() [5/8]
TEST_CASE |
( |
"unique_ptr to array construction from pointer and reference deleter" |
, |
|
|
"" |
[unique_ptr][array][constructor] |
|
) |
| |
Definition at line 92 of file unique_ptr_to_array_construction.cpp.
94 REQUIRE(Foo::object_count() == 0);
96 REQUIRE(Deleter<3>::object_count() == 1);
98 REQUIRE(Deleter<4>::object_count() == 1);
100 std::unique_ptr<Foo[], Deleter<3> &> foo1(
new Foo[10], d1);
101 REQUIRE(Foo::object_count() == 10);
102 REQUIRE(Deleter<3>::object_count() == 1);
105 REQUIRE(Foo::object_count() == 20);
106 REQUIRE(Deleter<4>::object_count() == 1);
108 REQUIRE(foo2.get() !=
nullptr);
109 REQUIRE(Deleter<4>::deleter_calls() == 0);
111 REQUIRE(Deleter<3>::object_count() == 1);
112 REQUIRE(Deleter<4>::object_count() == 1);
113 REQUIRE(Deleter<4>::deleter_calls() == 1);
unique_ptr that manages a single object
◆ TEST_CASE() [6/8]
TEST_CASE |
( |
"unique_ptr to array construction from pointer and move reference " "deleter" |
, |
|
|
"" |
[unique_ptr][array][constructor] |
|
) |
| |
Definition at line 117 of file unique_ptr_to_array_construction.cpp.
120 REQUIRE(Foo::object_count() == 0);
122 REQUIRE(Deleter<5>::object_count() == 1);
124 REQUIRE(Deleter<6>::object_count() == 1);
126 std::unique_ptr<Foo[], Deleter<5>> foo1(
new Foo[10], std::move(d1));
127 REQUIRE(Foo::object_count() == 10);
131 REQUIRE(Foo::object_count() == 20);
132 REQUIRE(Deleter<5>::object_count() == Deleter<6>::object_count());
134 REQUIRE(foo2.get() !=
nullptr);
135 REQUIRE(Deleter<6>::deleter_calls() == 0);
137 REQUIRE(Deleter<6>::object_count() == Deleter<5>::object_count());
138 REQUIRE(Deleter<6>::deleter_calls() == 1);
unique_ptr that manages a single object
◆ TEST_CASE() [7/8]
TEST_CASE |
( |
"unique_ptr to array construction from convertible pointer and copy " "deleter" |
, |
|
|
"" |
[unique_ptr][array][constructor] |
|
) |
| |
Definition at line 141 of file unique_ptr_to_array_construction.cpp.
144 REQUIRE(Foo::object_count() == 0);
146 REQUIRE(Deleter<7>::object_count() == 1);
148 REQUIRE(Deleter<8>::object_count() == 1);
150 std::unique_ptr<Foo[], Deleter<7>> foo1(
new Foo[10], d1);
151 REQUIRE(Foo::object_count() == 10);
153 REQUIRE(Foo::object_count() == 20);
154 REQUIRE(Deleter<8>::object_count() == Deleter<7>::object_count());
156 REQUIRE(foo2.get() !=
nullptr);
157 REQUIRE(Deleter<8>::deleter_calls() == 0);
159 std::unique_ptr<Foo[], Deleter<7>> moved_foo1(std::move(foo1));
160 REQUIRE(Foo::object_count() == 20);
162 REQUIRE(Foo::object_count() == 20);
163 REQUIRE(Deleter<8>::object_count() == Deleter<7>::object_count());
164 REQUIRE(Deleter<8>::deleter_calls() == 0);
165 REQUIRE(moved_foo2.get() !=
nullptr);
167 REQUIRE(Deleter<8>::object_count() == Deleter<7>::object_count());
168 REQUIRE(Deleter<8>::deleter_calls() == 1);
170 REQUIRE(Deleter<8>::object_count() == Deleter<7>::object_count());
171 REQUIRE(Deleter<8>::deleter_calls() == 1);
unique_ptr that manages a single object
◆ TEST_CASE() [8/8]
TEST_CASE |
( |
"unique_ptr to array construction from convertible pointer and move " "deleter" |
, |
|
|
"" |
[unique_ptr][array][constructor] |
|
) |
| |
Definition at line 175 of file unique_ptr_to_array_construction.cpp.
178 REQUIRE(Foo::object_count() == 0);
180 REQUIRE(Deleter<9>::object_count() == 1);
182 REQUIRE(Deleter<10>::object_count() == 1);
184 std::unique_ptr<Foo[], Deleter<9> &> foo1(
new Foo[10], d1);
185 REQUIRE(Foo::object_count() == 10);
188 REQUIRE(Foo::object_count() == 20);
189 REQUIRE(Deleter<10>::object_count() == Deleter<9>::object_count());
191 REQUIRE(foo2.get() !=
nullptr);
192 REQUIRE(Deleter<10>::deleter_calls() == 0);
194 std::unique_ptr<Foo[], Deleter<9>> moved_foo1(std::move(foo1));
195 REQUIRE(Foo::object_count() == 20);
198 REQUIRE(Foo::object_count() == 20);
199 REQUIRE(Deleter<10>::object_count() == Deleter<9>::object_count());
200 REQUIRE(Deleter<10>::deleter_calls() == 0);
201 REQUIRE(moved_foo2.get() !=
nullptr);
203 REQUIRE(Deleter<10>::object_count() == Deleter<9>::object_count());
204 REQUIRE(Deleter<10>::deleter_calls() == 1);
206 REQUIRE(Deleter<10>::object_count() == Deleter<9>::object_count());
207 REQUIRE(Deleter<10>::deleter_calls() == 1);
unique_ptr that manages a single object