#BUGFIX by cg
authorClaus Gittinger <cg@exept.de>
Thu, 17 May 2018 23:31:05 +0200
changeset 1939 9a6e4956515f
parent 1938 a9eb8f25b88e
child 1940 8e0e4fbf523d
#BUGFIX by cg class: RegressionTests::CacheDictionaryTest added: #testSizes
RegressionTests__CacheDictionaryTest.st
--- a/RegressionTests__CacheDictionaryTest.st	Thu May 17 23:12:17 2018 +0200
+++ b/RegressionTests__CacheDictionaryTest.st	Thu May 17 23:31:05 2018 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
 "{ Package: 'stx:goodies/regression' }"
 
 "{ NameSpace: RegressionTests }"
@@ -79,6 +81,24 @@
     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'!