r212751 - [Driver/Unittests] Follow up for r212666, add unit test for the newly exposed getARMCPUForMArch() function.

Argyrios Kyrtzidis akyrtzi at gmail.com
Thu Jul 10 11:38:38 PDT 2014


Author: akirtzidis
Date: Thu Jul 10 13:38:38 2014
New Revision: 212751

URL: http://llvm.org/viewvc/llvm-project?rev=212751&view=rev
Log:
[Driver/Unittests] Follow up for r212666, add unit test for the newly exposed getARMCPUForMArch() function.

Added:
    cfe/trunk/unittests/Driver/UtilsTest.cpp
Modified:
    cfe/trunk/unittests/Driver/CMakeLists.txt

Modified: cfe/trunk/unittests/Driver/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Driver/CMakeLists.txt?rev=212751&r1=212750&r2=212751&view=diff
==============================================================================
--- cfe/trunk/unittests/Driver/CMakeLists.txt (original)
+++ cfe/trunk/unittests/Driver/CMakeLists.txt Thu Jul 10 13:38:38 2014
@@ -4,6 +4,7 @@ set(LLVM_LINK_COMPONENTS
 
 add_clang_unittest(ClangDriverTests
   MultilibTest.cpp
+  UtilsTest.cpp
   )
 
 target_link_libraries(ClangDriverTests

Added: cfe/trunk/unittests/Driver/UtilsTest.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/unittests/Driver/UtilsTest.cpp?rev=212751&view=auto
==============================================================================
--- cfe/trunk/unittests/Driver/UtilsTest.cpp (added)
+++ cfe/trunk/unittests/Driver/UtilsTest.cpp Thu Jul 10 13:38:38 2014
@@ -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));
+  }
+}





More information about the cfe-commits mailing list