reg/tests: Add tests for importing DWORD values.

Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hugh McMaster 2017-04-10 09:50:02 +00:00 committed by Alexandre Julliard
parent 8335d9152f
commit 47f506a1e1
1 changed files with 124 additions and 0 deletions

View File

@ -1218,6 +1218,59 @@ static void test_import(void)
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
todo_wine verify_reg_nonexist(hkey, "Multi-Line9");
test_import_str("REGEDIT4\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
"\"Wine32a\"=dword:1\n"
"\"Wine32b\"=dword:4444\n\n", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
dword = 0x1;
todo_wine verify_reg(hkey, "Wine32a", REG_DWORD, &dword, sizeof(dword), 0);
dword = 0x4444;
todo_wine verify_reg(hkey, "Wine32b", REG_DWORD, &dword, sizeof(dword), 0);
test_import_str("REGEDIT4\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
"\"Wine33a\"=dword:\n"
"\"Wine33b\"=dword:hello\n"
"\"Wine33c\"=dword:123456789\n"
"\"Wine33d\"=dword:012345678\n\n", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
todo_wine verify_reg_nonexist(hkey, "Wine33a");
todo_wine verify_reg_nonexist(hkey, "Wine33b");
todo_wine verify_reg_nonexist(hkey, "Wine33c");
todo_wine verify_reg_nonexist(hkey, "Wine33d");
test_import_str("REGEDIT4\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
"\"Wine34a\"=dword:12345678abc\n"
"\"Wine34b\"=dword:12345678 abc\n\n", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
todo_wine verify_reg_nonexist(hkey, "Wine34a");
todo_wine verify_reg_nonexist(hkey, "Wine34b");
test_import_str("REGEDIT4\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
"\"Wine35a\"=dword:0x123\n"
"\"Wine35b\"=dword:123 456\n"
"\"Wine35c\"=dword:1234 5678\n\n", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
todo_wine verify_reg_nonexist(hkey, "Wine35a");
todo_wine verify_reg_nonexist(hkey, "Wine35b");
todo_wine verify_reg_nonexist(hkey, "Wine35c");
test_import_str("REGEDIT4\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
"\"Wine36a\"=dword:1234;5678\n"
"\"Wine36b\"=dword:1234 ;5678\n"
"\"Wine36c\"=dword:1234#5678\n"
"\"Wine36d\"=dword:1234 #5678\n\n", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
dword = 0x1234;
todo_wine verify_reg(hkey, "Wine36a", REG_DWORD, &dword, sizeof(dword), 0);
todo_wine verify_reg(hkey, "Wine36b", REG_DWORD, &dword, sizeof(dword), 0);
todo_wine verify_reg_nonexist(hkey, "Wine36c");
todo_wine verify_reg_nonexist(hkey, "Wine36d");
test_import_str("REGEDIT4\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
"\"double\\\"quote\"=\"valid \\\"or\\\" not\"\n"
@ -1587,6 +1640,59 @@ static void test_import(void)
dword = 0x00000004;
todo_wine verify_reg(hkey, "Wine31", REG_DWORD, &dword, sizeof(dword), 0);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
"\"Wine32a\"=dword:1\n"
"\"Wine32b\"=dword:4444\n\n", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
dword = 0x1;
todo_wine verify_reg(hkey, "Wine32a", REG_DWORD, &dword, sizeof(dword), 0);
dword = 0x4444;
todo_wine verify_reg(hkey, "Wine32b", REG_DWORD, &dword, sizeof(dword), 0);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
"\"Wine33a\"=dword:\n"
"\"Wine33b\"=dword:hello\n"
"\"Wine33c\"=dword:123456789\n"
"\"Wine33d\"=dword:012345678\n\n", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
todo_wine verify_reg_nonexist(hkey, "Wine33a");
todo_wine verify_reg_nonexist(hkey, "Wine33b");
todo_wine verify_reg_nonexist(hkey, "Wine33c");
todo_wine verify_reg_nonexist(hkey, "Wine33d");
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
"\"Wine34a\"=dword:12345678abc\n"
"\"Wine34b\"=dword:12345678 abc\n\n", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
todo_wine verify_reg_nonexist(hkey, "Wine34a");
todo_wine verify_reg_nonexist(hkey, "Wine34b");
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
"\"Wine35a\"=dword:0x123\n"
"\"Wine35b\"=dword:123 456\n"
"\"Wine35c\"=dword:1234 5678\n\n", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
todo_wine verify_reg_nonexist(hkey, "Wine35a");
todo_wine verify_reg_nonexist(hkey, "Wine35b");
todo_wine verify_reg_nonexist(hkey, "Wine35c");
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
"\"Wine36a\"=dword:1234;5678\n"
"\"Wine36b\"=dword:1234 ;5678\n"
"\"Wine36c\"=dword:1234#5678\n"
"\"Wine36d\"=dword:1234 #5678\n\n", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
dword = 0x1234;
todo_wine verify_reg(hkey, "Wine36a", REG_DWORD, &dword, sizeof(dword), 0);
todo_wine verify_reg(hkey, "Wine36b", REG_DWORD, &dword, sizeof(dword), 0);
todo_wine verify_reg_nonexist(hkey, "Wine36c");
todo_wine verify_reg_nonexist(hkey, "Wine36d");
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
"\"Multi-Line1\"=hex(7):4c,00,69,00,6e,00,65,00,20,00,\\\n"
@ -1822,6 +1928,15 @@ static void test_import_with_whitespace(void)
todo_wine verify_reg(hkey, "Wine8a", REG_SZ, "Trailing spaces", 16, 0);
todo_wine verify_reg(hkey, "Wine8b", REG_SZ, "Trailing tabs and spaces", 25, 0);
test_import_str("REGEDIT4\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
"\"Wine9a\"=dword: 00000008\n"
"\"Wine9b\"=dword:\t\t00000008\n\n", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
dword = 0x00000008;
todo_wine verify_reg(hkey, "Wine9a", REG_DWORD, &dword, sizeof(dword), 0);
todo_wine verify_reg(hkey, "Wine9b", REG_DWORD, &dword, sizeof(dword), 0);
err = RegCloseKey(hkey);
todo_wine ok(err == ERROR_SUCCESS, "RegCloseKey failed: got %d, expected 0\n", err);
@ -1941,6 +2056,15 @@ static void test_import_with_whitespace(void)
todo_wine verify_reg(hkey, "Wine8a", REG_SZ, "Trailing spaces", 16, 0);
todo_wine verify_reg(hkey, "Wine8b", REG_SZ, "Trailing tabs and spaces", 25, 0);
test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
"[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
"\"Wine9a\"=dword: 00000008\n"
"\"Wine9b\"=dword:\t\t00000008\n\n", &r);
todo_wine ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
dword = 0x00000008;
todo_wine verify_reg(hkey, "Wine9a", REG_DWORD, &dword, sizeof(dword), 0);
todo_wine verify_reg(hkey, "Wine9b", REG_DWORD, &dword, sizeof(dword), 0);
err = RegCloseKey(hkey);
todo_wine ok(err == ERROR_SUCCESS, "RegCloseKey failed: got %d, expected 0\n", err);