Changeset 10359
- Timestamp:
- Apr 12, 2015, 3:28:15 PM (10 years ago)
- Location:
- code/branches/core7/test/core/object
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core7/test/core/object/SmartPtrTest.cc
r9603 r10359 91 91 EXPECT_TRUE(destroyed); 92 92 } 93 94 void isNull(const SmartPtr<DestroyableTest> smartPtr) 95 { 96 EXPECT_TRUE(smartPtr == NULL); 97 EXPECT_TRUE(smartPtr == 0); 98 EXPECT_TRUE(!smartPtr); 99 EXPECT_FALSE(smartPtr != NULL); 100 EXPECT_FALSE(smartPtr != 0); 101 EXPECT_FALSE(smartPtr); 102 } 103 104 TEST(SmartPtrTest, IsNull) 105 { 106 { 107 SmartPtr<DestroyableTest> smartPtr; 108 isNull(smartPtr); 109 } 110 { 111 SmartPtr<DestroyableTest> smartPtr = NULL; 112 isNull(smartPtr); 113 } 114 { 115 SmartPtr<DestroyableTest> smartPtr; 116 smartPtr = NULL; 117 isNull(smartPtr); 118 } 119 { 120 SmartPtr<DestroyableTest> smartPtr = 0; 121 isNull(smartPtr); 122 } 123 { 124 SmartPtr<DestroyableTest> smartPtr; 125 smartPtr = 0; 126 isNull(smartPtr); 127 } 128 } 129 130 TEST(SmartPtrTest, IsNotNull) 131 { 132 bool destroyed = false; 133 DestroyableTest* test = new DestroyableTest(destroyed); 134 SmartPtr<DestroyableTest> smartPtr = test; 135 EXPECT_FALSE(smartPtr == NULL); 136 EXPECT_FALSE(smartPtr == 0); 137 EXPECT_FALSE(!smartPtr); 138 EXPECT_TRUE(smartPtr != NULL); 139 EXPECT_TRUE(smartPtr != 0); 140 EXPECT_TRUE(smartPtr); 141 test->destroy(); 142 } 93 143 } -
code/branches/core7/test/core/object/WeakPtrTest.cc
r9603 r10359 45 45 test->destroy(); 46 46 } 47 48 void isNull(const WeakPtr<DestroyableTest> weakPtr) 49 { 50 EXPECT_TRUE(weakPtr == NULL); 51 EXPECT_TRUE(weakPtr == 0); 52 EXPECT_TRUE(!weakPtr); 53 EXPECT_FALSE(weakPtr != NULL); 54 EXPECT_FALSE(weakPtr != 0); 55 EXPECT_FALSE(weakPtr); 56 } 57 58 TEST(WeakPtrTest, IsNull) 59 { 60 { 61 WeakPtr<DestroyableTest> weakPtr; 62 isNull(weakPtr); 63 } 64 { 65 WeakPtr<DestroyableTest> weakPtr = NULL; 66 isNull(weakPtr); 67 } 68 { 69 WeakPtr<DestroyableTest> weakPtr; 70 weakPtr = NULL; 71 isNull(weakPtr); 72 } 73 { 74 WeakPtr<DestroyableTest> weakPtr = 0; 75 isNull(weakPtr); 76 } 77 { 78 WeakPtr<DestroyableTest> weakPtr; 79 weakPtr = 0; 80 isNull(weakPtr); 81 } 82 } 83 84 TEST(WeakPtrTest, IsNotNull) 85 { 86 DestroyableTest* test = new DestroyableTest(); 87 WeakPtr<DestroyableTest> weakPtr = test; 88 EXPECT_FALSE(weakPtr == NULL); 89 EXPECT_FALSE(weakPtr == 0); 90 EXPECT_FALSE(!weakPtr); 91 EXPECT_TRUE(weakPtr != NULL); 92 EXPECT_TRUE(weakPtr != 0); 93 EXPECT_TRUE(weakPtr); 94 test->destroy(); 95 } 47 96 }
Note: See TracChangeset
for help on using the changeset viewer.