object-introspection/test/integration/enums.toml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

67 lines
1.9 KiB
TOML
Raw Permalink Normal View History

2023-02-14 13:58:34 +00:00
definitions = '''
enum class ScopedEnum {
CaseA,
CaseB,
CaseC,
};
2023-09-19 17:25:58 +01:00
enum class ScopedEnumUint8 : uint8_t {
CaseA = 2,
CaseB = 3,
CaseC = 4,
2023-02-14 13:58:34 +00:00
};
enum UNSCOPED_ENUM {
CASE_A = 5,
CASE_B = -2,
CASE_C = 20,
2023-02-14 13:58:34 +00:00
};
struct Holder {
enum {
One,
Two,
} e;
};
2023-09-19 17:25:58 +01:00
template <typename T1, typename T2>
struct Pair {
T1 first;
T2 second;
};
2023-02-14 13:58:34 +00:00
'''
[cases]
[cases.scoped]
param_types = ["ScopedEnum"]
setup = "return {};"
expect_json = '[{"staticSize":4, "dynamicSize":0}]'
expect_json_v2 = '[{"typeNames": ["ns_enums::ScopedEnum"], "staticSize":4, "exclusiveSize":4, "size":4}]'
2023-09-19 17:25:58 +01:00
[cases.scoped_uint8]
param_types = ["ScopedEnumUint8"]
2023-02-14 13:58:34 +00:00
setup = "return {};"
expect_json = '[{"staticSize":1, "dynamicSize":0}]'
expect_json_v2 = '[{"typeNames": ["ns_enums::ScopedEnumUint8"], "staticSize":1, "exclusiveSize":1, "size":1}]'
2023-02-14 13:58:34 +00:00
[cases.unscoped]
param_types = ["UNSCOPED_ENUM"]
setup = "return {};"
expect_json = '[{"staticSize":4, "dynamicSize":0, "exclusiveSize":4, "size":4}]'
[cases.anonymous]
skip = "TreeBuilder crashes" # https://github.com/facebookexperimental/object-introspection/issues/232
param_types = ["Holder&"]
setup = "return {};"
expect_json = '''[
{"staticSize":4, "dynamicSize":0, "exclusiveSize":0, "size":4, "members":[
{"name":"e", "staticSize":4, "dynamicSize":0, "exclusiveSize":4, "size":4}
]}]'''
2023-09-19 17:25:58 +01:00
[cases.paired_with_element]
param_types = ["Pair<ScopedEnumUint8, uint8_t>"]
setup = "return {};"
expect_json = '[{"staticSize":2, "dynamicSize":0}]'
expect_json_v2 = '''[
{"staticSize": 2, "exclusiveSize": 0, "size":2, "members": [
{"typeNames": ["ns_enums::ScopedEnumUint8"], "staticSize":1, "exclusiveSize":1, "size":1},
{"typeNames": ["uint8_t"], "staticSize":1, "exclusiveSize":1, "size":1}
2023-09-19 17:25:58 +01:00
]}
]'''