#DOCUMENTATION by cg
class: RegressionTests::ExternalStreamTest
added:
#testWriteNewStreams1
#testWriteNewStreams2
#testWriteNewStreams3
removed:
#testWrite1
#testWrite2
#testWrite3
comment/format in:
#testPosition1
#testPosition2
#testRead1
#testRead2
#testRead3
#testReadWait1
#testTiming1
#testTiming2
category of:
#testPosition1
#testPosition2
#testRead1
#testRead2
#testRead3
#testReadWait1
#testTiming1
#testTiming2
"{ Encoding: utf8 }"
"{ Package: 'stx:goodies/regression' }"
"{ NameSpace: RegressionTests }"
TestCase subclass:#CacheDictionaryTest
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'tests-Regression-Collections'
!
!CacheDictionaryTest methodsFor:'testing'!
testAdd
"(self run: #testAdd)"
| dict |
dict := CacheDictionary new:4.
self assert: (dict isEmpty).
dict add:(1->'one').
self assert: (dict size == 1).
dict add:(2->'two').
self assert: (dict size == 2).
dict add:(3->'three').
self assert: (dict size == 3).
dict add:(4->'four').
self assert: (dict size == 4).
dict add:(5->'five').
self assert: (dict size == 5).
dict add:(6->'six').
self assert: (dict size == 6).
dict add:(7->'seven').
self assert: (dict size == 7).
dict add:(8->'eight').
self assert: (dict size == 7).
dict add:(9->'nine').
self assert: (dict size == 7).
!
testAddRemove
"(self run: #testAddRemove)"
| dict notThere wasRemoved toRemove keysBefore keysAfter|
dict := CacheDictionary new:4.
self assert: (dict isEmpty).
1 to:50 do:[:i | dict at:i put:i printString].
self assert: (dict size == 7).
self assert:(dict includesKey:17) not.
notThere := false.
wasRemoved := (dict removeKey:17 ifAbsent:[ notThere := true. nil ]) notNil.
self assert:notThere.
self assert:wasRemoved not.
self assert:(dict size == 7).
toRemove := dict keys first.
self assert:(dict includesKey:toRemove).
notThere := false.
wasRemoved := (dict removeKey:toRemove ifAbsent:[ notThere := true. nil ]) notNil.
self assert:notThere not.
self assert:wasRemoved.
self assert:(dict size == 6).
keysBefore := dict keys copy.
self assert:(dict size == keysBefore size).
dict add:(99->'99').
keysAfter := dict keys copy.
self assert:(dict size == keysAfter size).
!
testSizes
"(self run: #testAddRemove)"
| dict origCapacity|
dict := CacheDictionary new:500.
self assert: (dict isEmpty).
self assert: ((origCapacity := dict capacity) >= 500).
1 to:50 do:[:i | dict at:i put:i printString].
self assert: (dict size == 50).
self assert: (origCapacity == dict capacity).
1 to:50 do:[:i | dict removeKey:i ifAbsent:[]].
self assert: (dict size == 0).
self assert: (origCapacity == dict capacity).
! !
!CacheDictionaryTest class methodsFor:'documentation'!
version
^ '$Header$'
!
version_CVS
^ '$Header$'
! !