Commit b771d417 authored by Alexandre Julliard's avatar Alexandre Julliard

kernel32/tests: Fix a string comparison test in utf-8 locales.

parent 680d17b4
...@@ -1816,8 +1816,13 @@ static void test_CompareStringA(void) ...@@ -1816,8 +1816,13 @@ static void test_CompareStringA(void)
static const char ABC_FF[] = {'A','B','C',0,0xFF}; static const char ABC_FF[] = {'A','B','C',0,0xFF};
int ret, i; int ret, i;
char a[256]; char a[256];
BOOL is_utf8;
CPINFOEXA cpinfo;
LCID lcid = MAKELCID(MAKELANGID(LANG_FRENCH, SUBLANG_DEFAULT), SORT_DEFAULT); LCID lcid = MAKELCID(MAKELANGID(LANG_FRENCH, SUBLANG_DEFAULT), SORT_DEFAULT);
GetCPInfoExA( CP_ACP, 0, &cpinfo );
is_utf8 = cpinfo.CodePage == CP_UTF8;
for (i = 0; i < ARRAY_SIZE(comparestringa_data); i++) for (i = 0; i < ARRAY_SIZE(comparestringa_data); i++)
{ {
const struct comparestringa_entry *entry = &comparestringa_data[i]; const struct comparestringa_entry *entry = &comparestringa_data[i];
...@@ -1945,13 +1950,13 @@ static void test_CompareStringA(void) ...@@ -1945,13 +1950,13 @@ static void test_CompareStringA(void)
ret = CompareStringA(LOCALE_USER_DEFAULT, 0, ABC_EE, 3, ABC_FF, 3); ret = CompareStringA(LOCALE_USER_DEFAULT, 0, ABC_EE, 3, ABC_FF, 3);
ok(ret == CSTR_EQUAL, "expected CSTR_EQUAL, got %d\n", ret); ok(ret == CSTR_EQUAL, "expected CSTR_EQUAL, got %d\n", ret);
ret = CompareStringA(LOCALE_USER_DEFAULT, 0, ABC_EE, 5, ABC_FF, 3); ret = CompareStringA(LOCALE_USER_DEFAULT, 0, ABC_EE, 5, ABC_FF, 3);
ok(ret == CSTR_GREATER_THAN, "expected CSTR_GREATER_THAN, got %d\n", ret); ok(ret == CSTR_GREATER_THAN || (is_utf8 && ret == CSTR_EQUAL), "expected CSTR_GREATER_THAN, got %d\n", ret);
ret = CompareStringA(LOCALE_USER_DEFAULT, 0, ABC_EE, 3, ABC_FF, 5); ret = CompareStringA(LOCALE_USER_DEFAULT, 0, ABC_EE, 3, ABC_FF, 5);
ok(ret == CSTR_LESS_THAN, "expected CSTR_LESS_THAN, got %d\n", ret); ok(ret == CSTR_LESS_THAN || (is_utf8 && ret == CSTR_EQUAL), "expected CSTR_LESS_THAN, got %d\n", ret);
ret = CompareStringA(LOCALE_USER_DEFAULT, 0, ABC_EE, 5, ABC_FF, 5); ret = CompareStringA(LOCALE_USER_DEFAULT, 0, ABC_EE, 5, ABC_FF, 5);
ok(ret == CSTR_LESS_THAN, "expected CSTR_LESS_THAN, got %d\n", ret); ok(ret == CSTR_LESS_THAN || (is_utf8 && ret == CSTR_EQUAL), "expected CSTR_LESS_THAN, got %d\n", ret);
ret = CompareStringA(LOCALE_USER_DEFAULT, 0, ABC_FF, 5, ABC_EE, 5); ret = CompareStringA(LOCALE_USER_DEFAULT, 0, ABC_FF, 5, ABC_EE, 5);
ok(ret == CSTR_GREATER_THAN, "expected CSTR_GREATER_THAN, got %d\n", ret); ok(ret == CSTR_GREATER_THAN || (is_utf8 && ret == CSTR_EQUAL), "expected CSTR_GREATER_THAN, got %d\n", ret);
} }
static void test_CompareStringW(void) static void test_CompareStringW(void)
......
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