Skip to content

Commit

Permalink
Add test case from #58 (#62)
Browse files Browse the repository at this point in the history
* add test case related to fixes from @mgriebling - thanks again
  • Loading branch information
twodayslate authored Mar 12, 2022
1 parent ed7ce30 commit b5f4834
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Tests/BIntTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
}
}

0 comments on commit b5f4834

Please sign in to comment.