object-introspection/test/integration/std_optional.toml

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

138 lines
2.9 KiB
TOML
Raw Permalink Normal View History

2022-12-19 14:37:51 +00:00
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,
2023-03-03 20:09:51 +00:00
"exclusiveSize": 16,
2022-12-19 14:37:51 +00:00
"length": 0,
"capacity": 1,
"elementStaticSize": 8
}
]
'''
2023-08-30 22:19:29 +01:00
expect_json_v2 = '''
[
{
"typeNames": ["std::optional<uint64_t>"],
2023-08-30 22:19:29 +01:00
"staticSize": 16,
"exclusiveSize": 16,
"size": 16,
2023-08-30 22:19:29 +01:00
"length": 0,
"capacity": 1,
"members": []
}
]
'''
2022-12-19 14:37:51 +00:00
[cases.uint64_present]
param_types = ["std::optional<std::uint64_t>&"]
setup = "return 64;"
expect_json = '''
[
{
"staticSize": 16,
"dynamicSize": 0,
2023-03-03 20:09:51 +00:00
"exclusiveSize": 16,
2022-12-19 14:37:51 +00:00
"length": 1,
"capacity": 1,
"elementStaticSize": 8
}
]
'''
2023-08-30 22:19:29 +01:00
expect_json_v2 = '''
[
{
"typeNames": ["std::optional<uint64_t>"],
2023-08-30 22:19:29 +01:00
"staticSize": 16,
"exclusiveSize": 8,
"size": 16,
2023-08-30 22:19:29 +01:00
"length": 1,
"capacity": 1,
"members": [
{
"typeNames": ["uint64_t"],
2023-08-30 22:19:29 +01:00
"staticSize": 8,
"exclusiveSize": 8
}
]
}
]
'''
2022-12-19 14:37:51 +00:00
[cases.vector_empty]
param_types = ["std::optional<std::vector<std::uint64_t>>&"]
setup = "return std::nullopt;"
expect_json = '''
[
{
"staticSize": 32,
"dynamicSize": 0,
2023-03-03 20:09:51 +00:00
"exclusiveSize": 32,
2022-12-19 14:37:51 +00:00
"length": 0,
"capacity": 1,
"elementStaticSize": 24
}
]
'''
2023-08-30 22:19:29 +01:00
expect_json_v2 = '''
[
{
"typeNames": ["std::optional<std::vector<uint64_t, std::allocator<uint64_t>>>"],
2023-08-30 22:19:29 +01:00
"staticSize": 32,
"exclusiveSize": 32,
"size": 32,
2023-08-30 22:19:29 +01:00
"length": 0,
"capacity": 1,
"members": []
}
]
'''
2022-12-19 14:37:51 +00:00
[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,
2023-03-03 20:09:51 +00:00
"exclusiveSize": 8,
2022-12-19 14:37:51 +00:00
"length": 1,
"capacity": 1,
"elementStaticSize": 24,
"members": [
{
"staticSize": 24,
"dynamicSize": 40,
2023-03-03 20:09:51 +00:00
"exclusiveSize": 64,
2022-12-19 14:37:51 +00:00
"length": 5
}
]
}
]
'''
2023-08-30 22:19:29 +01:00
expect_json_v2 = '''
[
{
"typeNames": ["std::optional<std::vector<uint64_t, std::allocator<uint64_t>>>"],
2023-08-30 22:19:29 +01:00
"staticSize": 32,
"exclusiveSize": 8,
"size": 72,
2023-08-30 22:19:29 +01:00
"length": 1,
"capacity": 1,
"members": [
{
"typeNames": ["std::vector<uint64_t, std::allocator<uint64_t>>"],
2023-08-30 22:19:29 +01:00
"staticSize": 24,
"exclusiveSize": 24,
"size": 64,
2023-08-30 22:19:29 +01:00
"length": 5,
"capacity": 5
}
]
}
]
'''