swift-numerics icon indicating copy to clipboard operation
swift-numerics copied to clipboard

[BigInt tests] ❌ Unary `+`, `-` and `~`

Open LiarPrincess opened this issue 2 years ago • 0 comments
trafficstars

Please read the #242 Using tests from “Violet - Python VM written in Swift” before.


❌ Failures

  func test_unaryMinus() {
    // -9223372036854775808 = Int.min
    // 'Int.min' negation overflows
    let int = -9223372036854775808
    let expected = BigInt(.positive, magnitude: BigIntPrototype.Word(int.magnitude))

    let big = -BigInt(int)
    XCTAssertEqual(big, expected)

    var negated = BigInt(int)
    negated.negate()
    XCTAssertEqual(negated, expected, "\(negated) == \(expected)")
  }

LiarPrincess avatar Jan 18 '23 15:01 LiarPrincess