#QUALITY by exept
class: RegressionTests::QDoubleTests
added: #test_09_truncating
changed:
#test99_misc
#test_01_instance_creation
#test_02_addition
--- a/RegressionTests__QDoubleTests.st Fri Nov 22 04:43:49 2019 +0100
+++ b/RegressionTests__QDoubleTests.st Sat Nov 23 19:39:16 2019 +0100
@@ -32,7 +32,7 @@
!QDoubleTests methodsFor:'tests'!
test99_misc
- self skip:'unfinished work in progress'.
+ "/ self skip:'unfinished work in progress'.
self assert:( 1 asQDouble / (3 factorial) - (QDouble invFact at:1) ) = 0.0.
self assert:( 1 asQDouble / (4 factorial) - (QDouble invFact at:2) ) = 0.0.
@@ -63,6 +63,18 @@
self assert:(q d2 = 0.0).
self assert:(q d3 = 0.0).
+ q := QDouble fromInteger:1.
+ self assert:(q d0 = 1.0).
+ self assert:(q d1 = 0.0).
+ self assert:(q d2 = 0.0).
+ self assert:(q d3 = 0.0).
+
+ q := 1 asQDouble.
+ self assert:(q d0 = 1.0).
+ self assert:(q d1 = 0.0).
+ self assert:(q d2 = 0.0).
+ self assert:(q d3 = 0.0).
+
q := 1.0 asQDouble.
self assert:(q d0 = 1.0).
self assert:(q d1 = 0.0).
@@ -156,6 +168,8 @@
self assert:(sum_q d2 = 1e40).
self assert:(sum_q d3 = 1.0).
+ '%.60f' printf:{QDouble pi}
+
"
self run:#test_02_addition
self new test_02_addition
@@ -537,6 +551,25 @@
"Created: / 20-06-2017 / 07:51:50 / cg"
"Modified: / 05-06-2019 / 20:18:48 / Claus Gittinger"
+!
+
+test_09_truncating
+ self assert:(1.0 asQDouble truncated = 1.0 asQDouble).
+ self assert:(1.0 asQDouble truncated = 1.0).
+
+ self assert:(1.1 asQDouble truncated = 1.0 asQDouble).
+ self assert:(1.1 asQDouble truncated = 1.0).
+
+ self assert:(1.999 asQDouble truncated = 1.0 asQDouble).
+ self assert:(1.999 asQDouble truncated = 1.0).
+
+ self assert:(-1.999 asQDouble truncated = -2.0 asQDouble).
+ self assert:(-1.999 asQDouble truncated = -2.0).
+
+ "
+ self run:#test_09_truncating
+ self new test_09_truncating
+ "
! !
!QDoubleTests class methodsFor:'documentation'!