object-introspection/test/integration/std_unordered_multimap_custom_operator.toml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

77 lines
2.1 KiB
TOML
Raw Normal View History

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_multimap<int, int> m1;
std::unordered_multimap<int, int, CustomIntHasher<8>> m2;
std::unordered_multimap<int, int, std::hash<int>, CustomEqualFnInt<8>> m3;
std::unordered_multimap<int, int, CustomIntHasher<8>, CustomEqualFnInt<8>> m4;
};
'''
includes = ["unordered_map"]
[cases]
[cases.a]
param_types = ["const Foo&"]
setup = '''
Foo foo;
for (int i = 0; i < 3; i++) {
foo.m1.emplace(i, i * 10);
}
for (int i = 0; i < 5; i++) {
foo.m2.emplace(i, i * 10);
}
for (int i = 0; i < 7; i++) {
foo.m3.emplace(i, i * 10);
}
for (int i = 0; i < 9; i++) {
foo.m4.emplace(i, i * 10);
}
return {foo};
'''
expect_json = '''[{
"staticSize":480,
"dynamicSize":1184,
"members":[
{"name":"m1", "staticSize":56, "dynamicSize":200, "length":3, "capacity":3, "elementStaticSize":32},
{"name":"m2", "staticSize":120, "dynamicSize":264, "length":5, "capacity":5, "elementStaticSize":32},
{"name":"m3", "staticSize":120, "dynamicSize":328, "length":7, "capacity":7, "elementStaticSize":32},
{"name":"m4", "staticSize":184, "dynamicSize":392, "length":9, "capacity":9, "elementStaticSize":32}
]}]'''
expect_json_v2 = '''[{
"staticSize":480,
"exclusiveSize":0,
"size":1952,
"members":[
{"name":"m1", "staticSize":56, "exclusiveSize":220, "size":292, "length":3, "capacity":3},
{"name":"m2", "staticSize":120, "exclusiveSize":324, "size":444, "length":5, "capacity":5},
{"name":"m3", "staticSize":120, "exclusiveSize":364, "size":532, "length":7, "capacity":7},
{"name":"m4", "staticSize":184, "exclusiveSize":468, "size":684, "length":9, "capacity":9}
]}]'''