-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
DataExtensionTests.swift
42 lines (34 loc) · 1.13 KB
/
DataExtensionTests.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//
// DataExtensionTests.swift
// DataExtensionTests
//
// Created by Sjors Provoost on 05/12/2019.
// Copyright © 2019 Sjors Provoost. Distributed under the MIT software
// license, see the accompanying file LICENSE.md
import XCTest
class DataExtensionTests: XCTestCase {
override func setUp() {
// Put setup code here. This method is called before the invocation of each test method in the class.
}
override func tearDown() {
// Put teardown code here. This method is called after the invocation of each test method in the class.
}
func testHexString() {
let hexString = "01234567890abcde"
let data = Data(hexString)
XCTAssertEqual(data?.hexString, hexString)
}
func testToBase58() {
let data = Data("01234567890abcde")
XCTAssertEqual(data?.base58, "2FEDkTt23zPwhDwc")
}
func testFromBase58() {
let base58 = "2FEDkTt23zPwhDwc"
let data = Data(base58: base58)
XCTAssertEqual(data?.hexString, "01234567890abcde")
}
func testInvalidCharacter() {
let base58 = "💩"
XCTAssertNil(Data(base58: base58))
}
}