diff options
Diffstat (limited to 'src/pal/tests/palsuite/c_runtime/_wcslwr/test1')
3 files changed, 83 insertions, 0 deletions
diff --git a/src/pal/tests/palsuite/c_runtime/_wcslwr/test1/CMakeLists.txt b/src/pal/tests/palsuite/c_runtime/_wcslwr/test1/CMakeLists.txt new file mode 100644 index 0000000000..a78098f86a --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_wcslwr/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_wcslwr_test1 + ${SOURCES} +) + +add_dependencies(paltest_wcslwr_test1 coreclrpal) + +target_link_libraries(paltest_wcslwr_test1 + pthread + m + coreclrpal +) diff --git a/src/pal/tests/palsuite/c_runtime/_wcslwr/test1/test1.c b/src/pal/tests/palsuite/c_runtime/_wcslwr/test1/test1.c new file mode 100644 index 0000000000..3a758de39b --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_wcslwr/test1/test1.c @@ -0,0 +1,50 @@ +// 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: Using memcmp to check the result, convert a wide character string +** with capitals, to all lowercase using this function. Test #1 for the +** wcslwr function +** +** +**==========================================================================*/ + +#include <palsuite.h> + +/* uses memcmp,wcslen */ + +int __cdecl main(int argc, char *argv[]) +{ + WCHAR *test_str = NULL; + WCHAR *expect_str = NULL; + WCHAR *result_str = NULL; + + /* + * Initialize the PAL and return FAIL if this fails + */ + if (0 != (PAL_Initialize(argc, argv))) + { + return FAIL; + } + + test_str = convert("aSdF 1#"); + expect_str = convert("asdf 1#"); + + result_str = _wcslwr(test_str); + if (memcmp(result_str, expect_str, wcslen(expect_str)*2 + 2) != 0) + { + Fail ("ERROR: Expected to get \"%s\", got \"%s\".\n", + convertC(expect_str), convertC(result_str)); + } + + free(result_str); + free(expect_str); + + PAL_Terminate(); + return PASS; +} + diff --git a/src/pal/tests/palsuite/c_runtime/_wcslwr/test1/testinfo.dat b/src/pal/tests/palsuite/c_runtime/_wcslwr/test1/testinfo.dat new file mode 100644 index 0000000000..5d691d84d9 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/_wcslwr/test1/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 = _wcslwr +Name = Positive Test for _wcslwr +TYPE = DEFAULT +EXE1 = test1 +Description += Using memcmp to check the result, convert a wide character string += with capitals, to all lowercase using this function. + |