summaryrefslogtreecommitdiff
path: root/src/pal/tests/palsuite/c_runtime/fwprintf
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/fwprintf
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/fwprintf')
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/CMakeLists.txt22
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/fwprintf.h453
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test1/test1.c71
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test1/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test10/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test10/test10.c51
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test10/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test11/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test11/test11.c51
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test11/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test12/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test12/test12.c52
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test12/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test13/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test13/test13.c52
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test13/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test14/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test14/test14.c66
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test14/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test15/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test15/test15.c66
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test15/testinfo.dat14
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test16/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test16/test16.c65
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test16/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test17/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test17/test17.c51
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test17/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test18/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test18/test18.c51
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test18/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test19/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test19/test19.c81
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test19/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test2/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test2/test2.c45
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test2/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test3/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test3/test3.c45
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test3/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test4/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test4/test4.c85
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test4/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test5/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test5/test5.c63
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test5/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test6/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test6/test6.c48
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test6/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test7/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test7/test7.c47
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test7/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test8/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test8/test8.c51
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test8/testinfo.dat13
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test9/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test9/test9.c51
-rw-r--r--src/pal/tests/palsuite/c_runtime/fwprintf/test9/testinfo.dat13
59 files changed, 2177 insertions, 0 deletions
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/CMakeLists.txt
new file mode 100644
index 0000000000..cafb9536b0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/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/fwprintf/fwprintf.h b/src/pal/tests/palsuite/c_runtime/fwprintf/fwprintf.h
new file mode 100644
index 0000000000..36756636cf
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/fwprintf.h
@@ -0,0 +1,453 @@
+// 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: fwprintf.h
+**
+** Purpose: Containts common testing functions for fwprintf
+**
+**
+**==========================================================================*/
+
+#ifndef __fwprintf_H__
+#define __fwprintf_H__
+
+void DoStrTest(WCHAR *formatstr, char* param, char *checkstr)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+ if ((fwprintf(fp, formatstr, param)) < 0)
+ {
+ Fail("ERROR: fwprintf failed\n");
+ }
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0)
+ {
+ Fail("ERROR: failed to insert string \"%\" into \"%S\"\n"
+ "Expected \"%s\" got \"%s\".\n",
+ param, formatstr, checkstr, buf);
+ }
+ fclose(fp);
+}
+
+void DoWStrTest(WCHAR *formatstr, WCHAR* param, char *checkstr)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+ if ((fwprintf(fp, formatstr, param)) < 0)
+ {
+ Fail("ERROR: fwprintf failed\n");
+ }
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0)
+ {
+ Fail("ERROR: failed to insert wide string \"%s\" into \"%S\"\n"
+ "Expected \"%s\" got \"%s\".\n",
+ convertC(param), formatstr, checkstr, buf);
+ }
+ fclose(fp);
+}
+
+
+void DoPointerTest(WCHAR *formatstr, void* param, char* paramstr,
+ char *checkstr1, char *checkstr2)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+
+ if ((fwprintf(fp, formatstr, param)) < 0)
+ {
+ Fail("ERROR: fwprintf failed\n");
+ }
+
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 &&
+ memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0 )
+ {
+ Fail("ERROR: failed to insert %s into \"%s\"\n"
+ "Expected \"%s\" or \"%s\" got \"%s\".\n",
+ paramstr, formatstr, checkstr1, checkstr2, buf);
+ }
+
+ if ((fclose( fp )) != 0)
+ {
+ Fail("ERROR: fclose failed to close \"testfile.txt\"\n");
+ }
+}
+
+
+
+void DoCountTest(WCHAR *formatstr, int param, char *checkstr)
+{
+ FILE *fp;
+ char buf[512] = { 0 };
+ int n = -1;
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+
+ if ((fwprintf(fp, formatstr, &n)) < 0)
+ {
+ Fail("ERROR: fwprintf failed\n");
+ }
+
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if ((fgets(buf, sizeof(buf), fp)) == NULL)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if (n != param)
+ {
+ Fail("ERROR: Expected count parameter to resolve to %d, got %X\n",
+ param, n);
+ }
+
+ if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0)
+ {
+ Fail("ERROR: Expected \"%s\" got \"%s\".\n", checkstr, buf);
+ }
+
+ if ((fclose( fp )) != 0)
+ {
+ Fail("ERROR: fclose failed to close \"testfile.txt\"\n");
+ }
+}
+
+void DoShortCountTest(WCHAR *formatstr, int param, char *checkstr)
+{
+ FILE *fp;
+ char buf[512] = { 0 };
+ short int n = -1;
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+
+ if ((fwprintf(fp, formatstr, &n)) < 0)
+ {
+ Fail("ERROR: fwprintf failed\n");
+ }
+
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if (n != param)
+ {
+ Fail("ERROR: Expected count parameter to resolve to %d, got %X\n",
+ param, n);
+ }
+
+ if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0)
+ {
+ Fail("ERROR: Expected \"%s\" got \"%s\".\n", checkstr, buf);
+ }
+
+ if ((fclose( fp )) != 0)
+ {
+ Fail("ERROR: fclose failed to close \"testfile.txt\"\n");
+ }
+}
+
+
+void DoCharTest(WCHAR *formatstr, char param, char *checkstr)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+ if ((fwprintf(fp, formatstr, param)) < 0)
+ {
+ Fail("ERROR: fwprintf failed\n");
+ }
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0)
+ {
+ Fail("ERROR: failed to insert char \'%c\' (%d) into \"%S\"\n"
+ "Expected \"%s\" got \"%s\".\n",
+ param, param, formatstr, checkstr, buf);
+ }
+ fclose(fp);
+}
+
+void DoWCharTest(WCHAR *formatstr, WCHAR param, char *checkstr)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+ if ((fwprintf(fp, formatstr, param)) < 0)
+ {
+ Fail("ERROR: fwprintf failed\n");
+ }
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0)
+ {
+ Fail("ERROR: failed to insert wide char \'%c\' (%d) into \"%S\"\n"
+ "Expected \"%s\" got \"%s\".\n",
+ (char)param, param, formatstr, checkstr, buf);
+ }
+ fclose(fp);
+}
+
+void DoNumTest(WCHAR *formatstr, int value, char *checkstr)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+ if ((fwprintf(fp, formatstr, value)) < 0)
+ {
+ Fail("ERROR: fwprintf failed\n");
+ }
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if (memcmp(buf, checkstr, strlen(checkstr) + 1) != 0)
+ {
+ Fail("ERROR: failed to insert %#x into \"%S\"\n"
+ "Expected \"%s\" got \"%s\".\n",
+ value, formatstr, checkstr, buf);
+ }
+ fclose(fp);
+}
+
+void DoI64Test(WCHAR *formatstr, INT64 value, char *valuestr, char *checkstr1,
+ char *checkstr2)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+ if ((fwprintf(fp, formatstr, value)) < 0)
+ {
+ Fail("ERROR: fwprintf failed\n");
+ }
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 &&
+ memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0)
+ {
+ Fail("ERROR: failed to insert %s into \"%S\"\n"
+ "Expected \"%s\" or \"%s\", got \"%s\".\n",
+ valuestr, formatstr, checkstr1, checkstr2, buf);
+ }
+ fclose(fp);
+}
+
+void DoDoubleTest(WCHAR *formatstr, double value, char *checkstr1,
+ char *checkstr2)
+{
+ FILE *fp;
+ char buf[256] = { 0 };
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+
+ if ((fwprintf(fp, formatstr, value)) < 0)
+ {
+ Fail("ERROR: fwprintf failed\n");
+ }
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 &&
+ memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0)
+ {
+ Fail("ERROR: failed to insert %f into \"%S\"\n"
+ "Expected \"%s\" or \"%s\", got \"%s\".\n",
+ value, formatstr, checkstr1, checkstr2, buf);
+ }
+ fclose(fp);
+}
+
+
+void DoArgumentPrecTest(WCHAR *formatstr, int precision, void *param,
+ char *paramstr, char *checkstr1, char *checkstr2)
+{
+ FILE *fp;
+ char buf[256];
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+
+ if ((fwprintf(fp, formatstr, precision, param)) < 0)
+ {
+ Fail("ERROR: fwprintf failed\n");
+ }
+
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 &&
+ memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0)
+ {
+ Fail("ERROR: failed to insert %s into \"%s\" with precision %d\n"
+ "Expected \"%s\" or \"%s\", got \"%s\".\n", paramstr, formatstr,
+ precision, checkstr1, checkstr2, buf);
+ }
+
+
+ if ((fclose( fp )) != 0)
+ {
+ Fail("ERROR: fclose failed to close \"testfile.txt\"\n");
+ }
+
+}
+
+void DoArgumentPrecDoubleTest(WCHAR *formatstr, int precision, double param,
+ char *checkstr1, char *checkstr2)
+{
+ FILE *fp;
+ char buf[256];
+
+ if ((fp = fopen("testfile.txt", "w+")) == NULL )
+ {
+ Fail("ERROR: fopen failed to create testfile\n");
+ }
+
+ if ((fwprintf(fp, formatstr, precision, param)) < 0)
+ {
+ Fail("ERROR: fwprintf failed\n");
+ }
+
+ if ((fseek(fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if ((fgets(buf, 100, fp)) == NULL)
+ {
+ Fail("ERROR: fseek failed\n");
+ }
+
+ if (memcmp(buf, checkstr1, strlen(checkstr1) + 1) != 0 &&
+ memcmp(buf, checkstr2, strlen(checkstr2) + 1) != 0)
+ {
+ Fail("ERROR: failed to insert %f into \"%s\" with precision %d\n"
+ "Expected \"%s\" or \"%s\", got \"%s\".\n", param, formatstr,
+ precision, checkstr1, checkstr2, buf);
+ }
+
+ if ((fclose( fp )) != 0)
+ {
+ Fail("ERROR: fclose failed to close \"testfile.txt\"\n");
+ }
+
+}
+
+#endif
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test1/CMakeLists.txt
new file mode 100644
index 0000000000..ce4271edb2
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/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_fwprintf_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test1 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test1/test1.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test1/test1.c
new file mode 100644
index 0000000000..8a171db52a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test1/test1.c
@@ -0,0 +1,71 @@
+// 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: A single, basic, test case with no formatting.
+** Test modeled after the sprintf series.
+**
+
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+/*
+ * Depends on memcmp, strlen, fopen, fgets, fseek and fclose.
+ */
+
+int __cdecl main(int argc, char *argv[])
+{
+ FILE *fp;
+ char testfile[] = "testfile.txt";
+
+ WCHAR *outstr;
+ char checkstr[] = "hello world";
+ char buf[256];
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ outstr = convert(checkstr);
+ if ((fp = fopen(testfile, "w+")) == NULL)
+ {
+ Fail("ERROR: fopen failed to create \"%s\"\n", testfile);
+ }
+
+ if ((fwprintf(fp, outstr)) < 0)
+ {
+ Fail("ERROR: fwprintf failed to print to \"%s\"\n", testfile);
+ }
+
+ if ((fseek( fp, 0, SEEK_SET)) != 0)
+ {
+ Fail("ERROR: Fseek failed to set pointer to beginning of file\n" );
+ }
+
+
+ if ((fgets( buf, 100, fp )) == NULL)
+ {
+ Fail("ERROR: fgets failed\n");
+ }
+
+ if (memcmp(checkstr, buf, strlen(checkstr)+1) != 0)
+ {
+ Fail("ERROR: expected %s, got %s\n", checkstr, buf);
+ }
+
+
+ if ((fclose( fp )) != 0)
+ {
+ Fail("ERROR: fclose failed to close \"%s\"\n", testfile);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test1/testinfo.dat
new file mode 100644
index 0000000000..3bef5c6384
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test1/testinfo.dat
@@ -0,0 +1,13 @@
+# 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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= A single, basic, test case with no formatting.
+= Test modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test10/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test10/CMakeLists.txt
new file mode 100644
index 0000000000..a8323b4fc7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/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_fwprintf_test10
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test10 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test10
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test10/test10.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test10/test10.c
new file mode 100644
index 0000000000..3aa2c45c7c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test10/test10.c
@@ -0,0 +1,51 @@
+// 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: Tests the octal specifier (%o).
+** This test is modeled after the sprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fwprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+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, "foo 52");
+ DoNumTest(convert("foo %lo"), 0xFFFF, "foo 177777");
+ DoNumTest(convert("foo %ho"), 0xFFFF, "foo 177777");
+ DoNumTest(convert("foo %Lo"), pos, "foo 52");
+ DoI64Test(convert("foo %I64o"), l, "42", "foo 52", "foo 52");
+ DoNumTest(convert("foo %3o"), pos, "foo 52");
+ DoNumTest(convert("foo %-3o"), pos, "foo 52 ");
+ DoNumTest(convert("foo %.1o"), pos, "foo 52");
+ DoNumTest(convert("foo %.3o"), pos, "foo 052");
+ DoNumTest(convert("foo %03o"), pos, "foo 052");
+ DoNumTest(convert("foo %#o"), pos, "foo 052");
+ DoNumTest(convert("foo %+o"), pos, "foo 52");
+ DoNumTest(convert("foo % o"), pos, "foo 52");
+ DoNumTest(convert("foo %+o"), neg, "foo 37777777726");
+ DoNumTest(convert("foo % o"), neg, "foo 37777777726");
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test10/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test10/testinfo.dat
new file mode 100644
index 0000000000..17902cb7fc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test10/testinfo.dat
@@ -0,0 +1,13 @@
+# 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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test10
+Description
+= Tests the octal specifier (%o).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test11/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test11/CMakeLists.txt
new file mode 100644
index 0000000000..1b7987400a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/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_fwprintf_test11
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test11 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test11
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test11/test11.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test11/test11.c
new file mode 100644
index 0000000000..5867cd64fb
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test11/test11.c
@@ -0,0 +1,51 @@
+// 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 the unsigned int specifier (%u).
+** This test is modeled after the sprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fwprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+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, "foo 42");
+ DoNumTest(convert("foo %lu"), 0xFFFF, "foo 65535");
+ DoNumTest(convert("foo %hu"), 0xFFFF, "foo 65535");
+ DoNumTest(convert("foo %Lu"), pos, "foo 42");
+ DoI64Test(convert("foo %I64u"), l, "42", "foo 42", "foo 42");
+ DoNumTest(convert("foo %3u"), pos, "foo 42");
+ DoNumTest(convert("foo %-3u"), pos, "foo 42 ");
+ DoNumTest(convert("foo %.1u"), pos, "foo 42");
+ DoNumTest(convert("foo %.3u"), pos, "foo 042");
+ DoNumTest(convert("foo %03u"), pos, "foo 042");
+ DoNumTest(convert("foo %#u"), pos, "foo 42");
+ DoNumTest(convert("foo %+u"), pos, "foo 42");
+ DoNumTest(convert("foo % u"), pos, "foo 42");
+ DoNumTest(convert("foo %+u"), neg, "foo 4294967254");
+ DoNumTest(convert("foo % u"), neg, "foo 4294967254");
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test11/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test11/testinfo.dat
new file mode 100644
index 0000000000..beda0cc3ab
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test11/testinfo.dat
@@ -0,0 +1,13 @@
+# 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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test11
+Description
+= Test the unsigned int specifier (%u).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test12/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test12/CMakeLists.txt
new file mode 100644
index 0000000000..1e43a4c906
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/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_fwprintf_test12
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test12 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test12
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test12/test12.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test12/test12.c
new file mode 100644
index 0000000000..48a6123423
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test12/test12.c
@@ -0,0 +1,52 @@
+// 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: Tests the (lowercase) hexadecimal specifier (%x).
+** This test is modeled after the sprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fwprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+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, "foo 1234ab");
+ DoNumTest(convert("foo %lx"), pos, "foo 1234ab");
+ DoNumTest(convert("foo %hx"), pos, "foo 34ab");
+ DoNumTest(convert("foo %Lx"), pos, "foo 1234ab");
+ DoI64Test(convert("foo %I64x"), l, "0x1234567887654321",
+ "foo 1234567887654321", "foo 0x1234567887654321");
+ DoNumTest(convert("foo %7x"), pos, "foo 1234ab");
+ DoNumTest(convert("foo %-7x"), pos, "foo 1234ab ");
+ DoNumTest(convert("foo %.1x"), pos, "foo 1234ab");
+ DoNumTest(convert("foo %.7x"), pos, "foo 01234ab");
+ DoNumTest(convert("foo %07x"), pos, "foo 01234ab");
+ DoNumTest(convert("foo %#x"), pos, "foo 0x1234ab");
+ DoNumTest(convert("foo %+x"), pos, "foo 1234ab");
+ DoNumTest(convert("foo % x"), pos, "foo 1234ab");
+ DoNumTest(convert("foo %+x"), neg, "foo ffffffd6");
+ DoNumTest(convert("foo % x"), neg, "foo ffffffd6");
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test12/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test12/testinfo.dat
new file mode 100644
index 0000000000..3d0bf4c8f8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test12/testinfo.dat
@@ -0,0 +1,13 @@
+# 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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test12
+Description
+= Tests the (lowercase) hexadecimal specifier (%x).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test13/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test13/CMakeLists.txt
new file mode 100644
index 0000000000..c84dc3ea41
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/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_fwprintf_test13
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test13 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test13
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test13/test13.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test13/test13.c
new file mode 100644
index 0000000000..6eabec6c77
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test13/test13.c
@@ -0,0 +1,52 @@
+// 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: Tests the (uppercase) hexadecimal specifier (%X).
+** This test is modeled after the sprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fwprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+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, "foo 1234AB");
+ DoNumTest(convert("foo %lX"), pos, "foo 1234AB");
+ DoNumTest(convert("foo %hX"), pos, "foo 34AB");
+ DoNumTest(convert("foo %LX"), pos, "foo 1234AB");
+ DoI64Test(convert("foo %I64X"), l, "0x1234567887654321",
+ "foo 1234567887654321", "foo 0x1234567887654321");
+ DoNumTest(convert("foo %7X"), pos, "foo 1234AB");
+ DoNumTest(convert("foo %-7X"), pos, "foo 1234AB ");
+ DoNumTest(convert("foo %.1X"), pos, "foo 1234AB");
+ DoNumTest(convert("foo %.7X"), pos, "foo 01234AB");
+ DoNumTest(convert("foo %07X"), pos, "foo 01234AB");
+ DoNumTest(convert("foo %#X"), pos, "foo 0X1234AB");
+ DoNumTest(convert("foo %+X"), pos, "foo 1234AB");
+ DoNumTest(convert("foo % X"), pos, "foo 1234AB");
+ DoNumTest(convert("foo %+X"), neg, "foo FFFFFFD6");
+ DoNumTest(convert("foo % X"), neg, "foo FFFFFFD6");
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test13/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test13/testinfo.dat
new file mode 100644
index 0000000000..c3222e7c9e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test13/testinfo.dat
@@ -0,0 +1,13 @@
+# 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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test13
+Description
+= Tests the (uppercase) hexadecimal specifier (%X).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test14/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test14/CMakeLists.txt
new file mode 100644
index 0000000000..97824c76b7
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/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_fwprintf_test14
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test14 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test14
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test14/test14.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test14/test14.c
new file mode 100644
index 0000000000..001cf72689
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test14/test14.c
@@ -0,0 +1,66 @@
+// 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: Tests the lowercase exponential
+** notation double specifier (%e).
+** This test is modeled after the sprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fwprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+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, "foo 2.560000e+002",
+ "foo 2.560000e+02");
+ DoDoubleTest(convert("foo %le"), val, "foo 2.560000e+002",
+ "foo 2.560000e+02");
+ DoDoubleTest(convert("foo %he"), val, "foo 2.560000e+002",
+ "foo 2.560000e+02");
+ DoDoubleTest(convert("foo %Le"), val, "foo 2.560000e+002",
+ "foo 2.560000e+02");
+ DoDoubleTest(convert("foo %I64e"), val, "foo 2.560000e+002",
+ "foo 2.560000e+02");
+ DoDoubleTest(convert("foo %14e"), val, "foo 2.560000e+002",
+ "foo 2.560000e+02");
+ DoDoubleTest(convert("foo %-14e"), val, "foo 2.560000e+002 ",
+ "foo 2.560000e+02 ");
+ DoDoubleTest(convert("foo %.1e"), val, "foo 2.6e+002",
+ "foo 2.6e+02");
+ DoDoubleTest(convert("foo %.8e"), val, "foo 2.56000000e+002",
+ "foo 2.56000000e+02");
+ DoDoubleTest(convert("foo %014e"), val, "foo 02.560000e+002",
+ "foo 002.560000e+02");
+ DoDoubleTest(convert("foo %#e"), val, "foo 2.560000e+002",
+ "foo 2.560000e+02");
+ DoDoubleTest(convert("foo %+e"), val, "foo +2.560000e+002",
+ "foo +2.560000e+02");
+ DoDoubleTest(convert("foo % e"), val, "foo 2.560000e+002",
+ "foo 2.560000e+02");
+ DoDoubleTest(convert("foo %+e"), neg, "foo -2.560000e+002",
+ "foo -2.560000e+02");
+ DoDoubleTest(convert("foo % e"), neg, "foo -2.560000e+002",
+ "foo -2.560000e+02");
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test14/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test14/testinfo.dat
new file mode 100644
index 0000000000..a723f76083
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test14
+Description
+= Tests the lowercase exponential
+= notation double specifier (%e).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test15/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test15/CMakeLists.txt
new file mode 100644
index 0000000000..6786c5b774
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/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_fwprintf_test15
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test15 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test15
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test15/test15.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test15/test15.c
new file mode 100644
index 0000000000..9dfe82eccc
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test15/test15.c
@@ -0,0 +1,66 @@
+// 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: Tests the uppercase exponential
+** notation double specifier (%E).
+** This test is modeled after the sprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fwprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+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, "foo 2.560000E+002",
+ "foo 2.560000E+02");
+ DoDoubleTest(convert("foo %lE"), val, "foo 2.560000E+002",
+ "foo 2.560000E+02");
+ DoDoubleTest(convert("foo %hE"), val, "foo 2.560000E+002",
+ "foo 2.560000E+02");
+ DoDoubleTest(convert("foo %LE"), val, "foo 2.560000E+002",
+ "foo 2.560000E+02");
+ DoDoubleTest(convert("foo %I64E"), val, "foo 2.560000E+002",
+ "foo 2.560000E+02");
+ DoDoubleTest(convert("foo %14E"), val, "foo 2.560000E+002",
+ "foo 2.560000E+02");
+ DoDoubleTest(convert("foo %-14E"), val, "foo 2.560000E+002 ",
+ "foo 2.560000E+02 ");
+ DoDoubleTest(convert("foo %.1E"), val, "foo 2.6E+002",
+ "foo 2.6E+02");
+ DoDoubleTest(convert("foo %.8E"), val, "foo 2.56000000E+002",
+ "foo 2.56000000E+02");
+ DoDoubleTest(convert("foo %014E"), val, "foo 02.560000E+002",
+ "foo 002.560000E+02");
+ DoDoubleTest(convert("foo %#E"), val, "foo 2.560000E+002",
+ "foo 2.560000E+02");
+ DoDoubleTest(convert("foo %+E"), val, "foo +2.560000E+002",
+ "foo +2.560000E+02");
+ DoDoubleTest(convert("foo % E"), val, "foo 2.560000E+002",
+ "foo 2.560000E+02");
+ DoDoubleTest(convert("foo %+E"), neg, "foo -2.560000E+002",
+ "foo -2.560000E+02");
+ DoDoubleTest(convert("foo % E"), neg, "foo -2.560000E+002",
+ "foo -2.560000E+02");
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test15/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test15/testinfo.dat
new file mode 100644
index 0000000000..246072f797
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test15
+Description
+= Tests the uppercase exponential
+= notation double specifier (%E).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test16/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test16/CMakeLists.txt
new file mode 100644
index 0000000000..be14870863
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/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_fwprintf_test16
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test16 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test16
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test16/test16.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test16/test16.c
new file mode 100644
index 0000000000..1969be1824
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test16/test16.c
@@ -0,0 +1,65 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================================
+**
+** Source: test16.c
+**
+** Purpose: Tests the decimal notation double specifier (%f).
+** This test is modeled after the sprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fwprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+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, "foo 2560.001000",
+ "foo 2560.001000");
+ DoDoubleTest(convert("foo %lf"), val, "foo 2560.001000",
+ "foo 2560.001000");
+ DoDoubleTest(convert("foo %hf"), val, "foo 2560.001000",
+ "foo 2560.001000");
+ DoDoubleTest(convert("foo %Lf"), val, "foo 2560.001000",
+ "foo 2560.001000");
+ DoDoubleTest(convert("foo %I64f"), val, "foo 2560.001000",
+ "foo 2560.001000");
+ DoDoubleTest(convert("foo %12f"), val, "foo 2560.001000",
+ "foo 2560.001000");
+ DoDoubleTest(convert("foo %-12f"), val, "foo 2560.001000 ",
+ "foo 2560.001000 ");
+ DoDoubleTest(convert("foo %.1f"), val, "foo 2560.0",
+ "foo 2560.0");
+ DoDoubleTest(convert("foo %.8f"), val, "foo 2560.00100000",
+ "foo 2560.00100000");
+ DoDoubleTest(convert("foo %012f"), val, "foo 02560.001000",
+ "foo 02560.001000");
+ DoDoubleTest(convert("foo %#f"), val, "foo 2560.001000",
+ "foo 2560.001000");
+ DoDoubleTest(convert("foo %+f"), val, "foo +2560.001000",
+ "foo +2560.001000");
+ DoDoubleTest(convert("foo % f"), val, "foo 2560.001000",
+ "foo 2560.001000");
+ DoDoubleTest(convert("foo %+f"), neg, "foo -2560.001000",
+ "foo -2560.001000");
+ DoDoubleTest(convert("foo % f"), neg, "foo -2560.001000",
+ "foo -2560.001000");
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test16/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test16/testinfo.dat
new file mode 100644
index 0000000000..9e5faf9baf
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test16/testinfo.dat
@@ -0,0 +1,13 @@
+# 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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test16
+Description
+= Tests the decimal notation double specifier (%f).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test17/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test17/CMakeLists.txt
new file mode 100644
index 0000000000..b390d15620
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/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_fwprintf_test17
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test17 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test17
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test17/test17.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test17/test17.c
new file mode 100644
index 0000000000..66b12716d0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test17/test17.c
@@ -0,0 +1,51 @@
+// 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: Tests the lowercase shorthand notation double specifier (%g).
+** This test is modeled after the sprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fwprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+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, "foo 2560", "foo 2560");
+ DoDoubleTest(convert("foo %lg"), val, "foo 2560", "foo 2560");
+ DoDoubleTest(convert("foo %hg"), val, "foo 2560", "foo 2560");
+ DoDoubleTest(convert("foo %Lg"), val, "foo 2560", "foo 2560");
+ DoDoubleTest(convert("foo %I64g"), val, "foo 2560", "foo 2560");
+ DoDoubleTest(convert("foo %5g"), val, "foo 2560", "foo 2560");
+ DoDoubleTest(convert("foo %-5g"), val, "foo 2560 ", "foo 2560 ");
+ DoDoubleTest(convert("foo %.1g"), val, "foo 3e+003", "foo 3e+03");
+ DoDoubleTest(convert("foo %.2g"), val, "foo 2.6e+003", "foo 2.6e+03");
+ DoDoubleTest(convert("foo %.12g"), val, "foo 2560.001", "foo 2560.001");
+ DoDoubleTest(convert("foo %06g"), val, "foo 002560", "foo 002560");
+ DoDoubleTest(convert("foo %#g"), val, "foo 2560.00", "foo 2560.00");
+ DoDoubleTest(convert("foo %+g"), val, "foo +2560", "foo +2560");
+ DoDoubleTest(convert("foo % g"), val, "foo 2560", "foo 2560");
+ DoDoubleTest(convert("foo %+g"), neg, "foo -2560", "foo -2560");
+ DoDoubleTest(convert("foo % g"), neg, "foo -2560", "foo -2560");
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test17/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test17/testinfo.dat
new file mode 100644
index 0000000000..fe637d744c
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test17/testinfo.dat
@@ -0,0 +1,13 @@
+# 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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test17
+Description
+= Tests the lowercase shorthand notation double specifier (%g).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test18/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test18/CMakeLists.txt
new file mode 100644
index 0000000000..6f6d79bce5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/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_fwprintf_test18
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test18 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test18
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test18/test18.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test18/test18.c
new file mode 100644
index 0000000000..a33dea39b3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test18/test18.c
@@ -0,0 +1,51 @@
+// 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: Tests the uppercase shorthand notation double specifier (%G).
+** This test is modeled after the sprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fwprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+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, "foo 2560", "foo 2560");
+ DoDoubleTest(convert("foo %lG"), val, "foo 2560", "foo 2560");
+ DoDoubleTest(convert("foo %hG"), val, "foo 2560", "foo 2560");
+ DoDoubleTest(convert("foo %LG"), val, "foo 2560", "foo 2560");
+ DoDoubleTest(convert("foo %I64G"), val, "foo 2560", "foo 2560");
+ DoDoubleTest(convert("foo %5G"), val, "foo 2560", "foo 2560");
+ DoDoubleTest(convert("foo %-5G"), val, "foo 2560 ", "foo 2560 ");
+ DoDoubleTest(convert("foo %.1G"), val, "foo 3E+003", "foo 3E+03");
+ DoDoubleTest(convert("foo %.2G"), val, "foo 2.6E+003", "foo 2.6E+03");
+ DoDoubleTest(convert("foo %.12G"), val, "foo 2560.001", "foo 2560.001");
+ DoDoubleTest(convert("foo %06G"), val, "foo 002560", "foo 002560");
+ DoDoubleTest(convert("foo %#G"), val, "foo 2560.00", "foo 2560.00");
+ DoDoubleTest(convert("foo %+G"), val, "foo +2560", "foo +2560");
+ DoDoubleTest(convert("foo % G"), val, "foo 2560", "foo 2560");
+ DoDoubleTest(convert("foo %+G"), neg, "foo -2560", "foo -2560");
+ DoDoubleTest(convert("foo % G"), neg, "foo -2560", "foo -2560");
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test18/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test18/testinfo.dat
new file mode 100644
index 0000000000..23f621733b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test18/testinfo.dat
@@ -0,0 +1,13 @@
+# 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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test18
+Description
+= Tests the uppercase shorthand notation double specifier (%G).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test19/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test19/CMakeLists.txt
new file mode 100644
index 0000000000..bc10825ce1
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/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_fwprintf_test19
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test19 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test19
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test19/test19.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test19/test19.c
new file mode 100644
index 0000000000..4600de7fa9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test19/test19.c
@@ -0,0 +1,81 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================================
+**
+** Source: test19.c
+**
+** Purpose: Tests the variable length precision argument.
+** This test is modeled after the sprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fwprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ int n = -1;
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoArgumentPrecTest(convert("%.*s"), 2, convert("bar"), "bar", "ba", "ba");
+ DoArgumentPrecTest(convert("%.*S"), 2, "bar", "bar", "ba", "ba");
+ DoArgumentPrecTest(convert("foo %.*n"), 3, &n, "pointer to int", "foo ",
+ "foo ");
+ if (n != 4)
+ {
+ Fail("ERROR: Expected count parameter to resolve to %d, got %X\n",
+ 4, n);
+ }
+
+ DoArgumentPrecTest(convert("%.*c"), 0, (void*)'a', "a", "a", "a");
+ DoArgumentPrecTest(convert("%.*c"), 4, (void*)'a', "a", "a", "a");
+ DoArgumentPrecTest(convert("%.*C"), 0, (void*)'a', "a", "a", "a");
+ DoArgumentPrecTest(convert("%.*C"), 4, (void*)'a', "a", "a", "a");
+ DoArgumentPrecTest(convert("%.*d"), 1, (void*)42, "42", "42", "42");
+ DoArgumentPrecTest(convert("%.*d"), 3, (void*)42, "42", "042", "042");
+ DoArgumentPrecTest(convert("%.*i"), 1, (void*)42, "42", "42", "42");
+ DoArgumentPrecTest(convert("%.*i"), 3, (void*)42, "42", "042", "042");
+ DoArgumentPrecTest(convert("%.*o"), 1, (void*)42, "42", "52", "52");
+ DoArgumentPrecTest(convert("%.*o"), 3, (void*)42, "42", "052", "052");
+ DoArgumentPrecTest(convert("%.*u"), 1, (void*)42, "42", "42", "42");
+ DoArgumentPrecTest(convert("%.*u"), 3, (void*)42, "42", "042", "042");
+ DoArgumentPrecTest(convert("%.*x"), 1, (void*)0x42, "0x42", "42", "42");
+ DoArgumentPrecTest(convert("%.*x"), 3, (void*)0x42, "0x42", "042", "042");
+ DoArgumentPrecTest(convert("%.*X"), 1, (void*)0x42, "0x42", "42", "42");
+ DoArgumentPrecTest(convert("%.*X"), 3, (void*)0x42, "0x42", "042", "042");
+
+
+ DoArgumentPrecDoubleTest(convert("%.*e"), 1, 2.01, "2.0e+000", "2.0e+00");
+ DoArgumentPrecDoubleTest(convert("%.*e"), 3, 2.01, "2.010e+000",
+ "2.010e+00");
+ DoArgumentPrecDoubleTest(convert("%.*E"), 1, 2.01, "2.0E+000", "2.0E+00");
+ DoArgumentPrecDoubleTest(convert("%.*E"), 3, 2.01, "2.010E+000",
+ "2.010E+00");
+ DoArgumentPrecDoubleTest(convert("%.*f"), 1, 2.01, "2.0", "2.0");
+ DoArgumentPrecDoubleTest(convert("%.*f"), 3, 2.01, "2.010", "2.010");
+ DoArgumentPrecDoubleTest(convert("%.*g"), 1, 256.01, "3e+002", "3e+02");
+ DoArgumentPrecDoubleTest(convert("%.*g"), 3, 256.01, "256", "256");
+ DoArgumentPrecDoubleTest(convert("%.*g"), 4, 256.01, "256", "256");
+ DoArgumentPrecDoubleTest(convert("%.*g"), 6, 256.01, "256.01", "256.01");
+ DoArgumentPrecDoubleTest(convert("%.*G"), 1, 256.01, "3E+002", "3E+02");
+ DoArgumentPrecDoubleTest(convert("%.*G"), 3, 256.01, "256", "256");
+ DoArgumentPrecDoubleTest(convert("%.*G"), 4, 256.01, "256", "256");
+ DoArgumentPrecDoubleTest(convert("%.*G"), 6, 256.01, "256.01", "256.01");
+
+ PAL_Terminate();
+
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test19/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test19/testinfo.dat
new file mode 100644
index 0000000000..24aa8778c3
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test19/testinfo.dat
@@ -0,0 +1,13 @@
+# 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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test19
+Description
+= Tests the variable length precision argument.
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test2/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test2/CMakeLists.txt
new file mode 100644
index 0000000000..64314651c0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/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_fwprintf_test2
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test2 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test2
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test2/test2.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test2/test2.c
new file mode 100644
index 0000000000..ecd3c513df
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test2/test2.c
@@ -0,0 +1,45 @@
+// 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: Tests the string specifier (%s).
+** This test is modeled after the sprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fwprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+int __cdecl main(int argc, char *argv[])
+{
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoWStrTest(convert("foo %s"), convert("bar"), "foo bar");
+ DoStrTest(convert("foo %hs"), "bar", "foo bar");
+ DoWStrTest(convert("foo %ls"), convert("bar"), "foo bar");
+ DoWStrTest(convert("foo %ws"), convert("bar"), "foo bar");
+ DoWStrTest(convert("foo %Ls"), convert("bar"), "foo bar");
+ DoWStrTest(convert("foo %I64s"), convert("bar"), "foo bar");
+ DoWStrTest(convert("foo %5s"), convert("bar"), "foo bar");
+ DoWStrTest(convert("foo %.2s"), convert("bar"), "foo ba");
+ DoWStrTest(convert("foo %5.2s"), convert("bar"), "foo ba");
+ DoWStrTest(convert("foo %-5s"), convert("bar"), "foo bar ");
+ DoWStrTest(convert("foo %05s"), convert("bar"), "foo 00bar");
+
+ PAL_Terminate();
+ return PASS;
+}
+
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test2/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test2/testinfo.dat
new file mode 100644
index 0000000000..1933682f24
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test2/testinfo.dat
@@ -0,0 +1,13 @@
+# 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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test2
+Description
+= Tests the string specifier (%s).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test3/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test3/CMakeLists.txt
new file mode 100644
index 0000000000..6906722cde
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/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_fwprintf_test3
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test3 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test3
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test3/test3.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test3/test3.c
new file mode 100644
index 0000000000..d718a19067
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test3/test3.c
@@ -0,0 +1,45 @@
+// 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: Tests the wide string specifier (%S).
+** This test is modeled after the sprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fwprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+int __cdecl main(int argc, char *argv[])
+{
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoStrTest(convert("foo %S"), "bar", "foo bar");
+ DoStrTest(convert("foo %hS"), "bar", "foo bar");
+ DoWStrTest(convert("foo %lS"), convert("bar"), "foo bar");
+ DoWStrTest(convert("foo %wS"), convert("bar"), "foo bar");
+ DoStrTest(convert("foo %LS"), "bar", "foo bar");
+ DoStrTest(convert("foo %I64S"), "bar", "foo bar");
+ DoStrTest(convert("foo %5S"), "bar", "foo bar");
+ DoStrTest(convert("foo %.2S"), "bar", "foo ba");
+ DoStrTest(convert("foo %5.2S"),"bar", "foo ba");
+ DoStrTest(convert("foo %-5S"), "bar", "foo bar ");
+ DoStrTest(convert("foo %05S"), "bar", "foo 00bar");
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test3/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test3/testinfo.dat
new file mode 100644
index 0000000000..fa8a0bcf75
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test3/testinfo.dat
@@ -0,0 +1,13 @@
+# 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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test3
+Description
+= Tests the wide string specifier (%S).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test4/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test4/CMakeLists.txt
new file mode 100644
index 0000000000..b91bc87195
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/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_fwprintf_test4
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test4 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test4
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test4/test4.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test4/test4.c
new file mode 100644
index 0000000000..96fb472c3e
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test4/test4.c
@@ -0,0 +1,85 @@
+// 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: Tests the pointer specifier (%p).
+** This test is modeled after the sprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fwprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+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, "NULL", "0000000000000000", "0x0");
+ DoPointerTest(convert("%p"), ptr, "pointer to 0x123456", "0000000000123456",
+ "0x123456");
+ DoPointerTest(convert("%17p"), ptr, "pointer to 0x123456", " 0000000000123456",
+ " 0x123456");
+ DoPointerTest(convert("%17p"), ptr, "pointer to 0x123456", " 0000000000123456",
+ "0x0123456");
+ DoPointerTest(convert("%-17p"), ptr, "pointer to 0x123456", "0000000000123456 ",
+ "0x123456 ");
+ DoPointerTest(convert("%+p"), ptr, "pointer to 0x123456", "0000000000123456",
+ "0x123456");
+ DoPointerTest(convert("%#p"), ptr, "pointer to 0x123456", "0X0000000000123456",
+ "0x123456");
+ DoPointerTest(convert("%lp"), ptr, "pointer to 0x123456", "00123456",
+ "0x123456");
+ DoPointerTest(convert("%hp"), ptr, "pointer to 0x123456", "00003456",
+ "0x3456");
+ DoPointerTest(convert("%Lp"), ptr, "pointer to 0x123456", "00123456",
+ "0x123456");
+ DoI64Test(convert("%I64p"), lptr, "pointer to 0x1234567887654321",
+ "1234567887654321", "0x1234567887654321");
+#else
+ Trace("Testing for Non 64 Bit Platforms \n");
+ DoPointerTest(convert("%p"), NULL, "NULL", "00000000", "0x0");
+ DoPointerTest(convert("%p"), ptr, "pointer to 0x123456", "00123456",
+ "0x123456");
+ DoPointerTest(convert("%9p"), ptr, "pointer to 0x123456", " 00123456",
+ " 0x123456");
+ DoPointerTest(convert("%09p"), ptr, "pointer to 0x123456", " 00123456",
+ "0x0123456");
+ DoPointerTest(convert("%-9p"), ptr, "pointer to 0x123456", "00123456 ",
+ "0x123456 ");
+ DoPointerTest(convert("%+p"), ptr, "pointer to 0x123456", "00123456",
+ "0x123456");
+ DoPointerTest(convert("%#p"), ptr, "pointer to 0x123456", "0X00123456",
+ "0x123456");
+ DoPointerTest(convert("%lp"), ptr, "pointer to 0x123456", "00123456",
+ "0x123456");
+ DoPointerTest(convert("%hp"), ptr, "pointer to 0x123456", "00003456",
+ "0x3456");
+ DoPointerTest(convert("%Lp"), ptr, "pointer to 0x123456", "00123456",
+ "0x123456");
+ DoI64Test(convert("%I64p"), lptr, "pointer to 0x1234567887654321",
+ "1234567887654321", "0x1234567887654321");
+#endif
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test4/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test4/testinfo.dat
new file mode 100644
index 0000000000..92140c29bb
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test4/testinfo.dat
@@ -0,0 +1,13 @@
+# 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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test4
+Description
+= Tests the pointer specifier (%p).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test5/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test5/CMakeLists.txt
new file mode 100644
index 0000000000..53bf482b6f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/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_fwprintf_test5
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test5 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test5
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test5/test5.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test5/test5.c
new file mode 100644
index 0000000000..9d95989090
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test5/test5.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: test5.c
+**
+** Purpose: Tests the count specifier (%n).
+** This test is modeled after the sprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fwprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR *longStr;
+ char *longResult =
+ "really-long-string-that-just-keeps-going-on-and-on-and-on.."
+ "..................useless-filler.................................."
+ "..................useless-filler.................................."
+ "..................useless-filler.................................."
+ " bar";
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ longStr =
+ convert("really-long-string-that-just-keeps-going-on-and-on-and-on.."
+ "..................useless-filler.................................."
+ "..................useless-filler.................................."
+ "..................useless-filler.................................."
+ "%n bar");
+ DoCountTest(convert("foo %n bar"), 4, "foo bar");
+ DoCountTest(longStr, 257, longResult);
+ DoCountTest(convert("fo%n bar"), 2, "fo bar");
+ DoCountTest(convert("%n foo"), 0, " foo");
+ DoCountTest(convert("foo %#n bar"), 4, "foo bar");
+ DoCountTest(convert("foo % n bar"), 4, "foo bar");
+ DoCountTest(convert("foo %+n bar"), 4, "foo bar");
+ DoCountTest(convert("foo %-n bar"), 4, "foo bar");
+ DoCountTest(convert("foo %0n bar"), 4, "foo bar");
+ DoShortCountTest(convert("foo %hn bar"), 4, "foo bar");
+ DoCountTest(convert("foo %ln bar"), 4, "foo bar");
+ DoCountTest(convert("foo %Ln bar"), 4, "foo bar");
+ DoCountTest(convert("foo %I64n bar"), 4, "foo bar");
+ DoCountTest(convert("foo %20.3n bar"), 4, "foo bar");
+
+ PAL_Terminate();
+
+ free(longStr);
+
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test5/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test5/testinfo.dat
new file mode 100644
index 0000000000..152f56334b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test5/testinfo.dat
@@ -0,0 +1,13 @@
+# 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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test5
+Description
+= Tests the count specifier (%n).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test6/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test6/CMakeLists.txt
new file mode 100644
index 0000000000..bf7d7cccb8
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/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_fwprintf_test6
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test6 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test6
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test6/test6.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test6/test6.c
new file mode 100644
index 0000000000..160ff524e0
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test6/test6.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: test6.c
+**
+** Purpose: Tests the char specifier (%c).
+** This test is modeled after the sprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fwprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR wb = (WCHAR) 'b';
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return(FAIL);
+ }
+
+ DoWCharTest(convert("foo %c"), wb, "foo b");
+ DoCharTest(convert("foo %hc"), 'c', "foo c");
+ DoWCharTest(convert("foo %lc"), wb, "foo b");
+ DoWCharTest(convert("foo %Lc"), wb, "foo b");
+ DoWCharTest(convert("foo %I64c"), wb, "foo b");
+ DoWCharTest(convert("foo %5c"), wb, "foo b");
+ DoWCharTest(convert("foo %.0c"), wb, "foo b");
+ DoWCharTest(convert("foo %-5c"), wb, "foo b ");
+ DoWCharTest(convert("foo %05c"), wb, "foo 0000b");
+ DoWCharTest(convert("foo % c"), wb, "foo b");
+ DoWCharTest(convert("foo %#c"), wb, "foo b");
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
+
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test6/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test6/testinfo.dat
new file mode 100644
index 0000000000..cc968bdf7f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test6/testinfo.dat
@@ -0,0 +1,13 @@
+# 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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test6
+Description
+= Tests the char specifier (%c).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test7/CMakeLists.txt
new file mode 100644
index 0000000000..68bcc9ca65
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/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_fwprintf_test7
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test7 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test7
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test7/test7.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test7/test7.c
new file mode 100644
index 0000000000..c5515a8640
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test7/test7.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: test7.c
+**
+** Purpose: Tests the wide char specifier (%C).
+** This test is modeled after the sprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fwprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR wb = (WCHAR) 'b';
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+
+ DoCharTest(convert("foo %C"), 'c', "foo c");
+ DoWCharTest(convert("foo %hc"), wb, "foo b");
+ DoCharTest(convert("foo %lC"), 'c', "foo c");
+ DoCharTest(convert("foo %LC"), 'c', "foo c");
+ DoCharTest(convert("foo %I64C"), 'c', "foo c");
+ DoCharTest(convert("foo %5C"), 'c', "foo c");
+ DoCharTest(convert("foo %.0C"), 'c', "foo c");
+ DoCharTest(convert("foo %-5C"), 'c', "foo c ");
+ DoCharTest(convert("foo %05C"), 'c', "foo 0000c");
+ DoCharTest(convert("foo % C"), 'c', "foo c");
+ DoCharTest(convert("foo %#C"), 'c', "foo c");
+
+ PAL_Terminate();
+ return PASS;
+}
+
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test7/testinfo.dat
new file mode 100644
index 0000000000..46cb35cf4b
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test7/testinfo.dat
@@ -0,0 +1,13 @@
+# 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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test7
+Description
+= Tests the wide char specifier (%C).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test8/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test8/CMakeLists.txt
new file mode 100644
index 0000000000..e07cbb9119
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/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_fwprintf_test8
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test8 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test8
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test8/test8.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test8/test8.c
new file mode 100644
index 0000000000..efc81a954a
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test8/test8.c
@@ -0,0 +1,51 @@
+// 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: Tests the decimal specifier (%d).
+** This test is modeled after the sprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fwprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+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, "foo 42");
+ DoNumTest(convert("foo %ld"), 0xFFFF, "foo 65535");
+ DoNumTest(convert("foo %hd"), 0xFFFF, "foo -1");
+ DoNumTest(convert("foo %Ld"), pos, "foo 42");
+ DoI64Test(convert("foo %I64d"), l, "42", "foo 42", "foo 42");
+ DoNumTest(convert("foo %3d"), pos, "foo 42");
+ DoNumTest(convert("foo %-3d"), pos, "foo 42 ");
+ DoNumTest(convert("foo %.1d"), pos, "foo 42");
+ DoNumTest(convert("foo %.3d"), pos, "foo 042");
+ DoNumTest(convert("foo %03d"), pos, "foo 042");
+ DoNumTest(convert("foo %#d"), pos, "foo 42");
+ DoNumTest(convert("foo %+d"), pos, "foo +42");
+ DoNumTest(convert("foo % d"), pos, "foo 42");
+ DoNumTest(convert("foo %+d"), neg, "foo -42");
+ DoNumTest(convert("foo % d"), neg, "foo -42");
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test8/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test8/testinfo.dat
new file mode 100644
index 0000000000..c8ce33acb9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test8/testinfo.dat
@@ -0,0 +1,13 @@
+# 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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test8
+Description
+= Tests the decimal specifier (%d).
+= This test is modeled after the sprintf series.
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test9/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/fwprintf/test9/CMakeLists.txt
new file mode 100644
index 0000000000..898da1a64f
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/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_fwprintf_test9
+ ${SOURCES}
+)
+
+add_dependencies(paltest_fwprintf_test9 coreclrpal)
+
+target_link_libraries(paltest_fwprintf_test9
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test9/test9.c b/src/pal/tests/palsuite/c_runtime/fwprintf/test9/test9.c
new file mode 100644
index 0000000000..23db2d8971
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test9/test9.c
@@ -0,0 +1,51 @@
+// 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: Tests the integer specifier (%i).
+** This test is modeled after the sprintf series.
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+#include "../fwprintf.h"
+
+/*
+ * Depends on memcmp, strlen, fopen, fseek and fgets.
+ */
+
+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, "foo 42");
+ DoNumTest(convert("foo %li"), 0xFFFF, "foo 65535");
+ DoNumTest(convert("foo %hi"), 0xFFFF, "foo -1");
+ DoNumTest(convert("foo %Li"), pos, "foo 42");
+ DoI64Test(convert("foo %I64i"), l, "42", "foo 42", "foo 42");
+ DoNumTest(convert("foo %3i"), pos, "foo 42");
+ DoNumTest(convert("foo %-3i"), pos, "foo 42 ");
+ DoNumTest(convert("foo %.1i"), pos, "foo 42");
+ DoNumTest(convert("foo %.3i"), pos, "foo 042");
+ DoNumTest(convert("foo %03i"), pos, "foo 042");
+ DoNumTest(convert("foo %#i"), pos, "foo 42");
+ DoNumTest(convert("foo %+i"), pos, "foo +42");
+ DoNumTest(convert("foo % i"), pos, "foo 42");
+ DoNumTest(convert("foo %+i"), neg, "foo -42");
+ DoNumTest(convert("foo % i"), neg, "foo -42");
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/fwprintf/test9/testinfo.dat b/src/pal/tests/palsuite/c_runtime/fwprintf/test9/testinfo.dat
new file mode 100644
index 0000000000..5c2ec25ab5
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/fwprintf/test9/testinfo.dat
@@ -0,0 +1,13 @@
+# 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 = fwprintf
+Name = Positive Test for fwprintf
+TYPE = DEFAULT
+EXE1 = test9
+Description
+= Tests the integer specifier (%i).
+= This test is modeled after the sprintf series.