[CRT_APITEST]
authorTimo Kreuzer <timo.kreuzer@reactos.org>
Tue, 30 Sep 2014 21:10:15 +0000 (21:10 +0000)
committerTimo Kreuzer <timo.kreuzer@reactos.org>
Tue, 30 Sep 2014 21:10:15 +0000 (21:10 +0000)
Fix some tests based on Windows 2003 SP1 behavior. Patch by Victor Martinez.

svn path=/trunk/; revision=64425

rostests/apitests/crt/_vsnprintf.c
rostests/apitests/crt/_vsnwprintf.c

index 722e8eb..52a9179 100644 (file)
@@ -31,37 +31,54 @@ START_TEST(_vsnprintf)
     call_varargs(buffer, 255, 12, "%S world!", L"hello");
     call_varargs(buffer, 255, 12, "%s world!", "hello");
     call_varargs(buffer, 255, 11, "%u cookies", 100);
-    /* This is how WINE implements _vcsprintf, and they are obviously wrong */
+
     StartSeh()
+#if defined(TEST_CRTDLL)||defined(TEST_USER32)
         call_varargs(NULL, INT_MAX, -1, "%s it really work?", "does");
-#if defined(TEST_CRTDLL) || defined(TEST_USER32)
+#else
+        call_varargs(NULL, INT_MAX, 20, "%s it really work?", "does");
+#endif
+
+#if defined(TEST_CRTDLL)||defined(TEST_USER32)
     EndSeh(STATUS_ACCESS_VIOLATION);
 #else
     EndSeh(STATUS_SUCCESS);
 #endif
-#if defined(TEST_MSVCRT) /* NTDLL doesn't use/set errno */
+
+#if defined(TEST_USER32) /* NTDLL doesn't use/set errno */
     ok(errno == EINVAL, "Expected EINVAL, got %u\n", errno);
+#else
+    ok(errno == 0, "Expected 0, got %u \n", errno);
 #endif
+
     /* This one is no better */
     StartSeh()
+#if defined(TEST_CRTDLL)||defined(TEST_USER32)
         call_varargs(NULL, 0, -1, "%s it really work?", "does");
-#if defined(TEST_CRTDLL) || defined(TEST_USER32)
-    EndSeh(STATUS_ACCESS_VIOLATION);
 #else
+        call_varargs(NULL, 0, 20, "%s it really work?", "does");
+#endif
+
+#if defined(TEST_USER32)
+    EndSeh(STATUS_ACCESS_VIOLATION);
+#else 
     EndSeh(STATUS_SUCCESS);
 #endif
-#if defined(TEST_MSVCRT) /* NTDLL doesn't use/set errno */
+
+#if defined(TEST_USER32) /* NTDLL doesn't use/set errno */
     ok(errno == EINVAL, "Expected EINVAL, got %u\n", errno);
+#else
+    ok(errno == 0, "Expected 0, got %u \n", errno);
 #endif
+
     /* One more NULL checks */
     StartSeh()
         call_varargs(buffer, 255, -1, NULL);
-#if defined(TEST_CRTDLL)
     EndSeh(STATUS_ACCESS_VIOLATION);
-#else
-    EndSeh(STATUS_SUCCESS);
-#endif
-#if defined(TEST_MSVCRT) /* NTDLL doesn't use/set errno */
+
+#if defined(TEST_USER32) /* NTDLL doesn't use/set errno */
     ok(errno == EINVAL, "Expected EINVAL, got %u\n", errno);
+#else
+    ok(errno == 0, "Expected 0, got %u \n", errno);
 #endif
 }
index 4fc9f28..eb21b07 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * PROJECT:         ReactOS api tests
  * LICENSE:         GPL - See COPYING in the top level directory
- * PURPOSE:         Test for _vsnprintf
+ * PURPOSE:         Test for _vsnwprintf
  */
 
 #include <apitest.h>
@@ -28,40 +28,43 @@ START_TEST(_vsnwprintf)
     wchar_t buffer[255];
 
     /* Test basic functionality */
-    call_varargs(buffer, 255, 19, L"%s world!", "hello");
+    call_varargs(buffer, 255, 10, L"%s world!", "hello");
     call_varargs(buffer, 255, 12, L"%s world!", L"hello");
     call_varargs(buffer, 255, 11, L"%u cookies", 100);
     /* This is how WINE implements _vcsprintf, and they are obviously wrong */
     StartSeh()
-        call_varargs(NULL, INT_MAX, -1, L"%s it really work?", L"does");
 #if defined(TEST_CRTDLL)
+        call_varargs(NULL, INT_MAX, -1, L"%s it really work?", L"does");
+#else 
+        call_varargs(NULL, INT_MAX, 20, L"%s it really work?", L"does");
+#endif
+
+#if defined(TEST_USER32)
     EndSeh(STATUS_ACCESS_VIOLATION);
-#else
+#else 
     EndSeh(STATUS_SUCCESS);
 #endif
-#if defined(TEST_MSVCRT) /* NTDLL doesn't use/set errno */
+
+#if defined(TEST_USER32)/* NTDLL doesn't use/set errno */
     ok(errno == EINVAL, "Expected EINVAL, got %u\n", errno);
+#else 
+    ok(errno == 0, "Expected 0, got %u\n", errno);
 #endif
+    
     /* This one is no better */
     StartSeh()
-        call_varargs(NULL, 0, -1, L"%s it really work?", L"does");
 #if defined(TEST_CRTDLL)
-    EndSeh(STATUS_ACCESS_VIOLATION);
-#else
-    EndSeh(STATUS_SUCCESS);
-#endif
-#if defined(TEST_MSVCRT) /* NTDLL doesn't use/set errno */
-    ok(errno == EINVAL, "Expected EINVAL, got %u\n", errno);
+        call_varargs(NULL, 0, -1, L"%s it really work?", L"does");
+#else 
+        call_varargs(NULL, 0, 20, L"%s it really work?", L"does");
 #endif
+    EndSeh(STATUS_SUCCESS);
+    ok(errno == 0, "Expected 0, got %u\n", errno);
+
+
     /* One more NULL checks */
     StartSeh()
         call_varargs(buffer, 255, -1, NULL);
-#if defined(TEST_CRTDLL)
     EndSeh(STATUS_ACCESS_VIOLATION);
-#else
-    EndSeh(STATUS_SUCCESS);
-#endif
-#if defined(TEST_MSVCRT) /* NTDLL doesn't use/set errno */
-    ok(errno == EINVAL, "Expected EINVAL, got %u\n", errno);
-#endif
+    ok(errno == 0, "Expected 0, got %u\n", errno);
 }