From: Daniel Lehman dlehman25@gmail.com
--- dlls/msvcrt/tests/locale.c | 35 ++++++++++++++++++++++++++++++++ include/msvcrt/corecrt_wstring.h | 1 + 2 files changed, 36 insertions(+)
diff --git a/dlls/msvcrt/tests/locale.c b/dlls/msvcrt/tests/locale.c index f77e8f93abb..c40a53baab1 100644 --- a/dlls/msvcrt/tests/locale.c +++ b/dlls/msvcrt/tests/locale.c @@ -796,6 +796,40 @@ static void test___mb_cur_max_func(void) } }
+static void test__wcsicmp_l(void) +{ + const struct { + const wchar_t *str1; + const wchar_t *str2; + int exp; + const char *loc; + } tests[] = { + { L"i", L"i", 0 }, + { L"I", L"i", 0 }, + { L"I", L"i", 0, "Turkish" }, + { L"i", L"a", 8 }, + { L"a", L"i", -8 }, + { L"i", L"a", 8, "Turkish" }, + }; + int ret, i; + + for(i=0; i<ARRAY_SIZE(tests); i++) { + _locale_t loc = NULL; + + if(tests[i].loc) { + loc = _create_locale(LC_ALL, tests[i].loc); + ok(!!loc, "Skipping test with %s locale\n", tests[i].loc); + if(!loc) continue; + } + ret = _wcsicmp_l(tests[i].str1, tests[i].str2, loc); + ok(ret == tests[i].exp, "_wcsicmp_l = %d, expected %d for test %d '%ls' vs '%ls' using %s locale\n", + ret, tests[i].exp, i, tests[i].str1, tests[i].str2, loc ? tests[i].loc : "current"); + + if(loc) + _free_locale(loc); + } +} + START_TEST(locale) { init(); @@ -804,4 +838,5 @@ START_TEST(locale) test_setlocale(); test__Gettnames(); test___mb_cur_max_func(); + test__wcsicmp_l(); } diff --git a/include/msvcrt/corecrt_wstring.h b/include/msvcrt/corecrt_wstring.h index 4d012800f65..02332787dc9 100644 --- a/include/msvcrt/corecrt_wstring.h +++ b/include/msvcrt/corecrt_wstring.h @@ -32,6 +32,7 @@ _ACRTIMP void* __cdecl memmove(void*,const void*,size_t);
_ACRTIMP wchar_t* __cdecl _wcsdup(const wchar_t*) __WINE_DEALLOC(free) __WINE_MALLOC; _ACRTIMP int __cdecl _wcsicmp(const wchar_t*,const wchar_t*); +_ACRTIMP int __cdecl _wcsicmp_l(const wchar_t*,const wchar_t*, _locale_t); _ACRTIMP int __cdecl _wcsicoll(const wchar_t*,const wchar_t*); _ACRTIMP int __cdecl _wcsicoll_l(const wchar_t*, const wchar_t*, _locale_t); _ACRTIMP wchar_t* __cdecl _wcslwr(wchar_t*);
Piotr Caban (@piotr) commented about dlls/msvcrt/tests/locale.c:
{ L"i", L"i", 0 },
{ L"I", L"i", 0 },
{ L"I", L"i", 0, "Turkish" },
{ L"i", L"a", 8 },
{ L"a", L"i", -8 },
{ L"i", L"a", 8, "Turkish" },
- };
- int ret, i;
- for(i=0; i<ARRAY_SIZE(tests); i++) {
_locale_t loc = NULL;
if(tests[i].loc) {
loc = _create_locale(LC_ALL, tests[i].loc);
ok(!!loc, "Skipping test with %s locale\n", tests[i].loc);
if(!loc) continue;
The test should never fail so `if(!loc) continue;` is not needed or `win_skip` should be used.