--- Copyright © 2010 Bart Massey --- [This program is licensed under the "3-clause ('new') BSD License"] --- Please see the file COPYING in the source --- distribution of this software for license terms. import Data.Array import Data.Array.ST import Text.Printf import Test.QuickCheck import qualified Data.Array.MArray.Heapsort as HS import qualified Data.List as L main :: IO () main = mapM_ (\(s, a) -> printf "%-25s: " s >> a) tests prop_heapsort_sorted :: Int -> [Int] -> Bool prop_heapsort_sorted k l = L.sort l == elems r where r = runSTArray $ do a <- newListArray (k, length l + k - 1) l HS.sort a return a tests :: [(String, IO ())] tests = [("Heapsort.sort/List.sort", quickCheck prop_heapsort_sorted)]