diff --git a/Tests/BIntTests.swift b/Tests/BIntTests.swift index 43b924c..67d7e22 100644 --- a/Tests/BIntTests.swift +++ b/Tests/BIntTests.swift @@ -113,4 +113,17 @@ class BIntTests: XCTestCase { } } + /** An issue was reported where a hex string was not being converted to a decimal. This test case checks that. */ + func testIssue58() throws { + // 190000000000000000000 + let x = try XCTUnwrap(BInt("0x00000000000000000000000000000000000000000000000a4cc799563c380000")) + let y = try XCTUnwrap(BInt("0x00000000000000000000000000000000000000000000000a4cc799563c380000", radix:16)) + XCTAssertEqual(x, y) + for radix in 2...16 { + XCTAssertEqual(x.asString(radix: radix), y.asString(radix: radix)) + } + XCTAssertNotEqual(x, 0) + XCTAssertGreaterThan(x, BInt(Int32.max)) + XCTAssertEqual(x, BInt("190000000000000000000")) + } }