RegressionTests__TimeDurationTest.st
changeset 1923 00f3085c5b71
parent 1922 a6d99b7a3447
child 1925 8aae0cf16be3
--- a/RegressionTests__TimeDurationTest.st	Thu May 10 14:25:34 2018 +0200
+++ b/RegressionTests__TimeDurationTest.st	Thu May 10 14:52:38 2018 +0200
@@ -72,6 +72,9 @@
     self assert:(t asTruncatedNanoseconds = 0).
     self assert:(t asPicoseconds = 345).
 
+    t := TimeDuration fromMicroseconds:-10001.
+    self assert:(t asExactMicroseconds = -10001).
+
     "
      self new test_00_Basic
     "
@@ -275,7 +278,39 @@
     "
 !
 
-test_05_Reading
+test_06_miscArithmetic    
+    |t rslt|
+
+    t := TimeDuration fromSeconds:1.
+    rslt := t negated.
+    self assert:(rslt asSeconds = -1).
+    self assert:(rslt = (TimeDuration fromSeconds:-1)).
+
+    t := TimeDuration fromMicroseconds:1.
+    rslt := t negated.
+    self assert:(rslt asMicroseconds = -1).
+    self assert:(rslt = (TimeDuration fromMicroseconds:-1)).
+
+    t := TimeDuration fromMicroseconds:10001.
+    rslt := t negated.
+    self assert:(rslt asMicroseconds = -10001).
+    self assert:(rslt = (TimeDuration fromMicroseconds:-10001)).
+    rslt := rslt negated.
+    self assert:(rslt asMicroseconds = 10001).
+    self assert:(rslt = (TimeDuration fromMicroseconds:10001)).
+
+
+    t := TimeDuration fromMicroseconds:-10001.
+    rslt := t abs.
+    self assert:(rslt asMicroseconds = 10001).
+    self assert:(rslt = (TimeDuration fromMicroseconds:10001)).
+
+    "
+     self new test_06_miscArithmetic
+    "
+!
+
+test_09_Reading
     |t1 t2|
 
     t2 := TimeDuration fromString:'1.001s'.
@@ -366,7 +401,7 @@
     self assert:(t1 asExactHours = 29.5).
 
     "
-     self new test_05_Reading
+     self new test_09_Reading
     "
 !