Hugh McMaster : kernel32/tests: Test whether every element of the CPINFO.LeadByte array is NUL.

Alexandre Julliard julliard at winehq.org
Mon Nov 22 16:05:18 CST 2021


Module: wine
Branch: master
Commit: 381ea5413c29efc104c0b7fcb914e13ac6afd685
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=381ea5413c29efc104c0b7fcb914e13ac6afd685

Author: Hugh McMaster <hugh.mcmaster at outlook.com>
Date:   Mon Nov 22 22:43:28 2021 +1100

kernel32/tests: Test whether every element of the CPINFO.LeadByte array is NUL.

Signed-off-by: Hugh McMaster <hugh.mcmaster at outlook.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/tests/locale.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/dlls/kernel32/tests/locale.c b/dlls/kernel32/tests/locale.c
index fa0ec374d34..4fb30eb5318 100644
--- a/dlls/kernel32/tests/locale.c
+++ b/dlls/kernel32/tests/locale.c
@@ -3962,6 +3962,7 @@ static void test_GetCPInfo(void)
     ok(GetLastError() == ERROR_INVALID_PARAMETER,
        "expected ERROR_INVALID_PARAMETER, got %u\n", GetLastError());
 
+    memset(cpinfo.LeadByte, '-', ARRAY_SIZE(cpinfo.LeadByte));
     SetLastError(0xdeadbeef);
     ret = GetCPInfo(CP_UTF7, &cpinfo);
     if (!ret && GetLastError() == ERROR_INVALID_PARAMETER)
@@ -3970,14 +3971,19 @@ static void test_GetCPInfo(void)
     }
     else
     {
+        unsigned int i;
+
         ok(ret, "GetCPInfo(CP_UTF7) error %u\n", GetLastError());
         ok(cpinfo.DefaultChar[0] == 0x3f, "expected 0x3f, got 0x%x\n", cpinfo.DefaultChar[0]);
         ok(cpinfo.DefaultChar[1] == 0, "expected 0, got 0x%x\n", cpinfo.DefaultChar[1]);
         ok(cpinfo.LeadByte[0] == 0, "expected 0, got 0x%x\n", cpinfo.LeadByte[0]);
         ok(cpinfo.LeadByte[1] == 0, "expected 0, got 0x%x\n", cpinfo.LeadByte[1]);
+        for (i = 2; i < sizeof(cpinfo.LeadByte); i++)
+            todo_wine ok(!cpinfo.LeadByte[i], "expected NUL byte in index %u\n", i);
         ok(cpinfo.MaxCharSize == 5, "expected 5, got 0x%x\n", cpinfo.MaxCharSize);
     }
 
+    memset(cpinfo.LeadByte, '-', ARRAY_SIZE(cpinfo.LeadByte));
     SetLastError(0xdeadbeef);
     ret = GetCPInfo(CP_UTF8, &cpinfo);
     if (!ret && GetLastError() == ERROR_INVALID_PARAMETER)
@@ -3986,11 +3992,15 @@ static void test_GetCPInfo(void)
     }
     else
     {
+        unsigned int i;
+
         ok(ret, "GetCPInfo(CP_UTF8) error %u\n", GetLastError());
         ok(cpinfo.DefaultChar[0] == 0x3f, "expected 0x3f, got 0x%x\n", cpinfo.DefaultChar[0]);
         ok(cpinfo.DefaultChar[1] == 0, "expected 0, got 0x%x\n", cpinfo.DefaultChar[1]);
         ok(cpinfo.LeadByte[0] == 0, "expected 0, got 0x%x\n", cpinfo.LeadByte[0]);
         ok(cpinfo.LeadByte[1] == 0, "expected 0, got 0x%x\n", cpinfo.LeadByte[1]);
+        for (i = 2; i < sizeof(cpinfo.LeadByte); i++)
+            todo_wine ok(!cpinfo.LeadByte[i], "expected NUL byte in index %u\n", i);
         ok(cpinfo.MaxCharSize == 4 || broken(cpinfo.MaxCharSize == 3) /* win9x */,
            "expected 4, got %u\n", cpinfo.MaxCharSize);
     }




More information about the wine-cvs mailing list