Commit 6468ffd8 authored by Jactry Zeng's avatar Jactry Zeng Committed by Alexandre Julliard

atl/tests: Move regular DWORD tests into a loop.

parent f9785543
...@@ -59,7 +59,20 @@ static void test_registrar(void) ...@@ -59,7 +59,20 @@ static void test_registrar(void)
IRegistrar *registrar = NULL; IRegistrar *registrar = NULL;
HRESULT hr; HRESULT hr;
INT count; INT count;
int i;
WCHAR *textW = NULL; WCHAR *textW = NULL;
struct dword_test
{
const char *name;
BOOL preserved;
LONGLONG value;
} dword_tests[] =
{
{ "dword_unquoted_dec", TRUE, 1 },
{ "dword_quoted_dec", TRUE, 1 },
{ "dword_quoted_hex", FALSE, 0xA },
{ "dword_unquoted_hex", FALSE, 0xA },
};
if (!GetProcAddress(GetModuleHandleA("atl.dll"), "AtlAxAttachControl")) if (!GetProcAddress(GetModuleHandleA("atl.dll"), "AtlAxAttachControl"))
{ {
...@@ -112,25 +125,16 @@ static void test_registrar(void) ...@@ -112,25 +125,16 @@ static void test_registrar(void)
ok(lret == ERROR_SUCCESS, "RegQueryValueExA failed, error %ld\n", lret); ok(lret == ERROR_SUCCESS, "RegQueryValueExA failed, error %ld\n", lret);
ok(!strcmp( buffer, "str'ing"), "wrong data %s\n", debugstr_a(buffer)); ok(!strcmp( buffer, "str'ing"), "wrong data %s\n", debugstr_a(buffer));
size = sizeof(dword); for (i = 0; i < ARRAYSIZE(dword_tests); i++)
lret = RegQueryValueExA(key, "dword_unquoted_hex", NULL, NULL, (BYTE*)&dword, &size); {
ok(lret == ERROR_SUCCESS, "RegQueryValueExA failed, error %ld\n", lret); size = sizeof(dword);
ok(dword != 0xA, "unquoted hex is not supposed to be preserved\n"); lret = RegQueryValueExA(key, dword_tests[i].name, NULL, NULL, (BYTE*)&dword, &size);
ok(lret == ERROR_SUCCESS, "Test %d: RegQueryValueExA failed %ld.\n", i, lret);
size = sizeof(dword); if (dword_tests[i].preserved)
lret = RegQueryValueExA(key, "dword_quoted_hex", NULL, NULL, (BYTE*)&dword, &size); ok(dword == dword_tests[i].value, "Test %d: got unexpected value %lu.\n", i, dword);
ok(lret == ERROR_SUCCESS, "RegQueryValueExA failed, error %ld\n", lret); else
ok(dword != 0xA, "quoted hex is not supposed to be preserved\n"); ok(dword != dword_tests[i].value, "Test %d: is not supposed to be preserved.\n", i);
}
size = sizeof(dword);
lret = RegQueryValueExA(key, "dword_unquoted_dec", NULL, NULL, (BYTE*)&dword, &size);
ok(lret == ERROR_SUCCESS, "RegQueryValueExA failed, error %ld\n", lret);
ok(dword == 1, "unquoted dec is not supposed to be %ld\n", dword);
size = sizeof(dword);
lret = RegQueryValueExA(key, "dword_quoted_dec", NULL, NULL, (BYTE*)&dword, &size);
ok(lret == ERROR_SUCCESS, "RegQueryValueExA failed, error %ld\n", lret);
ok(dword == 1, "quoted dec is not supposed to be %ld\n", dword);
size = 4; size = 4;
lret = RegQueryValueExA(key, "binary_quoted", NULL, NULL, bytes, &size); lret = RegQueryValueExA(key, "binary_quoted", NULL, NULL, bytes, &size);
......
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