summaryrefslogtreecommitdiff
path: root/src/pal/tests/palsuite/c_runtime/wcspbrk
diff options
context:
space:
mode:
Diffstat (limited to 'src/pal/tests/palsuite/c_runtime/wcspbrk')
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcspbrk/CMakeLists.txt4
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcspbrk/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcspbrk/test1/test1.c61
-rw-r--r--src/pal/tests/palsuite/c_runtime/wcspbrk/test1/testinfo.dat13
4 files changed, 97 insertions, 0 deletions
diff --git a/src/pal/tests/palsuite/c_runtime/wcspbrk/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcspbrk/CMakeLists.txt
new file mode 100644
index 0000000000..f6aa0cb2d9
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcspbrk/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 2.8.12.2)
+
+add_subdirectory(test1)
+
diff --git a/src/pal/tests/palsuite/c_runtime/wcspbrk/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/wcspbrk/test1/CMakeLists.txt
new file mode 100644
index 0000000000..c6a3f87d75
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcspbrk/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_wcspbrk_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_wcspbrk_test1 coreclrpal)
+
+target_link_libraries(paltest_wcspbrk_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/c_runtime/wcspbrk/test1/test1.c b/src/pal/tests/palsuite/c_runtime/wcspbrk/test1/test1.c
new file mode 100644
index 0000000000..b0432f7819
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcspbrk/test1/test1.c
@@ -0,0 +1,61 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================================
+**
+** Source: test1.c
+**
+** Purpose:
+** Tests that wcspbrk returns a pointer to the first element in the first
+** string that matches a character in the second (or NULL).
+**
+**
+**==========================================================================*/
+
+#include <palsuite.h>
+
+int __cdecl main(int argc, char *argv[])
+{
+ WCHAR *string;
+ WCHAR *key1;
+ WCHAR *key2;
+ WCHAR key3[] = {0};
+ WCHAR *result;
+
+ if (PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ string = convert("foo bar baz bar");
+ key1 = convert("z ");
+ key2 = convert("Q");
+
+ result = wcspbrk(string, key1);
+ if (result != string + 3)
+ {
+ Fail("ERROR: Got incorrect result in scanning \"%s\" with the set \"%s\".\n"
+ "Expected to get pointer to %#p, got %#p\n", convertC(string),
+ convertC(key1), string + 3, result);
+ }
+
+ result = wcspbrk(string, key2);
+ if (result != NULL)
+ {
+ Fail("ERROR: Got incorrect result in scanning \"%s\" with the set \"%s\".\n"
+ "Expected to get pointer to %#p, got %#p\n", convertC(string),
+ convertC(key2), NULL, result);
+ }
+
+ result = wcspbrk(string, key3);
+ if (result != NULL)
+ {
+ Fail("ERROR: Got incorrect result in scanning \"%s\" with the set \"%s\".\n"
+ "Expected to get pointer to %#p, got %#p\n", convertC(string),
+ convertC(key3), NULL, result);
+ }
+
+ PAL_Terminate();
+ return PASS;
+}
diff --git a/src/pal/tests/palsuite/c_runtime/wcspbrk/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/wcspbrk/test1/testinfo.dat
new file mode 100644
index 0000000000..7044197b77
--- /dev/null
+++ b/src/pal/tests/palsuite/c_runtime/wcspbrk/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 = wcspbrk
+Name = Positive Test for wcspbrk
+TYPE = DEFAULT
+EXE1 = test1
+Description
+= Tests that wcspbrk returns a pointer to the first element in the first
+= string that matches a character in the second (or NULL).