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: Test #1 for the isspace function
10**
11**
12**==========================================================================*/
13
14
15
16#include <palsuite.h>
17
18struct testCase
19{
20 long result;
21 char avalue;
22};
23
24
25
26int __cdecl main(int argc, char *argv[])
27{
28 int i=0;
29 long result = 0;
30
31 /*
32 * A structures of the testcases to be tested with
33 * isspace function
34 */
35 struct testCase testCases[] =
36 {
37 {1,'\n'},
38 {1,'\t'},
39 {1,'\r'},
40 {1,'\v'},
41 {1,'\f'},
42 {1,' '},
43 {0,'a'},
44 {0,'A'},
45 {0,'z'},
46 {0,'Z'},
47 {0,'r'},
48 {0,'R'},
49 {0,'0'},
50 {0,'*'},
51 {0,3}
52 };
53
54 /*
55 * Initialize the PAL
56 */
57 if ( 0 != PAL_Initialize(argc, argv))
58 {
59 return FAIL;
60 }
61
62
63 /* Loop through the testcases */
64 for (i=0; i<sizeof(testCases)/sizeof(struct testCase); i++)
65 {
66 result = isspace(testCases[i].avalue);
67 if ( ((testCases[i].result == 1) && (result==0)) ||
68 ((testCases[i].result ==0) && (result !=0)) )
69 {
70 Fail("ERROR: isspace() returned %d for %c instead of %d\n",
71 result,
72 testCases[i].avalue,
73 testCases[i].result );
74 }
75 }
76
77
78 PAL_Terminate();
79
80 return PASS;
81}
82
83