-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
148 additions
and
110 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,29 @@ | ||
// | ||
// Base58Tests.swift | ||
// | ||
// | ||
// Created by Yehor Popovych on 07/11/2023. | ||
// | ||
|
||
import XCTest | ||
import ScaleCodec | ||
@testable import Substrate | ||
|
||
final class Base58Tests: XCTestCase { | ||
func testEncDec() throws { | ||
try encDec(Data(hex: "6c13537af75e5a3b724db7334798f9084c192a2896e0c68a4216151b8e29bb32435f")!) | ||
} | ||
|
||
func testEncDecZeroes() throws { | ||
try encDec(Data(hex: "006c13537af75e5a3b724db7334798f9084c192a2896e0c68a4216151b8e29bb32435f")!) | ||
try encDec(Data(hex: "00006c13537af75e5a3b724db7334798f9084c192a2896e0c68a4216151b8e29bb32435f")!) | ||
try encDec(Data(hex: "0000006c13537af75e5a3b724db7334798f9084c192a2896e0c68a4216151b8e29bb32435f")!) | ||
try encDec(Data(hex: "000000006c13537af75e5a3b724db7334798f9084c192a2896e0c68a4216151b8e29bb32435f")!) | ||
} | ||
|
||
private func encDec(_ data: Data) throws { | ||
let encoded = Base58.encode(data) | ||
let decoded = try Base58.decode(encoded) | ||
XCTAssertEqual(data.hex(), decoded.hex()) | ||
} | ||
} |
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