From c69fea9be8ef00ed4cf3fa4c80f94390ad2fb2c2 Mon Sep 17 00:00:00 2001 From: Stephen Canon Date: Fri, 19 Jul 2024 16:15:50 -0400 Subject: [PATCH] Remove Int128 tests for now Most people are not yet using a toolchain with support for Int128; we'll re-enable these when we bump the baseline to Swift 6.0 --- Tests/IntegerUtilitiesTests/DivideTests.swift | 38 ------------------- Tests/IntegerUtilitiesTests/ShiftTests.swift | 30 --------------- 2 files changed, 68 deletions(-) diff --git a/Tests/IntegerUtilitiesTests/DivideTests.swift b/Tests/IntegerUtilitiesTests/DivideTests.swift index 71adccc..1dfc80b 100644 --- a/Tests/IntegerUtilitiesTests/DivideTests.swift +++ b/Tests/IntegerUtilitiesTests/DivideTests.swift @@ -467,44 +467,6 @@ final class IntegerUtilitiesDivideTests: XCTestCase { } } - @available(macOS 15, iOS 18, tvOS 18, watchOS 11, visionOS 2, *) - func divideUInt64(_ a: UInt64, _ b: UInt64, rounding rule: RoundingRule) { - let expected = UInt64(Int128(a).divided(by: Int128(b), rounding: rule).quotient) - let observed = a.divided(by: b, rounding: rule) - guard expected == observed else { - XCTFail(""" - \(a).divided(by: \(b), rounding: \(rule)) did not match expected result: - Computed with Int128: \(expected) - Computed with UInt64: \(observed) - """) - return - } - } - - @available(macOS 15, iOS 18, tvOS 18, watchOS 11, visionOS 2, *) - func testDivideUInt64() { - var values = [UInt64](repeating: 0, count: 64) - for i in 0 ..< values.count { - while values[i] == 0 { - values[i] = .random(in: .min ... .max) - } - } - for a in values { - for b in values where b != 0 { - divideUInt64(a, b, rounding: .down) - divideUInt64(a, b, rounding: .up) - divideUInt64(a, b, rounding: .towardZero) - divideUInt64(a, b, rounding: .awayFromZero) - divideUInt64(a, b, rounding: .toNearestOrDown) - divideUInt64(a, b, rounding: .toNearestOrUp) - divideUInt64(a, b, rounding: .toNearestOrZero) - divideUInt64(a, b, rounding: .toNearestOrAway) - divideUInt64(a, b, rounding: .toNearestOrEven) - divideUInt64(a, b, rounding: .toOdd) - } - } - } - // stochastically rounding doesn't have a deterministic "expected" answer, // but we know that the result must be either the floor or the ceiling. // The above tests ensure that, but that's not a very strong guarantee; diff --git a/Tests/IntegerUtilitiesTests/ShiftTests.swift b/Tests/IntegerUtilitiesTests/ShiftTests.swift index 2387082..47f62f5 100644 --- a/Tests/IntegerUtilitiesTests/ShiftTests.swift +++ b/Tests/IntegerUtilitiesTests/ShiftTests.swift @@ -167,32 +167,6 @@ final class IntegerUtilitiesShiftTests: XCTestCase { testRoundingShift(UInt.self, rounding: .toNearestOrEven) testRoundingShift(UInt.self, rounding: .toOdd) testRoundingShift(UInt.self, rounding: .stochastically) - - if #available(macOS 15, iOS 18, tvOS 18, watchOS 11, visionOS 2, *) { - testRoundingShift(Int128.self, rounding: .down) - testRoundingShift(Int128.self, rounding: .up) - testRoundingShift(Int128.self, rounding: .towardZero) - testRoundingShift(Int128.self, rounding: .awayFromZero) - testRoundingShift(Int128.self, rounding: .toNearestOrUp) - testRoundingShift(Int128.self, rounding: .toNearestOrDown) - testRoundingShift(Int128.self, rounding: .toNearestOrZero) - testRoundingShift(Int128.self, rounding: .toNearestOrAway) - testRoundingShift(Int128.self, rounding: .toNearestOrEven) - testRoundingShift(Int128.self, rounding: .toOdd) - testRoundingShift(Int128.self, rounding: .stochastically) - - testRoundingShift(UInt128.self, rounding: .down) - testRoundingShift(UInt128.self, rounding: .up) - testRoundingShift(UInt128.self, rounding: .towardZero) - testRoundingShift(UInt128.self, rounding: .awayFromZero) - testRoundingShift(UInt128.self, rounding: .toNearestOrUp) - testRoundingShift(UInt128.self, rounding: .toNearestOrDown) - testRoundingShift(UInt128.self, rounding: .toNearestOrZero) - testRoundingShift(UInt128.self, rounding: .toNearestOrAway) - testRoundingShift(UInt128.self, rounding: .toNearestOrEven) - testRoundingShift(UInt128.self, rounding: .toOdd) - testRoundingShift(UInt128.self, rounding: .stochastically) - } } // Stochastic rounding doesn't have a deterministic "expected" answer, @@ -247,10 +221,6 @@ final class IntegerUtilitiesShiftTests: XCTestCase { testStochasticAverage(UInt32.random(in: .min ... .max)) testStochasticAverage(Int64.random(in: .min ... .max)) testStochasticAverage(UInt64.random(in: .min ... .max)) - if #available(macOS 15, iOS 18, tvOS 18, watchOS 11, visionOS 2, *) { - testStochasticAverage(Int128.random(in: .min ... .max)) - testStochasticAverage(UInt128.random(in: .min ... .max)) - } testStochasticAverage(DoubleWidth.random(in: .min ... .max)) testStochasticAverage(DoubleWidth.random(in: .min ... .max)) }