added: #testOrderedCollection07_HeapSortRandomCollection
authorStefan Vogel <sv@exept.de>
Sat, 14 Apr 2012 20:01:29 +0200
changeset 657 4f04a8bf19c5
parent 656 470e994fc84b
child 658 9884ba816a34
added: #testOrderedCollection07_HeapSortRandomCollection
RegressionTests__CollectionTests.st
--- a/RegressionTests__CollectionTests.st	Thu Apr 12 21:11:11 2012 +0200
+++ b/RegressionTests__CollectionTests.st	Sat Apr 14 20:01:29 2012 +0200
@@ -546,6 +546,29 @@
          sorted := data copy mergeSort:[:a :b| a < b].
          self checkSorted:sorted with:checkBlock against:data.
     ].
+!
+
+testOrderedCollection07_HeapSortRandomCollection
+     |data sorted rg checkBlock|
+    
+     checkBlock := [:a :b| a <= b].   
+     rg := Random new.
+
+     #(1 4 11 2000 20011 200000) do:[:eachSize|
+         data := Array new:eachSize.
+         1 to:data size do:[:i |
+            data at:i put:(rg nextIntegerBetween:1 and:100).
+         ].
+         sorted := data copy heapSort.
+         self checkSorted:sorted with:checkBlock against:data.
+         sorted := sorted heapSort.
+         self checkSorted:sorted with:checkBlock against:data.
+         sorted := sorted reverse heapSort.
+         self checkSorted:sorted with:checkBlock against:data.
+
+         sorted := data copy heapSort:[:a :b| a < b].
+         self checkSorted:sorted with:checkBlock against:data.
+    ].
 ! !
 
 !CollectionTests methodsFor:'tests-orderedDictionary'!