2022-12-19 14:37:51 +00:00
|
|
|
includes = ["memory", "cstdint"]
|
|
|
|
definitions = '''
|
|
|
|
void void_int_deleter(void *void_ptr) {
|
|
|
|
auto *int_ptr = static_cast<int*>(void_ptr);
|
|
|
|
delete int_ptr;
|
|
|
|
}
|
|
|
|
'''
|
|
|
|
[cases]
|
|
|
|
[cases.unique_ptr_uint64_empty]
|
|
|
|
param_types = ["std::unique_ptr<std::uint64_t>&"]
|
|
|
|
setup = "return {nullptr};"
|
|
|
|
expect_json = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 8,
|
|
|
|
"dynamicSize": 0,
|
2023-03-03 20:09:51 +00:00
|
|
|
"exclusiveSize": 8,
|
2022-12-19 14:37:51 +00:00
|
|
|
"length": 0,
|
|
|
|
"capacity": 1,
|
|
|
|
"elementStaticSize": 8
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2023-08-30 20:33:49 +01:00
|
|
|
expect_json_v2 = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 8,
|
|
|
|
"exclusiveSize": 8,
|
2024-01-03 17:30:31 +00:00
|
|
|
"size": 8,
|
2023-08-30 20:33:49 +01:00
|
|
|
"length": 0,
|
|
|
|
"capacity": 1
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2024-01-31 17:13:43 +00:00
|
|
|
[cases.unique_ptr_const_uint64_empty]
|
|
|
|
param_types = ["std::unique_ptr<const std::uint64_t>&"]
|
|
|
|
setup = "return {nullptr};"
|
|
|
|
expect_json = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 8,
|
|
|
|
"dynamicSize": 0,
|
|
|
|
"exclusiveSize": 8,
|
|
|
|
"length": 0,
|
|
|
|
"capacity": 1,
|
|
|
|
"elementStaticSize": 8
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
|
|
|
expect_json_v2 = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 8,
|
|
|
|
"exclusiveSize": 8,
|
|
|
|
"length": 0,
|
|
|
|
"capacity": 1
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2022-12-19 14:37:51 +00:00
|
|
|
[cases.unique_ptr_uint64_present]
|
|
|
|
param_types = ["std::unique_ptr<std::uint64_t>&"]
|
|
|
|
setup = "return {std::make_unique<std::uint64_t>(64)};"
|
|
|
|
expect_json = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 8,
|
|
|
|
"dynamicSize": 8,
|
|
|
|
"length": 1,
|
|
|
|
"capacity": 1,
|
|
|
|
"elementStaticSize": 8
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2023-08-30 20:33:49 +01:00
|
|
|
expect_json_v2 = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 8,
|
|
|
|
"exclusiveSize": 8,
|
2024-01-03 17:30:31 +00:00
|
|
|
"size": 16,
|
2023-08-30 20:33:49 +01:00
|
|
|
"length": 1,
|
|
|
|
"capacity": 1
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2022-12-19 14:37:51 +00:00
|
|
|
[cases.unique_ptr_vector_empty]
|
|
|
|
param_types = ["std::unique_ptr<std::vector<std::uint64_t>>&"]
|
|
|
|
setup = "return {nullptr};"
|
|
|
|
expect_json = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 8,
|
|
|
|
"dynamicSize": 0,
|
|
|
|
"length": 0,
|
|
|
|
"capacity": 1,
|
|
|
|
"elementStaticSize": 24
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2023-08-30 20:33:49 +01:00
|
|
|
expect_json_v2 = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 8,
|
|
|
|
"exclusiveSize": 8,
|
2024-01-03 17:30:31 +00:00
|
|
|
"size": 8,
|
2023-08-30 20:33:49 +01:00
|
|
|
"length": 0,
|
|
|
|
"capacity": 1
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2024-01-31 17:13:43 +00:00
|
|
|
[cases.unique_ptr_const_vector_empty]
|
|
|
|
param_types = ["std::unique_ptr<const std::vector<std::uint64_t>>&"]
|
|
|
|
setup = "return {nullptr};"
|
|
|
|
expect_json = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 8,
|
|
|
|
"dynamicSize": 0,
|
|
|
|
"length": 0,
|
|
|
|
"capacity": 1,
|
|
|
|
"elementStaticSize": 24
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
|
|
|
expect_json_v2 = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 8,
|
|
|
|
"exclusiveSize": 8,
|
|
|
|
"length": 0,
|
|
|
|
"capacity": 1
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2022-12-19 14:37:51 +00:00
|
|
|
[cases.unique_ptr_vector_present]
|
|
|
|
param_types = ["std::unique_ptr<std::vector<std::uint64_t>>&"]
|
|
|
|
setup = "return {std::make_unique<std::vector<std::uint64_t>>(std::initializer_list<std::uint64_t>({1,2,3,4,5}))};"
|
|
|
|
expect_json = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 8,
|
|
|
|
"dynamicSize": 64,
|
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,
|
2023-03-03 20:09:51 +00:00
|
|
|
"dynamicSize": 40,
|
|
|
|
"exclusiveSize": 64
|
2022-12-19 14:37:51 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2023-08-30 20:33:49 +01:00
|
|
|
expect_json_v2 = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 8,
|
|
|
|
"exclusiveSize": 8,
|
2024-01-03 17:30:31 +00:00
|
|
|
"size": 72,
|
2023-08-30 20:33:49 +01:00
|
|
|
"length": 1,
|
|
|
|
"capacity": 1,
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"staticSize": 24,
|
|
|
|
"exclusiveSize": 24,
|
|
|
|
"length": 5,
|
|
|
|
"capacity": 5
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2022-12-19 14:37:51 +00:00
|
|
|
[cases.unique_ptr_void_empty]
|
|
|
|
param_types = ["std::unique_ptr<void, decltype(&void_int_deleter)>&"]
|
|
|
|
setup = "return {std::unique_ptr<void, decltype(&void_int_deleter)>(nullptr, &void_int_deleter)};"
|
|
|
|
expect_json = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 16,
|
|
|
|
"dynamicSize": 0
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2023-08-30 20:33:49 +01:00
|
|
|
expect_json_v2 = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 16,
|
2024-01-03 17:30:31 +00:00
|
|
|
"exclusiveSize": 16,
|
|
|
|
"size": 16
|
2023-08-30 20:33:49 +01:00
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2022-12-19 14:37:51 +00:00
|
|
|
[cases.unique_ptr_void_present]
|
|
|
|
param_types = ["std::unique_ptr<void, decltype(&void_int_deleter)>&"]
|
|
|
|
setup = "return {std::unique_ptr<void, decltype(&void_int_deleter)>(new int, &void_int_deleter)};"
|
|
|
|
expect_json = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 16,
|
2022-12-28 12:21:49 +00:00
|
|
|
"dynamicSize": 0
|
2022-12-19 14:37:51 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2023-08-30 20:33:49 +01:00
|
|
|
expect_json_v2 = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 16,
|
2024-01-03 17:30:31 +00:00
|
|
|
"exclusiveSize": 16,
|
|
|
|
"size": 16
|
2023-08-30 20:33:49 +01:00
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2022-12-19 14:37:51 +00:00
|
|
|
[cases.shared_ptr_uint64_empty]
|
|
|
|
param_types = ["std::shared_ptr<std::uint64_t>&"]
|
|
|
|
setup = "return {nullptr};"
|
|
|
|
expect_json = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 16,
|
|
|
|
"dynamicSize": 0,
|
|
|
|
"length": 0,
|
|
|
|
"capacity": 1,
|
|
|
|
"elementStaticSize": 8
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2023-08-31 16:25:53 +01:00
|
|
|
expect_json_v2 = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 16,
|
|
|
|
"exclusiveSize": 16,
|
2024-01-03 17:30:31 +00:00
|
|
|
"size": 16,
|
2023-08-31 16:25:53 +01:00
|
|
|
"length": 0,
|
|
|
|
"capacity": 1
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2024-01-31 17:13:43 +00:00
|
|
|
[cases.shared_ptr_const_uint64_empty]
|
|
|
|
param_types = ["std::shared_ptr<const std::uint64_t>&"]
|
|
|
|
setup = "return {nullptr};"
|
|
|
|
expect_json = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 16,
|
|
|
|
"dynamicSize": 0,
|
|
|
|
"length": 0,
|
|
|
|
"capacity": 1,
|
|
|
|
"elementStaticSize": 8
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
|
|
|
expect_json_v2 = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 16,
|
|
|
|
"exclusiveSize": 16,
|
|
|
|
"length": 0,
|
|
|
|
"capacity": 1
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2022-12-19 14:37:51 +00:00
|
|
|
[cases.shared_ptr_uint64_present]
|
|
|
|
param_types = ["std::shared_ptr<std::uint64_t>&"]
|
|
|
|
setup = "return std::make_shared<std::uint64_t>(64);"
|
|
|
|
expect_json = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 16,
|
|
|
|
"dynamicSize": 8,
|
|
|
|
"length": 1,
|
|
|
|
"capacity": 1,
|
|
|
|
"elementStaticSize": 8
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2023-08-31 16:25:53 +01:00
|
|
|
expect_json_v2 = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 16,
|
|
|
|
"exclusiveSize": 16,
|
2024-01-03 17:30:31 +00:00
|
|
|
"size": 24,
|
2023-08-31 16:25:53 +01:00
|
|
|
"length": 1,
|
|
|
|
"capacity": 1,
|
|
|
|
"members": [
|
|
|
|
{ "staticSize": 8, "exclusiveSize": 8 }
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2022-12-19 14:37:51 +00:00
|
|
|
[cases.shared_ptr_vector_empty]
|
|
|
|
param_types = ["std::shared_ptr<std::vector<std::uint64_t>>&"]
|
|
|
|
setup = "return {nullptr};"
|
|
|
|
expect_json = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 16,
|
|
|
|
"dynamicSize": 0,
|
|
|
|
"length": 0,
|
|
|
|
"capacity": 1,
|
|
|
|
"elementStaticSize": 24
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2023-08-31 16:25:53 +01:00
|
|
|
expect_json_v2 = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 16,
|
|
|
|
"exclusiveSize": 16,
|
2024-01-03 17:30:31 +00:00
|
|
|
"size": 16,
|
2023-08-31 16:25:53 +01:00
|
|
|
"length": 0,
|
|
|
|
"capacity": 1
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2024-01-31 17:13:43 +00:00
|
|
|
[cases.shared_ptr_const_vector_empty]
|
|
|
|
param_types = ["std::shared_ptr<const std::vector<std::uint64_t>>&"]
|
|
|
|
setup = "return {nullptr};"
|
|
|
|
expect_json = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 16,
|
|
|
|
"dynamicSize": 0,
|
|
|
|
"length": 0,
|
|
|
|
"capacity": 1,
|
|
|
|
"elementStaticSize": 24
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
|
|
|
expect_json_v2 = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 16,
|
|
|
|
"exclusiveSize": 16,
|
|
|
|
"length": 0,
|
|
|
|
"capacity": 1
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2022-12-19 14:37:51 +00:00
|
|
|
[cases.shared_ptr_vector_present]
|
|
|
|
param_types = ["std::shared_ptr<std::vector<std::uint64_t>>&"]
|
|
|
|
setup = "return std::make_shared<std::vector<std::uint64_t>>(std::initializer_list<std::uint64_t>({1,2,3,4,5}));"
|
|
|
|
expect_json = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 16,
|
|
|
|
"dynamicSize": 64,
|
|
|
|
"length": 1,
|
|
|
|
"capacity": 1,
|
|
|
|
"elementStaticSize": 24,
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"staticSize": 24,
|
|
|
|
"dynamicSize": 40
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2023-08-31 16:25:53 +01:00
|
|
|
expect_json_v2 = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 16,
|
|
|
|
"exclusiveSize": 16,
|
2024-01-03 17:30:31 +00:00
|
|
|
"size": 80,
|
2023-08-31 16:25:53 +01:00
|
|
|
"length": 1,
|
|
|
|
"capacity": 1,
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"staticSize": 24,
|
|
|
|
"exclusiveSize": 24,
|
2024-01-03 17:30:31 +00:00
|
|
|
"size": 64,
|
2023-08-31 16:25:53 +01:00
|
|
|
"length": 5,
|
|
|
|
"capacity": 5
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2022-12-19 14:37:51 +00:00
|
|
|
[cases.shared_ptr_void_empty]
|
|
|
|
param_types = ["std::shared_ptr<void>&"]
|
|
|
|
setup = "return {nullptr};"
|
|
|
|
expect_json = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 16,
|
2023-03-03 20:09:51 +00:00
|
|
|
"dynamicSize": 0,
|
2024-01-03 17:30:31 +00:00
|
|
|
"exclusiveSize": 16,
|
|
|
|
"size": 16
|
2022-12-19 14:37:51 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
|
|
|
[cases.shared_ptr_void_present]
|
|
|
|
param_types = ["std::shared_ptr<void>&"]
|
|
|
|
setup = "return {std::shared_ptr<void>(new int)};"
|
|
|
|
expect_json = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 16,
|
2023-03-03 20:09:51 +00:00
|
|
|
"dynamicSize": 0,
|
2024-01-03 17:30:31 +00:00
|
|
|
"exclusiveSize": 16,
|
|
|
|
"size": 16
|
2022-12-19 14:37:51 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2023-03-24 21:32:52 +00:00
|
|
|
[cases.weak_ptr_int64_empty]
|
|
|
|
param_types = ["std::weak_ptr<std::uint64_t>&"]
|
|
|
|
setup = "return std::weak_ptr<std::uint64_t>();"
|
|
|
|
expect_json = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 16,
|
|
|
|
"exclusiveSize": 16,
|
|
|
|
"dynamicSize": 0,
|
|
|
|
"NOT": "members"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2024-01-03 17:30:31 +00:00
|
|
|
expect_json_v2 = '''[{ "staticSize": 16, "exclusiveSize": 16, "size": 16, "members":[]}]'''
|
2023-03-24 21:32:52 +00:00
|
|
|
[cases.weak_ptr_int64_void_empty]
|
|
|
|
param_types = ["std::weak_ptr<void>&"]
|
|
|
|
setup = "return std::weak_ptr<void>();"
|
|
|
|
expect_json = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 16,
|
|
|
|
"exclusiveSize": 16,
|
|
|
|
"dynamicSize": 0,
|
|
|
|
"NOT": "members"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2024-01-03 17:30:31 +00:00
|
|
|
expect_json_v2 = '''[{ "staticSize": 16, "exclusiveSize": 16, "size": 16, "members":[]}]'''
|
2023-03-24 21:32:52 +00:00
|
|
|
[cases.weak_ptr_int64_present]
|
|
|
|
param_types = ["std::weak_ptr<std::uint64_t>&"]
|
|
|
|
setup = '''
|
|
|
|
static std::shared_ptr<std::uint64_t> shd = std::make_shared<std::uint64_t>(0xDEADBEEF);
|
|
|
|
std::weak_ptr<std::uint64_t> weak = shd;
|
|
|
|
return weak;
|
|
|
|
'''
|
|
|
|
expect_json = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 16,
|
|
|
|
"exclusiveSize": 16,
|
|
|
|
"dynamicSize": 0,
|
|
|
|
"NOT": "members"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2024-01-03 17:30:31 +00:00
|
|
|
expect_json_v2 = '''[{ "staticSize": 16, "exclusiveSize": 16, "size": 16, "members":[]}]'''
|
2023-03-24 21:32:52 +00:00
|
|
|
[cases.weak_ptr_int64_expired]
|
|
|
|
param_types = ["std::weak_ptr<std::uint64_t>&"]
|
|
|
|
setup = '''
|
|
|
|
std::shared_ptr<std::uint64_t> shd = std::make_shared<std::uint64_t>(0xDEADBEEF);
|
|
|
|
std::weak_ptr<std::uint64_t> weak = shd;
|
|
|
|
return weak;
|
|
|
|
'''
|
|
|
|
expect_json = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 16,
|
|
|
|
"exclusiveSize": 16,
|
|
|
|
"dynamicSize": 0,
|
|
|
|
"NOT": "members"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2024-01-03 17:30:31 +00:00
|
|
|
expect_json_v2 = '''[{ "staticSize": 16, "exclusiveSize": 16, "size": 16, "members":[]}]'''
|
2023-03-24 21:32:52 +00:00
|
|
|
[cases.weak_ptr_int64_present_chase]
|
|
|
|
param_types = ["std::weak_ptr<std::uint64_t>&"]
|
2024-01-16 11:15:05 +00:00
|
|
|
features = ["chase-raw-pointers"]
|
2023-03-24 21:32:52 +00:00
|
|
|
setup = '''
|
|
|
|
static std::shared_ptr<std::uint64_t> shd = std::make_shared<std::uint64_t>(0xDEADBEEF);
|
|
|
|
std::weak_ptr<std::uint64_t> weak = shd;
|
|
|
|
return weak;
|
|
|
|
'''
|
|
|
|
expect_json = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 16,
|
|
|
|
"exclusiveSize": 16,
|
|
|
|
"dynamicSize": 0,
|
|
|
|
"NOT": "members"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2024-01-03 17:30:31 +00:00
|
|
|
expect_json_v2 = '''[{ "staticSize": 16, "exclusiveSize": 16, "size": 16, "members":[]}]'''
|
2023-03-24 21:32:52 +00:00
|
|
|
[cases.weak_ptr_int64_expired_chase]
|
|
|
|
param_types = ["std::weak_ptr<std::uint64_t>&"]
|
2024-01-16 11:15:05 +00:00
|
|
|
features = ["chase-raw-pointers"]
|
2023-03-24 21:32:52 +00:00
|
|
|
setup = '''
|
|
|
|
return std::make_shared<std::uint64_t>(0xDEADBEEF);
|
|
|
|
'''
|
|
|
|
expect_json = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"staticSize": 16,
|
|
|
|
"exclusiveSize": 16,
|
|
|
|
"dynamicSize": 0,
|
|
|
|
"NOT": "members"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2024-01-03 17:30:31 +00:00
|
|
|
expect_json_v2 = '''[{ "staticSize": 16, "exclusiveSize": 16, "size": 16, "members":[]}]'''
|