Remove superfluous CustomStringConvertible impl

This commit is contained in:
Robert Thompson committed 2020-01-16 17:08:52 -05:00
1 parent fac716fdb2
commit d36d9ce02e
2 files changed
+5 -20

No files matched your search

-20
View File
@@ -89,26 +89,6 @@ extension BigInt: Comparable {
}
}
extension BigInt: CustomStringConvertible {
public var description: String {
var result = ""
if words.count == 1 {
return Int64(bitPattern: UInt64(words[0])).description
} else {
var next = abs(self)
while next != 0 {
let digit: BigInt
(next, digit) = BigInt._div(lhs: next, rhs: 10)
result += "\(digit.words[0])"
}
}
return (self < 0 ? "-" : "") + String(result.reversed())
}
}
extension BigInt: LosslessStringConvertible {
public init?(_ description: String) {
+5
View File
@@ -112,6 +112,11 @@ final class BigIntTests: XCTestCase {
XCTAssertEqual(baz, bar)
}
func testThing() {
let foo = BigInt("-1234567890123456789012345678901234567890")!
XCTAssertTrue(foo != 0)
}
func testComparable() {
let foo = BigInt("1234567890123456789012345678901234567890")!
let bar = foo * foo