@@ -518,7 +518,7 @@ class TestDecimal: XCTestCase {
518
518
XCTAssertEqual ( 1 , ten. _length)
519
519
}
520
520
521
- func test_NSDecimal( ) {
521
+ func test_NSDecimal( ) throws {
522
522
var nan = Decimal . nan
523
523
XCTAssertTrue ( NSDecimalIsNotANumber ( & nan) )
524
524
var zero = Decimal ( )
@@ -539,6 +539,31 @@ class TestDecimal: XCTestCase {
539
539
let nsd1 = NSDecimalNumber ( decimal: Decimal ( 2657.6 ) )
540
540
let nsd2 = NSDecimalNumber ( floatLiteral: 2657.6 )
541
541
XCTAssertEqual ( nsd1, nsd2)
542
+
543
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( Int8 . min) ) . description, Int8 . min. description)
544
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( Int8 . max) ) . description, Int8 . max. description)
545
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( UInt8 . min) ) . description, UInt8 . min. description)
546
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( UInt8 . max) ) . description, UInt8 . max. description)
547
+
548
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( Int16 . min) ) . description, Int16 . min. description)
549
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( Int16 . max) ) . description, Int16 . max. description)
550
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( UInt16 . min) ) . description, UInt16 . min. description)
551
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( UInt16 . max) ) . description, UInt16 . max. description)
552
+
553
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( Int32 . min) ) . description, Int32 . min. description)
554
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( Int32 . max) ) . description, Int32 . max. description)
555
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( UInt32 . min) ) . description, UInt32 . min. description)
556
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( UInt32 . max) ) . description, UInt32 . max. description)
557
+
558
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( Int64 . min) ) . description, Int64 . min. description)
559
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( Int64 . max) ) . description, Int64 . max. description)
560
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( UInt64 . min) ) . description, UInt64 . min. description)
561
+ XCTAssertEqual ( NSDecimalNumber ( decimal: Decimal ( UInt64 . max) ) . description, UInt64 . max. description)
562
+
563
+ XCTAssertEqual ( try NSDecimalNumber ( decimal: Decimal ( string: " 12.34 " ) . unwrapped ( ) ) . description, " 12.34 " )
564
+ XCTAssertEqual ( try NSDecimalNumber ( decimal: Decimal ( string: " 0.0001 " ) . unwrapped ( ) ) . description, " 0.0001 " )
565
+ XCTAssertEqual ( try NSDecimalNumber ( decimal: Decimal ( string: " -1.0002 " ) . unwrapped ( ) ) . description, " -1.0002 " )
566
+ XCTAssertEqual ( try NSDecimalNumber ( decimal: Decimal ( string: " 0.0 " ) . unwrapped ( ) ) . description, " 0 " )
542
567
}
543
568
544
569
func test_PositivePowers( ) {
0 commit comments