Changeset 36529 in vbox for trunk/src/VBox/Runtime/testcase/tstMemAutoPtr.cpp
- Timestamp:
- Apr 4, 2011 1:54:13 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/testcase/tstMemAutoPtr.cpp
r31157 r36529 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT - Testcase the RT MemAutoPtr template.3 * IPRT - Testcase the RTCMemAutoPtr template. 4 4 */ 5 5 … … 28 28 * Header Files * 29 29 *******************************************************************************/ 30 #include <iprt/ mem.h>30 #include <iprt/cpp/mem.h> 31 31 #include <iprt/stream.h> 32 32 #include <iprt/initterm.h> … … 61 61 extern "C" int tstMemAutoPtrDisas1(void **ppv) 62 62 { 63 RT MemAutoPtr<TSTMEMAUTOPTRSTRUCT> Handle(1);63 RTCMemAutoPtr<TSTMEMAUTOPTRSTRUCT> Handle(1); 64 64 if (!Handle) 65 65 { … … 135 135 */ 136 136 { 137 RT MemAutoPtr<char> NilObj;137 RTCMemAutoPtr<char> NilObj; 138 138 CHECK_EXPR(!NilObj); 139 139 CHECK_EXPR(NilObj.get() == NULL); … … 143 143 144 144 { 145 RT MemAutoPtr<char> Alloc(10);145 RTCMemAutoPtr<char> Alloc(10); 146 146 CHECK_EXPR(Alloc.get() != NULL); 147 147 char *pch = Alloc.release(); … … 149 149 CHECK_EXPR(Alloc.get() == NULL); 150 150 151 RT MemAutoPtr<char> Manage(pch);151 RTCMemAutoPtr<char> Manage(pch); 152 152 CHECK_EXPR(Manage.get() == pch); 153 153 CHECK_EXPR(&Manage[0] == pch); … … 161 161 */ 162 162 { 163 RT MemAutoPtr<char, RTMemEfAutoFree<char>, RTMemEfReallocNP> Electric(10);163 RTCMemAutoPtr<char, RTCMemEfAutoFree<char>, RTMemEfReallocNP> Electric(10); 164 164 CHECK_EXPR(Electric.get() != NULL); 165 165 Electric[0] = '0'; … … 178 178 g_cFrees = 0; 179 179 { 180 RT MemAutoPtr<char, tstMemAutoPtrDestructorCounter, RTMemEfReallocNP> FreeIt(128);180 RTCMemAutoPtr<char, tstMemAutoPtrDestructorCounter, RTMemEfReallocNP> FreeIt(128); 181 181 FreeIt[127] = '0'; 182 182 } … … 185 185 g_cFrees = 0; 186 186 { 187 RT MemAutoPtr<char, tstMemAutoPtrDestructorCounter, RTMemEfReallocNP> FreeIt2(128);187 RTCMemAutoPtr<char, tstMemAutoPtrDestructorCounter, RTMemEfReallocNP> FreeIt2(128); 188 188 FreeIt2[127] = '1'; 189 189 FreeIt2.reset(); … … 196 196 g_cFrees = 0; 197 197 { 198 RT MemAutoPtr<char, tstMemAutoPtrDestructorCounter, RTMemEfReallocNP> DontFreeIt(256);198 RTCMemAutoPtr<char, tstMemAutoPtrDestructorCounter, RTMemEfReallocNP> DontFreeIt(256); 199 199 DontFreeIt[255] = '0'; 200 200 RTMemEfFreeNP(DontFreeIt.release()); … … 204 204 g_cFrees = 0; 205 205 { 206 RT MemAutoPtr<char, tstMemAutoPtrDestructorCounter, RTMemEfReallocNP> FreeIt3(128);206 RTCMemAutoPtr<char, tstMemAutoPtrDestructorCounter, RTMemEfReallocNP> FreeIt3(128); 207 207 FreeIt3[127] = '0'; 208 208 CHECK_EXPR(FreeIt3.realloc(128)); … … 219 219 g_cFrees = 0; 220 220 { 221 RT MemAutoPtr<char, tstMemAutoPtrDestructorCounter, RTMemEfReallocNP> FreeIt4;221 RTCMemAutoPtr<char, tstMemAutoPtrDestructorCounter, RTMemEfReallocNP> FreeIt4; 222 222 CHECK_EXPR(FreeIt4.alloc(123)); 223 223 CHECK_EXPR(FreeIt4.realloc(543)); … … 231 231 */ 232 232 { 233 RT MemAutoPtr<TSTMEMAUTOPTRSTRUCT> Struct1(1);233 RTCMemAutoPtr<TSTMEMAUTOPTRSTRUCT> Struct1(1); 234 234 Struct1->a = 0x11223344; 235 235 Struct1->b = 0x55667788; … … 266 266 */ 267 267 { 268 RT MemAutoPtr<uint64_t, RTMemAutoDestructor<uint64_t>, tstMemAutoPtrAllocatorNoZero> Zeroed1(1, true);268 RTCMemAutoPtr<uint64_t, RTCMemAutoDestructor<uint64_t>, tstMemAutoPtrAllocatorNoZero> Zeroed1(1, true); 269 269 CHECK_EXPR(*Zeroed1 == 0); 270 270 } 271 271 272 272 { 273 RT MemAutoPtr<uint64_t, RTMemAutoDestructor<uint64_t>, tstMemAutoPtrAllocatorNoZero> Zeroed2;273 RTCMemAutoPtr<uint64_t, RTCMemAutoDestructor<uint64_t>, tstMemAutoPtrAllocatorNoZero> Zeroed2; 274 274 Zeroed2.alloc(5, true); 275 275 CHECK_EXPR(Zeroed2[0] == 0);
Note:
See TracChangeset
for help on using the changeset viewer.