summaryrefslogtreecommitdiff
path: root/unittests/ADT/TripleTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'unittests/ADT/TripleTest.cpp')
-rw-r--r--unittests/ADT/TripleTest.cpp84
1 files changed, 48 insertions, 36 deletions
diff --git a/unittests/ADT/TripleTest.cpp b/unittests/ADT/TripleTest.cpp
index dee09f46ee91..1a9e81a0df74 100644
--- a/unittests/ADT/TripleTest.cpp
+++ b/unittests/ADT/TripleTest.cpp
@@ -18,58 +18,58 @@ TEST(TripleTest, BasicParsing) {
Triple T;
T = Triple("");
- EXPECT_EQ("", T.getArchName());
- EXPECT_EQ("", T.getVendorName());
- EXPECT_EQ("", T.getOSName());
- EXPECT_EQ("", T.getEnvironmentName());
+ EXPECT_EQ("", T.getArchName().str());
+ EXPECT_EQ("", T.getVendorName().str());
+ EXPECT_EQ("", T.getOSName().str());
+ EXPECT_EQ("", T.getEnvironmentName().str());
T = Triple("-");
- EXPECT_EQ("", T.getArchName());
- EXPECT_EQ("", T.getVendorName());
- EXPECT_EQ("", T.getOSName());
- EXPECT_EQ("", T.getEnvironmentName());
+ EXPECT_EQ("", T.getArchName().str());
+ EXPECT_EQ("", T.getVendorName().str());
+ EXPECT_EQ("", T.getOSName().str());
+ EXPECT_EQ("", T.getEnvironmentName().str());
T = Triple("--");
- EXPECT_EQ("", T.getArchName());
- EXPECT_EQ("", T.getVendorName());
- EXPECT_EQ("", T.getOSName());
- EXPECT_EQ("", T.getEnvironmentName());
+ EXPECT_EQ("", T.getArchName().str());
+ EXPECT_EQ("", T.getVendorName().str());
+ EXPECT_EQ("", T.getOSName().str());
+ EXPECT_EQ("", T.getEnvironmentName().str());
T = Triple("---");
- EXPECT_EQ("", T.getArchName());
- EXPECT_EQ("", T.getVendorName());
- EXPECT_EQ("", T.getOSName());
- EXPECT_EQ("", T.getEnvironmentName());
+ EXPECT_EQ("", T.getArchName().str());
+ EXPECT_EQ("", T.getVendorName().str());
+ EXPECT_EQ("", T.getOSName().str());
+ EXPECT_EQ("", T.getEnvironmentName().str());
T = Triple("----");
- EXPECT_EQ("", T.getArchName());
- EXPECT_EQ("", T.getVendorName());
- EXPECT_EQ("", T.getOSName());
- EXPECT_EQ("-", T.getEnvironmentName());
+ EXPECT_EQ("", T.getArchName().str());
+ EXPECT_EQ("", T.getVendorName().str());
+ EXPECT_EQ("", T.getOSName().str());
+ EXPECT_EQ("-", T.getEnvironmentName().str());
T = Triple("a");
- EXPECT_EQ("a", T.getArchName());
- EXPECT_EQ("", T.getVendorName());
- EXPECT_EQ("", T.getOSName());
- EXPECT_EQ("", T.getEnvironmentName());
+ EXPECT_EQ("a", T.getArchName().str());
+ EXPECT_EQ("", T.getVendorName().str());
+ EXPECT_EQ("", T.getOSName().str());
+ EXPECT_EQ("", T.getEnvironmentName().str());
T = Triple("a-b");
- EXPECT_EQ("a", T.getArchName());
- EXPECT_EQ("b", T.getVendorName());
- EXPECT_EQ("", T.getOSName());
- EXPECT_EQ("", T.getEnvironmentName());
+ EXPECT_EQ("a", T.getArchName().str());
+ EXPECT_EQ("b", T.getVendorName().str());
+ EXPECT_EQ("", T.getOSName().str());
+ EXPECT_EQ("", T.getEnvironmentName().str());
T = Triple("a-b-c");
- EXPECT_EQ("a", T.getArchName());
- EXPECT_EQ("b", T.getVendorName());
- EXPECT_EQ("c", T.getOSName());
- EXPECT_EQ("", T.getEnvironmentName());
+ EXPECT_EQ("a", T.getArchName().str());
+ EXPECT_EQ("b", T.getVendorName().str());
+ EXPECT_EQ("c", T.getOSName().str());
+ EXPECT_EQ("", T.getEnvironmentName().str());
T = Triple("a-b-c-d");
- EXPECT_EQ("a", T.getArchName());
- EXPECT_EQ("b", T.getVendorName());
- EXPECT_EQ("c", T.getOSName());
- EXPECT_EQ("d", T.getEnvironmentName());
+ EXPECT_EQ("a", T.getArchName().str());
+ EXPECT_EQ("b", T.getVendorName().str());
+ EXPECT_EQ("c", T.getOSName().str());
+ EXPECT_EQ("d", T.getEnvironmentName().str());
}
TEST(TripleTest, ParsedIDs) {
@@ -92,6 +92,18 @@ TEST(TripleTest, ParsedIDs) {
T = Triple("huh");
EXPECT_EQ(Triple::UnknownArch, T.getArch());
+
+ // Two exceptional cases.
+
+ T = Triple("i386-mingw32");
+ EXPECT_EQ(Triple::x86, T.getArch());
+ EXPECT_EQ(Triple::PC, T.getVendor());
+ EXPECT_EQ(Triple::MinGW32, T.getOS());
+
+ T = Triple("arm-elf");
+ EXPECT_EQ(Triple::arm, T.getArch());
+ EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
+ EXPECT_EQ(Triple::UnknownOS, T.getOS());
}
TEST(TripleTest, MutateName) {