RegressionTests__PowerSetTests.st
author Jan Vrany <jan.vrany@labware.com>
Mon, 08 Mar 2021 11:25:35 +0000
branchjv
changeset 2594 e5f39c0a5bd6
parent 1500 d406a10b2965
permissions -rwxr-xr-x
Improve UTF8 read/write tests in `ChangeSetTests`

"{ Package: 'stx:goodies/regression' }"

"{ NameSpace: RegressionTests }"

TestCase subclass:#PowerSetTests
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'tests-Regression-Collections'
!


!PowerSetTests methodsFor:'testing'!

test01
    |s p|

    s := #(1 2 3) asSet.
    p := PowerSet for:s.

    p do:[:subSet | Transcript showCR:subSet].

    self assert:(p notEmpty).
    self assert:(p size = 8).     "/ [] [1] [2] [3] [1 2] [1 3] [2 3] [1 2 3]

    #(
	#()
	#(1)
	#(2)
	#(3)
	#(1 2)
	#(1 3)
	#(2 3)
	#(1 2 3)
    ) do:[:eachExpectedElement |
	self assert:(p includes: eachExpectedElement asSet).
    ].

    "
     self new test01
    "
!

test02
    |p|

    p := PowerSet for:(1 to:1000).

    self assert:(p notEmpty).
    self assert:(p size = (2 raisedTo:1000)).

    "
     self new test02
    "
! !

!PowerSetTests class methodsFor:'documentation'!

version
    ^ '$Header$'
! !