RegressionTests__SharedQueueTest.st
changeset 95 362e58ff28ba
parent 90 906aa2e912cc
child 181 a56517005229
--- a/RegressionTests__SharedQueueTest.st	Fri Dec 01 18:31:50 2000 +0100
+++ b/RegressionTests__SharedQueueTest.st	Thu Dec 07 09:46:20 2000 +0100
@@ -1,5 +1,7 @@
 "{ Package: 'exept:regression' }"
 
+"{ NameSpace: RegressionTests }"
+
 TestCase subclass:#SharedQueueTest
 	instanceVariableNames:''
 	classVariableNames:''
@@ -21,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.
@@ -50,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
+		].
+	    ]
+	]
     ].
 !
 
@@ -75,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.
@@ -109,23 +111,23 @@
 
     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.
@@ -136,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)).
     ].
 !
 
@@ -149,14 +151,14 @@
     q := SharedQueue new:10.
 
     [
-        1 to:1000 do:[:i|
-            q nextPut:i.
-        ].
+	1 to:1000 do:[:i|
+	    q nextPut:i.
+	].
     ] fork.
     [
-        1 to:1000 do:[:i|
-            q nextPut:i+scale.
-        ].
+	1 to:1000 do:[:i|
+	    q nextPut:i+scale.
+	].
     ] fork.
 
 
@@ -164,14 +166,14 @@
     next2 := next1 + scale.
 
     2000 timesRepeat:[ |i|
-        i := q next.
-        i < scale ifTrue:[
-            self assert:i == next1.
-            next1 := next1 + 1.
-        ] ifFalse:[
-            self assert:i == next2.
-            next2 := next2 + 1.
-        ]
+	i := q next.
+	i < scale ifTrue:[
+	    self assert:i == next1.
+	    next1 := next1 + 1.
+	] ifFalse:[
+	    self assert:i == next2.
+	    next2 := next2 + 1.
+	]
     ].
 
     self assert:next1 == 1001.
@@ -195,13 +197,13 @@
     q := SharedQueue new:10.
 
     [
-        1 to:1000 do:[:i|
-            q nextPut:i.
-        ].
+	1 to:1000 do:[:i|
+	    q nextPut:i.
+	].
     ] fork.
 
     1 to: 1000 do:[:i|
-        self assert:q next == i.
+	self assert:q next == i.
     ].
 
     self assert:q isEmpty
@@ -210,7 +212,7 @@
 testRemoveAll
 
     0 to:10 do:[:i|
-        self removeAllSize:10 fill:i.
+	self removeAllSize:10 fill:i.
     ].
 ! !
 
@@ -223,7 +225,7 @@
     q := SharedQueue new:size.
 
     1 to:fill do:[:i|
-        q nextPut:i.
+	q nextPut:i.
     ].
     q removeAll.
     self assert:q isEmpty.