#QUALITY by cg
authorClaus Gittinger <cg@exept.de>
Mon, 19 Jun 2017 17:08:13 +0200
changeset 1614 ead11e8f7913
parent 1611 7cc93d8bb66f
child 1615 736b7ed0df9a
#QUALITY by cg class: RegressionTests::QDoubleTests class definition added: #test_01_instance_creation #test_02_addition #test_03_subtract #test_04_relops #test_05_multiply class: RegressionTests::QDoubleTests class added: #documentation #version #version_CVS
RegressionTests__QDoubleTests.st
--- a/RegressionTests__QDoubleTests.st	Wed Jun 14 16:09:45 2017 +0200
+++ b/RegressionTests__QDoubleTests.st	Mon Jun 19 17:08:13 2017 +0200
@@ -70,14 +70,29 @@
     
     "/ no precision is lost
     self assert:( (sum_q - (QDouble fromFloat:1.0)) > 0.0 ).
+
+    q1 := QDouble fromFloat:1.0.
+    q2 := QDouble fromFloat:2.0.
+    sum_q := q1 + q2.
+    self assert:( sum_q = 3.0 ).
     
+    q1 := QDouble fromFloat:1.0.
+    q2 := QDouble fromFloat:2.0.
+    sum_q := q1 + 2.0.
+    self assert:( sum_q = 3.0 ).
+
+    q1 := QDouble fromFloat:1.0.
+    q2 := QDouble fromFloat:2.0.
+    sum_q := 1.0 + q2.
+    self assert:( sum_q = 3.0 ).
+
     "
      self run:#test_02_addition
      self new test_02_addition
     "
 
     "Created: / 12-06-2017 / 17:05:07 / cg"
-    "Modified: / 13-06-2017 / 16:47:05 / cg"
+    "Modified: / 19-06-2017 / 17:03:57 / cg"
 !
 
 test_03_subtract
@@ -233,6 +248,49 @@
     "
 
     "Created: / 13-06-2017 / 17:11:37 / cg"
+!
+
+test_05_multiply
+    |q1 q2 p|
+
+    q1 := QDouble fromFloat:3.0. "/ DoubleArray(2.0 0.0 0.0 0.0)
+    p := 2.0 * q1.
+
+    self assert:(p d0 = 6.0).
+    self assert:(p d1 = 0.0).
+    self assert:(p d2 = 0.0).
+    self assert:(p d3 = 0.0).
+    self assert:(p = 6.0).
+    self assert:(6.0 = p).
+
+    q1 := QDouble fromFloat:2.0. "/ DoubleArray(2.0 0.0 0.0 0.0)
+self halt.
+    p := q1 * 3.0.
+
+    self assert:(p d0 = 6.0).
+    self assert:(p d1 = 0.0).
+    self assert:(p d2 = 0.0).
+    self assert:(p d3 = 0.0).
+    self assert:(p = 6.0).
+    self assert:(6.0 = p).
+
+    q1 := QDouble fromFloat:2.0. "/ DoubleArray(2.0 0.0 0.0 0.0)
+    q2 := QDouble fromFloat:3.0. "/ DoubleArray(3.0 0.0 0.0 0.0)
+    p := q1 * q2.
+    
+    self assert:(p d0 = 6.0).
+    self assert:(p d1 = 0.0).
+    self assert:(p d2 = 0.0).
+    self assert:(p d3 = 0.0).
+    self assert:(p = 6.0).
+    self assert:(6.0 = p).
+    
+    "
+     self run:#test_05_multiply
+     self new test_05_multiply
+    "
+
+    "Created: / 19-06-2017 / 16:58:29 / cg"
 ! !
 
 !QDoubleTests class methodsFor:'documentation'!