summaryrefslogtreecommitdiff
path: root/src/pal/tests/palsuite/miscellaneous/lstrcatW/test4
diff options
context:
space:
mode:
Diffstat (limited to 'src/pal/tests/palsuite/miscellaneous/lstrcatW/test4')
-rw-r--r--src/pal/tests/palsuite/miscellaneous/lstrcatW/test4/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/miscellaneous/lstrcatW/test4/test4.c101
-rw-r--r--src/pal/tests/palsuite/miscellaneous/lstrcatW/test4/testinfo.dat28
3 files changed, 148 insertions, 0 deletions
diff --git a/src/pal/tests/palsuite/miscellaneous/lstrcatW/test4/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/lstrcatW/test4/CMakeLists.txt
new file mode 100644
index 0000000000..640c224f83
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/lstrcatW/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_lstrcatw_test4
+ ${SOURCES}
+)
+
+add_dependencies(paltest_lstrcatw_test4 coreclrpal)
+
+target_link_libraries(paltest_lstrcatw_test4
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/miscellaneous/lstrcatW/test4/test4.c b/src/pal/tests/palsuite/miscellaneous/lstrcatW/test4/test4.c
new file mode 100644
index 0000000000..abc9021518
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/lstrcatW/test4/test4.c
@@ -0,0 +1,101 @@
+// 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: Testing the behaviour of lstrcatw when string2 contains
+** special characters, this test case depends on:
+** memcmp
+** wcslen
+** lstrcpyn
+**
+**
+**=========================================================*/
+
+#define UNICODE
+
+#include <palsuite.h>
+
+struct testCase
+{
+ WCHAR SecondString[5];
+ WCHAR CorrectString[10];
+};
+
+int __cdecl main(int argc, char *argv[])
+{
+
+ WCHAR FirstString[10] = {'T','E','S','T','\0'};
+ WCHAR TestString[10] = {'T','E','S','T','\0'};
+ int i = 0;
+
+ /*
+ * this structure includes several strings to be tested with
+ * lstrcatW function and the expected results
+ */
+
+ struct testCase testCases[]=
+ {
+ {{'\t','T','A','B','\0'},
+ {'T','E','S','T','\t','T','A','B','\0'}},
+ {{'2','T','\?','B','\0'},
+ {'T','E','S','T','2','T','\?','B','\0'}},
+ {{'\v','T','E','\v','\0'},
+ {'T','E','S','T','\v','T','E','\v','\0'}},
+ {{'T','\a','E','\a','\0'},
+ {'T','E','S','T','T','\a','E','\a','\0'}},
+ {{'0','\f','Z','\f','\0'},
+ {'T','E','S','T','0','\f','Z','\f','\0'}},
+ {{'\r','H','I','\r','\0'},
+ {'T','E','S','T','\r','H','I','\r','\0'}},
+ {{'H','I','\"','\"','\0'},
+ {'T','E','S','T','H','I','\"','\"','\0'}},
+ {{'H','\b','I','\b','\0'},
+ {'T','E','S','T','H','\b','I','\b','\0'}},
+ {{'H','\n','I','\n','\0'},
+ {'T','E','S','T','H','\n','I','\n','\0'}}
+ };
+
+
+
+
+ /*
+ * Initialize the PAL and return FAILURE if this fails
+ */
+
+ if(0 != (PAL_Initialize(argc, argv)))
+ {
+ return FAIL;
+ }
+
+
+ /* Loop through the struct and validate the resulted string */
+ for( i = 0; i < sizeof(testCases)/sizeof(struct testCase); i++)
+ {
+
+ lstrcat(FirstString, testCases[i].SecondString);
+
+ if(memcmp(FirstString,testCases[i].CorrectString,
+ wcslen(FirstString)*sizeof(WCHAR)))
+ {
+
+ Fail("ERROR: the function failed with a special character.\n");
+ }
+
+ /* reinitialize the first string */
+ lstrcpyn(FirstString,TestString,10);
+
+ }
+
+
+
+
+ PAL_Terminate();
+ return PASS;
+}
+
+
+
diff --git a/src/pal/tests/palsuite/miscellaneous/lstrcatW/test4/testinfo.dat b/src/pal/tests/palsuite/miscellaneous/lstrcatW/test4/testinfo.dat
new file mode 100644
index 0000000000..96235fb257
--- /dev/null
+++ b/src/pal/tests/palsuite/miscellaneous/lstrcatW/test4/testinfo.dat
@@ -0,0 +1,28 @@
+# 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 = lstrcatW
+
+Name = Positive testing for lstrcatW
+
+TYPE = DEFAULT
+
+EXE1 = test4
+
+Description
+
+= Testing the behaviour of lstrcatw when string2 contains
+
+= special characters and validate the resulted string
+
+
+
+
+
+
+