ExampleSetTest.st
author Claus Gittinger <cg@exept.de>
Sat, 08 Dec 2001 02:56:14 +0100
changeset 41 9828e423824b
parent 14 a4a5478621e3
child 68 9fd111438d60
permissions -rw-r--r--
description

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

TestCase subclass:#ExampleSetTest
	instanceVariableNames:'full empty'
	classVariableNames:''
	poolDictionaries:''
	category:'SUnit-Tests'
!

!ExampleSetTest class methodsFor:'documentation'!

description
    ^ 'An example test
Tests some operations on Sets.
None should fail.'
! !

!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)
! !

!ExampleSetTest class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/goodies/sunit/ExampleSetTest.st,v 1.5 2001-12-08 01:55:54 cg Exp $'
! !