Commit 9a7cb34d authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt/tests: Add _strupr tests.

parent 52415cab
......@@ -3346,6 +3346,49 @@ static void test__memicmp_l(void)
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)
{
char mem[100];
......@@ -3468,4 +3511,5 @@ START_TEST(string)
test__ismbclx();
test__memicmp();
test__memicmp_l();
test__strupr();
}
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