kernel32: Add tests for lstrcmpW (try 3)

André Hentschel nerv at dawncrow.de
Wed Apr 28 10:28:05 CDT 2010


now using tables with a function
---
 dlls/kernel32/tests/locale.c |  430 ++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 430 insertions(+), 0 deletions(-)

diff --git a/dlls/kernel32/tests/locale.c b/dlls/kernel32/tests/locale.c
index a462a14..fba6ae8 100644
--- a/dlls/kernel32/tests/locale.c
+++ b/dlls/kernel32/tests/locale.c
@@ -2653,6 +2653,435 @@ static void test_GetCPInfo(void)
     }
 }
 
+struct range_table
+{
+    WCHAR       start;
+    WCHAR       end;
+};
+
+static const struct range_table table_ranges[] =
+{
+    { 0x0378, 0x0379 },
+    { 0x037f, 0x0383 },
+    { 0x0524, 0x0530 },
+    { 0x0557, 0x0558 },
+    { 0x058b, 0x0590 },
+    { 0x05c8, 0x05cf },
+    { 0x05eb, 0x05ef },
+    { 0x05f5, 0x05ff },
+    { 0x0604, 0x0605 },
+    { 0x061c, 0x061d },
+    { 0x074b, 0x074c },
+    { 0x07b2, 0x07bf },
+    { 0x07fb, 0x0900 },
+    { 0x093a, 0x093b },
+    { 0x094e, 0x094f },
+    { 0x0955, 0x0957 },
+    { 0x0973, 0x097a },
+    { 0x098d, 0x098e },
+    { 0x0991, 0x0992 },
+    { 0x09b3, 0x09b5 },
+    { 0x09ba, 0x09bb },
+    { 0x09c5, 0x09c6 },
+    { 0x09c9, 0x09ca },
+    { 0x09cf, 0x09d6 },
+    { 0x09d8, 0x09db },
+    { 0x09e4, 0x09e5 },
+    { 0x09fb, 0x0a00 },
+    { 0x0a0b, 0x0a0e },
+    { 0x0a11, 0x0a12 },
+    { 0x0a3a, 0x0a3b },
+    { 0x0a43, 0x0a46 },
+    { 0x0a49, 0x0a4a },
+    { 0x0a4e, 0x0a50 },
+    { 0x0a52, 0x0a58 },
+    { 0x0a5f, 0x0a65 },
+    { 0x0a76, 0x0a80 },
+    { 0x0aba, 0x0abb },
+    { 0x0ace, 0x0acf },
+    { 0x0ad1, 0x0adf },
+    { 0x0ae4, 0x0ae5 },
+    { 0x0af2, 0x0b00 },
+    { 0x0b0d, 0x0b0e },
+    { 0x0b11, 0x0b12 },
+    { 0x0b3a, 0x0b3b },
+    { 0x0b45, 0x0b46 },
+    { 0x0b49, 0x0b4a },
+    { 0x0b4e, 0x0b55 },
+    { 0x0b58, 0x0b5b },
+    { 0x0b64, 0x0b65 },
+    { 0x0b72, 0x0b81 },
+    { 0x0b8b, 0x0b8d },
+    { 0x0b96, 0x0b98 },
+    { 0x0ba0, 0x0ba2 },
+    { 0x0ba5, 0x0ba7 },
+    { 0x0bab, 0x0bad },
+    { 0x0bba, 0x0bbd },
+    { 0x0bc3, 0x0bc5 },
+    { 0x0bce, 0x0bcf },
+    { 0x0bd1, 0x0bd6 },
+    { 0x0bd8, 0x0be5 },
+    { 0x0bfb, 0x0c00 },
+    { 0x0c3a, 0x0c3c },
+    { 0x0c4e, 0x0c54 },
+    { 0x0c5a, 0x0c5f },
+    { 0x0c64, 0x0c65 },
+    { 0x0c70, 0x0c77 },
+    { 0x0c80, 0x0c81 },
+    { 0x0cba, 0x0cbb },
+    { 0x0cce, 0x0cd4 },
+    { 0x0cd7, 0x0cdd },
+    { 0x0ce4, 0x0ce5 },
+    { 0x0cf3, 0x0d01 },
+    { 0x0d3a, 0x0d3c },
+    { 0x0d4e, 0x0d56 },
+    { 0x0d58, 0x0d5f },
+    { 0x0d64, 0x0d65 },
+    { 0x0d76, 0x0d78 },
+    { 0x0d80, 0x0d81 },
+    { 0x0de1, 0x0de6 },
+    { 0x0df7, 0x0e00 },
+    { 0x0e3b, 0x0e3e },
+    { 0x0e5c, 0x0e6f },
+    { 0x0e75, 0x0e80 },
+    { 0x0e85, 0x0e86 },
+    { 0x0e8b, 0x0e8c },
+    { 0x0e8e, 0x0e93 },
+    { 0x0ea8, 0x0ea9 },
+    { 0x0ebe, 0x0ebf },
+    { 0x0ece, 0x0ecf },
+    { 0x0eda, 0x0edb },
+    { 0x0ede, 0x0eef },
+    { 0x0ef5, 0x0eff },
+    { 0x0f6d, 0x0f70 },
+    { 0x0f8c, 0x0f8f },
+    { 0x0fd5, 0x0fff },
+    { 0x109a, 0x109d },
+    { 0x10c6, 0x10cf },
+    { 0x10fd, 0x10ff },
+    { 0x115a, 0x115e },
+    { 0x11a3, 0x11a7 },
+    { 0x11fa, 0x11ff },
+    { 0x124e, 0x124f },
+    { 0x125e, 0x125f },
+    { 0x128e, 0x128f },
+    { 0x12b6, 0x12b7 },
+    { 0x12c6, 0x12c7 },
+    { 0x1316, 0x1317 },
+    { 0x135b, 0x135e },
+    { 0x137d, 0x137f },
+    { 0x139a, 0x139f },
+    { 0x13f5, 0x1400 },
+    { 0x1677, 0x167f },
+    { 0x169d, 0x169f },
+    { 0x16f1, 0x16ff },
+    { 0x1715, 0x171f },
+    { 0x1737, 0x173f },
+    { 0x1754, 0x175f },
+    { 0x1774, 0x177f },
+    { 0x17de, 0x17df },
+    { 0x17ea, 0x17ef },
+    { 0x17fa, 0x17ff },
+    { 0x180b, 0x180d },
+    { 0x181a, 0x181f },
+    { 0x1878, 0x187f },
+    { 0x18ab, 0x18ff },
+    { 0x191d, 0x191f },
+    { 0x192c, 0x192f },
+    { 0x193c, 0x193f },
+    { 0x1941, 0x1943 },
+    { 0x196e, 0x196f },
+    { 0x1975, 0x197f },
+    { 0x19aa, 0x19af },
+    { 0x19ca, 0x19cf },
+    { 0x19da, 0x19dd },
+    { 0x1a1c, 0x1a1d },
+    { 0x1a20, 0x1aff },
+    { 0x1b4c, 0x1b4f },
+    { 0x1b7d, 0x1b7f },
+    { 0x1bab, 0x1bad },
+    { 0x1bba, 0x1bff },
+    { 0x1c38, 0x1c3a },
+    { 0x1c4a, 0x1c4c },
+    { 0x1c80, 0x1cff },
+    { 0x1de7, 0x1dfd },
+    { 0x1f16, 0x1f17 },
+    { 0x1f1e, 0x1f1f },
+    { 0x1f46, 0x1f47 },
+    { 0x1f4e, 0x1f4f },
+    { 0x1f7e, 0x1f7f },
+    { 0x1fd4, 0x1fd5 },
+    { 0x1ff0, 0x1ff1 },
+    { 0x200d, 0x200f },
+    { 0x202a, 0x202e },
+    { 0x2060, 0x206f },
+    { 0x2072, 0x2073 },
+    { 0x2095, 0x209f },
+    { 0x20b6, 0x20cf },
+    { 0x20f1, 0x20ff },
+    { 0x2150, 0x2152 },
+    { 0x2189, 0x218f },
+    { 0x23e8, 0x23ff },
+    { 0x2427, 0x243f },
+    { 0x244b, 0x245f },
+    { 0x269e, 0x269f },
+    { 0x26bd, 0x26bf },
+    { 0x26c4, 0x2700 },
+    { 0x270a, 0x270b },
+    { 0x2753, 0x2755 },
+    { 0x275f, 0x2760 },
+    { 0x2795, 0x2797 },
+    { 0x27cd, 0x27cf },
+    { 0x2b4d, 0x2b4f },
+    { 0x2b55, 0x2bff },
+    { 0x2c7e, 0x2c7f },
+    { 0x2ceb, 0x2cf8 },
+    { 0x2d26, 0x2d2f },
+    { 0x2d66, 0x2d6e },
+    { 0x2d70, 0x2d7f },
+    { 0x2d97, 0x2d9f },
+    { 0x2e31, 0x2e7f },
+    { 0x2ef4, 0x2eff },
+    { 0x2fd6, 0x2fef },
+    { 0x2ffc, 0x2fff },
+    { 0x3097, 0x3098 },
+    { 0x3100, 0x3104 },
+    { 0x312e, 0x3130 },
+    { 0x318f, 0x3191 },
+    { 0x31b8, 0x31bf },
+    { 0x31e4, 0x31ef },
+    { 0x3244, 0x324f },
+    { 0x4db6, 0x4dbf },
+    { 0x9fc4, 0x9fff },
+    { 0xa48d, 0xa48f },
+    { 0xa4c7, 0xa4ff },
+    { 0xa62c, 0xa63f },
+    { 0xa660, 0xa661 },
+    { 0xa674, 0xa67b },
+    { 0xa698, 0xa6ff },
+    { 0xa78d, 0xa7fa },
+    { 0xa82c, 0xa83f },
+    { 0xa878, 0xa87f },
+    { 0xa8c5, 0xa8cd },
+    { 0xa8da, 0xa8ff },
+    { 0xa954, 0xa95e },
+    { 0xa960, 0xa9ff },
+    { 0xaa37, 0xaa3f },
+    { 0xaa4e, 0xaa4f },
+    { 0xaa5a, 0xaa5b },
+    { 0xaa60, 0xabff },
+    { 0xd7a4, 0xd7ff },
+    { 0xd880, 0xdb7f },
+    { 0xfa2e, 0xfa2f },
+    { 0xfa6b, 0xfa6f },
+    { 0xfada, 0xfaff },
+    { 0xfb07, 0xfb12 },
+    { 0xfb18, 0xfb1c },
+    { 0xfbb2, 0xfbd2 },
+    { 0xfd40, 0xfd4f },
+    { 0xfd90, 0xfd91 },
+    { 0xfdc8, 0xfdef },
+    { 0xfdfe, 0xfe0f },
+    { 0xfe1a, 0xfe1f },
+    { 0xfe27, 0xfe2f },
+    { 0xfe6c, 0xfe6f },
+    { 0xfefd, 0xfefe },
+    { 0xffbf, 0xffc1 },
+    { 0xffc8, 0xffc9 },
+    { 0xffd0, 0xffd1 },
+    { 0xffd8, 0xffd9 },
+    { 0xffdd, 0xffdf },
+    { 0xffef, 0xfffe },
+};
+
+static const WCHAR table_singles[] =
+{
+    0x034f,
+    0x038b,
+    0x038d,
+    0x03a2,
+    0x0560,
+    0x0588,
+    0x0620,
+    0x0640,
+    0x065f,
+    0x070e,
+    0x0980,
+    0x0984,
+    0x09a9,
+    0x09b1,
+    0x09de,
+    0x0a04,
+    0x0a29,
+    0x0a31,
+    0x0a34,
+    0x0a37,
+    0x0a5d,
+    0x0a84,
+    0x0a8e,
+    0x0a92,
+    0x0aa9,
+    0x0ab1,
+    0x0ab4,
+    0x0ac6,
+    0x0aca,
+    0x0af0,
+    0x0b04,
+    0x0b29,
+    0x0b31,
+    0x0b34,
+    0x0b5e,
+    0x0b84,
+    0x0b91,
+    0x0b9b,
+    0x0b9d,
+    0x0bc9,
+    0x0c04,
+    0x0c0d,
+    0x0c11,
+    0x0c29,
+    0x0c34,
+    0x0c45,
+    0x0c49,
+    0x0c57,
+    0x0c84,
+    0x0c8d,
+    0x0c91,
+    0x0ca9,
+    0x0cb4,
+    0x0cc5,
+    0x0cc9,
+    0x0cdf,
+    0x0cf0,
+    0x0d04,
+    0x0d0d,
+    0x0d11,
+    0x0d29,
+    0x0d45,
+    0x0d49,
+    0x0d84,
+    0x0dbc,
+    0x0dc9,
+    0x0dce,
+    0x0e83,
+    0x0e89,
+    0x0e98,
+    0x0ea0,
+    0x0ea4,
+    0x0ea6,
+    0x0eac,
+    0x0eba,
+    0x0ec5,
+    0x0ec7,
+    0x0f48,
+    0x0f98,
+    0x0fbd,
+    0x0fcd,
+    0x1249,
+    0x1257,
+    0x1259,
+    0x1289,
+    0x12b1,
+    0x12bf,
+    0x12c1,
+    0x12d7,
+    0x1311,
+    0x170d,
+    0x176d,
+    0x1771,
+    0x1806,
+    0x180f,
+    0x1f58,
+    0x1f5a,
+    0x1f5c,
+    0x1f5e,
+    0x1fb5,
+    0x1fc5,
+    0x1fdc,
+    0x1ff5,
+    0x1fff,
+    0x208f,
+    0x2705,
+    0x2728,
+    0x274c,
+    0x274e,
+    0x2757,
+    0x27b0,
+    0x27bf,
+    0x27cb,
+    0x2c2f,
+    0x2c5f,
+    0x2c70,
+    0x2da7,
+    0x2daf,
+    0x2db7,
+    0x2dbf,
+    0x2dc7,
+    0x2dcf,
+    0x2dd7,
+    0x2ddf,
+    0x2e9a,
+    0x3040,
+    0x321f,
+    0x32ff,
+    0xfb37,
+    0xfb3d,
+    0xfb3f,
+    0xfb42,
+    0xfb45,
+    0xfe53,
+    0xfe67,
+    0xfe75,
+    0xff00,
+    0xffe7,
+};
+
+BOOL ignorewchar(WCHAR num)
+{
+    int i;
+
+    for (i = 0; i < sizeof(table_ranges)/sizeof(table_ranges[0]); i++)
+    {if (num >= table_ranges[i].start && num <= table_ranges[i].end) return TRUE; }
+
+    for (i = 0; i < sizeof(table_singles)/sizeof(table_singles[0]); i++)
+    {if (num == table_singles[i]) return TRUE; }
+
+    return FALSE;
+}
+
+static void test_lstrcmpW(void)
+{
+    static const WCHAR nomarkerW[] = {'t','e','s','t',0};
+    static WCHAR markerW[] = {'t','e','r','s','t',0};
+    WCHAR r;
+
+    SetLastError(0xdeadbeef);
+    lstrcmpW(markerW, nomarkerW);
+    if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+    {
+        win_skip("lstrcmpW is not implemented\n");
+        return;
+    }
+
+    for (r = 0; r < 0xFFFF; r++)
+    {
+        if (ignorewchar(r))
+        {
+            markerW[2] = r;
+            todo_wine
+            {
+                ok(!lstrcmpW(markerW, nomarkerW), "expected the character 0x%x to be ignored within the string\n", r);
+                ok(CompareStringW(LOCALE_SYSTEM_DEFAULT, 0, markerW, -1, nomarkerW, -1) == 2,
+                   "expected the character 0x%x to be ignored within the string\n", r);
+                ok(CompareStringW(LOCALE_SYSTEM_DEFAULT, NORM_IGNORECASE|NORM_IGNORENONSPACE|NORM_IGNORESYMBOLS|
+                                  SORT_STRINGSORT|NORM_IGNOREKANATYPE|NORM_IGNOREWIDTH|LOCALE_USE_CP_ACP,
+                                  markerW, -1, nomarkerW, -1) == 2,
+                   "expected the character 0x%x to be ignored within the string\n", r);
+            }
+        }
+    }
+}
+
 START_TEST(locale)
 {
   InitFunctionPointers();
@@ -2671,6 +3100,7 @@ START_TEST(locale)
   test_LCMapStringW();
   test_FoldStringA();
   test_FoldStringW();
+  test_lstrcmpW();
   test_ConvertDefaultLocale();
   test_EnumSystemLanguageGroupsA();
   test_EnumLanguageGroupLocalesA();
-- 

Best Regards, André Hentschel




More information about the wine-patches mailing list