*** empty log message ***
authorClaus Gittinger <cg@exept.de>
Fri, 17 Feb 2006 15:56:53 +0100
changeset 313 347d94236f10
parent 312 d39568c0560e
child 314 cd0e47be2a25
*** empty log message ***
RegressionTests__ScaledDecimalTest.st
--- a/RegressionTests__ScaledDecimalTest.st	Fri Feb 17 15:47:31 2006 +0100
+++ b/RegressionTests__ScaledDecimalTest.st	Fri Feb 17 15:56:53 2006 +0100
@@ -201,6 +201,36 @@
         ].
 !
 
+testPrintString
+        "The printed representation of a ScaledDecimal is truncated, not rounded.
+        Not sure if this is right, so this test describes the current Squeak implementation.
+        If someone knows a reason that rounding would be preferable, then update
+        this test."
+
+        | sd |
+
+        sd := (13 / 11) asScaledDecimal: 6.
+        Smalltalk isSmalltalkX ifTrue:[
+            self assert: ('1.181818' = sd printString).
+        ] ifFalse:[
+            self assert: ('1.181818s6' = sd printString).
+        ].
+
+        sd := (13 / 11) asScaledDecimal: 5.
+        Smalltalk isSmalltalkX ifTrue:[
+            self assert: ('1.18182' = sd printString).
+        ] ifFalse:[
+            self deny: ('1.18182s5' = sd printString).
+        ].
+
+        sd := (13 / 11) asScaledDecimal: 5.
+        Smalltalk isSmalltalkX ifTrue:[
+            self deny: ('1.18181' = sd printString).
+        ] ifFalse:[
+            self assert: ('1.18181s5' = sd printString).
+        ].
+!
+
 testStoreAndRead
     |check|