mirror of
https://github.com/github/codeql.git
synced 2026-04-24 16:25:15 +02:00
C++: Add more tests.
This commit is contained in:
@@ -34,6 +34,10 @@
|
||||
| test.c:170:9:170:9 | s |
|
||||
| test.c:176:8:176:15 | ! ... |
|
||||
| test.c:176:10:176:14 | ... < ... |
|
||||
| test.c:182:8:182:34 | ! ... |
|
||||
| test.c:182:10:182:20 | ... >= ... |
|
||||
| test.c:182:10:182:33 | ... && ... |
|
||||
| test.c:182:25:182:33 | ... < ... |
|
||||
| test.cpp:18:8:18:10 | call to get |
|
||||
| test.cpp:31:7:31:13 | ... == ... |
|
||||
| test.cpp:42:13:42:20 | call to getABool |
|
||||
@@ -51,3 +55,5 @@
|
||||
| test.cpp:135:6:135:21 | call to __builtin_expect |
|
||||
| test.cpp:141:6:141:21 | call to __builtin_expect |
|
||||
| test.cpp:145:6:145:21 | call to __builtin_expect |
|
||||
| test.cpp:152:7:152:8 | ! ... |
|
||||
| test.cpp:152:8:152:8 | b |
|
||||
|
||||
@@ -349,6 +349,42 @@
|
||||
| 146 | x != 0 when x is true |
|
||||
| 146 | x == 0 when ! ... is true |
|
||||
| 146 | x == 0 when x is false |
|
||||
| 152 | 10 < a+1 when ! ... is true |
|
||||
| 152 | 10 < a+1 when b is false |
|
||||
| 152 | 10 >= a+1 when ! ... is false |
|
||||
| 152 | 10 >= a+1 when b is true |
|
||||
| 152 | ! ... != 0 when ! ... is true |
|
||||
| 152 | ! ... != 0 when b is false |
|
||||
| 152 | ! ... != 1 when ! ... is false |
|
||||
| 152 | ! ... != 1 when b is true |
|
||||
| 152 | ! ... == 0 when ! ... is false |
|
||||
| 152 | ! ... == 0 when b is true |
|
||||
| 152 | ! ... == 1 when ! ... is true |
|
||||
| 152 | ! ... == 1 when b is false |
|
||||
| 152 | ... < ... != 0 when ! ... is false |
|
||||
| 152 | ... < ... != 0 when b is true |
|
||||
| 152 | ... < ... != 1 when ! ... is true |
|
||||
| 152 | ... < ... != 1 when b is false |
|
||||
| 152 | ... < ... == 0 when ! ... is true |
|
||||
| 152 | ... < ... == 0 when b is false |
|
||||
| 152 | ... < ... == 1 when ! ... is false |
|
||||
| 152 | ... < ... == 1 when b is true |
|
||||
| 152 | a < 10 when ! ... is false |
|
||||
| 152 | a < 10 when b is true |
|
||||
| 152 | a < 10+0 when ! ... is false |
|
||||
| 152 | a < 10+0 when b is true |
|
||||
| 152 | a >= 10 when ! ... is true |
|
||||
| 152 | a >= 10 when b is false |
|
||||
| 152 | a >= 10+0 when ! ... is true |
|
||||
| 152 | a >= 10+0 when b is false |
|
||||
| 152 | b != 0 when ! ... is false |
|
||||
| 152 | b != 0 when b is true |
|
||||
| 152 | b != 1 when ! ... is true |
|
||||
| 152 | b != 1 when b is false |
|
||||
| 152 | b == 0 when ! ... is true |
|
||||
| 152 | b == 0 when b is false |
|
||||
| 152 | b == 1 when ! ... is false |
|
||||
| 152 | b == 1 when b is true |
|
||||
| 152 | p != 0 when p is true |
|
||||
| 152 | p != 1 when p is false |
|
||||
| 152 | p == 0 when p is false |
|
||||
@@ -393,3 +429,39 @@
|
||||
| 176 | ... < ... != 0 when ... < ... is true |
|
||||
| 176 | ... < ... == 0 when ! ... is true |
|
||||
| 176 | ... < ... == 0 when ... < ... is false |
|
||||
| 182 | 1.0 < foo+1 when ... < ... is false |
|
||||
| 182 | 1.0 >= foo+1 when ... && ... is true |
|
||||
| 182 | 1.0 >= foo+1 when ... < ... is true |
|
||||
| 182 | 9.999999999999999547e-07 < foo+1 when ... && ... is true |
|
||||
| 182 | 9.999999999999999547e-07 < foo+1 when ... >= ... is true |
|
||||
| 182 | 9.999999999999999547e-07 >= foo+1 when ... >= ... is false |
|
||||
| 182 | ! ... != 0 when ! ... is true |
|
||||
| 182 | ! ... != 0 when ... && ... is false |
|
||||
| 182 | ! ... != 1 when ! ... is false |
|
||||
| 182 | ! ... != 1 when ... && ... is true |
|
||||
| 182 | ! ... == 0 when ! ... is false |
|
||||
| 182 | ! ... == 0 when ... && ... is true |
|
||||
| 182 | ! ... == 1 when ! ... is true |
|
||||
| 182 | ! ... == 1 when ... && ... is false |
|
||||
| 182 | ... && ... != 0 when ! ... is false |
|
||||
| 182 | ... && ... != 0 when ... && ... is true |
|
||||
| 182 | ... && ... == 0 when ! ... is true |
|
||||
| 182 | ... && ... == 0 when ... && ... is false |
|
||||
| 182 | ... < ... != 0 when ... && ... is true |
|
||||
| 182 | ... < ... != 0 when ... < ... is true |
|
||||
| 182 | ... < ... != 1 when ... < ... is false |
|
||||
| 182 | ... < ... == 0 when ... < ... is false |
|
||||
| 182 | ... < ... == 1 when ... && ... is true |
|
||||
| 182 | ... < ... == 1 when ... < ... is true |
|
||||
| 182 | ... >= ... != 0 when ... && ... is true |
|
||||
| 182 | ... >= ... != 0 when ... >= ... is true |
|
||||
| 182 | ... >= ... != 1 when ... >= ... is false |
|
||||
| 182 | ... >= ... == 0 when ... >= ... is false |
|
||||
| 182 | ... >= ... == 1 when ... && ... is true |
|
||||
| 182 | ... >= ... == 1 when ... >= ... is true |
|
||||
| 182 | foo < 1.0+0 when ... && ... is true |
|
||||
| 182 | foo < 1.0+0 when ... < ... is true |
|
||||
| 182 | foo < 9.999999999999999547e-07+0 when ... >= ... is false |
|
||||
| 182 | foo >= 1.0+0 when ... < ... is false |
|
||||
| 182 | foo >= 9.999999999999999547e-07+0 when ... && ... is true |
|
||||
| 182 | foo >= 9.999999999999999547e-07+0 when ... >= ... is true |
|
||||
|
||||
@@ -87,6 +87,12 @@
|
||||
| test.c:170:9:170:9 | s | false | 170 | 172 |
|
||||
| test.c:176:8:176:15 | ! ... | true | 176 | 178 |
|
||||
| test.c:176:10:176:14 | ... < ... | false | 176 | 178 |
|
||||
| test.c:182:8:182:34 | ! ... | true | 182 | 184 |
|
||||
| test.c:182:10:182:20 | ... >= ... | true | 181 | 182 |
|
||||
| test.c:182:10:182:20 | ... >= ... | true | 182 | 182 |
|
||||
| test.c:182:10:182:33 | ... && ... | false | 182 | 184 |
|
||||
| test.c:182:10:182:33 | ... && ... | true | 181 | 182 |
|
||||
| test.c:182:25:182:33 | ... < ... | true | 181 | 182 |
|
||||
| test.cpp:18:8:18:10 | call to get | true | 19 | 19 |
|
||||
| test.cpp:31:7:31:13 | ... == ... | false | 30 | 30 |
|
||||
| test.cpp:31:7:31:13 | ... == ... | false | 34 | 34 |
|
||||
@@ -110,3 +116,5 @@
|
||||
| test.cpp:135:6:135:21 | call to __builtin_expect | true | 135 | 136 |
|
||||
| test.cpp:141:6:141:21 | call to __builtin_expect | true | 141 | 142 |
|
||||
| test.cpp:145:6:145:21 | call to __builtin_expect | true | 145 | 146 |
|
||||
| test.cpp:152:7:152:8 | ! ... | true | 152 | 153 |
|
||||
| test.cpp:152:8:152:8 | b | false | 152 | 153 |
|
||||
|
||||
@@ -157,6 +157,16 @@ binary
|
||||
| test.c:109:9:109:23 | ... \|\| ... | test.c:109:23:109:23 | 0 | < | test.c:109:19:109:19 | y | 1 | 113 | 113 |
|
||||
| test.c:109:19:109:23 | ... < ... | test.c:109:19:109:19 | y | >= | test.c:109:23:109:23 | 0 | 0 | 113 | 113 |
|
||||
| test.c:109:19:109:23 | ... < ... | test.c:109:23:109:23 | 0 | < | test.c:109:19:109:19 | y | 1 | 113 | 113 |
|
||||
| test.c:182:10:182:20 | ... >= ... | test.c:182:10:182:12 | foo | >= | test.c:182:17:182:20 | 9.999999999999999547e-07 | 0 | 181 | 182 |
|
||||
| test.c:182:10:182:20 | ... >= ... | test.c:182:10:182:12 | foo | >= | test.c:182:17:182:20 | 9.999999999999999547e-07 | 0 | 182 | 182 |
|
||||
| test.c:182:10:182:20 | ... >= ... | test.c:182:17:182:20 | 9.999999999999999547e-07 | < | test.c:182:10:182:12 | foo | 1 | 181 | 182 |
|
||||
| test.c:182:10:182:20 | ... >= ... | test.c:182:17:182:20 | 9.999999999999999547e-07 | < | test.c:182:10:182:12 | foo | 1 | 182 | 182 |
|
||||
| test.c:182:10:182:33 | ... && ... | test.c:182:10:182:12 | foo | >= | test.c:182:17:182:20 | 9.999999999999999547e-07 | 0 | 181 | 182 |
|
||||
| test.c:182:10:182:33 | ... && ... | test.c:182:17:182:20 | 9.999999999999999547e-07 | < | test.c:182:10:182:12 | foo | 1 | 181 | 182 |
|
||||
| test.c:182:10:182:33 | ... && ... | test.c:182:25:182:27 | foo | < | test.c:182:31:182:33 | 1.0 | 0 | 181 | 182 |
|
||||
| test.c:182:10:182:33 | ... && ... | test.c:182:31:182:33 | 1.0 | >= | test.c:182:25:182:27 | foo | 1 | 181 | 182 |
|
||||
| test.c:182:25:182:33 | ... < ... | test.c:182:25:182:27 | foo | < | test.c:182:31:182:33 | 1.0 | 0 | 181 | 182 |
|
||||
| test.c:182:25:182:33 | ... < ... | test.c:182:31:182:33 | 1.0 | >= | test.c:182:25:182:27 | foo | 1 | 181 | 182 |
|
||||
| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | != | test.cpp:31:12:31:13 | - ... | 0 | 30 | 30 |
|
||||
| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | != | test.cpp:31:12:31:13 | - ... | 0 | 34 | 34 |
|
||||
| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | == | test.cpp:31:12:31:13 | - ... | 0 | 30 | 30 |
|
||||
@@ -181,6 +191,10 @@ binary
|
||||
| test.cpp:141:6:141:21 | call to __builtin_expect | test.cpp:141:28:141:29 | 42 | == | test.cpp:141:23:141:23 | a | 0 | 141 | 142 |
|
||||
| test.cpp:145:6:145:21 | call to __builtin_expect | test.cpp:145:23:145:23 | a | != | test.cpp:145:28:145:29 | 42 | 0 | 145 | 146 |
|
||||
| test.cpp:145:6:145:21 | call to __builtin_expect | test.cpp:145:28:145:29 | 42 | != | test.cpp:145:23:145:23 | a | 0 | 145 | 146 |
|
||||
| test.cpp:152:7:152:8 | ! ... | test.cpp:151:8:151:8 | a | >= | test.cpp:151:12:151:13 | 10 | 0 | 152 | 153 |
|
||||
| test.cpp:152:7:152:8 | ! ... | test.cpp:151:12:151:13 | 10 | < | test.cpp:151:8:151:8 | a | 1 | 152 | 153 |
|
||||
| test.cpp:152:8:152:8 | b | test.cpp:151:8:151:8 | a | >= | test.cpp:151:12:151:13 | 10 | 0 | 152 | 153 |
|
||||
| test.cpp:152:8:152:8 | b | test.cpp:151:12:151:13 | 10 | < | test.cpp:151:8:151:8 | a | 1 | 152 | 153 |
|
||||
unary
|
||||
| test.c:7:9:7:13 | ... > ... | test.c:7:9:7:9 | x | < | 1 | 10 | 11 |
|
||||
| test.c:7:9:7:13 | ... > ... | test.c:7:9:7:9 | x | >= | 1 | 7 | 9 |
|
||||
@@ -467,6 +481,25 @@ unary
|
||||
| test.c:176:10:176:14 | ... < ... | test.c:176:8:176:15 | ! ... | != | 0 | 176 | 178 |
|
||||
| test.c:176:10:176:14 | ... < ... | test.c:176:8:176:15 | ! ... | == | 1 | 176 | 178 |
|
||||
| test.c:176:10:176:14 | ... < ... | test.c:176:10:176:14 | ... < ... | == | 0 | 176 | 178 |
|
||||
| test.c:182:8:182:34 | ! ... | test.c:182:8:182:34 | ! ... | != | 0 | 182 | 184 |
|
||||
| test.c:182:8:182:34 | ! ... | test.c:182:8:182:34 | ! ... | == | 1 | 182 | 184 |
|
||||
| test.c:182:8:182:34 | ! ... | test.c:182:10:182:33 | ... && ... | == | 0 | 182 | 184 |
|
||||
| test.c:182:10:182:20 | ... >= ... | test.c:182:10:182:20 | ... >= ... | != | 0 | 181 | 182 |
|
||||
| test.c:182:10:182:20 | ... >= ... | test.c:182:10:182:20 | ... >= ... | != | 0 | 182 | 182 |
|
||||
| test.c:182:10:182:20 | ... >= ... | test.c:182:10:182:20 | ... >= ... | == | 1 | 181 | 182 |
|
||||
| test.c:182:10:182:20 | ... >= ... | test.c:182:10:182:20 | ... >= ... | == | 1 | 182 | 182 |
|
||||
| test.c:182:10:182:33 | ... && ... | test.c:182:8:182:34 | ! ... | != | 0 | 182 | 184 |
|
||||
| test.c:182:10:182:33 | ... && ... | test.c:182:8:182:34 | ! ... | != | 1 | 181 | 182 |
|
||||
| test.c:182:10:182:33 | ... && ... | test.c:182:8:182:34 | ! ... | == | 0 | 181 | 182 |
|
||||
| test.c:182:10:182:33 | ... && ... | test.c:182:8:182:34 | ! ... | == | 1 | 182 | 184 |
|
||||
| test.c:182:10:182:33 | ... && ... | test.c:182:10:182:20 | ... >= ... | != | 0 | 181 | 182 |
|
||||
| test.c:182:10:182:33 | ... && ... | test.c:182:10:182:20 | ... >= ... | == | 1 | 181 | 182 |
|
||||
| test.c:182:10:182:33 | ... && ... | test.c:182:10:182:33 | ... && ... | != | 0 | 181 | 182 |
|
||||
| test.c:182:10:182:33 | ... && ... | test.c:182:10:182:33 | ... && ... | == | 0 | 182 | 184 |
|
||||
| test.c:182:10:182:33 | ... && ... | test.c:182:25:182:33 | ... < ... | != | 0 | 181 | 182 |
|
||||
| test.c:182:10:182:33 | ... && ... | test.c:182:25:182:33 | ... < ... | == | 1 | 181 | 182 |
|
||||
| test.c:182:25:182:33 | ... < ... | test.c:182:25:182:33 | ... < ... | != | 0 | 181 | 182 |
|
||||
| test.c:182:25:182:33 | ... < ... | test.c:182:25:182:33 | ... < ... | == | 1 | 181 | 182 |
|
||||
| test.cpp:18:8:18:10 | call to get | test.cpp:18:8:18:10 | call to get | != | 0 | 19 | 19 |
|
||||
| test.cpp:18:8:18:10 | call to get | test.cpp:18:8:18:10 | call to get | == | 1 | 19 | 19 |
|
||||
| test.cpp:31:7:31:13 | ... == ... | test.cpp:31:7:31:7 | x | != | -1 | 30 | 30 |
|
||||
@@ -519,3 +552,17 @@ unary
|
||||
| test.cpp:145:6:145:21 | call to __builtin_expect | test.cpp:145:6:145:21 | call to __builtin_expect | != | 0 | 145 | 146 |
|
||||
| test.cpp:145:6:145:21 | call to __builtin_expect | test.cpp:145:6:145:21 | call to __builtin_expect | == | 1 | 145 | 146 |
|
||||
| test.cpp:145:6:145:21 | call to __builtin_expect | test.cpp:145:23:145:23 | a | != | 42 | 145 | 146 |
|
||||
| test.cpp:152:7:152:8 | ! ... | test.cpp:151:8:151:8 | a | >= | 10 | 152 | 153 |
|
||||
| test.cpp:152:7:152:8 | ! ... | test.cpp:151:8:151:13 | ... < ... | != | 1 | 152 | 153 |
|
||||
| test.cpp:152:7:152:8 | ! ... | test.cpp:151:8:151:13 | ... < ... | == | 0 | 152 | 153 |
|
||||
| test.cpp:152:7:152:8 | ! ... | test.cpp:152:7:152:8 | ! ... | != | 0 | 152 | 153 |
|
||||
| test.cpp:152:7:152:8 | ! ... | test.cpp:152:7:152:8 | ! ... | == | 1 | 152 | 153 |
|
||||
| test.cpp:152:7:152:8 | ! ... | test.cpp:152:8:152:8 | b | != | 1 | 152 | 153 |
|
||||
| test.cpp:152:7:152:8 | ! ... | test.cpp:152:8:152:8 | b | == | 0 | 152 | 153 |
|
||||
| test.cpp:152:8:152:8 | b | test.cpp:151:8:151:8 | a | >= | 10 | 152 | 153 |
|
||||
| test.cpp:152:8:152:8 | b | test.cpp:151:8:151:13 | ... < ... | != | 1 | 152 | 153 |
|
||||
| test.cpp:152:8:152:8 | b | test.cpp:151:8:151:13 | ... < ... | == | 0 | 152 | 153 |
|
||||
| test.cpp:152:8:152:8 | b | test.cpp:152:7:152:8 | ! ... | != | 0 | 152 | 153 |
|
||||
| test.cpp:152:8:152:8 | b | test.cpp:152:7:152:8 | ! ... | == | 1 | 152 | 153 |
|
||||
| test.cpp:152:8:152:8 | b | test.cpp:152:8:152:8 | b | != | 1 | 152 | 153 |
|
||||
| test.cpp:152:8:152:8 | b | test.cpp:152:8:152:8 | b | == | 0 | 152 | 153 |
|
||||
|
||||
@@ -175,5 +175,11 @@ void test9(short s) {
|
||||
void test10(int a, int b) {
|
||||
if(!(a < b)) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void test11(double foo) {
|
||||
if(!(foo >= 1e-6 && foo < 1.0)) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -145,4 +145,11 @@ void unary_test_builtin_expected(int a) {
|
||||
if(__builtin_expect(a != 42, 0)) {
|
||||
use(a);
|
||||
}
|
||||
}
|
||||
|
||||
void test_with_reference(bool& b, int a) {
|
||||
b = a < 10;
|
||||
if(!b) {
|
||||
use(a);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user