Commit 16d1b3b0 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

oleaut32: Added some SysFreeString tests.

parent ed9d78d2
......@@ -6072,6 +6072,47 @@ static void test_ChangeType_keep_dst(void)
SysFreeString(bstr);
}
/* This tests assumes an empty cache, so it needs to be ran early in the test. */
static void test_bstr_cache(void)
{
BSTR str, str2, strs[20];
unsigned i;
static const WCHAR testW[] = {'t','e','s','t',0};
str = SysAllocString(testW);
/* This should put the string into cache */
SysFreeString(str);
/* The string is in cache, this won't touch it */
SysFreeString(str);
ok(SysStringLen(str) == 4, "unexpected len\n");
ok(!lstrcmpW(str, testW), "string changed\n");
str2 = SysAllocString(testW);
ok(str == str2, "str != str2\n");
SysFreeString(str2);
/* Fill the bucket with cached entries. */
for(i=0; i < sizeof(strs)/sizeof(*strs); i++)
strs[i] = SysAllocStringLen(NULL, 24);
for(i=0; i < sizeof(strs)/sizeof(*strs); i++)
SysFreeString(strs[i]);
/* Following allocation will be made from cache */
str = SysAllocStringLen(NULL, 24);
ok(str == strs[0], "str != strs[0]\n");
/* Smaller buffers may also use larget cached buffers */
str2 = SysAllocStringLen(NULL, 16);
ok(str2 == strs[1], "str2 != strs[1]\n");
SysFreeString(str);
SysFreeString(str2);
SysFreeString(str);
SysFreeString(str2);
}
START_TEST(vartype)
{
hOleaut32 = GetModuleHandleA("oleaut32.dll");
......@@ -6079,6 +6120,8 @@ START_TEST(vartype)
trace("LCIDs: System=0x%08x, User=0x%08x\n", GetSystemDefaultLCID(),
GetUserDefaultLCID());
test_bstr_cache();
test_VarI1FromI2();
test_VarI1FromI4();
test_VarI1FromI8();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment