smartcheck-0.2.4: A smarter QuickCheck.

Test.SmartCheck.SmartGen

Synopsis

# Documentation

iterateArbIdx :: SubTypes a => a -> (Idx, Maybe Int) -> Int -> Int -> (a -> Property) -> IO (Int, Result a) Source #

Driver for iterateArb.

Arguments

 :: SubTypes a => a Counterexample. -> SubT Sub-value in the counterexample. -> Idx Index of sub-value. -> Int Maximum number of iterations. -> Int Maximum size of value to generate. -> (a -> Property) Property. -> IO (Int, Result a) Number of times precondition is passed and returned result.

Replace the hole in d indexed by idx with a bunch of random values, and test the new d against the property. Returns the first new d (the full d but with the hole replaced) that succeeds. Succeeds is determined by the call to resultify---if we're expecting failure, then we succeed by getting a value that passes the precondition but fails the property; otherwise we succeed by getting a value that passes the precondition and satisfies the property. If no value ever satisfies the precondition, then we return FailedPreCond. (Thus, there's an implied linear order on the Result type: FailedPreCond < FailedProp < Result a.)

resultify :: (a -> Property) -> a -> IO (Result a) Source #

Make a QuickCheck Result by applying a property function to a value and then get out the Result using our result type.

replace :: SubTypes a => a -> Idx -> SubT -> Maybe a Source #

Put a value v into a another value d at a hole idx, if v is well-typed. Return Nothing if dynamic typing fails.

Arguments

 :: SubTypes a => a Failed value -> Test a b Test to use -> Next a b What to do after the test -> (a -> Property) Property -> Maybe Int Max depth to analyze -> Forest Bool Only evaluate at True indexes. -> Idx Starting index to extrapolate -> [Idx] List of generalized indices -> IO (a, [Idx])