1701
|
1 |
"{ Encoding: utf8 }"
|
|
2 |
|
1447
|
3 |
"{ Package: 'stx:goodies/regression' }"
|
92
|
4 |
|
95
|
5 |
"{ NameSpace: RegressionTests }"
|
|
6 |
|
92
|
7 |
TestCase subclass:#OperationInQueueTests
|
|
8 |
instanceVariableNames:''
|
|
9 |
classVariableNames:''
|
|
10 |
poolDictionaries:''
|
181
|
11 |
category:'tests-Regression'
|
92
|
12 |
!
|
|
13 |
|
|
14 |
|
|
15 |
!OperationInQueueTests methodsFor:'tests'!
|
|
16 |
|
|
17 |
test1
|
|
18 |
|op opQ rslt|
|
|
19 |
|
|
20 |
opQ := OperationQueue new.
|
|
21 |
|
|
22 |
op := [ 1 + 2 ].
|
|
23 |
|
|
24 |
rslt := opQ scheduleOperation:op.
|
|
25 |
|
|
26 |
self assert:(rslt == 3)
|
|
27 |
!
|
|
28 |
|
|
29 |
test2
|
|
30 |
|op opQ rslt|
|
|
31 |
|
|
32 |
opQ := OperationQueue new.
|
|
33 |
|
|
34 |
op := 1.
|
|
35 |
|
|
36 |
rslt := opQ scheduleOperation:op.
|
|
37 |
|
|
38 |
self assert:(rslt == 1)
|
|
39 |
!
|
|
40 |
|
|
41 |
test3
|
1447
|
42 |
|op opQ val1 val2 val3 val1b val2b val3b
|
92
|
43 |
rslt rslt1 rslt2 rslt3 p0 p1 p2 p3 rslt1b rslt2b rslt3b p1b p2b p3b sz|
|
|
44 |
|
|
45 |
opQ := OperationQueue new.
|
|
46 |
opQ consumerProcessPriority:8.
|
|
47 |
|
|
48 |
op := '1'.
|
|
49 |
rslt := opQ scheduleOperation:op.
|
|
50 |
|
|
51 |
self assert:(rslt = '1').
|
|
52 |
|
|
53 |
self assert:(opQ size == 0).
|
|
54 |
|
|
55 |
p0 := [
|
1701
|
56 |
opQ scheduleOperation:[ Delay waitForSeconds:3.].
|
92
|
57 |
] fork.
|
|
58 |
|
|
59 |
p1 := [
|
1701
|
60 |
rslt1 := opQ scheduleOperation:(val1 := '1').
|
92
|
61 |
] fork.
|
|
62 |
|
|
63 |
p2 := [
|
1701
|
64 |
rslt2 := opQ scheduleOperation:(val2 := '2').
|
92
|
65 |
] fork.
|
|
66 |
|
|
67 |
p3 := [
|
1701
|
68 |
rslt3 := opQ scheduleOperation:(val3 := '3').
|
92
|
69 |
] fork.
|
|
70 |
|
1701
|
71 |
Delay waitForSeconds:0.5.
|
92
|
72 |
self assert:((sz := opQ size) == 3).
|
|
73 |
|
|
74 |
p1b := [
|
1701
|
75 |
rslt1b := opQ scheduleOperation:(val1b := '1').
|
92
|
76 |
] fork.
|
|
77 |
|
|
78 |
p2b := [
|
1701
|
79 |
rslt2b := opQ scheduleOperation:(val2b := '2').
|
92
|
80 |
] fork.
|
|
81 |
|
|
82 |
p3b := [
|
1701
|
83 |
rslt3b := opQ scheduleOperation:(val3b := '3').
|
92
|
84 |
] fork.
|
|
85 |
|
1701
|
86 |
Delay waitForSeconds:0.5.
|
92
|
87 |
self assert:(opQ size == 3).
|
|
88 |
|
1701
|
89 |
Delay waitForSeconds:3.
|
92
|
90 |
self assert:((sz := opQ size) == 0).
|
|
91 |
|
|
92 |
self assert:(val1 == rslt1).
|
|
93 |
self assert:(val2 == rslt2).
|
|
94 |
self assert:(val3 == rslt3).
|
|
95 |
self assert:(rslt1 = rslt1b).
|
|
96 |
self assert:(rslt2 = rslt2b).
|
|
97 |
self assert:(rslt3 = rslt3b).
|
|
98 |
self assert:(val1b = rslt1b).
|
|
99 |
self assert:(val2b = rslt2b).
|
|
100 |
self assert:(val3b = rslt3b).
|
|
101 |
! !
|
|
102 |
|
|
103 |
!OperationInQueueTests class methodsFor:'documentation'!
|
|
104 |
|
|
105 |
version
|
|
106 |
^ '$Header$'
|
|
107 |
! !
|
1701
|
108 |
|