module Test.Hspec.QuickCheck (
modifyMaxSuccess
, modifyMaxDiscardRatio
, modifyMaxSize
, prop
) where
import Test.QuickCheck
import Test.Hspec
import Test.Hspec.Core (Params(..), modifyParams)
prop :: Testable prop => String -> prop -> Spec
prop s = it s . property
modifyMaxSuccess :: (Int -> Int) -> Spec -> Spec
modifyMaxSuccess = modifyArgs . modify
where
modify :: (Int -> Int) -> Args -> Args
modify f args = args {maxSuccess = f (maxSuccess args)}
modifyMaxDiscardRatio :: (Int -> Int) -> Spec -> Spec
modifyMaxDiscardRatio = modifyArgs . modify
where
modify :: (Int -> Int) -> Args -> Args
modify f args = args {maxDiscardRatio = f (maxDiscardRatio args)}
modifyMaxSize :: (Int -> Int) -> Spec -> Spec
modifyMaxSize = modifyArgs . modify
where
modify :: (Int -> Int) -> Args -> Args
modify f args = args {maxSize = f (maxSize args)}
modifyArgs :: (Args -> Args) -> Spec -> Spec
modifyArgs = modifyParams . modify
where
modify :: (Args -> Args) -> Params -> Params
modify f p = p {paramsQuickCheckArgs = f (paramsQuickCheckArgs p)}