object-introspection/test/integration/enums.toml
2023-09-20 18:13:45 +01:00

67 lines
1.7 KiB
TOML

definitions = '''
enum class ScopedEnum {
CaseA,
CaseB,
CaseC,
};
enum class ScopedEnumUint8 : uint8_t {
CaseA = 2,
CaseB = 3,
CaseC = 4,
};
enum UNSCOPED_ENUM {
CASE_A = 5,
CASE_B = -2,
CASE_C = 20,
};
struct Holder {
enum {
One,
Two,
} e;
};
template <typename T1, typename T2>
struct Pair {
T1 first;
T2 second;
};
'''
[cases]
[cases.scoped]
param_types = ["ScopedEnum"]
setup = "return {};"
expect_json = '[{"staticSize":4, "dynamicSize":0}]'
expect_json_v2 = '[{"typeNames": ["ScopedEnum"], "staticSize":4, "exclusiveSize":4}]'
[cases.scoped_uint8]
param_types = ["ScopedEnumUint8"]
setup = "return {};"
expect_json = '[{"staticSize":1, "dynamicSize":0}]'
expect_json_v2 = '[{"typeNames": ["ScopedEnumUint8"], "staticSize":1, "exclusiveSize":1}]'
[cases.unscoped]
param_types = ["UNSCOPED_ENUM"]
setup = "return {};"
expect_json = '[{"staticSize":4, "dynamicSize":0}]'
[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, "members":[
{"name":"e", "staticSize":4, "dynamicSize":0, "exclusiveSize":4}
]}]'''
[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, "members": [
{"typeNames": ["ScopedEnumUint8"], "staticSize":1, "exclusiveSize":1},
{"typeNames": ["uint8_t"], "staticSize":1, "exclusiveSize":1}
]}
]'''