summaryrefslogtreecommitdiff
path: root/src/pal/tests/palsuite/c_runtime/swprintf/test7
diff options
context:
space:
mode:
Diffstat (limited to 'src/pal/tests/palsuite/c_runtime/swprintf/test7')
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test7/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test7/test7.c48
-rw-r--r--src/pal/tests/palsuite/c_runtime/swprintf/test7/testinfo.dat12
3 files changed, 79 insertions, 0 deletions
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test7/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/swprintf/test7/CMakeLists.txt
new file mode 100644
index 0000000000..2b1c30cb56
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/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_swprintf_test7
+ ${SOURCES}
+)
+
+add_dependencies(paltest_swprintf_test7 coreclrpal)
+
+target_link_libraries(paltest_swprintf_test7
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test7/test7.c b/src/pal/tests/palsuite/c_runtime/swprintf/test7/test7.c
new file mode 100644
index 0000000000..e231ada3d2
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test7/test7.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: test7.c
+**
+** Purpose: Tests swprintf with wide characters
+**
+**
+**==========================================================================*/
+
+
+
+#include <palsuite.h>
+#include "../swprintf.h"
+
+/*
+ * Uses memcmp & wcslen
+ */
+
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR wb = (WCHAR) 'b';
+
+ if (PAL_Initialize(argc, argv) != 0)
+ {
+ return FAIL;
+ }
+
+
+ DoCharTest(convert("foo %C"), 'c', convert("foo c"));
+ DoWCharTest(convert("foo %hc"), wb, convert("foo b"));
+ DoCharTest(convert("foo %lC"), 'c', convert("foo c"));
+ DoCharTest(convert("foo %LC"), 'c', convert("foo c"));
+ DoCharTest(convert("foo %I64C"), 'c', convert("foo c"));
+ DoCharTest(convert("foo %5C"), 'c', convert("foo c"));
+ DoCharTest(convert("foo %.0C"), 'c', convert("foo c"));
+ DoCharTest(convert("foo %-5C"), 'c', convert("foo c "));
+ DoCharTest(convert("foo %05C"), 'c', convert("foo 0000c"));
+ DoCharTest(convert("foo % C"), 'c', convert("foo c"));
+ DoCharTest(convert("foo %#C"), 'c', convert("foo c"));
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/swprintf/test7/testinfo.dat b/src/pal/tests/palsuite/c_runtime/swprintf/test7/testinfo.dat
new file mode 100644
index 0000000000..7facc90b58
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/swprintf/test7/testinfo.dat
@@ -0,0 +1,12 @@
+# 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 = swprintf
+Name = Positive Test for swprintf
+TYPE = DEFAULT
+EXE1 = test7
+Description
+= Tests swprintf with wide characters