2022-12-19 14:37:51 +00:00
|
|
|
definitions = '''
|
|
|
|
|
|
|
|
template <unsigned int N>
|
|
|
|
class CustomIntHasher
|
|
|
|
{
|
|
|
|
double d[N];
|
|
|
|
public:
|
|
|
|
size_t operator() (int const& key) const
|
|
|
|
{
|
|
|
|
return std::hash<int>{}(key);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
template <unsigned int N>
|
|
|
|
class CustomEqualFnInt
|
|
|
|
{
|
|
|
|
double d[N];
|
|
|
|
public:
|
|
|
|
bool operator() (int const& t1, int const& t2) const
|
|
|
|
{
|
|
|
|
return t1 == t2;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
struct Foo {
|
|
|
|
std::unordered_set<int> m1;
|
|
|
|
std::unordered_set<int, CustomIntHasher<8>> m2;
|
|
|
|
std::unordered_set<int, std::hash<int>, CustomEqualFnInt<8>> m3;
|
|
|
|
std::unordered_set<int, CustomIntHasher<8>, CustomEqualFnInt<8>> m4;
|
|
|
|
};
|
|
|
|
'''
|
|
|
|
includes = ["unordered_set"]
|
|
|
|
|
|
|
|
[cases]
|
|
|
|
[cases.a]
|
|
|
|
param_types = ["const Foo&"]
|
|
|
|
setup = '''
|
|
|
|
Foo foo;
|
|
|
|
|
|
|
|
for (int i = 0; i < 3; i++) {
|
|
|
|
foo.m1.insert(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < 5; i++) {
|
|
|
|
foo.m2.insert(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < 7; i++) {
|
|
|
|
foo.m3.insert(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
for (int i = 0; i < 9; i++) {
|
|
|
|
foo.m4.insert(i);
|
|
|
|
}
|
|
|
|
|
|
|
|
return {foo};
|
|
|
|
'''
|
|
|
|
expect_json = '''[{
|
|
|
|
"staticSize":480,
|
|
|
|
"dynamicSize":704,
|
|
|
|
"members":[
|
|
|
|
{"name":"m1", "staticSize":56, "dynamicSize":140, "length":3, "capacity":3, "elementStaticSize":12},
|
|
|
|
{"name":"m2", "staticSize":120, "dynamicSize":164, "length":5, "capacity":5, "elementStaticSize":12},
|
|
|
|
{"name":"m3", "staticSize":120, "dynamicSize":188, "length":7, "capacity":7, "elementStaticSize":12},
|
|
|
|
{"name":"m4", "staticSize":184, "dynamicSize":212, "length":9, "capacity":9, "elementStaticSize":12}
|
|
|
|
]}]'''
|
2023-08-25 17:57:49 +01:00
|
|
|
expect_json_v2 = '''[{
|
|
|
|
"staticSize":480,
|
2024-01-03 17:30:31 +00:00
|
|
|
"exclusiveSize":0,
|
|
|
|
"size":1472,
|
2023-08-25 17:57:49 +01:00
|
|
|
"members":[
|
2024-01-03 17:30:31 +00:00
|
|
|
{"name":"m1", "staticSize":56, "exclusiveSize":220, "size":232,"length":3, "capacity":3},
|
|
|
|
{"name":"m2", "staticSize":120, "exclusiveSize":324, "size":344, "length":5, "capacity":5},
|
|
|
|
{"name":"m3", "staticSize":120, "exclusiveSize":364, "size":392, "length":7, "capacity":7},
|
|
|
|
{"name":"m4", "staticSize":184, "exclusiveSize":468, "size":504, "length":9, "capacity":9}
|
2023-08-25 17:57:49 +01:00
|
|
|
]}]'''
|