-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathtest.c
47 lines (38 loc) · 806 Bytes
/
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 f1(int p1) {
if (2 > 3) { // NON_COMPLIANT
}
if (p1 > 0) { // COMPLIANT
}
if (p1 < 10 && p1 > 20) { // NON_COMPLIANT[FALSE_NEGATIVE]
}
}
void f2() {
while (20 > 10) { // NON_COMPLIANT
if (1 > 2) {
} // NON_COMPLIANT
}
for (int i = 10; i < 5; i++) { // NON_COMPLIANT
}
}
void f3() {
while (true) { // COMPLIANT - permitted by exception 1
}
while (1 < 2) { // NON_COMPLIANT - likely an indication of a bug
}
}
void f4() {
do {
} while (0u == 1u); // COMPLIANT - by exception 2
}
void f5(bool b1) {
true ? 1 : 2; // NON_COMPLIANT
1 ? 1 : 2; // NON_COMPLIANT
b1 ? 1 : 2; // COMPLIANT
}
void f6(int p1) {
while (p1 < 10 && p1 > 12) { // NON_COMPLIANT[FALSE_NEGATIVE]
}
while (1 == 0 && p1 > 12) { // NON_COMPLIANT
}
}