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 to see that wcsrchr correctly returns a pointer to the last occurence |
11 | ** of a character in a a string. |
12 | ** |
13 | ** |
14 | **==========================================================================*/ |
15 | |
16 | |
17 | |
18 | #include <palsuite.h> |
19 | |
20 | int __cdecl main(int argc, char *argv[]) |
21 | { |
22 | WCHAR str[] = {'f','o','o',' ','b','a','r',' ','b','a','z',0}; |
23 | WCHAR c = (WCHAR)' '; |
24 | WCHAR c2 = (WCHAR)'$'; |
25 | WCHAR *ptr; |
26 | |
27 | if (PAL_Initialize(argc, argv)) |
28 | { |
29 | return FAIL; |
30 | } |
31 | |
32 | |
33 | ptr = wcsrchr(str, c); |
34 | if (ptr != str + 7) |
35 | { |
36 | Fail("ERROR: expected wcsrchr to return pointer to %p, got %p\n" , |
37 | str + 7, ptr); |
38 | } |
39 | |
40 | ptr = wcsrchr(str, c2); |
41 | if (ptr != NULL) |
42 | { |
43 | Fail("ERROR: expected wcsrchr to return pointer to %p, got %p\n" , |
44 | NULL, ptr); |
45 | } |
46 | |
47 | PAL_Terminate(); |
48 | return PASS; |
49 | } |
50 | |
51 | |