--- a/RegressionTests__TimeDurationTest.st Thu May 10 12:44:54 2018 +0200
+++ b/RegressionTests__TimeDurationTest.st Thu May 10 13:02:58 2018 +0200
@@ -99,6 +99,48 @@
self assert:(sum asNanoseconds = 1000001000).
self assert:(sum asPicoseconds = 1000001000000).
+ t1 := TimeDuration fromNanoseconds:100.
+ t2 := TimeDuration fromNanoseconds:15.5.
+ sum := t1 + t2.
+
+ self assert:(sum asNanoseconds = 115).
+ self assert:(sum asPicoseconds = 115500).
+
+
+ "
+ self new test_01_Arithmetic
+ "
+!
+
+test_02_Arithmetic
+ |t1 t2 sum|
+
+ t1 := TimeDuration fromSeconds:1.
+ t2 := TimeDuration fromMilliseconds:1.
+ sum := t1 - t2.
+
+ self assert:(sum asMilliseconds == 999).
+ self assert:(sum asMicroseconds = 999000).
+ self assert:(sum asNanoseconds = 999000000).
+ self assert:(sum asPicoseconds = 999000000000).
+
+
+ t1 := TimeDuration fromSeconds:1.
+ t2 := TimeDuration fromMicroseconds:1.
+ sum := t1 - t2.
+
+ self assert:(sum asMilliseconds == 999).
+ self assert:(sum asMicroseconds = 999999).
+ self assert:(sum asNanoseconds = 999999000).
+ self assert:(sum asPicoseconds = 999999000000).
+
+ t1 := TimeDuration fromNanoseconds:100.
+ t2 := TimeDuration fromNanoseconds:15.5.
+ sum := t1 - t2.
+
+ self assert:(sum asNanoseconds = 84).
+ self assert:(sum asPicoseconds = 84500).
+
"
self new test_01_Arithmetic