-
Notifications
You must be signed in to change notification settings - Fork 62
/
Copy pathtest.c
47 lines (44 loc) · 1.13 KB
/
test.c
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
#include <stdbool.h>
void testRules() {
_Bool b = true;
enum E1 { A, B, C } e1 = A;
signed int i = 100;
unsigned int u = 100;
signed short s = 100;
unsigned short us = 100;
signed long l = 100L;
unsigned long ul = 100UL;
float f = 10.0f;
// Addition cases
i + 'a'; // COMPLIANT
'a' + i; // COMPLIANT
u + 'a'; // COMPLIANT
'a' + u; // COMPLIANT
'a' + 'a'; // NON_COMPLIANT
'a' + f; // NON_COMPLIANT
f + 'a'; // NON_COMPLIANT
'a' + b; // NON_COMPLIANT
b + 'a'; // NON_COMPLIANT
'a' + e1; // NON_COMPLIANT
e1 + 'a'; // NON_COMPLIANT
'a' + s; // COMPLIANT
'a' + us; // COMPLIANT
'a' + l; // NON_COMPLIANT
'a' + ul; // NON_COMPLIANT
// Subtraction cases
'a' - i; // COMPLIANT
'a' - u; // COMPLIANT
'a' - 'a'; // COMPLIANT
'a' - f; // NON_COMPLIANT
i - 'a'; // NON_COMPLIANT
u - 'a'; // NON_COMPLIANT
f - 'a'; // NON_COMPLIANT
b - 'a'; // NON_COMPLIANT
'a' - b; // NON_COMPLIANT
e1 - 'a'; // NON_COMPLIANT
'a' - e1; // NON_COMPLIANT
'a' - s; // COMPLIANT
'a' - us; // COMPLIANT
'a' - l; // NON_COMPLIANT
'a' - ul; // NON_COMPLIANT
}