1447
|
1 |
"{ Package: 'stx:goodies/regression' }"
|
323
|
2 |
|
|
3 |
"{ NameSpace: RegressionTests }"
|
|
4 |
|
|
5 |
TestCase subclass:#PowerSetTests
|
|
6 |
instanceVariableNames:''
|
|
7 |
classVariableNames:''
|
|
8 |
poolDictionaries:''
|
1075
|
9 |
category:'tests-Regression-Collections'
|
323
|
10 |
!
|
|
11 |
|
|
12 |
|
|
13 |
!PowerSetTests methodsFor:'testing'!
|
|
14 |
|
|
15 |
test01
|
|
16 |
|s p|
|
|
17 |
|
|
18 |
s := #(1 2 3) asSet.
|
|
19 |
p := PowerSet for:s.
|
|
20 |
|
|
21 |
p do:[:subSet | Transcript showCR:subSet].
|
|
22 |
|
|
23 |
self assert:(p notEmpty).
|
|
24 |
self assert:(p size = 8). "/ [] [1] [2] [3] [1 2] [1 3] [2 3] [1 2 3]
|
|
25 |
|
|
26 |
#(
|
1447
|
27 |
#()
|
|
28 |
#(1)
|
|
29 |
#(2)
|
|
30 |
#(3)
|
|
31 |
#(1 2)
|
|
32 |
#(1 3)
|
|
33 |
#(2 3)
|
|
34 |
#(1 2 3)
|
323
|
35 |
) do:[:eachExpectedElement |
|
1447
|
36 |
self assert:(p includes: eachExpectedElement asSet).
|
323
|
37 |
].
|
|
38 |
|
|
39 |
"
|
|
40 |
self new test01
|
|
41 |
"
|
|
42 |
!
|
|
43 |
|
|
44 |
test02
|
|
45 |
|p|
|
|
46 |
|
|
47 |
p := PowerSet for:(1 to:1000).
|
|
48 |
|
|
49 |
self assert:(p notEmpty).
|
1447
|
50 |
self assert:(p size = (2 raisedTo:1000)).
|
323
|
51 |
|
|
52 |
"
|
|
53 |
self new test02
|
|
54 |
"
|
|
55 |
! !
|
|
56 |
|
|
57 |
!PowerSetTests class methodsFor:'documentation'!
|
|
58 |
|
|
59 |
version
|
|
60 |
^ '$Header$'
|
|
61 |
! !
|
1075
|
62 |
|