ExampleSetTest.st
author Claus Gittinger <cg@exept.de>
Wed, 25 Oct 2000 17:51:59 +0200
changeset 0 9365d5753f11
child 6 78bb1397e43d
permissions -rw-r--r--
*** empty log message ***

'From Smalltalk/X, Version:4.1.1 on 24-oct-2000 at 08:11:03 pm'                 !

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

TestCase subclass:#ExampleSetTest
	instanceVariableNames:'full empty'
	classVariableNames:''
	poolDictionaries:''
	category:'SUnitTests'
!

!ExampleSetTest methodsFor:'Running'!

setUp
	empty := Set new.
	full := Set with: 5 with: #abc! !

!ExampleSetTest methodsFor:'Testing'!

testAdd
	empty add: 5.
	self assert: (empty includes: 5)!

testGrow
	empty addAll: (1 to: 100).
	self assert: empty size = 100!

testIllegal
	self 
		should: [empty at: 5] 
		raise: TestResult error.
	self 
		should: [empty at: 5 put: #abc] 
		raise: TestResult error!

testIncludes
	self assert: (full includes: 5).
	self assert: (full includes: #abc)!

testOccurrences
	self assert: (empty occurrencesOf: 0) = 0.
	self assert: (full occurrencesOf: 5) = 1.
	full add: 5.
	self assert: (full occurrencesOf: 5) = 1!

testRemove
	full remove: 5.
	self assert: (full includes: #abc).
	self deny: (full includes: 5)! !