File tree Expand file tree Collapse file tree 1 file changed +31
-1
lines changed
Tests/web3swiftTests/localTests Expand file tree Collapse file tree 1 file changed +31
-1
lines changed Original file line number Diff line number Diff line change 11//
2- // File .swift
2+ // EthereumAddressTest .swift
33//
44//
55// Created by JeneaVranceanu on 03.02.2023.
66//
77
88import Foundation
9+ import XCTest
10+
11+ @testable import Web3Core
12+
13+ class EthereumAddressTest : XCTestCase {
14+
15+ func testZeroAddress( ) {
16+ XCTAssertNotNil ( EthereumAddress ( Data ( count: 20 ) ) )
17+ }
18+
19+ func testAddress( ) {
20+ let rawAddress = " 0x200eb5ccda1c35b0f5bf82552fdd65a8aee98e79 "
21+ let ethereumAddress = EthereumAddress ( rawAddress)
22+ XCTAssertNotNil ( ethereumAddress)
23+ XCTAssertEqual ( ethereumAddress? . address. lowercased ( ) , rawAddress)
24+ }
25+
26+ func testInvalidAddress( ) {
27+ var rawAddress = " 0x200eb5ccda1c35b0f5bf82552e98e79 "
28+ var ethereumAddress = EthereumAddress ( rawAddress)
29+ XCTAssertNil ( ethereumAddress)
30+ rawAddress = " 0x200eb5ccDA1c35b0f5bf82552fdd65a8aeeabcde "
31+ ethereumAddress = EthereumAddress ( rawAddress)
32+ XCTAssertNil ( ethereumAddress)
33+ rawAddress = " 0x200eb5ccda1c35b0f5bf82552fdd65a8aeeabcdef "
34+ ethereumAddress = EthereumAddress ( rawAddress)
35+ XCTAssertNil ( ethereumAddress)
36+ }
37+
38+ }
You can’t perform that action at this time.
0 commit comments