108TEST(RefcntTest, AssignmentFromAPointerFromAPointer)
111 Ptr assignmentTarget;
112 TestRC *assignmentSourcePointer =
new TestRC();
113 EXPECT_EQ(liveListSize(), 1);
114 assignmentTarget = assignmentSourcePointer;
115 EXPECT_EQ(liveListSize(), 1);
116 assignmentTarget = NULL;
117 EXPECT_EQ(liveListSize(), 0);
118 Ptr assignmentSourcePtr(
new TestRC());
119 EXPECT_EQ(liveListSize(), 1);
120 assignmentTarget = assignmentSourcePtr;
121 EXPECT_EQ(liveListSize(), 1);
122 assignmentSourcePtr = NULL;
123 EXPECT_EQ(liveListSize(), 1);
124 assignmentTarget = NULL;
125 EXPECT_EQ(liveListSize(), 0);
128TEST(RefcntTest, AccessToClassPointers)
131 TestRC *accessTest =
new TestRC();
132 Ptr accessTestPtr = accessTest;
133 accessTest->testVal = 1;
134 EXPECT_EQ(1, accessTestPtr->testVal);
135 EXPECT_EQ(1, (*accessTestPtr).testVal);
136 accessTest->testVal = 2;
137 EXPECT_EQ(2, accessTestPtr->testVal);
138 EXPECT_EQ(2, (*accessTestPtr).testVal);
139 accessTestPtr->testVal = 3;
140 EXPECT_EQ(3, accessTest->testVal);
141 (*accessTestPtr).testVal = 4;
142 EXPECT_EQ(4, accessTest->testVal);
143 accessTestPtr = NULL;
145 EXPECT_EQ(0, liveListSize());
160TEST(RefcntTest, EqualityOperators)
163 TestRC *equalTestA =
new TestRC();
164 Ptr equalTestAPtr = equalTestA;
165 Ptr equalTestAPtr2 = equalTestA;
166 TestRC *equalTestB =
new TestRC();
167 Ptr equalTestBPtr = equalTestB;
168 EXPECT_TRUE(equalTestA == equalTestAPtr);
169 EXPECT_TRUE(equalTestAPtr == equalTestA);
170 EXPECT_TRUE(equalTestAPtr == equalTestAPtr2);
171 EXPECT_TRUE(equalTestA != equalTestBPtr);
172 EXPECT_TRUE(equalTestAPtr != equalTestB);
173 EXPECT_TRUE(equalTestAPtr != equalTestBPtr);