CPP: Improve the Enums3 test.

This commit is contained in:
Geoffrey White
2019-08-06 15:07:15 +01:00
parent 064b8773a4
commit 2466299df5
2 changed files with 25 additions and 13 deletions

View File

@@ -1,10 +1,10 @@
| enums.cpp:3:6:3:8 | Day | false |
| enums.cpp:4:6:4:9 | Day2 | false |
| enums.cpp:5:6:5:9 | Flag | false |
| enums.cpp:19:7:19:17 | myLocalEnum | false |
| enums.cpp:27:8:27:19 | MyNestedEnum | false |
| enums.ms.c:1:6:1:12 | numbers | false |
| scoped.cpp:2:12:2:13 | E1 | true |
| scoped.cpp:6:12:6:13 | E2 | true |
| scoped.cpp:10:13:10:14 | E3 | true |
| scoped.cpp:16:14:16:18 | State | true |
| enums.cpp:3:6:3:8 | Day | |
| enums.cpp:4:6:4:9 | Day2 | |
| enums.cpp:5:6:5:9 | Flag | |
| enums.cpp:19:7:19:17 | myLocalEnum | LocalEnum |
| enums.cpp:27:8:27:19 | MyNestedEnum | NestedEnum |
| enums.ms.c:1:6:1:12 | numbers | |
| scoped.cpp:2:12:2:13 | E1 | ScopedEnum |
| scoped.cpp:6:12:6:13 | E2 | ScopedEnum |
| scoped.cpp:10:13:10:14 | E3 | ScopedEnum |
| scoped.cpp:16:14:16:18 | State | NestedEnum, ScopedEnum |

View File

@@ -1,6 +1,18 @@
import cpp
from Enum e, boolean isScoped
where if e instanceof ScopedEnum then isScoped = true else isScoped = false
select e, isScoped
string describe(Enum e)
{
(
e instanceof LocalEnum and
result = "LocalEnum"
) or (
e instanceof NestedEnum and
result = "NestedEnum"
) or (
e instanceof ScopedEnum and
result = "ScopedEnum"
)
}
from Enum e
select e, concat(describe(e), ", ")