ntdll/tests: Fix string test for UTF-8 default codepage.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2022-03-23 18:31:31 +01:00
parent b5561c8bba
commit 63d7591b3c
1 changed files with 7 additions and 4 deletions

View File

@ -1837,7 +1837,7 @@ static void test_toupper(void)
{ {
int i, ret, exp_ret; int i, ret, exp_ret;
char str[2], *p; char str[3], *p;
WCHAR wc; WCHAR wc;
ok(ptoupper != NULL, "toupper is not available\n"); ok(ptoupper != NULL, "toupper is not available\n");
@ -1846,17 +1846,20 @@ static void test_toupper(void)
{ {
str[0] = i; str[0] = i;
str[1] = i >> 8; str[1] = i >> 8;
str[2] = 0;
p = str; p = str;
wc = RtlAnsiCharToUnicodeChar( &p ); wc = RtlAnsiCharToUnicodeChar( &p );
wc = RtlUpcaseUnicodeChar( wc ); wc = RtlUpcaseUnicodeChar( wc );
ret = WideCharToMultiByte( CP_ACP, 0, &wc, 1, str, 2, NULL, NULL ); ret = WideCharToMultiByte( CP_ACP, 0, &wc, 1, str, 2, NULL, NULL );
ok(ret == 1 || ret == 2, "WideCharToMultiByte returned %d\n", ret); ok(!ret || ret == 1 || ret == 2, "WideCharToMultiByte returned %d\n", ret);
if (ret == 2) if (ret == 2)
exp_ret = (unsigned char)str[1] + ((unsigned char)str[0] << 8); exp_ret = (unsigned char)str[1] + ((unsigned char)str[0] << 8);
else else if (ret == 1)
exp_ret = (unsigned char)str[0]; exp_ret = (unsigned char)str[0];
else
exp_ret = (WCHAR)i;
ret = ptoupper(i); ret = (WCHAR)ptoupper(i);
ok(ret == exp_ret, "toupper(%x) = %x, expected %x\n", i, ret, exp_ret); ok(ret == exp_ret, "toupper(%x) = %x, expected %x\n", i, ret, exp_ret);
} }
} }