0
|
1 |
'From Smalltalk/X, Version:4.1.1 on 24-oct-2000 at 08:11:03 pm' !
|
|
2 |
|
|
3 |
"{ Package: 'stx:goodies/sunit' }"
|
|
4 |
|
|
5 |
TestCase subclass:#ExampleSetTest
|
|
6 |
instanceVariableNames:'full empty'
|
|
7 |
classVariableNames:''
|
|
8 |
poolDictionaries:''
|
|
9 |
category:'SUnitTests'
|
|
10 |
!
|
|
11 |
|
|
12 |
!ExampleSetTest methodsFor:'Running'!
|
|
13 |
|
|
14 |
setUp
|
|
15 |
empty := Set new.
|
|
16 |
full := Set with: 5 with: #abc! !
|
|
17 |
|
|
18 |
!ExampleSetTest methodsFor:'Testing'!
|
|
19 |
|
|
20 |
testAdd
|
|
21 |
empty add: 5.
|
|
22 |
self assert: (empty includes: 5)!
|
|
23 |
|
|
24 |
testGrow
|
|
25 |
empty addAll: (1 to: 100).
|
|
26 |
self assert: empty size = 100!
|
|
27 |
|
|
28 |
testIllegal
|
|
29 |
self
|
|
30 |
should: [empty at: 5]
|
|
31 |
raise: TestResult error.
|
|
32 |
self
|
|
33 |
should: [empty at: 5 put: #abc]
|
|
34 |
raise: TestResult error!
|
|
35 |
|
|
36 |
testIncludes
|
|
37 |
self assert: (full includes: 5).
|
|
38 |
self assert: (full includes: #abc)!
|
|
39 |
|
|
40 |
testOccurrences
|
|
41 |
self assert: (empty occurrencesOf: 0) = 0.
|
|
42 |
self assert: (full occurrencesOf: 5) = 1.
|
|
43 |
full add: 5.
|
|
44 |
self assert: (full occurrencesOf: 5) = 1!
|
|
45 |
|
|
46 |
testRemove
|
|
47 |
full remove: 5.
|
|
48 |
self assert: (full includes: #abc).
|
|
49 |
self deny: (full includes: 5)! !
|
|
50 |
|