Skip to content

Commit 53a53fb

Browse files
committed
C++: Modernize the Functions test.
1 parent b2f1008 commit 53a53fb

File tree

2 files changed

+44
-51
lines changed

2 files changed

+44
-51
lines changed
Lines changed: 29 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,29 @@
1-
| ODASA-5186.cpp:4:8:4:8 | operator= | operator= | | | ODASA-5186.cpp:4:8:4:8 | declaration |
2-
| ODASA-5186.cpp:4:8:4:8 | operator= | operator= | | | ODASA-5186.cpp:4:8:4:8 | declaration |
3-
| ODASA-5186.cpp:5:8:5:8 | operator== | operator== | | | ODASA-5186.cpp:5:8:5:8 | declaration |
4-
| ODASA-5186.cpp:5:8:5:8 | operator== | operator== | | | ODASA-5186.cpp:5:8:5:8 | definition |
5-
| ODASA-5186.cpp:5:8:5:17 | operator== | operator== | | | ODASA-5186.cpp:5:8:5:17 | declaration |
6-
| ODASA-5186.cpp:5:8:5:17 | operator== | operator== | | | ODASA-5186.cpp:5:8:5:17 | definition |
7-
| ODASA-5186.cpp:8:6:8:9 | test | test | isTopLevel | TopLevelFunction | ODASA-5186.cpp:8:6:8:9 | declaration |
8-
| ODASA-5186.cpp:8:6:8:9 | test | test | isTopLevel | TopLevelFunction | ODASA-5186.cpp:8:6:8:9 | definition |
9-
| ODASA-5186.hpp:2:8:2:8 | operator= | operator= | | | ODASA-5186.hpp:2:8:2:8 | declaration |
10-
| ODASA-5186.hpp:2:8:2:8 | operator= | operator= | | | ODASA-5186.hpp:2:8:2:8 | declaration |
11-
| ODASA-5186.hpp:4:18:4:27 | operator!= | operator!= | isTopLevel | TopLevelFunction | ODASA-5186.hpp:4:18:4:27 | declaration |
12-
| ODASA-5186.hpp:4:18:4:27 | operator!= | operator!= | isTopLevel | TopLevelFunction | ODASA-5186.hpp:4:18:4:27 | declaration |
13-
| ODASA-5186.hpp:4:18:4:27 | operator!= | operator!= | isTopLevel | TopLevelFunction | ODASA-5186.hpp:4:18:4:27 | definition |
14-
| ODASA-5186.hpp:4:18:4:27 | operator!= | operator!= | isTopLevel | TopLevelFunction | ODASA-5186.hpp:4:18:4:27 | definition |
15-
| functions.cpp:1:6:1:6 | f | f | isTopLevel | TopLevelFunction | functions.cpp:1:6:1:6 | declaration |
16-
| functions.cpp:1:6:1:6 | f | f | isTopLevel | TopLevelFunction | functions.cpp:1:6:1:6 | definition |
17-
| functions.cpp:7:8:7:8 | operator= | operator= | | | functions.cpp:7:8:7:8 | declaration |
18-
| functions.cpp:7:8:7:8 | operator= | operator= | | | functions.cpp:7:8:7:8 | declaration |
19-
| functions.cpp:8:7:8:8 | af | af | | | functions.cpp:8:7:8:8 | declaration |
20-
| functions.cpp:8:7:8:8 | af | af | | | functions.cpp:8:7:8:8 | definition |
21-
| functions.cpp:11:7:11:8 | ag | ag | | | functions.cpp:11:7:11:8 | declaration |
22-
| functions.cpp:14:6:14:6 | g | g | isTopLevel | TopLevelFunction | functions.cpp:5:6:5:6 | declaration |
23-
| functions.cpp:14:6:14:6 | g | g | isTopLevel | TopLevelFunction | functions.cpp:14:6:14:6 | declaration |
24-
| functions.cpp:14:6:14:6 | g | g | isTopLevel | TopLevelFunction | functions.cpp:14:6:14:6 | definition |
25-
| functions.cpp:19:7:19:7 | operator= | operator= | | | functions.cpp:19:7:19:7 | declaration |
26-
| functions.cpp:19:7:19:7 | operator= | operator= | | | functions.cpp:19:7:19:7 | declaration |
27-
| functions.cpp:23:7:23:7 | Table | Table | | | functions.cpp:23:7:23:7 | declaration |
28-
| functions.cpp:23:7:23:7 | operator= | operator= | | | functions.cpp:23:7:23:7 | declaration |
29-
| functions.cpp:27:3:27:7 | Table | Table | | | functions.cpp:27:3:27:7 | declaration |
30-
| functions.cpp:27:3:27:7 | Table | Table | | | functions.cpp:27:3:27:7 | definition |
31-
| functions.cpp:28:3:28:8 | ~Table | ~Table | | | functions.cpp:28:3:28:8 | declaration |
32-
| functions.cpp:28:3:28:8 | ~Table | ~Table | | | functions.cpp:28:3:28:8 | definition |
33-
| functions.cpp:29:9:29:14 | lookup | lookup | | | functions.cpp:29:9:29:14 | declaration |
34-
| functions.cpp:30:8:30:13 | insert | insert | | | functions.cpp:30:8:30:13 | declaration |
35-
| functions.cpp:33:7:33:7 | operator= | operator= | | | functions.cpp:33:7:33:7 | declaration |
36-
| functions.cpp:33:7:33:7 | operator= | operator= | | | functions.cpp:33:7:33:7 | definition |
37-
| functions.cpp:36:2:36:8 | MyClass | MyClass | | | functions.cpp:36:2:36:8 | declaration |
38-
| functions.cpp:37:2:37:8 | MyClass | MyClass | | | functions.cpp:37:2:37:8 | declaration |
39-
| functions.cpp:38:2:38:8 | MyClass | MyClass | | | functions.cpp:38:2:38:8 | declaration |
40-
| functions.cpp:39:2:39:8 | MyClass | MyClass | | | functions.cpp:39:2:39:8 | declaration |
41-
| functions.cpp:40:2:40:13 | operator int | operator int | | | functions.cpp:40:2:40:13 | declaration |
1+
| ODASA-5186.cpp:4:8:4:8 | operator= | operator= | declaration:ODASA-5186.cpp:4:8:4:8 |
2+
| ODASA-5186.cpp:4:8:4:8 | operator= | operator= | declaration:ODASA-5186.cpp:4:8:4:8 |
3+
| ODASA-5186.cpp:5:8:5:8 | operator== | operator== | declaration:ODASA-5186.cpp:5:8:5:8, definition:ODASA-5186.cpp:5:8:5:8 |
4+
| ODASA-5186.cpp:5:8:5:17 | operator== | operator== | declaration:ODASA-5186.cpp:5:8:5:17, definition:ODASA-5186.cpp:5:8:5:17 |
5+
| ODASA-5186.cpp:8:6:8:9 | test | test | TopLevelFunction, declaration:ODASA-5186.cpp:8:6:8:9, definition:ODASA-5186.cpp:8:6:8:9, isTopLevel |
6+
| ODASA-5186.hpp:2:8:2:8 | operator= | operator= | declaration:ODASA-5186.hpp:2:8:2:8 |
7+
| ODASA-5186.hpp:2:8:2:8 | operator= | operator= | declaration:ODASA-5186.hpp:2:8:2:8 |
8+
| ODASA-5186.hpp:4:18:4:27 | operator!= | operator!= | TopLevelFunction, declaration:ODASA-5186.hpp:4:18:4:27, definition:ODASA-5186.hpp:4:18:4:27, isTopLevel |
9+
| ODASA-5186.hpp:4:18:4:27 | operator!= | operator!= | TopLevelFunction, declaration:ODASA-5186.hpp:4:18:4:27, definition:ODASA-5186.hpp:4:18:4:27, isTopLevel |
10+
| functions.cpp:1:6:1:6 | f | f | TopLevelFunction, declaration:functions.cpp:1:6:1:6, definition:functions.cpp:1:6:1:6, isTopLevel |
11+
| functions.cpp:7:8:7:8 | operator= | operator= | declaration:functions.cpp:7:8:7:8 |
12+
| functions.cpp:7:8:7:8 | operator= | operator= | declaration:functions.cpp:7:8:7:8 |
13+
| functions.cpp:8:7:8:8 | af | af | declaration:functions.cpp:8:7:8:8, definition:functions.cpp:8:7:8:8 |
14+
| functions.cpp:11:7:11:8 | ag | ag | declaration:functions.cpp:11:7:11:8 |
15+
| functions.cpp:14:6:14:6 | g | g | TopLevelFunction, declaration:functions.cpp:14:6:14:6, declaration:functions.cpp:5:6:5:6, definition:functions.cpp:14:6:14:6, isTopLevel |
16+
| functions.cpp:19:7:19:7 | operator= | operator= | declaration:functions.cpp:19:7:19:7 |
17+
| functions.cpp:19:7:19:7 | operator= | operator= | declaration:functions.cpp:19:7:19:7 |
18+
| functions.cpp:23:7:23:7 | Table | Table | declaration:functions.cpp:23:7:23:7 |
19+
| functions.cpp:23:7:23:7 | operator= | operator= | declaration:functions.cpp:23:7:23:7 |
20+
| functions.cpp:27:3:27:7 | Table | Table | declaration:functions.cpp:27:3:27:7, definition:functions.cpp:27:3:27:7 |
21+
| functions.cpp:28:3:28:8 | ~Table | ~Table | declaration:functions.cpp:28:3:28:8, definition:functions.cpp:28:3:28:8 |
22+
| functions.cpp:29:9:29:14 | lookup | lookup | declaration:functions.cpp:29:9:29:14 |
23+
| functions.cpp:30:8:30:13 | insert | insert | declaration:functions.cpp:30:8:30:13 |
24+
| functions.cpp:33:7:33:7 | operator= | operator= | declaration:functions.cpp:33:7:33:7, definition:functions.cpp:33:7:33:7 |
25+
| functions.cpp:36:2:36:8 | MyClass | MyClass | declaration:functions.cpp:36:2:36:8 |
26+
| functions.cpp:37:2:37:8 | MyClass | MyClass | declaration:functions.cpp:37:2:37:8 |
27+
| functions.cpp:38:2:38:8 | MyClass | MyClass | declaration:functions.cpp:38:2:38:8 |
28+
| functions.cpp:39:2:39:8 | MyClass | MyClass | declaration:functions.cpp:39:2:39:8 |
29+
| functions.cpp:40:2:40:13 | operator int | operator int | declaration:functions.cpp:40:2:40:13 |

cpp/ql/test/library-tests/functions/functions/Functions1.ql

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,18 @@
44

55
import cpp
66

7-
from Function f, string top1, string top2, Location loc, string loctype
8-
where
9-
(if f.isTopLevel() then top1 = "isTopLevel" else top1 = "") and
10-
(if f instanceof TopLevelFunction then top2 = "TopLevelFunction" else top2 = "") and
11-
(
12-
loc = f.getADeclarationLocation() and loctype = "declaration"
13-
or
14-
loc = f.getDefinitionLocation() and loctype = "definition"
15-
)
16-
select f, f.getName(), top1, top2, loc.toString(), loctype
7+
string describe(Function f) {
8+
f.isTopLevel() and
9+
result = "isTopLevel"
10+
or
11+
f instanceof TopLevelFunction and
12+
result = "TopLevelFunction"
13+
or
14+
result = "declaration:" + f.getADeclarationLocation()
15+
or
16+
result = "definition:" + f.getDefinitionLocation()
17+
}
18+
19+
from Function f
20+
where exists(f.getLocation())
21+
select f, f.getName(), concat(describe(f), ", ")

0 commit comments

Comments
 (0)