diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-01-19 10:06:29 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-01-19 10:06:29 +0000 |
commit | 94994d372d014ce4c8758b9605d63fae651bd8aa (patch) | |
tree | 51c0b708bd59f205d6b35cb2a8c24d62f0c33d77 /unittests/Utility/ArchSpecTest.cpp | |
parent | 39be7ce23363d12ae3e49aeb1fdb2bfeb892e836 (diff) |
Notes
Diffstat (limited to 'unittests/Utility/ArchSpecTest.cpp')
-rw-r--r-- | unittests/Utility/ArchSpecTest.cpp | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/unittests/Utility/ArchSpecTest.cpp b/unittests/Utility/ArchSpecTest.cpp index d7397cbec531..f226af4b507a 100644 --- a/unittests/Utility/ArchSpecTest.cpp +++ b/unittests/Utility/ArchSpecTest.cpp @@ -171,3 +171,65 @@ TEST(ArchSpecTest, MergeFromMachOUnknown) { A.MergeFrom(B); ASSERT_EQ(A.GetCore(), ArchSpec::eCore_uknownMach64); } + +TEST(ArchSpecTest, Compatibility) { + { + ArchSpec A("x86_64-apple-macosx10.12"); + ArchSpec B("x86_64-apple-macosx10.12"); + ASSERT_TRUE(A.IsExactMatch(B)); + ASSERT_TRUE(A.IsCompatibleMatch(B)); + } + { + // The version information is auxiliary to support availablity but + // doesn't affect compatibility. + ArchSpec A("x86_64-apple-macosx10.11"); + ArchSpec B("x86_64-apple-macosx10.12"); + ASSERT_TRUE(A.IsExactMatch(B)); + ASSERT_TRUE(A.IsCompatibleMatch(B)); + } + { + ArchSpec A("x86_64-apple-macosx10.13"); + ArchSpec B("x86_64h-apple-macosx10.13"); + ASSERT_FALSE(A.IsExactMatch(B)); + ASSERT_TRUE(A.IsCompatibleMatch(B)); + } + { + ArchSpec A("x86_64-apple-macosx"); + ArchSpec B("x86_64-apple-ios-simulator"); + ASSERT_FALSE(A.IsExactMatch(B)); + ASSERT_FALSE(A.IsCompatibleMatch(B)); + } + { + ArchSpec A("x86_64-*-*"); + ArchSpec B("x86_64-apple-ios-simulator"); + ASSERT_FALSE(A.IsExactMatch(B)); + ASSERT_FALSE(A.IsCompatibleMatch(B)); + } + { + ArchSpec A("arm64-*-*"); + ArchSpec B("arm64-apple-ios"); + ASSERT_FALSE(A.IsExactMatch(B)); + // FIXME: This looks unintuitive and we should investigate whether + // this is the desired behavior. + ASSERT_FALSE(A.IsCompatibleMatch(B)); + } + { + ArchSpec A("x86_64-*-*"); + ArchSpec B("x86_64-apple-ios-simulator"); + ASSERT_FALSE(A.IsExactMatch(B)); + // FIXME: See above, though the extra environment complicates things. + ASSERT_FALSE(A.IsCompatibleMatch(B)); + } + { + ArchSpec A("x86_64"); + ArchSpec B("x86_64-apple-macosx10.14"); + // FIXME: The exact match also looks unintuitive. + ASSERT_TRUE(A.IsExactMatch(B)); + ASSERT_TRUE(A.IsCompatibleMatch(B)); + } +} + +TEST(ArchSpecTest, OperatorBool) { + EXPECT_FALSE(ArchSpec()); + EXPECT_TRUE(ArchSpec("x86_64-pc-linux")); +} |