@@ -189,11 +189,11 @@ class web3swiftTransactionsTests: XCTestCase {
189
189
do {
190
190
let jsonTxn : EthereumTransaction = try JSONDecoder ( ) . decode ( EthereumTransaction . self, from: jsonData)
191
191
// check that the transaction type is legacy
192
- XCTAssert ( jsonTxn. type == . legacy)
192
+ XCTAssertEqual ( jsonTxn. type, . legacy, " Transaction Type Mismatch " )
193
193
// check the hash, if they match everything was parsed, and re-encoded correctly
194
- XCTAssert ( jsonTxn. hash!. toHexString ( ) . addHexPrefix ( ) == vector. hash)
194
+ XCTAssertEqual ( jsonTxn. hash!. toHexString ( ) . addHexPrefix ( ) , vector. hash, " Transaction Hash Mismatch " )
195
195
// check that we recovered the address correctly
196
- XCTAssert ( jsonTxn. sender!. address == expectedAddress. address)
196
+ XCTAssertEqual ( jsonTxn. sender!. address, expectedAddress. address, " Recovered Address Mismatch " )
197
197
} catch {
198
198
print ( error)
199
199
return XCTFail ( String ( describing: error) )
@@ -211,11 +211,11 @@ class web3swiftTransactionsTests: XCTestCase {
211
211
return XCTFail ( " Decoding RLP encoded transaction failed " )
212
212
}
213
213
// check that the transaction type is legacy
214
- XCTAssert ( rlpTxn. type == . legacy)
214
+ XCTAssertEqual ( rlpTxn. type, . legacy, " Transaction Type Mismatch " )
215
215
// check the hash, if they match everything was parsed, and re-encoded correctly
216
- XCTAssert ( rlpTxn. hash!. toHexString ( ) . addHexPrefix ( ) == vector. hash)
216
+ XCTAssertEqual ( rlpTxn. hash!. toHexString ( ) . addHexPrefix ( ) , vector. hash, " Transaction Hash Mismatch " )
217
217
// check that we recovered the address correctly
218
- XCTAssert ( rlpTxn. sender!. address == expectedAddress. address)
218
+ XCTAssertEqual ( rlpTxn. sender!. address, expectedAddress. address, " Recovered Address Mismatch " )
219
219
}
220
220
221
221
// test signing a fallback legacy transaction (chainId not part of the signing process)
@@ -237,11 +237,11 @@ class web3swiftTransactionsTests: XCTestCase {
237
237
let rawTxn = jsonTxn. encode ( ) !. toHexString ( ) . addHexPrefix ( )
238
238
239
239
// check the hash, if they match everything was parsed, and re-encoded correctly
240
- XCTAssert ( rawTxn == vector. RLP)
240
+ XCTAssertEqual ( rawTxn, vector. RLP, " Transaction Encoding Mismatch " )
241
241
// check the hash, if they match everything was parsed, and re-encoded correctly
242
- XCTAssert ( jsonTxn. hash!. toHexString ( ) . addHexPrefix ( ) == vector. hash)
242
+ XCTAssertEqual ( jsonTxn. hash!. toHexString ( ) . addHexPrefix ( ) , vector. hash, " Transaction Hash Mismatch " )
243
243
// check that we recovered the address correctly
244
- XCTAssert ( jsonTxn. sender!. address == expectedAddress. address)
244
+ XCTAssertEqual ( jsonTxn. sender!. address, expectedAddress. address, " Recovered Address Mismatch " )
245
245
} catch {
246
246
print ( error)
247
247
return XCTFail ( String ( describing: error) )
@@ -258,11 +258,11 @@ class web3swiftTransactionsTests: XCTestCase {
258
258
do {
259
259
let jsonTxn : EthereumTransaction = try JSONDecoder ( ) . decode ( EthereumTransaction . self, from: jsonData)
260
260
// check that the transaction type is legacy
261
- XCTAssert ( jsonTxn. type == . legacy)
261
+ XCTAssertEqual ( jsonTxn. type, . legacy, " Transaction Type Mismatch " )
262
262
// check the hash, if they match everything was parsed, and re-encoded correctly
263
- XCTAssert ( jsonTxn. hash!. toHexString ( ) . addHexPrefix ( ) == vector. hash)
263
+ XCTAssertEqual ( jsonTxn. hash!. toHexString ( ) . addHexPrefix ( ) , vector. hash, " Transaction Hash Mismatch " )
264
264
// check that we recovered the address correctly
265
- XCTAssert ( jsonTxn. sender!. address == expectedAddress. address)
265
+ XCTAssertEqual ( jsonTxn. sender!. address, expectedAddress. address, " Recovered Address Mismatch " )
266
266
} catch {
267
267
print ( error)
268
268
return XCTFail ( String ( describing: error) )
@@ -280,11 +280,11 @@ class web3swiftTransactionsTests: XCTestCase {
280
280
return XCTFail ( " Decoding RLP encoded transaction failed " )
281
281
}
282
282
// check that the transaction type is legacy
283
- XCTAssert ( rlpTxn. type == . legacy)
283
+ XCTAssertEqual ( rlpTxn. type, . legacy, " Transaction Type Mismatch " )
284
284
// check the hash, if they match everything was parsed, and re-encoded correctly
285
- XCTAssert ( rlpTxn. hash!. toHexString ( ) . addHexPrefix ( ) == vector. hash)
285
+ XCTAssertEqual ( rlpTxn. hash!. toHexString ( ) . addHexPrefix ( ) , vector. hash, " Transaction Hash Mismatch " )
286
286
// check that we recovered the address correctly
287
- XCTAssert ( rlpTxn. sender!. address == expectedAddress. address)
287
+ XCTAssertEqual ( rlpTxn. sender!. address, expectedAddress. address, " Recovered Address Mismatch " )
288
288
}
289
289
290
290
// test signing a normal legacy transaction conforming to EIP155
@@ -306,11 +306,11 @@ class web3swiftTransactionsTests: XCTestCase {
306
306
let rawTxn = jsonTxn. encode ( ) !. toHexString ( ) . addHexPrefix ( )
307
307
308
308
// check the hash, if they match everything was parsed, and re-encoded correctly
309
- XCTAssert ( rawTxn == vector. RLP)
309
+ XCTAssertEqual ( rawTxn, vector. RLP, " Transaction Encoding Mismatch " )
310
310
// check the hash, if they match everything was parsed, and re-encoded correctly
311
- XCTAssert ( jsonTxn. hash!. toHexString ( ) . addHexPrefix ( ) == vector. hash)
311
+ XCTAssertEqual ( jsonTxn. hash!. toHexString ( ) . addHexPrefix ( ) , vector. hash, " Transaction Hash Mismatch " )
312
312
// check that we recovered the address correctly
313
- XCTAssert ( jsonTxn. sender!. address == expectedAddress. address)
313
+ XCTAssertEqual ( jsonTxn. sender!. address, expectedAddress. address, " Recovered Address Mismatch " )
314
314
} catch {
315
315
print ( error)
316
316
return XCTFail ( String ( describing: error) )
@@ -327,11 +327,11 @@ class web3swiftTransactionsTests: XCTestCase {
327
327
do {
328
328
let jsonTxn : EthereumTransaction = try JSONDecoder ( ) . decode ( EthereumTransaction . self, from: jsonData)
329
329
// check that the transaction type is eip2930
330
- XCTAssert ( jsonTxn. type == . eip2930)
330
+ XCTAssertEqual ( jsonTxn. type, . eip2930, " Transaction Type Mismatch " )
331
331
// check the hash, if they match everything was parsed, and re-encoded correctly
332
- XCTAssert ( jsonTxn. hash!. toHexString ( ) . addHexPrefix ( ) == vector. hash)
332
+ XCTAssertEqual ( jsonTxn. hash!. toHexString ( ) . addHexPrefix ( ) , vector. hash, " Transaction Hash Mismatch " )
333
333
// check that we recovered the address correctly
334
- XCTAssert ( jsonTxn. sender!. address == expectedAddress. address)
334
+ XCTAssertEqual ( jsonTxn. sender!. address, expectedAddress. address, " Recovered Address Mismatch " )
335
335
} catch {
336
336
print ( error)
337
337
return XCTFail ( String ( describing: error) )
@@ -349,11 +349,11 @@ class web3swiftTransactionsTests: XCTestCase {
349
349
return XCTFail ( " Decoding RLP encoded transaction failed " )
350
350
}
351
351
// check that the transaction type is eip2930
352
- XCTAssert ( rlpTxn. type == . eip2930)
352
+ XCTAssertEqual ( rlpTxn. type, . eip2930, " Transaction Type Mismatch " )
353
353
// check the hash, if they match everything was parsed, and re-encoded correctly
354
- XCTAssert ( rlpTxn. hash!. toHexString ( ) . addHexPrefix ( ) == vector. hash)
354
+ XCTAssertEqual ( rlpTxn. hash!. toHexString ( ) . addHexPrefix ( ) , vector. hash, " Transaction Hash Mismatch " )
355
355
// check that we recovered the address correctly
356
- XCTAssert ( rlpTxn. sender!. address == expectedAddress. address)
356
+ XCTAssertEqual ( rlpTxn. sender!. address, expectedAddress. address, " Recovered Address Mismatch " )
357
357
}
358
358
359
359
// test signing a EIP-2930 transaction (without accessList)
@@ -375,11 +375,11 @@ class web3swiftTransactionsTests: XCTestCase {
375
375
let rawTxn = jsonTxn. encode ( ) !. toHexString ( ) . addHexPrefix ( )
376
376
377
377
// check the hash, if they match everything was parsed, and re-encoded correctly
378
- XCTAssert ( rawTxn == vector. RLP)
378
+ XCTAssertEqual ( rawTxn, vector. RLP, " Transaction Encoding Mismatch " )
379
379
// check the hash, if they match everything was parsed, and re-encoded correctly
380
- XCTAssert ( jsonTxn. hash!. toHexString ( ) . addHexPrefix ( ) == vector. hash)
380
+ XCTAssertEqual ( jsonTxn. hash!. toHexString ( ) . addHexPrefix ( ) , vector. hash, " Transaction Hash Mismatch " )
381
381
// check that we recovered the address correctly
382
- XCTAssert ( jsonTxn. sender!. address == expectedAddress. address)
382
+ XCTAssertEqual ( jsonTxn. sender!. address, expectedAddress. address, " Recovered Address Mismatch " )
383
383
} catch {
384
384
print ( error)
385
385
return XCTFail ( String ( describing: error) )
@@ -396,11 +396,11 @@ class web3swiftTransactionsTests: XCTestCase {
396
396
do {
397
397
let jsonTxn : EthereumTransaction = try JSONDecoder ( ) . decode ( EthereumTransaction . self, from: jsonData)
398
398
// check that the transaction type is eip2930
399
- XCTAssert ( jsonTxn. type == . eip2930)
399
+ XCTAssertEqual ( jsonTxn. type, . eip2930, " Transaction Type Mismatch " )
400
400
// check the hash, if they match everything was parsed, and re-encoded correctly
401
- XCTAssert ( jsonTxn. hash!. toHexString ( ) . addHexPrefix ( ) == vector. hash)
401
+ XCTAssertEqual ( jsonTxn. hash!. toHexString ( ) . addHexPrefix ( ) , vector. hash, " Transaction Hash Mismatch " )
402
402
// check that we recovered the address correctly
403
- XCTAssert ( jsonTxn. sender!. address == expectedAddress. address)
403
+ XCTAssertEqual ( jsonTxn. sender!. address, expectedAddress. address, " Recovered Address Mismatch " )
404
404
} catch {
405
405
print ( error)
406
406
return XCTFail ( String ( describing: error) )
@@ -418,11 +418,11 @@ class web3swiftTransactionsTests: XCTestCase {
418
418
return XCTFail ( " Decoding RLP encoded transaction failed " )
419
419
}
420
420
// check that the transaction type is eip2930
421
- XCTAssert ( rlpTxn. type == . eip2930)
421
+ XCTAssertEqual ( rlpTxn. type, . eip2930, " Transaction Type Mismatch " )
422
422
// check the hash, if they match everything was parsed, and re-encoded correctly
423
- XCTAssert ( rlpTxn. hash!. toHexString ( ) . addHexPrefix ( ) == vector. hash)
423
+ XCTAssertEqual ( rlpTxn. hash!. toHexString ( ) . addHexPrefix ( ) , vector. hash, " Transaction Hash Mismatch " )
424
424
// check that we recovered the address correctly
425
- XCTAssert ( rlpTxn. sender!. address == expectedAddress. address)
425
+ XCTAssertEqual ( rlpTxn. sender!. address, expectedAddress. address, " Recovered Address Mismatch " )
426
426
}
427
427
428
428
// test signing a EIP-2930 transaction (with accessList)
@@ -444,11 +444,11 @@ class web3swiftTransactionsTests: XCTestCase {
444
444
let rawTxn = jsonTxn. encode ( ) !. toHexString ( ) . addHexPrefix ( )
445
445
446
446
// check the hash, if they match everything was parsed, and re-encoded correctly
447
- XCTAssert ( rawTxn == vector. RLP)
447
+ XCTAssertEqual ( rawTxn, vector. RLP, " Transaction Encoding Mismatch " )
448
448
// check the hash, if they match everything was parsed, and re-encoded correctly
449
- XCTAssert ( jsonTxn. hash!. toHexString ( ) . addHexPrefix ( ) == vector. hash)
449
+ XCTAssertEqual ( jsonTxn. hash!. toHexString ( ) . addHexPrefix ( ) , vector. hash, " Transaction Hash Mismatch " )
450
450
// check that we recovered the address correctly
451
- XCTAssert ( jsonTxn. sender!. address == expectedAddress. address)
451
+ XCTAssertEqual ( jsonTxn. sender!. address, expectedAddress. address, " Recovered Address Mismatch " )
452
452
} catch {
453
453
print ( error)
454
454
return XCTFail ( String ( describing: error) )
@@ -465,11 +465,11 @@ class web3swiftTransactionsTests: XCTestCase {
465
465
do {
466
466
let jsonTxn : EthereumTransaction = try JSONDecoder ( ) . decode ( EthereumTransaction . self, from: jsonData)
467
467
// check that the transaction type is eip1559
468
- XCTAssert ( jsonTxn. type == . eip1559)
468
+ XCTAssertEqual ( jsonTxn. type, . eip1559, " Transaction Type Mismatch " )
469
469
// check the hash, if they match everything was parsed, and re-encoded correctly
470
- XCTAssert ( jsonTxn. hash!. toHexString ( ) . addHexPrefix ( ) == vector. hash)
470
+ XCTAssertEqual ( jsonTxn. hash!. toHexString ( ) . addHexPrefix ( ) , vector. hash, " Transaction Hash Mismatch " )
471
471
// check that we recovered the address correctly
472
- XCTAssert ( jsonTxn. sender!. address == expectedAddress. address)
472
+ XCTAssertEqual ( jsonTxn. sender!. address, expectedAddress. address, " Recovered Address Mismatch " )
473
473
} catch {
474
474
print ( error)
475
475
return XCTFail ( String ( describing: error) )
@@ -487,11 +487,11 @@ class web3swiftTransactionsTests: XCTestCase {
487
487
return XCTFail ( " Decoding RLP encoded transaction failed " )
488
488
}
489
489
// check that the transaction type is eip1559
490
- XCTAssert ( rlpTxn. type == . eip1559)
490
+ XCTAssertEqual ( rlpTxn. type, . eip1559, " Transaction Type Mismatch " )
491
491
// check the hash, if they match everything was parsed, and re-encoded correctly
492
- XCTAssert ( rlpTxn. hash!. toHexString ( ) . addHexPrefix ( ) == vector. hash)
492
+ XCTAssertEqual ( rlpTxn. hash!. toHexString ( ) . addHexPrefix ( ) , vector. hash, " Transaction Hash Mismatch " )
493
493
// check that we recovered the address correctly
494
- XCTAssert ( rlpTxn. sender!. address == expectedAddress. address)
494
+ XCTAssertEqual ( rlpTxn. sender!. address, expectedAddress. address, " Recovered Address Mismatch " )
495
495
}
496
496
497
497
// test signing a EIP-1559 transaction (without accessList)
@@ -513,11 +513,11 @@ class web3swiftTransactionsTests: XCTestCase {
513
513
let rawTxn = jsonTxn. encode ( ) !. toHexString ( ) . addHexPrefix ( )
514
514
515
515
// check the hash, if they match everything was parsed, and re-encoded correctly
516
- XCTAssert ( rawTxn == vector. RLP)
516
+ XCTAssertEqual ( rawTxn, vector. RLP, " Transaction Encoding Mismatch " )
517
517
// check the hash, if they match everything was parsed, and re-encoded correctly
518
- XCTAssert ( jsonTxn. hash!. toHexString ( ) . addHexPrefix ( ) == vector. hash)
518
+ XCTAssertEqual ( jsonTxn. hash!. toHexString ( ) . addHexPrefix ( ) , vector. hash, " Transaction Hash Mismatch " )
519
519
// check that we recovered the address correctly
520
- XCTAssert ( jsonTxn. sender!. address == expectedAddress. address)
520
+ XCTAssertEqual ( jsonTxn. sender!. address, expectedAddress. address, " Recovered Address Mismatch " )
521
521
} catch {
522
522
print ( error)
523
523
return XCTFail ( String ( describing: error) )
@@ -534,11 +534,11 @@ class web3swiftTransactionsTests: XCTestCase {
534
534
do {
535
535
let jsonTxn : EthereumTransaction = try JSONDecoder ( ) . decode ( EthereumTransaction . self, from: jsonData)
536
536
// check that the transaction type is eip1559
537
- XCTAssert ( jsonTxn. type == . eip1559)
537
+ XCTAssertEqual ( jsonTxn. type, . eip1559, " Transaction Type Mismatch " )
538
538
// check the hash, if they match everything was parsed, and re-encoded correctly
539
- XCTAssert ( jsonTxn. hash!. toHexString ( ) . addHexPrefix ( ) == vector. hash)
539
+ XCTAssertEqual ( jsonTxn. hash!. toHexString ( ) . addHexPrefix ( ) , vector. hash, " Transaction Hash Mismatch " )
540
540
// check that we recovered the address correctly
541
- XCTAssert ( jsonTxn. sender!. address == expectedAddress. address)
541
+ XCTAssertEqual ( jsonTxn. sender!. address, expectedAddress. address, " Recovered Address Mismatch " )
542
542
} catch {
543
543
print ( error)
544
544
return XCTFail ( String ( describing: error) )
@@ -556,11 +556,11 @@ class web3swiftTransactionsTests: XCTestCase {
556
556
return XCTFail ( " Decoding RLP encoded transaction failed " )
557
557
}
558
558
// check that the transaction type is eip1559
559
- XCTAssert ( rlpTxn. type == . eip1559)
559
+ XCTAssertEqual ( rlpTxn. type, . eip1559, " Transaction Type Mismatch " )
560
560
// check the hash, if they match everything was parsed, and re-encoded correctly
561
- XCTAssert ( rlpTxn. hash!. toHexString ( ) . addHexPrefix ( ) == vector. hash)
561
+ XCTAssertEqual ( rlpTxn. hash!. toHexString ( ) . addHexPrefix ( ) , vector. hash, " Transaction Hash Mismatch " )
562
562
// check that we recovered the address correctly
563
- XCTAssert ( rlpTxn. sender!. address == expectedAddress. address)
563
+ XCTAssertEqual ( rlpTxn. sender!. address, expectedAddress. address, " Recovered Address Mismatch " )
564
564
}
565
565
566
566
// test signing a EIP-1559 transaction (with accessList)
@@ -582,18 +582,19 @@ class web3swiftTransactionsTests: XCTestCase {
582
582
let rawTxn = jsonTxn. encode ( ) !. toHexString ( ) . addHexPrefix ( )
583
583
584
584
// check the hash, if they match everything was parsed, and re-encoded correctly
585
- XCTAssert ( rawTxn == vector. RLP)
585
+ XCTAssertEqual ( rawTxn, vector. RLP, " Transaction Encoding Mismatch " )
586
586
// check the hash, if they match everything was parsed, and re-encoded correctly
587
- XCTAssert ( jsonTxn. hash!. toHexString ( ) . addHexPrefix ( ) == vector. hash)
587
+ XCTAssertEqual ( jsonTxn. hash!. toHexString ( ) . addHexPrefix ( ) , vector. hash, " Transaction Hash Mismatch " )
588
588
// check that we recovered the address correctly
589
- XCTAssert ( jsonTxn. sender!. address == expectedAddress. address)
589
+ XCTAssertEqual ( jsonTxn. sender!. address, expectedAddress. address, " Recovered Address Mismatch " )
590
590
} catch {
591
591
print ( error)
592
592
return XCTFail ( String ( describing: error) )
593
593
}
594
594
}
595
595
596
596
// ***** Legacy Tests *****
597
+ // TODO: Replace `XCTAssert` with more explicite `XCTAssertEqual`, where Applicable
597
598
598
599
func testDirectTransaction( ) throws {
599
600
do {
0 commit comments