Ver código fonte

Update tests to Swift 4

Marcin Krzyżanowski 8 anos atrás
pai
commit
93d13f7f50

+ 2 - 2
Tests/CryptoSwiftTests/AESTests.swift

@@ -356,7 +356,7 @@ final class AESTests: XCTestCase {
             let iv: Array<UInt8> = [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F]
             let message = Array<UInt8>(repeating: 7, count: 1024 * 1024)
             let aes = try! AES(key: key, iv: iv, blockMode: .CBC, padding: PKCS7())
-            measureMetrics([XCTPerformanceMetric_WallClockTime], automaticallyStartMeasuring: true, for: { () -> Void in
+            measureMetrics([XCTPerformanceMetric.wallClockTime], automaticallyStartMeasuring: true, for: { () -> Void in
                 _ = try! aes.encrypt(message)
             })
         }
@@ -366,7 +366,7 @@ final class AESTests: XCTestCase {
             let iv: Array<UInt8> = [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F]
             let message = Array<UInt8>(repeating: 7, count: 1024 * 1024)
             let aes = try! AES(key: key, iv: iv, blockMode: .CBC, padding: PKCS7())
-            measureMetrics([XCTPerformanceMetric_WallClockTime], automaticallyStartMeasuring: true, for: { () -> Void in
+            measureMetrics([XCTPerformanceMetric.wallClockTime], automaticallyStartMeasuring: true, for: { () -> Void in
                 _ = try! aes.decrypt(message)
             })
         }

+ 1 - 1
Tests/CryptoSwiftTests/ChaCha20Tests.swift

@@ -109,7 +109,7 @@ final class ChaCha20Tests: XCTestCase {
             let key: Array<UInt8> = [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x1F]
             let iv: Array<UInt8> = [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07]
             let message = Array<UInt8>(repeating: 7, count: 1024)
-            measureMetrics([XCTPerformanceMetric_WallClockTime], automaticallyStartMeasuring: true, for: { () -> Void in
+            measureMetrics([XCTPerformanceMetric.wallClockTime], automaticallyStartMeasuring: true, for: { () -> Void in
                 do {
                     let _ = try ChaCha20(key: key, iv: iv).encrypt(message)
                 } catch {

+ 1 - 1
Tests/CryptoSwiftTests/DigestTests.swift

@@ -166,7 +166,7 @@ final class DigestTests: XCTestCase {
     extension DigestTests {
 
         func testMD5Performance() {
-            self.measureMetrics([XCTPerformanceMetric_WallClockTime], automaticallyStartMeasuring: false, for: { () -> Void in
+            self.measureMetrics([XCTPerformanceMetric.wallClockTime], automaticallyStartMeasuring: false, for: { () -> Void in
                 let arr = Array<UInt8>(repeating: 200, count: 1024 * 1024)
                 self.startMeasuring()
                 _ = Digest.md5(arr)

+ 1 - 1
Tests/CryptoSwiftTests/ExtensionsTest.swift

@@ -93,7 +93,7 @@ final class ExtensionsTest: XCTestCase {
     extension ExtensionsTest {
 
         func testArrayChunksPerformance() {
-            measureMetrics([XCTPerformanceMetric_WallClockTime], automaticallyStartMeasuring: false, for: { () -> Void in
+            measureMetrics([XCTPerformanceMetric.wallClockTime], automaticallyStartMeasuring: false, for: { () -> Void in
                 let message = Array<UInt8>(repeating: 7, count: 1024 * 1024)
                 self.startMeasuring()
                 _ = message.chunks(size: AES.blockSize)

+ 1 - 1
Tests/CryptoSwiftTests/PBKDF.swift

@@ -56,7 +56,7 @@ class PBKDF: XCTestCase {
     func testPerformance() {
         let password: Array<UInt8> = Array("s33krit".utf8)
         let salt: Array<UInt8> = Array("nacl".utf8)
-        measureMetrics([XCTPerformanceMetric_WallClockTime], automaticallyStartMeasuring: true, for: { () -> Void in
+        measureMetrics([XCTPerformanceMetric.wallClockTime], automaticallyStartMeasuring: true, for: { () -> Void in
             let _ = try! PKCS5.PBKDF2(password: password, salt: salt, iterations: 65536, keyLength: 32, variant: .sha1).calculate()
         })
     }

+ 1 - 1
Tests/CryptoSwiftTests/RabbitTests.swift

@@ -118,7 +118,7 @@ class RabbitTests: XCTestCase {
             let key: Array<UInt8> = Array<UInt8>(repeating: 0, count: Rabbit.keySize)
             let iv: Array<UInt8> = Array<UInt8>(repeating: 0, count: Rabbit.ivSize)
             let message = Array<UInt8>(repeating: 7, count: (1024 * 1024) * 1)
-            measureMetrics([XCTPerformanceMetric_WallClockTime], automaticallyStartMeasuring: true, for: { () -> Void in
+            measureMetrics([XCTPerformanceMetric.wallClockTime], automaticallyStartMeasuring: true, for: { () -> Void in
                 let encrypted = try! Rabbit(key: key, iv: iv).encrypt(message)
                 self.stopMeasuring()
                 XCTAssert(!encrypted.isEmpty, "not encrypted")