diff options
Diffstat (limited to 'src/pal/tests/palsuite/c_runtime/wcschr/test1/test1.cpp')
-rw-r--r-- | src/pal/tests/palsuite/c_runtime/wcschr/test1/test1.cpp | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/pal/tests/palsuite/c_runtime/wcschr/test1/test1.cpp b/src/pal/tests/palsuite/c_runtime/wcschr/test1/test1.cpp new file mode 100644 index 0000000000..a4963672f8 --- /dev/null +++ b/src/pal/tests/palsuite/c_runtime/wcschr/test1/test1.cpp @@ -0,0 +1,51 @@ +// 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 wcschr correctly finds the first occurrence of a character in a +** string +** +** +**==========================================================================*/ + + + +#include <palsuite.h> + +int __cdecl main(int argc, char *argv[]) +{ + WCHAR str[] = {'f','o','o',' ','b','a','r',' ',0}; + WCHAR c = (WCHAR)' '; + WCHAR c2 = (WCHAR)'$'; + WCHAR *ptr; + + + if (PAL_Initialize(argc, argv)) + { + return FAIL; + } + + + ptr = wcschr(str, c); + if (ptr != str + 3) + { + Fail("ERROR: expected wcschr to return pointer to %p, got %p\n", + str + 3, ptr); + } + + ptr = wcschr(str, c2); + if (ptr != NULL) + { + Fail("ERROR: expected wcschr to return pointer to %p, got %p\n", + NULL, ptr); + } + + PAL_Terminate(); + return PASS; +} + |