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 islower function
10** Check that a number of characters return the correct
11** values for whether they are lower case or not.
12**
13**
14**===================================================================*/
15
16#include <palsuite.h>
17
18struct testCase
19{
20 int CorrectResult;
21 int character;
22};
23
24int __cdecl main(int argc, char **argv)
25{
26
27 int result;
28 int i;
29
30 struct testCase testCases[] =
31 {
32 {1, 'a'}, /* Basic cases */
33 {1, 'z'},
34 {0, 'B'}, /* Lower case */
35 {0, '?'}, /* Characters without case */
36 {0, 230},
37 {0, '5'}
38 };
39
40 if (PAL_Initialize(argc, argv))
41 {
42 return FAIL;
43 }
44
45
46 /* Loop through each case. Check to see if each is lower case or
47 not.
48 */
49
50 for(i = 0; i < sizeof(testCases) / sizeof(struct testCase); i++)
51 {
52
53 result = islower(testCases[i].character);
54
55 /* The return value is 'non-zero' for success. This if condition
56 * will still work if that non-zero isn't just 1
57 */
58 if ( ((testCases[i].CorrectResult == 1) && (result == 0)) ||
59 ( (testCases[i].CorrectResult == 0) && (result != 0) ))
60 {
61 Fail("ERROR: islower returned %i instead of %i for "
62 "character %c.\n",
63 result, testCases[i].CorrectResult,
64 testCases[i].character);
65 }
66
67 }
68
69
70 PAL_Terminate();
71 return PASS;
72}
73
74
75
76
77
78
79
80
81
82
83
84
85
86