1 //===- llvm/unittest/IR/TypesTest.cpp - Type unit tests -------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "llvm/IR/DerivedTypes.h"
11 #include "llvm/IR/LLVMContext.h"
12 #include "gtest/gtest.h"
17 TEST(TypesTest, StructType) {
21 StructType *Struct = StructType::create(C, "FooBar");
22 EXPECT_EQ("FooBar", Struct->getName());
23 Struct->setName(Struct->getName().substr(0, 3));
24 EXPECT_EQ("Foo", Struct->getName());
26 EXPECT_TRUE(Struct->getName().empty());
27 EXPECT_FALSE(Struct->hasName());
30 TEST(TypesTest, LayoutIdenticalEmptyStructs) {
33 StructType *Foo = StructType::create(C, "Foo");
34 StructType *Bar = StructType::create(C, "Bar");
35 EXPECT_TRUE(Foo->isLayoutIdentical(Bar));
38 } // end anonymous namespace