author | Jan Vrany <jan.vrany@fit.cvut.cz> |
Wed, 29 Jun 2016 21:40:53 +0100 | |
branch | jv |
changeset 1499 | 26a16a04219b |
parent 1075 | 6c94d6335387 |
child 1500 | d406a10b2965 |
permissions | -rw-r--r-- |
1499
26a16a04219b
Package renamed from exept:regression to stx:goodies/regression. Hooray!
Jan Vrany <jan.vrany@fit.cvut.cz>
parents:
1075
diff
changeset
|
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 |
#( |
|
27 |
#() |
|
28 |
#(1) |
|
29 |
#(2) |
|
30 |
#(3) |
|
31 |
#(1 2) |
|
32 |
#(1 3) |
|
33 |
#(2 3) |
|
34 |
#(1 2 3) |
|
35 |
) do:[:eachExpectedElement | |
|
679 | 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). |
|
50 |
self assert:(p size = (2 raisedTo:1000)). |
|
51 |
||
52 |
" |
|
53 |
self new test02 |
|
54 |
" |
|
55 |
! ! |
|
56 |
||
57 |
!PowerSetTests class methodsFor:'documentation'! |
|
58 |
||
59 |
version |
|
60 |
^ '$Header$' |
|
61 |
! ! |
|
1075 | 62 |