# HG changeset patch # User Claus Gittinger # Date 1138051295 -3600 # Node ID eb142b88180a270726db5d42ad000265d9135d1a # Parent 9f92e951baf2d7afeea0d676461dd2ffdf6531dd *** empty log message *** diff -r 9f92e951baf2 -r eb142b88180a RegressionTests__CollectionTests.st --- a/RegressionTests__CollectionTests.st Mon Jan 09 10:23:25 2006 +0100 +++ b/RegressionTests__CollectionTests.st Mon Jan 23 22:21:35 2006 +0100 @@ -3,7 +3,7 @@ "{ NameSpace: RegressionTests }" TestCase subclass:#CollectionTests - instanceVariableNames:'' + instanceVariableNames:'empty nonEmpty' classVariableNames:'' poolDictionaries:'' category:'tests-Regression' @@ -37,6 +37,13 @@ "Created: / 8.11.2001 / 08:17:09 / cg" ! ! +!CollectionTests methodsFor:'initialize-release'! + +setUp + empty := Set new. + nonEmpty := OrderedCollection with: #x +! ! + !CollectionTests methodsFor:'tests-dictionary'! testDictionary01 @@ -307,6 +314,41 @@ " ! ! +!CollectionTests methodsFor:'tests-squeak'! + +testIfEmptyifNotEmpty + self assert: (empty ifEmpty: [true] ifNotEmpty: [false]). + self assert: (nonEmpty ifEmpty: [false] ifNotEmpty: [true]). + self assert: (nonEmpty ifEmpty: [false] ifNotEmpty: [:s | s first = #x]) +! + +testIfEmptyifNotEmptyDo + self assert: (empty ifEmpty: [true] ifNotEmptyDo: [:s | false]). + self assert: (nonEmpty ifEmpty: [false] ifNotEmptyDo: [:s | s first = #x]) +! + +testIfNotEmpty + empty ifNotEmpty: [self assert: false]. + self assert: (nonEmpty ifNotEmpty: [self]) == self. + self assert: (nonEmpty ifNotEmpty: [:s | s first]) = #x +! + +testIfNotEmptyDo + empty ifNotEmptyDo: [:s | self assert: false]. + self assert: (nonEmpty ifNotEmptyDo: [:s | s first]) = #x +! + +testIfNotEmptyDoifNotEmpty + self assert: (empty ifNotEmptyDo: [:s | false] ifEmpty: [true]). + self assert: (nonEmpty ifNotEmptyDo: [:s | s first = #x] ifEmpty: [false]) +! + +testIfNotEmptyifEmpty + self assert: (empty ifEmpty: [true] ifNotEmpty: [false]). + self assert: (nonEmpty ifEmpty: [false] ifNotEmpty: [true]). + self assert: (nonEmpty ifEmpty: [false] ifNotEmpty: [:s | s first = #x]) +! ! + !CollectionTests::SortTestData methodsFor:'accessing'! value