Piotr Caban : msvcp90: Added wctrans and towctrans tests.

Alexandre Julliard julliard at winehq.org
Fri Nov 16 13:12:51 CST 2012


Module: wine
Branch: master
Commit: a497d36a62637cb022ed02e36e1bc4a09c2947da
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a497d36a62637cb022ed02e36e1bc4a09c2947da

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Fri Nov 16 10:53:47 2012 +0100

msvcp90: Added wctrans and towctrans tests.

---

 dlls/msvcp90/tests/misc.c |   37 +++++++++++++++++++++++++++++++++++++
 1 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/dlls/msvcp90/tests/misc.c b/dlls/msvcp90/tests/misc.c
index 5188fd5..2cb7380 100644
--- a/dlls/msvcp90/tests/misc.c
+++ b/dlls/msvcp90/tests/misc.c
@@ -18,6 +18,7 @@
 
 #include <stdio.h>
 #include <locale.h>
+#include <wctype.h>
 
 #include <windef.h>
 #include <winbase.h>
@@ -66,6 +67,8 @@ static char* (__cdecl *p_Copy_s)(char*, size_t, const char*, size_t);
 static unsigned short (__cdecl *p_wctype)(const char*);
 static MSVCP__Ctypevec* (__cdecl *p__Getctype)(MSVCP__Ctypevec*);
 static /*MSVCP__Collvec*/ULONGLONG (__cdecl *p__Getcoll)(void);
+static wctrans_t (__cdecl *p_wctrans)(const char*);
+static wint_t (__cdecl *p_towctrans)(wint_t, wctrans_t);
 
 #undef __thiscall
 #ifdef __i386__
@@ -188,6 +191,8 @@ static BOOL init(void)
     SET(p_wctype, "wctype");
     SET(p__Getctype, "_Getctype");
     SET(p__Getcoll, "_Getcoll");
+    SET(p_wctrans, "wctrans");
+    SET(p_towctrans, "towctrans");
     SET(basic_ostringstream_char_vbtable, "??_8?$basic_ostringstream at DU?$char_traits at D@std@@V?$allocator at D@2@@std@@7B@");
     if(sizeof(void*) == 8) { /* 64-bit initialization */
         SET(p_char_assign, "?assign@?$char_traits at D@std@@SAXAEADAEBD at Z");
@@ -440,6 +445,37 @@ static void test__Getcoll(void)
     ok(ret.collvec.page == 0, "ret.page = %x\n", ret.collvec.page);
 }
 
+static void test_towctrans(void)
+{
+    wchar_t ret;
+
+    ret = p_wctrans("tolower");
+    ok(ret == 2, "wctrans returned %d, expected 2\n", ret);
+    ret = p_wctrans("toupper");
+    ok(ret == 1, "wctrans returned %d, expected 1\n", ret);
+    ret = p_wctrans("toLower");
+    ok(ret == 0, "wctrans returned %d, expected 0\n", ret);
+    ret = p_wctrans("");
+    ok(ret == 0, "wctrans returned %d, expected 0\n", ret);
+    if(0) { /* crashes on windows */
+        ret = p_wctrans(NULL);
+        ok(ret == 0, "wctrans returned %d, expected 0\n", ret);
+    }
+
+    ret = p_towctrans('t', 2);
+    ok(ret == 't', "towctrans('t', 2) returned %c, expected t\n", ret);
+    ret = p_towctrans('T', 2);
+    ok(ret == 't', "towctrans('T', 2) returned %c, expected t\n", ret);
+    ret = p_towctrans('T', 0);
+    ok(ret == 't', "towctrans('T', 0) returned %c, expected t\n", ret);
+    ret = p_towctrans('T', 3);
+    ok(ret == 't', "towctrans('T', 3) returned %c, expected t\n", ret);
+    ret = p_towctrans('t', 1);
+    ok(ret == 'T', "towctrans('t', 1) returned %c, expected T\n", ret);
+    ret = p_towctrans('T', 1);
+    ok(ret == 'T', "towctrans('T', 1) returned %c, expected T\n", ret);
+}
+
 static void test_allocator_char(void)
 {
     void *allocator = (void*)0xdeadbeef;
@@ -525,6 +561,7 @@ START_TEST(misc)
     test_wctype();
     test__Getctype();
     test__Getcoll();
+    test_towctrans();
     test_virtual_call();
     test_virtual_base_dtors();
 




More information about the wine-cvs mailing list