2023-09-07 18:21:59 +01:00
|
|
|
includes = ["folly/container/F14Set.h"]
|
|
|
|
definitions = '''
|
|
|
|
struct Bar {
|
|
|
|
float a, b;
|
|
|
|
};
|
|
|
|
|
|
|
|
inline bool operator==(const Bar &lhs, const Bar &rhs) noexcept {
|
|
|
|
return lhs.a == rhs.a && lhs.b == rhs.b;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct BarHasher {
|
|
|
|
inline size_t operator()(const Bar &bar) const {
|
|
|
|
return folly::hash::hash_combine(bar.a, bar.b);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Foo {
|
|
|
|
folly::F14NodeSet<int> m1;
|
|
|
|
folly::F14NodeSet<Bar, BarHasher> m2;
|
|
|
|
folly::F14NodeSet<int> m3;
|
|
|
|
folly::F14NodeSet<int> m4;
|
|
|
|
};
|
|
|
|
'''
|
|
|
|
|
|
|
|
[cases]
|
|
|
|
[cases.a]
|
|
|
|
param_types = ["const Foo&"]
|
|
|
|
setup = '''
|
|
|
|
Foo foo;
|
|
|
|
|
|
|
|
foo.m1.reserve(3);
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
foo.m1.emplace(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
foo.m2.reserve(5);
|
|
|
|
for (int i = 0; i < 5; i++) {
|
|
|
|
foo.m2.emplace(Bar{(float)i, 0.0f});
|
|
|
|
}
|
|
|
|
|
|
|
|
foo.m3.reserve(7);
|
|
|
|
for (int i = 0; i < 7; i++) {
|
|
|
|
foo.m3.emplace(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
foo.m4.reserve(9);
|
|
|
|
for (int i = 0; i < 9; i++) {
|
|
|
|
foo.m4.emplace(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
return {foo};
|
|
|
|
'''
|
|
|
|
expect_json = '''[{
|
|
|
|
"staticSize":96,
|
|
|
|
"dynamicSize":404,
|
|
|
|
"members":[
|
|
|
|
{"name":"m1", "staticSize":24, "dynamicSize":60, "length":3, "capacity":3, "elementStaticSize":4},
|
|
|
|
{
|
|
|
|
"name":"m2",
|
|
|
|
"staticSize":24,
|
|
|
|
"dynamicSize":104,
|
|
|
|
"length":5,
|
|
|
|
"capacity":5,
|
|
|
|
"elementStaticSize":8,
|
|
|
|
"members":[
|
|
|
|
{"staticSize":8, "members":[{"name":"a"}, {"name": "b"}]},
|
|
|
|
{"staticSize":8, "members":[{"name":"a"}, {"name": "b"}]},
|
|
|
|
{"staticSize":8, "members":[{"name":"a"}, {"name": "b"}]},
|
|
|
|
{"staticSize":8, "members":[{"name":"a"}, {"name": "b"}]},
|
|
|
|
{"staticSize":8, "members":[{"name":"a"}, {"name": "b"}]}
|
|
|
|
]},
|
|
|
|
{"name":"m3", "staticSize":24, "dynamicSize":108, "length":7, "capacity":7, "elementStaticSize":4},
|
|
|
|
{"name":"m4", "staticSize":24, "dynamicSize":132, "length":9, "capacity":9, "elementStaticSize":4}
|
|
|
|
]}]'''
|
|
|
|
expect_json_v2 = '''[{
|
|
|
|
"staticSize":96,
|
|
|
|
"exclusiveSize": 0,
|
2024-01-03 17:30:31 +00:00
|
|
|
"size": 500,
|
2023-09-07 18:21:59 +01:00
|
|
|
"members":[
|
2024-01-03 17:30:31 +00:00
|
|
|
{"name":"m1", "staticSize":24, "exclusiveSize": 72, "size": 84, "length": 3, "capacity": 3},
|
|
|
|
{"name":"m2", "staticSize":24, "exclusiveSize": 88, "size": 128, "length": 5, "capacity": 5},
|
|
|
|
{"name":"m3", "staticSize":24, "exclusiveSize": 104, "size": 132, "length": 7, "capacity": 7},
|
|
|
|
{"name":"m4", "staticSize":24, "exclusiveSize": 120, "size": 156, "length": 9, "capacity": 9}
|
2023-09-07 18:21:59 +01:00
|
|
|
]}]'''
|