mirror of
https://github.com/JakeHillion/object-introspection.git
synced 2024-11-09 21:24:14 +00:00
cbeafba9bb
Type names of optional elements were accidentally left as todo. Update `std::optional` to use `make_field` and correctly name its elements. Test Plan: - CI - Updated the integration tests to test the names.
138 lines
2.9 KiB
TOML
138 lines
2.9 KiB
TOML
includes = ["optional", "cstdint", "vector"]
|
|
[cases]
|
|
[cases.uint64_empty]
|
|
param_types = ["std::optional<std::uint64_t>&"]
|
|
setup = "return std::nullopt;"
|
|
expect_json = '''
|
|
[
|
|
{
|
|
"staticSize": 16,
|
|
"dynamicSize": 0,
|
|
"exclusiveSize": 16,
|
|
"length": 0,
|
|
"capacity": 1,
|
|
"elementStaticSize": 8
|
|
}
|
|
]
|
|
'''
|
|
expect_json_v2 = '''
|
|
[
|
|
{
|
|
"typeNames": ["std::optional<uint64_t>"],
|
|
"staticSize": 16,
|
|
"exclusiveSize": 16,
|
|
"size": 16,
|
|
"length": 0,
|
|
"capacity": 1,
|
|
"members": []
|
|
}
|
|
]
|
|
'''
|
|
[cases.uint64_present]
|
|
param_types = ["std::optional<std::uint64_t>&"]
|
|
setup = "return 64;"
|
|
expect_json = '''
|
|
[
|
|
{
|
|
"staticSize": 16,
|
|
"dynamicSize": 0,
|
|
"exclusiveSize": 16,
|
|
"length": 1,
|
|
"capacity": 1,
|
|
"elementStaticSize": 8
|
|
}
|
|
]
|
|
'''
|
|
expect_json_v2 = '''
|
|
[
|
|
{
|
|
"typeNames": ["std::optional<uint64_t>"],
|
|
"staticSize": 16,
|
|
"exclusiveSize": 8,
|
|
"size": 16,
|
|
"length": 1,
|
|
"capacity": 1,
|
|
"members": [
|
|
{
|
|
"typeNames": ["uint64_t"],
|
|
"staticSize": 8,
|
|
"exclusiveSize": 8
|
|
}
|
|
]
|
|
}
|
|
]
|
|
'''
|
|
[cases.vector_empty]
|
|
param_types = ["std::optional<std::vector<std::uint64_t>>&"]
|
|
setup = "return std::nullopt;"
|
|
expect_json = '''
|
|
[
|
|
{
|
|
"staticSize": 32,
|
|
"dynamicSize": 0,
|
|
"exclusiveSize": 32,
|
|
"length": 0,
|
|
"capacity": 1,
|
|
"elementStaticSize": 24
|
|
}
|
|
]
|
|
'''
|
|
expect_json_v2 = '''
|
|
[
|
|
{
|
|
"typeNames": ["std::optional<std::vector<uint64_t, std::allocator<uint64_t>>>"],
|
|
"staticSize": 32,
|
|
"exclusiveSize": 32,
|
|
"size": 32,
|
|
"length": 0,
|
|
"capacity": 1,
|
|
"members": []
|
|
}
|
|
]
|
|
'''
|
|
[cases.vector_present]
|
|
param_types = ["std::optional<std::vector<std::uint64_t>>&"]
|
|
setup = "return {{{1,2,3,4,5}}};"
|
|
expect_json = '''
|
|
[
|
|
{
|
|
"staticSize": 32,
|
|
"dynamicSize": 40,
|
|
"exclusiveSize": 8,
|
|
"length": 1,
|
|
"capacity": 1,
|
|
"elementStaticSize": 24,
|
|
"members": [
|
|
{
|
|
"staticSize": 24,
|
|
"dynamicSize": 40,
|
|
"exclusiveSize": 64,
|
|
"length": 5
|
|
}
|
|
]
|
|
}
|
|
]
|
|
'''
|
|
expect_json_v2 = '''
|
|
[
|
|
{
|
|
"typeNames": ["std::optional<std::vector<uint64_t, std::allocator<uint64_t>>>"],
|
|
"staticSize": 32,
|
|
"exclusiveSize": 8,
|
|
"size": 72,
|
|
"length": 1,
|
|
"capacity": 1,
|
|
"members": [
|
|
{
|
|
"typeNames": ["std::vector<uint64_t, std::allocator<uint64_t>>"],
|
|
"staticSize": 24,
|
|
"exclusiveSize": 24,
|
|
"size": 64,
|
|
"length": 5,
|
|
"capacity": 5
|
|
}
|
|
]
|
|
}
|
|
]
|
|
'''
|