Casting.cpp revision af8e2ef649b90e88f9d595a638279e3bc4892845
1//===---------- 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 25TEST(CastingTest, isa) { 26 // test various configurations of const 27 const bar &B3 = B1; 28 const bar *const B4 = B2; 29 EXPECT_TRUE(isa<foo>(B1)); 30 EXPECT_TRUE(isa<foo>(B2)); 31 EXPECT_TRUE(isa<foo>(B3)); 32 EXPECT_TRUE(isa<foo>(B4)); 33} 34 35bar B; 36bar &B1 = B; 37const bar *B2 = &B; 38} // anonymous namespace 39