#FEATURE by cg
authorClaus Gittinger <cg@exept.de>
Tue, 20 Jun 2017 14:03:25 +0200
changeset 1621 aa072d5d3c06
parent 1620 e19b7dd63097
child 1622 ced5fda31c2e
#FEATURE by cg class: RegressionTests::FloatTest class definition added: #actualPrecisionOf: #test00_Precision #test01_Nan #test02_Inf #test03_Conversion #test04_Arithmetic #test05_Comparing #test06_MiscMath #test07_Truncation #test08_Representation class: RegressionTests::FloatTest class added: #version #version_CVS
RegressionTests__FloatTest.st
--- a/RegressionTests__FloatTest.st	Tue Jun 20 13:06:17 2017 +0200
+++ b/RegressionTests__FloatTest.st	Tue Jun 20 14:03:25 2017 +0200
@@ -141,9 +141,26 @@
     self assert:( shouldBeLongFloatNaN - 1.0 asShortFloat ) isNaN.
     self assert:( shouldBeLongFloatNaN - 1.0 asLongFloat ) isNaN.
 
+    shouldBeFloatNaN := Float NaN.
+    self assert:( shouldBeFloatNaN isMemberOf:Float ).
+    self assert:( shouldBeFloatNaN isNaN ).
+    self assert:( shouldBeFloatNaN isFinite not ).
+
+    shouldBeShortFloatNaN := ShortFloat NaN.
+    self assert:( shouldBeShortFloatNaN isMemberOf:ShortFloat ).
+    self assert:( shouldBeShortFloatNaN isNaN ).
+    self assert:( shouldBeShortFloatNaN isFinite not ).
+
+    shouldBeLongFloatNaN := LongFloat NaN.
+    self assert:( shouldBeLongFloatNaN isMemberOf:LongFloat ).
+    self assert:( shouldBeLongFloatNaN isNaN ).
+    self assert:( shouldBeLongFloatNaN isFinite not ).
+
     "
      self basicNew test01_Nan
     "
+
+    "Modified: / 20-06-2017 / 14:00:08 / cg"
 !
 
 test02_Inf
@@ -152,45 +169,45 @@
     |check posInf negInf|
 
     check :=
-	[:v1 :v2 |
+        [:v1 :v2 |
 
-	    posInf := v1 uncheckedDivide: v2.
+            posInf := v1 uncheckedDivide: v2.
 
-	    self assert:( posInf isMemberOf:v1 class ).
-	    self assert:( posInf isNaN not ).
-	    self assert:( posInf isFinite not ).
-	    self assert:( posInf isInfinite ).
-	    self assert:( posInf positive ).
-	    self assert:( posInf negative not ).
-	    self assert:( posInf isNegativeInfinity not).
-	    self assert:( posInf isPositiveInfinity ).
+            self assert:( posInf isMemberOf:v1 class ).
+            self assert:( posInf isNaN not ).
+            self assert:( posInf isFinite not ).
+            self assert:( posInf isInfinite ).
+            self assert:( posInf positive ).
+            self assert:( posInf negative not ).
+            self assert:( posInf isNegativeInfinity not).
+            self assert:( posInf isPositiveInfinity ).
 
-	    negInf := v1 negated uncheckedDivide: v2.
+            negInf := v1 negated uncheckedDivide: v2.
 
-	    self assert:( negInf isMemberOf:v1 class ).
-	    self assert:( negInf isNaN not ).
-	    self assert:( negInf isFinite not ).
-	    self assert:( negInf isInfinite ).
-	    self assert:( negInf positive not).
-	    self assert:( negInf negative ).
-	    self assert:( negInf isNegativeInfinity ).
-	    self assert:( negInf isPositiveInfinity not ).
+            self assert:( negInf isMemberOf:v1 class ).
+            self assert:( negInf isNaN not ).
+            self assert:( negInf isFinite not ).
+            self assert:( negInf isInfinite ).
+            self assert:( negInf positive not).
+            self assert:( negInf negative ).
+            self assert:( negInf isNegativeInfinity ).
+            self assert:( negInf isPositiveInfinity not ).
 
-	    self assert:( negInf + negInf = negInf).
-	    self assert:( posInf + posInf = posInf).
-	    self assert:( negInf + posInf) isNaN.
-	    self assert:( posInf + negInf) isNaN.
+            self assert:( negInf + negInf = negInf).
+            self assert:( posInf + posInf = posInf).
+            self assert:( negInf + posInf) isNaN.
+            self assert:( posInf + negInf) isNaN.
 
-	    self assert:( negInf - posInf = negInf).
-	    self assert:( negInf - negInf) isNaN.
-	    self assert:( posInf - negInf = posInf).
-	    self assert:( posInf - posInf) isNaN.
+            self assert:( negInf - posInf = negInf).
+            self assert:( negInf - negInf) isNaN.
+            self assert:( posInf - negInf = posInf).
+            self assert:( posInf - posInf) isNaN.
 
-	    self assert:( posInf + v1) = posInf.
-	    self assert:( posInf - v1) = posInf.
-	    self assert:( negInf + v1) = negInf.
-	    self assert:( negInf - v1) = negInf.
-	].
+            self assert:( posInf + v1) = posInf.
+            self assert:( posInf - v1) = posInf.
+            self assert:( negInf + v1) = negInf.
+            self assert:( negInf - v1) = negInf.
+        ].
 
     check value: 1.0 value: 0.0.
     check value: 1.0 asShortFloat value: 0.0 asShortFloat.
@@ -206,9 +223,30 @@
 "/    check value: 1.0 asLongFloat value: 0.0 asShortFloat.
 "/    check value: 1.0 asLongFloat value: 0.0.
 
+    { Float . ShortFloat . LongFloat }
+    do:[:cls |
+        posInf := cls infinity.
+        self assert:( posInf isInfinite ).
+        self assert:( posInf isFinite not ).
+        self assert:( posInf > 0 ).
+        self assert:( posInf >= 0 ).
+        self assert:( posInf < 0 ) not.
+        self assert:( posInf <= 0 ) not.
+
+        negInf := cls negativeInfinity.
+        self assert:( negInf isInfinite ).
+        self assert:( negInf isFinite not ).
+        self assert:( negInf < 0 ).
+        self assert:( negInf <= 0 ).
+        self assert:( negInf > 0 ) not.
+        self assert:( negInf >= 0 ) not.
+    ].
+
     "
      self basicNew test02_Inf
     "
+
+    "Modified: / 20-06-2017 / 14:03:08 / cg"
 !
 
 test03_Conversion