mirror of
https://github.com/JakeHillion/object-introspection.git
synced 2024-11-09 21:24:14 +00:00
90 lines
2.8 KiB
TOML
90 lines
2.8 KiB
TOML
includes = ["vector", "utility", "cstdint"]
|
|
[cases]
|
|
[cases.uint64_uint64]
|
|
param_types = ["std::pair<std::uint64_t, std::uint64_t>&"]
|
|
setup = "return {{0, 1}};"
|
|
expect_json = '''
|
|
[
|
|
{
|
|
"staticSize": 16,
|
|
"dynamicSize": 0,
|
|
"length": 1,
|
|
"capacity": 1
|
|
}
|
|
]
|
|
'''
|
|
expect_json_v2 = '''[
|
|
{"staticSize": 16, "exclusiveSize": 0, "members": [
|
|
{"typeNames": ["uint64_t"], "staticSize": 8, "exclusiveSize": 8},
|
|
{"typeNames": ["uint64_t"], "staticSize": 8, "exclusiveSize": 8}
|
|
]}
|
|
]'''
|
|
[cases.uint64_uint32]
|
|
param_types = ["std::pair<std::uint64_t, std::uint32_t>&"]
|
|
setup = "return {{0, 1}};"
|
|
# Should still have static size of 16 due to padding
|
|
expect_json = '''
|
|
[
|
|
{
|
|
"staticSize": 16,
|
|
"dynamicSize": 0,
|
|
"length": 1,
|
|
"capacity": 1
|
|
}
|
|
]
|
|
'''
|
|
expect_json_v2 = '''[
|
|
{"staticSize": 16, "exclusiveSize": 4, "members": [
|
|
{"typeNames": ["uint64_t"], "staticSize": 8, "exclusiveSize": 8},
|
|
{"typeNames": ["uint32_t"], "staticSize": 4, "exclusiveSize": 4}
|
|
]}
|
|
]'''
|
|
|
|
[cases.uint64_uint64_ptr]
|
|
# Stubbed pointers were previously generated as a uintptr_t. Now they're
|
|
# generated as a special StubbedPointer type. This previously caused
|
|
# codegen problems as uintptr_t is a typedef of uint64_t and they'd both
|
|
# be specialised on a template.
|
|
param_types = ["std::pair<uint64_t, uint64_t*>&"]
|
|
setup = "return {{0, nullptr}};"
|
|
expect_json_v2 = '''[
|
|
{"staticSize": 16, "exclusiveSize": 0, "members": [
|
|
{"typeNames": ["uint64_t"], "staticSize": 8, "exclusiveSize": 8},
|
|
{"typeNames": ["uintptr_t (stubbed)"], "staticSize": 8, "exclusiveSize": 8}
|
|
]}
|
|
]'''
|
|
|
|
[cases.vector_vector]
|
|
param_types = ["std::pair<std::vector<std::uint64_t>, std::vector<std::uint64_t>>&"]
|
|
setup = "return {{std::initializer_list<std::uint64_t>({0,1,2}), std::initializer_list<std::uint64_t>({3,4,5,6})}};"
|
|
expect_json = '''
|
|
[
|
|
{
|
|
"staticSize": 48,
|
|
"dynamicSize": 56,
|
|
"length": 1,
|
|
"capacity": 1,
|
|
"members": [
|
|
{
|
|
"staticSize": 24,
|
|
"dynamicSize": 24,
|
|
"length": 3,
|
|
"capacity": 3
|
|
},
|
|
{
|
|
"staticSize": 24,
|
|
"dynamicSize": 32,
|
|
"length": 4,
|
|
"capacity": 4
|
|
}
|
|
]
|
|
}
|
|
]
|
|
'''
|
|
expect_json_v2 = '''[
|
|
{"staticSize": 48, "exclusiveSize": 0, "members": [
|
|
{"typeNames": ["std::vector<uint64_t, std::allocator<uint64_t>>"], "staticSize": 24, "exclusiveSize": 24},
|
|
{"typeNames": ["std::vector<uint64_t, std::allocator<uint64_t>>"], "staticSize": 24, "exclusiveSize": 24}
|
|
]}
|
|
]'''
|