@@ -245,14 +245,7 @@ class TestNSNumberBridging : XCTestCase {
245
245
246
246
let float = Float ( exactly: number!)
247
247
let expectedFloat = Float ( exactly: int32!)
248
- if int32! != Int32 . min + 1 && int32! < Int32 . max - 1 {
249
- testFloat ( expectedFloat, float)
250
- } else {
251
- // FIXME: Exact conversions to NSNumber succeeding incorrectly
252
- // https://bugs.swift.org/browse/SR-6322
253
- // XCTAssertNil(float)
254
- // XCTAssertNil(expectedFloat)
255
- }
248
+ testFloat ( expectedFloat, float)
256
249
257
250
let double = Double ( exactly: number!)
258
251
let expectedDouble = Double ( exactly: int32!)
@@ -292,14 +285,7 @@ class TestNSNumberBridging : XCTestCase {
292
285
293
286
let float = Float ( exactly: number!)
294
287
let expectedFloat = Float ( exactly: uint32!)
295
- if uint32! < UInt32 . max - 1 {
296
- testFloat ( expectedFloat, float)
297
- } else {
298
- // FIXME: Exact conversions to NSNumber succeeding incorrectly
299
- // https://bugs.swift.org/browse/SR-6322
300
- // XCTAssertNil(float)
301
- // XCTAssertNil(expectedFloat)
302
- }
288
+ testFloat ( expectedFloat, float)
303
289
304
290
let double = Double ( exactly: number!)
305
291
let expectedDouble = Double ( exactly: uint32!)
@@ -338,17 +324,12 @@ class TestNSNumberBridging : XCTestCase {
338
324
XCTAssertEqual ( UInt ( exactly: interestingValue) , uint)
339
325
340
326
let float = Float ( exactly: number!)
327
+ let expectedFloat = Float ( exactly: int64!)
328
+ testFloat ( expectedFloat, float)
329
+
341
330
let double = Double ( exactly: number!)
342
- if int64! != Int64 . min + 1 && int64! < Int64 . max - 1 {
343
- // Note: Double/Float(exactly: Int64.min) != nil
344
- XCTAssertEqual ( Float ( interestingValue) , float)
345
- XCTAssertEqual ( Double ( interestingValue) , double)
346
- } else {
347
- // FIXME: Exact conversions to NSNumber succeeding incorrectly
348
- // https://bugs.swift.org/browse/SR-6322
349
- // XCTAssertNil(float)
350
- // XCTAssertNil(double)
351
- }
331
+ let expectedDouble = Double ( exactly: int64!)
332
+ testDouble ( expectedDouble, double)
352
333
}
353
334
let bridged = interestingValue. _bridgeToObjectiveC ( )
354
335
testNumber ( bridged)
@@ -383,16 +364,12 @@ class TestNSNumberBridging : XCTestCase {
383
364
XCTAssertEqual ( UInt ( exactly: interestingValue) , uint)
384
365
385
366
let float = Float ( exactly: number!)
367
+ let expectedFloat = Float ( exactly: uint64!)
368
+ testFloat ( expectedFloat, float)
369
+
386
370
let double = Double ( exactly: number!)
387
- if uint64! < UInt64 . max - 1 {
388
- XCTAssertEqual ( Float ( interestingValue) , float)
389
- XCTAssertEqual ( Double ( interestingValue) , double)
390
- } else {
391
- // FIXME: Exact conversions to NSNumber succeeding incorrectly
392
- // https://bugs.swift.org/browse/SR-6322
393
- // XCTAssertNil(float)
394
- // XCTAssertNil(double)
395
- }
371
+ let expectedDouble = Double ( exactly: uint64!)
372
+ testDouble ( expectedDouble, double)
396
373
}
397
374
let bridged = interestingValue. _bridgeToObjectiveC ( )
398
375
testNumber ( bridged)
@@ -427,17 +404,12 @@ class TestNSNumberBridging : XCTestCase {
427
404
XCTAssertEqual ( UInt ( exactly: interestingValue) , uint)
428
405
429
406
let float = Float ( exactly: number!)
407
+ let expectedFloat = Float ( exactly: int!)
408
+ testFloat ( expectedFloat, float)
409
+
430
410
let double = Double ( exactly: number!)
431
- if int! != Int . min + 1 && int! < Int . max - 1 {
432
- // Double/Float(exactly: Int.min) != nil
433
- XCTAssertEqual ( Float ( interestingValue) , float)
434
- XCTAssertEqual ( Double ( interestingValue) , double)
435
- } else {
436
- // FIXME: Exact conversions to NSNumber succeeding incorrectly
437
- // https://bugs.swift.org/browse/SR-6322
438
- // XCTAssertNil(float)
439
- // XCTAssertNil(double)
440
- }
411
+ let expectedDouble = Double ( exactly: int!)
412
+ testDouble ( expectedDouble, double)
441
413
}
442
414
let bridged = interestingValue. _bridgeToObjectiveC ( )
443
415
testNumber ( bridged)
@@ -472,16 +444,12 @@ class TestNSNumberBridging : XCTestCase {
472
444
XCTAssertEqual ( UInt ( exactly: interestingValue) , uint)
473
445
474
446
let float = Float ( exactly: number!)
447
+ let expectedFloat = Float ( exactly: uint!)
448
+ testFloat ( expectedFloat, float)
449
+
475
450
let double = Double ( exactly: number!)
476
- if uint! < UInt . max - 1 {
477
- XCTAssertEqual ( Float ( interestingValue) , float)
478
- XCTAssertEqual ( Double ( interestingValue) , double)
479
- } else {
480
- // FIXME: Exact conversions to NSNumber succeeding incorrectly
481
- // https://bugs.swift.org/browse/SR-6322
482
- // XCTAssertNil(float)
483
- // XCTAssertNil(double)
484
- }
451
+ let expectedDouble = Double ( exactly: uint!)
452
+ testDouble ( expectedDouble, double)
485
453
}
486
454
let bridged = interestingValue. _bridgeToObjectiveC ( )
487
455
testNumber ( bridged)
@@ -515,16 +483,13 @@ class TestNSNumberBridging : XCTestCase {
515
483
let uint = UInt ( exactly: number!)
516
484
XCTAssertEqual ( UInt ( exactly: interestingValue) , uint)
517
485
518
- let float = Float ( truncating : number!)
519
- let expectedFloat = interestingValue
486
+ let float = Float ( exactly : number!)
487
+ let expectedFloat = Float ( exactly : interestingValue)
520
488
testFloat ( expectedFloat, float)
521
-
522
- // FIXME: Double.nan doesn't round-trip through NSNumber
523
- if !interestingValue. isNaN {
524
- let double = Double ( exactly: number!)
525
- let expectedDouble = Double ( exactly: interestingValue)
526
- testDouble ( expectedDouble, double)
527
- }
489
+
490
+ let double = Double ( exactly: number!)
491
+ let expectedDouble = Double ( exactly: interestingValue)
492
+ testDouble ( expectedDouble, double)
528
493
}
529
494
let bridged = interestingValue. _bridgeToObjectiveC ( )
530
495
testNumber ( bridged)
@@ -558,16 +523,13 @@ class TestNSNumberBridging : XCTestCase {
558
523
let uint = UInt ( exactly: number!)
559
524
XCTAssertEqual ( UInt ( exactly: interestingValue) , uint)
560
525
561
- let float = Float ( truncating : number!)
562
- let expectedFloat = Float ( reasonably : interestingValue)
526
+ let float = Float ( exactly : number!)
527
+ let expectedFloat = Float ( exactly : interestingValue)
563
528
testFloat ( expectedFloat, float)
564
-
565
- // FIXME: Double.nan doesn't round-trip through NSNumber
566
- if !interestingValue. isNaN {
567
- let double = Double ( exactly: number!)
568
- let expectedDouble = Double ( exactly: interestingValue)
569
- testDouble ( expectedDouble, double)
570
- }
529
+
530
+ let double = Double ( exactly: number!)
531
+ let expectedDouble = Double ( exactly: interestingValue)
532
+ testDouble ( expectedDouble, double)
571
533
}
572
534
let bridged = interestingValue. _bridgeToObjectiveC ( )
573
535
testNumber ( bridged)
0 commit comments