summaryrefslogtreecommitdiff
path: root/unittests/Core/ArchSpecTest.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-04-20 21:21:28 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-04-20 21:21:28 +0000
commitd44a35e87e405ae98902dc491ba70ed82f58f592 (patch)
treec943b2e42186cf1629dc15a3b6604514996993ee /unittests/Core/ArchSpecTest.cpp
parent74a628f776edb588bff8f8f5cc16eac947c9d631 (diff)
Notes
Diffstat (limited to 'unittests/Core/ArchSpecTest.cpp')
-rw-r--r--unittests/Core/ArchSpecTest.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/unittests/Core/ArchSpecTest.cpp b/unittests/Core/ArchSpecTest.cpp
index 32b363652f75..8fed7adba07c 100644
--- a/unittests/Core/ArchSpecTest.cpp
+++ b/unittests/Core/ArchSpecTest.cpp
@@ -134,3 +134,22 @@ TEST(ArchSpecTest, TestSetTriple) {
AS = ArchSpec();
EXPECT_FALSE(AS.SetTriple(""));
}
+
+TEST(ArchSpecTest, MergeFrom) {
+ ArchSpec A;
+ ArchSpec B("x86_64-pc-linux");
+
+ EXPECT_FALSE(A.IsValid());
+ ASSERT_TRUE(B.IsValid());
+ EXPECT_EQ(llvm::Triple::ArchType::x86_64, B.GetTriple().getArch());
+ EXPECT_EQ(llvm::Triple::VendorType::PC, B.GetTriple().getVendor());
+ EXPECT_EQ(llvm::Triple::OSType::Linux, B.GetTriple().getOS());
+ EXPECT_EQ(ArchSpec::eCore_x86_64_x86_64, B.GetCore());
+
+ A.MergeFrom(B);
+ ASSERT_TRUE(A.IsValid());
+ EXPECT_EQ(llvm::Triple::ArchType::x86_64, A.GetTriple().getArch());
+ EXPECT_EQ(llvm::Triple::VendorType::PC, A.GetTriple().getVendor());
+ EXPECT_EQ(llvm::Triple::OSType::Linux, A.GetTriple().getOS());
+ EXPECT_EQ(ArchSpec::eCore_x86_64_x86_64, A.GetCore());
+}