Integration tests: Add simple class and simple union tests

This commit is contained in:
Alastair Robertson 2023-02-14 05:10:21 -08:00 committed by Alastair Robertson
parent de071e2e38
commit 18e636d68d
3 changed files with 50 additions and 21 deletions

View File

@ -18,7 +18,7 @@ set(INTEGRATION_TEST_CONFIGS
pointers_incomplete.toml pointers_incomplete.toml
primitives.toml primitives.toml
references.toml references.toml
simple_struct.toml simple.toml
sorted_vector_set.toml sorted_vector_set.toml
std_array.toml std_array.toml
std_conditional.toml std_conditional.toml

View File

@ -0,0 +1,49 @@
definitions = '''
struct SimpleStruct {
int a;
char b;
long long c;
};
class SimpleClass {
int a;
char b;
long long c;
};
union SimpleUnion {
int a;
char b;
long long c;
};
'''
[cases]
[cases.struct]
param_types = ["const SimpleStruct&"]
setup = "return {};"
expect_json = '''[{
"staticSize":16,
"dynamicSize":0,
"members":[
{"name":"a", "staticSize":4, "dynamicSize":0},
{"name":"b", "staticSize":1, "dynamicSize":0},
{"name":"c", "staticSize":8, "dynamicSize":0}
]}]'''
[cases.class]
param_types = ["const SimpleClass&"]
setup = "return {};"
expect_json = '''[{
"staticSize":16,
"dynamicSize":0,
"members":[
{"name":"a", "staticSize":4, "dynamicSize":0},
{"name":"b", "staticSize":1, "dynamicSize":0},
{"name":"c", "staticSize":8, "dynamicSize":0}
]}]'''
[cases.union]
param_types = ["const SimpleUnion&"]
setup = "return {};"
expect_json = '''[{
"staticSize":8,
"dynamicSize":0,
"NOT":"members"
}]'''

View File

@ -1,20 +0,0 @@
definitions = '''
struct Foo {
int a;
int b;
int c;
};
'''
[cases]
[cases.a]
param_types = ["const Foo&"]
setup = "return {};"
expect_json = '''[{
"staticSize":12,
"dynamicSize":0,
"members":[
{"name":"a", "staticSize":4, "dynamicSize":0},
{"name":"b", "staticSize":4, "dynamicSize":0},
{"name":"c", "staticSize":4, "dynamicSize":0}
]}]'''