object-introspection/test/test_enforce_compatibility.cpp
Alastair Robertson 2060a0491e CodeGen v2: Enable independent running without CodeGen v1
Create DrgnExporter to translate Type Graph "Type" nodes into drgn_type
structs, suitable for use in OICache and TreeBuilder.
2023-12-15 14:57:24 +00:00

35 lines
744 B
C++

#include <gtest/gtest.h>
#include "oi/type_graph/EnforceCompatibility.h"
#include "test/type_graph_utils.h"
using namespace type_graph;
TEST(EnforceCompatibilityTest, ParentContainers) {
test(EnforceCompatibility::createPass(),
R"(
[0] Class: MyClass (size: 24)
Member: __oi_parent (offset: 0)
[1] Container: std::vector (size: 24)
Param
Primitive: int32_t
)",
R"(
[0] Class: MyClass (size: 24)
)");
}
TEST(EnforceCompatibilityTest, TypesToStub) {
test(EnforceCompatibility::createPass(),
R"(
[0] Class: EnumMap (size: 8)
Member: a (offset: 0)
Primitive: int32_t
Member: b (offset: 4)
Primitive: int32_t
)",
R"(
[0] Class: EnumMap (size: 8)
)");
}