#QUALITY by cg
authorClaus Gittinger <cg@exept.de>
Mon, 03 Jul 2017 13:58:38 +0200
changeset 1626 2416702a1097
parent 1625 1aca49cee54d
child 1627 ad08ca4a7ee6
#QUALITY by cg class: RegressionTests::FloatTest added: #test09_ComplexRoots
RegressionTests__FloatTest.st
--- a/RegressionTests__FloatTest.st	Mon Jul 03 10:14:41 2017 +0200
+++ b/RegressionTests__FloatTest.st	Mon Jul 03 13:58:38 2017 +0200
@@ -850,6 +850,28 @@
     "
 
     "Modified: / 02-08-2011 / 18:34:39 / cg"
+!
+
+test09_ComplexRoots
+    |rslt|
+    
+    self should:[ -4 sqrt ] raise:ImaginaryResultError.
+
+    rslt := Complex trapImaginary:[ -4 sqrt ].
+    self assert:(rslt = 2 i).
+
+    rslt := nil.
+    Complex trapImaginary:[ rslt := -4 sqrt ].
+    self assert:(rslt = 2 i).
+
+    self shouldnt:[ rslt := -8 cbrt ] raise:ImaginaryResultError.
+    self assert:(rslt = -2).
+
+    "
+     self basicNew test09_ComplexRoots
+    "
+
+    "Created: / 03-07-2017 / 13:51:54 / cg"
 ! !
 
 !FloatTest class methodsFor:'documentation'!