c4fb0432ae
GitOrigin-RevId: 3fc1143a04da49a92c3663813c6a0c1e8ccd477f
25 lines
892 B
Haskell
25 lines
892 B
Haskell
--------------------------------------------------------------------------------
|
|
module Xanthous.RandomSpec (main, test) where
|
|
--------------------------------------------------------------------------------
|
|
import Test.Prelude
|
|
--------------------------------------------------------------------------------
|
|
import Control.Monad.Random
|
|
--------------------------------------------------------------------------------
|
|
import Xanthous.Random
|
|
--------------------------------------------------------------------------------
|
|
|
|
main :: IO ()
|
|
main = defaultMain test
|
|
|
|
test :: TestTree
|
|
test = testGroup "Xanthous.Random"
|
|
[ testGroup "chooseSubset"
|
|
[ testProperty "chooses a subset"
|
|
$ \(l :: [Int]) (Positive (r :: Double)) -> randomTest $ do
|
|
ss <- chooseSubset r l
|
|
pure $ all (`elem` l) ss
|
|
|
|
]
|
|
]
|
|
where
|
|
randomTest prop = evalRandT prop . mkStdGen =<< arbitrary
|