mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[stdlib] Fix FloatingPoint.init(exactly:) (#11311)
* [stdlib] Fix FloatingPoint.init(exactly:) This initializer wasn't actually checking the exact conversion. Corrects the tests as well.
This commit is contained in:
@@ -652,16 +652,12 @@ func testNSNumberBridgeFromUInt() {
|
||||
let uint = (number!) as? UInt
|
||||
expectEqual(UInt(exactly: interestingValue), uint)
|
||||
|
||||
// these are disabled because of https://bugs.swift.org/browse/SR-4634
|
||||
if uint! != UInt(UInt32.max) && uint! != UInt(UInt32.max - 1) {
|
||||
let float = (number!) as? Float
|
||||
let expectedFloat = Float(uint!)
|
||||
testFloat(expectedFloat, float)
|
||||
}
|
||||
|
||||
|
||||
let float = (number!) as? Float
|
||||
let expectedFloat = Float(exactly: uint!)
|
||||
testFloat(expectedFloat, float)
|
||||
|
||||
let double = (number!) as? Double
|
||||
let expectedDouble = Double(uint!)
|
||||
let expectedDouble = Double(exactly: uint!)
|
||||
testDouble(expectedDouble, double)
|
||||
}
|
||||
let bridged = interestingValue as NSNumber
|
||||
|
||||
Reference in New Issue
Block a user