Skip to content

Commit d3f98a5

Browse files
committed
CPP: Create a direct test of Variable.getAnAssignedValue().
1 parent 18443e3 commit d3f98a5

File tree

3 files changed

+39
-0
lines changed

3 files changed

+39
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
| test.cpp:4:9:4:11 | 10 | test.cpp:4:6:4:6 | v |
2+
| test.cpp:5:15:5:16 | & ... | test.cpp:5:7:5:11 | ptr_v |
3+
| test.cpp:6:15:6:15 | v | test.cpp:6:7:6:11 | ref_v |
4+
| test.cpp:8:6:8:7 | 11 | test.cpp:4:6:4:6 | v |
5+
| test.cpp:10:10:10:11 | 13 | test.cpp:6:7:6:11 | ref_v |
6+
| test.cpp:11:6:11:10 | ... + ... | test.cpp:4:6:4:6 | v |
7+
| test.cpp:19:32:19:35 | 0.0 | test.cpp:19:27:19:28 | _y |
8+
| test.cpp:19:42:19:43 | _x | test.cpp:24:8:24:8 | x |
9+
| test.cpp:19:49:19:50 | _y | test.cpp:24:11:24:11 | y |
10+
| test.cpp:19:54:19:60 | 0.0 | test.cpp:24:14:24:14 | z |
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import cpp
2+
3+
from Variable v
4+
select v.getAnAssignedValue(), v
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
void test1()
3+
{
4+
int v = 10; // assignment to `v`
5+
int *ptr_v = &v; // assignment to `ptr_v`
6+
int &ref_v = v; // assignment to `ref_v`
7+
8+
v = 11; // assignment to `v`
9+
*ptr_v = 12;
10+
ref_v = 13; // assignment to `ref_v`
11+
v = v + 1; // assignment to `v`
12+
v += 1;
13+
v++;
14+
}
15+
16+
class myClass1
17+
{
18+
public:
19+
myClass1(float _x, float _y = 0.0f) : x(_x), y(_y), z(0.0f) { // assignments to `_y`, `x`, `y`, `z`
20+
// ...
21+
}
22+
23+
private:
24+
float x, y, z;
25+
};

0 commit comments

Comments
 (0)