Skip to content

Commit

Permalink
chore: isHex string extension tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JeneaVranceanu committed Nov 26, 2023
1 parent 3cadddd commit 01e1f6a
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions Tests/web3swiftTests/localTests/String+ExtensionTests.swift.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
//
// String+ExtensionTests.swift
//
// Created by JeneaVranceanu on 26.11.2023.
//

import Foundation
import XCTest

class StringExtensionsTest: XCTestCase {

func testIsHex() throws {
XCTAssertTrue("0x".isHex)
XCTAssertTrue("0xF".isHex)
XCTAssertTrue("F".isHex)
XCTAssertTrue("0xFF".isHex)
XCTAssertTrue("0x0123456789abcdefABCDEF".isHex)
XCTAssertTrue("0123456789abcdefABCDEF".isHex)
XCTAssertTrue("0123456789abcdefABCDEF ".isHex)
XCTAssertTrue(" 0123456789abcdefABCDEF ".isHex)
XCTAssertTrue(" 0123456789abcdefABCDEF".isHex)

XCTAssertFalse("".isHex)
XCTAssertFalse("-".isHex)
XCTAssertFalse("xyz".isHex)
XCTAssertFalse("0xCAFEQ".isHex)
XCTAssertFalse("R0123456789abcdefABCDEF ".isHex)
XCTAssertFalse(" R0123456789abcdefABCDEFT ".isHex)
}

}

0 comments on commit 01e1f6a

Please sign in to comment.