-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop'
- Loading branch information
Showing
63 changed files
with
1,411 additions
and
512 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// | ||
// web3.swift | ||
// Copyright © 2023 Argent Labs Limited. All rights reserved. | ||
// | ||
|
||
import XCTest | ||
@testable import web3 | ||
|
||
class EthereumAddressTests: XCTestCase { | ||
private var values: Set<EthereumAddress>! | ||
private let addr1 = EthereumAddress("0x162142f0508F557C02bEB7C473682D7C91Bcef41") | ||
private let addr1Padded = EthereumAddress("0x0162142f0508F557C02bEB7C473682D7C91Bcef41") | ||
private let addr2 = EthereumAddress("0x162142f0508F557C02bEB7C473682D7C91Bcef42") | ||
|
||
func testGivenAddress_WhenComparingWithSameAddressString_AddressIsEqual() { | ||
XCTAssertEqual(addr1, addr1) | ||
} | ||
|
||
func testGivenAddress_WhenHashingWithSameAddressString_AddressIsEqual() { | ||
values = [addr1] | ||
XCTAssertTrue(values.contains(addr1)) | ||
} | ||
|
||
func testGivenAddress_WhenComparingWithDifferentAddressString_AddressNotEqual() { | ||
XCTAssertNotEqual(addr1, addr2) | ||
} | ||
|
||
func testGivenAddress_WhenComparingWith0PaddedAddress_AddressIsEqual() { | ||
XCTAssertEqual(addr1, addr1Padded) | ||
} | ||
|
||
func testGivenAddress_WhenHashingWith0PaddedAddress_AddressIsEqual() { | ||
values = [addr1] | ||
XCTAssertTrue(values.contains(addr1Padded)) | ||
} | ||
|
||
func testGiven0PaddedAddress_WhenHashingWithNotPaddedAddress_AddressIsEqual() { | ||
values = [addr1Padded] | ||
XCTAssertTrue(values.contains(addr1)) | ||
} | ||
|
||
func testGivenAddress_WhenHashing_EqualToSameAddressHash() { | ||
XCTAssertEqual(addr1.hashValue, addr1.hashValue) | ||
} | ||
|
||
func testGivenAddress_WhenHashing_EqualToPaddedAddressHash() { | ||
XCTAssertEqual(addr1.hashValue, addr1Padded.hashValue) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.