96
|
1 |
"{ Package: 'exept:regression' }"
|
105
|
2 |
|
96
|
3 |
"{ NameSpace: RegressionTests }"
|
105
|
4 |
|
|
5 |
TestCase subclass:#DelayTest
|
|
6 |
instanceVariableNames:''
|
|
7 |
classVariableNames:''
|
|
8 |
poolDictionaries:''
|
181
|
9 |
category:'tests-Regression'
|
96
|
10 |
!
|
105
|
11 |
|
106
|
12 |
|
586
|
13 |
!DelayTest class methodsFor:'others'!
|
|
14 |
|
|
15 |
version_CVS
|
|
16 |
^ '$Header$'
|
|
17 |
! !
|
|
18 |
|
|
19 |
!DelayTest class methodsFor:'queries'!
|
|
20 |
|
|
21 |
coveredClasses
|
|
22 |
^ Array with:Delay
|
|
23 |
|
|
24 |
"Created: / 05-07-2011 / 09:51:28 / cg"
|
|
25 |
! !
|
|
26 |
|
105
|
27 |
!DelayTest methodsFor:'tests'!
|
|
28 |
|
96
|
29 |
test1
|
|
30 |
|n|
|
55
|
31 |
|
96
|
32 |
[
|
|
33 |
n := 0.
|
|
34 |
[n < 10] whileTrue:[
|
106
|
35 |
Delay waitForSeconds:0.1.
|
96
|
36 |
Transcript showCR:n.
|
|
37 |
n := n + 1.
|
|
38 |
]
|
105
|
39 |
] forkAt:(Processor activePriority - 1).
|
|
40 |
|
|
41 |
self assert:(n == nil).
|
|
42 |
|
106
|
43 |
Delay waitForSeconds:0.1.
|
105
|
44 |
|
|
45 |
self assert:(n == 0).
|
|
46 |
|
106
|
47 |
Delay waitForSeconds:1.5.
|
105
|
48 |
|
|
49 |
self assert:(n == 10).
|
|
50 |
|
|
51 |
"
|
|
52 |
self basicNew test1
|
|
53 |
"
|
|
54 |
!
|
|
55 |
|
|
56 |
test2
|
|
57 |
|n|
|
|
58 |
|
|
59 |
[
|
|
60 |
n := 0.
|
|
61 |
[n < 10] whileTrue:[
|
106
|
62 |
Delay waitForSeconds:0.1.
|
105
|
63 |
Transcript showCR:n.
|
|
64 |
n := n + 1.
|
|
65 |
]
|
|
66 |
] forkAt:(Processor activePriority + 1).
|
|
67 |
|
|
68 |
self assert:(n == 0).
|
106
|
69 |
Delay waitForSeconds:1.1.
|
105
|
70 |
self assert:(n == 10).
|
|
71 |
|
|
72 |
"
|
|
73 |
self basicNew test2
|
|
74 |
"
|
592
|
75 |
!
|
|
76 |
|
|
77 |
test3_longDelay
|
|
78 |
"in stx6.2.1, the following does not wait, due to an overflow in
|
|
79 |
the millisecond computation..."
|
|
80 |
|
|
81 |
|stillWaiting watchDogBite|
|
|
82 |
|
|
83 |
[
|
|
84 |
watchDogBite := false.
|
|
85 |
stillWaiting := true.
|
|
86 |
Delay waitForSeconds:1000000.
|
|
87 |
stillWaiting := false.
|
|
88 |
] valueWithWatchDog:[ watchDogBite := true] afterMilliseconds:1000.
|
|
89 |
|
|
90 |
self assert:stillWaiting.
|
|
91 |
self assert:watchDogBite.
|
|
92 |
|
|
93 |
"
|
|
94 |
self basicNew test3_longDelay
|
|
95 |
"
|
|
96 |
|
|
97 |
"Created: / 31-07-2011 / 18:44:53 / cg"
|
96
|
98 |
! !
|
105
|
99 |
|
106
|
100 |
!DelayTest class methodsFor:'documentation'!
|
|
101 |
|
|
102 |
version
|
|
103 |
^ '$Header$'
|
|
104 |
! !
|