Fix position handling (assumed 1-based positions)
authorStefan Vogel <sv@exept.de>
Fri, 26 Sep 2003 17:40:23 +0200
changeset 209 eff283f4ddd5
parent 208 4db1efdbce2e
child 210 ee39b434235b
Fix position handling (assumed 1-based positions)
RegressionTests__SharedQueueTest.st
--- a/RegressionTests__SharedQueueTest.st	Fri Sep 26 17:37:53 2003 +0200
+++ b/RegressionTests__SharedQueueTest.st	Fri Sep 26 17:40:23 2003 +0200
@@ -23,19 +23,19 @@
     s2 := ReadWriteStream on:(Array new:1000).
 
     p1 := [
-	[
-	    s1 nextPut:q next
-	] loop.
+        [
+            s1 nextPut:q next
+        ] loop.
     ] fork.
 
     p2 := [
-	[
-	    s2 nextPut:q next
-	] loop.
+        [
+            s2 nextPut:q next
+        ] loop.
     ] fork.
 
     1 to:1000 do:[:i|
-	q nextPut:i
+        q nextPut:i
     ].
 
     Delay waitForMilliseconds:20.
@@ -43,7 +43,7 @@
     p1 terminate.
     p2 terminate.
 
-    self assert:s1 position + s2 position == (1000+2).
+    self assert:s1 position0Based + s2 position0Based == 1000.
 
     s1 reset.
     s2 reset.
@@ -52,17 +52,17 @@
     next2 := s2 next.
 
     1 to: 1000 do:[:i|
-	self should:[
-	    next1 == i ifTrue:[
-		next1 := s1 next.
-		true.
-	    ] ifFalse:[
-		next2 == i ifTrue:[
-		    next2 := s2 next.
-		    true
-		].
-	    ]
-	]
+        self should:[
+            next1 == i ifTrue:[
+                next1 := s1 next.
+                true.
+            ] ifFalse:[
+                next2 == i ifTrue:[
+                    next2 := s2 next.
+                    true
+                ].
+            ]
+        ]
     ].
 !
 
@@ -77,25 +77,25 @@
     s2 := ReadWriteStream on:(Array new:20000).
 
     p1 := [
-	[
-	    s1 nextPut:q next
-	] loop.
+        [
+            s1 nextPut:q next
+        ] loop.
     ] fork.
 
     p2 := [
-	[
-	    s2 nextPut:q next
-	] loop.
+        [
+            s2 nextPut:q next
+        ] loop.
     ] fork.
 
     pw := [
-	1 to:10000 do:[:i|
-	    q nextPut:i+scale
-	].
+        1 to:10000 do:[:i|
+            q nextPut:i+scale
+        ].
     ] fork.
 
     1 to:10000 do:[:i|
-	q nextPut:i
+        q nextPut:i
     ].
 
     pw waitUntilTerminated.
@@ -104,30 +104,30 @@
     p1 terminate.
     p2 terminate.
 
-    self assert:s1 position + s2 position == (20000+2).
+    self assert:s1 position0Based + s2 position0Based == 20000.
 
     s1 reset.
     s2 reset.
 
     next1 := next2 := 0.
     self should:[
-	s1 contents conform:[:i|
-	    i < scale ifTrue:[
-		next1 < i and:[next1 := i. true]
-	    ] ifFalse:[
-		next2 < i and:[next2 := i. true]
-	    ].
-	].
+        s1 contents conform:[:i|
+            i < scale ifTrue:[
+                next1 < i and:[next1 := i. true]
+            ] ifFalse:[
+                next2 < i and:[next2 := i. true]
+            ].
+        ].
     ].
     next1 := next2 := 0.
     self should:[
-	s2 contents conform:[:i|
-	    i < scale ifTrue:[
-		next1 < i and:[next1 := i. true]
-	    ] ifFalse:[
-		next2 < i and:[next2 := i. true]
-	    ].
-	].
+        s2 contents conform:[:i|
+            i < scale ifTrue:[
+                next1 < i and:[next1 := i. true]
+            ] ifFalse:[
+                next2 < i and:[next2 := i. true]
+            ].
+        ].
     ].
 
     s1 reset.
@@ -138,8 +138,8 @@
     all addAll:s2 contents.
 
     1 to: 10000 do:[:i|
-	self assert:((all at:i) == i).
-	self assert:((all at:(i+10000)) == (i+scale)).
+        self assert:((all at:i) == i).
+        self assert:((all at:(i+10000)) == (i+scale)).
     ].
 !