RegressionTests__QueueTest.st
author Stefan Vogel <sv@exept.de>
Tue, 11 Jun 2019 10:34:41 +0200
changeset 2321 32ea6329f5ad
parent 1691 684012a746c0
permissions -rw-r--r--
class: stx_goodies_regression class changed: #classNamesAndAttributes make classes autoloaded that stc cannot compile (yet)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1057
diff changeset
     1
"{ Package: 'stx:goodies/regression' }"
171
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
"{ NameSpace: RegressionTests }"
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
TestCase subclass:#QueueTest
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
	instanceVariableNames:''
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
	classVariableNames:''
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
	poolDictionaries:''
1057
0d8367313171 category
Claus Gittinger <cg@exept.de>
parents: 181
diff changeset
     9
	category:'tests-Regression-Collections'
171
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
!
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
1534
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
    13
!QueueTest class methodsFor:'queries'!
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
    14
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
    15
coveredClassNames
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
    16
    ^ #( Queue )
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
    17
! !
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
    18
1691
684012a746c0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1534
diff changeset
    19
!QueueTest methodsFor:'helpers'!
684012a746c0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1534
diff changeset
    20
684012a746c0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1534
diff changeset
    21
removeAllSize:size fill:fill
684012a746c0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1534
diff changeset
    22
684012a746c0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1534
diff changeset
    23
    |q|
684012a746c0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1534
diff changeset
    24
684012a746c0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1534
diff changeset
    25
    q := Queue new:size.
684012a746c0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1534
diff changeset
    26
684012a746c0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1534
diff changeset
    27
    1 to:fill do:[:i|
684012a746c0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1534
diff changeset
    28
	q nextPut:i.
684012a746c0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1534
diff changeset
    29
    ].
684012a746c0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1534
diff changeset
    30
    q removeAll.
684012a746c0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1534
diff changeset
    31
    self assert:q isEmpty.
684012a746c0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1534
diff changeset
    32
! !
684012a746c0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1534
diff changeset
    33
684012a746c0 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 1534
diff changeset
    34
!QueueTest methodsFor:'testing'!
171
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
testBasic1
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
    |q el|
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
    q := Queue new:5.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
    self assert:q isEmpty.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
    self assert:q size == 0.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
    q nextPut:1.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
    self assert:q notEmpty.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
    self assert:q size == 1.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
    q nextPut:2.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
    self assert:q notEmpty.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
    self assert:q size == 2.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
    el := q next.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
    self assert:q notEmpty.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
    self assert:q size == 1.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
    self assert:(el==1).
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
    el := q next.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
    self assert:q isEmpty.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
    self assert:q size == 0.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
    self assert:(el==2).
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
    "
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1057
diff changeset
    59
     self new testBasic1
171
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
    "
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
!
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
testBasic2
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
    |q el|
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
    q := Queue new:5.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
    self assert:q isEmpty.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
    self assert:q size == 0.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
    q nextPut:1.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
    q nextPut:2.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
    q nextPut:3.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
    q nextPut:4.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
    q nextPut:5.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
    el := q next.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
    self assert:(el==1).
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
    el := q next.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
    self assert:(el==2).
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
    el := q next.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
    self assert:(el==3).
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
    el := q next.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
    self assert:(el==4).
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
    el := q next.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
    self assert:(el==5).
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
    "
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1057
diff changeset
    87
     self new testBasic2
171
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
    "
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
!
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
testBasic3
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
    |q el|
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
    q := Queue new:5.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96
    self assert:q isEmpty.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    97
    self assert:q size == 0.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    98
    q nextPut:1.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    99
    q nextPut:2.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   100
    q nextPut:3.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   101
    q nextPut:4.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   102
    q nextPut:5.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   103
    self should:[q nextPut:6] raise:Error.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   104
    el := q next.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   105
    self assert:(el==1).
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   106
    el := q next.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   107
    self assert:(el==2).
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   108
    el := q next.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   109
    self assert:(el==3).
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   110
    el := q next.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   111
    self assert:(el==4).
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   112
    el := q next.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   113
    self assert:(el==5).
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   114
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   115
    "
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1057
diff changeset
   116
     self new testBasic3
171
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   117
    "
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   118
!
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   119
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   120
testBasic4
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   121
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   122
    |q el|
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   123
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   124
    q := Queue new:5.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   125
    self assert:q isEmpty.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   126
    self assert:q size == 0.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   127
    q nextPut:1.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   128
    q nextPutFirst:2.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   129
    q nextPutFirst:3.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   130
    q nextPutFirst:4.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   131
    q nextPutFirst:5.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   132
    self should:[q nextPutFirst:6] raise:Error.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   133
    el := q next.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   134
    self assert:(el==5).
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   135
    el := q next.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   136
    self assert:(el==4).
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   137
    el := q next.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   138
    self assert:(el==3).
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   139
    el := q next.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   140
    self assert:(el==2).
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   141
    el := q next.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   142
    self assert:(el==1).
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   143
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   144
    "
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1057
diff changeset
   145
     self new testBasic4
171
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   146
    "
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   147
!
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   148
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   149
testBasic5
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   150
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   151
    |q el|
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   152
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   153
    q := Queue new:5.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   154
    self assert:q isEmpty.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   155
    self assert:q size == 0.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   156
    q nextPutFirst:1.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   157
    q nextPutFirst:2.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   158
    q nextPutFirst:3.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   159
    el := q next.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   160
    self assert:(el==3).
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   161
    el := q next.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   162
    self assert:(el==2).
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   163
    el := q next.
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   164
    self assert:(el==1).
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   165
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   166
    "
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1057
diff changeset
   167
     self new testBasic5
171
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   168
    "
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   169
!
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   170
1534
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   171
testChangeCapacity
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   172
    "tests all kinds of boundary conditions in the capacity-change code
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   173
     (i.e. especially wraps)"
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   174
     
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   175
     |q|
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   176
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   177
     #(false true) do:[:wrap |
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   178
        1 to:10 do:[:fill |
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   179
            1 to:fill do:[:read |
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   180
                 Transcript show:'wrap: '; show:wrap; show:' fill: '; show:fill; show:' read: '; showCR:read.
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   181
                
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   182
                 q := Queue new:10.
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   183
                 self assert:(q capacity == 10).
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   184
                 wrap ifTrue:[
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   185
                     1 to:5 do:[:i | q nextPut:#foo ].
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   186
                 ].
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   187
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   188
                 1 to:fill do:[:i | q nextPut:i.
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   189
                                    (i==1 and:[wrap]) ifTrue:[ 1 to:5 do:[:i | q next ] ].
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   190
                              ].
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   191
                "/ (wrap and:[fill==9 and:[read == 8]]) ifTrue:[self halt].
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   192
                 read timesRepeat:[ q next ].
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   193
                 q capacity:12.
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   194
                 self assert:(q capacity == 12).
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   195
                 self assert:(q size == (fill-read)).
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   196
                 self assert:((Array streamContents:[:s | q do:[:e |s nextPut:e]]) = (read+1 to:fill) asArray).
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   197
                 self assert:(q size == (fill-read)).
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   198
                 fill==read ifTrue:[
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   199
                     self assert:(q isEmpty).
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   200
                     self assert:(q notEmpty not).
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   201
                     self assert:(q size == 0).
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   202
                     self assert:(q nextOrNil == nil).
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   203
                     self assert:(q peekOrNil == nil).
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   204
                     self should:[q at:1] raise:SubscriptOutOfBoundsError.
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   205
                 ] ifFalse:[
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   206
                     self assert:(q notEmpty).
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   207
                     self assert:(q isEmpty not).
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   208
                     self assert:(q at:1) == (read+1).
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   209
                     self assert:(q peek) == (read+1).
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   210
                     self assert:(q peekOrNil) == (read+1).
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   211
                 ].        
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   212
            ].    
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   213
        ].    
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   214
     ]. 
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   215
!
65f4fdae8ad0 #QUALITY by cg
Claus Gittinger <cg@exept.de>
parents: 1447
diff changeset
   216
171
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   217
testRemoveAll
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   218
    0 to:10 do:[:i|
1447
2351db93aa5b package changes
Claus Gittinger <cg@exept.de>
parents: 1057
diff changeset
   219
	self removeAllSize:10 fill:i.
171
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   220
    ].
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   221
! !
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   222
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   223
!QueueTest class methodsFor:'documentation'!
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   224
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   225
version
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   226
    ^ '$Header$'
21c0c65568af initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
   227
! !
1057
0d8367313171 category
Claus Gittinger <cg@exept.de>
parents: 181
diff changeset
   228