7 #include <throwing/shared_ptr.hpp> 14 int dummy() {
return dummy_a; }
21 int dummy() {
return dummy_b; }
26 TEST_CASE(
"assignment from throwing::shared_ptr",
"[shared_ptr][assignment]") {
28 throwing::shared_ptr<A> t_ptr1(ptr1);
29 throwing::shared_ptr<A> t_ptr2;
31 REQUIRE(t_ptr2.get() == t_ptr1.get());
33 REQUIRE(t_ptr1.get() ==
nullptr);
34 REQUIRE(t_ptr2.get() == ptr1);
37 TEST_CASE(
"assignment from std::shared_ptr",
"[shared_ptr][assignment]") {
39 std::shared_ptr<A> t_ptr1(ptr1);
40 throwing::shared_ptr<A> t_ptr2;
42 REQUIRE(t_ptr2.get() == t_ptr1.get());
44 REQUIRE(t_ptr1.get() ==
nullptr);
45 REQUIRE(t_ptr2.get() == ptr1);
48 TEST_CASE(
"assignment from throwing::shared_ptr to derived class",
49 "[shared_ptr][assignment]") {
50 throwing::shared_ptr<B> t_ptr1(
new B);
51 throwing::shared_ptr<A> t_ptr2;
53 REQUIRE(t_ptr2.get() == t_ptr1.get());
56 TEST_CASE(
"assignment from std::shared_ptr to derived class",
57 "[shared_ptr][assignment]") {
58 std::shared_ptr<B> t_ptr1(
new B);
59 throwing::shared_ptr<A> t_ptr2;
61 REQUIRE(t_ptr2.get() == t_ptr1.get());
64 TEST_CASE(
"move assignment from throwing::shared_ptr to derived class",
65 "[shared_ptr][assignment]") {
67 throwing::shared_ptr<B> t_ptr1(ptr);
68 throwing::shared_ptr<A> t_ptr2;
69 t_ptr2 = std::move(t_ptr1);
70 REQUIRE(t_ptr1.get() ==
nullptr);
71 REQUIRE(t_ptr2.get() == ptr);
74 TEST_CASE(
"move assignment from std::shared_ptr to derived class",
75 "[shared_ptr][assignment]") {
77 std::shared_ptr<B> t_ptr1(ptr);
78 throwing::shared_ptr<A> t_ptr2;
79 t_ptr2 = std::move(t_ptr1);
80 REQUIRE(t_ptr1.get() ==
nullptr);
81 REQUIRE(t_ptr2.get() == ptr);
TEST_CASE("unique_ptr to array reset to convertible", "[unique_ptr][array][reset][conv.qual]")