[LVI] Add trunc to i1 handling. (#124480)
[llvm-project.git] / compiler-rt / lib / orc / tests / unit / extensible_rtti_test.cpp
blob8e8cdee02487c90014067f39cc4e82440daddb9b
1 //===-- extensible_rtti_test.cpp ------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file is a part of the ORC runtime.
11 // Note:
12 // This unit test was adapted from
13 // llvm/unittests/Support/ExtensibleRTTITest.cpp
15 //===----------------------------------------------------------------------===//
17 #include "extensible_rtti.h"
18 #include "gtest/gtest.h"
20 using namespace orc_rt;
22 namespace {
24 class MyBase : public RTTIExtends<MyBase, RTTIRoot> {};
26 class MyDerivedA : public RTTIExtends<MyDerivedA, MyBase> {};
28 class MyDerivedB : public RTTIExtends<MyDerivedB, MyBase> {};
30 } // end anonymous namespace
32 TEST(ExtensibleRTTITest, BaseCheck) {
33 MyBase MB;
34 MyDerivedA MDA;
35 MyDerivedB MDB;
37 // Check MB properties.
38 EXPECT_TRUE(isa<RTTIRoot>(MB));
39 EXPECT_TRUE(isa<MyBase>(MB));
40 EXPECT_FALSE(isa<MyDerivedA>(MB));
41 EXPECT_FALSE(isa<MyDerivedB>(MB));
43 // Check MDA properties.
44 EXPECT_TRUE(isa<RTTIRoot>(MDA));
45 EXPECT_TRUE(isa<MyBase>(MDA));
46 EXPECT_TRUE(isa<MyDerivedA>(MDA));
47 EXPECT_FALSE(isa<MyDerivedB>(MDA));
49 // Check MDB properties.
50 EXPECT_TRUE(isa<RTTIRoot>(MDB));
51 EXPECT_TRUE(isa<MyBase>(MDB));
52 EXPECT_FALSE(isa<MyDerivedA>(MDB));
53 EXPECT_TRUE(isa<MyDerivedB>(MDB));