llvm.org GIT mirror llvm / 69f60e7
Added a unit test for r173983 that verifies that Target.isiOS() works correctly. As a bonus I put in some extra checks to make sure that we are identifying the machine word of various Mac OS X/iOS targets appropriately. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173994 91177308-0d34-0410-b5e6-96231b3b80d8 Michael Gottesman 6 years ago
1 changed file(s) with 30 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
406406 unsigned Major, Minor, Micro;
407407
408408 T = Triple("i386-apple-darwin9");
409 EXPECT_TRUE(T.isMacOSX());
410 EXPECT_FALSE(T.isiOS());
411 EXPECT_FALSE(T.isArch16Bit());
412 EXPECT_TRUE(T.isArch32Bit());
413 EXPECT_FALSE(T.isArch64Bit());
409414 T.getMacOSXVersion(Major, Minor, Micro);
410415 EXPECT_EQ((unsigned)10, Major);
411416 EXPECT_EQ((unsigned)5, Minor);
416421 EXPECT_EQ((unsigned)0, Micro);
417422
418423 T = Triple("x86_64-apple-darwin9");
424 EXPECT_TRUE(T.isMacOSX());
425 EXPECT_FALSE(T.isiOS());
426 EXPECT_FALSE(T.isArch16Bit());
427 EXPECT_FALSE(T.isArch32Bit());
428 EXPECT_TRUE(T.isArch64Bit());
419429 T.getMacOSXVersion(Major, Minor, Micro);
420430 EXPECT_EQ((unsigned)10, Major);
421431 EXPECT_EQ((unsigned)5, Minor);
426436 EXPECT_EQ((unsigned)0, Micro);
427437
428438 T = Triple("x86_64-apple-macosx");
439 EXPECT_TRUE(T.isMacOSX());
440 EXPECT_FALSE(T.isiOS());
441 EXPECT_FALSE(T.isArch16Bit());
442 EXPECT_FALSE(T.isArch32Bit());
443 EXPECT_TRUE(T.isArch64Bit());
429444 T.getMacOSXVersion(Major, Minor, Micro);
430445 EXPECT_EQ((unsigned)10, Major);
431446 EXPECT_EQ((unsigned)4, Minor);
436451 EXPECT_EQ((unsigned)0, Micro);
437452
438453 T = Triple("x86_64-apple-macosx10.7");
454 EXPECT_TRUE(T.isMacOSX());
455 EXPECT_FALSE(T.isiOS());
456 EXPECT_FALSE(T.isArch16Bit());
457 EXPECT_FALSE(T.isArch32Bit());
458 EXPECT_TRUE(T.isArch64Bit());
439459 T.getMacOSXVersion(Major, Minor, Micro);
440460 EXPECT_EQ((unsigned)10, Major);
441461 EXPECT_EQ((unsigned)7, Minor);
446466 EXPECT_EQ((unsigned)0, Micro);
447467
448468 T = Triple("armv7-apple-ios");
469 EXPECT_FALSE(T.isMacOSX());
470 EXPECT_TRUE(T.isiOS());
471 EXPECT_FALSE(T.isArch16Bit());
472 EXPECT_TRUE(T.isArch32Bit());
473 EXPECT_FALSE(T.isArch64Bit());
449474 T.getMacOSXVersion(Major, Minor, Micro);
450475 EXPECT_EQ((unsigned)10, Major);
451476 EXPECT_EQ((unsigned)4, Minor);
456481 EXPECT_EQ((unsigned)0, Micro);
457482
458483 T = Triple("armv7-apple-ios5.0");
484 EXPECT_FALSE(T.isMacOSX());
485 EXPECT_TRUE(T.isiOS());
486 EXPECT_FALSE(T.isArch16Bit());
487 EXPECT_TRUE(T.isArch32Bit());
488 EXPECT_FALSE(T.isArch64Bit());
459489 T.getMacOSXVersion(Major, Minor, Micro);
460490 EXPECT_EQ((unsigned)10, Major);
461491 EXPECT_EQ((unsigned)4, Minor);