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: Tests that _wcsicmp correctly compares two strings with |
10 | ** case insensitivity. |
11 | ** |
12 | ** |
13 | **==========================================================================*/ |
14 | |
15 | #include <palsuite.h> |
16 | |
17 | /* |
18 | * Note: The _wcsicmp is dependent on the LC_CTYPE category of the locale, |
19 | * and this is ignored by these tests. |
20 | */ |
21 | int __cdecl main(int argc, char *argv[]) |
22 | { |
23 | WCHAR str1[] = {'f','o','o',0}; |
24 | WCHAR str2[] = {'f','O','o',0}; |
25 | WCHAR str3[] = {'f','o','o','_','b','a','r',0}; |
26 | WCHAR str4[] = {'f','o','o','b','a','r',0}; |
27 | |
28 | /* |
29 | * Initialize the PAL and return FAIL if this fails |
30 | */ |
31 | if (0 != (PAL_Initialize(argc, argv))) |
32 | { |
33 | return FAIL; |
34 | } |
35 | |
36 | if (_wcsicmp(str1, str2) != 0) |
37 | { |
38 | Fail ("ERROR: _wcsicmp returning incorrect value:\n" |
39 | "_wcsicmp(\"%S\", \"%S\") != 0\n" , str1, str2); |
40 | } |
41 | |
42 | if (_wcsicmp(str2, str3) >= 0) |
43 | { |
44 | Fail ("ERROR: _wcsicmp returning incorrect value:\n" |
45 | "_wcsicmp(\"%S\", \"%S\") >= 0\n" , str2, str3); |
46 | } |
47 | |
48 | if (_wcsicmp(str3, str4) >= 0) |
49 | { |
50 | Fail ("ERROR: _wcsicmp returning incorrect value:\n" |
51 | "_wcsicmp(\"%S\", \"%S\") >= 0\n" , str3, str4); |
52 | } |
53 | |
54 | if (_wcsicmp(str4, str1) <= 0) |
55 | { |
56 | Fail ("ERROR: _wcsicmp returning incorrect value:\n" |
57 | "_wcsicmp(\"%S\", \"%S\") <= 0\n" , str4, str1); |
58 | } |
59 | |
60 | if (_wcsicmp(str3, str2) <= 0) |
61 | { |
62 | Fail ("ERROR: _wcsicmp returning incorrect value:\n" |
63 | "_wcsicmp(\"%S\", \"%S\") <= 0\n" , str2, str3); |
64 | } |
65 | |
66 | PAL_Terminate(); |
67 | return PASS; |
68 | } |
69 | |