RegressionTests__OperationInQueueTests.st
author Claus Gittinger <cg@exept.de>
Tue, 09 Jul 2019 18:53:03 +0200
changeset 2327 bf482d49aeaf
parent 2213 720d5d036a6d
permissions -rw-r--r--
#QUALITY by exept class: RegressionTests::StringTests added: #test82c_expanding
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2205
abbfea7d603b #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
     1
"{ Encoding: utf8 }"
abbfea7d603b #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
     2
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 181
diff changeset
     3
"{ Package: 'stx:goodies/regression' }"
92
54539aa534d2 initial checkin
martin
parents:
diff changeset
     4
95
362e58ff28ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 94
diff changeset
     5
"{ NameSpace: RegressionTests }"
362e58ff28ba checkin from browser
Claus Gittinger <cg@exept.de>
parents: 94
diff changeset
     6
92
54539aa534d2 initial checkin
martin
parents:
diff changeset
     7
TestCase subclass:#OperationInQueueTests
54539aa534d2 initial checkin
martin
parents:
diff changeset
     8
	instanceVariableNames:''
54539aa534d2 initial checkin
martin
parents:
diff changeset
     9
	classVariableNames:''
54539aa534d2 initial checkin
martin
parents:
diff changeset
    10
	poolDictionaries:''
2052
916a21ae08e1 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1983
diff changeset
    11
	category:'tests-Regression-Processes'
92
54539aa534d2 initial checkin
martin
parents:
diff changeset
    12
!
54539aa534d2 initial checkin
martin
parents:
diff changeset
    13
54539aa534d2 initial checkin
martin
parents:
diff changeset
    14
54539aa534d2 initial checkin
martin
parents:
diff changeset
    15
!OperationInQueueTests methodsFor:'tests'!
54539aa534d2 initial checkin
martin
parents:
diff changeset
    16
54539aa534d2 initial checkin
martin
parents:
diff changeset
    17
test1
54539aa534d2 initial checkin
martin
parents:
diff changeset
    18
    |op opQ rslt|
54539aa534d2 initial checkin
martin
parents:
diff changeset
    19
54539aa534d2 initial checkin
martin
parents:
diff changeset
    20
    opQ := OperationQueue new.
54539aa534d2 initial checkin
martin
parents:
diff changeset
    21
    op := [ 1 + 2 ].
54539aa534d2 initial checkin
martin
parents:
diff changeset
    22
1983
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    23
    ([
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    24
        rslt := opQ scheduleOperation:op.
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    25
        self assert:(rslt == 3)
2205
abbfea7d603b #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
    26
    ] valueWithTimeout:20 seconds)
1983
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    27
        isNil ifTrue:[
2205
abbfea7d603b #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
    28
            self assert:false message:'test did not finish within 20 seconds'
1983
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    29
        ].
92
54539aa534d2 initial checkin
martin
parents:
diff changeset
    30
2205
abbfea7d603b #UI_ENHANCEMENT by cg
Claus Gittinger <cg@exept.de>
parents: 2052
diff changeset
    31
    "Modified: / 29-03-2019 / 15:13:19 / Claus Gittinger"
92
54539aa534d2 initial checkin
martin
parents:
diff changeset
    32
!
54539aa534d2 initial checkin
martin
parents:
diff changeset
    33
54539aa534d2 initial checkin
martin
parents:
diff changeset
    34
test2
54539aa534d2 initial checkin
martin
parents:
diff changeset
    35
    |op opQ rslt|
54539aa534d2 initial checkin
martin
parents:
diff changeset
    36
54539aa534d2 initial checkin
martin
parents:
diff changeset
    37
    opQ := OperationQueue new.
54539aa534d2 initial checkin
martin
parents:
diff changeset
    38
    op := 1.
54539aa534d2 initial checkin
martin
parents:
diff changeset
    39
1983
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    40
    ([
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    41
        rslt := opQ scheduleOperation:op.
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    42
        self assert:(rslt == 1)
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    43
    ] valueWithTimeout:10 seconds)
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    44
        isNil ifTrue:[
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    45
            self assert:false message:'test did not finish within 10 seconds'
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    46
        ].
92
54539aa534d2 initial checkin
martin
parents:
diff changeset
    47
1983
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    48
    "Modified (format): / 03-07-2018 / 11:48:55 / Claus Gittinger"
92
54539aa534d2 initial checkin
martin
parents:
diff changeset
    49
!
54539aa534d2 initial checkin
martin
parents:
diff changeset
    50
54539aa534d2 initial checkin
martin
parents:
diff changeset
    51
test3
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 181
diff changeset
    52
    |op opQ val1 val2 val3 val1b val2b val3b
92
54539aa534d2 initial checkin
martin
parents:
diff changeset
    53
     rslt rslt1 rslt2 rslt3 p0 p1 p2 p3 rslt1b rslt2b rslt3b p1b p2b p3b sz|
54539aa534d2 initial checkin
martin
parents:
diff changeset
    54
1983
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    55
    ([ 
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    56
        opQ := OperationQueue new.
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    57
        opQ consumerProcessPriority:8.
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    58
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    59
        op := '1'.
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    60
        rslt := opQ scheduleOperation:op.
92
54539aa534d2 initial checkin
martin
parents:
diff changeset
    61
1983
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    62
        self assert:(rslt = '1').
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    63
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    64
        self assert:(opQ size == 0).
92
54539aa534d2 initial checkin
martin
parents:
diff changeset
    65
1983
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    66
        p0 := [
2213
720d5d036a6d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 2205
diff changeset
    67
            opQ scheduleOperation:[ Delay waitForSeconds:1.].
1983
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    68
        ] fork.
92
54539aa534d2 initial checkin
martin
parents:
diff changeset
    69
1983
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    70
        p1 := [
2213
720d5d036a6d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 2205
diff changeset
    71
            rslt1 := opQ scheduleOperation:[val1 := '1'].
1983
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    72
        ] fork.
92
54539aa534d2 initial checkin
martin
parents:
diff changeset
    73
1983
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    74
        p2 := [
2213
720d5d036a6d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 2205
diff changeset
    75
            rslt2 := opQ scheduleOperation:[val2 := '2'].
1983
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    76
        ] fork.
92
54539aa534d2 initial checkin
martin
parents:
diff changeset
    77
1983
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    78
        p3 := [
2213
720d5d036a6d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 2205
diff changeset
    79
            rslt3 := opQ scheduleOperation:[val3 := '3'].
1983
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    80
        ] fork.
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    81
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    82
        Delay waitForSeconds:0.5.
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    83
        self assert:((sz := opQ size) == 3).
92
54539aa534d2 initial checkin
martin
parents:
diff changeset
    84
1983
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    85
        p1b := [
2213
720d5d036a6d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 2205
diff changeset
    86
            rslt1b := opQ scheduleOperation:[val1b := '1'].
1983
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    87
        ] fork.
92
54539aa534d2 initial checkin
martin
parents:
diff changeset
    88
1983
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    89
        p2b := [
2213
720d5d036a6d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 2205
diff changeset
    90
            rslt2b := opQ scheduleOperation:[val2b := '2'].
1983
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    91
        ] fork.
92
54539aa534d2 initial checkin
martin
parents:
diff changeset
    92
1983
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    93
        p3b := [
2213
720d5d036a6d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 2205
diff changeset
    94
            rslt3b := opQ scheduleOperation:[val3b := '3'].
1983
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    95
        ] fork.
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
    96
2213
720d5d036a6d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 2205
diff changeset
    97
        Delay waitForSeconds:0.1.
720d5d036a6d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 2205
diff changeset
    98
        self assert:(opQ size == 6).
92
54539aa534d2 initial checkin
martin
parents:
diff changeset
    99
2213
720d5d036a6d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 2205
diff changeset
   100
        Delay waitForSeconds:1.
1983
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
   101
        self assert:((sz := opQ size) == 0).
92
54539aa534d2 initial checkin
martin
parents:
diff changeset
   102
1983
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
   103
        self assert:(val1 == rslt1).
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
   104
        self assert:(val2 == rslt2).
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
   105
        self assert:(val3 == rslt3).
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
   106
        self assert:(rslt1 = rslt1b).
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
   107
        self assert:(rslt2 = rslt2b).
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
   108
        self assert:(rslt3 = rslt3b).
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
   109
        self assert:(val1b = rslt1b).
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
   110
        self assert:(val2b = rslt2b).
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
   111
        self assert:(val3b = rslt3b).
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
   112
    ] valueWithTimeout:30 seconds)
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
   113
        isNil ifTrue:[
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
   114
            self assert:false message:'test did not finish within 30 seconds'
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
   115
        ].
c3cc934ecc69 #OTHER by cg
Claus Gittinger <cg@exept.de>
parents: 1701
diff changeset
   116
2213
720d5d036a6d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 2205
diff changeset
   117
    "Modified: / 02-04-2019 / 15:34:28 / Claus Gittinger"
92
54539aa534d2 initial checkin
martin
parents:
diff changeset
   118
! !
54539aa534d2 initial checkin
martin
parents:
diff changeset
   119
54539aa534d2 initial checkin
martin
parents:
diff changeset
   120
!OperationInQueueTests class methodsFor:'documentation'!
54539aa534d2 initial checkin
martin
parents:
diff changeset
   121
54539aa534d2 initial checkin
martin
parents:
diff changeset
   122
version
54539aa534d2 initial checkin
martin
parents:
diff changeset
   123
    ^ '$Header$'
54539aa534d2 initial checkin
martin
parents:
diff changeset
   124
! !
1701
48849326905a #BUGFIX by sr
sr
parents: 1447
diff changeset
   125