Skip to content

Commit 2466299

Browse files
committed
CPP: Improve the Enums3 test.
1 parent 064b877 commit 2466299

File tree

2 files changed

+25
-13
lines changed

2 files changed

+25
-13
lines changed
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
| enums.cpp:3:6:3:8 | Day | false |
2-
| enums.cpp:4:6:4:9 | Day2 | false |
3-
| enums.cpp:5:6:5:9 | Flag | false |
4-
| enums.cpp:19:7:19:17 | myLocalEnum | false |
5-
| enums.cpp:27:8:27:19 | MyNestedEnum | false |
6-
| enums.ms.c:1:6:1:12 | numbers | false |
7-
| scoped.cpp:2:12:2:13 | E1 | true |
8-
| scoped.cpp:6:12:6:13 | E2 | true |
9-
| scoped.cpp:10:13:10:14 | E3 | true |
10-
| scoped.cpp:16:14:16:18 | State | true |
1+
| enums.cpp:3:6:3:8 | Day | |
2+
| enums.cpp:4:6:4:9 | Day2 | |
3+
| enums.cpp:5:6:5:9 | Flag | |
4+
| enums.cpp:19:7:19:17 | myLocalEnum | LocalEnum |
5+
| enums.cpp:27:8:27:19 | MyNestedEnum | NestedEnum |
6+
| enums.ms.c:1:6:1:12 | numbers | |
7+
| scoped.cpp:2:12:2:13 | E1 | ScopedEnum |
8+
| scoped.cpp:6:12:6:13 | E2 | ScopedEnum |
9+
| scoped.cpp:10:13:10:14 | E3 | ScopedEnum |
10+
| scoped.cpp:16:14:16:18 | State | NestedEnum, ScopedEnum |
Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11
import cpp
22

3-
from Enum e, boolean isScoped
4-
where if e instanceof ScopedEnum then isScoped = true else isScoped = false
5-
select e, isScoped
3+
string describe(Enum e)
4+
{
5+
(
6+
e instanceof LocalEnum and
7+
result = "LocalEnum"
8+
) or (
9+
e instanceof NestedEnum and
10+
result = "NestedEnum"
11+
) or (
12+
e instanceof ScopedEnum and
13+
result = "ScopedEnum"
14+
)
15+
}
616

17+
from Enum e
18+
select e, concat(describe(e), ", ")

0 commit comments

Comments
 (0)