Piotr Caban : msvcrt/tests: Added __crtGetStringTypeW tests.
Alexandre Julliard
julliard at winehq.org
Mon Apr 19 11:51:17 CDT 2010
Module: wine
Branch: master
Commit: 0d79b4b6539a1e162a24c00e727e8a3cbc11391a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=0d79b4b6539a1e162a24c00e727e8a3cbc11391a
Author: Piotr Caban <piotr at codeweavers.com>
Date: Mon Apr 19 10:58:40 2010 +0200
msvcrt/tests: Added __crtGetStringTypeW tests.
---
dlls/msvcrt/tests/locale.c | 61 ++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 61 insertions(+), 0 deletions(-)
diff --git a/dlls/msvcrt/tests/locale.c b/dlls/msvcrt/tests/locale.c
index ce44347..45ab9b7 100644
--- a/dlls/msvcrt/tests/locale.c
+++ b/dlls/msvcrt/tests/locale.c
@@ -19,7 +19,20 @@
*/
#include <locale.h>
+
#include "wine/test.h"
+#include "winnls.h"
+
+static BOOL (__cdecl *p__crtGetStringTypeW)(DWORD, DWORD, const wchar_t*, int, WORD*);
+static int (__cdecl *pmemcpy_s)(void *, size_t, void*, size_t);
+
+static void init(void)
+{
+ HMODULE hmod = GetModuleHandleA("msvcrt.dll");
+
+ p__crtGetStringTypeW = (void*)GetProcAddress(hmod, "__crtGetStringTypeW");
+ pmemcpy_s = (void*)GetProcAddress(hmod, "memcpy_s");
+}
static void test_setlocale(void)
{
@@ -75,7 +88,55 @@ static void test_setlocale(void)
ok(!strcmp(ret, "English_United States.1252"), "ret = %s\n", ret);
}
+static void test_crtGetStringTypeW(void)
+{
+ static const wchar_t str0[] = { '0', '\0' };
+ static const wchar_t strA[] = { 'A', '\0' };
+ static const wchar_t str_space[] = { ' ', '\0' };
+ static const wchar_t str_null[] = { '\0', '\0' };
+ static const wchar_t str_rand[] = { 1234, '\0' };
+
+ const wchar_t *str[] = { str0, strA, str_space, str_null, str_rand };
+
+ WORD out_crt, out;
+ BOOL ret_crt, ret;
+ int i;
+
+ if(!p__crtGetStringTypeW) {
+ win_skip("Skipping __crtGetStringTypeW tests\n");
+ return;
+ }
+
+ if(!pmemcpy_s) {
+ win_skip("To old version of msvcrt.dll\n");
+ return;
+ }
+
+ for(i=0; i<sizeof(str)/sizeof(*str); i++) {
+ ret_crt = p__crtGetStringTypeW(0, CT_CTYPE1, str[i], 1, &out_crt);
+ ret = GetStringTypeW(CT_CTYPE1, str[i], 1, &out);
+ ok(ret == ret_crt, "%d) ret_crt = %d\n", i, (int)ret_crt);
+ ok(out == out_crt, "%d) out_crt = %x, expected %x\n", i, (int)out_crt, (int)out);
+
+ ret_crt = p__crtGetStringTypeW(0, CT_CTYPE2, str[i], 1, &out_crt);
+ ret = GetStringTypeW(CT_CTYPE2, str[i], 1, &out);
+ ok(ret == ret_crt, "%d) ret_crt = %d\n", i, (int)ret_crt);
+ ok(out == out_crt, "%d) out_crt = %x, expected %x\n", i, (int)out_crt, (int)out);
+
+ ret_crt = p__crtGetStringTypeW(0, CT_CTYPE3, str[i], 1, &out_crt);
+ ret = GetStringTypeW(CT_CTYPE3, str[i], 1, &out);
+ ok(ret == ret_crt, "%d) ret_crt = %d\n", i, (int)ret_crt);
+ ok(out == out_crt, "%d) out_crt = %x, expected %x\n", i, (int)out_crt, (int)out);
+ }
+
+ ret = p__crtGetStringTypeW(0, 3, str[0], 1, &out);
+ ok(!ret, "ret == TRUE\n");
+}
+
START_TEST(locale)
{
+ init();
+
+ test_crtGetStringTypeW();
test_setlocale();
}
More information about the wine-cvs
mailing list