Safe Haskell | Safe |
---|---|

Language | Haskell2010 |

- iterateArbIdx :: SubTypes a => a -> (Idx, Maybe Int) -> Int -> Int -> (a -> Property) -> IO (Int, Result a)
- iterateArb :: forall a. SubTypes a => a -> SubT -> Idx -> Int -> Int -> (a -> Property) -> IO (Int, Result a)
- resultify :: (a -> Property) -> a -> IO (Result a)
- replace :: SubTypes a => a -> Idx -> SubT -> Maybe a
- iter :: SubTypes a => a -> Test a b -> Next a b -> (a -> Property) -> Maybe Int -> Forest Bool -> Idx -> [Idx] -> IO (a, [Idx])

# Documentation

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

Driver for iterateArb.

:: 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.