added:
authorClaus Gittinger <cg@exept.de>
Tue, 09 Aug 2011 21:22:24 +0200
changeset 624 d102acf4b889
parent 623 2a27ea2f2490
child 625 9ed02c4fa1d0
added: #literal_helper1 #testLiteralInSTC changed: #testLiteral1 category of:
RegressionTests__ScaledDecimalTest.st
--- a/RegressionTests__ScaledDecimalTest.st	Tue Aug 09 21:08:20 2011 +0200
+++ b/RegressionTests__ScaledDecimalTest.st	Tue Aug 09 21:22:24 2011 +0200
@@ -10,13 +10,21 @@
 !
 
 
-!ScaledDecimalTest methodsFor:'tests'!
+!ScaledDecimalTest methodsFor:'helpers'!
 
-literal1_helper
+literal_helper1
     ^ 1.40s2.
 
-    "Created: / 09-08-2011 / 21:06:05 / cg"
-!
+    "Created: / 09-08-2011 / 21:11:13 / cg"
+! !
+
+!ScaledDecimalTest methodsFor:'temporary'!
+
+literal_helper2
+    ^ 1.40s2.
+! !
+
+!ScaledDecimalTest methodsFor:'tests'!
 
 testAsNumber
         "Ensure no loss of precision"
@@ -208,8 +216,9 @@
 
 testLiteral1
     "s2 is not a message to be sent to a float"
+
     self 
-        shouldnt:[ self literal1_helper ] 
+        shouldnt:[ self literal_helper1 ] 
         raise:MessageNotUnderstood
 
     "Created: / 09-08-2011 / 21:05:47 / cg"
@@ -231,6 +240,32 @@
     "Created: / 09-08-2011 / 21:06:11 / cg"
 !
 
+testLiteralInSTC
+    |value|
+
+    Class withoutUpdatingChangesDo:[
+        self class
+            compile:
+'literal_helper2
+    ^ 1.40s2.
+'
+            classified:'temporary'.
+
+        Compiler stcCompileMethod:(self class compiledMethodAt:#literal_helper2).
+    ].
+
+    self 
+        shouldnt:[ self literal_helper2 ] 
+        raise:MessageNotUnderstood.
+
+    value := self literal_helper2.
+    self assert:( value isFixedPoint ).
+    self assert:( (value * 10) = 14 ).
+    self assert:( value asFloat = 1.4 ).
+
+    "Created: / 09-08-2011 / 21:10:22 / cg"
+!
+
 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.