-
Notifications
You must be signed in to change notification settings - Fork 75
Expand file tree
/
Copy pathtest.c
More file actions
111 lines (99 loc) · 2.83 KB
/
test.c
File metadata and controls
111 lines (99 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
// NOTICE: THE TEST CASES BELOW ARE ALSO INCLUDED IN THE C++ TEST CASE AND
// CHANGES SHOULD BE REFLECTED THERE AS WELL.
#include <ctype.h>
#include <stdio.h>
int f1() {
char *c_str;
int c;
c = *c_str++; // NON_COMPLIANT
return (c);
}
int f2() {
unsigned char *c_str;
int c;
c = *c_str++; // COMPLIANT
return (c);
}
int f3(void) {
char *c_str;
int c;
c = (unsigned char)*c_str++; // COMPLIANT
return (c);
}
void f4() {
char *t;
isalnum(*t); // NON_COMPLIANT
isalpha(*t); // NON_COMPLIANT
// isascii(*t); // Not part of the C Standard
isblank(*t); // NON_COMPLIANT
iscntrl(*t); // NON_COMPLIANT
isdigit(*t); // NON_COMPLIANT
isgraph(*t); // NON_COMPLIANT
islower(*t); // NON_COMPLIANT
isprint(*t); // NON_COMPLIANT
ispunct(*t); // NON_COMPLIANT
isspace(*t); // NON_COMPLIANT
isupper(*t); // NON_COMPLIANT
isxdigit(*t); // NON_COMPLIANT
// toascii(i); // Not part of the C Standard
toupper(*t); // NON_COMPLIANT
tolower(*t); // NON_COMPLIANT
}
void f5() {
unsigned char *t;
isalnum(*t); // COMPLIANT
isalpha(*t); // COMPLIANT
// isascii(*t); // Not part of the C Standard
isblank(*t); // COMPLIANT
iscntrl(*t); // COMPLIANT
isdigit(*t); // COMPLIANT
isgraph(*t); // COMPLIANT
islower(*t); // COMPLIANT
isprint(*t); // COMPLIANT
ispunct(*t); // COMPLIANT
isspace(*t); // COMPLIANT
isupper(*t); // COMPLIANT
isxdigit(*t); // COMPLIANT
// toascii(i); // Not part of the C Standard
toupper(*t); // COMPLIANT
tolower(*t); // COMPLIANT
}
void f6() {
char *t;
isalnum((unsigned char)*t); // COMPLIANT
isalpha((unsigned char)*t); // COMPLIANT
// isascii((unsigned char*)*t); // Not part of the C Standard
isblank((unsigned char)*t); // COMPLIANT
iscntrl((unsigned char)*t); // COMPLIANT
isdigit((unsigned char)*t); // COMPLIANT
isgraph((unsigned char)*t); // COMPLIANT
islower((unsigned char)*t); // COMPLIANT
isprint((unsigned char)*t); // COMPLIANT
ispunct((unsigned char)*t); // COMPLIANT
isspace((unsigned char)*t); // COMPLIANT
isupper((unsigned char)*t); // COMPLIANT
isxdigit((unsigned char)*t); // COMPLIANT
// toascii((unsigned int) i); // Not part of the C Standard
toupper((unsigned char)*t); // COMPLIANT
tolower((unsigned char)*t); // COMPLIANT
}
void f7() {
int t;
// Note these are all NON_COMPLIANT under STR37-C
isalnum(t); // COMPLIANT
isalpha(t); // COMPLIANT
// isascii(t); // Not part of the C Standard
isblank(t); // COMPLIANT
iscntrl(t); // COMPLIANT
isdigit(t); // COMPLIANT
isgraph(t); // COMPLIANT
islower(t); // COMPLIANT
isprint(t); // COMPLIANT
ispunct(t); // COMPLIANT
isspace(t); // COMPLIANT
isupper(t); // COMPLIANT
isxdigit(t); // COMPLIANT
// toascii(i); // Not part of the C Standard
toupper(t); // COMPLIANT
tolower(t); // COMPLIANT
}