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(towupper)
8**
9**
10** Purpose: Tests the PAL implementation of the towupper function.
11** Check that the towupper function makes lower case
12** character a capital. Also check that it has no effect
13** on upper case letters and special characters.
14**
15**
16**===================================================================*/
17
18#include <palsuite.h>
19
20struct testCase
21{
22 WCHAR upper;
23 WCHAR start;
24};
25
26int __cdecl main(int argc, char **argv)
27{
28
29 int result;
30 int i;
31
32 struct testCase testCases[] =
33 {
34 {'A', 'a'}, /* Basic cases */
35 {'Z', 'z'},
36 {'B', 'B'}, /* Upper case */
37 {'%', '%'}, /* Characters without case */
38 {157, 157}
39 };
40
41 if ((PAL_Initialize(argc, argv)) != 0)
42 {
43 return FAIL;
44 }
45
46
47 /* Loop through each case. Convert each character to upper case
48 and then compare to ensure that it is the correct value.
49 */
50
51 for(i = 0; i < sizeof(testCases) / sizeof(struct testCase); i++)
52 {
53 /*Convert to upper case*/
54 result = towupper(testCases[i].start);
55
56 if (testCases[i].upper != result)
57 {
58 Fail("ERROR: towupper capitalized \"%c\" to %c instead of %c.\n",
59 testCases[i].start, result, testCases[i].upper);
60 }
61 }
62
63 PAL_Terminate();
64 return PASS;
65}
66