summaryrefslogtreecommitdiff
path: root/src/pal/tests/palsuite/miscellaneous/wsprintfA
diff options
context:
space:
mode:
Diffstat (limited to 'src/pal/tests/palsuite/miscellaneous/wsprintfA')
-rw-r--r--src/pal/tests/palsuite/miscellaneous/wsprintfA/CMakeLists.txt13
-rw-r--r--src/pal/tests/palsuite/miscellaneous/wsprintfA/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/miscellaneous/wsprintfA/test1/test.c58
-rw-r--r--src/pal/tests/palsuite/miscellaneous/wsprintfA/test1/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/miscellaneous/wsprintfA/test11/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/miscellaneous/wsprintfA/test11/test.c128
-rw-r--r--src/pal/tests/palsuite/miscellaneous/wsprintfA/test11/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/miscellaneous/wsprintfA/test12/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/miscellaneous/wsprintfA/test12/test.c119
-rw-r--r--src/pal/tests/palsuite/miscellaneous/wsprintfA/test12/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/miscellaneous/wsprintfA/test13/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/miscellaneous/wsprintfA/test13/test.c120
-rw-r--r--src/pal/tests/palsuite/miscellaneous/wsprintfA/test13/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/miscellaneous/wsprintfA/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/miscellaneous/wsprintfA/test2/test.c123
-rw-r--r--src/pal/tests/palsuite/miscellaneous/wsprintfA/test2/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/miscellaneous/wsprintfA/test3/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/miscellaneous/wsprintfA/test3/test.c121
-rw-r--r--src/pal/tests/palsuite/miscellaneous/wsprintfA/test3/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/miscellaneous/wsprintfA/test6/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/miscellaneous/wsprintfA/test6/test.c114
-rw-r--r--src/pal/tests/palsuite/miscellaneous/wsprintfA/test6/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/miscellaneous/wsprintfA/test7/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/miscellaneous/wsprintfA/test7/test.c112
-rw-r--r--src/pal/tests/palsuite/miscellaneous/wsprintfA/test7/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/miscellaneous/wsprintfA/test8/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/miscellaneous/wsprintfA/test8/test.c120
-rw-r--r--src/pal/tests/palsuite/miscellaneous/wsprintfA/test8/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/miscellaneous/wsprintfA/test9/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/miscellaneous/wsprintfA/test9/test.c122
-rw-r--r--src/pal/tests/palsuite/miscellaneous/wsprintfA/test9/testinfo.dat14
31 files changed, 1480 insertions, 0 deletions
diff --git a/src/pal/tests/palsuite/miscellaneous/wsprintfA/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/wsprintfA/CMakeLists.txt
new file mode 100644
index 0000000000..f40d4151d6
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/wsprintfA/CMakeLists.txt
@@ -0,0 +1,13 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+add_subdirectory(test11)
+add_subdirectory(test12)
+add_subdirectory(test13)
+add_subdirectory(test2)
+add_subdirectory(test3)
+add_subdirectory(test6)
+add_subdirectory(test7)
+add_subdirectory(test8)
+add_subdirectory(test9)
+
diff --git a/src/pal/tests/palsuite/miscellaneous/wsprintfA/test1/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test1/CMakeLists.txt
new file mode 100644
index 0000000000..ef589329f0
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test1/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test.c
+)
+
+add_executable(paltest_wsprintfa_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wsprintfa_test1 coreclrpal)
+
+target_link_libraries(paltest_wsprintfa_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/miscellaneous/wsprintfA/test1/test.c b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test1/test.c
new file mode 100644
index 0000000000..722270965d
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test1/test.c
@@ -0,0 +1,58 @@
+// 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: test.c
+**
+** Purpose: Test for wsprintfA() function
+**
+**
+**=========================================================*/
+
+#include <palsuite.h>
+
+ char * ErrorMessage;
+ char buf[256];
+
+/* memcmp is used to verify the results, so this test is dependent on it. */
+/* ditto with strlen */
+
+int test1()
+{
+ char checkstr[] = "hello world";
+
+ wsprintf(buf, "hello world");
+
+ /* Error message */
+ ErrorMessage = "ERROR: (Test 1) Failed on 'hello world' test. The "
+ "correct string is 'hello world' and the result returned was ";
+
+ return (memcmp(checkstr, buf, strlen(checkstr)+1) != 0);
+}
+
+int __cdecl main(int argc, char *argv[])
+{
+
+ /*
+ * Initialize the PAL and return FAILURE if this fails
+ */
+
+ if(0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ if(test1())
+ {
+ Fail("%s '%s'\n",ErrorMessage,buf);
+ }
+
+ PAL_Terminate();
+ return PASS;
+
+}
+
+
+
diff --git a/src/pal/tests/palsuite/miscellaneous/wsprintfA/test1/testinfo.dat b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test1/testinfo.dat
new file mode 100644
index 0000000000..c06f4c01aa
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/wsprintfA/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 = Miscellaneous
+Function = wsprintfA
+Name = Positive test of wsprintfA
+TYPE = DEFAULT
+EXE1 = test
+Description
+= Test the very basic functionality of wsprintf.
+
+
diff --git a/src/pal/tests/palsuite/miscellaneous/wsprintfA/test11/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test11/CMakeLists.txt
new file mode 100644
index 0000000000..92c44b9341
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test11/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test.c
+)
+
+add_executable(paltest_wsprintfa_test11
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wsprintfa_test11 coreclrpal)
+
+target_link_libraries(paltest_wsprintfa_test11
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/miscellaneous/wsprintfA/test11/test.c b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test11/test.c
new file mode 100644
index 0000000000..b43299a045
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test11/test.c
@@ -0,0 +1,128 @@
+// 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: test.c
+**
+** Purpose: Test for wsprintfA() function
+**
+**
+**=========================================================*/
+
+#include <palsuite.h>
+
+/* memcmp is used to verify the results, so this test is dependent on it. */
+/* ditto with strlen */
+
+char * ErrorMessage;
+char buf[256];
+
+BOOL test1()
+{
+ int pos = 42;
+
+
+ /* Test 1 */
+ wsprintf(buf, "foo %u", pos);
+ if (memcmp(buf, "foo 42", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 1) Failed. The correct string is "
+ "'foo 42' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 2 */
+ wsprintf(buf, "foo %lu", 0xFFFF);
+ if (memcmp(buf, "foo 65535", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 2) Failed. The correct string is "
+ "'foo 65535' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 3 */
+ wsprintf(buf, "foo %hu", 0xFFFF);
+ if (memcmp(buf, "foo 65535", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 3) Failed. The correct string is "
+ "'foo 65535' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 4 */
+ wsprintf(buf, "foo %3u", pos);
+ if (memcmp(buf, "foo 42", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 4) Failed. The correct string is "
+ "'foo 42' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 5 */
+ wsprintf(buf, "foo %-3u", pos);
+ if (memcmp(buf, "foo 42 ", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 5) Failed. The correct string is "
+ "'foo 42' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 6 */
+ wsprintf(buf, "foo %.1u", pos);
+ if (memcmp(buf, "foo 42", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 6) Failed. The correct string is "
+ "'foo 42' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 7 */
+ wsprintf(buf, "foo %.3u", pos);
+ if (memcmp(buf, "foo 042", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 7) Failed. The correct string is "
+ "'foo 042' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 8 */
+ wsprintf(buf, "foo %03u", pos);
+ if (memcmp(buf, "foo 042", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 8) Failed. The correct string is "
+ "'foo 042' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 9 */
+ wsprintf(buf, "foo %#u", pos);
+ if (memcmp(buf, "foo 42", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 9) Failed. The correct string is "
+ "'foo 42' and the result returned was ";
+ return FAIL;
+ }
+ return PASS;
+}
+
+
+int __cdecl main(int argc, char *argv[])
+{
+
+ if(0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ if(test1())
+ {
+ Fail("%s'%s'\n",ErrorMessage,buf);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
diff --git a/src/pal/tests/palsuite/miscellaneous/wsprintfA/test11/testinfo.dat b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test11/testinfo.dat
new file mode 100644
index 0000000000..c5f1ec1975
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/wsprintfA/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 = Miscellaneous
+Function = wsprintfA
+Name = Positive test of wsprintfA
+TYPE = DEFAULT
+EXE1 = test
+Description
+= Test the %u formatter.
+
+
diff --git a/src/pal/tests/palsuite/miscellaneous/wsprintfA/test12/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test12/CMakeLists.txt
new file mode 100644
index 0000000000..e4013ad9e3
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test12/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test.c
+)
+
+add_executable(paltest_wsprintfa_test12
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wsprintfa_test12 coreclrpal)
+
+target_link_libraries(paltest_wsprintfa_test12
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/miscellaneous/wsprintfA/test12/test.c b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test12/test.c
new file mode 100644
index 0000000000..dcc61019d4
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test12/test.c
@@ -0,0 +1,119 @@
+// 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: test.c
+**
+** Purpose: Test for wsprintfA() function
+**
+**
+**=========================================================*/
+
+#include <palsuite.h>
+
+/* memcmp is used to verify the results, so this test is dependent on it. */
+/* ditto with strlen */
+
+char * ErrorMessage;
+char buf[256];
+
+BOOL test1()
+{
+ int pos = 0x1234ab;
+
+ /* Test 1 */
+ wsprintf(buf, "foo %x", pos);
+ if (memcmp(buf, "foo 1234ab", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 1) Failed. The correct "
+ "string is 'foo 1234ab' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 2 */
+ wsprintf(buf, "foo %lx", pos);
+ if (memcmp(buf, "foo 1234ab", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 2) Failed. The correct "
+ "string is 'foo 1234ab' and the result returned was ";
+ return FAIL;
+ }
+
+
+ /* Test 3 */
+ wsprintf(buf, "foo %7x", pos);
+ if (memcmp(buf, "foo 1234ab", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 3) Failed. The correct string is "
+ "'foo 1234ab' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 4 */
+ wsprintf(buf, "foo %-7x", pos);
+ if (memcmp(buf, "foo 1234ab ", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 4) Failed. The correct string is "
+ "'foo 1234ab' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 5 */
+ wsprintf(buf, "foo %.1x", pos);
+ if (memcmp(buf, "foo 1234ab", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 5) Failed. The correct string is "
+ "'foo 1234ab' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 6 */
+ wsprintf(buf, "foo %.7x", pos);
+ if (memcmp(buf, "foo 01234ab", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 6) Failed. The correct string is "
+ "'foo 01234ab' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 7 */
+ wsprintf(buf, "foo %07x", pos);
+ if (memcmp(buf, "foo 01234ab", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 7) Failed. The correct string is "
+ "'foo 01234ab' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 8 */
+ wsprintf(buf, "foo %#x", pos);
+ if (memcmp(buf, "foo 0x1234ab", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 8) Failed. The correct string is "
+ "'foo 0x1234ab' and the result returned was ";
+ return FAIL;
+ }
+
+ return PASS;
+}
+
+int __cdecl main(int argc, char *argv[])
+{
+
+ if(0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ if(test1())
+ {
+ Fail("%s '%s'\n",ErrorMessage,buf);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
diff --git a/src/pal/tests/palsuite/miscellaneous/wsprintfA/test12/testinfo.dat b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test12/testinfo.dat
new file mode 100644
index 0000000000..71c8386f27
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/wsprintfA/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 = Miscellaneous
+Function = wsprintfA
+Name = Positive test of wsprintfA
+TYPE = DEFAULT
+EXE1 = test
+Description
+= Test the %x formatter.
+
+
diff --git a/src/pal/tests/palsuite/miscellaneous/wsprintfA/test13/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test13/CMakeLists.txt
new file mode 100644
index 0000000000..423b05d8d9
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test13/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test.c
+)
+
+add_executable(paltest_wsprintfa_test13
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wsprintfa_test13 coreclrpal)
+
+target_link_libraries(paltest_wsprintfa_test13
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/miscellaneous/wsprintfA/test13/test.c b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test13/test.c
new file mode 100644
index 0000000000..e1f7d80a0f
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test13/test.c
@@ -0,0 +1,120 @@
+// 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: test.c
+**
+** Purpose: Test for wsprintfA() function
+**
+**
+**=========================================================*/
+
+#include <palsuite.h>
+
+/* memcmp is used to verify the results, so this test is dependent on it. */
+/* ditto with strlen */
+
+char * ErrorMessage;
+char buf[256];
+
+BOOL test1()
+{
+ int pos = 0x1234ab;
+
+ /* Test 1 */
+ wsprintf(buf, "foo %X", pos);
+ if (memcmp(buf, "foo 1234AB", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 1) Failed. The correct string is "
+ " 'foo 1234AB' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 2 */
+ wsprintf(buf, "foo %lX", pos);
+ if (memcmp(buf, "foo 1234AB", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 2) Failed. The correct string is "
+ "'foo 1234AB' and the result returned was ";
+ return FAIL;
+ }
+
+
+ /* Test 3 */
+ wsprintf(buf, "foo %7X", pos);
+ if (memcmp(buf, "foo 1234AB", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 3) Failed. The correct string is "
+ "'foo 1234AB' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 4 */
+ wsprintf(buf, "foo %-7X", pos);
+ if (memcmp(buf, "foo 1234AB ", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 4) Failed. The correct string is "
+ "'foo 1234AB' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 5 */
+ wsprintf(buf, "foo %.1X", pos);
+ if (memcmp(buf, "foo 1234AB", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 5) Failed. The correct string is "
+ "'foo 1234AB' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 6 */
+ wsprintf(buf, "foo %.7X", pos);
+ if (memcmp(buf, "foo 01234AB", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 6) Failed. The correct string is "
+ "'foo 01234AB' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 7 */
+ wsprintf(buf, "foo %07X", pos);
+ if (memcmp(buf, "foo 01234AB", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 7) Failed. The correct string is "
+ "'foo 01234AB' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 8 */
+ wsprintf(buf, "foo %#X", pos);
+ if (memcmp(buf, "foo 0X1234AB", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 8) Failed. The correct string is "
+ "'foo 0X1234AB' and the result returned was ";
+ return FAIL;
+ }
+
+ return PASS;
+}
+
+int __cdecl main(int argc, char *argv[])
+{
+
+ if(0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ if(test1())
+ {
+ Fail("%s '%s'\n",ErrorMessage,buf);
+ }
+
+ PAL_Terminate();
+ return PASS;
+
+}
+
+
diff --git a/src/pal/tests/palsuite/miscellaneous/wsprintfA/test13/testinfo.dat b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test13/testinfo.dat
new file mode 100644
index 0000000000..0e0d1b4633
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/wsprintfA/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 = Miscellaneous
+Function = wsprintfA
+Name = Positive test of wsprintfA
+TYPE = DEFAULT
+EXE1 = test
+Description
+= Test the %X formatter.
+
+
diff --git a/src/pal/tests/palsuite/miscellaneous/wsprintfA/test2/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test2/CMakeLists.txt
new file mode 100644
index 0000000000..546a1daa38
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test2/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test.c
+)
+
+add_executable(paltest_wsprintfa_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wsprintfa_test2 coreclrpal)
+
+target_link_libraries(paltest_wsprintfa_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/miscellaneous/wsprintfA/test2/test.c b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test2/test.c
new file mode 100644
index 0000000000..b879e54043
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test2/test.c
@@ -0,0 +1,123 @@
+// 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: test.c
+**
+** Purpose: Test for wsprintfA() function
+**
+**
+**=========================================================*/
+
+#include <palsuite.h>
+
+/* memcmp is used to verify the results, so this test is dependent on it. */
+/* ditto with strlen */
+
+char * ErrorMessage;
+char * BadResult;
+char buf[256];
+
+BOOL test1()
+{
+
+
+ /* Test 1 */
+ wsprintf(buf, "foo %s", "bar");
+ if (memcmp(buf, "foo bar", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 1) Failed. The correct string is "
+ "'foo bar' and the result returned was ";
+ BadResult = buf;
+ return FAIL;
+ }
+
+ /* Test 2 */
+ wsprintf(buf, "foo %hs", "bar");
+ if (memcmp(buf, "foo bar", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 2) Failed. The correct string is "
+ "'foo bar' and the result returned was ";
+ BadResult = buf;
+ return FAIL;
+ }
+
+
+ /* Test 3 */
+ wsprintf(buf, "foo %5s", "bar");
+ if (memcmp(buf, "foo bar", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 3) Failed. The correct string is "
+ "'foo bar' and the result returned was ";
+ BadResult = buf;
+ return FAIL;
+ }
+
+ /* Test 4 */
+ wsprintf(buf, "foo %.2s", "bar");
+ if (memcmp(buf, "foo ba", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 4) Failed. The correct string is "
+ "'foo ba' and the result returned was ";
+ BadResult = buf;
+ return FAIL;
+ }
+
+ /* Test 5 */
+ wsprintf(buf, "foo %5.2s", "bar");
+ if (memcmp(buf, "foo ba", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 5) Failed. The correct string is "
+ "'foo ba' and the result returned was ";
+ BadResult = buf;
+ return FAIL;
+ }
+
+ /* Test 6 */
+ wsprintf(buf, "foo %-5s", "bar");
+ if (memcmp(buf, "foo bar ", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 6) Failed. The correct string is "
+ "'foo bar' and the result returned was ";
+ BadResult = buf;
+ return FAIL;
+ }
+
+ /* Test 7 */
+ wsprintf(buf, "foo %05s", "bar");
+ if (memcmp(buf, "foo 00bar", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 7) Failed. The correct string is "
+ "'foo 00bar' and the result returned was ";
+ BadResult = buf;
+ return FAIL;
+ }
+ return PASS;
+}
+
+
+int __cdecl main(int argc, char *argv[])
+{
+
+ /*
+ * Initialize the PAL and return FAILURE if this fails
+ */
+
+ if(0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ if(test1())
+ {
+ Fail("%s '%s'\n",ErrorMessage,BadResult);
+ }
+
+ PAL_Terminate();
+ return PASS;
+
+}
+
+
diff --git a/src/pal/tests/palsuite/miscellaneous/wsprintfA/test2/testinfo.dat b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test2/testinfo.dat
new file mode 100644
index 0000000000..32e51df28b
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/wsprintfA/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 = Miscellaneous
+Function = wsprintfA
+Name = Positive test of wsprintfA
+TYPE = DEFAULT
+EXE1 = test
+Description
+= Test the %s and %ls formatters with various flags.
+
+
diff --git a/src/pal/tests/palsuite/miscellaneous/wsprintfA/test3/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test3/CMakeLists.txt
new file mode 100644
index 0000000000..8043ccd60b
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test3/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test.c
+)
+
+add_executable(paltest_wsprintfa_test3
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wsprintfa_test3 coreclrpal)
+
+target_link_libraries(paltest_wsprintfa_test3
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/miscellaneous/wsprintfA/test3/test.c b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test3/test.c
new file mode 100644
index 0000000000..bb598d9d63
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test3/test.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: test.c
+**
+** Purpose: Test for wsprintfA() function
+**
+**
+**=========================================================*/
+
+#include <palsuite.h>
+
+/* memcmp is used to verify the results, so this test is dependent on it. */
+/* ditto with strlen */
+
+char * ErrorMessage;
+char buf[256];
+
+BOOL test1()
+{
+
+ /* Test 1 */
+ wsprintf(buf, "foo %S", convert("bar"));
+ if (memcmp(buf, "foo bar", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 1) Failed. The correct string is "
+ "'foo bar' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 2 */
+ wsprintf(buf, "foo %hS", "bar");
+ if (memcmp(buf, "foo bar", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 2) Failed. The correct string is "
+ "'foo bar' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 3 */
+ wsprintf(buf, "foo %lS", convert("bar"));
+ if (memcmp(buf, "foo bar", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 3) Failed. The correct string is '"
+ "foo bar' and the result returned was ";
+ return FAIL;
+ }
+
+
+ /* Test 4 */
+ wsprintf(buf, "foo %5S", convert("bar"));
+ if (memcmp(buf, "foo bar", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 4) Failed. The correct string is "
+ "'foo bar' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 5 */
+ wsprintf(buf, "foo %.2S", convert("bar"));
+ if (memcmp(buf, "foo ba", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 5) Failed. The correct string is "
+ "'foo ba' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 6 */
+ wsprintf(buf, "foo %5.2S", convert("bar"));
+ if (memcmp(buf, "foo ba", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 6) Failed. The correct string is "
+ "'foo ba' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 7 */
+ wsprintf(buf, "foo %-5S", convert("bar"));
+ if (memcmp(buf, "foo bar ", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 7) Failed. The correct string is "
+ "'foo bar ' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 8 */
+ wsprintf(buf, "foo %05S", convert("bar"));
+ if (memcmp(buf, "foo 00bar", strlen(buf) + 1) != 0) {
+ ErrorMessage = "ERROR: (Test 8) Failed. The correct string is "
+ "'foo 00bar' and the result returned was ";
+ return FAIL;
+ }
+ return PASS;
+}
+
+int __cdecl main(int argc, char *argv[])
+{
+
+ /*
+ * Initialize the PAL and return FAILURE if this fails
+ */
+
+ if(0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ if(test1()) {
+ Fail("%s '%s'\n",ErrorMessage,buf);
+
+ }
+
+ PAL_Terminate();
+ return PASS;
+
+}
+
+
diff --git a/src/pal/tests/palsuite/miscellaneous/wsprintfA/test3/testinfo.dat b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test3/testinfo.dat
new file mode 100644
index 0000000000..0660aa17a3
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/wsprintfA/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 = Miscellaneous
+Function = wsprintfA
+Name = Positive test of wsprintfA
+TYPE = DEFAULT
+EXE1 = test
+Description
+= Test the %S and wide characters in general.
+
+
diff --git a/src/pal/tests/palsuite/miscellaneous/wsprintfA/test6/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test6/CMakeLists.txt
new file mode 100644
index 0000000000..6a5caf95c2
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test6/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test.c
+)
+
+add_executable(paltest_wsprintfa_test6
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wsprintfa_test6 coreclrpal)
+
+target_link_libraries(paltest_wsprintfa_test6
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/miscellaneous/wsprintfA/test6/test.c b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test6/test.c
new file mode 100644
index 0000000000..08d97f467a
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test6/test.c
@@ -0,0 +1,114 @@
+// 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: test.c
+**
+** Purpose: Test for wsprintfA() function
+**
+**
+**=========================================================*/
+
+#include <palsuite.h>
+
+/* memcmp is used to verify the results, so this test is dependent on it. */
+/* ditto with strlen */
+
+char * ErrorMessage;
+char buf[256];
+
+BOOL test1()
+{
+ WCHAR wc = 'c';
+
+ /* Test 1 */
+ wsprintf(buf, "foo %c", 'b');
+ if (memcmp(buf, "foo b", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 1) Failed. The correct string is "
+ "'foo b' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 2 */
+ wsprintf(buf, "foo %hc", 'b');
+ if (memcmp(buf, "foo b", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 2) Failed. The correct string is "
+ "'foo b' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 3 */
+ wsprintf(buf, "foo %lc", wc);
+ if (memcmp(buf, "foo c", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 3) Failed. The correct string is "
+ "'foo c' and the result returned was ";
+ return FAIL;
+ }
+
+
+ /* Test 4 */
+ wsprintf(buf, "foo %5c", 'b');
+ if (memcmp(buf, "foo b", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 4) Failed. The correct string is "
+ "'foo bar' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 5 */
+ wsprintf(buf, "foo %-5c", 'b');
+ if (memcmp(buf, "foo b ", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 5) Failed. The correct string is "
+ "'foo b ' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 6 */
+ wsprintf(buf, "foo %05c", 'b');
+ if (memcmp(buf, "foo 0000b", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 6) Failed. The correct string is "
+ "'foo 0000b' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 7 */
+ wsprintf(buf, "foo %#c", 'b');
+ if (memcmp(buf, "foo b", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 7) Failed. The correct string is "
+ "'foo b' and the result returned was ";
+ return FAIL;
+ }
+ return PASS;
+}
+
+int __cdecl main(int argc, char *argv[])
+{
+
+ /*
+ * Initialize the PAL and return FAILURE if this fails
+ */
+
+ if(0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ if(test1())
+ {
+ Fail("%s '%s'\n",ErrorMessage,buf);
+ }
+
+ PAL_Terminate();
+ return PASS;
+
+}
+
+
diff --git a/src/pal/tests/palsuite/miscellaneous/wsprintfA/test6/testinfo.dat b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test6/testinfo.dat
new file mode 100644
index 0000000000..31b0f667b6
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/wsprintfA/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 = Miscellaneous
+Function = wsprintfA
+Name = Positive test of wsprintfA
+TYPE = DEFAULT
+EXE1 = test
+Description
+= Test the %c formatter.
+
+
diff --git a/src/pal/tests/palsuite/miscellaneous/wsprintfA/test7/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test7/CMakeLists.txt
new file mode 100644
index 0000000000..0885f0f21e
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test7/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test.c
+)
+
+add_executable(paltest_wsprintfa_test7
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wsprintfa_test7 coreclrpal)
+
+target_link_libraries(paltest_wsprintfa_test7
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/miscellaneous/wsprintfA/test7/test.c b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test7/test.c
new file mode 100644
index 0000000000..6d380efaa9
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test7/test.c
@@ -0,0 +1,112 @@
+// 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: test.c
+**
+** Purpose: Test for wsprintfA() function
+**
+**
+**=========================================================*/
+
+#include <palsuite.h>
+
+/* memcmp is used to verify the results, so this test is dependent on it. */
+/* ditto with strlen */
+
+char * ErrorMessage;
+char buf[256];
+
+BOOL test1()
+{
+ WCHAR wb = 'b';
+
+ /* Test 1 */
+ wsprintf(buf, "foo %C", wb);
+ if (memcmp(buf, "foo b", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 1) Failed. The correct string is "
+ "'foo b' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 2 */
+ wsprintf(buf, "foo %hC", wb);
+ if (memcmp(buf, "foo b", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 2) Failed. The correct string is "
+ "'foo b' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 3 */
+ wsprintf(buf, "foo %lC", 'c');
+ if (memcmp(buf, "foo c", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 3) Failed. The correct string is "
+ "'foo c' and the result returned was ";
+ return FAIL;
+ }
+
+
+ /* Test 4 */
+ wsprintf(buf, "foo %5C", wb);
+ if (memcmp(buf, "foo b", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 4) Failed. The correct string is "
+ "'foo b' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 5 */
+ wsprintf(buf, "foo %-5C", wb);
+ if (memcmp(buf, "foo b ", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 5) Failed. The correct string is "
+ "'foo b ' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 6 */
+ wsprintf(buf, "foo %05C", wb);
+ if (memcmp(buf, "foo 0000b", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 6) Failed. The correct string is "
+ "'foo 0000b' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 7 */
+ wsprintf(buf, "foo %#C", wb);
+ if (memcmp(buf, "foo b", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 7) Failed. The correct string is "
+ "'foo b' and the result returned was ";
+ return FAIL;
+ }
+ return PASS;
+}
+
+int __cdecl main(int argc, char *argv[])
+{
+
+
+ if(0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ if(test1())
+ {
+ Fail("%s '%s'\n",ErrorMessage,buf);
+
+ }
+
+ PAL_Terminate();
+ return PASS;
+
+}
+
+
diff --git a/src/pal/tests/palsuite/miscellaneous/wsprintfA/test7/testinfo.dat b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test7/testinfo.dat
new file mode 100644
index 0000000000..31b0f667b6
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/wsprintfA/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 = Miscellaneous
+Function = wsprintfA
+Name = Positive test of wsprintfA
+TYPE = DEFAULT
+EXE1 = test
+Description
+= Test the %c formatter.
+
+
diff --git a/src/pal/tests/palsuite/miscellaneous/wsprintfA/test8/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test8/CMakeLists.txt
new file mode 100644
index 0000000000..3c4b5ed36e
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test8/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test.c
+)
+
+add_executable(paltest_wsprintfa_test8
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wsprintfa_test8 coreclrpal)
+
+target_link_libraries(paltest_wsprintfa_test8
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/miscellaneous/wsprintfA/test8/test.c b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test8/test.c
new file mode 100644
index 0000000000..7367461544
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test8/test.c
@@ -0,0 +1,120 @@
+// 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: test.c
+**
+** Purpose: Test for wsprintfA() function
+**
+**
+**=========================================================*/
+
+#include <palsuite.h>
+
+/* memcmp is used to verify the results, so this test is dependent on it. */
+/* ditto with strlen */
+
+char * ErrorMessage;
+char buf[256];
+
+BOOL test1()
+{
+ int pos = 42;
+
+ /* Test 1 */
+ wsprintf(buf, "foo %d", pos);
+ if (memcmp(buf, "foo 42", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 1) Failed. The correct string is "
+ "'foo 42' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 2 */
+ wsprintf(buf, "foo %ld", 0xFFFF);
+ if (memcmp(buf, "foo 65535", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 2) Failed. The correct string is "
+ "'foo 65535' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 3 */
+ wsprintf(buf, "foo %3d", pos);
+ if (memcmp(buf, "foo 42", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 3) Failed. The correct string is "
+ "'foo 42' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 4 */
+ wsprintf(buf, "foo %-3d", pos);
+ if (memcmp(buf, "foo 42 ", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 4) Failed. The correct string is "
+ "'foo 42 ' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 5 */
+ wsprintf(buf, "foo %.1d", pos);
+ if (memcmp(buf, "foo 42", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 5) Failed. The correct string is "
+ "'foo 42' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 6 */
+ wsprintf(buf, "foo %.3d", pos);
+ if (memcmp(buf, "foo 042", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 6) Failed. The correct string is "
+ "'foo 042' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 7 */
+ wsprintf(buf, "foo %03d", pos);
+ if (memcmp(buf, "foo 042", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 7) Failed. The correct string is "
+ "'foo 042' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 8 */
+ wsprintf(buf, "foo %#d", pos);
+ if (memcmp(buf, "foo 42", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 8) Failed. The correct string is "
+ "'foo 42' and the result returned was ";
+ return FAIL;
+ }
+ return PASS;
+}
+
+int __cdecl main(int argc, char *argv[])
+{
+
+
+ if(0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ if(test1())
+ {
+ Fail("%s '%s'\n",ErrorMessage,buf);
+ }
+
+ PAL_Terminate();
+ return PASS;
+
+}
+
+
+
diff --git a/src/pal/tests/palsuite/miscellaneous/wsprintfA/test8/testinfo.dat b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test8/testinfo.dat
new file mode 100644
index 0000000000..75f4fbf121
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/wsprintfA/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 = Miscellaneous
+Function = wsprintfA
+Name = Positive test of wsprintfA
+TYPE = DEFAULT
+EXE1 = test
+Description
+= Test the %d formatter.
+
+
diff --git a/src/pal/tests/palsuite/miscellaneous/wsprintfA/test9/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test9/CMakeLists.txt
new file mode 100644
index 0000000000..dcbb22ebb5
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test9/CMakeLists.txt
@@ -0,0 +1,19 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+set(CMAKE_INCLUDE_CURRENT_DIR ON)
+
+set(SOURCES
+ test.c
+)
+
+add_executable(paltest_wsprintfa_test9
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wsprintfa_test9 coreclrpal)
+
+target_link_libraries(paltest_wsprintfa_test9
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/miscellaneous/wsprintfA/test9/test.c b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test9/test.c
new file mode 100644
index 0000000000..9f123bcc6d
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test9/test.c
@@ -0,0 +1,122 @@
+// 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: test.c
+**
+** Purpose: Test for wsprintfA() function
+**
+**
+**=========================================================*/
+
+#include <palsuite.h>
+
+/* memcmp is used to verify the results, so this test is dependent on it. */
+/* ditto with strlen */
+
+char * ErrorMessage;
+char buf[256];
+
+BOOL test1()
+{
+
+ int pos = 42;
+
+
+ /* Test 1 */
+ wsprintf(buf, "foo %i", pos);
+ if (memcmp(buf, "foo 42", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 1) Failed. The correct string is "
+ "'foo 42' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 2 */
+ wsprintf(buf, "foo %li", 0xFFFF);
+ if (memcmp(buf, "foo 65535", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 2) Failed. The correct string is "
+ "'foo 65535' and the result returned was ";
+ return FAIL;
+ }
+
+
+ /* Test 3 */
+ wsprintf(buf, "foo %3i", pos);
+ if (memcmp(buf, "foo 42", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 3) Failed. The correct string is "
+ "'foo 42' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 4 */
+ wsprintf(buf, "foo %-3i", pos);
+ if (memcmp(buf, "foo 42 ", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 4) Failed. The correct string is "
+ "'foo 42 ' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 5 */
+ wsprintf(buf, "foo %.1i", pos);
+ if (memcmp(buf, "foo 42", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 5) Failed. The correct string is "
+ "'foo 42' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 6 */
+ wsprintf(buf, "foo %.3i", pos);
+ if (memcmp(buf, "foo 042", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 6) Failed. The correct string is "
+ "'foo 042' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 7 */
+ wsprintf(buf, "foo %03i", pos);
+ if (memcmp(buf, "foo 042", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 7) Failed. The correct string is "
+ "'foo 042' and the result returned was ";
+ return FAIL;
+ }
+
+ /* Test 8 */
+ wsprintf(buf, "foo %#i", pos);
+ if (memcmp(buf, "foo 42", strlen(buf) + 1) != 0)
+ {
+ ErrorMessage = "ERROR: (Test 8) Failed. The correct string is "
+ "'foo 42' and the result returned was ";
+ return FAIL;
+ }
+
+ return PASS;
+}
+
+int __cdecl main(int argc, char *argv[])
+{
+
+ if(0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+ if(test1())
+ {
+ Fail("%s '%s'\n",ErrorMessage,buf);
+ }
+
+ PAL_Terminate();
+ return PASS;
+
+}
+
+
diff --git a/src/pal/tests/palsuite/miscellaneous/wsprintfA/test9/testinfo.dat b/src/pal/tests/palsuite/miscellaneous/wsprintfA/test9/testinfo.dat
new file mode 100644
index 0000000000..2a3689e4dd
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/wsprintfA/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 = Miscellaneous
+Function = wsprintfA
+Name = Positive test of wsprintfA
+TYPE = DEFAULT
+EXE1 = test
+Description
+= Test the %i formatter.
+
+