mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-14 11:32:34 +00:00
extend to cast<> and cast_or_null<> tests
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@108854 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
133e295b36
commit
08993c03ab
@ -19,19 +19,47 @@ using namespace llvm;
|
||||
|
||||
namespace {
|
||||
|
||||
const foo *null_foo = NULL;
|
||||
|
||||
extern bar &B1;
|
||||
extern const bar *B2;
|
||||
// test various configurations of const
|
||||
const bar &B3 = B1;
|
||||
const bar *const B4 = B2;
|
||||
|
||||
TEST(CastingTest, isa) {
|
||||
// test various configurations of const
|
||||
const bar &B3 = B1;
|
||||
const bar *const B4 = B2;
|
||||
EXPECT_TRUE(isa<foo>(B1));
|
||||
EXPECT_TRUE(isa<foo>(B2));
|
||||
EXPECT_TRUE(isa<foo>(B3));
|
||||
EXPECT_TRUE(isa<foo>(B4));
|
||||
}
|
||||
|
||||
TEST(CastingTest, cast) {
|
||||
foo &F1 = cast<foo>(B1);
|
||||
EXPECT_NE(&F1, null_foo);
|
||||
const foo *F3 = cast<foo>(B2);
|
||||
EXPECT_NE(F3, null_foo);
|
||||
const foo *F4 = cast<foo>(B2);
|
||||
EXPECT_NE(F4, null_foo);
|
||||
const foo &F8 = cast<foo>(B3);
|
||||
EXPECT_NE(&F8, null_foo);
|
||||
const foo *F9 = cast<foo>(B4);
|
||||
EXPECT_NE(F9, null_foo);
|
||||
foo *F10 = cast<foo>(fub());
|
||||
EXPECT_EQ(F10, null_foo);
|
||||
}
|
||||
|
||||
TEST(CastingTest, cast_or_null) {
|
||||
const foo *F11 = cast_or_null<foo>(B2);
|
||||
EXPECT_NE(F11, null_foo);
|
||||
const foo *F12 = cast_or_null<foo>(B2);
|
||||
EXPECT_NE(F12, null_foo);
|
||||
const foo *F13 = cast_or_null<foo>(B4);
|
||||
EXPECT_NE(F13, null_foo);
|
||||
const foo *F14 = cast_or_null<foo>(fub()); // Shouldn't print.
|
||||
EXPECT_EQ(F14, null_foo);
|
||||
}
|
||||
|
||||
bar B;
|
||||
bar &B1 = B;
|
||||
const bar *B2 = &B;
|
||||
|
Loading…
Reference in New Issue
Block a user