#QUALITY by cg
authorClaus Gittinger <cg@exept.de>
Fri, 11 May 2018 01:09:49 +0200
changeset 1926 139e97e95b07
parent 1925 8aae0cf16be3
child 1927 ac82d7231d95
#QUALITY by cg class: RegressionTests::TimeDurationTest changed: #test_00_Basic
RegressionTests__TimeDurationTest.st
--- a/RegressionTests__TimeDurationTest.st	Thu May 10 23:55:50 2018 +0200
+++ b/RegressionTests__TimeDurationTest.st	Fri May 11 01:09:49 2018 +0200
@@ -75,6 +75,40 @@
     t := TimeDuration fromMicroseconds:-10001.
     self assert:(t asExactMicroseconds = -10001).
 
+    (4 to:4000000000000000000 byFactor:1000) do:[:v |
+        self assert:(t := TimeDuration new setPicoseconds:v) asPicoseconds = v.
+        self assert:(t := TimeDuration fromPicoseconds:v) asPicoseconds = v.
+        self assert:(t := v picoseconds) asPicoseconds = v.
+
+        self assert:(t := TimeDuration new setNanoseconds:v) asNanoseconds = v.
+        self assert:(t := TimeDuration fromNanoseconds:v) asNanoseconds = v.
+        self assert:(t := v nanoseconds) asNanoseconds = v.
+
+    ].
+
+    self assert:(t := 4 picoseconds) printString = ('4ps').
+    self assert:(t := 40 picoseconds) printString = ('40ps').
+    self assert:(t := 400 picoseconds) printString = ('400ps').
+    self assert:(t := 4000 picoseconds) printString = ('4ns').
+    self assert:(4000 picoseconds = 4 nanoseconds).
+
+    self assert:(t := 4 nanoseconds) printString = ('4ns').
+    self assert:(t := 40 nanoseconds) printString = ('40ns').
+    self assert:(t := 400 nanoseconds) printString = ('400ns').
+    self assert:(t := 4000 nanoseconds) printString = ('4us').
+    self assert:(4000 nanoseconds = 4 microseconds).
+
+    self assert:(t := 4 microseconds) printString = ('4us').
+    self assert:(t := 40 microseconds) printString = ('40us').
+    self assert:(t := 400 microseconds) printString = ('400us').
+    self assert:(t := 4000 microseconds) printString = ('4ms').
+    self assert:(4000 microseconds = 4 milliseconds).
+
+    self assert:(t := 4 milliseconds) printString = ('4ms').
+    self assert:(t := 40 milliseconds) printString = ('40ms').
+    self assert:(t := 400 milliseconds) printString = ('400ms').
+    self assert:(t := 4000 milliseconds) printString = ('4s').
+    self assert:(4000 milliseconds = 4 seconds).
     "
      self new test_00_Basic
     "