2023-09-27 23:19:51 +01:00
|
|
|
includes = ["folly/FBString.h", "utility"]
|
2023-04-05 21:56:55 +01:00
|
|
|
[cases]
|
|
|
|
[cases.empty]
|
|
|
|
param_types = ["folly::fbstring&"]
|
|
|
|
setup = "return {};"
|
|
|
|
expect_json = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"typeName": "fbstring",
|
|
|
|
"isTypedef": true,
|
|
|
|
"staticSize": 24,
|
|
|
|
"dynamicSize": 0,
|
|
|
|
"exclusiveSize": 0,
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"staticSize": 24,
|
|
|
|
"dynamicSize": 0,
|
|
|
|
"exclusiveSize": 24,
|
|
|
|
"length": 0,
|
2023-09-27 23:19:51 +01:00
|
|
|
"capacity":23,
|
2023-04-05 21:56:55 +01:00
|
|
|
"elementStaticSize": 1
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2023-09-27 23:19:51 +01:00
|
|
|
expect_json_v2 = '''[{
|
|
|
|
"typeNames": ["folly::basic_fbstring<int8_t, std::char_traits<int8_t>, std::allocator<int8_t>, folly::fbstring_core<int8_t>>"],
|
|
|
|
"staticSize": 24,
|
|
|
|
"exclusiveSize": 24,
|
2024-01-03 17:30:31 +00:00
|
|
|
"size": 24,
|
2023-09-27 23:19:51 +01:00
|
|
|
"length": 0,
|
|
|
|
"capacity": 23
|
|
|
|
}]'''
|
2023-04-05 21:56:55 +01:00
|
|
|
|
|
|
|
[cases.inline]
|
|
|
|
param_types = ["folly::fbstring&"]
|
|
|
|
setup = 'return {"012345"};'
|
|
|
|
expect_json = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"typeName": "fbstring",
|
|
|
|
"isTypedef": true,
|
|
|
|
"staticSize": 24,
|
|
|
|
"dynamicSize": 0,
|
|
|
|
"exclusiveSize": 0,
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"staticSize": 24,
|
|
|
|
"dynamicSize": 0,
|
|
|
|
"exclusiveSize": 24,
|
|
|
|
"length": 6,
|
|
|
|
"capacity": 23,
|
|
|
|
"elementStaticSize": 1
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2023-09-27 23:19:51 +01:00
|
|
|
expect_json_v2 = '''[{
|
|
|
|
"typeNames": ["folly::basic_fbstring<int8_t, std::char_traits<int8_t>, std::allocator<int8_t>, folly::fbstring_core<int8_t>>"],
|
|
|
|
"staticSize": 24,
|
|
|
|
"exclusiveSize": 24,
|
2024-01-03 17:30:31 +00:00
|
|
|
"size": 24,
|
2023-09-27 23:19:51 +01:00
|
|
|
"length": 6,
|
|
|
|
"capacity": 23
|
|
|
|
}]'''
|
2023-04-05 21:56:55 +01:00
|
|
|
|
|
|
|
[cases.heap_allocated]
|
|
|
|
param_types = ["folly::fbstring&"]
|
|
|
|
setup = 'return {"abcdefghijklmnopqrstuvwxzy"};'
|
|
|
|
expect_json = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"typeName": "fbstring",
|
|
|
|
"isTypedef": true,
|
|
|
|
"staticSize": 24,
|
|
|
|
"dynamicSize": 26,
|
|
|
|
"exclusiveSize": 0,
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"staticSize": 24,
|
|
|
|
"dynamicSize": 26,
|
|
|
|
"exclusiveSize": 50,
|
|
|
|
"length": 26,
|
|
|
|
"capacity": 26,
|
|
|
|
"elementStaticSize": 1
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2023-09-27 23:19:51 +01:00
|
|
|
expect_json_v2 = '''[{
|
|
|
|
"typeNames": ["folly::basic_fbstring<int8_t, std::char_traits<int8_t>, std::allocator<int8_t>, folly::fbstring_core<int8_t>>"],
|
|
|
|
"staticSize": 24,
|
|
|
|
"exclusiveSize": 50,
|
2024-01-03 17:30:31 +00:00
|
|
|
"size": 50,
|
2023-09-27 23:19:51 +01:00
|
|
|
"length": 26,
|
|
|
|
"capacity": 26
|
|
|
|
}]'''
|
2023-04-05 21:56:55 +01:00
|
|
|
|
2023-09-27 23:19:51 +01:00
|
|
|
[cases.string_pooled_unique]
|
2023-04-05 21:56:55 +01:00
|
|
|
param_types = ["folly::fbstring&"]
|
|
|
|
setup = "return folly::fbstring(1024, 'c');"
|
|
|
|
expect_json = '''
|
|
|
|
[
|
|
|
|
{
|
|
|
|
"typeName": "fbstring",
|
|
|
|
"isTypedef": true,
|
|
|
|
"staticSize": 24,
|
|
|
|
"dynamicSize": 1024,
|
|
|
|
"exclusiveSize": 0,
|
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"staticSize": 24,
|
|
|
|
"dynamicSize": 1024,
|
|
|
|
"exclusiveSize": 1048,
|
|
|
|
"length": 1024,
|
|
|
|
"capacity": 1024,
|
|
|
|
"elementStaticSize": 1
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
'''
|
2023-09-27 23:19:51 +01:00
|
|
|
expect_json_v2 = '''[{
|
|
|
|
"typeNames": ["folly::basic_fbstring<int8_t, std::char_traits<int8_t>, std::allocator<int8_t>, folly::fbstring_core<int8_t>>"],
|
|
|
|
"staticSize": 24,
|
|
|
|
"exclusiveSize": 1056,
|
2024-01-03 17:30:31 +00:00
|
|
|
"size": 1056,
|
2023-09-27 23:19:51 +01:00
|
|
|
"length": 1024,
|
|
|
|
"capacity": 1024
|
|
|
|
}]'''
|
|
|
|
|
|
|
|
[cases.string_pooled_shared]
|
|
|
|
param_types = ["std::pair<folly::fbstring, folly::fbstring>&"]
|
|
|
|
setup = """
|
|
|
|
folly::fbstring s(1024, 'c');
|
|
|
|
return {{s, s}};
|
|
|
|
"""
|
|
|
|
expect_json_v2 = '''[{
|
|
|
|
"staticSize": 48,
|
|
|
|
"exclusiveSize": 0,
|
2024-01-03 17:30:31 +00:00
|
|
|
"size": 1080,
|
2023-09-27 23:19:51 +01:00
|
|
|
"members": [
|
|
|
|
{
|
|
|
|
"typeNames": ["folly::basic_fbstring<int8_t, std::char_traits<int8_t>, std::allocator<int8_t>, folly::fbstring_core<int8_t>>"],
|
|
|
|
"staticSize": 24,
|
|
|
|
"exclusiveSize": 1056,
|
2024-01-03 17:30:31 +00:00
|
|
|
"size": 1056,
|
2023-09-27 23:19:51 +01:00
|
|
|
"length": 1024,
|
|
|
|
"capacity": 1024
|
|
|
|
}, {
|
|
|
|
"typeNames": ["folly::basic_fbstring<int8_t, std::char_traits<int8_t>, std::allocator<int8_t>, folly::fbstring_core<int8_t>>"],
|
|
|
|
"staticSize": 24,
|
|
|
|
"exclusiveSize": 24,
|
2024-01-03 17:30:31 +00:00
|
|
|
"size": 24,
|
2023-09-27 23:19:51 +01:00
|
|
|
"length": 1024,
|
|
|
|
"capacity": 1024
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}]'''
|