summaryrefslogtreecommitdiff
path: root/src/pal/tests/palsuite/c_runtime/vswprintf
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/vswprintf
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/vswprintf')
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/CMakeLists.txt22
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test1/test1.c41
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test1/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test10/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test10/test10.c48
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test10/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test11/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test11/test11.c48
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test11/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test12/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test12/test12.c48
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test12/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test13/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test13/test13.c48
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test13/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test14/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test14/test14.c61
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test14/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test15/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test15/test15.c62
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test15/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test16/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test16/test16.c61
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test16/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test17/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test17/test17.c63
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test17/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test18/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test18/test18.c63
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test18/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test19/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test19/test19.c137
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test19/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test2/test2.c40
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test2/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test3/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test3/test3.c40
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test3/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test4/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test4/test4.c118
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test4/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test5/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test5/test5.c79
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test5/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test6/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test6/test6.c41
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test6/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test7/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test7/test7.c41
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test7/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test8/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test8/test8.c47
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test8/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test9/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test9/test9.c47
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/test9/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/vswprintf/vswprintf.h132
59 files changed, 1914 insertions, 0 deletions
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/CMakeLists.txt
new file mode 100644
index 0000000000..cafb9536b0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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/vswprintf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test1/CMakeLists.txt
new file mode 100644
index 0000000000..97fbeb4e28
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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_vswprintf_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test1 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test1/test1.c
new file mode 100644
index 0000000000..d386ce104f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test1/test1.c
@@ -0,0 +1,41 @@
+// 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 vswprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vswprintf.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 = NULL;
+ WCHAR buf[256] = { 0 };
+
+ if (PAL_Initialize(argc, argv) != 0)
+ return(FAIL);
+
+ checkstr = convert("hello world");
+ testvswp(buf, checkstr);
+
+ if (memcmp(checkstr, buf, wcslen(checkstr)*2+2) != 0)
+ {
+ Fail("ERROR: Expected \"%s\", got \"%s\"\n",
+ convertC(checkstr), convertC(buf));
+ }
+
+ free(checkstr);
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test1/testinfo.dat
new file mode 100644
index 0000000000..6161190d4c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests the PAL implementation of the vswprintf function.
+= General test to see if vswprintf works correctly.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test10/CMakeLists.txt
new file mode 100644
index 0000000000..06c11f68ca
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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_vswprintf_test10
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test10 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test10
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test10/test10.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test10/test10.c
new file mode 100644
index 0000000000..7f316e28f6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test10/test10.c
@@ -0,0 +1,48 @@
+// 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 vswprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vswprintf.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/vswprintf/test10/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test10/testinfo.dat
new file mode 100644
index 0000000000..81fbce5e4d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test10
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with octal numbers.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test11/CMakeLists.txt
new file mode 100644
index 0000000000..5237ba4e1d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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_vswprintf_test11
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test11 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test11
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test11/test11.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test11/test11.c
new file mode 100644
index 0000000000..608069f829
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test11/test11.c
@@ -0,0 +1,48 @@
+// 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 vswprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vswprintf.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/vswprintf/test11/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test11/testinfo.dat
new file mode 100644
index 0000000000..13585cc94e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test11
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with unsigned numbers.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test12/CMakeLists.txt
new file mode 100644
index 0000000000..26199c3dcc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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_vswprintf_test12
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test12 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test12
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test12/test12.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test12/test12.c
new file mode 100644
index 0000000000..36b203853a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test12/test12.c
@@ -0,0 +1,48 @@
+// 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 vswprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vswprintf.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/vswprintf/test12/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test12/testinfo.dat
new file mode 100644
index 0000000000..d42e9a1801
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test12
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with hex numbers (lowercase).
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test13/CMakeLists.txt
new file mode 100644
index 0000000000..d0acd98d64
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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_vswprintf_test13
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test13 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test13
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test13/test13.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test13/test13.c
new file mode 100644
index 0000000000..63dc36a960
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test13/test13.c
@@ -0,0 +1,48 @@
+// 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 vswprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vswprintf.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/vswprintf/test13/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test13/testinfo.dat
new file mode 100644
index 0000000000..f7c6756e30
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test13
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with hex numbers (uppercase).
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test14/CMakeLists.txt
new file mode 100644
index 0000000000..06c12674a4
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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_vswprintf_test14
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test14 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test14
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test14/test14.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test14/test14.c
new file mode 100644
index 0000000000..bb4ab16a54
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test14/test14.c
@@ -0,0 +1,61 @@
+// 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 vswprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vswprintf.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/vswprintf/test14/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test14/testinfo.dat
new file mode 100644
index 0000000000..e9615f906a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test14
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with exponential format doubles (lowercase).
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test15/CMakeLists.txt
new file mode 100644
index 0000000000..05dc41b0d8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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_vswprintf_test15
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test15 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test15
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test15/test15.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test15/test15.c
new file mode 100644
index 0000000000..6296220c4e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test15/test15.c
@@ -0,0 +1,62 @@
+// 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 vswprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vswprintf.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/vswprintf/test15/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test15/testinfo.dat
new file mode 100644
index 0000000000..24ff03b11a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test15
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with exponential format doubles (uppercase).
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test16/CMakeLists.txt
new file mode 100644
index 0000000000..3c42755043
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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_vswprintf_test16
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test16 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test16
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test16/test16.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test16/test16.c
new file mode 100644
index 0000000000..3a2059a491
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test16/test16.c
@@ -0,0 +1,61 @@
+// 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 vswprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vswprintf.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/vswprintf/test16/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test16/testinfo.dat
new file mode 100644
index 0000000000..6dc45f4c78
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test16
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with decimal point format doubles.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test17/CMakeLists.txt
new file mode 100644
index 0000000000..b94c466d5f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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_vswprintf_test17
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test17 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test17
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test17/test17.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test17/test17.c
new file mode 100644
index 0000000000..95e3bd9995
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test17/test17.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: test17.c
+**
+** Purpose: Test #17 for the vswprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vswprintf.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/vswprintf/test17/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test17/testinfo.dat
new file mode 100644
index 0000000000..815e57ddf5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test17
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with compact format doubles (lowercase).
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test18/CMakeLists.txt
new file mode 100644
index 0000000000..57cc8ccb03
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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_vswprintf_test18
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test18 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test18
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test18/test18.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test18/test18.c
new file mode 100644
index 0000000000..ae7ae4c44b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test18/test18.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: test18.c
+**
+** Purpose: Test #18 for the vswprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vswprintf.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/vswprintf/test18/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test18/testinfo.dat
new file mode 100644
index 0000000000..b5165999a6
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test18
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with compact format doubles (uppercase).
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test19/CMakeLists.txt
new file mode 100644
index 0000000000..2187b58727
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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_vswprintf_test19
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test19 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test19
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test19/test19.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test19/test19.c
new file mode 100644
index 0000000000..c00185be6d
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test19/test19.c
@@ -0,0 +1,137 @@
+// 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 vswprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vswprintf.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];
+
+ testvswp(buf, 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];
+
+ testvswp(buf, 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/vswprintf/test19/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test19/testinfo.dat
new file mode 100644
index 0000000000..ccc08cd7ba
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test19
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with argument specified precision.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test2/CMakeLists.txt
new file mode 100644
index 0000000000..295448cb0c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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_vswprintf_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test2 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test2/test2.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test2/test2.c
new file mode 100644
index 0000000000..491d99f0cf
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 vswprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vswprintf.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/vswprintf/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test2/testinfo.dat
new file mode 100644
index 0000000000..d6d7c3e8bd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with strings.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test3/CMakeLists.txt
new file mode 100644
index 0000000000..1fb6272ae7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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_vswprintf_test3
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test3 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test3
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test3/test3.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test3/test3.c
new file mode 100644
index 0000000000..1eb0b65ebe
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 vswprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vswprintf.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/vswprintf/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test3/testinfo.dat
new file mode 100644
index 0000000000..8fb9dc8060
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test3
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with wide strings.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test4/CMakeLists.txt
new file mode 100644
index 0000000000..cae0806e03
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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_vswprintf_test4
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test4 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test4
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test4/test4.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test4/test4.c
new file mode 100644
index 0000000000..5c9047b5a7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test4/test4.c
@@ -0,0 +1,118 @@
+// 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 vswprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vswprintf.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 };
+
+ testvswp(buf, 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 };
+
+ testvswp(buf, 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("0000000000000000"));
+ 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/vswprintf/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test4/testinfo.dat
new file mode 100644
index 0000000000..435f9703cd
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test4
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with pointers.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test5/CMakeLists.txt
new file mode 100644
index 0000000000..7c480455ed
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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_vswprintf_test5
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test5 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test5
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test5/test5.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test5/test5.c
new file mode 100644
index 0000000000..42146c8be7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test5/test5.c
@@ -0,0 +1,79 @@
+// 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 vswprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vswprintf.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;
+
+ testvswp(buf, 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;
+
+ testvswp(buf, 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/vswprintf/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test5/testinfo.dat
new file mode 100644
index 0000000000..17ca0fd33b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test5
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with the count specifier.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test6/CMakeLists.txt
new file mode 100644
index 0000000000..d7de580853
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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_vswprintf_test6
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test6 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test6
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test6/test6.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test6/test6.c
new file mode 100644
index 0000000000..51e99267a1
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test6/test6.c
@@ -0,0 +1,41 @@
+// 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 vswprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vswprintf.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/vswprintf/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test6/testinfo.dat
new file mode 100644
index 0000000000..f4ad2e954e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test6
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with characters.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test7/CMakeLists.txt
new file mode 100644
index 0000000000..eb07ee2cae
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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_vswprintf_test7
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test7 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test7
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test7/test7.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test7/test7.c
new file mode 100644
index 0000000000..6037cb0fe7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test7/test7.c
@@ -0,0 +1,41 @@
+// 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 vswprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vswprintf.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/vswprintf/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test7/testinfo.dat
new file mode 100644
index 0000000000..ed0a474f7e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test7
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with wide characters.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test8/CMakeLists.txt
new file mode 100644
index 0000000000..ed35ea8dd0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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_vswprintf_test8
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test8 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test8
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test8/test8.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test8/test8.c
new file mode 100644
index 0000000000..baba524650
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test8/test8.c
@@ -0,0 +1,47 @@
+// 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 vswprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vswprintf.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/vswprintf/test8/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test8/testinfo.dat
new file mode 100644
index 0000000000..4c5114bd27
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test8
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with decimal numbers.
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/vswprintf/test9/CMakeLists.txt
new file mode 100644
index 0000000000..7098da31d0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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_vswprintf_test9
+ ${SOURCES}
+)
+
+add_dependencies(paltest_vswprintf_test9 coreclrpal)
+
+target_link_libraries(paltest_vswprintf_test9
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/test9/test9.c b/src/pal/tests/palsuite/c_runtime/vswprintf/test9/test9.c
new file mode 100644
index 0000000000..5de004f5ed
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/test9/test9.c
@@ -0,0 +1,47 @@
+// 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 vswprintf function.
+**
+**
+**===================================================================*/
+
+#include <palsuite.h>
+#include "../vswprintf.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/vswprintf/test9/testinfo.dat b/src/pal/tests/palsuite/c_runtime/vswprintf/test9/testinfo.dat
new file mode 100644
index 0000000000..3c2bcdf3e5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/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 = vswprintf
+Name = Positive Test for vswprintf
+TYPE = DEFAULT
+EXE1 = test9
+Description
+= Tests the PAL implementation of the vswprintf function.
+= Tests vswprintf with integer numbers
+= This test is modeled after _snwprintf.
diff --git a/src/pal/tests/palsuite/c_runtime/vswprintf/vswprintf.h b/src/pal/tests/palsuite/c_runtime/vswprintf/vswprintf.h
new file mode 100644
index 0000000000..a79c9bb7a9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/vswprintf/vswprintf.h
@@ -0,0 +1,132 @@
+// 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: vswprintf.h
+**
+** Purpose: Containts common testing functions for vswprintf
+**
+**
+**==========================================================================*/
+
+#ifndef __vswprintf_H__
+#define __vswprintf_H__
+
+/* These functions leaks memory like crazy. C'est la vie. */
+int testvswp(wchar_t* buf, const wchar_t* format, ...)
+{
+ int retVal = 0;
+ va_list arglist;
+
+ va_start(arglist, format);
+ retVal = vswprintf(buf, format, arglist);
+ va_end(arglist);
+
+ return( retVal);
+}
+
+void DoWStrTest(WCHAR *formatstr, WCHAR *param, WCHAR *checkstr)
+{
+ WCHAR buf[256] = { 0 };
+
+ testvswp(buf, 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 };
+
+ testvswp(buf, 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 };
+
+ testvswp(buf, 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 };
+
+ testvswp(buf, 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 };
+
+ testvswp(buf, 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 };
+
+ testvswp(buf, 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 };
+
+ testvswp(buf, 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