module Crypto.Lol.Tests
(test
,testIO
,TF.testGroup
,nestGroup
,testGroupM
,genTestArgs
,Test(..)) where
import Crypto.Lol.Utils.GenArgs
import qualified Test.Framework as TF
import Test.Framework.Providers.QuickCheck2
import Test.QuickCheck
test :: Bool -> Test params
test = Test
testIO :: IO Bool -> Test params
testIO = TestIO
nestGroup :: String -> [proxy (a :: k) -> TF.Test] -> proxy a -> TF.Test
nestGroup s ts p = TF.testGroup s $ map ($ p) ts
testGroupM :: String -> [IO TF.Test] -> TF.Test
testGroupM str = TF.buildTest . (TF.testGroup str <$>) . sequence
genTestArgs :: (GenArgs bnch, ResultOf bnch ~ Test a)
=> String -> bnch -> proxy a -> TF.Test
genTestArgs s f _ = testProperty s $ ioProperty $ do
res <- genArgs f
case res of
Test b -> return b
TestIO b -> b
data Test params where
Test :: Bool -> Test params
TestIO :: IO Bool -> Test params
instance (ResultOf (Test params) ~ Test params)
=> GenArgs (Test params) where
genArgs = return