Explorar el Código

Run tests with "swift test".
Run tests on Linux.
Changed test method names to camel case.

Michael Ledin hace 9 años
padre
commit
dbd0b54d87

+ 17 - 8
CryptoSwift.xcodeproj/project.pbxproj

@@ -260,6 +260,8 @@
 		80545D141CA9FECD00474A99 /* Bit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 80545D121CA9FECD00474A99 /* Bit.swift */; };
 		80545D151CA9FECD00474A99 /* Bit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 80545D121CA9FECD00474A99 /* Bit.swift */; };
 		80545D161CA9FECD00474A99 /* Bit.swift in Sources */ = {isa = PBXBuildFile; fileRef = 80545D121CA9FECD00474A99 /* Bit.swift */; };
+		E3FD2D501D6B7E1100A9F35F /* CommonCryptoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3FD2D4E1D6B734A00A9F35F /* CommonCryptoTests.swift */; };
+		E3FD2D531D6B81CE00A9F35F /* Error+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = E3FD2D511D6B813C00A9F35F /* Error+Extension.swift */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXContainerItemProxy section */
@@ -357,7 +359,7 @@
 		754BE45519693E190098E6F3 /* CryptoSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CryptoSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 		754BE46019693E190098E6F3 /* CryptoSwiftTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = CryptoSwiftTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
 		754BE46619693E190098E6F3 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
-		754BE46719693E190098E6F3 /* HashTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HashTests.swift; sourceTree = "<group>"; };
+		754BE46719693E190098E6F3 /* HashTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HashTests.swift; sourceTree = "<group>"; };
 		754C9D1A1C30800A0003D5FE /* String+LinuxFoundation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "String+LinuxFoundation.swift"; sourceTree = "<group>"; };
 		75558FCB1D4BA93C00CF6C18 /* RandomAccessCryptor.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = RandomAccessCryptor.swift; path = Sources/CryptoSwift/RandomAccessCryptor.swift; sourceTree = SOURCE_ROOT; };
 		755655C61D080E3F00F004E7 /* Cryptors.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Cryptors.swift; path = Sources/CryptoSwift/Cryptors.swift; sourceTree = SOURCE_ROOT; };
@@ -425,6 +427,8 @@
 		75DB81A71CDC06B100ED181A /* Updatable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Updatable.swift; path = Sources/CryptoSwift/Updatable.swift; sourceTree = SOURCE_ROOT; };
 		75DF77721BC8EB59006E9520 /* CryptoSwift.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = CryptoSwift.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 		80545D121CA9FECD00474A99 /* Bit.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Bit.swift; path = Sources/CryptoSwift/Bit.swift; sourceTree = SOURCE_ROOT; };
+		E3FD2D4E1D6B734A00A9F35F /* CommonCryptoTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CommonCryptoTests.swift; sourceTree = "<group>"; };
+		E3FD2D511D6B813C00A9F35F /* Error+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "Error+Extension.swift"; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -489,7 +493,7 @@
 			children = (
 				755D27BC1D06DE6400C41692 /* CryptoSwift.playground */,
 				754BE45719693E190098E6F3 /* CryptoSwift */,
-				754BE46419693E190098E6F3 /* CryptoSwiftTests */,
+				754BE46419693E190098E6F3 /* Tests */,
 				754BE45619693E190098E6F3 /* Products */,
 				24B0BBA29D734E62809E53BC /* Frameworks */,
 			);
@@ -561,7 +565,7 @@
 			name = "Supporting Files";
 			sourceTree = "<group>";
 		};
-		754BE46419693E190098E6F3 /* CryptoSwiftTests */ = {
+		754BE46419693E190098E6F3 /* Tests */ = {
 			isa = PBXGroup;
 			children = (
 				757DA2561A4ED47B002BA3EF /* Helpers.swift */,
@@ -577,8 +581,11 @@
 				75C2E76C1D55F097003D2BCA /* Access.swift */,
 				756BFDCA1A82B87300B9D9A4 /* Bridging.h */,
 				754BE46519693E190098E6F3 /* Supporting Files */,
+				E3FD2D4E1D6B734A00A9F35F /* CommonCryptoTests.swift */,
+				E3FD2D511D6B813C00A9F35F /* Error+Extension.swift */,
 			);
-			path = CryptoSwiftTests;
+			name = Tests;
+			path = Tests/CryptoSwiftTests;
 			sourceTree = "<group>";
 		};
 		754BE46519693E190098E6F3 /* Supporting Files */ = {
@@ -998,11 +1005,13 @@
 				75100F8F19B0BC890005C5F5 /* Poly1305Tests.swift in Sources */,
 				757DA2571A4ED47B002BA3EF /* Helpers.swift in Sources */,
 				754BE46819693E190098E6F3 /* HashTests.swift in Sources */,
+				E3FD2D531D6B81CE00A9F35F /* Error+Extension.swift in Sources */,
 				757DA2591A4ED4D7002BA3EF /* ChaCha20Tests.swift in Sources */,
 				755FB1DA199E347D00475437 /* ExtensionsTest.swift in Sources */,
 				674A736F1BF5D85B00866C5B /* RabbitTests.swift in Sources */,
 				757DA2531A4ED0A4002BA3EF /* PaddingTests.swift in Sources */,
 				757DA2551A4ED408002BA3EF /* AESTests.swift in Sources */,
+				E3FD2D501D6B7E1100A9F35F /* CommonCryptoTests.swift in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1381,13 +1390,13 @@
 					"/Applications/Xcode6-Beta3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include",
 					"includes/**",
 				);
-				INFOPLIST_FILE = CryptoSwiftTests/Info.plist;
+				INFOPLIST_FILE = Tests/CryptoSwiftTests/Info.plist;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
 				LLVM_LTO = NO;
 				METAL_ENABLE_DEBUG_INFO = YES;
 				PRODUCT_BUNDLE_IDENTIFIER = "com.hakore.${PRODUCT_NAME:rfc1034identifier}";
 				PRODUCT_NAME = "$(TARGET_NAME)";
-				SWIFT_OBJC_BRIDGING_HEADER = CryptoSwiftTests/Bridging.h;
+				SWIFT_OBJC_BRIDGING_HEADER = Tests/CryptoSwiftTests/Bridging.h;
 				SWIFT_VERSION = 3.0;
 			};
 			name = Debug;
@@ -1402,14 +1411,14 @@
 					"/Applications/Xcode6-Beta3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include",
 					"includes/**",
 				);
-				INFOPLIST_FILE = CryptoSwiftTests/Info.plist;
+				INFOPLIST_FILE = Tests/CryptoSwiftTests/Info.plist;
 				LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
 				LLVM_LTO = YES;
 				METAL_ENABLE_DEBUG_INFO = NO;
 				PRODUCT_BUNDLE_IDENTIFIER = "com.hakore.${PRODUCT_NAME:rfc1034identifier}";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SWIFT_DISABLE_SAFETY_CHECKS = YES;
-				SWIFT_OBJC_BRIDGING_HEADER = CryptoSwiftTests/Bridging.h;
+				SWIFT_OBJC_BRIDGING_HEADER = Tests/CryptoSwiftTests/Bridging.h;
 				SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule";
 				SWIFT_VERSION = 3.0;
 			};

+ 1 - 6
Package.swift

@@ -2,9 +2,4 @@ import PackageDescription
 
 let package = Package(name: "CryptoSwift")
 
-// Do not build Foundation part for non-darwin systems
-// where Swift Foundation is outdated on incomplete
-// see https://github.com/apple/swift/blob/master/lib/Basic/LangOptions.cpp#L26
-#if !os(OSX) && !os(tvOS) && !os(iOS) && !os(watchOS)
-package.exclude.append("Sources/CryptoSwift/Foundation")
-#endif
+package.exclude.append("Tests/CryptoSwiftTests/CommonCryptoTests.swift")

+ 41 - 19
CryptoSwiftTests/AESTests.swift → Tests/CryptoSwiftTests/AESTests.swift

@@ -6,13 +6,14 @@
 //  Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
 //
 import XCTest
+import Foundation
 @testable import CryptoSwift
 
 final class AESTests: XCTestCase {
     // 128 bit key
     let aesKey:Array<UInt8> = [0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f]
 
-    func testAES_encrypt2() {
+    func testAESEncrypt2() {
         let key:Array<UInt8>   = [0x36, 0x37, 0x39, 0x66, 0x62, 0x31, 0x64, 0x64, 0x66, 0x37, 0x64, 0x38, 0x31, 0x62, 0x65, 0x65];
         let iv:Array<UInt8>    = [0x6b, 0x64, 0x66, 0x36, 0x37, 0x33, 0x39, 0x38, 0x44, 0x46, 0x37, 0x33, 0x38, 0x33, 0x66, 0x64]
         let input:Array<UInt8> = [0x62, 0x72, 0x61, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
@@ -26,7 +27,7 @@ final class AESTests: XCTestCase {
         XCTAssertEqual(decrypted, input, "decryption failed")
     }
 
-    func testAES_encrypt3() {
+    func testAESEncrypt3() {
         let key = "679fb1ddf7d81bee"
         let iv = "kdf67398DF7383fd"
         let input:Array<UInt8> = [0x62, 0x72, 0x61, 0x64, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
@@ -39,7 +40,7 @@ final class AESTests: XCTestCase {
         XCTAssertEqual(decrypted, input, "decryption failed")
     }
     
-    func testAES_encrypt() {
+    func testAESEncrypt() {
         let input:Array<UInt8> = [0x00, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77, 0x88, 0x99, 0xaa, 0xbb, 0xcc, 0xdd, 0xee, 0xff];
         let expected:Array<UInt8> = [0x69, 0xc4, 0xe0, 0xd8, 0x6a, 0x7b, 0x4, 0x30, 0xd8, 0xcd, 0xb7, 0x80, 0x70, 0xb4, 0xc5, 0x5a];
         
@@ -50,7 +51,7 @@ final class AESTests: XCTestCase {
         XCTAssertEqual(decrypted, input, "decryption failed")
     }
 
-    func testAES_encrypt_cbc_no_padding() {
+    func testAESEncryptCBCNoPadding() {
         let key:Array<UInt8> = [0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6,0xab,0xf7,0x15,0x88,0x09,0xcf,0x4f,0x3c];
         let iv:Array<UInt8> = [0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F]
         let plaintext:Array<UInt8> = [0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a]
@@ -63,7 +64,7 @@ final class AESTests: XCTestCase {
         XCTAssertEqual(decrypted, plaintext, "decryption failed")
     }
 
-    func testAES_encrypt_cbc_with_padding() {
+    func testAESEncryptCBCWithPadding() {
         let key:Array<UInt8> = [0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6,0xab,0xf7,0x15,0x88,0x09,0xcf,0x4f,0x3c];
         let iv:Array<UInt8> = [0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F]
         let plaintext:Array<UInt8> = [0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a]
@@ -76,7 +77,7 @@ final class AESTests: XCTestCase {
         XCTAssertEqual(decrypted, plaintext, "decryption failed")
     }
 
-    func testAES_encrypt_cbc_with_padding_partial() {
+    func testAESEncryptCBCWithPaddingPartial() {
         let key:Array<UInt8> = [0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6,0xab,0xf7,0x15,0x88,0x09,0xcf,0x4f,0x3c];
         let iv:Array<UInt8> = [0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F]
         let plaintext:Array<UInt8> = [0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a,0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a]
@@ -92,7 +93,7 @@ final class AESTests: XCTestCase {
         XCTAssertEqual(try! aes.encrypt(plaintext), ciphertext, "encryption failed")
     }
 
-    func testAES_encrypt_incremental() {
+    func testAESEncryptIncremental() {
         do {
             var ciphertext = Array<UInt8>()
             let plaintext = "Today Apple launched the open source Swift community, as well as amazing new tools and resources."
@@ -107,7 +108,7 @@ final class AESTests: XCTestCase {
         }
     }
 
-    func testAES_decrypt_cbc_with_padding_partial() {
+    func testAESDecryptCBCWithPaddingPartial() {
         let key:Array<UInt8> = [0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6,0xab,0xf7,0x15,0x88,0x09,0xcf,0x4f,0x3c];
         let iv:Array<UInt8> = [0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F]
         let ciphertext:Array<UInt8> = [118, 73, 171, 172, 129, 25, 178, 70, 206, 233, 142, 155, 18, 233, 25, 125, 76, 187, 200, 88, 117, 107, 53, 129, 37, 82, 158, 150, 152, 163, 143, 68, 169, 105, 137, 234, 93, 98, 239, 215, 41, 45, 51, 254, 138, 92, 251, 17]
@@ -122,7 +123,7 @@ final class AESTests: XCTestCase {
         XCTAssertEqual(try! aes.decrypt(ciphertext), plaintext, "encryption failed")
     }
 
-    func testAES_encrypt_cfb() {
+    func testAESEncryptCFB() {
         let key:Array<UInt8> = [0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6,0xab,0xf7,0x15,0x88,0x09,0xcf,0x4f,0x3c];
         let iv:Array<UInt8> = [0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F]
         let plaintext:Array<UInt8> = [0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a]
@@ -136,7 +137,7 @@ final class AESTests: XCTestCase {
     }
 
     // https://github.com/krzyzanowskim/CryptoSwift/issues/142
-    func testAES_encrypt_cfb_long() {
+    func testAESEncryptCFBLong() {
         let key: Array<UInt8> = [56, 118, 37, 51, 125, 78, 103, 107, 119, 40, 74, 88, 117, 112, 123, 75, 122, 89, 72, 36, 46, 91, 106, 60, 54, 110, 34, 126, 69, 126, 61, 87]
         let iv: Array<UInt8> = [69, 122, 99, 87, 83, 112, 110, 65, 54, 109, 107, 89, 73, 122, 74, 49]
         let plaintext: Array<UInt8> = [123, 10, 32, 32, 34, 67, 111, 110, 102, 105, 114, 109, 34, 32, 58, 32, 34, 116, 101, 115, 116, 105, 110, 103, 34, 44, 10, 32, 32, 34, 70, 105, 114, 115, 116, 78, 97, 109, 101, 34, 32, 58, 32, 34, 84, 101, 115, 116, 34, 44, 10, 32, 32, 34, 69, 109, 97, 105, 108, 34, 32, 58, 32, 34, 116, 101, 115, 116, 64, 116, 101, 115, 116, 46, 99, 111, 109, 34, 44, 10, 32, 32, 34, 76, 97, 115, 116, 78, 97, 109, 101, 34, 32, 58, 32, 34, 84, 101, 115, 116, 101, 114, 34, 44, 10, 32, 32, 34, 80, 97, 115, 115, 119, 111, 114, 100, 34, 32, 58, 32, 34, 116, 101, 115, 116, 105, 110, 103, 34, 44, 10, 32, 32, 34, 85, 115, 101, 114, 110, 97, 109, 101, 34, 32, 58, 32, 34, 84, 101, 115, 116, 34, 10, 125]
@@ -145,7 +146,7 @@ final class AESTests: XCTestCase {
         XCTAssert(decrypted == plaintext, "decryption failed")
     }
 
-    func testAES_encrypt_ofb128() {
+    func testAESEncryptOFB128() {
         let key:Array<UInt8> = [0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6,0xab,0xf7,0x15,0x88,0x09,0xcf,0x4f,0x3c];
         let iv:Array<UInt8> = [0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F]
         let plaintext:Array<UInt8> = [0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a]
@@ -158,7 +159,7 @@ final class AESTests: XCTestCase {
         XCTAssertEqual(decrypted, plaintext, "decryption failed")
     }
 
-    func testAES_encrypt_ofb256() {
+    func testAESEncryptOFB256() {
         let key: Array<UInt8> = [0x60,0x3d,0xeb,0x10,0x15,0xca,0x71,0xbe,0x2b,0x73,0xae,0xf0,0x85,0x7d,0x77,0x81,0x1f,0x35,0x2c,0x07,0x3b,0x61,0x08,0xd7,0x2d,0x98,0x10,0xa3,0x09,0x14,0xdf,0xf4]
         let iv: Array<UInt8> = [0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F]
         let plaintext: Array<UInt8> = [0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a]
@@ -171,7 +172,7 @@ final class AESTests: XCTestCase {
         XCTAssertEqual(decrypted, plaintext, "decryption failed")
     }
 
-    func testAES_encrypt_pcbc256() {
+    func testAESEncryptPCBC256() {
         let key: Array<UInt8> = [0x60,0x3d,0xeb,0x10,0x15,0xca,0x71,0xbe,0x2b,0x73,0xae,0xf0,0x85,0x7d,0x77,0x81,0x1f,0x35,0x2c,0x07,0x3b,0x61,0x08,0xd7,0x2d,0x98,0x10,0xa3,0x09,0x14,0xdf,0xf4]
         let iv: Array<UInt8> = [0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F]
         let plaintext: Array<UInt8> = [0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a]
@@ -185,7 +186,7 @@ final class AESTests: XCTestCase {
         XCTAssertEqual(decrypted, plaintext, "decryption failed")
     }
 
-    func testAES_encrypt_ctr() {
+    func testAESEncryptCTR() {
         let key:Array<UInt8> = [0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6,0xab,0xf7,0x15,0x88,0x09,0xcf,0x4f,0x3c];
         let iv:Array<UInt8> = [0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff]
         let plaintext:Array<UInt8> = [0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a]
@@ -198,7 +199,7 @@ final class AESTests: XCTestCase {
         XCTAssertEqual(decrypted, plaintext, "decryption failed")
     }
 
-    func testAES_encrypt_ctr_irregular_length() {
+    func testAESEncryptCTRIrregularLength() {
         let key:Array<UInt8> = [0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6,0xab,0xf7,0x15,0x88,0x09,0xcf,0x4f,0x3c];
         let iv:Array<UInt8> = [0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff]
         let plaintext:Array<UInt8> = [0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a,0x01]
@@ -212,7 +213,7 @@ final class AESTests: XCTestCase {
     }
 
     // https://github.com/krzyzanowskim/CryptoSwift/pull/290
-    func testAES_decrypt_ctr_seek() {
+    func testAESDecryptCTRSeek() {
         let key:Array<UInt8> = [0x52, 0x72, 0xb5, 0x9c, 0xab, 0x07, 0xc5, 0x01, 0x11, 0x7a, 0x39, 0xb6, 0x10, 0x35, 0x87, 0x02];
         let iv:Array<UInt8> = [0x00, 0x01, 0x02, 0x03, 0x00, 0x01, 0x02, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01]
         var plaintext:Array<UInt8> = Array<UInt8>(repeating: 0, count: 6000)
@@ -253,7 +254,7 @@ final class AESTests: XCTestCase {
     }
     
     // https://github.com/krzyzanowskim/CryptoSwift/pull/289
-    func testAES_encrypt_ctr_irregular_length_incremental_update() {
+    func testAESEncryptCTRIrregularLengthIncrementalUpdate() {
         let key:Array<UInt8> = [0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6,0xab,0xf7,0x15,0x88,0x09,0xcf,0x4f,0x3c];
         let iv:Array<UInt8> = [0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc,0xfd,0xfe,0xff]
         let plaintext:Array<UInt8> = [0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a,0x01,0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a,0x01]
@@ -278,7 +279,7 @@ final class AESTests: XCTestCase {
     }
 
     // https://github.com/krzyzanowskim/CryptoSwift/issues/298
-    func test_issue298() {
+    func testIssue298() {
         let encryptedValue = "47595cfa90f7b0b0e0d9d7240a2e035f7f4acde27d7ca778a7d8b05add32a0a92d945c0a59f7f0e029d7f2fbb258b2f0"
         let key = "0123456789abcdef"
         let iv = "fedcba9876543210"
@@ -286,7 +287,7 @@ final class AESTests: XCTestCase {
         do {
             let aes = try AES(key: key, iv: iv, blockMode: .CBC, padding: NoPadding())
             let ciphertext = try aes.decrypt(Array<UInt8>(hex: encryptedValue))
-            let str = String(data: Data(ciphertext), encoding: String.Encoding.utf8)
+            let str = String(data: Data(bytes: ciphertext), encoding: String.Encoding.utf8)
             XCTAssertEqual(str!, "74b653e36430d7a9cd91a24d9944b032OrFeckrWo\0\0\0\0\0\0\0")
         } catch {
             XCTFail("failed")
@@ -326,4 +327,25 @@ final class AESTests: XCTestCase {
         XCTAssertTrue(decrypted! != plaintext, "failed")
     }
 
+    static let allTests =  [
+        ("testAESEncrypt2", testAESEncrypt2),
+        ("testAESEncrypt3", testAESEncrypt3),
+        ("testAESEncrypt", testAESEncrypt),
+        ("testAESEncryptCBCNoPadding", testAESEncryptCBCNoPadding),
+        ("testAESEncryptCBCWithPadding", testAESEncryptCBCWithPadding),
+        ("testAESEncryptCBCWithPaddingPartial", testAESEncryptCBCWithPaddingPartial),
+        ("testAESEncryptIncremental", testAESEncryptIncremental),
+        ("testAESDecryptCBCWithPaddingPartial", testAESDecryptCBCWithPaddingPartial),
+        ("testAESEncryptCFB", testAESEncryptCFB),
+        ("testAESEncryptCFBLong", testAESEncryptCFBLong),
+        ("testAESEncryptOFB128", testAESEncryptOFB128),
+        ("testAESEncryptOFB256", testAESEncryptOFB256),
+        ("testAESEncryptPCBC256", testAESEncryptPCBC256),
+        ("testAESEncryptCTR", testAESEncryptCTR),
+        ("testAESEncryptCTRIrregularLength", testAESEncryptCTRIrregularLength),
+        ("testAESDecryptCTRSeek", testAESDecryptCTRSeek),
+        ("testAESEncryptCTRIrregularLengthIncrementalUpdate", testAESEncryptCTRIrregularLengthIncrementalUpdate),
+        ("testIssue298", testIssue298),
+        ("testAESWithWrongKey", testAESWithWrongKey)
+    ]
 }

+ 24 - 1
CryptoSwiftTests/Access.swift → Tests/CryptoSwiftTests/Access.swift

@@ -7,7 +7,8 @@
 //
 
 import XCTest
-import CryptoSwift
+import Foundation
+@testable import CryptoSwift
 
 class Access: XCTestCase {
     let cipher = try! AES(key: "secret0key000000", iv: "0123456789012345")
@@ -214,4 +215,26 @@ class Access: XCTestCase {
     func testUpdatable() {
         // TODO
     }
+    
+    static let allTests =  [
+        ("testChecksum", testChecksum),
+        ("testHash", testHash),
+        ("testArrayExtension", testArrayExtension),
+        ("testCollectionExtension", testCollectionExtension),
+        ("testStringExtension", testStringExtension),
+        ("testStringFoundationExtension", testStringFoundationExtension),
+        ("testIntExtension", testIntExtension),
+        ("testUInt16Extension", testUInt16Extension),
+        ("testUInt32Extension", testUInt32Extension),
+        ("testUInt64Extension", testUInt64Extension),
+        ("testUInt8Extension", testUInt8Extension),
+        ("testDataExtension", testDataExtension),
+        ("testPadding", testPadding),
+        ("testPBKDF", testPBKDF),
+        ("testAuthenticators", testAuthenticators),
+        ("testAES", testAES),
+        ("testRabbit", testRabbit),
+        ("testChaCha20", testChaCha20),
+        ("testUpdatable", testUpdatable)
+    ]
 }

+ 0 - 0
CryptoSwiftTests/Bridging.h → Tests/CryptoSwiftTests/Bridging.h


+ 9 - 9
CryptoSwiftTests/ChaCha20Tests.swift → Tests/CryptoSwiftTests/ChaCha20Tests.swift

@@ -6,18 +6,11 @@
 //  Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
 //
 import XCTest
+import Foundation
 @testable import CryptoSwift
 
 final class ChaCha20Tests: XCTestCase {
 
-    override func setUp() {
-        super.setUp()
-    }
-    
-    override func tearDown() {
-        super.tearDown()
-    }
-
     func testChaCha20() {
         let keys:[Array<UInt8>] = [
             [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00],
@@ -81,7 +74,7 @@ final class ChaCha20Tests: XCTestCase {
         }
     }
 
-    func testChaCha20_encrypt_partial() {
+    func testChaCha20EncryptPartial() {
         let key:Array<UInt8> = [0x2b,0x7e,0x15,0x16,0x28,0xae,0xd2,0xa6,0xab,0xf7,0x15,0x88,0x09,0xcf,0x4f,0x3c];
         let iv:Array<UInt8> = [0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F]
         let plaintext:Array<UInt8> = [0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a,0x6b,0xc1,0xbe,0xe2,0x2e,0x40,0x9f,0x96,0xe9,0x3d,0x7e,0x11,0x73,0x93,0x17,0x2a]
@@ -114,4 +107,11 @@ final class ChaCha20Tests: XCTestCase {
             self.stopMeasuring()
         })
     }
+    
+    static let allTests =  [
+        ("testChaCha20", testChaCha20),
+        ("testVector1Py", testVector1Py),
+        ("testChaCha20EncryptPartial", testChaCha20EncryptPartial),
+        ("testChaCha20Performance", testChaCha20Performance)
+    ]
 }

+ 26 - 0
Tests/CryptoSwiftTests/CommonCryptoTests.swift

@@ -0,0 +1,26 @@
+//
+//  CommonCryptoTests.swift
+//  CryptoSwift
+//
+//  Created by Michael Ledin on 22.08.16.
+//  Copyright © 2016 Marcin Krzyzanowski. All rights reserved.
+//
+
+import XCTest
+@testable import CryptoSwift
+
+final class CryptoSwiftTests: XCTestCase {
+    func testMD5PerformanceCommonCrypto() {
+        self.measureMetrics([XCTPerformanceMetric_WallClockTime], automaticallyStartMeasuring: false, for: { () -> Void in
+            let buf: UnsafeMutableRawPointer = calloc(1024 * 1024, MemoryLayout<UInt8>.size)
+            let data = NSData(bytes: buf, length: 1024 * 1024)
+            let md = UnsafeMutablePointer<UInt8>.allocate(capacity: Int(CC_MD5_DIGEST_LENGTH))
+            self.startMeasuring()
+            CC_MD5(data.bytes, CC_LONG(data.length), md)
+            self.stopMeasuring()
+            md.deallocate(capacity: Int(CC_MD5_DIGEST_LENGTH))
+            md.deinitialize()
+            buf.deallocate(bytes: 1024 * 1024, alignedTo: MemoryLayout<UInt8>.alignment)
+        })
+    }
+}

+ 17 - 0
Tests/CryptoSwiftTests/Error+Extension.swift

@@ -0,0 +1,17 @@
+//
+//  Error+Extension.swift
+//  CryptoSwift
+//
+//  Created by Michael Ledin on 22.08.16.
+//  Copyright © 2016 Marcin Krzyzanowski. All rights reserved.
+//
+
+import Foundation
+
+#if !_runtime(_ObjC)
+extension Error {
+    var localizedDescription: String {
+        return "\(self)"
+    }
+}
+#endif

+ 17 - 13
CryptoSwiftTests/ExtensionsTest.swift → Tests/CryptoSwiftTests/ExtensionsTest.swift

@@ -6,18 +6,11 @@
 //  Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
 //
 import XCTest
+import Foundation
 @testable import CryptoSwift
 
 final class ExtensionsTest: XCTestCase {
 
-    override func setUp() {
-        super.setUp()
-    }
-    
-    override func tearDown() {
-        super.tearDown()
-    }
-
     func testArrayChunksPerformance() {
         measureMetrics([XCTPerformanceMetric_WallClockTime], automaticallyStartMeasuring: false, for: { () -> Void in
             let message = Array<UInt8>(repeating: 7, count: 1024 * 1024)
@@ -76,7 +69,7 @@ final class ExtensionsTest: XCTestCase {
         XCTAssert((iii &<< 32) == 0, "shift left failed")
     }
     
-    func testtoUInt32Array() {
+    func testToUInt32Array() {
         let chunk:ArraySlice<UInt8> = [1,1,1,7,2,3,4,5]
         let result = chunk.toUInt32Array()
         
@@ -85,12 +78,12 @@ final class ExtensionsTest: XCTestCase {
         XCTAssert(result[1] == 84148994, "Invalid conversion")
     }
 
-    func test_NSData_init() {
+    func testDataInit() {
         let data = Data(bytes: [0x01, 0x02, 0x03])
         XCTAssert(data.count == 3, "Invalid data")
     }
 
-    func test_String_encrypt() {
+    func testStringEncrypt() {
         do {
             let encryptedHex = try "my secret string".encrypt(cipher: AES(key: "secret0key000000", iv: "0123456789012345"))
             XCTAssertEqual(encryptedHex, "68f7ff8bdb61f625febdfe3d791ecf624daaed2e719a6de39112de8e0cc7349b")
@@ -99,13 +92,13 @@ final class ExtensionsTest: XCTestCase {
         }
     }
 
-    func test_String_decrypt_base64() {
+    func testStringDecryptBase64() {
         let encryptedBase64 = "aPf/i9th9iX+vf49eR7PYk2q7S5xmm3jkRLejgzHNJs="
         let decrypted = try! encryptedBase64.decryptBase64ToString(cipher: AES(key: "secret0key000000", iv: "0123456789012345"))
         XCTAssertEqual(decrypted, "my secret string")
     }
 
-    func test_Array_init_hex() {
+    func testArrayInitHex() {
         let bytes = Array<UInt8>(hex: "0xb1b1b2b2")
         XCTAssertEqual(bytes, [177,177,178,178])
 
@@ -115,4 +108,15 @@ final class ExtensionsTest: XCTestCase {
         XCTAssertEqual(str, hex)
     }
 
+    static let allTests =  [
+        ("testArrayChunksPerformance", testArrayChunksPerformance),
+        ("testIntExtension", testIntExtension),
+        ("testBytes", testBytes),
+        ("testShiftLeft", testShiftLeft),
+        ("testToUInt32Array", testToUInt32Array),
+        ("testDataInit", testDataInit),
+        ("testStringEncrypt", testStringEncrypt),
+        ("testStringDecryptBase64", testStringDecryptBase64),
+        ("testArrayInitHex", testArrayInitHex)
+    ]
 }

+ 10 - 10
CryptoSwiftTests/HMACTests.swift → Tests/CryptoSwiftTests/HMACTests.swift

@@ -9,16 +9,7 @@ import XCTest
 @testable import CryptoSwift
 
 final class HMACTests: XCTestCase {
-    
-    override func setUp() {
-        super.setUp()
-    }
-    
-    override func tearDown() {
-        super.tearDown()
-    }
-    
-    
+ 
     func testMD5() {
         let key:Array<UInt8> = []
         let msg:Array<UInt8> = []
@@ -63,4 +54,13 @@ final class HMACTests: XCTestCase {
         let hmac = try! HMAC(key: key, variant: .sha512).authenticate(msg)
         XCTAssertEqual(hmac, expectedMac, "Invalid authentication result")
     }
+    
+    static let allTests =  [
+        ("testMD5", testMD5),
+        ("testSHA1", testSHA1),
+        ("testSHA256", testSHA256),
+        ("testSHA384", testSHA384),
+        ("testSHA512", testSHA512)
+    ]
+
 }

+ 21 - 27
CryptoSwiftTests/HashTests.swift → Tests/CryptoSwiftTests/HashTests.swift

@@ -7,29 +7,22 @@
 //
 
 import XCTest
+import Foundation
 @testable import CryptoSwift
 
-final class CryptoSwiftTests: XCTestCase {
+final class HashTests: XCTestCase {
     
-    override func setUp() {
-        super.setUp()
-    }
-    
-    override func tearDown() {
-        super.tearDown()
-    }
-    
-    func testMD5_data() {
+    func testMD5Data() {
         let data = [0x31, 0x32, 0x33] as Array<UInt8> // "1", "2", "3"
         XCTAssertEqual(Hash.md5(data), [0x20,0x2c,0xb9,0x62,0xac,0x59,0x07,0x5b,0x96,0x4b,0x07,0x15,0x2d,0x23,0x4b,0x70], "MD5 calculation failed");
     }
 
-    func testMD5_emptyString() {
-        let data:Data = "".data(using: String.Encoding.utf8, allowLossyConversion: false)!
+    func testMD5EmptyString() {
+        let data:Data = "".data(using: String.Encoding.utf8, allowLossyConversion: false) ?? Data()
         XCTAssertEqual(Hash.md5(data.bytes), [0xd4,0x1d,0x8c,0xd9,0x8f,0x00,0xb2,0x04,0xe9,0x80,0x09,0x98,0xec,0xf8,0x42,0x7e], "MD5 calculation failed")
     }
 
-    func testMD5_string() {
+    func testMD5String() {
         XCTAssertEqual("123".md5(), "202cb962ac59075b964b07152d234b70", "MD5 calculation failed");
         XCTAssertEqual("".md5(), "d41d8cd98f00b204e9800998ecf8427e", "MD5 calculation failed")
         XCTAssertEqual("a".md5(), "0cc175b9c0f1b6a831c399e269772661", "MD5 calculation failed")
@@ -49,20 +42,6 @@ final class CryptoSwiftTests: XCTestCase {
         })
     }
     
-    func testMD5PerformanceCommonCrypto() {
-        self.measureMetrics([XCTPerformanceMetric_WallClockTime], automaticallyStartMeasuring: false, for: { () -> Void in
-            let buf: UnsafeMutableRawPointer = calloc(1024 * 1024, MemoryLayout<UInt8>.size)
-            let data = NSData(bytes: buf, length: 1024 * 1024)
-            let md = UnsafeMutablePointer<UInt8>.allocate(capacity: Int(CC_MD5_DIGEST_LENGTH))
-            self.startMeasuring()
-            CC_MD5(data.bytes, CC_LONG(data.length), md)
-            self.stopMeasuring()
-            md.deallocate(capacity: Int(CC_MD5_DIGEST_LENGTH))
-            md.deinitialize()
-            buf.deallocate(bytes: 1024 * 1024, alignedTo: MemoryLayout<UInt8>.alignment)
-        })
-    }
-    
     func testSHA1() {
         let data:Data = Data(bytes: UnsafePointer<UInt8>([0x31, 0x32, 0x33] as Array<UInt8>), count: 3)
         if let hash = data.sha1() {
@@ -140,4 +119,19 @@ final class CryptoSwiftTests: XCTestCase {
         XCTAssert(data.checksum() == 0x96, "Invalid checksum")
     }
 
+    static let allTests =  [
+        ("testMD5Data", testMD5Data),
+        ("testMD5EmptyString", testMD5EmptyString),
+        ("testMD5String", testMD5String),
+        ("testMD5PerformanceSwift", testMD5PerformanceSwift),
+        ("testSHA1", testSHA1),
+        ("testSHA224", testSHA224),
+        ("testSHA256", testSHA256),
+        ("testSHA384", testSHA384),
+        ("testSHA512", testSHA512),
+        ("testCRC32", testCRC32),
+        ("testCRC32NotReflected", testCRC32NotReflected),
+        ("testCRC15", testCRC16),
+        ("testChecksum", testChecksum)
+    ]
 }

+ 0 - 0
CryptoSwiftTests/Helpers.swift → Tests/CryptoSwiftTests/Helpers.swift


+ 0 - 0
CryptoSwiftTests/Info.plist → Tests/CryptoSwiftTests/Info.plist


+ 9 - 11
CryptoSwiftTests/PBKDF.swift → Tests/CryptoSwiftTests/PBKDF.swift

@@ -11,33 +11,31 @@ import XCTest
 
 class PBKDF: XCTestCase {
 
-    override func setUp() {
-        super.setUp()
-    }
-
-    override func tearDown() {
-        super.tearDown()
-    }
-
-    func test_pbkdf1() {
+    func testPBKDF1() {
         let password: Array<UInt8> = [0x70,0x61,0x73,0x73,0x77,0x6F,0x72,0x64]
         let salt: Array<UInt8> = [0x78,0x57,0x8E,0x5A,0x5D,0x63,0xCB,0x06]
         let value = try! PKCS5.PBKDF1(password: password, salt: salt, iterations: 1000, keyLength: 16).calculate()
         XCTAssertEqual(value.toHexString(), "dc19847e05c64d2faf10ebfb4a3d2a20")
     }
 
-    func test_pbkdf2() {
+    func testPBKDF2() {
         let password: Array<UInt8> = "s33krit".utf8.map {$0}
         let salt: Array<UInt8> = "nacl".utf8.map {$0}
         let value = try! PKCS5.PBKDF2(password: password, salt: salt, iterations: 2, keyLength: 140, variant: .sha1).calculate()
         XCTAssert(value.toHexString() == "a53cf3df485e5cd91c17c4978048e3ca86e03cced5f748fb55eff9c1edfce7f9f490c0beee768b85c1ba14ec5750cf059fea52565ffd9e4f9dba01c5c953955e7f1012b6a9eb40629ce767982e598df9081048e22781b35187c16d61ac43f69b88630a9e80233b4c58bdc74ea5c06b5bb1b2c2a86e3ddc2775b852c4508ac85a6a47c0e23a3d8dc6e4dca583", "PBKDF2 fail")
     }
 
-    func test_pbkdf2_length() {
+    func testPBKDF2Length() {
         let password: Array<UInt8> = "s33krit".utf8.map {$0}
         let salt: Array<UInt8> = "nacl".utf8.map {$0}
         let value = try! PKCS5.PBKDF2(password: password, salt: salt, iterations: 2, keyLength: 8, variant: .sha1).calculate()
         XCTAssert(value.toHexString() == "a53cf3df485e5cd9", "PBKDF2 fail")
     }
 
+    static let allTests =  [
+        ("testPBKDF1", testPBKDF1),
+        ("testPBKDF2", testPBKDF2),
+        ("testPBKDF2Length", testPBKDF2Length)
+    ]
+    
 }

+ 7 - 0
CryptoSwiftTests/PaddingTests.swift → Tests/CryptoSwiftTests/PaddingTests.swift

@@ -43,4 +43,11 @@ final class PaddingTests: XCTestCase {
         XCTAssertEqual(padding.add(to: input, blockSize: 16), expected, "ZeroPadding failed")
         XCTAssertEqual(padding.remove(from: padding.add(to: input, blockSize: 16), blockSize: 16), input, "ZeroPadding failed")
     }
+    
+    static let allTests =  [
+        ("testPKCS7_0", testPKCS7_0),
+        ("testPKCS7_1", testPKCS7_1),
+        ("testPKCS7_2", testPKCS7_2),
+        ("testZeroPadding", testZeroPadding)
+    ]
 }

+ 5 - 9
CryptoSwiftTests/Poly1305Tests.swift → Tests/CryptoSwiftTests/Poly1305Tests.swift

@@ -6,19 +6,11 @@
 //  Copyright (c) 2014 Marcin Krzyzanowski. All rights reserved.
 //
 import XCTest
+import Foundation
 @testable import CryptoSwift
 
 final class Poly1305Tests: XCTestCase {
     
-    override func setUp() {
-        super.setUp()
-    }
-    
-    override func tearDown() {
-        super.tearDown()
-    }
-    
-    
     func testPoly1305() {
         let key:Array<UInt8> = [0xdd,0xde,0xdf,0xe0,0xe1,0xe2,0xe3,0xe4,0xe5,0xe6,0xe7,0xe8,0xe9,0xea,0xeb,0xec,0xed,0xee,0xef,0xf0,0xf1,0xf2,0xf3,0xf4,0xf5,0xf6,0xf7,0xf8,0xf9,0xfa,0xfb,0xfc]
         let msg:Array<UInt8> = [0x79,0x7a,0x7b,0x7c,0x7d,0x7e,0x7f,0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,0x90,0x91,0x92,0x93,0x94,0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x9f,0xa0,0xa1,0xa2,0xa3,0xa4,0xa5,0xa6,0xa7,0xa8,0xa9,0xaa,0xab,0xac,0xad,0xae,0xaf,0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7,0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf,0xc0,0xc1]
@@ -32,4 +24,8 @@ final class Poly1305Tests: XCTestCase {
         let mac2 = try! msgData.authenticate(with: Poly1305(key: key))
         XCTAssertEqual(mac2, Data(bytes: expectedMac), "Invalid authentication result")
     }
+    
+    static let allTests =  [
+        ("testPoly1305", testPoly1305)
+    ]
 }

+ 7 - 8
CryptoSwiftTests/RabbitTests.swift → Tests/CryptoSwiftTests/RabbitTests.swift

@@ -10,14 +10,6 @@ import XCTest
 @testable import CryptoSwift
 
 class RabbitTests: XCTestCase {
-    
-    override func setUp() {
-        super.setUp()
-    }
-    
-    override func tearDown() {
-        super.tearDown()
-    }
 
     func testInitialization() {
         var key = Array<UInt8>(repeating: 0, count: Rabbit.keySize - 1)
@@ -127,4 +119,11 @@ class RabbitTests: XCTestCase {
             XCTAssert(!encrypted.isEmpty, "not encrypted")
         })
     }
+    
+    static let allTests =  [
+        ("testInitialization", testInitialization),
+        ("testRabbitWithoutIV", testRabbitWithoutIV),
+        ("testRabbitWithIV", testRabbitWithIV),
+        ("testRabbitPerformance", testRabbitPerformance)
+    ]
 }

+ 15 - 0
Tests/LinuxMain.swift

@@ -0,0 +1,15 @@
+import XCTest
+@testable import CryptoSwiftTests
+
+XCTMain([
+    testCase(HashTests.allTests),
+    testCase(Poly1305Tests.allTests),
+    testCase(HMACTests.allTests),
+    testCase(AESTests.allTests),
+    testCase(ChaCha20Tests.allTests),
+    testCase(RabbitTests.allTests),
+    testCase(ExtensionsTest.allTests),
+    testCase(PaddingTests.allTests),
+    testCase(PBKDF.allTests),
+    testCase(Access.allTests)
+])