From: Jactry Zeng jzeng@codeweavers.com
--- dlls/msvcrt/tests/string.c | 48 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+)
diff --git a/dlls/msvcrt/tests/string.c b/dlls/msvcrt/tests/string.c index 533419fb194..967f3f20d75 100644 --- a/dlls/msvcrt/tests/string.c +++ b/dlls/msvcrt/tests/string.c @@ -4974,6 +4974,53 @@ static void test__strnicmp_l(void) setlocale(LC_ALL, "C"); }
+static void test_toupper(void) +{ + int ret; + + ok(setlocale(LC_ALL, "English_United States") != NULL, "setlocale failed.\n"); + errno = 0xdeadbeef; + ret = toupper((signed char)0xf0); + ok(ret == 0xd0, "Got %#x.\n", ret); + ok(errno == EILSEQ, "Got errno %d.\n", errno); + errno = 0xdeadbeef; + ret = toupper(0xf0); + ok(ret == 0xd0, "Got %#x.\n", ret); + ok(errno == 0xdeadbeef, "Got errno %d.\n", errno); + + ok(setlocale(LC_ALL, "Polish") != NULL, "setlocale failed.\n"); + errno = 0xdeadbeef; + ret = toupper((signed char)0xa5); + ok(ret == 0xa5, "Got %#x.\n", ret); + ok(errno == EILSEQ, "Got errno %d.\n", errno); + errno = 0xdeadbeef; + ret = toupper((signed char)0xb9); + ok(ret == 0xa5, "Got %#x.\n", ret); + ok(errno == EILSEQ, "Got errno %d.\n", errno); + + ok(setlocale(LC_ALL, "Japanese_Japan.932") != NULL, "setlocale failed.\n"); + errno = 0xdeadbeef; + ret = toupper((signed char)0xf0); + ok(ret == (signed char)0xf0, "Got %#x.\n", ret); + ok(errno == EILSEQ, "Got errno %d.\n", errno); + errno = 0xdeadbeef; + ret = toupper(0xf0); + todo_wine ok(ret == 0xf0, "Got %#x.\n", ret); + ok(errno == 0xdeadbeef, "Got errno %d.\n", errno); + + ok(setlocale(LC_ALL, "Chinese_China.936") != NULL, "setlocale failed.\n"); + errno = 0xdeadbeef; + ret = toupper((signed char)0xf0); + ok(ret == (signed char)0xf0, "Got %#x.\n", ret); + ok(errno == EILSEQ, "Got errno %d.\n", errno); + errno = 0xdeadbeef; + ret = toupper(0xf0); + todo_wine ok(ret == 0xf0, "Got %#x.\n", ret); + ok(errno == 0xdeadbeef, "Got errno %d.\n", errno); + + setlocale(LC_ALL, "C"); +} + START_TEST(string) { char mem[100]; @@ -5139,4 +5186,5 @@ START_TEST(string) test_mbsrev(); test__tolower_l(); test__strnicmp_l(); + test_toupper(); }