-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Automatic testing of Haskell programs -- -- A library for testing Haskell programs automatically. The programmer -- provides a specification of the program, in the form of properties -- which functions should satisfy, and QuickCheck then tests that the -- properties hold in a large number of randomly generated cases. -- Specifications are expressed in Haskell, using combinators defined in -- the QuickCheck library. QuickCheck provides combinators to define -- properties, observe the distribution of test data, and define test -- data generators. @package QuickCheck @version 1.2.0.1 -- | QuickCheck v.0.2 DRAFT implementation; last update 000104. Koen -- Claessen, John Hughes. This file represents work in progress, and -- might change at a later date. module Test.QuickCheck test, verboseCheck, quickCheck :: Testable a => a -> IO () data Config Config :: Int -> Int -> (Int -> Int) -> (Int -> [String] -> String) -> Config configMaxTest :: Config -> Int configMaxFail :: Config -> Int configSize :: Config -> Int -> Int configEvery :: Config -> Int -> [String] -> String defaultConfig :: Config check :: Testable a => Config -> a -> IO () forAll :: (Show a, Testable b) => Gen a -> (a -> b) -> Property (==>) :: Testable a => Bool -> a -> Property label :: Testable a => String -> a -> Property collect :: (Show a, Testable b) => a -> b -> Property classify :: Testable a => Bool -> String -> a -> Property trivial :: Testable a => Bool -> a -> Property data Gen a elements :: [a] -> Gen a two :: Monad m => m a -> m (a, a) three :: Monad m => m a -> m (a, a, a) four :: Monad m => m a -> m (a, a, a, a) sized :: (Int -> Gen a) -> Gen a resize :: Int -> Gen a -> Gen a choose :: Random a => (a, a) -> Gen a oneof :: [Gen a] -> Gen a frequency :: [(Int, Gen a)] -> Gen a vector :: Arbitrary a => Int -> Gen [a] class Arbitrary a arbitrary :: Arbitrary a => Gen a coarbitrary :: Arbitrary a => a -> Gen b -> Gen b rand :: Gen StdGen promote :: (a -> Gen b) -> Gen (a -> b) variant :: Int -> Gen a -> Gen a class Testable a property :: Testable a => a -> Property data Property data Result Result :: Maybe Bool -> [String] -> [String] -> Result ok :: Result -> Maybe Bool stamp :: Result -> [String] arguments :: Result -> [String] generate :: Int -> StdGen -> Gen a -> a evaluate :: Testable a => a -> Gen Result instance (Arbitrary a, Show a, Testable b) => Testable (a -> b) instance Testable Property instance Testable Result instance Testable Bool instance Testable () instance (Arbitrary a, Arbitrary b) => Arbitrary (a -> b) instance Arbitrary a => Arbitrary [a] instance (Arbitrary a, Arbitrary b) => Arbitrary (Either a b) instance Arbitrary a => Arbitrary (Maybe a) instance (Arbitrary a, Arbitrary b, Arbitrary c, Arbitrary d) => Arbitrary (a, b, c, d) instance (Arbitrary a, Arbitrary b, Arbitrary c) => Arbitrary (a, b, c) instance (Arbitrary a, Arbitrary b) => Arbitrary (a, b) instance Arbitrary Double instance Arbitrary Float instance Arbitrary Integer instance Arbitrary Int instance Arbitrary Bool instance Arbitrary () instance Monad Gen instance Functor Gen -- | A batch driver for running QuickCheck. -- -- Note: in GHC only, it is possible to place a time limit on each -- test, to ensure that testing terminates. module Test.QuickCheck.Batch -- | Run the test. Here we use the same random number each time, so we get -- reproducable results! run :: Testable a => a -> TestOptions -> IO TestResult -- | Prints a one line summary of various tests with common theme runTests :: String -> TestOptions -> [TestOptions -> IO TestResult] -> IO () defOpt :: TestOptions data TestOptions TestOptions :: Int -> Int -> Bool -> TestOptions -- | number of tests to run. no_of_tests :: TestOptions -> Int -- | time limit for test, in seconds. If zero, no time limit. Note: -- only GHC supports time limits. length_of_tests :: TestOptions -> Int debug_tests :: TestOptions -> Bool data TestResult TestOk :: String -> Int -> [[String]] -> TestResult TestExausted :: String -> Int -> [[String]] -> TestResult TestFailed :: [String] -> Int -> TestResult TestAborted :: SomeException -> TestResult -- | Look out behind you! These can be misused badly. However, in the -- context of a batch tester, can also be very useful. -- -- Examples of use of bottom and isBottom: -- --
--   {- test for abort -}
--   prop_head2 = isBottom (head [])
--   {- test for strictness -}
--   prop_head3 = isBottom (head bottom)
--   
isBottom :: a -> Bool bottom :: a -- | These are some general purpose utilities for use with QuickCheck. module Test.QuickCheck.Utils isAssociativeBy :: (Show a, Testable prop) => (a -> a -> prop) -> Gen a -> (a -> a -> a) -> Property isAssociative :: (Arbitrary a, Show a, Eq a) => (a -> a -> a) -> Property isCommutableBy :: (Show a, Testable prop) => (b -> b -> prop) -> Gen a -> (a -> a -> b) -> Property isCommutable :: (Arbitrary a, Show a, Eq b) => (a -> a -> b) -> Property isTotalOrder :: (Arbitrary a, Show a, Ord a) => a -> a -> Property -- | This is an attempt to emulate polymorphic types for the purposes of -- testing by using abstract monomorphic types. -- -- It is likely that future versions of QuickCheck will include some -- polymorphic emulation testing facility, but this module can be used -- for now. module Test.QuickCheck.Poly type ALPHA = Poly ALPHA_ type BETA = Poly BETA_ type GAMMA = Poly GAMMA_ type OrdALPHA = Poly OrdALPHA_ type OrdBETA = Poly OrdBETA_ type OrdGAMMA = Poly OrdGAMMA_ instance Eq ALPHA_ instance Eq BETA_ instance Eq GAMMA_ instance Eq OrdALPHA_ instance Ord OrdALPHA_ instance Eq OrdBETA_ instance Ord OrdBETA_ instance Eq OrdGAMMA_ instance Ord OrdGAMMA_ instance Ord a => Ord (Poly a) instance Eq a => Eq (Poly a) instance Arbitrary (Poly a) instance Show (Poly a) module Debug.QuickCheck.Poly -- | These are some general purpose utilities for use with QuickCheck. module Debug.QuickCheck.Utils -- | This is a batch driver for running QuickCheck (GHC only). module Debug.QuickCheck.Batch -- | implementation moved to Test.QuickCheck module Debug.QuickCheck