IR: Allow vectors of halfs to be ConstantDataVectors
[oota-llvm.git] / unittests / IR / TypesTest.cpp
1 //===- llvm/unittest/IR/TypesTest.cpp - Type unit 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/IR/DerivedTypes.h"
11 #include "llvm/IR/LLVMContext.h"
12 #include "gtest/gtest.h"
13 using namespace llvm;
14
15 namespace {
16
17 TEST(TypesTest, StructType) {
18   LLVMContext C;
19
20   // PR13522
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());
25   Struct->setName("");
26   EXPECT_TRUE(Struct->getName().empty());
27   EXPECT_FALSE(Struct->hasName());
28 }
29
30 TEST(TypesTest, LayoutIdenticalEmptyStructs) {\r
31   LLVMContext C;\r
32 \r
33   StructType *Foo = StructType::create(C, "Foo");\r
34   StructType *Bar = StructType::create(C, "Bar");\r
35   EXPECT_TRUE(Foo->isLayoutIdentical(Bar));\r
36 }\r
37
38 }  // end anonymous namespace