author | Claus Gittinger <cg@exept.de> |
Thu, 07 Dec 2000 08:49:35 +0100 | |
changeset 9 | e4ecc750aa38 |
parent 6 | 78bb1397e43d |
child 14 | a4a5478621e3 |
permissions | -rw-r--r-- |
0 | 1 |
"{ Package: 'stx:goodies/sunit' }" |
2 |
||
3 |
TestCase subclass:#ExampleSetTest |
|
4 |
instanceVariableNames:'full empty' |
|
5 |
classVariableNames:'' |
|
6 |
poolDictionaries:'' |
|
6
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
0
diff
changeset
|
7 |
category:'SUnit-Tests' |
0 | 8 |
! |
9 |
||
9 | 10 |
!ExampleSetTest class methodsFor:'documentation'! |
11 |
||
12 |
description |
|
13 |
^ 'An example test |
|
14 |
Tests some operations on Sets.' |
|
15 |
! ! |
|
16 |
||
0 | 17 |
!ExampleSetTest methodsFor:'Running'! |
18 |
||
19 |
setUp |
|
20 |
empty := Set new. |
|
6
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
0
diff
changeset
|
21 |
full := Set with: 5 with: #abc |
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
0
diff
changeset
|
22 |
! ! |
0 | 23 |
|
24 |
!ExampleSetTest methodsFor:'Testing'! |
|
25 |
||
26 |
testAdd |
|
27 |
empty add: 5. |
|
6
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
0
diff
changeset
|
28 |
self assert: (empty includes: 5) |
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
0
diff
changeset
|
29 |
! |
0 | 30 |
|
31 |
testGrow |
|
32 |
empty addAll: (1 to: 100). |
|
6
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
0
diff
changeset
|
33 |
self assert: empty size = 100 |
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
0
diff
changeset
|
34 |
! |
0 | 35 |
|
36 |
testIllegal |
|
37 |
self |
|
38 |
should: [empty at: 5] |
|
39 |
raise: TestResult error. |
|
40 |
self |
|
41 |
should: [empty at: 5 put: #abc] |
|
6
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
0
diff
changeset
|
42 |
raise: TestResult error |
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
0
diff
changeset
|
43 |
! |
0 | 44 |
|
45 |
testIncludes |
|
46 |
self assert: (full includes: 5). |
|
6
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
0
diff
changeset
|
47 |
self assert: (full includes: #abc) |
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
0
diff
changeset
|
48 |
! |
0 | 49 |
|
50 |
testOccurrences |
|
51 |
self assert: (empty occurrencesOf: 0) = 0. |
|
52 |
self assert: (full occurrencesOf: 5) = 1. |
|
53 |
full add: 5. |
|
6
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
0
diff
changeset
|
54 |
self assert: (full occurrencesOf: 5) = 1 |
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
0
diff
changeset
|
55 |
! |
0 | 56 |
|
57 |
testRemove |
|
58 |
full remove: 5. |
|
59 |
self assert: (full includes: #abc). |
|
6
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
0
diff
changeset
|
60 |
self deny: (full includes: 5) |
78bb1397e43d
added rerun-defect tests; fixed button enable bug
Claus Gittinger <cg@exept.de>
parents:
0
diff
changeset
|
61 |
! ! |
0 | 62 |