Re: ole32/tests: Add a few CoGetMalloc tests.
2009/3/3 Huw Davies <huw(a)codeweavers.com>:
diff --git a/dlls/ole32/tests/compobj.c b/dlls/ole32/tests/compobj.c index a332d27..9720e52 100644 --- a/dlls/ole32/tests/compobj.c +++ b/dlls/ole32/tests/compobj.c @@ -1162,6 +1162,28 @@ static void test_CoInitializeEx(void) OleUninitialize(); }
+static void test_CoGetMalloc(void) +{ + IMalloc *malloc; + HRESULT hr; + void *ptr; + DWORD i, size; + + OleInitialize(NULL); + hr = CoGetMalloc(1, &malloc); + ok(hr == S_OK, "got %x\n", hr); + for(i = 0; i < 10; i++) + { + ptr = IMalloc_Alloc(malloc, i); + ok(ptr != NULL, "got NULL for size %d\n", i); + size = IMalloc_GetSize(malloc, ptr); + ok(size == i, "got %d expected %d\n", size, i);
Has this been tested on Win9x? Since HeapSize on those versions of Windows doesn't return the same size as allocated, IMalloc_GetSize might not either.
+ IMalloc_Free(malloc, ptr); + } + IMalloc_Release(malloc); + OleUninitialize(); +}
-- Rob Shearman
Rob Shearman wrote:
2009/3/3 Huw Davies <huw(a)codeweavers.com>:
diff --git a/dlls/ole32/tests/compobj.c b/dlls/ole32/tests/compobj.c index a332d27..9720e52 100644 --- a/dlls/ole32/tests/compobj.c +++ b/dlls/ole32/tests/compobj.c @@ -1162,6 +1162,28 @@ static void test_CoInitializeEx(void) OleUninitialize(); }
+static void test_CoGetMalloc(void) +{ + IMalloc *malloc; + HRESULT hr; + void *ptr; + DWORD i, size; + + OleInitialize(NULL); + hr = CoGetMalloc(1, &malloc); + ok(hr == S_OK, "got %x\n", hr); + for(i = 0; i < 10; i++) + { + ptr = IMalloc_Alloc(malloc, i); + ok(ptr != NULL, "got NULL for size %d\n", i); + size = IMalloc_GetSize(malloc, ptr); + ok(size == i, "got %d expected %d\n", size, i);
Has this been tested on Win9x? Since HeapSize on those versions of Windows doesn't return the same size as allocated, IMalloc_GetSize might not either.
+ IMalloc_Free(malloc, ptr); + } + IMalloc_Release(malloc); + OleUninitialize(); +}
Hi, Tested it on my Win95 and Win98 box and all new tests (on both boxes) show: compobj.c:1180: Test failed: got 12 expected * -- Cheers, Paul.
Paul Vriens wrote:
Rob Shearman wrote:
2009/3/3 Huw Davies <huw(a)codeweavers.com>:
diff --git a/dlls/ole32/tests/compobj.c b/dlls/ole32/tests/compobj.c index a332d27..9720e52 100644 --- a/dlls/ole32/tests/compobj.c +++ b/dlls/ole32/tests/compobj.c @@ -1162,6 +1162,28 @@ static void test_CoInitializeEx(void) OleUninitialize(); }
+static void test_CoGetMalloc(void) +{ + IMalloc *malloc; + HRESULT hr; + void *ptr; + DWORD i, size; + + OleInitialize(NULL); + hr = CoGetMalloc(1, &malloc); + ok(hr == S_OK, "got %x\n", hr); + for(i = 0; i < 10; i++) + { + ptr = IMalloc_Alloc(malloc, i); + ok(ptr != NULL, "got NULL for size %d\n", i); + size = IMalloc_GetSize(malloc, ptr); + ok(size == i, "got %d expected %d\n", size, i);
Has this been tested on Win9x? Since HeapSize on those versions of Windows doesn't return the same size as allocated, IMalloc_GetSize might not either.
+ IMalloc_Free(malloc, ptr); + } + IMalloc_Release(malloc); + OleUninitialize(); +}
Hi,
Tested it on my Win95 and Win98 box and all new tests (on both boxes) show:
compobj.c:1180: Test failed: got 12 expected *
Hi, FWIW, here the results when looping from 0 to 50: compobj.c:1180: Test failed: got 12 expected 1 compobj.c:1180: Test failed: got 12 expected 2 compobj.c:1180: Test failed: got 12 expected 3 compobj.c:1180: Test failed: got 12 expected 4 compobj.c:1180: Test failed: got 12 expected 5 compobj.c:1180: Test failed: got 12 expected 6 compobj.c:1180: Test failed: got 12 expected 7 compobj.c:1180: Test failed: got 12 expected 8 compobj.c:1180: Test failed: got 12 expected 9 compobj.c:1180: Test failed: got 12 expected 10 compobj.c:1180: Test failed: got 12 expected 11 compobj.c:1180: Test failed: got 16 expected 13 compobj.c:1180: Test failed: got 16 expected 14 compobj.c:1180: Test failed: got 16 expected 15 compobj.c:1180: Test failed: got 20 expected 17 compobj.c:1180: Test failed: got 20 expected 18 compobj.c:1180: Test failed: got 20 expected 19 compobj.c:1180: Test failed: got 24 expected 21 compobj.c:1180: Test failed: got 24 expected 22 compobj.c:1180: Test failed: got 24 expected 23 compobj.c:1180: Test failed: got 28 expected 25 compobj.c:1180: Test failed: got 28 expected 26 compobj.c:1180: Test failed: got 28 expected 27 compobj.c:1180: Test failed: got 32 expected 29 compobj.c:1180: Test failed: got 32 expected 30 compobj.c:1180: Test failed: got 32 expected 31 compobj.c:1180: Test failed: got 36 expected 33 compobj.c:1180: Test failed: got 36 expected 34 compobj.c:1180: Test failed: got 36 expected 35 compobj.c:1180: Test failed: got 40 expected 37 compobj.c:1180: Test failed: got 40 expected 38 compobj.c:1180: Test failed: got 40 expected 39 compobj.c:1180: Test failed: got 44 expected 41 compobj.c:1180: Test failed: got 44 expected 42 compobj.c:1180: Test failed: got 44 expected 43 compobj.c:1180: Test failed: got 48 expected 45 compobj.c:1180: Test failed: got 48 expected 46 compobj.c:1180: Test failed: got 48 expected 47 compobj.c:1180: Test failed: got 64 expected 49 -- Cheers, Paul.
participants (2)
-
Paul Vriens -
Rob Shearman