@@ -504,7 +504,7 @@ class TestDecimal: XCTestCase {
504
504
XCTAssertEqual ( 1 , ten. _length)
505
505
}
506
506
507
- func test_NSDecimal( ) {
507
+ func test_NSDecimal( ) throws {
508
508
var nan = Decimal . nan
509
509
XCTAssertTrue ( NSDecimalIsNotANumber ( & nan) )
510
510
var zero = Decimal ( )
@@ -525,6 +525,31 @@ class TestDecimal: XCTestCase {
525
525
let nsd1 = NSDecimalNumber ( decimal: Decimal ( 2657.6 ) )
526
526
let nsd2 = NSDecimalNumber ( floatLiteral: 2657.6 )
527
527
XCTAssertEqual ( nsd1, nsd2)
528
+
529
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( Int8 . min) ) . description, Int8 . min. description)
530
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( Int8 . max) ) . description, Int8 . max. description)
531
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( UInt8 . min) ) . description, UInt8 . min. description)
532
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( UInt8 . max) ) . description, UInt8 . max. description)
533
+
534
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( Int16 . min) ) . description, Int16 . min. description)
535
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( Int16 . max) ) . description, Int16 . max. description)
536
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( UInt16 . min) ) . description, UInt16 . min. description)
537
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( UInt16 . max) ) . description, UInt16 . max. description)
538
+
539
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( Int32 . min) ) . description, Int32 . min. description)
540
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( Int32 . max) ) . description, Int32 . max. description)
541
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( UInt32 . min) ) . description, UInt32 . min. description)
542
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( UInt32 . max) ) . description, UInt32 . max. description)
543
+
544
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( Int64 . min) ) . description, Int64 . min. description)
545
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( Int64 . max) ) . description, Int64 . max. description)
546
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( UInt64 . min) ) . description, UInt64 . min. description)
547
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( UInt64 . max) ) . description, UInt64 . max. description)
548
+
549
+ XCTAssertEqual ( try NSDecimalNumber ( decimal: Decimal ( string: " 12.34 " ) . unwrapped ( ) ) . description, " 12.34 " )
550
+ XCTAssertEqual ( try NSDecimalNumber ( decimal: Decimal ( string: " 0.0001 " ) . unwrapped ( ) ) . description, " 0.0001 " )
551
+ XCTAssertEqual ( try NSDecimalNumber ( decimal: Decimal ( string: " -1.0002 " ) . unwrapped ( ) ) . description, " -1.0002 " )
552
+ XCTAssertEqual ( try NSDecimalNumber ( decimal: Decimal ( string: " 0.0 " ) . unwrapped ( ) ) . description, " 0 " )
528
553
}
529
554
530
555
func test_PositivePowers( ) {
0 commit comments