msvcrt/tests: Add _strupr tests.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2018-03-22 18:51:56 +01:00 committed by Alexandre Julliard
parent 52415cabb0
commit 9a7cb34d0f
1 changed files with 44 additions and 0 deletions

View File

@ -3346,6 +3346,49 @@ static void test__memicmp_l(void)
ok(errno == 0xdeadbeef, "errno is %d, expected 0xdeadbeef\n", errno); ok(errno == 0xdeadbeef, "errno is %d, expected 0xdeadbeef\n", errno);
} }
static void test__strupr(void)
{
const char str[] = "123";
char str2[4];
char *mem, *p;
DWORD prot;
mem = VirtualAlloc(NULL, sizeof(str), MEM_COMMIT, PAGE_READWRITE);
ok(mem != NULL, "VirtualAlloc failed\n");
memcpy(mem, str, sizeof(str));
ok(VirtualProtect(mem, sizeof(str), PAGE_READONLY, &prot), "VirtualProtect failed\n");
strcpy(str2, "aBc");
p = _strupr(str2);
ok(p == str2, "_strupr returned %p\n", p);
ok(!strcmp(str2, "ABC"), "str2 = %s\n", str2);
p = _strupr(mem);
ok(p == mem, "_strupr returned %p\n", p);
ok(!strcmp(mem, "123"), "mem = %s\n", mem);
if(!setlocale(LC_ALL, "english")) {
VirtualFree(mem, sizeof(str), MEM_RELEASE);
win_skip("English locale _strupr tests\n");
return;
}
strcpy(str2, "aBc");
p = _strupr(str2);
ok(p == str2, "_strupr returned %p\n", p);
ok(!strcmp(str2, "ABC"), "str2 = %s\n", str2);
if (0) /* crashes on Windows */
{
p = _strupr(mem);
ok(p == mem, "_strupr returned %p\n", p);
ok(!strcmp(mem, "123"), "mem = %s\n", mem);
}
setlocale(LC_ALL, "C");
VirtualFree(mem, sizeof(str), MEM_RELEASE);
}
START_TEST(string) START_TEST(string)
{ {
char mem[100]; char mem[100];
@ -3468,4 +3511,5 @@ START_TEST(string)
test__ismbclx(); test__ismbclx();
test__memicmp(); test__memicmp();
test__memicmp_l(); test__memicmp_l();
test__strupr();
} }