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