@@ -11,6 +11,8 @@ import CryptoSwift
1111
1212class web3swift_Keystores_tests : XCTestCase {
1313
14+ let mnemonic = " fruit wave dwarf banana earth journey tattoo true farm silk olive fence "
15+
1416 func testBIP39 ( ) {
1517 var entropy = Data . fromHex ( " 00000000000000000000000000000000 " ) !
1618 var phrase = BIP39 . generateMnemonicsFromEntropy ( entropy: entropy)
@@ -88,7 +90,6 @@ class web3swift_Keystores_tests: XCTestCase {
8890 }
8991
9092 func testBIP32keystoreMatching( ) {
91- let mnemonic = " fruit wave dwarf banana earth journey tattoo true farm silk olive fence "
9293 let keystore = try ! BIP32Keystore ( mnemonics: mnemonic, password: " " , mnemonicsPassword: " banana " )
9394 XCTAssertNotNil ( keystore)
9495 let account = keystore!. addresses![ 0 ]
@@ -98,15 +99,13 @@ class web3swift_Keystores_tests: XCTestCase {
9899 }
99100
100101 func testBIP32keystoreMatchingRootNode( ) {
101- let mnemonic = " fruit wave dwarf banana earth journey tattoo true farm silk olive fence "
102102 let keystore = try ! BIP32Keystore ( mnemonics: mnemonic, password: " " , mnemonicsPassword: " banana " )
103103 XCTAssertNotNil ( keystore)
104104 let rootNode = try ! keystore!. serializeRootNodeToString ( password: " " )
105105 XCTAssert ( rootNode == " xprvA2KM71v838kPwE8Lfr12m9DL939TZmPStMnhoFcZkr1nBwDXSG7c3pjYbMM9SaqcofK154zNSCp7W7b4boEVstZu1J3pniLQJJq7uvodfCV " )
106106 }
107107
108108 func testBIP32keystoreCustomPathMatching( ) {
109- let mnemonic = " fruit wave dwarf banana earth journey tattoo true farm silk olive fence "
110109 let keystore = try ! BIP32Keystore ( mnemonics: mnemonic, password: " " , mnemonicsPassword: " banana " , prefixPath: " m/44'/60'/0'/0 " )
111110 XCTAssertNotNil ( keystore)
112111 let account = keystore!. addresses![ 0 ]
@@ -156,8 +155,8 @@ class web3swift_Keystores_tests: XCTestCase {
156155 print ( recreatedStore!. addresses![ 0 ] . address)
157156 print ( recreatedStore!. addresses![ 1 ] . address)
158157 // This will fail. It wont fail if use scrypt from pod 'scrypt', '2.0', not from CryptoSwift
159- XCTAssert ( keystore? . addresses![ 0 ] == recreatedStore? . addresses![ 1 ] )
160- XCTAssert ( keystore? . addresses![ 1 ] == recreatedStore? . addresses![ 0 ] )
158+ XCTAssert ( keystore? . addresses![ 1 ] == recreatedStore? . addresses![ 1 ] )
159+ XCTAssert ( keystore? . addresses![ 0 ] == recreatedStore? . addresses![ 0 ] )
161160 }
162161
163162 // func testPBKDF2() {
0 commit comments