[PowerPC] Collect some CallLowering arguments into a struct. [NFC]
[llvm-project.git] / lldb / unittests / Platform / PlatformDarwinTest.cpp
blob476848d6881f80574e24507202fe0cbba625a7fb
1 //===-- PlatformDarwinTest.cpp ----------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include "gtest/gtest.h"
11 #include "Plugins/Platform/MacOSX/PlatformDarwin.h"
13 #include "llvm/ADT/StringRef.h"
15 #include <tuple>
17 using namespace lldb;
18 using namespace lldb_private;
20 struct PlatformDarwinTester : public PlatformDarwin {
21 static bool SDKSupportsModules(SDKType desired_type,
22 const lldb_private::FileSpec &sdk_path) {
23 return PlatformDarwin::SDKSupportsModules(desired_type, sdk_path);
27 TEST(PlatformDarwinTest, TestParseVersionBuildDir) {
28 llvm::VersionTuple V;
29 llvm::StringRef D;
31 std::tie(V, D) = PlatformDarwin::ParseVersionBuildDir("1.2.3 (test1)");
32 EXPECT_EQ(llvm::VersionTuple(1, 2, 3), V);
33 EXPECT_EQ("test1", D);
35 std::tie(V, D) = PlatformDarwin::ParseVersionBuildDir("2.3 (test2)");
36 EXPECT_EQ(llvm::VersionTuple(2, 3), V);
37 EXPECT_EQ("test2", D);
39 std::tie(V, D) = PlatformDarwin::ParseVersionBuildDir("3 (test3)");
40 EXPECT_EQ(llvm::VersionTuple(3), V);
41 EXPECT_EQ("test3", D);
43 std::tie(V, D) = PlatformDarwin::ParseVersionBuildDir("1.2.3 (test");
44 EXPECT_EQ(llvm::VersionTuple(1, 2, 3), V);
45 EXPECT_EQ("test", D);
47 std::tie(V, D) = PlatformDarwin::ParseVersionBuildDir("2.3.4 test");
48 EXPECT_EQ(llvm::VersionTuple(2, 3, 4), V);
49 EXPECT_EQ("", D);
51 std::tie(V, D) = PlatformDarwin::ParseVersionBuildDir("3.4.5");
52 EXPECT_EQ(llvm::VersionTuple(3, 4, 5), V);
54 std::string base = "/Applications/Xcode.app/Contents/Developer/Platforms/";
55 EXPECT_TRUE(PlatformDarwinTester::SDKSupportsModules(
56 PlatformDarwin::SDKType::iPhoneSimulator,
57 FileSpec(
58 base +
59 "iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.0.sdk")));
60 EXPECT_FALSE(PlatformDarwinTester::SDKSupportsModules(
61 PlatformDarwin::SDKType::iPhoneSimulator,
62 FileSpec(
63 base +
64 "iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator7.2.sdk")));
65 EXPECT_TRUE(PlatformDarwinTester::SDKSupportsModules(
66 PlatformDarwin::SDKType::MacOSX,
67 FileSpec(base + "MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk")));
68 EXPECT_FALSE(PlatformDarwinTester::SDKSupportsModules(
69 PlatformDarwin::SDKType::MacOSX,
70 FileSpec(base + "MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk")));