From ccf58fa5fd7ac0354c5e737650afd66a73d3e66f Mon Sep 17 00:00:00 2001 From: Chad Rosier Date: Wed, 9 May 2012 19:31:41 +0000 Subject: [PATCH] Add unittests for Triple::getMacOSXVersion and Triple::getiOSVersion. llvm-svn: 156507 --- unittests/ADT/TripleTest.cpp | 65 ++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/unittests/ADT/TripleTest.cpp b/unittests/ADT/TripleTest.cpp index 479046e01d7..3b7558436d9 100644 --- a/unittests/ADT/TripleTest.cpp +++ b/unittests/ADT/TripleTest.cpp @@ -390,4 +390,69 @@ TEST(TripleTest, BitWidthArchVariants) { EXPECT_EQ(Triple::x86_64, T.get64BitArchVariant().getArch()); } +TEST(TripleTest, getOSVersion) { + Triple T; + unsigned Major, Minor, Micro; + + T = Triple("i386-apple-darwin9"); + T.getMacOSXVersion(Major, Minor, Micro); + EXPECT_EQ((unsigned)10, Major); + EXPECT_EQ((unsigned)5, Minor); + EXPECT_EQ((unsigned)0, Micro); + T.getiOSVersion(Major, Minor, Micro); + EXPECT_EQ((unsigned)3, Major); + EXPECT_EQ((unsigned)0, Minor); + EXPECT_EQ((unsigned)0, Micro); + + T = Triple("x86_64-apple-darwin9"); + T.getMacOSXVersion(Major, Minor, Micro); + EXPECT_EQ((unsigned)10, Major); + EXPECT_EQ((unsigned)5, Minor); + EXPECT_EQ((unsigned)0, Micro); + T.getiOSVersion(Major, Minor, Micro); + EXPECT_EQ((unsigned)3, Major); + EXPECT_EQ((unsigned)0, Minor); + EXPECT_EQ((unsigned)0, Micro); + + T = Triple("x86_64-apple-macosx"); + T.getMacOSXVersion(Major, Minor, Micro); + EXPECT_EQ((unsigned)10, Major); + EXPECT_EQ((unsigned)4, Minor); + EXPECT_EQ((unsigned)0, Micro); + T.getiOSVersion(Major, Minor, Micro); + EXPECT_EQ((unsigned)3, Major); + EXPECT_EQ((unsigned)0, Minor); + EXPECT_EQ((unsigned)0, Micro); + + T = Triple("x86_64-apple-macosx10.7"); + T.getMacOSXVersion(Major, Minor, Micro); + EXPECT_EQ((unsigned)10, Major); + EXPECT_EQ((unsigned)7, Minor); + EXPECT_EQ((unsigned)0, Micro); + T.getiOSVersion(Major, Minor, Micro); + EXPECT_EQ((unsigned)3, Major); + EXPECT_EQ((unsigned)0, Minor); + EXPECT_EQ((unsigned)0, Micro); + + T = Triple("armv7-apple-ios"); + T.getMacOSXVersion(Major, Minor, Micro); + EXPECT_EQ((unsigned)10, Major); + EXPECT_EQ((unsigned)4, Minor); + EXPECT_EQ((unsigned)0, Micro); + T.getiOSVersion(Major, Minor, Micro); + EXPECT_EQ((unsigned)3, Major); + EXPECT_EQ((unsigned)0, Minor); + EXPECT_EQ((unsigned)0, Micro); + + T = Triple("armv7-apple-ios5.0"); + T.getMacOSXVersion(Major, Minor, Micro); + EXPECT_EQ((unsigned)10, Major); + EXPECT_EQ((unsigned)4, Minor); + EXPECT_EQ((unsigned)0, Micro); + T.getiOSVersion(Major, Minor, Micro); + EXPECT_EQ((unsigned)5, Major); + EXPECT_EQ((unsigned)0, Minor); + EXPECT_EQ((unsigned)0, Micro); +} + }