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: isprint.c
8**
9** Purpose: Negative test for the isprint API. Call isprint
10** to test if out of range characters are
11** not printable.
12**
13**
14**============================================================*/
15#include <palsuite.h>
16
17int __cdecl main(int argc, char *argv[])
18{
19 int err;
20
21 /*Initialize the PAL environment*/
22 err = PAL_Initialize(argc, argv);
23 if(0 != err)
24 {
25 return FAIL;
26 }
27
28 /*check that function fails for values that are not printable*/
29 err = isprint(0x15);
30 if(err)
31 {
32 Fail("\nSucceeded when it should have failed because 0x15 "
33 "is not in the range of printable characters\n");
34 }
35
36 err = isprint(0xAA);
37 if(err)
38 {
39 Fail("\nSucceeded when it should have failed because 0xAA "
40 "is not in the range of printable characters\n");
41 }
42
43 /* check carriage return */
44 if(0 != isprint(0x0d))
45 {
46 Fail("\nSucceeded when it should have failed because 0x0d "
47 "is not in the range of printable characters\n");
48 }
49
50 /* check line feed */
51 if(0 != isprint(0x0a))
52 {
53 Fail("\nSucceeded when it should have failed because 0x0a "
54 "is not in the range of printable characters\n");
55 }
56
57 PAL_Terminate();
58 return PASS;
59}
60