-
Notifications
You must be signed in to change notification settings - Fork 444
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: added docs; new test for ABI.Element.Function;
- Loading branch information
1 parent
084a2cb
commit e6ff991
Showing
4 changed files
with
68 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// | ||
// ABIElementsTests.swift | ||
// | ||
// | ||
// Created by JeneaVranceanu on 09.01.2024. | ||
// | ||
|
||
import Foundation | ||
import XCTest | ||
@testable import web3swift | ||
@testable import Web3Core | ||
|
||
class ABIElementsTests: XCTestCase { | ||
|
||
func testABIElementFunction() { | ||
let test1Function = ABI.Element.Function(name: "Test1", | ||
inputs: [], | ||
outputs: [], | ||
constant: true, | ||
payable: false) | ||
|
||
XCTAssertEqual(test1Function.name, "Test1") | ||
XCTAssertEqual(test1Function.selector, String("Test1()".sha3(.keccak256).prefix(8))) | ||
XCTAssertEqual(test1Function.selectorEncoded, | ||
Data.fromHex("Test1()".sha3(.keccak256))?.prefix(4)) | ||
|
||
} | ||
|
||
} |