mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[test] Fix Int128 test on 32-bit platforms
The test used Int.min and Int.max assuming that they are 64-bit integers. Use 64-bit integers explicitly instead.
This commit is contained in:
@@ -310,49 +310,49 @@ Int128Tests.test("Conversion from integers") {
|
||||
expectEqual(Int128(truncatingIfNeeded: Int8.min), -0x80)
|
||||
expectEqual(Int128(truncatingIfNeeded: Int8.max), 0x0000000000000000_000000000000007f)
|
||||
expectEqual(Int128(truncatingIfNeeded: UInt8.max), 0x0000000000000000_00000000000000ff)
|
||||
expectEqual(Int128(truncatingIfNeeded: Int.min), -0x8000000000000000)
|
||||
expectEqual(Int128(truncatingIfNeeded: Int.max), 0x0000000000000000_7fffffffffffffff)
|
||||
expectEqual(Int128(truncatingIfNeeded: UInt.max), 0x0000000000000000_ffffffffffffffff)
|
||||
expectEqual(Int128(truncatingIfNeeded: Int64.min), -0x8000000000000000)
|
||||
expectEqual(Int128(truncatingIfNeeded: Int64.max), 0x0000000000000000_7fffffffffffffff)
|
||||
expectEqual(Int128(truncatingIfNeeded: UInt64.max), 0x0000000000000000_ffffffffffffffff)
|
||||
|
||||
expectEqual(Int128(exactly: -1), -1)
|
||||
expectEqual(Int128(exactly: Int8.min), -0x80)
|
||||
expectEqual(Int128(exactly: Int8.max), 0x7f)
|
||||
expectEqual(Int128(exactly: UInt8.max), 0xff)
|
||||
expectEqual(Int128(exactly: Int.min), -0x8000000000000000)
|
||||
expectEqual(Int128(exactly: Int.max), 0x7fffffffffffffff)
|
||||
expectEqual(Int128(exactly: UInt.max), 0xffffffffffffffff)
|
||||
expectEqual(Int128(exactly: Int64.min), -0x8000000000000000)
|
||||
expectEqual(Int128(exactly: Int64.max), 0x7fffffffffffffff)
|
||||
expectEqual(Int128(exactly: UInt64.max), 0xffffffffffffffff)
|
||||
|
||||
expectEqual(Int128(clamping: -1), -1)
|
||||
expectEqual(Int128(clamping: Int8.min), -0x80)
|
||||
expectEqual(Int128(clamping: Int8.max), 0x7f)
|
||||
expectEqual(Int128(clamping: UInt8.max), 0xff)
|
||||
expectEqual(Int128(clamping: Int.min), -0x8000000000000000)
|
||||
expectEqual(Int128(clamping: Int.max), 0x7fffffffffffffff)
|
||||
expectEqual(Int128(clamping: UInt.max), 0xffffffffffffffff)
|
||||
expectEqual(Int128(clamping: Int64.min), -0x8000000000000000)
|
||||
expectEqual(Int128(clamping: Int64.max), 0x7fffffffffffffff)
|
||||
expectEqual(Int128(clamping: UInt64.max), 0xffffffffffffffff)
|
||||
|
||||
expectEqual(UInt128(truncatingIfNeeded: -1), 0xffffffffffffffff_ffffffffffffffff)
|
||||
expectEqual(UInt128(truncatingIfNeeded: Int8.min), 0xffffffffffffffff_ffffffffffffff80)
|
||||
expectEqual(UInt128(truncatingIfNeeded: Int8.max), 0x0000000000000000_000000000000007f)
|
||||
expectEqual(UInt128(truncatingIfNeeded: UInt8.max),0x0000000000000000_00000000000000ff)
|
||||
expectEqual(UInt128(truncatingIfNeeded: Int.min), 0xffffffffffffffff_8000000000000000)
|
||||
expectEqual(UInt128(truncatingIfNeeded: Int.max), 0x0000000000000000_7fffffffffffffff)
|
||||
expectEqual(UInt128(truncatingIfNeeded: UInt.max), 0x0000000000000000_ffffffffffffffff)
|
||||
expectEqual(UInt128(truncatingIfNeeded: Int64.min), 0xffffffffffffffff_8000000000000000)
|
||||
expectEqual(UInt128(truncatingIfNeeded: Int64.max), 0x0000000000000000_7fffffffffffffff)
|
||||
expectEqual(UInt128(truncatingIfNeeded: UInt64.max), 0x0000000000000000_ffffffffffffffff)
|
||||
|
||||
expectEqual(UInt128(exactly: -1), nil)
|
||||
expectEqual(UInt128(exactly: Int8.min), nil)
|
||||
expectEqual(UInt128(exactly: Int8.max), 0x7f)
|
||||
expectEqual(UInt128(exactly: UInt8.max), 0xff)
|
||||
expectEqual(UInt128(exactly: Int.min), nil)
|
||||
expectEqual(UInt128(exactly: Int.max), 0x7fffffffffffffff)
|
||||
expectEqual(UInt128(exactly: UInt.max), 0xffffffffffffffff)
|
||||
expectEqual(UInt128(exactly: Int64.min), nil)
|
||||
expectEqual(UInt128(exactly: Int64.max), 0x7fffffffffffffff)
|
||||
expectEqual(UInt128(exactly: UInt64.max), 0xffffffffffffffff)
|
||||
|
||||
expectEqual(UInt128(clamping: -1), 0)
|
||||
expectEqual(UInt128(clamping: Int8.min), 0)
|
||||
expectEqual(UInt128(clamping: Int8.max), 0x7f)
|
||||
expectEqual(UInt128(clamping: UInt8.max),0xff)
|
||||
expectEqual(UInt128(clamping: Int.min), 0)
|
||||
expectEqual(UInt128(clamping: Int.max), 0x7fffffffffffffff)
|
||||
expectEqual(UInt128(clamping: UInt.max), 0xffffffffffffffff)
|
||||
expectEqual(UInt128(clamping: Int64.min), 0)
|
||||
expectEqual(UInt128(clamping: Int64.max), 0x7fffffffffffffff)
|
||||
expectEqual(UInt128(clamping: UInt64.max), 0xffffffffffffffff)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user