2013-01-07 15:35:46 +00:00
|
|
|
//===- llvm/unittest/IR/TypesTest.cpp - Type unit tests -------------------===//
|
2012-08-04 09:47:02 +00:00
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2013-01-02 11:36:10 +00:00
|
|
|
#include "llvm/IR/DerivedTypes.h"
|
|
|
|
#include "llvm/IR/LLVMContext.h"
|
2012-08-04 09:47:02 +00:00
|
|
|
#include "gtest/gtest.h"
|
|
|
|
using namespace llvm;
|
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
|
|
|
TEST(TypesTest, StructType) {
|
|
|
|
LLVMContext C;
|
|
|
|
|
|
|
|
// PR13522
|
|
|
|
StructType *Struct = StructType::create(C, "FooBar");
|
|
|
|
EXPECT_EQ("FooBar", Struct->getName());
|
|
|
|
Struct->setName(Struct->getName().substr(0, 3));
|
|
|
|
EXPECT_EQ("Foo", Struct->getName());
|
|
|
|
Struct->setName("");
|
|
|
|
EXPECT_TRUE(Struct->getName().empty());
|
|
|
|
EXPECT_FALSE(Struct->hasName());
|
|
|
|
}
|
|
|
|
|
|
|
|
} // end anonymous namespace
|