added:5 methods
authorClaus Gittinger <cg@exept.de>
Mon, 08 Aug 2011 16:01:30 +0200
changeset 615 3a61700c6e88
parent 614 61a039961050
child 616 b1c37b2c7848
added:5 methods changed: #testGeneralOperations
RegressionTests__CollectionTests.st
--- a/RegressionTests__CollectionTests.st	Sun Aug 07 15:31:26 2011 +0200
+++ b/RegressionTests__CollectionTests.st	Mon Aug 08 16:01:30 2011 +0200
@@ -103,6 +103,102 @@
 
 !CollectionTests methodsFor:'tests-general'!
 
+doTestDictionaryLikeAddRemoveOperationsIn:aClass
+    |coll|
+
+    coll := aClass new.
+
+    self assert: ( coll size == 0 ).
+    self assert: ( coll isEmpty ).
+    self assert: ( coll notEmpty not ).
+    self assert: ( coll isEmptyOrNil ).
+    self assert: ( coll notEmptyOrNil not ).
+
+    coll at:1 put:'one'.
+
+    self assert: ( coll size == 1 ).
+    self assert: ( coll isEmpty not).
+    self assert: ( coll notEmpty ).
+    self assert: ( coll isEmptyOrNil not ).
+    self assert: ( coll notEmptyOrNil ).
+
+    coll at:2 put:'two'.
+
+    self assert: ( coll size == 2 ).
+    self assert: ( coll isEmpty not).
+    self assert: ( coll notEmpty ).
+    self assert: ( coll isEmptyOrNil not ).
+    self assert: ( coll notEmptyOrNil ).
+
+    coll removeKey:2.
+    self assert: ( coll size == 1 ).
+    self assert: ( coll isEmpty not).
+    self assert: ( coll notEmpty ).
+    self assert: ( coll isEmptyOrNil not ).
+    self assert: ( coll notEmptyOrNil ).
+
+    coll removeKey:1.
+    self assert: ( coll size == 0 ).
+    self assert: ( coll isEmpty ).
+    self assert: ( coll notEmpty not ).
+    self assert: ( coll isEmptyOrNil ).
+    self assert: ( coll notEmptyOrNil not ).
+
+    "
+     self basicNew doTestDictionaryLikeAddRemoveOperations
+    "
+
+    "Created: / 08-08-2011 / 16:01:14 / cg"
+!
+
+doTestGeneralAddRemoveOperationsIn:aClass
+    |coll|
+
+    coll := aClass new.
+
+    self assert: ( coll size == 0 ).
+    self assert: ( coll isEmpty ).
+    self assert: ( coll notEmpty not ).
+    self assert: ( coll isEmptyOrNil ).
+    self assert: ( coll notEmptyOrNil not ).
+
+    coll add:1.
+
+    self assert: ( coll size == 1 ).
+    self assert: ( coll isEmpty not).
+    self assert: ( coll notEmpty ).
+    self assert: ( coll isEmptyOrNil not ).
+    self assert: ( coll notEmptyOrNil ).
+
+    coll add:2.
+
+    self assert: ( coll size == 2 ).
+    self assert: ( coll isEmpty not).
+    self assert: ( coll notEmpty ).
+    self assert: ( coll isEmptyOrNil not ).
+    self assert: ( coll notEmptyOrNil ).
+
+    coll remove:2.
+    self assert: ( coll size == 1 ).
+    self assert: ( coll isEmpty not).
+    self assert: ( coll notEmpty ).
+    self assert: ( coll isEmptyOrNil not ).
+    self assert: ( coll notEmptyOrNil ).
+
+    coll remove:1.
+    self assert: ( coll size == 0 ).
+    self assert: ( coll isEmpty ).
+    self assert: ( coll notEmpty not ).
+    self assert: ( coll isEmptyOrNil ).
+    self assert: ( coll notEmptyOrNil not ).
+
+    "
+     self basicNew testGeneralOperations
+    "
+
+    "Created: / 08-08-2011 / 16:00:06 / cg"
+!
+
 doTestGeneralCollectionOperationsIn:aClass
     |coll|
 
@@ -125,6 +221,58 @@
     "
 !
 
+testDictionaryLikeAddRemoveOperations
+    |classes|
+
+    classes := OrderedCollection new.
+    classes 
+        add:Dictionary;
+        add:IdentityDictionary;
+        add:OrderedDictionary;
+        add:BTree.
+
+    classes do:[:eachClass |
+        self doTestDictionaryLikeAddRemoveOperationsIn:eachClass
+    ].
+
+    "
+     self basicNew testDictionaryLikeAddRemoveOperations
+    "
+
+    "Created: / 08-08-2011 / 15:59:52 / cg"
+!
+
+testGeneralAddRemoveOperations
+    |classes|
+
+    classes := OrderedCollection new.
+    classes 
+        "/ add:RunArray;
+        add:Bag;
+        add:Set;
+        add:IdentitySet;
+        "/add:Dictionary;
+        "/add:IdentityDictionary;
+        add:OrderedCollection;
+        add:SortedCollection;
+        "/add:Queue;
+        "/add:Stack;
+        add:SortedCollection;
+        "/add:OrderedDictionary;
+        add:OrderedSet.
+        "/add:BTree.
+
+    classes do:[:eachClass |
+        self doTestGeneralAddRemoveOperationsIn:eachClass
+    ].
+
+    "
+     self basicNew testGeneralAddRemoveOperations
+    "
+
+    "Created: / 08-08-2011 / 15:59:02 / cg"
+!
+
 testGeneralOperations
     |classes|
 
@@ -142,7 +290,8 @@
         add:Stack;
         add:SortedCollection;
         add:OrderedDictionary;
-        add:OrderedSet.
+        add:OrderedSet;
+        add:BTree.
 
     classes do:[:eachClass |
         self doTestGeneralCollectionOperationsIn:eachClass
@@ -151,6 +300,8 @@
     "
      self basicNew testGeneralOperations
     "
+
+    "Modified: / 08-08-2011 / 15:53:16 / cg"
 ! !
 
 !CollectionTests methodsFor:'tests-interval'!