42 EXPECT_TRUE(ptr1 == ptr2);
43 EXPECT_FALSE(ptr1 != ptr2);
45 WeakTestPtr ptr3(ptr1);
46 EXPECT_TRUE(ptr1 == ptr3);
47 EXPECT_FALSE(ptr1 != ptr3);
49 WeakTestPtr ptr4 = ptr1;
50 EXPECT_TRUE(ptr1 == ptr4);
51 EXPECT_FALSE(ptr1 != ptr4);
55 PseudoDeletable thing;
56 EXPECT_EQ(0, thing.delete_count());
58 UniqueTestPtr unique(&thing);
59 WeakTestPtr ptr1(std::move(unique));
61 EXPECT_EQ(&thing, ptr1.Get());
64 EXPECT_FALSE(ptr1 == ptr2);
65 EXPECT_TRUE(ptr1 != ptr2);
67 WeakTestPtr ptr3(ptr1);
68 EXPECT_TRUE(ptr1 == ptr3);
69 EXPECT_FALSE(ptr1 != ptr3);
70 EXPECT_EQ(&thing, ptr3.Get());
72 WeakTestPtr ptr4 = ptr1;
73 EXPECT_TRUE(ptr1 == ptr4);
74 EXPECT_FALSE(ptr1 != ptr4);
75 EXPECT_EQ(&thing, ptr4.Get());
78 EXPECT_EQ(0, thing.delete_count());
80 EXPECT_EQ(1, thing.delete_count());
84 PseudoDeletable thing;
86 UniqueTestPtr unique(&thing);
87 WeakTestPtr ptr1(std::move(unique));
88 WeakTestPtr ptr2 = ptr1;
91 EXPECT_FALSE(ptr1.Get());
93 EXPECT_EQ(&thing, ptr2.Get());
94 EXPECT_FALSE(ptr1 == ptr2);
95 EXPECT_TRUE(ptr1 != ptr2);
96 EXPECT_EQ(0, thing.delete_count());
98 EXPECT_EQ(1, thing.delete_count());
102 PseudoDeletable thing1;
103 PseudoDeletable thing2;
105 UniqueTestPtr unique1(&thing1);
106 WeakTestPtr ptr1(std::move(unique1));
107 WeakTestPtr ptr2 = ptr1;
108 UniqueTestPtr unique2(&thing2);
109 ptr2.Reset(
std::move(unique2));
111 EXPECT_EQ(&thing1, ptr1.Get());
113 EXPECT_EQ(&thing2, ptr2.Get());
114 EXPECT_FALSE(ptr1 == ptr2);
115 EXPECT_TRUE(ptr1 != ptr2);
116 EXPECT_EQ(0, thing1.delete_count());
117 EXPECT_EQ(0, thing2.delete_count());
119 EXPECT_EQ(1, thing1.delete_count());
120 EXPECT_EQ(1, thing2.delete_count());
124 PseudoDeletable thing;
126 UniqueTestPtr unique(&thing);
127 WeakTestPtr ptr1(std::move(unique));
128 WeakTestPtr ptr2 = ptr1;
131 EXPECT_FALSE(ptr1.Get());
133 EXPECT_FALSE(ptr2.Get());
134 EXPECT_FALSE(ptr1 == ptr2);
135 EXPECT_TRUE(ptr1 != ptr2);
136 EXPECT_EQ(1, thing.delete_count());
138 EXPECT_EQ(1, thing.delete_count());
142 PseudoDeletable thing1;
143 PseudoDeletable thing2;
145 UniqueTestPtr unique1(&thing1);
146 UniqueTestPtr unique2(&thing2);
147 WeakTestPtr ptr1(std::move(unique1));
148 WeakTestPtr ptr2(std::move(unique2));
153 EXPECT_EQ(0, thing1.delete_count());
154 EXPECT_EQ(0, thing2.delete_count());
158 PseudoDeletable thing1;
159 PseudoDeletable thing2;
161 UniqueTestPtr unique1(&thing1);
162 UniqueTestPtr unique2(&thing2);
163 WeakTestPtr ptr1(std::move(unique1));
164 WeakTestPtr ptr2(std::move(unique2));
168 EXPECT_EQ(1, thing1.delete_count());
169 EXPECT_EQ(0, thing2.delete_count());
171 EXPECT_EQ(1, thing1.delete_count());
172 EXPECT_EQ(1, thing2.delete_count());