mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-14 07:00:43 +02:00
unittests/ThunkLibs: Add simple struct repacking tests
These just ensure that two specific but common patterns continue to compile.
This commit is contained in:
1 parent
4cbaad298a
commit
295fe03eef
1 file changed
+9
@@ -713,6 +713,11 @@ TEST_CASE_METHOD(Fixture, "StructRepacking") {
|
||||
}
|
||||
}
|
||||
|
||||
SECTION("Pointer to struct with pointer member of consistent data layout") {
|
||||
std::string type = GENERATE("char", "short", "int", "float");
|
||||
REQUIRE_NOTHROW(run_thunkgen_host("struct A { " + type + "* a; };\n", code, guest_abi));
|
||||
}
|
||||
|
||||
SECTION("Pointer to struct with pointer member of opaque type") {
|
||||
const auto prelude =
|
||||
"struct B;\n"
|
||||
@@ -720,6 +725,10 @@ TEST_CASE_METHOD(Fixture, "StructRepacking") {
|
||||
|
||||
// Unannotated
|
||||
REQUIRE_THROWS_WITH(run_thunkgen_host(prelude, code, guest_abi), Catch::Contains("incomplete type"));
|
||||
|
||||
// Annotated as opaque_type
|
||||
CHECK_NOTHROW(run_thunkgen_host(prelude,
|
||||
code + "template<> struct fex_gen_type<B> : fexgen::opaque_type {};\n", guest_abi));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user