Piotr Caban : msvcrt: Move invalid parameter tests to msvcr90.
Alexandre Julliard
julliard at winehq.org
Thu Apr 1 11:25:06 CDT 2010
Module: wine
Branch: master
Commit: f377e4be6b97db27d58a6da96d4867cd39fa2188
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f377e4be6b97db27d58a6da96d4867cd39fa2188
Author: Piotr Caban <piotr at codeweavers.com>
Date: Thu Apr 1 12:39:50 2010 +0200
msvcrt: Move invalid parameter tests to msvcr90.
---
dlls/msvcr90/tests/msvcr90.c | 36 ++++++++++++++++++++++++++++++++++++
dlls/msvcrt/tests/string.c | 32 --------------------------------
2 files changed, 36 insertions(+), 32 deletions(-)
diff --git a/dlls/msvcr90/tests/msvcr90.c b/dlls/msvcr90/tests/msvcr90.c
index 5fe00b2..3ff7135 100644
--- a/dlls/msvcr90/tests/msvcr90.c
+++ b/dlls/msvcr90/tests/msvcr90.c
@@ -35,6 +35,8 @@ static int *p_sys_nerr;
static int* (__cdecl *p__sys_nerr)(void);
static char **p_sys_errlist;
static char** (__cdecl *p__sys_errlist)(void);
+static __int64 (__cdecl *p_strtoi64)(const char *, char **, int);
+static unsigned __int64 (__cdecl *p_strtoui64)(const char *, char **, int);
int cb_called[4];
@@ -193,6 +195,37 @@ static void test_error_messages(void)
ok(*p_sys_errlist == *(p__sys_errlist()), "p_sys_errlist != p__sys_errlist()\n");
}
+static void test__strtoi64(void)
+{
+ __int64 res;
+ unsigned __int64 ures;
+
+ if(!p_strtoi64 || !p_strtoui64) {
+ win_skip("_strtoi64 or _strtoui64 not found\n");
+ return;
+ }
+
+ if(!p_set_invalid_parameter_handler) {
+ win_skip("_set_invalid_parameter_handler not found\n");
+ return;
+ }
+
+ errno = 0xdeadbeef;
+ res = p_strtoi64(NULL, NULL, 10);
+ ok(res == 0, "res != 0\n");
+ res = p_strtoi64("123", NULL, 1);
+ ok(res == 0, "res != 0\n");
+ res = p_strtoi64("123", NULL, 37);
+ ok(res == 0, "res != 0\n");
+ ures = p_strtoui64(NULL, NULL, 10);
+ ok(ures == 0, "res = %d\n", (int)ures);
+ ures = p_strtoui64("123", NULL, 1);
+ ok(ures == 0, "res = %d\n", (int)ures);
+ ures = p_strtoui64("123", NULL, 37);
+ ok(ures == 0, "res = %d\n", (int)ures);
+ ok(errno == 0xdeadbeef, "errno = %x\n", errno);
+}
+
/* ########## */
START_TEST(msvcr90)
@@ -219,8 +252,11 @@ START_TEST(msvcr90)
p__sys_nerr = (void *) GetProcAddress(hcrt, "__sys_nerr");
p_sys_errlist = (void *) GetProcAddress(hcrt, "_sys_errlist");
p__sys_errlist = (void *) GetProcAddress(hcrt, "__sys_errlist");
+ p_strtoi64 = (void *) GetProcAddress(hcrt, "_strtoi64");
+ p_strtoui64 = (void *) GetProcAddress(hcrt, "_strtoui64");
test__initterm_e();
test__encode_pointer();
test_error_messages();
+ test__strtoi64();
}
diff --git a/dlls/msvcrt/tests/string.c b/dlls/msvcrt/tests/string.c
index a4926d9..c873d18 100644
--- a/dlls/msvcrt/tests/string.c
+++ b/dlls/msvcrt/tests/string.c
@@ -56,7 +56,6 @@ static int (__cdecl *p_wcsupr_s)(wchar_t *str, size_t size);
static size_t (__cdecl *p_strnlen)(const char *, size_t);
static __int64 (__cdecl *p_strtoi64)(const char *, char **, int);
static unsigned __int64 (__cdecl *p_strtoui64)(const char *, char **, int);
-static _invalid_parameter_handler *p_invalid_parameter;
static int *p__mb_cur_max;
static unsigned char *p_mbctype;
@@ -65,17 +64,6 @@ static unsigned char *p_mbctype;
HMODULE hMsvcrt;
-void __cdecl test_invalid_parameter_handler(const wchar_t *expression,
- const wchar_t *function, const wchar_t *file,
- unsigned line, unsigned *res)
-{
- ok(expression == NULL, "expression is not NULL\n");
- ok(function == NULL, "function is not NULL\n");
- ok(file == NULL, "file is not NULL\n");
- ok(line == 0, "line = %u\n", line);
- ok(res == NULL, "res = %p\n", res);
-}
-
static void test_swab( void ) {
char original[] = "BADCFEHGJILKNMPORQTSVUXWZY@#";
char expected1[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ@#";
@@ -968,23 +956,6 @@ static void test__strtoi64(void)
return;
}
- if(p_invalid_parameter) {
- errno = 0xdeadbeef;
- res = p_strtoi64(NULL, NULL, 10);
- ok(res == 0, "res != 0\n");
- res = p_strtoi64(no1, NULL, 1);
- ok(res == 0, "res != 0\n");
- res = p_strtoi64(no1, NULL, 37);
- ok(res == 0, "res != 0\n");
- ures = p_strtoui64(NULL, NULL, 10);
- ok(ures == 0, "res = %d\n", (int)ures);
- ures = p_strtoui64(no1, NULL, 1);
- ok(ures == 0, "res = %d\n", (int)ures);
- ures = p_strtoui64(no1, NULL, 37);
- ok(ures == 0, "res = %d\n", (int)ures);
- ok(errno == 0xdeadbeef, "errno = %x\n", errno);
- }
-
errno = 0xdeadbeef;
res = p_strtoi64(no1, NULL, 10);
ok(res == 31923, "res != 31923\n");
@@ -1123,9 +1094,6 @@ START_TEST(string)
SET(pmemcmp,"memcmp");
SET(p_mbctype,"_mbctype");
SET(p__mb_cur_max,"__mb_cur_max");
- p_invalid_parameter = (void *)GetProcAddress( hMsvcrt,"_invalid_parameter");
- if(p_invalid_parameter)
- *p_invalid_parameter = test_invalid_parameter_handler;
pstrcpy_s = (void *)GetProcAddress( hMsvcrt,"strcpy_s" );
pstrcat_s = (void *)GetProcAddress( hMsvcrt,"strcat_s" );
p_mbsnbcpy_s = (void *)GetProcAddress( hMsvcrt,"_mbsnbcpy_s" );
More information about the wine-cvs
mailing list