aboutsummaryrefslogtreecommitdiff
path: root/unittests/Core/ArchSpecTest.cpp
diff options
context:
space:
mode:
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());
+}