diff options
author | sof <unknown> | 1999-05-13 11:03:11 +0000 |
---|---|---|
committer | sof <unknown> | 1999-05-13 11:03:11 +0000 |
commit | 40fc171e42f6d0bceeff32d8f737bf1be345a9a0 (patch) | |
tree | 6e4deebbe5ec4ee206388987dc4b5fce6a3d92e5 | |
parent | dc83b06b33d7aedd3e193828c786e2f7e7bbb9cf (diff) | |
download | haskell-40fc171e42f6d0bceeff32d8f737bf1be345a9a0.tar.gz |
[project @ 1999-05-13 11:03:10 by sof]
Testing the Random library (not complete).
-rw-r--r-- | ghc/tests/lib/should_run/rand001.hs | 22 | ||||
-rw-r--r-- | ghc/tests/lib/should_run/rand001.stdout | 5 |
2 files changed, 27 insertions, 0 deletions
diff --git a/ghc/tests/lib/should_run/rand001.hs b/ghc/tests/lib/should_run/rand001.hs new file mode 100644 index 0000000000..f514325829 --- /dev/null +++ b/ghc/tests/lib/should_run/rand001.hs @@ -0,0 +1,22 @@ +module Main(main) where + +import Random + +tstRnd rng = checkRange rng (genRnd 50 rng) + +genRnd n rng = take n (randomRs rng (mkStdGen 2)) + +checkRange (lo,hi) = all pred + where + pred + | lo <= hi = \ x -> x >= lo && x <= hi + | otherwise = \ x -> x >= hi && x <= lo + +main :: IO () +main = do + print (tstRnd (1,5::Double)) + print (tstRnd (1,5::Int)) + print (tstRnd (10,54::Integer)) + print (tstRnd ((-6),2::Int)) + print (tstRnd (2,(-6)::Int)) + diff --git a/ghc/tests/lib/should_run/rand001.stdout b/ghc/tests/lib/should_run/rand001.stdout new file mode 100644 index 0000000000..2e883c51de --- /dev/null +++ b/ghc/tests/lib/should_run/rand001.stdout @@ -0,0 +1,5 @@ +True +True +True +True +True |