[Driver/Unittests] Follow up for r212666, add unit test for the newly exposed getARMC...
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Thu, 10 Jul 2014 18:38:38 +0000 (18:38 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Thu, 10 Jul 2014 18:38:38 +0000 (18:38 +0000)
llvm-svn: 212751

clang/unittests/Driver/CMakeLists.txt
clang/unittests/Driver/UtilsTest.cpp [new file with mode: 0644]

index 8cc963b..106f070 100644 (file)
@@ -4,6 +4,7 @@ set(LLVM_LINK_COMPONENTS
 
 add_clang_unittest(ClangDriverTests
   MultilibTest.cpp
+  UtilsTest.cpp
   )
 
 target_link_libraries(ClangDriverTests
diff --git a/clang/unittests/Driver/UtilsTest.cpp b/clang/unittests/Driver/UtilsTest.cpp
new file mode 100644 (file)
index 0000000..308e8d8
--- /dev/null
@@ -0,0 +1,31 @@
+//===- unittests/Driver/UtilsTest.cpp --- Utils tests ---------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// Unit tests for Driver/Util API.
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/Driver/Util.h"
+#include "clang/Basic/LLVM.h"
+#include "llvm/ADT/Triple.h"
+#include "gtest/gtest.h"
+
+using namespace clang::driver;
+using namespace clang;
+
+TEST(UtilsTest, getARMCPUForMArch) {
+  {
+    llvm::Triple Triple("armv7s-apple-ios7");
+    EXPECT_STREQ("swift", getARMCPUForMArch(Triple.getArchName(), Triple));
+  }
+  {
+    llvm::Triple Triple("armv7-apple-ios7");
+    EXPECT_STREQ("cortex-a8", getARMCPUForMArch(Triple.getArchName(), Triple));
+  }
+}