blob: 3a3af7e046d50868b79f1b315ee6311f8797c9aa [file] [log] [blame]
Gabor Greifee57dae2010-07-20 16:32:20 +00001//===---------- llvm/unittest/Support/Casting.cpp - Casting tests --------===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10#include "llvm/Support/raw_ostream.h"
11#include "llvm/Support/Debug.h"
12#define DEBUG_CAST_OPERATORS
13#include "llvm/Support/Casting.h"
14
15#include "gtest/gtest.h"
16#include <cstdlib>
17
18using namespace llvm;
19
20namespace {
21
22extern bar &B1;
23extern const bar *B2;
24
Gabor Greifaf8e2ef2010-07-20 16:38:12 +000025TEST(CastingTest, isa) {
26 // test various configurations of const
27 const bar &B3 = B1;
28 const bar *const B4 = B2;
Gabor Greifee57dae2010-07-20 16:32:20 +000029 EXPECT_TRUE(isa<foo>(B1));
Gabor Greifaf8e2ef2010-07-20 16:38:12 +000030 EXPECT_TRUE(isa<foo>(B2));
31 EXPECT_TRUE(isa<foo>(B3));
32 EXPECT_TRUE(isa<foo>(B4));
Gabor Greifee57dae2010-07-20 16:32:20 +000033}
34
35bar B;
36bar &B1 = B;
37const bar *B2 = &B;
38} // anonymous namespace