module Test.Hspec.QuickCheck (
property
) where
import Test.Hspec.Internal
import qualified Test.QuickCheck as QC
data QuickCheckProperty a = QuickCheckProperty a
property :: QC.Testable a => a -> QuickCheckProperty a
property = QuickCheckProperty
instance QC.Testable t => SpecVerifier (QuickCheckProperty t) where
it description (QuickCheckProperty prop) = do
r <- QC.quickCheckResult prop
case r of
QC.Success {} -> return (description, Success)
f@(QC.Failure {}) -> return (description, Fail (QC.output f))
g@(QC.GaveUp {}) -> return (description, Fail ("Gave up after " ++ quantify (QC.numTests g) "test" ))
QC.NoExpectedFailure {} -> return (description, Fail ("No expected failure"))