32 #include <gtest/gtest.h>
48 return liveList.size();
54 LiveList::iterator liveIt;
59 liveList.push_front(
this);
60 liveIt = liveList.begin();
65 liveList.erase(liveIt);
74 TEST(RefcntTest, NullPointerCheck)
82 TEST(RefcntTest, ConstructionFromPointer)
85 Ptr constFromPointer =
new TestRC();
89 TEST(RefcntTest, ConstructionFromExistingPointer)
92 Ptr constFromPointer1 =
new TestRC();
93 Ptr constFromPointer2 = constFromPointer1;
98 TEST(RefcntTest, DestroyPointer)
101 Ptr *ptrPtr =
new Ptr(
new TestRC());
107 TEST(RefcntTest, AssignmentFromAPointerFromAPointer)
110 Ptr assignmentTarget;
111 TestRC *assignmentSourcePointer =
new TestRC();
113 assignmentTarget = assignmentSourcePointer;
115 assignmentTarget = NULL;
117 Ptr assignmentSourcePtr(
new TestRC());
119 assignmentTarget = assignmentSourcePtr;
121 assignmentSourcePtr = NULL;
123 assignmentTarget = NULL;
127 TEST(RefcntTest, AccessToClassPointers)
130 TestRC *accessTest =
new TestRC();
131 Ptr accessTestPtr = accessTest;
132 accessTest->testVal = 1;
135 accessTest->testVal = 2;
138 accessTestPtr->testVal = 3;
140 (*accessTestPtr).testVal = 4;
142 accessTestPtr = NULL;
147 TEST(RefcntTest, BoolAndLogicalNotOperatorOverloads)
150 Ptr boolTest =
new TestRC();
159 TEST(RefcntTest, EqualityOperators)
162 TestRC *equalTestA =
new TestRC();
163 Ptr equalTestAPtr = equalTestA;
164 Ptr equalTestAPtr2 = equalTestA;
165 TestRC *equalTestB =
new TestRC();
166 Ptr equalTestBPtr = equalTestB;