Skip to content

Commit df24e59

Browse files
committed
C++: Add tests and accept test changes.
1 parent e8b9d7e commit df24e59

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
| test.cpp:3:11:3:15 | local | Variable 'local' is not initialized. |
2+
| test.cpp:12:5:12:24 | uninitialised_global | Variable 'uninitialised_global' is not initialized. |
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Critical/NotInitialised.ql
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
void test1() {
2+
int local;
3+
int x = local; // BAD
4+
5+
static int static_local;
6+
int y = static_local; // GOOD
7+
8+
int initialised = 42;
9+
int z = initialised; // GOOD
10+
}
11+
12+
int uninitialised_global; // BAD
13+
static int uninitialised_static_global; // GOOD
14+
int initialized_global = 0; // GOOD
15+
16+
void test2() {
17+
int a = uninitialised_global;
18+
int b = uninitialised_static_global;
19+
int c = initialized_global;
20+
}

0 commit comments

Comments
 (0)