Piotr Caban : msvcrt/tests: Add _strupr tests.
Alexandre Julliard
julliard at winehq.org
Thu Mar 22 17:08:16 CDT 2018
Module: wine
Branch: master
Commit: 9a7cb34d0fa72f2a024dd32326fd22cd1784372c
URL: https://source.winehq.org/git/wine.git/?a=commit;h=9a7cb34d0fa72f2a024dd32326fd22cd1784372c
Author: Piotr Caban <piotr at codeweavers.com>
Date: Thu Mar 22 18:51:56 2018 +0100
msvcrt/tests: Add _strupr tests.
Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/msvcrt/tests/string.c | 44 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/dlls/msvcrt/tests/string.c b/dlls/msvcrt/tests/string.c
index b270366..2e963dc 100644
--- a/dlls/msvcrt/tests/string.c
+++ b/dlls/msvcrt/tests/string.c
@@ -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();
}
More information about the wine-cvs
mailing list