1// Licensed to the .NET Foundation under one or more agreements.
2// The .NET Foundation licenses this file to you under the MIT license.
3// See the LICENSE file in the project root for more information.
4
5/*============================================================================
6**
7** Source: test1.c
8**
9** Purpose:
10** Tests that wcschr correctly finds the first occurrence of a character in a
11** string
12**
13**
14**==========================================================================*/
15
16
17
18#include <palsuite.h>
19
20int __cdecl main(int argc, char *argv[])
21{
22 WCHAR str[] = {'f','o','o',' ','b','a','r',' ',0};
23 WCHAR c = (WCHAR)' ';
24 WCHAR c2 = (WCHAR)'$';
25 WCHAR *ptr;
26
27
28 if (PAL_Initialize(argc, argv))
29 {
30 return FAIL;
31 }
32
33
34 ptr = wcschr(str, c);
35 if (ptr != str + 3)
36 {
37 Fail("ERROR: expected wcschr to return pointer to %p, got %p\n",
38 str + 3, ptr);
39 }
40
41 ptr = wcschr(str, c2);
42 if (ptr != NULL)
43 {
44 Fail("ERROR: expected wcschr to return pointer to %p, got %p\n",
45 NULL, ptr);
46 }
47
48 PAL_Terminate();
49 return PASS;
50}
51
52