From e49e3cad08385554700f08431e1b164e4bd85b72 Mon Sep 17 00:00:00 2001 From: Davide De Rosa Date: Tue, 2 Nov 2021 22:52:47 +0100 Subject: [PATCH] Fix test inter-dependencies Cannot depend on another test target? --- Package.swift | 5 ++--- .../DataManipulationTests.swift | 2 +- Tests/TunnelKitCoreTests/RandomTests.swift | 2 +- .../RawPerformanceTests.swift | 2 +- Tests/TunnelKitCoreTests/RoutingTests.swift | 2 +- .../{TestUtils+Core.swift => TestUtils.swift} | 8 ++----- .../TunnelKitLZOTests/CompressionTests.swift | 2 +- .../AppExtensionTests.swift | 2 +- .../ConfigurationParserTests.swift | 2 +- .../ControlChannelTests.swift | 2 +- .../DataPathEncryptionTests.swift | 2 +- .../DataPathPerformanceTests.swift | 3 +-- .../EncryptionPerformanceTests.swift | 3 +-- .../EncryptionTests.swift | 2 +- Tests/TunnelKitOpenVPNTests/LinkTests.swift | 3 +-- Tests/TunnelKitOpenVPNTests/PacketTests.swift | 2 +- Tests/TunnelKitOpenVPNTests/PushTests.swift | 2 +- .../StaticKeyTests.swift | 2 +- ...estUtils+OpenVPN.swift => TestUtils.swift} | 21 +++++++++++++++++-- 19 files changed, 39 insertions(+), 30 deletions(-) rename Tests/TunnelKitCoreTests/{TestUtils+Core.swift => TestUtils.swift} (93%) rename Tests/TunnelKitOpenVPNTests/{TestUtils+OpenVPN.swift => TestUtils.swift} (87%) diff --git a/Package.swift b/Package.swift index 7e9b95e..ae9f7f4 100644 --- a/Package.swift +++ b/Package.swift @@ -89,13 +89,11 @@ let package = Package( .testTarget( name: "TunnelKitCoreTests", dependencies: [ - "TunnelKitCore", - "_TunnelKitCoreObjC" + "TunnelKitCore" ]), .testTarget( name: "TunnelKitOpenVPNTests", dependencies: [ - "TunnelKitCoreTests", "TunnelKitOpenVPN", "_TunnelKitOpenVPNObjC", "TunnelKitLZO" @@ -106,6 +104,7 @@ let package = Package( .testTarget( name: "TunnelKitLZOTests", dependencies: [ + "TunnelKitCore", "TunnelKitLZO" ]), ] diff --git a/Tests/TunnelKitCoreTests/DataManipulationTests.swift b/Tests/TunnelKitCoreTests/DataManipulationTests.swift index 914afc1..a5ee129 100644 --- a/Tests/TunnelKitCoreTests/DataManipulationTests.swift +++ b/Tests/TunnelKitCoreTests/DataManipulationTests.swift @@ -1,6 +1,6 @@ // // DataManipulationTests.swift -// TunnelKitTests +// TunnelKitCoreTests // // Created by Davide De Rosa on 7/7/18. // Copyright (c) 2021 Davide De Rosa. All rights reserved. diff --git a/Tests/TunnelKitCoreTests/RandomTests.swift b/Tests/TunnelKitCoreTests/RandomTests.swift index 91671ac..e4c9e56 100644 --- a/Tests/TunnelKitCoreTests/RandomTests.swift +++ b/Tests/TunnelKitCoreTests/RandomTests.swift @@ -1,6 +1,6 @@ // // RandomTests.swift -// TunnelKitTests +// TunnelKitCoreTests // // Created by Davide De Rosa on 7/7/18. // Copyright (c) 2021 Davide De Rosa. All rights reserved. diff --git a/Tests/TunnelKitCoreTests/RawPerformanceTests.swift b/Tests/TunnelKitCoreTests/RawPerformanceTests.swift index aa20c77..cd92b40 100644 --- a/Tests/TunnelKitCoreTests/RawPerformanceTests.swift +++ b/Tests/TunnelKitCoreTests/RawPerformanceTests.swift @@ -1,6 +1,6 @@ // // RawPerformanceTests.swift -// TunnelKitTests +// TunnelKitCoreTests // // Created by Davide De Rosa on 7/7/18. // Copyright (c) 2021 Davide De Rosa. All rights reserved. diff --git a/Tests/TunnelKitCoreTests/RoutingTests.swift b/Tests/TunnelKitCoreTests/RoutingTests.swift index 0ae2b88..76cfaf2 100644 --- a/Tests/TunnelKitCoreTests/RoutingTests.swift +++ b/Tests/TunnelKitCoreTests/RoutingTests.swift @@ -1,6 +1,6 @@ // // RoutingTests.swift -// TunnelKitTests +// TunnelKitCoreTests // // Created by Davide De Rosa on 4/30/19. // Copyright (c) 2021 Davide De Rosa. All rights reserved. diff --git a/Tests/TunnelKitCoreTests/TestUtils+Core.swift b/Tests/TunnelKitCoreTests/TestUtils.swift similarity index 93% rename from Tests/TunnelKitCoreTests/TestUtils+Core.swift rename to Tests/TunnelKitCoreTests/TestUtils.swift index 267f6d7..c3a9a8f 100644 --- a/Tests/TunnelKitCoreTests/TestUtils+Core.swift +++ b/Tests/TunnelKitCoreTests/TestUtils.swift @@ -1,6 +1,6 @@ // -// TestUtils+Core.swift -// TunnelKitTests +// TestUtils.swift +// TunnelKitCoreTests // // Created by Davide De Rosa on 7/7/18. // Copyright (c) 2021 Davide De Rosa. All rights reserved. @@ -38,10 +38,6 @@ import Foundation @testable import TunnelKitCore public class TestUtils { - public static func uniqArray(_ v: [Int]) -> [Int] { - return v.reduce([]){ $0.contains($1) ? $0 : $0 + [$1] } - } - public static func generateDataSuite(_ size: Int, _ count: Int) -> [Data] { var suite = [Data]() for _ in 0.. [Int] { + return v.reduce([]){ $0.contains($1) ? $0 : $0 + [$1] } + } + + public static func generateDataSuite(_ size: Int, _ count: Int) -> [Data] { + var suite = [Data]() + for _ in 0..?) throws -> Data { let srcLength = data.count