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 {
|
2023-08-16 19:15:09 +01:00
|
|
|
CaseA = 2,
|
|
|
|
CaseB = 3,
|
|
|
|
CaseC = 4,
|
2023-02-14 13:58:34 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
enum UNSCOPED_ENUM {
|
2023-08-16 19:15:09 +01:00
|
|
|
CASE_A = 5,
|
|
|
|
CASE_B = -2,
|
|
|
|
CASE_C = 20,
|
2023-02-14 13:58:34 +00:00
|
|
|
};
|
2023-07-12 14:31:23 +01: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}]'
|
2024-01-16 16:23:52 +00:00
|
|
|
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}]'
|
2024-01-16 16:23:52 +00:00
|
|
|
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 {};"
|
2024-01-03 17:30:31 +00:00
|
|
|
expect_json = '[{"staticSize":4, "dynamicSize":0, "exclusiveSize":4, "size":4}]'
|
2023-07-12 14:31:23 +01:00
|
|
|
[cases.anonymous]
|
|
|
|
skip = "TreeBuilder crashes" # https://github.com/facebookexperimental/object-introspection/issues/232
|
|
|
|
param_types = ["Holder&"]
|
|
|
|
setup = "return {};"
|
|
|
|
expect_json = '''[
|
2024-01-03 17:30:31 +00:00
|
|
|
{"staticSize":4, "dynamicSize":0, "exclusiveSize":0, "size":4, "members":[
|
|
|
|
{"name":"e", "staticSize":4, "dynamicSize":0, "exclusiveSize":4, "size":4}
|
2023-07-12 14:31:23 +01:00
|
|
|
]}]'''
|
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 = '''[
|
2024-01-03 17:30:31 +00:00
|
|
|
{"staticSize": 2, "exclusiveSize": 0, "size":2, "members": [
|
2024-01-16 16:23:52 +00:00
|
|
|
{"typeNames": ["ns_enums::ScopedEnumUint8"], "staticSize":1, "exclusiveSize":1, "size":1},
|
2024-01-03 17:30:31 +00:00
|
|
|
{"typeNames": ["uint8_t"], "staticSize":1, "exclusiveSize":1, "size":1}
|
2023-09-19 17:25:58 +01:00
|
|
|
]}
|
|
|
|
]'''
|