2023-05-26 13:52:09 +01:00
|
|
|
#include <gtest/gtest.h>
|
|
|
|
|
|
|
|
#include "oi/type_graph/RemoveTopLevelPointer.h"
|
|
|
|
#include "oi/type_graph/Types.h"
|
2023-06-23 12:43:30 +01:00
|
|
|
#include "test/type_graph_utils.h"
|
2023-05-26 13:52:09 +01:00
|
|
|
|
|
|
|
using namespace type_graph;
|
|
|
|
|
|
|
|
TEST(RemoveTopLevelPointerTest, TopLevelPointerRemoved) {
|
2023-08-01 19:06:02 +01:00
|
|
|
test(RemoveTopLevelPointer::createPass(), R"(
|
|
|
|
[0] Pointer
|
|
|
|
[1] Class: MyClass (size: 4)
|
|
|
|
Member: n (offset: 0)
|
|
|
|
Primitive: int32_t
|
|
|
|
)",
|
|
|
|
R"(
|
2023-08-02 11:11:52 +01:00
|
|
|
[1] Class: MyClass (size: 4)
|
2023-05-26 13:52:09 +01:00
|
|
|
Member: n (offset: 0)
|
|
|
|
Primitive: int32_t
|
|
|
|
)");
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(RemoveTopLevelPointerTest, TopLevelClassUntouched) {
|
2023-08-01 19:06:02 +01:00
|
|
|
testNoChange(RemoveTopLevelPointer::createPass(), R"(
|
2023-05-26 13:52:09 +01:00
|
|
|
[0] Class: MyClass (size: 4)
|
|
|
|
Member: n (offset: 0)
|
|
|
|
Primitive: int32_t
|
|
|
|
)");
|
|
|
|
}
|
|
|
|
|
|
|
|
TEST(RemoveTopLevelPointerTest, IntermediatePointerUntouched) {
|
2023-08-01 19:06:02 +01:00
|
|
|
testNoChange(RemoveTopLevelPointer::createPass(), R"(
|
2023-05-26 13:52:09 +01:00
|
|
|
[0] Class: MyClass (size: 4)
|
|
|
|
Member: n (offset: 0)
|
|
|
|
[1] Pointer
|
|
|
|
Primitive: int32_t
|
|
|
|
)");
|
|
|
|
}
|