2023-01-20 14:05:36 +00:00
|
|
|
includes = ["vector"]
|
|
|
|
definitions = '''
|
|
|
|
class A {
|
|
|
|
public:
|
2023-02-02 23:19:48 +00:00
|
|
|
virtual ~A() = default;
|
2023-01-20 14:05:36 +00:00
|
|
|
virtual void myfunc() {}
|
|
|
|
int int_a;
|
|
|
|
};
|
|
|
|
|
|
|
|
class B : public A {
|
|
|
|
public:
|
2023-02-02 23:19:48 +00:00
|
|
|
virtual ~B() = default;
|
2023-01-20 14:05:36 +00:00
|
|
|
virtual void myfunc() override {}
|
|
|
|
std::vector<int> vec_b;
|
|
|
|
};
|
|
|
|
|
|
|
|
class C : public B {
|
|
|
|
public:
|
2023-02-02 23:19:48 +00:00
|
|
|
virtual ~C() = default;
|
2023-01-20 14:05:36 +00:00
|
|
|
virtual void myfunc() override {}
|
|
|
|
int int_c;
|
|
|
|
};
|
|
|
|
'''
|
|
|
|
[cases]
|
|
|
|
[cases.a_as_a]
|
2023-01-25 14:37:16 +00:00
|
|
|
oil_skip = "Polymorphic inheritance disabled in OIL"
|
2024-01-16 11:15:05 +00:00
|
|
|
features = ["polymorphic-inheritance"]
|
2023-01-20 14:05:36 +00:00
|
|
|
param_types = ["const A&"]
|
|
|
|
arg_types = ["A"]
|
|
|
|
setup = "return {};"
|
|
|
|
expect_json = '''[{
|
2024-01-10 18:08:44 +00:00
|
|
|
"typeName":"ns_inheritance_polymorphic::A",
|
2023-01-20 14:05:36 +00:00
|
|
|
"staticSize":16,
|
|
|
|
"dynamicSize":0,
|
|
|
|
"members":[
|
|
|
|
{"staticSize":8, "dynamicSize":0},
|
|
|
|
{"name":"int_a", "staticSize":4, "dynamicSize":0}
|
|
|
|
]}]'''
|
|
|
|
|
|
|
|
[cases.b_as_a]
|
2023-01-25 14:37:16 +00:00
|
|
|
oil_skip = "Polymorphic inheritance disabled in OIL"
|
2024-01-16 11:15:05 +00:00
|
|
|
features = ["polymorphic-inheritance"]
|
2023-01-20 14:05:36 +00:00
|
|
|
param_types = ["const A&"]
|
|
|
|
arg_types = ["B"]
|
|
|
|
setup = '''
|
|
|
|
B b;
|
|
|
|
b.vec_b = {1,2,3};
|
|
|
|
return b;
|
|
|
|
'''
|
|
|
|
expect_json = '''[{
|
2024-01-10 18:08:44 +00:00
|
|
|
"typeName":"ns_inheritance_polymorphic::B",
|
2023-01-25 14:37:16 +00:00
|
|
|
"staticSize":40,
|
|
|
|
"dynamicSize":12,
|
2023-01-20 14:05:36 +00:00
|
|
|
"members":[
|
|
|
|
{"staticSize":8, "dynamicSize":0},
|
2023-01-25 14:37:16 +00:00
|
|
|
{"name":"int_a", "staticSize":4, "dynamicSize":0},
|
|
|
|
{"name":"vec_b", "staticSize":24, "dynamicSize":12, "length":3, "capacity":3, "elementStaticSize":4}
|
2023-01-20 14:05:36 +00:00
|
|
|
]}]'''
|
|
|
|
[cases.b_as_b]
|
2023-01-25 14:37:16 +00:00
|
|
|
oil_skip = "Polymorphic inheritance disabled in OIL"
|
2024-01-16 11:15:05 +00:00
|
|
|
features = ["polymorphic-inheritance"]
|
2023-01-20 14:05:36 +00:00
|
|
|
param_types = ["const B&"]
|
|
|
|
arg_types = ["B"]
|
|
|
|
setup = '''
|
|
|
|
B b;
|
|
|
|
b.vec_b = {1,2,3};
|
|
|
|
return b;
|
|
|
|
'''
|
|
|
|
expect_json = '''[{
|
2024-01-10 18:08:44 +00:00
|
|
|
"typeName":"ns_inheritance_polymorphic::B",
|
2023-01-20 14:05:36 +00:00
|
|
|
"staticSize":40,
|
|
|
|
"dynamicSize":12,
|
|
|
|
"members":[
|
|
|
|
{"staticSize":8, "dynamicSize":0},
|
|
|
|
{"name":"int_a", "staticSize":4, "dynamicSize":0},
|
|
|
|
{"name":"vec_b", "staticSize":24, "dynamicSize":12, "length":3, "capacity":3, "elementStaticSize":4}
|
|
|
|
]}]'''
|
|
|
|
|
|
|
|
[cases.c_as_a]
|
2023-01-25 14:37:16 +00:00
|
|
|
oil_skip = "Polymorphic inheritance disabled in OIL"
|
2024-01-16 11:15:05 +00:00
|
|
|
features = ["polymorphic-inheritance"]
|
2023-01-20 14:05:36 +00:00
|
|
|
param_types = ["const A&"]
|
|
|
|
arg_types = ["C"]
|
|
|
|
setup = '''
|
|
|
|
C c;
|
|
|
|
c.vec_b = {1,2,3};
|
|
|
|
return c;
|
|
|
|
'''
|
|
|
|
expect_json = '''[{
|
2024-01-10 18:08:44 +00:00
|
|
|
"typeName":"ns_inheritance_polymorphic::C",
|
2023-01-25 14:37:16 +00:00
|
|
|
"staticSize":48,
|
|
|
|
"dynamicSize":12,
|
2023-01-20 14:05:36 +00:00
|
|
|
"members":[
|
|
|
|
{"staticSize":8, "dynamicSize":0},
|
2023-01-25 14:37:16 +00:00
|
|
|
{"name":"int_a", "staticSize":4, "dynamicSize":0},
|
|
|
|
{"name":"vec_b", "staticSize":24, "dynamicSize":12, "length":3, "capacity":3, "elementStaticSize":4},
|
|
|
|
{"name":"int_c", "staticSize":4, "dynamicSize":0}
|
2023-01-20 14:05:36 +00:00
|
|
|
]}]'''
|
|
|
|
[cases.c_as_b]
|
2023-01-25 14:37:16 +00:00
|
|
|
oil_skip = "Polymorphic inheritance disabled in OIL"
|
2024-01-16 11:15:05 +00:00
|
|
|
features = ["polymorphic-inheritance"]
|
2023-01-20 14:05:36 +00:00
|
|
|
param_types = ["const B&"]
|
|
|
|
arg_types = ["C"]
|
|
|
|
setup = '''
|
|
|
|
C c;
|
|
|
|
c.vec_b = {1,2,3};
|
|
|
|
return c;
|
|
|
|
'''
|
|
|
|
expect_json = '''[{
|
2024-01-10 18:08:44 +00:00
|
|
|
"typeName":"ns_inheritance_polymorphic::C",
|
2023-01-25 14:37:16 +00:00
|
|
|
"staticSize":48,
|
2023-01-20 14:05:36 +00:00
|
|
|
"dynamicSize":12,
|
|
|
|
"members":[
|
|
|
|
{"staticSize":8, "dynamicSize":0},
|
|
|
|
{"name":"int_a", "staticSize":4, "dynamicSize":0},
|
2023-01-25 14:37:16 +00:00
|
|
|
{"name":"vec_b", "staticSize":24, "dynamicSize":12, "length":3, "capacity":3, "elementStaticSize":4},
|
|
|
|
{"name":"int_c", "staticSize":4, "dynamicSize":0}
|
2023-01-20 14:05:36 +00:00
|
|
|
]}]'''
|
|
|
|
[cases.c_as_c]
|
2023-04-17 19:13:59 +01:00
|
|
|
oil_skip = "Polymorphic inheritance disabled in OIL"
|
2024-01-16 11:15:05 +00:00
|
|
|
features = ["polymorphic-inheritance"]
|
2023-06-22 13:24:39 +01:00
|
|
|
param_types = ["const C&"]
|
2023-04-17 19:13:59 +01:00
|
|
|
arg_types = ["C"]
|
|
|
|
setup = '''
|
|
|
|
C c;
|
|
|
|
c.vec_b = {1,2,3};
|
|
|
|
return c;
|
|
|
|
'''
|
|
|
|
expect_json = '''[{
|
2024-01-10 18:08:44 +00:00
|
|
|
"typeName":"ns_inheritance_polymorphic::C",
|
2023-04-17 19:13:59 +01:00
|
|
|
"staticSize":48,
|
|
|
|
"dynamicSize":12,
|
|
|
|
"members":[
|
|
|
|
{"staticSize":8, "dynamicSize":0},
|
|
|
|
{"name":"int_a", "staticSize":4, "dynamicSize":0},
|
|
|
|
{"name":"vec_b", "staticSize":24, "dynamicSize":12, "length":3, "capacity":3, "elementStaticSize":4},
|
|
|
|
{"name":"int_c", "staticSize":4, "dynamicSize":0}
|
|
|
|
]}]'''
|