Skip to content

Commit 8b8ec7c

Browse files
author
Robert Marsh
committed
C++: add literal tests
1 parent 3c6a9c0 commit 8b8ec7c

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

cpp/ql/test/library-tests/valuenumbering/HashCons/GlobalValueNumbering.expected

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,19 @@
3333
| test.cpp:79:11:79:14 | vals | 79:c11-c14 79:c24-c27 |
3434
| test.cpp:92:11:92:11 | x | 92:c11-c11 93:c10-c10 |
3535
| test.cpp:97:3:97:3 | x | 97:c3-c3 98:c3-c3 |
36+
| test.cpp:103:10:103:11 | 1 | 103:c10-c11 104:c7-c7 107:c7-c7 108:c7-c7 10:c16-c16 |
37+
| test.cpp:104:3:104:3 | x | 104:c3-c3 105:c3-c3 106:c3-c3 107:c3-c3 108:c3-c3 |
38+
| test.cpp:105:7:105:7 | 2 | 105:c7-c7 106:c7-c7 107:c11-c11 108:c11-c11 21:c16-c16 |
39+
| test.cpp:107:7:107:11 | ... + ... | 107:c7-c11 108:c7-c11 35:c16-c16 |
40+
| test.cpp:110:15:110:17 | 1 | 110:c15-c17 111:c9-c11 |
41+
| test.cpp:110:15:110:17 | (char *)... | 110:c15-c17 111:c9-c11 |
42+
| test.cpp:110:15:110:17 | array to pointer conversion | 110:c15-c17 111:c9-c11 |
43+
| test.cpp:111:3:111:5 | str | 111:c3-c5 112:c3-c5 113:c3-c5 |
44+
| test.cpp:112:9:112:11 | 2 | 112:c9-c11 113:c9-c11 |
45+
| test.cpp:112:9:112:11 | (char *)... | 112:c9-c11 113:c9-c11 |
46+
| test.cpp:112:9:112:11 | array to pointer conversion | 112:c9-c11 113:c9-c11 |
47+
| test.cpp:115:13:115:15 | 0.0 | 115:c13-c15 116:c7-c9 |
48+
| test.cpp:115:13:115:15 | (float)... | 115:c13-c15 116:c7-c9 |
49+
| test.cpp:116:3:116:3 | y | 116:c3-c3 117:c3-c3 118:c3-c3 |
50+
| test.cpp:117:7:117:9 | 0.10000000000000001 | 117:c7-c9 118:c7-c9 |
51+
| test.cpp:117:7:117:9 | (float)... | 117:c7-c9 118:c7-c9 |

cpp/ql/test/library-tests/valuenumbering/HashCons/test.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,22 @@ void test06(int x) {
9898
x++; // x is matched but x++ is not matched?
9999
}
100100

101+
// literals
102+
void test07() {
103+
int x = 1;
104+
x = 1;
105+
x = 2;
106+
x = 2;
107+
x = 1 + 2;
108+
x = 1 + 2;
109+
110+
char *str = "1";
111+
str = "1";
112+
str = "2";
113+
str = "2";
114+
115+
float y = 0.0;
116+
y = 0.0;
117+
y = 0.1;
118+
y = 0.1;
119+
}

0 commit comments

Comments
 (0)