#include "atltest.h"
#include <atlbase.h>
Go to the source code of this file.
◆ START_TEST()
START_TEST |
( |
CComHeapPtr |
| ) |
|
Definition at line 74 of file CComHeapPtr.cpp.
77 ok(
SUCCEEDED(
hr),
"Expected CoRegisterMallocSpy to succeed, but it failed: 0x%lx\n",
hr);
81 CComHeapPtr<DWORD> heapPtr1;
83 CComHeapPtr<DWORD> heapPtr2(
test_Alloc(0x11111111));
86 ok((
PDWORD)heapPtr1 ==
NULL,
"Expected heapPtr1 to be NULL, was: 0x%p\n", (
PDWORD)heapPtr1);
87 ok((
PDWORD)heapPtr2 !=
NULL,
"Expected heapPtr2 to not be NULL\n");
88 ok(*heapPtr2 == 0x11111111,
"Expected *heapPtr2 to be 0x11111111, but was: 0x%lx\n", *heapPtr2);
92 CComHeapPtr<DWORD> heapPtrSteal1(heapPtr1);
94 ok((
PDWORD)heapPtr1 ==
NULL,
"Expected heapPtr1 to be NULL, was: 0x%p\n", (
PDWORD)heapPtr1);
95 ok((
PDWORD)heapPtrSteal1 ==
NULL,
"Expected heapPtrSteal1 to be NULL, was: 0x%p\n", (
PDWORD)heapPtrSteal1);
96 CComHeapPtr<DWORD> heapPtrSteal2(heapPtr2);
98 ok((
PDWORD)heapPtr2 ==
NULL,
"Expected heapPtr2 to be NULL, was: 0x%p\n", (
PDWORD)heapPtr2);
99 ok((
PDWORD)heapPtrSteal2 !=
NULL,
"Expected heapPtrSteal2 to not be NULL\n");
100 ok(*heapPtrSteal2 == 0x11111111,
"Expected *heapPtrSteal2 to be 0x11111111, but was: 0x%lx\n", *heapPtrSteal2);
104 ok(heapPtr1.Allocate(1),
"Expected Allocate to succeed\n");
108 *heapPtr1 = 0x22222222;
109 ok(*heapPtr1 == 0x22222222,
"Expected *heapPtr1 to be 0x22222222, but was: 0x%lx\n", *heapPtr1);
111 ok(heapPtr1.Reallocate(2),
"Expected Reallocate to succeed\n");
112 heapPtr1[1] = 0x33333333;
113 ok(*heapPtr1 == 0x22222222,
"Expected *heapPtr1 to be 0x22222222, but was: 0x%lx\n", *heapPtr1);
119 ok(*heapPtr2 == 0x22222222,
"Expected *heapPtr2 to be 0x33333333, but was: 0x%lx\n", *heapPtr2);
120 ok(heapPtr2[1] == 0x33333333,
"Expected heapPtr2[1] to be 0x33333333, but was: 0x%lx\n", heapPtr2[1]);
121 ok((
PDWORD)heapPtr1 ==
NULL,
"Expected heapPtr1 to be NULL, was: 0x%p\n", (
PDWORD)heapPtr1);
126 ok(
SUCCEEDED(
hr),
"Expected CoRevokeMallocSpy to succeed, but it failed: 0x%lx\n",
hr);
static LONG g_OpenAllocations
HRESULT WINAPI CoRevokeMallocSpy(void)
static LONG g_Reallocations
static PDWORD test_Alloc(DWORD value)
HRESULT WINAPI CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy)
◆ test_Alloc()
Definition at line 16 of file CComHeapPtr.cpp.
GLsizei const GLfloat * value
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Referenced by START_TEST().
◆ g_OpenAllocations
LONG g_OpenAllocations = 0 |
|
static |
◆ g_Reallocations
◆ g_Spy