Lines Matching refs:Triple
1 //===----------- Triple.cpp - Triple unit tests ---------------------------===//
11 #include "llvm/ADT/Triple.h"
18 Triple T;
20 T = Triple("");
26 T = Triple("-");
32 T = Triple("--");
38 T = Triple("---");
44 T = Triple("----");
50 T = Triple("a");
56 T = Triple("a-b");
62 T = Triple("a-b-c");
68 T = Triple("a-b-c-d");
76 Triple T;
78 T = Triple("i386-apple-darwin");
79 EXPECT_EQ(Triple::x86, T.getArch());
80 EXPECT_EQ(Triple::Apple, T.getVendor());
81 EXPECT_EQ(Triple::Darwin, T.getOS());
82 EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
84 T = Triple("x86_64-pc-linux-gnu");
85 EXPECT_EQ(Triple::x86_64, T.getArch());
86 EXPECT_EQ(Triple::PC, T.getVendor());
87 EXPECT_EQ(Triple::Linux, T.getOS());
88 EXPECT_EQ(Triple::GNU, T.getEnvironment());
90 T = Triple("powerpc-dunno-notsure");
91 EXPECT_EQ(Triple::ppc, T.getArch());
92 EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
93 EXPECT_EQ(Triple::UnknownOS, T.getOS());
94 EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
96 T = Triple("arm-none-none-eabi");
97 EXPECT_EQ(Triple::arm, T.getArch());
98 EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
99 EXPECT_EQ(Triple::UnknownOS, T.getOS());
100 EXPECT_EQ(Triple::EABI, T.getEnvironment());
102 T = Triple("huh");
103 EXPECT_EQ(Triple::UnknownArch, T.getArch());
118 EXPECT_EQ("", Triple::normalize(""));
119 EXPECT_EQ("-", Triple::normalize("-"));
120 EXPECT_EQ("--", Triple::normalize("--"));
121 EXPECT_EQ("---", Triple::normalize("---"));
122 EXPECT_EQ("----", Triple::normalize("----"));
124 EXPECT_EQ("a", Triple::normalize("a"));
125 EXPECT_EQ("a-b", Triple::normalize("a-b"));
126 EXPECT_EQ("a-b-c", Triple::normalize("a-b-c"));
127 EXPECT_EQ("a-b-c-d", Triple::normalize("a-b-c-d"));
129 EXPECT_EQ("i386-b-c", Triple::normalize("i386-b-c"));
130 EXPECT_EQ("i386-a-c", Triple::normalize("a-i386-c"));
131 EXPECT_EQ("i386-a-b", Triple::normalize("a-b-i386"));
132 EXPECT_EQ("i386-a-b-c", Triple::normalize("a-b-c-i386"));
134 EXPECT_EQ("a-pc-c", Triple::normalize("a-pc-c"));
135 EXPECT_EQ("-pc-b-c", Triple::normalize("pc-b-c"));
136 EXPECT_EQ("a-pc-b", Triple::normalize("a-b-pc"));
137 EXPECT_EQ("a-pc-b-c", Triple::normalize("a-b-c-pc"));
139 EXPECT_EQ("a-b-linux", Triple::normalize("a-b-linux"));
140 EXPECT_EQ("--linux-b-c", Triple::normalize("linux-b-c"));
141 EXPECT_EQ("a--linux-c", Triple::normalize("a-linux-c"));
143 EXPECT_EQ("i386-pc-a", Triple::normalize("a-pc-i386"));
144 EXPECT_EQ("i386-pc-", Triple::normalize("-pc-i386"));
145 EXPECT_EQ("-pc-linux-c", Triple::normalize("linux-pc-c"));
146 EXPECT_EQ("-pc-linux", Triple::normalize("linux-pc-"));
148 EXPECT_EQ("i386", Triple::normalize("i386"));
149 EXPECT_EQ("-pc", Triple::normalize("pc"));
150 EXPECT_EQ("--linux", Triple::normalize("linux"));
152 EXPECT_EQ("x86_64--linux-gnu", Triple::normalize("x86_64-gnu-linux"));
155 // triple with the unpermuted components.
157 for (int Arch = 1+Triple::UnknownArch; Arch < Triple::InvalidArch; ++Arch) {
158 C[0] = Triple::getArchTypeName(Triple::ArchType(Arch));
159 for (int Vendor = 1+Triple::UnknownVendor; Vendor <= Triple::PC;
161 C[1] = Triple::getVendorTypeName(Triple::VendorType(Vendor));
162 for (int OS = 1+Triple::UnknownOS; OS <= Triple::Minix; ++OS) {
163 C[2] = Triple::getOSTypeName(Triple::OSType(OS));
168 if (OS == Triple::Psp)
172 EXPECT_EQ(E, Triple::normalize(Join(C[0], C[1], C[2])));
174 EXPECT_EQ(E, Triple::normalize(Join(C[0], C[2], C[1])));
175 EXPECT_EQ(E, Triple::normalize(Join(C[1], C[2], C[0])));
176 EXPECT_EQ(E, Triple::normalize(Join(C[1], C[0], C[2])));
177 EXPECT_EQ(E, Triple::normalize(Join(C[2], C[0], C[1])));
178 EXPECT_EQ(E, Triple::normalize(Join(C[2], C[1], C[0])));
180 for (int Env = 1+Triple::UnknownEnvironment; Env <= Triple::MachO;
182 C[3] = Triple::getEnvironmentTypeName(Triple::EnvironmentType(Env));
185 EXPECT_EQ(F, Triple::normalize(Join(C[0], C[1], C[2], C[3])));
187 EXPECT_EQ(F, Triple::normalize(Join(C[0], C[1], C[3], C[2])));
188 EXPECT_EQ(F, Triple::normalize(Join(C[0], C[2], C[3], C[1])));
189 EXPECT_EQ(F, Triple::normalize(Join(C[0], C[2], C[1], C[3])));
190 EXPECT_EQ(F, Triple::normalize(Join(C[0], C[3], C[1], C[2])));
191 EXPECT_EQ(F, Triple::normalize(Join(C[0], C[3], C[2], C[1])));
192 EXPECT_EQ(F, Triple::normalize(Join(C[1], C[2], C[3], C[0])));
193 EXPECT_EQ(F, Triple::normalize(Join(C[1], C[2], C[0], C[3])));
194 EXPECT_EQ(F, Triple::normalize(Join(C[1], C[3], C[0], C[2])));
195 EXPECT_EQ(F, Triple::normalize(Join(C[1], C[3], C[2], C[0])));
196 EXPECT_EQ(F, Triple::normalize(Join(C[1], C[0], C[2], C[3])));
197 EXPECT_EQ(F, Triple::normalize(Join(C[1], C[0], C[3], C[2])));
198 EXPECT_EQ(F, Triple::normalize(Join(C[2], C[3], C[0], C[1])));
199 EXPECT_EQ(F, Triple::normalize(Join(C[2], C[3], C[1], C[0])));
200 EXPECT_EQ(F, Triple::normalize(Join(C[2], C[0], C[1], C[3])));
201 EXPECT_EQ(F, Triple::normalize(Join(C[2], C[0], C[3], C[1])));
202 EXPECT_EQ(F, Triple::normalize(Join(C[2], C[1], C[3], C[0])));
203 EXPECT_EQ(F, Triple::normalize(Join(C[2], C[1], C[0], C[3])));
204 EXPECT_EQ(F, Triple::normalize(Join(C[3], C[0], C[1], C[2])));
205 EXPECT_EQ(F, Triple::normalize(Join(C[3], C[0], C[2], C[1])));
206 EXPECT_EQ(F, Triple::normalize(Join(C[3], C[1], C[2], C[0])));
207 EXPECT_EQ(F, Triple::normalize(Join(C[3], C[1], C[0], C[2])));
208 EXPECT_EQ(F, Triple::normalize(Join(C[3], C[2], C[0], C[1])));
209 EXPECT_EQ(F, Triple::normalize(Join(C[3], C[2], C[1], C[0])));
215 EXPECT_EQ("a-b-psp", Triple::normalize("a-b-psp"));
216 EXPECT_EQ("psp-b-c", Triple::normalize("psp-b-c"));
220 EXPECT_EQ("i386--mingw32", Triple::normalize("i386-mingw32")); // i386-pc-mingw32
221 EXPECT_EQ("x86_64--linux-gnu", Triple::normalize("x86_64-linux-gnu")); // x86_64-pc-linux-gnu
222 EXPECT_EQ("i486--linux-gnu", Triple::normalize("i486-linux-gnu")); // i486-pc-linux-gnu
223 EXPECT_EQ("i386-redhat-linux", Triple::normalize("i386-redhat-linux")); // i386-redhat-linux-gnu
224 EXPECT_EQ("i686--linux", Triple::normalize("i686-linux")); // i686-pc-linux-gnu
225 EXPECT_EQ("arm-none--eabi", Triple::normalize("arm-none-eabi")); // arm-none-eabi
229 Triple T;
230 EXPECT_EQ(Triple::UnknownArch, T.getArch());
231 EXPECT_EQ(Triple::UnknownVendor, T.getVendor());
232 EXPECT_EQ(Triple::UnknownOS, T.getOS());
233 EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment());
236 EXPECT_EQ(Triple::x86, T.getArch());
240 EXPECT_EQ(Triple::x86, T.getArch());
241 EXPECT_EQ(Triple::PC, T.getVendor());
245 EXPECT_EQ(Triple::x86, T.getArch());
246 EXPECT_EQ(Triple::PC, T.getVendor());
247 EXPECT_EQ(Triple::Linux, T.getOS());
251 EXPECT_EQ(Triple::x86, T.getArch());
252 EXPECT_EQ(Triple::PC, T.getVendor());
253 EXPECT_EQ(Triple::Linux, T.getOS());
257 EXPECT_EQ(Triple::x86, T.getArch());
258 EXPECT_EQ(Triple::PC, T.getVendor());
259 EXPECT_EQ(Triple::FreeBSD, T.getOS());
263 EXPECT_EQ(Triple::x86, T.getArch());
264 EXPECT_EQ(Triple::PC, T.getVendor());
265 EXPECT_EQ(Triple::Darwin, T.getOS());