summaryrefslogtreecommitdiff
path: root/src/pal/tests/palsuite/c_runtime/_vsnwprintf
diff options
context:
space:
mode:
authorJiyoung Yun <jy910.yun@samsung.com>2016-11-23 19:09:09 +0900
committerJiyoung Yun <jy910.yun@samsung.com>2016-11-23 19:09:09 +0900
commit4b4aad7217d3292650e77eec2cf4c198ea9c3b4b (patch)
tree98110734c91668dfdbb126fcc0e15ddbd93738ca /src/pal/tests/palsuite/c_runtime/_vsnwprintf
parentfa45f57ed55137c75ac870356a1b8f76c84b229c (diff)
downloadcoreclr-4b4aad7217d3292650e77eec2cf4c198ea9c3b4b.tar.gz
coreclr-4b4aad7217d3292650e77eec2cf4c198ea9c3b4b.tar.bz2
coreclr-4b4aad7217d3292650e77eec2cf4c198ea9c3b4b.zip
Imported Upstream version 1.1.0upstream/1.1.0
Diffstat (limited to 'src/pal/tests/palsuite/c_runtime/_vsnwprintf')
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/CMakeLists.txt22
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/_vsnwprintf.h133
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/test1.c60
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/test10.c50
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/test11.c50
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/test12.c50
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/test13.c50
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/test14.c63
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/test15.c64
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/test16.c63
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/test17.c65
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/test18.c65
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/test19.c139
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/test2.c40
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/test3.c40
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/test4.c121
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/test5.c81
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/test6.c43
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/test7.c43
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/test8.c49
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/test9.c49
-rw-r--r--src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/testinfo.dat14
59 files changed, 1967 insertions, 0 deletions
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/CMakeLists.txt
new file mode 100644
index 0000000000..cafb9536b0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/CMakeLists.txt
@@ -0,0 +1,22 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+add_subdirectory(test10)
+add_subdirectory(test11)
+add_subdirectory(test12)
+add_subdirectory(test13)
+add_subdirectory(test14)
+add_subdirectory(test15)
+add_subdirectory(test16)
+add_subdirectory(test17)
+add_subdirectory(test18)
+add_subdirectory(test19)
+add_subdirectory(test2)
+add_subdirectory(test3)
+add_subdirectory(test4)
+add_subdirectory(test5)
+add_subdirectory(test6)
+add_subdirectory(test7)
+add_subdirectory(test8)
+add_subdirectory(test9)
+
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/_vsnwprintf.h b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/_vsnwprintf.h
new file mode 100644
index 0000000000..a3a932f822
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/_vsnwprintf.h
@@ -0,0 +1,133 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================================
+**
+** Source: _vsnwprintf.h
+**
+** Purpose: Containts common testing functions for _vsnwprintf
+**
+**
+**==========================================================================*/
+
+#ifndef ___VSNWPRINTF_H__
+#define ___VSNWPRINTF_H__
+
+/* These functions leaks memory like crazy. C'est la vie. */
+int TestVsnwprintf(wchar_t* buf, size_t count, const wchar_t* format, ...)
+{
+ int retVal = 0;
+ va_list arglist;
+
+ va_start(arglist, format);
+ retVal = _vsnwprintf(buf, count, format, arglist);
+ va_end(arglist);
+
+ return( retVal);
+}
+
+
+void DoWStrTest(WCHAR *formatstr, WCHAR *param, WCHAR *checkstr)
+{
+ WCHAR buf[256] = { 0 };
+
+ TestVsnwprintf(buf, 256, formatstr, param);
+
+ if (memcmp(buf, checkstr, wcslen(buf) * 2 + 2) != 0)
+ {
+ Fail("ERROR: failed to insert wide string \"%s\" into \"%s\".\n"
+ "Expected \"%s\", got \"%s\".\n",
+ convertC(param), convertC(formatstr),
+ convertC(checkstr), convertC(buf));
+ }
+}
+
+void DoStrTest(WCHAR *formatstr, char *param, WCHAR *checkstr)
+{
+ WCHAR buf[256] = { 0 };
+
+ TestVsnwprintf(buf, 256, formatstr, param);
+
+ if (memcmp(buf, checkstr, wcslen(buf) * 2 + 2) != 0)
+ {
+ Fail("ERROR: failed to insert wide string \"%s\" into \"%s\".\n"
+ "Expected \"%s\", got \"%s\".\n",
+ param, convertC(formatstr), convertC(checkstr),
+ convertC(buf));
+ }
+}
+
+void DoCharTest(WCHAR *formatstr, char param, WCHAR *checkstr)
+{
+ WCHAR buf[256] = { 0 };
+
+ TestVsnwprintf(buf, 256, formatstr, param);
+ if (memcmp(buf, checkstr, wcslen(buf)*2 + 2) != 0)
+ {
+ Fail("ERROR: failed to insert char \'%c\' (%d) into \"%s\"\n"
+ "Expected \"%s\" got \"%s\".\n",
+ param, param, convertC(formatstr), convertC(checkstr),
+ convertC(buf));
+ }
+}
+
+void DoWCharTest(WCHAR *formatstr, WCHAR param, WCHAR *checkstr)
+{
+ WCHAR buf[256] = { 0 };
+
+ TestVsnwprintf(buf, 256, formatstr, param);
+ if (memcmp(buf, checkstr, wcslen(buf)*2 + 2) != 0)
+ {
+ Fail("ERROR: failed to insert wide char \'%c\' (%d) into \"%s\"\n"
+ "Expected \"%s\" got \"%s\".\n",
+ (char) param, param, convertC(formatstr),
+ convertC(checkstr), convertC(buf));
+ }
+}
+
+void DoNumTest(WCHAR *formatstr, int value, WCHAR*checkstr)
+{
+ WCHAR buf[256] = { 0 };
+
+ TestVsnwprintf(buf, 256, formatstr, value);
+ if (memcmp(buf, checkstr, wcslen(buf)* 2 + 2) != 0)
+ {
+ Fail("ERROR: failed to insert %#x into \"%s\"\n"
+ "Expected \"%s\" got \"%s\".\n", value, convertC(formatstr),
+ convertC(checkstr), convertC(buf));
+ }
+}
+
+void DoI64NumTest(WCHAR *formatstr, INT64 value, char *valuestr, WCHAR*checkstr)
+{
+ WCHAR buf[256] = { 0 };
+
+ TestVsnwprintf(buf, 256, formatstr, value);
+ if (memcmp(buf, checkstr, wcslen(buf)* 2 + 2) != 0)
+ {
+ Fail("ERROR: failed to insert %s into \"%s\"\n"
+ "Expected \"%s\" got \"%s\".\n", valuestr, convertC(formatstr),
+ convertC(checkstr), convertC(buf));
+ }
+}
+void DoDoubleTest(WCHAR *formatstr, double value,
+ WCHAR *checkstr1, WCHAR *checkstr2)
+{
+ WCHAR buf[256] = { 0 };
+
+ TestVsnwprintf(buf, 256, formatstr, value);
+ if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0 &&
+ memcmp(buf, checkstr2, wcslen(checkstr2) + 2) != 0)
+ {
+ Fail("ERROR: failed to insert %f into \"%s\"\n"
+ "Expected \"%s\" or \"%s\", got \"%s\".\n",
+ value,
+ convertC(formatstr),
+ convertC(checkstr1),
+ convertC(checkstr2),
+ convertC(buf));
+ }
+}
+
+#endif
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/CMakeLists.txt
new file mode 100644
index 0000000000..52c442d572
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test1.c
+)
+
+add_executable(paltest_vsnwprintf_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnwprintf_test1 coreclrpal)
+
+target_link_libraries(paltest_vsnwprintf_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/test1.c
new file mode 100644
index 0000000000..0238e42611
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/test1.c
@@ -0,0 +1,60 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*=====================================================================
+**
+** Source: test1.c
+**
+** Purpose: Test #1 for the _vsnwprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnwprintf.h"
+
+/* memcmp is used to verify the results, so this test is dependent on it. */
+/* ditto with wcslen */
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR *checkstr;
+ WCHAR buf[256] = { 0 };
+ int ret;
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ checkstr = convert("hello world");
+ TestVsnwprintf(buf, 256, checkstr);
+ if (memcmp(checkstr, buf, wcslen(checkstr)*2+2) != 0)
+ {
+ Fail("ERROR: Expected \"%s\", got \"%s\"\n",
+ convertC(checkstr), convertC(buf));
+ }
+
+ TestVsnwprintf(buf, 256, convert("xxxxxxxxxxxxxxxxx"));
+ ret = TestVsnwprintf(buf, 8, checkstr);
+ if (memcmp(checkstr, buf, 16) != 0)
+ {
+ Fail("ERROR: Expected \"%8s\", got \"%8s\"\n",
+ convertC(checkstr), convertC(buf));
+ }
+ if (ret >= 0)
+ {
+ Fail("ERROR: Expected negative return value, got %d.\n", ret);
+ }
+ if (buf[8] != (WCHAR) 'x')
+ {
+ Fail("ERROR: buffer overflow using \"%s\" with length 8.\n",
+ convertC(checkstr));
+ }
+
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/testinfo.dat
new file mode 100644
index 0000000000..d806fb8ed8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test1/testinfo.dat
@@ -0,0 +1,14 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = _vsnwprintf
+Name = Positive Test for _vsnwprintf
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests the PAL implementation of the _vsnwprintf function.
+= General test to see if _vsnwprintf works correctly.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/CMakeLists.txt
new file mode 100644
index 0000000000..86ea1a3160
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test10.c
+)
+
+add_executable(paltest_vsnwprintf_test10
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnwprintf_test10 coreclrpal)
+
+target_link_libraries(paltest_vsnwprintf_test10
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/test10.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/test10.c
new file mode 100644
index 0000000000..6e188e56ff
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/test10.c
@@ -0,0 +1,50 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*=====================================================================
+**
+** Source: test10.c
+**
+** Purpose: Test #10 for the _vsnwprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnwprintf.h"
+
+/* memcmp is used to verify the results, so this test is dependent on it. */
+/* ditto with wcslen */
+
+int __cdecl main(int argc, char *argv[])
+{
+ int neg = -42;
+ int pos = 42;
+ INT64 l = 42;
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoNumTest(convert("foo %o"), pos, convert("foo 52"));
+ DoNumTest(convert("foo %lo"), 0xFFFF, convert("foo 177777"));
+ DoNumTest(convert("foo %ho"), 0xFFFF, convert("foo 177777"));
+ DoNumTest(convert("foo %Lo"), pos, convert("foo 52"));
+ DoI64NumTest(convert("foo %I64o"), l, "42", convert("foo 52"));
+ DoNumTest(convert("foo %3o"), pos, convert("foo 52"));
+ DoNumTest(convert("foo %-3o"), pos, convert("foo 52 "));
+ DoNumTest(convert("foo %.1o"), pos, convert("foo 52"));
+ DoNumTest(convert("foo %.3o"), pos, convert("foo 052"));
+ DoNumTest(convert("foo %03o"), pos, convert("foo 052"));
+ DoNumTest(convert("foo %#o"), pos, convert("foo 052"));
+ DoNumTest(convert("foo %+o"), pos, convert("foo 52"));
+ DoNumTest(convert("foo % o"), pos, convert("foo 52"));
+ DoNumTest(convert("foo %+o"), neg, convert("foo 37777777726"));
+ DoNumTest(convert("foo % o"), neg, convert("foo 37777777726"));
+
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/testinfo.dat
new file mode 100644
index 0000000000..beb5b41be9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test10/testinfo.dat
@@ -0,0 +1,14 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = _vsnwprintf
+Name = Positive Test for _vsnwprintf
+TYPE = DEFAULT
+EXE1 = test10
+Description
+= Tests the PAL implementation of the _vsnwprintf function.
+= Tests _vsnwprintf with octal numbers.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/CMakeLists.txt
new file mode 100644
index 0000000000..c6011dc1de
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test11.c
+)
+
+add_executable(paltest_vsnwprintf_test11
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnwprintf_test11 coreclrpal)
+
+target_link_libraries(paltest_vsnwprintf_test11
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/test11.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/test11.c
new file mode 100644
index 0000000000..af54985bdc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/test11.c
@@ -0,0 +1,50 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*=====================================================================
+**
+** Source: test11.c
+**
+** Purpose: Test #11 for the _vsnwprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnwprintf.h"
+
+/* memcmp is used to verify the results, so this test is dependent on it. */
+/* ditto with wcslen */
+
+int __cdecl main(int argc, char *argv[])
+{
+ int neg = -42;
+ int pos = 42;
+ INT64 l = 42;
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoNumTest(convert("foo %u"), pos, convert("foo 42"));
+ DoNumTest(convert("foo %lu"), 0xFFFF, convert("foo 65535"));
+ DoNumTest(convert("foo %hu"), 0xFFFF, convert("foo 65535"));
+ DoNumTest(convert("foo %Lu"), pos, convert("foo 42"));
+ DoI64NumTest(convert("foo %I64u"), l, "42", convert("foo 42"));
+ DoNumTest(convert("foo %3u"), pos, convert("foo 42"));
+ DoNumTest(convert("foo %-3u"), pos, convert("foo 42 "));
+ DoNumTest(convert("foo %.1u"), pos, convert("foo 42"));
+ DoNumTest(convert("foo %.3u"), pos, convert("foo 042"));
+ DoNumTest(convert("foo %03u"), pos, convert("foo 042"));
+ DoNumTest(convert("foo %#u"), pos, convert("foo 42"));
+ DoNumTest(convert("foo %+u"), pos, convert("foo 42"));
+ DoNumTest(convert("foo % u"), pos, convert("foo 42"));
+ DoNumTest(convert("foo %+u"), neg, convert("foo 4294967254"));
+ DoNumTest(convert("foo % u"), neg, convert("foo 4294967254"));
+
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/testinfo.dat
new file mode 100644
index 0000000000..083b0fa5af
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test11/testinfo.dat
@@ -0,0 +1,14 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = _vsnwprintf
+Name = Positive Test for _vsnwprintf
+TYPE = DEFAULT
+EXE1 = test11
+Description
+= Tests the PAL implementation of the _vsnwprintf function.
+= Tests _vsnwprintf with unsigned numbers.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/CMakeLists.txt
new file mode 100644
index 0000000000..bd9652c2fb
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test12.c
+)
+
+add_executable(paltest_vsnwprintf_test12
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnwprintf_test12 coreclrpal)
+
+target_link_libraries(paltest_vsnwprintf_test12
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/test12.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/test12.c
new file mode 100644
index 0000000000..b593a82b4b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/test12.c
@@ -0,0 +1,50 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*=====================================================================
+**
+** Source: test12.c
+**
+** Purpose: Test #12 for the _vsnwprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnwprintf.h"
+
+/* memcmp is used to verify the results, so this test is dependent on it. */
+/* ditto with wcslen */
+
+int __cdecl main(int argc, char *argv[])
+{
+ int neg = -42;
+ int pos = 0x1234ab;
+ INT64 l = I64(0x1234567887654321);
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoNumTest(convert("foo %x"), pos, convert("foo 1234ab"));
+ DoNumTest(convert("foo %lx"), pos, convert("foo 1234ab"));
+ DoNumTest(convert("foo %hx"), pos, convert("foo 34ab"));
+ DoNumTest(convert("foo %Lx"), pos, convert("foo 1234ab"));
+ DoI64NumTest(convert("foo %I64x"), l, "0x1234567887654321",
+ convert("foo 1234567887654321"));
+ DoNumTest(convert("foo %7x"), pos, convert("foo 1234ab"));
+ DoNumTest(convert("foo %-7x"), pos, convert("foo 1234ab "));
+ DoNumTest(convert("foo %.1x"), pos, convert("foo 1234ab"));
+ DoNumTest(convert("foo %.7x"), pos, convert("foo 01234ab"));
+ DoNumTest(convert("foo %07x"), pos, convert("foo 01234ab"));
+ DoNumTest(convert("foo %#x"), pos, convert("foo 0x1234ab"));
+ DoNumTest(convert("foo %+x"), pos, convert("foo 1234ab"));
+ DoNumTest(convert("foo % x"), pos, convert("foo 1234ab"));
+ DoNumTest(convert("foo %+x"), neg, convert("foo ffffffd6"));
+ DoNumTest(convert("foo % x"), neg, convert("foo ffffffd6"));
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/testinfo.dat
new file mode 100644
index 0000000000..a4450ed8d0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test12/testinfo.dat
@@ -0,0 +1,14 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = _vsnwprintf
+Name = Positive Test for _vsnwprintf
+TYPE = DEFAULT
+EXE1 = test12
+Description
+= Tests the PAL implementation of the _vsnwprintf function.
+= Tests _vsnwprintf with hex numbers (lowercase).
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/CMakeLists.txt
new file mode 100644
index 0000000000..c608ab84e3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test13.c
+)
+
+add_executable(paltest_vsnwprintf_test13
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnwprintf_test13 coreclrpal)
+
+target_link_libraries(paltest_vsnwprintf_test13
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/test13.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/test13.c
new file mode 100644
index 0000000000..59a9dc496f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/test13.c
@@ -0,0 +1,50 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*=====================================================================
+**
+** Source: test13.c
+**
+** Purpose: Test #13 for the _vsnwprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnwprintf.h"
+
+/* memcmp is used to verify the results, so this test is dependent on it. */
+/* ditto with wcslen */
+
+int __cdecl main(int argc, char *argv[])
+{
+ int neg = -42;
+ int pos = 0x1234ab;
+ INT64 l = I64(0x1234567887654321);
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoNumTest(convert("foo %X"), pos, convert("foo 1234AB"));
+ DoNumTest(convert("foo %lX"), pos, convert("foo 1234AB"));
+ DoNumTest(convert("foo %hX"), pos, convert("foo 34AB"));
+ DoNumTest(convert("foo %LX"), pos, convert("foo 1234AB"));
+ DoI64NumTest(convert("foo %I64X"), l, "0x1234567887654321",
+ convert("foo 1234567887654321"));
+ DoNumTest(convert("foo %7X"), pos, convert("foo 1234AB"));
+ DoNumTest(convert("foo %-7X"), pos, convert("foo 1234AB "));
+ DoNumTest(convert("foo %.1X"), pos, convert("foo 1234AB"));
+ DoNumTest(convert("foo %.7X"), pos, convert("foo 01234AB"));
+ DoNumTest(convert("foo %07X"), pos, convert("foo 01234AB"));
+ DoNumTest(convert("foo %#X"), pos, convert("foo 0X1234AB"));
+ DoNumTest(convert("foo %+X"), pos, convert("foo 1234AB"));
+ DoNumTest(convert("foo % X"), pos, convert("foo 1234AB"));
+ DoNumTest(convert("foo %+X"), neg, convert("foo FFFFFFD6"));
+ DoNumTest(convert("foo % X"), neg, convert("foo FFFFFFD6"));
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/testinfo.dat
new file mode 100644
index 0000000000..fa54ae8a62
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test13/testinfo.dat
@@ -0,0 +1,14 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = _vsnwprintf
+Name = Positive Test for _vsnwprintf
+TYPE = DEFAULT
+EXE1 = test13
+Description
+= Tests the PAL implementation of the _vsnwprintf function.
+= Tests _vsnwprintf with hex numbers (uppercase).
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/CMakeLists.txt
new file mode 100644
index 0000000000..3bf157a2b3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test14.c
+)
+
+add_executable(paltest_vsnwprintf_test14
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnwprintf_test14 coreclrpal)
+
+target_link_libraries(paltest_vsnwprintf_test14
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/test14.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/test14.c
new file mode 100644
index 0000000000..633f9d68ae
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/test14.c
@@ -0,0 +1,63 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*=====================================================================
+**
+** Source: test14.c
+**
+** Purpose: Test #14 for the _vsnwprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnwprintf.h"
+
+/* memcmp is used to verify the results, so this test is dependent on it. */
+/* ditto with wcslen */
+
+int __cdecl main(int argc, char *argv[])
+{
+ double val = 256.0;
+ double neg = -256.0;
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoDoubleTest(convert("foo %e"), val, convert("foo 2.560000e+002"),
+ convert("foo 2.560000e+02"));
+ DoDoubleTest(convert("foo %le"), val, convert("foo 2.560000e+002"),
+ convert("foo 2.560000e+02"));
+ DoDoubleTest(convert("foo %he"), val, convert("foo 2.560000e+002"),
+ convert("foo 2.560000e+02"));
+ DoDoubleTest(convert("foo %Le"), val, convert("foo 2.560000e+002"),
+ convert("foo 2.560000e+02"));
+ DoDoubleTest(convert("foo %I64e"), val, convert("foo 2.560000e+002"),
+ convert("foo 2.560000e+02"));
+ DoDoubleTest(convert("foo %14e"), val, convert("foo 2.560000e+002"),
+ convert("foo 2.560000e+02"));
+ DoDoubleTest(convert("foo %-14e"), val, convert("foo 2.560000e+002 "),
+ convert("foo 2.560000e+02 "));
+ DoDoubleTest(convert("foo %.1e"), val, convert("foo 2.6e+002"),
+ convert("foo 2.6e+02"));
+ DoDoubleTest(convert("foo %.8e"), val, convert("foo 2.56000000e+002"),
+ convert("foo 2.56000000e+02"));
+ DoDoubleTest(convert("foo %014e"), val, convert("foo 02.560000e+002"),
+ convert("foo 002.560000e+02"));
+ DoDoubleTest(convert("foo %#e"), val, convert("foo 2.560000e+002"),
+ convert("foo 2.560000e+02"));
+ DoDoubleTest(convert("foo %+e"), val, convert("foo +2.560000e+002"),
+ convert("foo +2.560000e+02"));
+ DoDoubleTest(convert("foo % e"), val, convert("foo 2.560000e+002"),
+ convert("foo 2.560000e+02"));
+ DoDoubleTest(convert("foo %+e"), neg, convert("foo -2.560000e+002"),
+ convert("foo -2.560000e+02"));
+ DoDoubleTest(convert("foo % e"), neg, convert("foo -2.560000e+002"),
+ convert("foo -2.560000e+02"));
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/testinfo.dat
new file mode 100644
index 0000000000..0796f5e81c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test14/testinfo.dat
@@ -0,0 +1,14 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = _vsnwprintf
+Name = Positive Test for _vsnwprintf
+TYPE = DEFAULT
+EXE1 = test14
+Description
+= Tests the PAL implementation of the _vsnwprintf function.
+= Tests _vsnwprintf with exponential format doubles (lowercase).
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/CMakeLists.txt
new file mode 100644
index 0000000000..eedc7bb9db
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test15.c
+)
+
+add_executable(paltest_vsnwprintf_test15
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnwprintf_test15 coreclrpal)
+
+target_link_libraries(paltest_vsnwprintf_test15
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/test15.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/test15.c
new file mode 100644
index 0000000000..0af41fe1dc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/test15.c
@@ -0,0 +1,64 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*=====================================================================
+**
+** Source: test15.c
+**
+** Purpose: Test #15 for the _vsnwprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnwprintf.h"
+
+/* memcmp is used to verify the results, so this test is dependent on it. */
+/* ditto with wcslen */
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ double val = 256.0;
+ double neg = -256.0;
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoDoubleTest(convert("foo %E"), val, convert("foo 2.560000E+002"),
+ convert("foo 2.560000E+02"));
+ DoDoubleTest(convert("foo %lE"), val, convert("foo 2.560000E+002"),
+ convert("foo 2.560000E+02"));
+ DoDoubleTest(convert("foo %hE"), val, convert("foo 2.560000E+002"),
+ convert("foo 2.560000E+02"));
+ DoDoubleTest(convert("foo %LE"), val, convert("foo 2.560000E+002"),
+ convert("foo 2.560000E+02"));
+ DoDoubleTest(convert("foo %I64E"), val, convert("foo 2.560000E+002"),
+ convert("foo 2.560000E+02"));
+ DoDoubleTest(convert("foo %14E"), val, convert("foo 2.560000E+002"),
+ convert("foo 2.560000E+02"));
+ DoDoubleTest(convert("foo %-14E"), val, convert("foo 2.560000E+002 "),
+ convert("foo 2.560000E+02 "));
+ DoDoubleTest(convert("foo %.1E"), val, convert("foo 2.6E+002"),
+ convert("foo 2.6E+02"));
+ DoDoubleTest(convert("foo %.8E"), val, convert("foo 2.56000000E+002"),
+ convert("foo 2.56000000E+02"));
+ DoDoubleTest(convert("foo %014E"), val, convert("foo 02.560000E+002"),
+ convert("foo 002.560000E+02"));
+ DoDoubleTest(convert("foo %#E"), val, convert("foo 2.560000E+002"),
+ convert("foo 2.560000E+02"));
+ DoDoubleTest(convert("foo %+E"), val, convert("foo +2.560000E+002"),
+ convert("foo +2.560000E+02"));
+ DoDoubleTest(convert("foo % E"), val, convert("foo 2.560000E+002"),
+ convert("foo 2.560000E+02"));
+ DoDoubleTest(convert("foo %+E"), neg, convert("foo -2.560000E+002"),
+ convert("foo -2.560000E+02"));
+ DoDoubleTest(convert("foo % E"), neg, convert("foo -2.560000E+002"),
+ convert("foo -2.560000E+002"));
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/testinfo.dat
new file mode 100644
index 0000000000..9de3c83b8a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test15/testinfo.dat
@@ -0,0 +1,14 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = _vsnwprintf
+Name = Positive Test for _vsnwprintf
+TYPE = DEFAULT
+EXE1 = test15
+Description
+= Tests the PAL implementation of the _vsnwprintf function.
+= Tests _vsnwprintf with exponential format doubles (uppercase).
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/CMakeLists.txt
new file mode 100644
index 0000000000..a469c497e9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test16.c
+)
+
+add_executable(paltest_vsnwprintf_test16
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnwprintf_test16 coreclrpal)
+
+target_link_libraries(paltest_vsnwprintf_test16
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/test16.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/test16.c
new file mode 100644
index 0000000000..77571b01b3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/test16.c
@@ -0,0 +1,63 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*=====================================================================
+**
+** Source: test16.c
+**
+** Purpose: Test #16 for the _vsnwprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnwprintf.h"
+
+/* memcmp is used to verify the results, so this test is dependent on it. */
+/* ditto with wcslen */
+
+int __cdecl main(int argc, char *argv[])
+{
+ double val = 2560.001;
+ double neg = -2560.001;
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoDoubleTest(convert("foo %f"), val, convert("foo 2560.001000"),
+ convert("foo 2560.001000"));
+ DoDoubleTest(convert("foo %lf"), val, convert("foo 2560.001000"),
+ convert("foo 2560.001000"));
+ DoDoubleTest(convert("foo %hf"), val, convert("foo 2560.001000"),
+ convert("foo 2560.001000"));
+ DoDoubleTest(convert("foo %Lf"), val, convert("foo 2560.001000"),
+ convert("foo 2560.001000"));
+ DoDoubleTest(convert("foo %I64f"), val, convert("foo 2560.001000"),
+ convert("foo 2560.001000"));
+ DoDoubleTest(convert("foo %12f"), val, convert("foo 2560.001000"),
+ convert("foo 2560.001000"));
+ DoDoubleTest(convert("foo %-12f"), val, convert("foo 2560.001000 "),
+ convert("foo 2560.001000 "));
+ DoDoubleTest(convert("foo %.1f"), val, convert("foo 2560.0"),
+ convert("foo 2560.0"));
+ DoDoubleTest(convert("foo %.8f"), val, convert("foo 2560.00100000"),
+ convert("foo 2560.00100000"));
+ DoDoubleTest(convert("foo %012f"), val, convert("foo 02560.001000"),
+ convert("foo 02560.001000"));
+ DoDoubleTest(convert("foo %#f"), val, convert("foo 2560.001000"),
+ convert("foo 2560.001000"));
+ DoDoubleTest(convert("foo %+f"), val, convert("foo +2560.001000"),
+ convert("foo +2560.001000"));
+ DoDoubleTest(convert("foo % f"), val, convert("foo 2560.001000"),
+ convert("foo 2560.001000"));
+ DoDoubleTest(convert("foo %+f"), neg, convert("foo -2560.001000"),
+ convert("foo -2560.001000"));
+ DoDoubleTest(convert("foo % f"), neg, convert("foo -2560.001000"),
+ convert("foo -2560.001000"));
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/testinfo.dat
new file mode 100644
index 0000000000..b7134c785b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test16/testinfo.dat
@@ -0,0 +1,14 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = _vsnwprintf
+Name = Positive Test for _vsnwprintf
+TYPE = DEFAULT
+EXE1 = test16
+Description
+= Tests the PAL implementation of the _vsnwprintf function.
+= Tests _vsnwprintf with decimal point format doubles.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/CMakeLists.txt
new file mode 100644
index 0000000000..f429e94417
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test17.c
+)
+
+add_executable(paltest_vsnwprintf_test17
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnwprintf_test17 coreclrpal)
+
+target_link_libraries(paltest_vsnwprintf_test17
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/test17.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/test17.c
new file mode 100644
index 0000000000..3a9d70ad03
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/test17.c
@@ -0,0 +1,65 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*=====================================================================
+**
+** Source: test17.c
+**
+** Purpose: Test #17 for the _vsnwprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnwprintf.h"
+
+/* memcmp is used to verify the results, so this test is dependent on it. */
+/* ditto with wcslen */
+
+int __cdecl main(int argc, char *argv[])
+{
+ double val = 2560.001;
+ double neg = -2560.001;
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoDoubleTest(convert("foo %g"), val, convert("foo 2560"),
+ convert("foo 2560"));
+ DoDoubleTest(convert("foo %lg"), val, convert("foo 2560"),
+ convert("foo 2560"));
+ DoDoubleTest(convert("foo %hg"), val, convert("foo 2560"),
+ convert("foo 2560"));
+ DoDoubleTest(convert("foo %Lg"), val, convert("foo 2560"),
+ convert("foo 2560"));
+ DoDoubleTest(convert("foo %I64g"), val, convert("foo 2560"),
+ convert("foo 2560"));
+ DoDoubleTest(convert("foo %5g"), val, convert("foo 2560"),
+ convert("foo 2560"));
+ DoDoubleTest(convert("foo %-5g"), val, convert("foo 2560 "),
+ convert("foo 2560 "));
+ DoDoubleTest(convert("foo %.1g"), val, convert("foo 3e+003"),
+ convert("foo 3e+03"));
+ DoDoubleTest(convert("foo %.2g"), val, convert("foo 2.6e+003"),
+ convert("foo 2.6e+03"));
+ DoDoubleTest(convert("foo %.12g"), val, convert("foo 2560.001"),
+ convert("foo 2560.001"));
+ DoDoubleTest(convert("foo %06g"), val, convert("foo 002560"),
+ convert("foo 002560"));
+ DoDoubleTest(convert("foo %#g"), val, convert("foo 2560.00"),
+ convert("foo 2560.00"));
+ DoDoubleTest(convert("foo %+g"), val, convert("foo +2560"),
+ convert("foo +2560"));
+ DoDoubleTest(convert("foo % g"), val, convert("foo 2560"),
+ convert("foo 2560"));
+ DoDoubleTest(convert("foo %+g"), neg, convert("foo -2560"),
+ convert("foo -2560"));
+ DoDoubleTest(convert("foo % g"), neg, convert("foo -2560"),
+ convert("foo -2560"));
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/testinfo.dat
new file mode 100644
index 0000000000..5d5553151e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test17/testinfo.dat
@@ -0,0 +1,14 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = _vsnwprintf
+Name = Positive Test for _vsnwprintf
+TYPE = DEFAULT
+EXE1 = test17
+Description
+= Tests the PAL implementation of the _vsnwprintf function.
+= Tests _vsnwprintf with compact format doubles (lowercase).
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/CMakeLists.txt
new file mode 100644
index 0000000000..25dd6a2c5b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test18.c
+)
+
+add_executable(paltest_vsnwprintf_test18
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnwprintf_test18 coreclrpal)
+
+target_link_libraries(paltest_vsnwprintf_test18
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/test18.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/test18.c
new file mode 100644
index 0000000000..03f9870113
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/test18.c
@@ -0,0 +1,65 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*=====================================================================
+**
+** Source: test18.c
+**
+** Purpose: Test #18 for the _vsnwprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnwprintf.h"
+
+/* memcmp is used to verify the results, so this test is dependent on it. */
+/* ditto with wcslen */
+
+int __cdecl main(int argc, char *argv[])
+{
+ double val = 2560.001;
+ double neg = -2560.001;
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoDoubleTest(convert("foo %G"), val, convert("foo 2560"),
+ convert("foo 2560"));
+ DoDoubleTest(convert("foo %lG"), val, convert("foo 2560"),
+ convert("foo 2560"));
+ DoDoubleTest(convert("foo %hG"), val, convert("foo 2560"),
+ convert("foo 2560"));
+ DoDoubleTest(convert("foo %LG"), val, convert("foo 2560"),
+ convert("foo 2560"));
+ DoDoubleTest(convert("foo %I64G"), val, convert("foo 2560"),
+ convert("foo 2560"));
+ DoDoubleTest(convert("foo %5G"), val, convert("foo 2560"),
+ convert("foo 2560"));
+ DoDoubleTest(convert("foo %-5G"), val, convert("foo 2560 "),
+ convert("foo 2560 "));
+ DoDoubleTest(convert("foo %.1G"), val, convert("foo 3E+003"),
+ convert("foo 3E+03"));
+ DoDoubleTest(convert("foo %.2G"), val, convert("foo 2.6E+003"),
+ convert("foo 2.6E+03"));
+ DoDoubleTest(convert("foo %.12G"), val, convert("foo 2560.001"),
+ convert("foo 2560.001"));
+ DoDoubleTest(convert("foo %06G"), val, convert("foo 002560"),
+ convert("foo 002560"));
+ DoDoubleTest(convert("foo %#G"), val, convert("foo 2560.00"),
+ convert("foo 2560.00"));
+ DoDoubleTest(convert("foo %+G"), val, convert("foo +2560"),
+ convert("foo +2560"));
+ DoDoubleTest(convert("foo % G"), val, convert("foo 2560"),
+ convert("foo 2560"));
+ DoDoubleTest(convert("foo %+G"), neg, convert("foo -2560"),
+ convert("foo -2560"));
+ DoDoubleTest(convert("foo % G"), neg, convert("foo -2560"),
+ convert("foo -2560"));
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/testinfo.dat
new file mode 100644
index 0000000000..f56c80980d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test18/testinfo.dat
@@ -0,0 +1,14 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = _vsnwprintf
+Name = Positive Test for _vsnwprintf
+TYPE = DEFAULT
+EXE1 = test18
+Description
+= Tests the PAL implementation of the _vsnwprintf function.
+= Tests _vsnwprintf with compact format doubles (uppercase).
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/CMakeLists.txt
new file mode 100644
index 0000000000..9c636b8b0a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test19.c
+)
+
+add_executable(paltest_vsnwprintf_test19
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnwprintf_test19 coreclrpal)
+
+target_link_libraries(paltest_vsnwprintf_test19
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/test19.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/test19.c
new file mode 100644
index 0000000000..fea275a242
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/test19.c
@@ -0,0 +1,139 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*=====================================================================
+**
+** Source: test18.c
+**
+** Purpose: Test #18 for the _vsnwprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnwprintf.h"
+
+/* memcmp is used to verify the results, so this test is dependent on it. */
+/* ditto with wcslen */
+
+#define DOTEST(a,b,c,d,e) DoTest(a,b,(void*)c,d,e)
+
+void DoArgumentPrecTest(WCHAR *formatstr, int precision, void *param,
+ WCHAR *paramstr, WCHAR *checkstr1, WCHAR *checkstr2)
+{
+ WCHAR buf[256];
+
+ TestVsnwprintf(buf, 256, formatstr, precision, param);
+ if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0 &&
+ memcmp(buf, checkstr2, wcslen(checkstr2) + 2) != 0)
+ {
+ Fail("ERROR: failed to insert %s into \"%s\" with precision %d\n"
+ "Expected \"%s\" or \"%s\", got \"%s\".\n",
+ paramstr,
+ convertC(formatstr),
+ precision,
+ convertC(checkstr1),
+ convertC(checkstr2),
+ convertC(buf));
+ }
+}
+void DoArgumentPrecDoubleTest(WCHAR *formatstr, int precision, double param,
+ WCHAR *checkstr1, WCHAR *checkstr2)
+{
+ WCHAR buf[256];
+
+ TestVsnwprintf(buf, 256, formatstr, precision, param);
+ if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0 &&
+ memcmp(buf, checkstr2, wcslen(checkstr2) + 2) != 0)
+ {
+ Fail("ERROR: failed to insert %f into \"%s\" with precision %d\n"
+ "Expected \"%s\" or \"%s\", got \"%s\".\n",
+ param, convertC(formatstr),
+ precision,
+ convertC(checkstr1),
+ convertC(checkstr2),
+ convertC(buf));
+ }
+}
+
+/*
+ * Uses memcmp & wcslen
+ */
+
+int __cdecl main(int argc, char *argv[])
+{
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoArgumentPrecTest(convert("%.*s"), 2, convert("bar"), convert("bar"),
+ convert("ba"), convert("ba"));
+ DoArgumentPrecTest(convert("%.*c"), 0, (void*)'a', convert("a"),
+ convert("a"), convert("a"));
+ DoArgumentPrecTest(convert("%.*c"), 4, (void*)'a', convert("a"),
+ convert("a"), convert("a"));
+ DoArgumentPrecTest(convert("%.*C"), 0, (void*)'a', convert("a"),
+ convert("a"), convert("a"));
+ DoArgumentPrecTest(convert("%.*C"), 4, (void*)'a', convert("a"),
+ convert("a"), convert("a"));
+ DoArgumentPrecTest(convert("%.*d"), 1, (void*)42, convert("42"),
+ convert("42"), convert("42"));
+ DoArgumentPrecTest(convert("%.*d"), 3, (void*)42, convert("42"),
+ convert("042"), convert("042"));
+ DoArgumentPrecTest(convert("%.*i"), 1, (void*)42, convert("42"),
+ convert("42"), convert("42"));
+ DoArgumentPrecTest(convert("%.*i"), 3, (void*)42, convert("42"),
+ convert("042"), convert("042"));
+ DoArgumentPrecTest(convert("%.*o"), 1, (void*)42, convert("42"),
+ convert("52"), convert("52"));
+ DoArgumentPrecTest(convert("%.*o"), 3, (void*)42, convert("42"),
+ convert("052"), convert("052"));
+ DoArgumentPrecTest(convert("%.*u"), 1, (void*)42, convert("42"),
+ convert("42"), convert("42"));
+ DoArgumentPrecTest(convert("%.*u"), 3, (void*)42, convert("42"),
+ convert("042"), convert("042"));
+ DoArgumentPrecTest(convert("%.*x"), 1, (void*)0x42, convert("0x42"),
+ convert("42"), convert("42"));
+ DoArgumentPrecTest(convert("%.*x"), 3, (void*)0x42, convert("0x42"),
+ convert("042"), convert("042"));
+ DoArgumentPrecTest(convert("%.*X"), 1, (void*)0x42, convert("0x42"),
+ convert("42"), convert("42"));
+ DoArgumentPrecTest(convert("%.*X"), 3, (void*)0x42, convert("0x42"),
+ convert("042"), convert("042"));
+
+
+ DoArgumentPrecDoubleTest(convert("%.*e"), 1, 2.01, convert("2.0e+000"),
+ convert("2.0e+00"));
+ DoArgumentPrecDoubleTest(convert("%.*e"), 3, 2.01, convert("2.010e+000"),
+ convert("2.010e+00"));
+ DoArgumentPrecDoubleTest(convert("%.*E"), 1, 2.01, convert("2.0E+000"),
+ convert("2.0E+00"));
+ DoArgumentPrecDoubleTest(convert("%.*E"), 3, 2.01, convert("2.010E+000"),
+ convert("2.010E+00"));
+ DoArgumentPrecDoubleTest(convert("%.*f"), 1, 2.01, convert("2.0"),
+ convert("2.0"));
+ DoArgumentPrecDoubleTest(convert("%.*f"), 3, 2.01, convert("2.010"),
+ convert("2.010"));
+ DoArgumentPrecDoubleTest(convert("%.*g"), 1, 256.01, convert("3e+002"),
+ convert("3e+02"));
+ DoArgumentPrecDoubleTest(convert("%.*g"), 3, 256.01, convert("256"),
+ convert("256"));
+ DoArgumentPrecDoubleTest(convert("%.*g"), 4, 256.01, convert("256"),
+ convert("256"));
+ DoArgumentPrecDoubleTest(convert("%.*g"), 6, 256.01, convert("256.01"),
+ convert("256.01"));
+ DoArgumentPrecDoubleTest(convert("%.*G"), 1, 256.01, convert("3E+002"),
+ convert("3E+02"));
+ DoArgumentPrecDoubleTest(convert("%.*G"), 3, 256.01, convert("256"),
+ convert("256"));
+ DoArgumentPrecDoubleTest(convert("%.*G"), 4, 256.01, convert("256"),
+ convert("256"));
+ DoArgumentPrecDoubleTest(convert("%.*G"), 6, 256.01, convert("256.01"),
+ convert("256.01"));
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/testinfo.dat
new file mode 100644
index 0000000000..77178f1471
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test19/testinfo.dat
@@ -0,0 +1,14 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = _vsnwprintf
+Name = Positive Test for _vsnwprintf
+TYPE = DEFAULT
+EXE1 = test19
+Description
+= Tests the PAL implementation of the _vsnwprintf function.
+= Tests _vsnwprintf with argument specified precision.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/CMakeLists.txt
new file mode 100644
index 0000000000..817657ea61
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test2.c
+)
+
+add_executable(paltest_vsnwprintf_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnwprintf_test2 coreclrpal)
+
+target_link_libraries(paltest_vsnwprintf_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/test2.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/test2.c
new file mode 100644
index 0000000000..20499954db
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/test2.c
@@ -0,0 +1,40 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*=====================================================================
+**
+** Source: test2.c
+**
+** Purpose: Test #2 for the _vsnwprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnwprintf.h"
+
+/* memcmp is used to verify the results, so this test is dependent on it. */
+/* ditto with wcslen */
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ if (PAL_Initialize(argc, argv) != 0)
+ return(FAIL);
+
+ DoWStrTest(convert("foo %s"), convert("bar"), convert("foo bar"));
+ DoStrTest(convert("foo %hs"), "bar", convert("foo bar"));
+ DoWStrTest(convert("foo %ls"), convert("bar"), convert("foo bar"));
+ DoWStrTest(convert("foo %ws"), convert("bar"), convert("foo bar"));
+ DoWStrTest(convert("foo %Ls"), convert("bar"), convert("foo bar"));
+ DoWStrTest(convert("foo %I64s"), convert("bar"), convert("foo bar"));
+ DoWStrTest(convert("foo %5s"), convert("bar"), convert("foo bar"));
+ DoWStrTest(convert("foo %.2s"), convert("bar"), convert("foo ba"));
+ DoWStrTest(convert("foo %5.2s"), convert("bar"), convert("foo ba"));
+ DoWStrTest(convert("foo %-5s"), convert("bar"), convert("foo bar "));
+ DoWStrTest(convert("foo %05s"), convert("bar"), convert("foo 00bar"));
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/testinfo.dat
new file mode 100644
index 0000000000..429911bd83
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test2/testinfo.dat
@@ -0,0 +1,14 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = _vsnwprintf
+Name = Positive Test for _vsnwprintf
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Tests the PAL implementation of the _vsnwprintf function.
+= Tests _vsnwprintf with strings.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/CMakeLists.txt
new file mode 100644
index 0000000000..4af3e36f3b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test3.c
+)
+
+add_executable(paltest_vsnwprintf_test3
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnwprintf_test3 coreclrpal)
+
+target_link_libraries(paltest_vsnwprintf_test3
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/test3.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/test3.c
new file mode 100644
index 0000000000..9a37d3fc4b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/test3.c
@@ -0,0 +1,40 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*=====================================================================
+**
+** Source: test3.c
+**
+** Purpose: Test #3 for the _vsnwprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnwprintf.h"
+
+/* memcmp is used to verify the results, so this test is dependent on it. */
+/* ditto with wcslen */
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ if (PAL_Initialize(argc, argv) != 0)
+ return(FAIL);
+
+ DoStrTest(convert("foo %S"), "bar", convert("foo bar"));
+ DoStrTest(convert("foo %hS"), "bar", convert("foo bar"));
+ DoWStrTest(convert("foo %lS"), convert("bar"), convert("foo bar"));
+ DoWStrTest(convert("foo %wS"), convert("bar"), convert("foo bar"));
+ DoStrTest(convert("foo %LS"), "bar", convert("foo bar"));
+ DoStrTest(convert("foo %I64S"), "bar", convert("foo bar"));
+ DoStrTest(convert("foo %5S"), "bar", convert("foo bar"));
+ DoStrTest(convert("foo %.2S"), "bar", convert("foo ba"));
+ DoStrTest(convert("foo %5.2S"), "bar", convert("foo ba"));
+ DoStrTest(convert("foo %-5S"), "bar", convert("foo bar "));
+ DoStrTest(convert("foo %05S"), "bar", convert("foo 00bar"));
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/testinfo.dat
new file mode 100644
index 0000000000..d4e2686763
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test3/testinfo.dat
@@ -0,0 +1,14 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = _vsnwprintf
+Name = Positive Test for _vsnwprintf
+TYPE = DEFAULT
+EXE1 = test3
+Description
+= Tests the PAL implementation of the _vsnwprintf function.
+= Tests _vsnwprintf with wide strings.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/CMakeLists.txt
new file mode 100644
index 0000000000..b7ff9e7bb3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test4.c
+)
+
+add_executable(paltest_vsnwprintf_test4
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnwprintf_test4 coreclrpal)
+
+target_link_libraries(paltest_vsnwprintf_test4
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/test4.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/test4.c
new file mode 100644
index 0000000000..6f39be2a80
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/test4.c
@@ -0,0 +1,121 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*=====================================================================
+**
+** Source: test4.c
+**
+** Purpose: Test #4 for the _vsnwprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnwprintf.h"
+
+/* memcmp is used to verify the results, so this test is dependent on it. */
+/* ditto with wcslen */
+static void DoPointerTest(WCHAR *formatstr, void* param, WCHAR* paramstr,
+ WCHAR *checkstr1)
+{
+ WCHAR buf[256] = { 0 };
+
+ TestVsnwprintf(buf, 256, formatstr, param);
+ if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0)
+
+ {
+ Fail("ERROR: failed to insert pointer to %#p into \"%s\"\n"
+ "Expected \"%s\" got \"%s\".\n",
+ paramstr,
+ convertC(formatstr),
+ convertC(checkstr1),
+ convertC(buf));
+ }
+}
+
+static void DoI64DoubleTest(WCHAR *formatstr, INT64 value, WCHAR *valuestr,
+ WCHAR *checkstr1)
+{
+ WCHAR buf[256] = { 0 };
+
+ TestVsnwprintf(buf, 256, formatstr, value);
+ if (memcmp(buf, checkstr1, wcslen(checkstr1) + 2) != 0)
+ {
+ Fail("ERROR: failed to insert %s into \"%s\"\n"
+ "Expected \"%s\", got \"%s\".\n",
+ value,
+ convertC(formatstr),
+ convertC(checkstr1),
+ convertC(buf));
+ }
+}
+
+int __cdecl main(int argc, char *argv[])
+{
+ void *ptr = (void*) 0x123456;
+ INT64 lptr = I64(0x1234567887654321);
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+/*
+** Run only on 64 bit platforms
+*/
+#if defined(BIT64) && defined(PLATFORM_UNIX)
+ Trace("Testing for 64 Bit Platforms \n");
+ DoPointerTest(convert("%p"), NULL, convert("NULL"), convert("00000000"));
+ DoPointerTest(convert("%p"), ptr, convert("pointer to 0x123456"),
+ convert("0000000000123456"));
+ DoPointerTest(convert("%17p"), ptr, convert("pointer to 0x123456"),
+ convert(" 0000000000123456"));
+ DoPointerTest(convert("%17p"), ptr, convert("pointer to 0x123456"),
+ convert(" 0000000000123456"));
+ DoPointerTest(convert("%-17p"), ptr, convert("pointer to 0x123456"),
+ convert("0000000000123456 "));
+ DoPointerTest(convert("%+p"), ptr, convert("pointer to 0x123456"),
+ convert("0000000000123456"));
+ DoPointerTest(convert("%#p"), ptr, convert("pointer to 0x123456"),
+ convert("0X0000000000123456"));
+ DoPointerTest(convert("%lp"), ptr, convert("pointer to 0x123456"),
+ convert("00123456"));
+ DoPointerTest(convert("%hp"), ptr, convert("pointer to 0x123456"),
+ convert("00003456"));
+ DoPointerTest(convert("%Lp"), ptr, convert("pointer to 0x123456"),
+ convert("00123456"));
+ DoI64DoubleTest(convert("%I64p"), lptr,
+ convert("pointer to 0x1234567887654321"),
+ convert("1234567887654321"));
+
+#else
+ Trace("Testing for Non 64 Bit Platforms \n");
+ DoPointerTest(convert("%p"), NULL, convert("NULL"), convert("00000000"));
+ DoPointerTest(convert("%p"), ptr, convert("pointer to 0x123456"),
+ convert("00123456"));
+ DoPointerTest(convert("%9p"), ptr, convert("pointer to 0x123456"),
+ convert(" 00123456"));
+ DoPointerTest(convert("%09p"), ptr, convert("pointer to 0x123456"),
+ convert(" 00123456"));
+ DoPointerTest(convert("%-9p"), ptr, convert("pointer to 0x123456"),
+ convert("00123456 "));
+ DoPointerTest(convert("%+p"), ptr, convert("pointer to 0x123456"),
+ convert("00123456"));
+ DoPointerTest(convert("%#p"), ptr, convert("pointer to 0x123456"),
+ convert("0X00123456"));
+ DoPointerTest(convert("%lp"), ptr, convert("pointer to 0x123456"),
+ convert("00123456"));
+ DoPointerTest(convert("%hp"), ptr, convert("pointer to 0x123456"),
+ convert("00003456"));
+ DoPointerTest(convert("%Lp"), ptr, convert("pointer to 0x123456"),
+ convert("00123456"));
+ DoI64DoubleTest(convert("%I64p"), lptr,
+ convert("pointer to 0x1234567887654321"),
+ convert("1234567887654321"));
+#endif
+
+ PAL_Terminate();
+ return PASS;
+}
+
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/testinfo.dat
new file mode 100644
index 0000000000..56f488a66a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test4/testinfo.dat
@@ -0,0 +1,14 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = _vsnwprintf
+Name = Positive Test for _vsnwprintf
+TYPE = DEFAULT
+EXE1 = test4
+Description
+= Tests the PAL implementation of the _vsnwprintf function.
+= Tests _vsnwprintf with pointers.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/CMakeLists.txt
new file mode 100644
index 0000000000..9b316b9f90
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test5.c
+)
+
+add_executable(paltest_vsnwprintf_test5
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnwprintf_test5 coreclrpal)
+
+target_link_libraries(paltest_vsnwprintf_test5
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/test5.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/test5.c
new file mode 100644
index 0000000000..224db766ff
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/test5.c
@@ -0,0 +1,81 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*=====================================================================
+**
+** Source: test5.c
+**
+** Purpose: Test #5 for the _vsnwprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnwprintf.h"
+
+/* memcmp is used to verify the results, so this test is dependent on it. */
+/* ditto with wcslen */
+
+static void DoTest(WCHAR *formatstr, int param, WCHAR *checkstr)
+{
+ WCHAR buf[256] = { 0 };
+ int n = -1;
+
+ TestVsnwprintf(buf, 256, formatstr, &n);
+
+ if (n != param)
+ {
+ Fail("ERROR: Expected count parameter to resolve to %d, got %d\n",
+ param, n);
+ }
+
+ if (memcmp(buf, checkstr, wcslen(buf)*2 + 2) != 0)
+ {
+ Fail("ERROR: Expected \"%s\" got \"%s\".\n",
+ convertC(checkstr), convertC(buf));
+ }
+}
+
+static void DoShortTest(WCHAR *formatstr, int param, WCHAR *checkstr)
+{
+ WCHAR buf[256] = { 0 };
+ short int n = -1;
+
+ TestVsnwprintf(buf, 256, formatstr, &n);
+
+ if (n != param)
+ {
+ Fail("ERROR: Expected count parameter to resolve to %d, got %d\n",
+ param, n);
+ }
+
+ if (memcmp(buf, checkstr, wcslen(buf)*2 + 2) != 0)
+ {
+ Fail("ERROR: Expected \"%s\" got \"%s\".\n",
+ convertC(checkstr), convertC(buf));
+ }
+}
+
+int __cdecl main(int argc, char *argv[])
+{
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoTest(convert("foo %n bar"), 4, convert("foo bar"));
+ DoTest(convert("foo %#n bar"), 4, convert("foo bar"));
+ DoTest(convert("foo % n bar"), 4, convert("foo bar"));
+ DoTest(convert("foo %+n bar"), 4, convert("foo bar"));
+ DoTest(convert("foo %-n bar"), 4, convert("foo bar"));
+ DoTest(convert("foo %0n bar"), 4, convert("foo bar"));
+ DoShortTest(convert("foo %hn bar"), 4, convert("foo bar"));
+ DoTest(convert("foo %ln bar"), 4, convert("foo bar"));
+ DoTest(convert("foo %Ln bar"), 4, convert("foo bar"));
+ DoTest(convert("foo %I64n bar"), 4, convert("foo bar"));
+ DoTest(convert("foo %20.3n bar"), 4, convert("foo bar"));
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/testinfo.dat
new file mode 100644
index 0000000000..35d3816a76
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test5/testinfo.dat
@@ -0,0 +1,14 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = _vsnwprintf
+Name = Positive Test for _vsnwprintf
+TYPE = DEFAULT
+EXE1 = test5
+Description
+= Tests the PAL implementation of the _vsnwprintf function.
+= Tests _vsnwprintf with the count specifier.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/CMakeLists.txt
new file mode 100644
index 0000000000..d3fad03597
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test6.c
+)
+
+add_executable(paltest_vsnwprintf_test6
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnwprintf_test6 coreclrpal)
+
+target_link_libraries(paltest_vsnwprintf_test6
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/test6.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/test6.c
new file mode 100644
index 0000000000..1bd83ea85c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/test6.c
@@ -0,0 +1,43 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*=====================================================================
+**
+** Source: test6.c
+**
+** Purpose: Test #6 for the _vsnwprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnwprintf.h"
+
+/* memcmp is used to verify the results, so this test is dependent on it. */
+/* ditto with wcslen */
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR wc = (WCHAR) 'c';
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoWCharTest(convert("foo %c"), wc, convert("foo c"));
+ DoCharTest(convert("foo %hc"), 'b', convert("foo b"));
+ DoWCharTest(convert("foo %lc"), wc, convert("foo c"));
+ DoWCharTest(convert("foo %Lc"), wc, convert("foo c"));
+ DoWCharTest(convert("foo %I64c"), wc, convert("foo c"));
+ DoWCharTest(convert("foo %5c"), wc, convert("foo c"));
+ DoWCharTest(convert("foo %.0c"), wc, convert("foo c"));
+ DoWCharTest(convert("foo %-5c"), wc, convert("foo c "));
+ DoWCharTest(convert("foo %05c"), wc, convert("foo 0000c"));
+ DoWCharTest(convert("foo % c"), wc, convert("foo c"));
+ DoWCharTest(convert("foo %#c"), wc, convert("foo c"));
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/testinfo.dat
new file mode 100644
index 0000000000..6afe96d1cd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test6/testinfo.dat
@@ -0,0 +1,14 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = _vsnwprintf
+Name = Positive Test for _vsnwprintf
+TYPE = DEFAULT
+EXE1 = test6
+Description
+= Tests the PAL implementation of the _vsnwprintf function.
+= Tests _vsnwprintf with characters.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/CMakeLists.txt
new file mode 100644
index 0000000000..cede861358
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test7.c
+)
+
+add_executable(paltest_vsnwprintf_test7
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnwprintf_test7 coreclrpal)
+
+target_link_libraries(paltest_vsnwprintf_test7
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/test7.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/test7.c
new file mode 100644
index 0000000000..e13798b784
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/test7.c
@@ -0,0 +1,43 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*=====================================================================
+**
+** Source: test7.c
+**
+** Purpose: Test #7 for the _vsnwprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnwprintf.h"
+
+/* memcmp is used to verify the results, so this test is dependent on it. */
+/* ditto with wcslen */
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR wc = (WCHAR) 'c';
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoCharTest(convert("foo %C"), 'b', convert("foo b"));
+ DoWCharTest(convert("foo %hC"), wc, convert("foo c"));
+ DoCharTest(convert("foo %lC"), 'b', convert("foo b"));
+ DoCharTest(convert("foo %LC"), 'b', convert("foo b"));
+ DoCharTest(convert("foo %I64C"), 'b', convert("foo b"));
+ DoCharTest(convert("foo %5C"), 'b', convert("foo b"));
+ DoCharTest(convert("foo %.0C"), 'b', convert("foo b"));
+ DoCharTest(convert("foo %-5C"), 'b', convert("foo b "));
+ DoCharTest(convert("foo %05C"), 'b', convert("foo 0000b"));
+ DoCharTest(convert("foo % C"), 'b', convert("foo b"));
+ DoCharTest(convert("foo %#C"), 'b', convert("foo b"));
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/testinfo.dat
new file mode 100644
index 0000000000..ece40aa195
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test7/testinfo.dat
@@ -0,0 +1,14 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = _vsnwprintf
+Name = Positive Test for _vsnwprintf
+TYPE = DEFAULT
+EXE1 = test7
+Description
+= Tests the PAL implementation of the _vsnwprintf function.
+= Tests _vsnwprintf with wide characters.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/CMakeLists.txt
new file mode 100644
index 0000000000..846e7b9219
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test8.c
+)
+
+add_executable(paltest_vsnwprintf_test8
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnwprintf_test8 coreclrpal)
+
+target_link_libraries(paltest_vsnwprintf_test8
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/test8.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/test8.c
new file mode 100644
index 0000000000..8f02412eb0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/test8.c
@@ -0,0 +1,49 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*=====================================================================
+**
+** Source: test8.c
+**
+** Purpose: Test #8 for the _vsnwprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnwprintf.h"
+
+/* memcmp is used to verify the results, so this test is dependent on it. */
+/* ditto with wcslen */
+
+int __cdecl main(int argc, char *argv[])
+{
+ int neg = -42;
+ int pos = 42;
+ INT64 l = 42;
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoNumTest(convert("foo %d"), pos, convert("foo 42"));
+ DoNumTest(convert("foo %ld"), 0xFFFF, convert("foo 65535"));
+ DoNumTest(convert("foo %hd"), 0xFFFF, convert("foo -1"));
+ DoNumTest(convert("foo %Ld"), pos, convert("foo 42"));
+ DoI64NumTest(convert("foo %I64d"), l, "42", convert("foo 42"));
+ DoNumTest(convert("foo %3d"), pos, convert("foo 42"));
+ DoNumTest(convert("foo %-3d"), pos, convert("foo 42 "));
+ DoNumTest(convert("foo %.1d"), pos, convert("foo 42"));
+ DoNumTest(convert("foo %.3d"), pos, convert("foo 042"));
+ DoNumTest(convert("foo %03d"), pos, convert("foo 042"));
+ DoNumTest(convert("foo %#d"), pos, convert("foo 42"));
+ DoNumTest(convert("foo %+d"), pos, convert("foo +42"));
+ DoNumTest(convert("foo % d"), pos, convert("foo 42"));
+ DoNumTest(convert("foo %+d"), neg, convert("foo -42"));
+ DoNumTest(convert("foo % d"), neg, convert("foo -42"));
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/testinfo.dat
new file mode 100644
index 0000000000..d7a567a6d6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test8/testinfo.dat
@@ -0,0 +1,14 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = _vsnwprintf
+Name = Positive Test for _vsnwprintf
+TYPE = DEFAULT
+EXE1 = test8
+Description
+= Tests the PAL implementation of the _vsnwprintf function.
+= Tests _vsnwprintf with decimal numbers.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/CMakeLists.txt
new file mode 100644
index 0000000000..e25eded172
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test9.c
+)
+
+add_executable(paltest_vsnwprintf_test9
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vsnwprintf_test9 coreclrpal)
+
+target_link_libraries(paltest_vsnwprintf_test9
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/test9.c b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/test9.c
new file mode 100644
index 0000000000..7b5b6cd8a6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/test9.c
@@ -0,0 +1,49 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*=====================================================================
+**
+** Source: test9.c
+**
+** Purpose: Test #9 for the _vsnwprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../_vsnwprintf.h"
+
+/* memcmp is used to verify the results, so this test is dependent on it. */
+/* ditto with wcslen */
+
+int __cdecl main(int argc, char *argv[])
+{
+ int neg = -42;
+ int pos = 42;
+ INT64 l = 42;
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoNumTest(convert("foo %i"), pos, convert("foo 42"));
+ DoNumTest(convert("foo %li"), 0xFFFF, convert("foo 65535"));
+ DoNumTest(convert("foo %hi"), 0xFFFF, convert("foo -1"));
+ DoNumTest(convert("foo %Li"), pos, convert("foo 42"));
+ DoI64NumTest(convert("foo %I64i"), l, "42", convert("foo 42"));
+ DoNumTest(convert("foo %3i"), pos, convert("foo 42"));
+ DoNumTest(convert("foo %-3i"), pos, convert("foo 42 "));
+ DoNumTest(convert("foo %.1i"), pos, convert("foo 42"));
+ DoNumTest(convert("foo %.3i"), pos, convert("foo 042"));
+ DoNumTest(convert("foo %03i"), pos, convert("foo 042"));
+ DoNumTest(convert("foo %#i"), pos, convert("foo 42"));
+ DoNumTest(convert("foo %+i"), pos, convert("foo +42"));
+ DoNumTest(convert("foo % i"), pos, convert("foo 42"));
+ DoNumTest(convert("foo %+i"), neg, convert("foo -42"));
+ DoNumTest(convert("foo % i"), neg, convert("foo -42"));
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/testinfo.dat
new file mode 100644
index 0000000000..726b060240
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/_vsnwprintf/test9/testinfo.dat
@@ -0,0 +1,14 @@
+# Licensed to the .NET Foundation under one or more agreements.
+# The .NET Foundation licenses this file to you under the MIT license.
+# See the LICENSE file in the project root for more information.
+
+Version = 1.0
+Section = C Runtime
+Function = _vsnwprintf
+Name = Positive Test for _vsnwprintf
+TYPE = DEFAULT
+EXE1 = test9
+Description
+= Tests the PAL implementation of the _vsnwprintf function.
+= Tests _vsnwprintf with integer numbers
+= This test is modeled after _snwprintf.