# HG changeset patch # User Stefan Vogel # Date 1334426489 -7200 # Node ID 4f04a8bf19c5b15819767881bf2fe90756872c7d # Parent 470e994fc84b68b31d24ed3800e6fb6fc9186b30 added: #testOrderedCollection07_HeapSortRandomCollection diff -r 470e994fc84b -r 4f04a8bf19c5 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'!