diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/gtest/type-builder.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/gtest/type-builder.cpp b/test/gtest/type-builder.cpp index cb2150974..d92057502 100644 --- a/test/gtest/type-builder.cpp +++ b/test/gtest/type-builder.cpp @@ -620,6 +620,35 @@ TEST_F(IsorecursiveTest, TestExistingSuperType) { EXPECT_EQ(B1.getHeapType(), B2.getHeapType()); } +// Test .getMaxDepths() helper. +TEST_F(NominalTest, TestMaxDepths) { + /* + A + | + B + */ + HeapType A, B; + { + TypeBuilder builder(2); + builder[0] = Struct(); + builder[1] = Struct(); + builder.setSubType(1, builder.getTempHeapType(0)); + auto result = builder.build(); + ASSERT_TRUE(result); + auto built = *result; + A = built[0]; + B = built[1]; + } + + SubTypes subTypes({A, B}); + auto maxDepths = subTypes.getMaxDepths(); + + EXPECT_EQ(maxDepths[B], Index(0)); + EXPECT_EQ(maxDepths[A], Index(1)); + EXPECT_EQ(maxDepths[HeapType::data], Index(2)); + EXPECT_EQ(maxDepths[HeapType::eq], Index(3)); +} + // Test .depth() helper. TEST_F(NominalTest, TestDepth) { HeapType A, B, C; |