tunnelkit/TunnelKitTests/TestUtils.swift

35 lines
747 B
Swift
Raw Normal View History

2018-08-23 08:19:25 +00:00
//
// TestUtils.swift
// TunnelKitTests
2018-08-23 08:19:25 +00:00
//
// Created by Davide De Rosa on 07/07/2018.
// Copyright © 2018 London Trust Media. All rights reserved.
//
import Foundation
2018-08-23 10:09:44 +00:00
@testable import TunnelKit
@testable import __TunnelKitNative
2018-08-23 08:19:25 +00:00
class TestUtils {
static func uniqArray(_ v: [Int]) -> [Int] {
return v.reduce([]){ $0.contains($1) ? $0 : $0 + [$1] }
}
static func generateDataSuite(_ size: Int, _ count: Int) -> [Data] {
var suite = [Data]()
for _ in 0..<count {
suite.append(try! SecureRandom.data(length: size))
}
return suite
}
private init() {
}
}
extension ZeroingData {
var data: Data {
return Data(bytes: bytes, count: count)
}
}