mirror of
https://github.com/JakeHillion/object-introspection.git
synced 2024-11-14 14:26:55 +00:00
ff31971bd3
This removes Printer's legacy behaviour of generating an ID for each node as it gets printed. This old method meant that if new nodes were added to or removed from a graph, every ID after the new/removed node would change. Now IDs are stable so it is easier to follow specific nodes through multiple transformation passes in CodeGen.
39 lines
923 B
C++
39 lines
923 B
C++
#include <gtest/gtest.h>
|
|
|
|
#include "oi/type_graph/RemoveTopLevelPointer.h"
|
|
#include "oi/type_graph/Types.h"
|
|
#include "test/type_graph_utils.h"
|
|
|
|
using namespace type_graph;
|
|
|
|
TEST(RemoveTopLevelPointerTest, TopLevelPointerRemoved) {
|
|
test(RemoveTopLevelPointer::createPass(), R"(
|
|
[0] Pointer
|
|
[1] Class: MyClass (size: 4)
|
|
Member: n (offset: 0)
|
|
Primitive: int32_t
|
|
)",
|
|
R"(
|
|
[1] Class: MyClass (size: 4)
|
|
Member: n (offset: 0)
|
|
Primitive: int32_t
|
|
)");
|
|
}
|
|
|
|
TEST(RemoveTopLevelPointerTest, TopLevelClassUntouched) {
|
|
testNoChange(RemoveTopLevelPointer::createPass(), R"(
|
|
[0] Class: MyClass (size: 4)
|
|
Member: n (offset: 0)
|
|
Primitive: int32_t
|
|
)");
|
|
}
|
|
|
|
TEST(RemoveTopLevelPointerTest, IntermediatePointerUntouched) {
|
|
testNoChange(RemoveTopLevelPointer::createPass(), R"(
|
|
[0] Class: MyClass (size: 4)
|
|
Member: n (offset: 0)
|
|
[1] Pointer
|
|
Primitive: int32_t
|
|
)");
|
|
}
|