-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
These patches look reasonable to me. There are some things that are matters of opinion as far as I can see, like printing static expected values in this patch, or reusing the same buffer in patch 4-6. I left those up to Jonathan to decide. If we have written rules about those please point them out.
Am 2014-10-22 18:13, schrieb Jonathan Vollebregt:
Also use %u for DWORD instead of %d
programs/reg/tests/reg.c | 60 ++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 30 deletions(-)
diff --git a/programs/reg/tests/reg.c b/programs/reg/tests/reg.c index 5b79aed..772d81d 100644 --- a/programs/reg/tests/reg.c +++ b/programs/reg/tests/reg.c @@ -73,13 +73,13 @@ static void verify_reg_(unsigned line, HKEY hkey, const char* value, return;
if (todo & TODO_REG_TYPE)
todo_wine lok(type == exp_type, "got wrong type %d, expected %d\n", type, exp_type);
elsetodo_wine lok(type == exp_type, "got wrong type %u, expected %u\n", type, exp_type);
lok(type == exp_type, "got wrong type %d, expected %d\n", type, exp_type);
if (todo & TODO_REG_SIZE)lok(type == exp_type, "got wrong type %u, expected %u\n", type, exp_type);
todo_wine lok(size == exp_size, "got wrong size %d, expected %d\n", size, exp_size);
elsetodo_wine lok(size == exp_size, "got wrong size %u, expected %u\n", size, exp_size);
lok(size == exp_size, "got wrong size %d, expected %d\n", size, exp_size);
if (todo & TODO_REG_DATA) todo_wine lok(memcmp(data, exp_data, size) == 0, "got wrong data\n"); elselok(size == exp_size, "got wrong size %u, expected %u\n", size, exp_size);
@@ -93,7 +93,7 @@ static void test_add(void) DWORD r, dword, type, size;
run_reg_exe("reg add", &r);
- ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
ok(r == REG_EXIT_FAILURE, "got exit code %u, expected %u\n", r, REG_EXIT_FAILURE);
err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE); ok(err == ERROR_SUCCESS || err == ERROR_FILE_NOT_FOUND, "got %d\n", err);
@@ -102,7 +102,7 @@ static void test_add(void) ok(err == ERROR_FILE_NOT_FOUND, "got %d\n", err);
run_reg_exe("reg add HKCU\\" KEY_BASE " /f", &r);
- ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected %u\n", r, REG_EXIT_SUCCESS);
err = RegOpenKeyExA(HKEY_CURRENT_USER, KEY_BASE, 0, KEY_READ, &hkey); ok(err == ERROR_SUCCESS, "key creation failed, got %d\n", err);
@@ -110,36 +110,36 @@ static void test_add(void) /* REG_SZ */ run_reg_exe("reg add HKCU\" KEY_BASE " /d WineTest /f", &r); ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE /* WinXP */),
"got exit code %d, expected 0\n", r);
"got exit code %u, expected %u\n", r, REG_EXIT_SUCCESS);
if (r == REG_EXIT_SUCCESS) verify_reg(hkey, "", REG_SZ, "WineTest", 9, 0); else win_skip("broken reg.exe detected\n");
run_reg_exe("reg add HKCU\" KEY_BASE " /v test /d deadbeef /f", &r);
- ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected %u\n", r, REG_EXIT_SUCCESS); verify_reg(hkey, "test", REG_SZ, "deadbeef", 9, 0);
run_reg_exe("reg add HKCU\" KEY_BASE " /v test /f", &r);
- ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected %u\n", r, REG_EXIT_SUCCESS); verify_reg(hkey, "test", REG_SZ, "", 1, TODO_REG_SIZE);
run_reg_exe("reg add HKEY_CURRENT_USER\" KEY_BASE " /ve /d WineTEST /f", &r);
- ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected %u\n", r, REG_EXIT_SUCCESS); verify_reg(hkey, "", REG_SZ, "WineTEST", 9, 0);
run_reg_exe("reg add HKCU\" KEY_BASE " /t REG_SZ /v test2 /f", &r);
- ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected %u\n", r, REG_EXIT_SUCCESS); verify_reg(hkey, "test2", REG_SZ, "", 1, TODO_REG_SIZE);
run_reg_exe("reg add HKCU\" KEY_BASE " /t REG_SZ /v test3 /f /d """, &r);
- ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected %u\n", r, REG_EXIT_SUCCESS); verify_reg(hkey, "test3", REG_SZ, "", 1, 0);
/* REG_DWORD */ run_reg_exe("reg add HKCU\" KEY_BASE " /t REG_DWORD /f /d 12345678", &r); ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE /* WinXP */),
"got exit code %d, expected 0\n", r);
dword = 12345678; if (r == REG_EXIT_SUCCESS) verify_reg(hkey, "", REG_DWORD, &dword, sizeof(dword), 0);"got exit code %u, expected %u\n", r, REG_EXIT_SUCCESS);
@@ -148,41 +148,41 @@ static void test_add(void)
run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword1 /t REG_DWORD /f", &r); todo_wine ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */),
"got exit code %d, expected 0\n", r);
run_reg_exe("reg add HKCU\" KEY_BASE " /v dword2 /t REG_DWORD /d zzz /f", &r);"got exit code %u, expected %u\n", r, REG_EXIT_FAILURE);
- todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
- todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u, expected %u\n", r, REG_EXIT_FAILURE); run_reg_exe("reg add HKCU\" KEY_BASE " /v dword3 /t REG_DWORD /d deadbeef /f", &r);
- todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
- todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u, expected %u\n", r, REG_EXIT_FAILURE); run_reg_exe("reg add HKCU\" KEY_BASE " /v dword4 /t REG_DWORD /d 123xyz /f", &r);
- todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u, expected %u\n", r, REG_EXIT_FAILURE);
run_reg_exe("reg add HKCU\" KEY_BASE " /v dword5 /t reg_dword /d 12345678 /f", &r);
- ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected %u\n", r, REG_EXIT_SUCCESS); dword = 12345678; verify_reg(hkey, "dword5", REG_DWORD, &dword, sizeof(dword), 0);
run_reg_exe("reg add HKCU\" KEY_BASE " /v dword6 /t REG_DWORD /D 0123 /f", &r);
- ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
- ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected %u\n", r, REG_EXIT_SUCCESS); size = sizeof(dword); err = RegQueryValueExA(hkey, "dword6", NULL, &type, (LPBYTE)&dword, &size); ok(err == ERROR_SUCCESS, "RegQueryValueEx failed: got %d\n", err);
- ok(type == REG_DWORD, "got wrong type %d, expected %d\n", type, REG_DWORD);
- ok(size == sizeof(DWORD), "got wrong size %d, expected %d\n", size, (int)sizeof(DWORD));
- ok(type == REG_DWORD, "got wrong type %u, expected %u\n", type, REG_DWORD);
- ok(size == sizeof(DWORD), "got wrong size %u, expected %u\n", size, (unsigned int) sizeof(DWORD)); todo_wine ok(dword == 123 || broken(dword == 0123 /* WinXP */),
"got wrong data %d, expected %d\n", dword, 123);
"got wrong data %u, expected %u\n", dword, 123);
run_reg_exe("reg add HKCU\" KEY_BASE " /v dword7 /t reg_dword /d 0xabcdefg /f", &r);
- todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
todo_wine ok(r == REG_EXIT_FAILURE, "got exit code %u, expected %u\n", r, REG_EXIT_FAILURE);
run_reg_exe("reg add HKCU\" KEY_BASE " /v dword8 /t REG_dword /d 0xdeadbeef /f", &r);
- ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected %u\n", r, REG_EXIT_SUCCESS); dword = 0xdeadbeef; verify_reg(hkey, "dword8", REG_DWORD, &dword, sizeof(dword), (sizeof(long) > sizeof(DWORD)) ? 0 : TODO_REG_DATA);
/* REG_DWORD_LITTLE_ENDIAN */ run_reg_exe("reg add HKCU\" KEY_BASE " /v DWORD_LE /t REG_DWORD_LITTLE_ENDIAN /d 456 /f", &r);
- ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
- ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected %u\n", r, REG_EXIT_SUCCESS); dword = 456; verify_reg(hkey, "DWORD_LE", REG_DWORD_LITTLE_ENDIAN, &dword, sizeof(dword), 0);
@@ -200,7 +200,7 @@ static void test_delete(void) const DWORD deadbeef = 0xdeadbeef;
run_reg_exe("reg delete", &r);
- ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
ok(r == REG_EXIT_FAILURE, "got exit code %u, expected %u\n", r, REG_EXIT_FAILURE);
err = RegCreateKeyExA(HKEY_CURRENT_USER, KEY_BASE, 0, NULL, 0, KEY_ALL_ACCESS, NULL, &hkey, NULL); ok(err == ERROR_SUCCESS, "got %d\n", err);
@@ -219,17 +219,17 @@ static void test_delete(void) RegCloseKey(hsubkey);
run_reg_exe("reg delete HKCU\\" KEY_BASE " /v bar /f", &r);
- ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected %u\n", r, REG_EXIT_SUCCESS); err = RegQueryValueExA(hkey, "bar", NULL, NULL, NULL, NULL); ok(err == ERROR_FILE_NOT_FOUND, "got %d\n", err);
run_reg_exe("reg delete HKCU\" KEY_BASE " /ve /f", &r);
- ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected %u\n", r, REG_EXIT_SUCCESS); err = RegQueryValueExA(hkey, "", NULL, NULL, NULL, NULL); todo_wine ok(err == ERROR_FILE_NOT_FOUND, "got %d\n", err);
run_reg_exe("reg delete HKCU\" KEY_BASE " /va /f", &r);
- ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
- ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected %u\n", r, REG_EXIT_SUCCESS); err = RegQueryValueExA(hkey, "foo", NULL, NULL, NULL, NULL); ok(err == ERROR_FILE_NOT_FOUND, "got %d\n", err); err = RegOpenKeyExA(hkey, "subkey", 0, KEY_READ, &hsubkey);
@@ -238,7 +238,7 @@ static void test_delete(void) RegCloseKey(hkey);
run_reg_exe("reg delete HKCU\\" KEY_BASE " /f", &r);
- ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
- ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected %u\n", r, REG_EXIT_SUCCESS); err = RegOpenKeyExA(HKEY_CURRENT_USER, KEY_BASE, 0, KEY_READ, &hkey); ok(err == ERROR_FILE_NOT_FOUND, "got %d\n", err);
}