Skip to content

Commit d9fbf64

Browse files
committed
C++: Simplify test queries
1 parent 4216611 commit d9fbf64

3 files changed

Lines changed: 4 additions & 22 deletions

File tree

‎cpp/ql/test/library-tests/builtins/builtins/expr.expected‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
| choose_expr.c:3:35:3:35 | 1 | | 1 |
3232
| choose_expr.c:3:38:3:38 | 5 | | 5 |
3333
| choose_expr.c:3:41:3:41 | 6 | | 6 |
34+
| spaceship.cpp:6:45:6:45 | n | this | <none> |
3435
| spaceship.cpp:6:45:6:45 | this | | <none> |
3536
| spaceship.cpp:9:53:9:56 | {...} | - ... | <none> |
3637
| spaceship.cpp:9:54:9:55 | - ... | 1 | -1 |
@@ -42,6 +43,7 @@
4243
| spaceship.cpp:18:12:18:14 | rhs | | <none> |
4344
| spaceship.cpp:18:12:18:24 | ... <=> ... | rhs,i | <none> |
4445
| spaceship.cpp:18:20:18:22 | lhs | | <none> |
46+
| spaceship.cpp:18:24:18:24 | i | lhs | <none> |
4547
| spaceship.cpp:22:41:22:101 | __builtin_lt_synthesizes_from_spaceship | const S &,const int & | 1 |
4648
| spaceship.cpp:22:41:22:101 | const S & | | <none> |
4749
| spaceship.cpp:22:41:22:101 | const int & | | <none> |
Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
import cpp
22

3-
string childrenFrom(Expr e, int i) {
4-
(
5-
if i = 0
6-
then result = e.getChild(i).toString() + childrenFrom(e, i + 1)
7-
else result = "," + e.getChild(i).toString() + childrenFrom(e, i + 1)
8-
)
9-
or
10-
i = e.getNumChild() and result = ""
11-
}
12-
133
from Expr e, string value
144
where if exists(e.getValue()) then value = e.getValue().toString() else value = "<none>"
15-
select e, childrenFrom(e, 0), value
5+
select e, concat(int i | | e.getChild(i).toString(), "," order by i), value
Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
import cpp
22

3-
string childrenFrom(Expr e, int i) {
4-
(
5-
if i = 0
6-
then result = e.getChild(i).toString() + childrenFrom(e, i + 1)
7-
else result = "," + e.getChild(i).toString() + childrenFrom(e, i + 1)
8-
)
9-
or
10-
i = e.getNumChild() and result = ""
11-
}
12-
133
from Expr e, string value
144
where if exists(e.getValue()) then value = e.getValue().toString() else value = "<none>"
15-
select e, childrenFrom(e, 0), value
5+
select e, concat(int i | | e.getChild(i).toString(), "," order by i), value

0 commit comments

Comments
 (0)