object-introspection/test/integration/std_vector.toml
Jake Hillion 5071519e45 oil v2
2023-08-23 15:59:53 +01:00

65 lines
3.2 KiB
TOML

includes = ["vector"]
[cases]
[cases.int_empty]
param_types = ["const std::vector<int>&"]
setup = "return {};"
expect_json = '[{"staticSize":24, "dynamicSize":0, "length":0, "capacity":0, "elementStaticSize":4}]'
expect_json_v2 = '[{"staticSize":24, "exclusiveSize":24, "length":0, "capacity":0, "members":[]}]'
[cases.int_some]
param_types = ["const std::vector<int>&"]
setup = "return {{1,2,3}};"
expect_json = '[{"staticSize":24, "dynamicSize":12, "length":3, "capacity":3, "elementStaticSize":4}]'
expect_json_v2 = '''[{"staticSize":24, "exclusiveSize":24, "length":3, "capacity":3, "members":[
{"staticSize":4, "exclusiveSize":4},
{"staticSize":4, "exclusiveSize":4},
{"staticSize":4, "exclusiveSize":4}
]}]'''
[cases.bool_empty]
skip = true # https://github.com/facebookexperimental/object-introspection/issues/14
param_types = ["const std::vector<bool>&"]
setup = "return {};"
expect_json = '[{"staticSize":40, "dynamicSize":0, "length":0, "capacity":0, "elementStaticSize":0.125}]'
[cases.bool_some]
skip = true # https://github.com/facebookexperimental/object-introspection/issues/14
param_types = ["const std::vector<bool>&"]
setup = "return {{true, false, true}};"
expect_json = '[{"staticSize":40,"dynamicSize":8, "exclusiveSize":40, "length":3, "capacity":64, "elementStaticSize":0.125}]'
[cases.vector_int_empty]
param_types = ["const std::vector<std::vector<int>>&"]
setup = "return {};"
expect_json = '[{"staticSize":24, "dynamicSize":0, "length":0, "capacity":0, "elementStaticSize":24}]'
expect_json_v2 = '[{"staticSize":24, "exclusiveSize":24, "length":0, "capacity":0, "members":[]}]'
[cases.vector_int_some]
param_types = ["const std::vector<std::vector<int>>&"]
setup = "return {{{1,2,3},{4},{5,6}}};"
expect_json = '''[{
"staticSize":24,
"dynamicSize":96,
"exclusiveSize":24,
"length":3,
"capacity":3,
"elementStaticSize":24,
"members":[
{"staticSize":24, "dynamicSize":12, "exclusiveSize":36, "length":3, "capacity":3, "elementStaticSize":4},
{"staticSize":24, "dynamicSize":4, "exclusiveSize":28, "length":1, "capacity":1, "elementStaticSize":4},
{"staticSize":24, "dynamicSize":8, "exclusiveSize":32, "length":2, "capacity":2, "elementStaticSize":4}
]}]'''
expect_json_v2 = '''[{"staticSize":24, "exclusiveSize":24, "length":3, "capacity": 3, "members":[
{"staticSize":24, "exclusiveSize":24, "length":3, "capacity": 3, "members":[]},
{"staticSize":24, "exclusiveSize":24, "length":1, "capacity": 1, "members":[]},
{"staticSize":24, "exclusiveSize":24, "length":2, "capacity": 2, "members":[]}
]}]'''
[cases.reserve]
param_types = ["const std::vector<int>&"]
setup = '''
std::vector<int> ret = {1,2,3};
ret.reserve(10);
return ret;
'''
expect_json = '[{"staticSize":24, "dynamicSize":40, "exclusiveSize":64, "length":3, "capacity":10, "elementStaticSize":4}]'
expect_json_v2 = '''[{"staticSize":24, "exclusiveSize":52, "length":3, "capacity":10, "members":[
{"staticSize":4, "exclusiveSize":4},
{"staticSize":4, "exclusiveSize":4},
{"staticSize":4, "exclusiveSize":4}
]}]'''