sync msvcrt_winetest with wine 1.1.35
authorChristoph von Wittich <christoph_vw@reactos.org>
Tue, 22 Dec 2009 11:46:36 +0000 (11:46 +0000)
committerChristoph von Wittich <christoph_vw@reactos.org>
Tue, 22 Dec 2009 11:46:36 +0000 (11:46 +0000)
svn path=/trunk/; revision=44707

rostests/winetests/msvcrt/cpp.c
rostests/winetests/msvcrt/file.c
rostests/winetests/msvcrt/msvcrt.rbuild
rostests/winetests/msvcrt/signal.c [new file with mode: 0644]
rostests/winetests/msvcrt/string.c
rostests/winetests/msvcrt/testlist.c

index d640d67..106ef73 100644 (file)
@@ -1032,6 +1032,8 @@ static void test_demangle(void)
 /* 111 */ {"?f@T@@QAEHQCY1BE@BO@D@Z", "public: int __thiscall T::f(char (volatile * const)[20][30])"},
 /* 112 */ {"?f@T@@QAEHQAY2BE@BO@CI@D@Z", "public: int __thiscall T::f(char (* const)[20][30][40])"},
 /* 113 */ {"?f@T@@QAEHQAY1BE@BO@$$CBD@Z", "public: int __thiscall T::f(char const (* const)[20][30])"},
 /* 111 */ {"?f@T@@QAEHQCY1BE@BO@D@Z", "public: int __thiscall T::f(char (volatile * const)[20][30])"},
 /* 112 */ {"?f@T@@QAEHQAY2BE@BO@CI@D@Z", "public: int __thiscall T::f(char (* const)[20][30][40])"},
 /* 113 */ {"?f@T@@QAEHQAY1BE@BO@$$CBD@Z", "public: int __thiscall T::f(char const (* const)[20][30])"},
+/* 114 */ {"??0?$Foo@U?$vector_c@H$00$01$0?1$0A@$0A@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@$0HPPPPPPP@@mpl@boost@@@@QAE@XZ",
+           "public: __thiscall Foo<struct boost::mpl::vector_c<int,1,2,-2,0,0,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647> >::Foo<struct boost::mpl::vector_c<int,1,2,-2,0,0,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647,2147483647> >(void)"},
 
     };
     int i, num_test = (sizeof(test)/sizeof(test[0]));
 
     };
     int i, num_test = (sizeof(test)/sizeof(test[0]));
index e652985..e164555 100644 (file)
@@ -439,6 +439,7 @@ static void test_fgetc( void )
   ok(ich == ret, "Second fgetc expected %x got %x\n", ich, ret);
   fclose(tempfh);
   unlink(tempf);
   ok(ich == ret, "Second fgetc expected %x got %x\n", ich, ret);
   fclose(tempfh);
   unlink(tempf);
+  free(tempf);
 }
 
 static void test_fputc( void )
 }
 
 static void test_fputc( void )
@@ -463,6 +464,7 @@ static void test_fputc( void )
   fclose(tempfh);
 
   unlink(tempf);
   fclose(tempfh);
 
   unlink(tempf);
+  free(tempf);
 }
 
 static void test_flsbuf( void )
 }
 
 static void test_flsbuf( void )
@@ -517,6 +519,7 @@ static void test_flsbuf( void )
   fclose(tempfh);
 
   unlink(tempf);
   fclose(tempfh);
 
   unlink(tempf);
+  free(tempf);
 }
 
 static void test_fgetwc( void )
 }
 
 static void test_fgetwc( void )
@@ -634,6 +637,7 @@ static void test_fgetwc( void )
   free(mytextW);
   fclose(tempfh);
   unlink(tempf);
   free(mytextW);
   fclose(tempfh);
   unlink(tempf);
+  free(tempf);
 }
 
 static void test_ctrlz( void )
 }
 
 static void test_ctrlz( void )
@@ -681,6 +685,7 @@ static void test_ctrlz( void )
   ok(feof(tempfh), "did not get EOF\n");
   fclose(tempfh);
   unlink(tempf);
   ok(feof(tempfh), "did not get EOF\n");
   fclose(tempfh);
   unlink(tempf);
+  free(tempf);
 }
 
 static void test_file_put_get( void )
 }
 
 static void test_file_put_get( void )
@@ -730,6 +735,7 @@ static void test_file_put_get( void )
   free(mytextW);
   fclose(tempfh);
   unlink(tempf);
   free(mytextW);
   fclose(tempfh);
   unlink(tempf);
+  free(tempf);
 }
 
 static void test_file_write_read( void )
 }
 
 static void test_file_write_read( void )
@@ -806,6 +812,7 @@ static void test_file_write_read( void )
 
   ret = unlink(tempf);
   ok( ret == 0 ,"Can't unlink '%s': %d\n", tempf, errno);
 
   ret = unlink(tempf);
   ok( ret == 0 ,"Can't unlink '%s': %d\n", tempf, errno);
+  free(tempf);
 
   tempf=_tempnam(".","wne");
   tempfd = _open(tempf,_O_CREAT|_O_TRUNC|_O_BINARY|_O_RDWR,0);
 
   tempf=_tempnam(".","wne");
   tempfd = _open(tempf,_O_CREAT|_O_TRUNC|_O_BINARY|_O_RDWR,0);
@@ -833,6 +840,7 @@ static void test_file_write_read( void )
      "Can't chmod '%s' to read-write: %d\n", tempf, errno);
   ret = unlink(tempf);
   ok( ret == 0 ,"Can't unlink '%s': %d\n", tempf, errno);
      "Can't chmod '%s' to read-write: %d\n", tempf, errno);
   ret = unlink(tempf);
   ok( ret == 0 ,"Can't unlink '%s': %d\n", tempf, errno);
+  free(tempf);
 }
 
 static void test_file_inherit_child(const char* fd_s)
 }
 
 static void test_file_inherit_child(const char* fd_s)
@@ -1080,6 +1088,7 @@ static void test_chsize( void )
 
     _close( fd );
     _unlink( tempfile );
 
     _close( fd );
     _unlink( tempfile );
+    free( tempfile );
 }
 
 static void test_fopen_fclose_fcloseall( void )
 }
 
 static void test_fopen_fclose_fcloseall( void )
index ca047fa..1657252 100644 (file)
@@ -29,6 +29,7 @@
        <file>heap.c</file>
        <file>printf.c</file>
        <file>scanf.c</file>
        <file>heap.c</file>
        <file>printf.c</file>
        <file>scanf.c</file>
+       <file>signal.c</file>
        <file>string.c</file>
        <file>testlist.c</file>
        <file>time.c</file>
        <file>string.c</file>
        <file>testlist.c</file>
        <file>time.c</file>
diff --git a/rostests/winetests/msvcrt/signal.c b/rostests/winetests/msvcrt/signal.c
new file mode 100644 (file)
index 0000000..d33498b
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Unit test suite for signal function.
+ *
+ * Copyright 2009 Peter Rosin
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "wine/test.h"
+#include <winbase.h>
+#include <signal.h>
+
+static int test_value = 0;
+
+static void __cdecl sighandler(int signum)
+{
+    ++test_value;
+}
+
+static void test_signal(void)
+{
+    void (__cdecl *old)(int);
+    int res;
+
+    old = signal(SIGBREAK, sighandler);
+    ok(old != SIG_ERR, "Failed to install signal handler for SIGBREAK\n");
+    test_value = 0;
+    res = raise(SIGBREAK);
+    ok(res == 0, "Failed to raise SIGBREAK\n");
+    ok(test_value == 1, "SIGBREAK handler not invoked\n");
+}
+
+START_TEST(signal)
+{
+    test_signal();
+}
index fc2ad3c..8544735 100644 (file)
@@ -51,6 +51,7 @@ static int (__cdecl *pstrcpy_s)(char *dst, size_t len, const char *src);
 static int (__cdecl *pstrcat_s)(char *dst, size_t len, const char *src);
 static int (__cdecl *p_mbsnbcpy_s)(unsigned char * dst, size_t size, const unsigned char * src, size_t count);
 static int (__cdecl *p_wcscpy_s)(wchar_t *wcDest, size_t size, const wchar_t *wcSrc);
 static int (__cdecl *pstrcat_s)(char *dst, size_t len, const char *src);
 static int (__cdecl *p_mbsnbcpy_s)(unsigned char * dst, size_t size, const unsigned char * src, size_t count);
 static int (__cdecl *p_wcscpy_s)(wchar_t *wcDest, size_t size, const wchar_t *wcSrc);
+static int (__cdecl *p_wcsupr_s)(wchar_t *str, size_t size);
 static int *p__mb_cur_max;
 static unsigned char *p_mbctype;
 
 static int *p__mb_cur_max;
 static unsigned char *p_mbctype;
 
@@ -597,6 +598,93 @@ static void test_wcscpy_s(void)
     ok(szDestShort[0] == 0, "szDestShort[0] not 0\n");
 }
 
     ok(szDestShort[0] == 0, "szDestShort[0] not 0\n");
 }
 
+static void test__wcsupr_s(void)
+{
+    static const WCHAR mixedString[] = {'M', 'i', 'X', 'e', 'D', 'l', 'o', 'w',
+                                        'e', 'r', 'U', 'P', 'P', 'E', 'R', 0};
+    static const WCHAR expectedString[] = {'M', 'I', 'X', 'E', 'D', 'L', 'O',
+                                           'W', 'E', 'R', 'U', 'P', 'P', 'E',
+                                           'R', 0};
+    WCHAR testBuffer[2*sizeof(mixedString)/sizeof(WCHAR)];
+    int ret;
+
+    if (!p_wcsupr_s)
+    {
+        win_skip("_wcsupr_s not found\n");
+        return;
+    }
+
+    /* Test NULL input string and invalid size. */
+    errno = EBADF;
+    ret = p_wcsupr_s(NULL, 0);
+    ok(ret == EINVAL, "Expected _wcsupr_s to fail with EINVAL, got %d\n", ret);
+    ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
+
+    /* Test NULL input string and valid size. */
+    errno = EBADF;
+    ret = p_wcsupr_s(NULL, sizeof(testBuffer)/sizeof(WCHAR));
+    ok(ret == EINVAL, "Expected _wcsupr_s to fail with EINVAL, got %d\n", ret);
+    ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
+
+    /* Test empty string with zero size. */
+    errno = EBADF;
+    testBuffer[0] = '\0';
+    ret = p_wcsupr_s(testBuffer, 0);
+    ok(ret == EINVAL, "Expected _wcsupr_s to fail with EINVAL, got %d\n", ret);
+    ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
+    ok(testBuffer[0] == '\0', "Expected the buffer to be unchanged\n");
+
+    /* Test empty string with size of one. */
+    testBuffer[0] = '\0';
+    ret = p_wcsupr_s(testBuffer, 1);
+    ok(ret == 0, "Expected _wcsupr_s to succeed, got %d\n", ret);
+    ok(testBuffer[0] == '\0', "Expected the buffer to be unchanged\n");
+
+    /* Test one-byte buffer with zero size. */
+    errno = EBADF;
+    testBuffer[0] = 'x';
+    ret = p_wcsupr_s(testBuffer, 0);
+    ok(ret == EINVAL, "Expected _wcsupr_s to fail with EINVAL, got %d\n", ret);
+    ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
+    ok(testBuffer[0] == '\0', "Expected the first buffer character to be null\n");
+
+    /* Test one-byte buffer with size of one. */
+    errno = EBADF;
+    testBuffer[0] = 'x';
+    ret = p_wcsupr_s(testBuffer, 1);
+    ok(ret == EINVAL, "Expected _wcsupr_s to fail with EINVAL, got %d\n", ret);
+    ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
+    ok(testBuffer[0] == '\0', "Expected the first buffer character to be null\n");
+
+    /* Test invalid size. */
+    wcscpy(testBuffer, mixedString);
+    errno = EBADF;
+    ret = p_wcsupr_s(testBuffer, 0);
+    ok(ret == EINVAL, "Expected _wcsupr_s to fail with EINVAL, got %d\n", ret);
+    ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
+    ok(testBuffer[0] == '\0', "Expected the first buffer character to be null\n");
+
+    /* Test normal string uppercasing. */
+    wcscpy(testBuffer, mixedString);
+    ret = p_wcsupr_s(testBuffer, sizeof(mixedString)/sizeof(WCHAR));
+    ok(ret == 0, "Expected _wcsupr_s to succeed, got %d\n", ret);
+    ok(!wcscmp(testBuffer, expectedString), "Expected the string to be fully upper-case\n");
+
+    /* Test uppercasing with a shorter buffer size count. */
+    wcscpy(testBuffer, mixedString);
+    errno = EBADF;
+    ret = p_wcsupr_s(testBuffer, sizeof(mixedString)/sizeof(WCHAR) - 1);
+    ok(ret == EINVAL, "Expected _wcsupr_s to fail with EINVAL, got %d\n", ret);
+    ok(errno == EINVAL, "Expected errno to be EINVAL, got %d\n", errno);
+    ok(testBuffer[0] == '\0', "Expected the first buffer character to be null\n");
+
+    /* Test uppercasing with a longer buffer size count. */
+    wcscpy(testBuffer, mixedString);
+    ret = p_wcsupr_s(testBuffer, sizeof(testBuffer)/sizeof(WCHAR));
+    ok(ret == 0, "Expected _wcsupr_s to succeed, got %d\n", ret);
+    ok(!wcscmp(testBuffer, expectedString), "Expected the string to be fully upper-case\n");
+}
+
 static void test_mbcjisjms(void)
 {
     /* List of value-pairs to test. The test assumes the last pair to be {0, ..} */
 static void test_mbcjisjms(void)
 {
     /* List of value-pairs to test. The test assumes the last pair to be {0, ..} */
@@ -721,6 +809,7 @@ START_TEST(string)
     pstrcat_s = (void *)GetProcAddress( hMsvcrt,"strcat_s" );
     p_mbsnbcpy_s = (void *)GetProcAddress( hMsvcrt,"_mbsnbcpy_s" );
     p_wcscpy_s = (void *)GetProcAddress( hMsvcrt,"wcscpy_s" );
     pstrcat_s = (void *)GetProcAddress( hMsvcrt,"strcat_s" );
     p_mbsnbcpy_s = (void *)GetProcAddress( hMsvcrt,"_mbsnbcpy_s" );
     p_wcscpy_s = (void *)GetProcAddress( hMsvcrt,"wcscpy_s" );
+    p_wcsupr_s = (void *)GetProcAddress( hMsvcrt,"_wcsupr_s" );
 
     /* MSVCRT memcpy behaves like memmove for overlapping moves,
        MFC42 CString::Insert seems to rely on that behaviour */
 
     /* MSVCRT memcpy behaves like memmove for overlapping moves,
        MFC42 CString::Insert seems to rely on that behaviour */
@@ -746,5 +835,6 @@ START_TEST(string)
     test_mbcjisjms();
     test_strtok();
     test_wcscpy_s();
     test_mbcjisjms();
     test_strtok();
     test_wcscpy_s();
+    test__wcsupr_s();
     test_strtol();
 }
     test_strtol();
 }
index db41945..4bd436d 100644 (file)
@@ -15,6 +15,7 @@ extern void func_headers(void);
 extern void func_heap(void);
 extern void func_printf(void);
 extern void func_scanf(void);
 extern void func_heap(void);
 extern void func_printf(void);
 extern void func_scanf(void);
+extern void func_signal(void);
 extern void func_string(void);
 extern void func_time(void);
 
 extern void func_string(void);
 extern void func_time(void);
 
@@ -29,6 +30,7 @@ const struct test winetest_testlist[] =
     { "heap", func_heap },
     { "printf", func_printf },
     { "scanf", func_scanf },
     { "heap", func_heap },
     { "printf", func_printf },
     { "scanf", func_scanf },
+       { "signal", func_signal },
     { "string", func_string },
     { "time", func_time },
     { 0, 0 }
     { "string", func_string },
     { "time", func_time },
     { 0, 0 }