Author: akhaldi
Date: Tue Mar 10 10:10:35 2015
New Revision: 66659
URL:
http://svn.reactos.org/svn/reactos?rev=66659&view=rev
Log:
[MSVCRT_WINETEST] Sync with Wine Staging 1.7.37. CORE-9246
Modified:
trunk/rostests/winetests/msvcrt/file.c
trunk/rostests/winetests/msvcrt/headers.c
trunk/rostests/winetests/msvcrt/printf.c
trunk/rostests/winetests/msvcrt/string.c
Modified: trunk/rostests/winetests/msvcrt/file.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msvcrt/file.c?r…
==============================================================================
--- trunk/rostests/winetests/msvcrt/file.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/msvcrt/file.c [iso-8859-1] Tue Mar 10 10:10:35 2015
@@ -2244,6 +2244,7 @@
char *inbuffer;
char *outbuffer;
int size, fd;
+ fpos_t pos, pos2;
fd = fileno(file);
inbuffer = calloc(bufsize + 1, 1);
@@ -2275,6 +2276,19 @@
fseek(file, 0, SEEK_SET);
ok(fread(inbuffer, 1, bufsize, file) == bufsize, "read failed\n");
ok(memcmp(outbuffer, inbuffer, bufsize) != 0, "unexpected flush by %d/2 byte
double write\n", bufsize);
+
+ ok(!fseek(file, -1, SEEK_END), "fseek failed\n");
+ ok(!fgetpos(file, &pos), "fgetpos failed\n");
+ ok(fread(inbuffer, 1, 1, file) == 1, "fread failed\n");
+ ok(file->_flag & _IOREAD, "file->_flag = %x\n", file->_flag);
+ ok(!file->_cnt, "file->_cnt = %d\n", file->_cnt);
+ ok(file->_ptr != file->_base, "file->_ptr == file->_base\n");
+ ok(fwrite(outbuffer, 1, bufsize, file), "fwrite failed\n");
+ ok(file->_flag & _IOREAD, "file->_flag = %x\n", file->_flag);
+ ok(!file->_cnt, "file->_cnt = %d\n", file->_cnt);
+ ok(file->_ptr == file->_base, "file->_ptr == file->_base\n");
+ ok(!fgetpos(file, &pos2), "fgetpos failed\n");
+ ok(pos+bufsize+1 == pos2, "pos = %d (%d)\n", (int)pos, (int)pos2);
free(inbuffer);
free(outbuffer);
}
Modified: trunk/rostests/winetests/msvcrt/headers.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msvcrt/headers.…
==============================================================================
--- trunk/rostests/winetests/msvcrt/headers.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/msvcrt/headers.c [iso-8859-1] Tue Mar 10 10:10:35 2015
@@ -66,11 +66,10 @@
#define TYPEOF(type) int
#endif
#define MSVCRT(x) MSVCRT_##x
-#define OFFSET(T,F) ((unsigned int)((char *)&((struct T *)0L)->F - (char *)0L))
#define CHECK_SIZE(e) ok(sizeof(e) == sizeof(MSVCRT(e)), "Element has different
sizes\n")
#define CHECK_TYPE(t) { TYPEOF(t) a = 0; TYPEOF(MSVCRT(t)) b = a; a = b; CHECK_SIZE(t);
}
#define CHECK_STRUCT(s) ok(sizeof(struct s) == sizeof(struct MSVCRT(s)), "Struct has
different sizes\n")
-#define CHECK_FIELD(s,e) ok(OFFSET(s,e) == OFFSET(MSVCRT(s),e), "Bad
offset\n")
+#define CHECK_FIELD(s,e) ok(offsetof(struct s,e) == offsetof(struct MSVCRT(s),e),
"Bad offset\n")
#define CHECK_DEF(d) ok(d == MSVCRT_##d, "Defines (MSVCRT_)" #d " are
different: %d vs. %d\n", d, MSVCRT_##d)
/************* Checking types ***************/
Modified: trunk/rostests/winetests/msvcrt/printf.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msvcrt/printf.c…
==============================================================================
--- trunk/rostests/winetests/msvcrt/printf.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/msvcrt/printf.c [iso-8859-1] Tue Mar 10 10:10:35 2015
@@ -1127,6 +1127,12 @@
ok( ret == 11, "got %d expected 11\n", ret );
WideCharToMultiByte( CP_ACP, 0, str, -1, buf, sizeof(buf), NULL, NULL );
ok( !strcmp(buf, "onetwothree"), "got %s expected
'onetwothree'\n", buf );
+
+ ret = _vsnwprintf_wrapper( str, 0, format, one, two, three );
+ ok( ret == -1, "got %d, expected -1\n", ret );
+
+ ret = _vsnwprintf_wrapper( NULL, 0, format, one, two, three );
+ ok( ret == 11 || broken(ret == -1 /* Win2k */), "got %d, expected 11\n",
ret );
}
static int __cdecl vswprintf_wrapper(wchar_t *str, const wchar_t *format, ...)
Modified: trunk/rostests/winetests/msvcrt/string.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/msvcrt/string.c…
==============================================================================
--- trunk/rostests/winetests/msvcrt/string.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/msvcrt/string.c [iso-8859-1] Tue Mar 10 10:10:35 2015
@@ -89,7 +89,10 @@
static size_t (__cdecl *p_mbrlen)(const char*, size_t, mbstate_t*);
static size_t (__cdecl *p_mbrtowc)(wchar_t*, const char*, size_t, mbstate_t*);
static int (__cdecl *p__atodbl_l)(_CRT_DOUBLE*,char*,_locale_t);
+static double (__cdecl *p__atof_l)(const char*,_locale_t);
+static double (__cdecl *p__strtod_l)(const char *,char**,_locale_t);
static int (__cdecl *p__strnset_s)(char*,size_t,int,size_t);
+static int (__cdecl *p__wcsset_s)(wchar_t*,size_t,wchar_t);
#define SETNOFAIL(x,y) x = (void*)GetProcAddress(hMsvcrt,y)
#define SET(x,y) SETNOFAIL(x,y); ok(x != NULL, "Export '%s' not
found\n", y)
@@ -1579,6 +1582,28 @@
ok(almost_equal(d, 0), "d = %lf\n", d);
ok(end == white_chars, "incorrect end (%d)\n", (int)(end-white_chars));
+ if (!p__strtod_l)
+ win_skip("_strtod_l not found\n");
+ else
+ {
+ errno = EBADF;
+ d = strtod(NULL, NULL);
+ ok(almost_equal(d, 0.0), "d = %lf\n", d);
+ ok(errno == EINVAL, "errno = %x\n", errno);
+
+ errno = EBADF;
+ end = (char *)0xdeadbeef;
+ d = strtod(NULL, &end);
+ ok(almost_equal(d, 0.0), "d = %lf\n", d);
+ ok(errno == EINVAL, "errno = %x\n", errno);
+ ok(!end, "incorrect end ptr %p\n", end);
+
+ errno = EBADF;
+ d = p__strtod_l(NULL, NULL, NULL);
+ ok(almost_equal(d, 0.0), "d = %lf\n", d);
+ ok(errno == EINVAL, "errno = %x\n", errno);
+ }
+
/* Set locale with non '.' decimal point (',') */
if(!setlocale(LC_ALL, "Polish")) {
win_skip("system with limited locales\n");
@@ -2622,6 +2647,36 @@
ok(r == 0, "atoi(4294967296) = %d\n", r);
}
+static void test_atof(void)
+{
+ double d;
+
+ d = atof("0.0");
+ ok(almost_equal(d, 0.0), "d = %lf\n", d);
+
+ d = atof("1.0");
+ ok(almost_equal(d, 1.0), "d = %lf\n", d);
+
+ d = atof("-1.0");
+ ok(almost_equal(d, -1.0), "d = %lf\n", d);
+
+ if (!p__atof_l)
+ {
+ win_skip("_atof_l not found\n");
+ return;
+ }
+
+ errno = EBADF;
+ d = atof(NULL);
+ ok(almost_equal(d, 0.0), "d = %lf\n", d);
+ ok(errno == EINVAL, "errno = %x\n", errno);
+
+ errno = EBADF;
+ d = p__atof_l(NULL, NULL);
+ ok(almost_equal(d, 0.0), "d = %lf\n", d);
+ ok(errno == EINVAL, "errno = %x\n", errno);
+}
+
static void test_strncpy(void)
{
#define TEST_STRNCPY_LEN 10
@@ -2747,6 +2802,40 @@
r = p__strnset_s(buf, sizeof(buf)-1, 'c', 2);
ok(r == EINVAL, "r = %d\n", r);
ok(!buf[0] && buf[1]=='c' && buf[2]=='b', "buf =
%s\n", buf);
+}
+
+static void test__wcsset_s(void)
+{
+ wchar_t str[10];
+ int r;
+
+ if(!p__wcsset_s) {
+ win_skip("_wcsset_s not available\n");
+ return;
+ }
+
+ r = p__wcsset_s(NULL, 0, 'a');
+ ok(r == EINVAL, "r = %d\n", r);
+
+ str[0] = 'a';
+ r = p__wcsset_s(str, 0, 'a');
+ ok(r == EINVAL, "r = %d\n", r);
+ ok(str[0] == 'a', "str[0] = %d\n", str[0]);
+
+ str[0] = 'a';
+ str[1] = 'b';
+ r = p__wcsset_s(str, 2, 'c');
+ ok(r == EINVAL, "r = %d\n", r);
+ ok(!str[0], "str[0] = %d\n", str[0]);
+ ok(str[1] == 'b', "str[1] = %d\n", str[1]);
+
+ str[0] = 'a';
+ str[1] = 0;
+ str[2] = 'b';
+ r = p__wcsset_s(str, 3, 'c');
+ ok(str[0] == 'c', "str[0] = %d\n", str[0]);
+ ok(str[1] == 0, "str[1] = %d\n", str[1]);
+ ok(str[2] == 'b', "str[2] = %d\n", str[2]);
}
START_TEST(string)
@@ -2796,7 +2885,10 @@
p_mbrtowc = (void*)GetProcAddress(hMsvcrt, "mbrtowc");
p_mbsrtowcs = (void*)GetProcAddress(hMsvcrt, "mbsrtowcs");
p__atodbl_l = (void*)GetProcAddress(hMsvcrt, "_atodbl_l");
+ p__atof_l = (void*)GetProcAddress(hMsvcrt, "_atof_l");
+ p__strtod_l = (void*)GetProcAddress(hMsvcrt, "_strtod_l");
p__strnset_s = (void*)GetProcAddress(hMsvcrt, "_strnset_s");
+ p__wcsset_s = (void*)GetProcAddress(hMsvcrt, "_wcsset_s");
/* MSVCRT memcpy behaves like memmove for overlapping moves,
MFC42 CString::Insert seems to rely on that behaviour */
@@ -2848,7 +2940,9 @@
test__stricmp();
test__wcstoi64();
test_atoi();
+ test_atof();
test_strncpy();
test_strxfrm();
test__strnset_s();
-}
+ test__wcsset_s();
+}