summaryrefslogtreecommitdiff
path: root/src/pal/tests/palsuite/locale_info/IsDBCSLeadByte/test1
diff options
context:
space:
mode:
Diffstat (limited to 'src/pal/tests/palsuite/locale_info/IsDBCSLeadByte/test1')
-rw-r--r--src/pal/tests/palsuite/locale_info/IsDBCSLeadByte/test1/CMakeLists.txt19
-rw-r--r--src/pal/tests/palsuite/locale_info/IsDBCSLeadByte/test1/test1.c64
-rw-r--r--src/pal/tests/palsuite/locale_info/IsDBCSLeadByte/test1/testinfo.dat13
3 files changed, 96 insertions, 0 deletions
diff --git a/src/pal/tests/palsuite/locale_info/IsDBCSLeadByte/test1/CMakeLists.txt b/src/pal/tests/palsuite/locale_info/IsDBCSLeadByte/test1/CMakeLists.txt
new file mode 100644
index 0000000000..ad5ad7508d
--- /dev/null
+++ b/src/pal/tests/palsuite/locale_info/IsDBCSLeadByte/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_isdbcsleadbyte_test1
+ ${SOURCES}
+)
+
+add_dependencies(paltest_isdbcsleadbyte_test1 coreclrpal)
+
+target_link_libraries(paltest_isdbcsleadbyte_test1
+ pthread
+ m
+ coreclrpal
+)
diff --git a/src/pal/tests/palsuite/locale_info/IsDBCSLeadByte/test1/test1.c b/src/pal/tests/palsuite/locale_info/IsDBCSLeadByte/test1/test1.c
new file mode 100644
index 0000000000..ad326be084
--- /dev/null
+++ b/src/pal/tests/palsuite/locale_info/IsDBCSLeadByte/test1/test1.c
@@ -0,0 +1,64 @@
+// 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 IsDBCSLeadByte does not find any lead-bytes in the
+** current ansi code page
+**
+**
+** TODO: Test for positive, i.e., if it is potentially isdbcsleadbyte
+**==========================================================================*/
+
+
+#include <palsuite.h>
+
+void DoTest()
+{
+ int value;
+ int ret;
+ int i;
+
+
+ for (i=0; i<256; i++)
+ {
+ value = IsDBCSLeadByte(i);
+
+ ret = GetLastError();
+ if (ret == ERROR_INVALID_PARAMETER)
+ {
+ Fail("IsDBCSLeadByte unexpectedly errored with ERROR_INVALID_PARAMETER for %d!\n", i);
+ }
+ else if (ret != 0)
+ {
+ Fail("IsDBCSLeadByte had an unexpected error [%d] for %d!\n", ret, i);
+ }
+ else if (value)
+ {
+ Fail("IsDBCSLeadByte incorrectly found a lead byte in value [%d] for"
+ " %d\n", value, i);
+ }
+
+ }
+}
+
+int __cdecl main(int argc, char *argv[])
+{
+
+ if (0 != PAL_Initialize(argc, argv))
+ {
+ return FAIL;
+ }
+
+ DoTest();
+
+ PAL_Terminate();
+
+// setlocale( "japan", );
+
+ return PASS;
+}
+
diff --git a/src/pal/tests/palsuite/locale_info/IsDBCSLeadByte/test1/testinfo.dat b/src/pal/tests/palsuite/locale_info/IsDBCSLeadByte/test1/testinfo.dat
new file mode 100644
index 0000000000..43cd2aebb6
--- /dev/null
+++ b/src/pal/tests/palsuite/locale_info/IsDBCSLeadByte/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 = Locale Information
+Function = IsDBCSLeadByte
+Name = Test #1 for IsDBCSLeadByte
+TYPE = DEFAULT
+EXE1 = test1
+Description
+=Tests that IsDBCSLeadByte does not find any lead-bytes in the
+=current ansi code page