1 //===- TypeNameTest.cpp ---------------------------------------------------===//
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/Support/TypeName.h"
11 #include "llvm/Support/raw_ostream.h"
12 #include "gtest/gtest.h"
23 TEST(TypeNameTest, Names) {
26 StringRef S1Name = getTypeName<N1::S1>();
27 StringRef C1Name = getTypeName<N1::C1>();
28 StringRef U1Name = getTypeName<N1::U1>();
29 StringRef S2Name = getTypeName<S2>();
31 #if defined(__clang__) || defined(__GNUC__) || defined(__INTEL_COMPILER) || \
33 EXPECT_TRUE(S1Name.endswith("::N1::S1")) << S1Name.str();
34 EXPECT_TRUE(C1Name.endswith("::N1::C1")) << C1Name.str();
35 EXPECT_TRUE(U1Name.endswith("::N1::U1")) << U1Name.str();
37 EXPECT_TRUE(S2Name.endswith("S2")) << S2Name.str();
39 EXPECT_TRUE(S2Name.endswith("::S2")) << S2Name.str();
42 EXPECT_EQ("UNKNOWN_TYPE", S1Name);
43 EXPECT_EQ("UNKNOWN_TYPE", C1Name);
44 EXPECT_EQ("UNKNOWN_TYPE", U1Name);
45 EXPECT_EQ("UNKNOWN_TYPE", S2Name);
49 } // end anonymous namespace