Commit 8346d8f6 authored by Simon Marlow's avatar Simon Marlow
Browse files

add test from #2317

parent 74106f16
{-# LANGUAGE PatternSignatures #-}
import Control.Monad
import Control.Parallel
import System.Environment
import System.Random
sort (x:xs) = sort lesser ++ [x] ++ sort greater
where lesser = filter (< x) xs
greater = filter (>= x) xs
sort _ = []
psort xs 10 = sort xs
psort (x:xs) d = let d' = d + 1
l = psort lesser d'
g = psort greater d'
in l `par` g `par` (l ++ [x] ++ g)
where lesser = filter (< x) xs
greater = filter (>= x) xs
psort _ _ = []
main = do
args <- getArgs
let counts | null args = [100000]
| otherwise = map read args
rs :: [Int] <- randoms `fmap` getStdGen
forM_ counts $ \k -> do
let xs = take k rs
print . length $ xs
-- s <- getCurrentTime
print . length $ psort xs 0
-- e <- getCurrentTime
-- print (e `diffUTCTime` s)
TOP=../../../..
include $(TOP)/mk/boilerplate.mk
include $(TOP)/mk/test.mk
test('2317', [skip_if_fast, reqlib('parallel')],
multimod_compile_and_run, ['2317',''])
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment