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