|
| Test.QuickCheck.Modifiers |
|
|
|
|
| Description |
Modifiers for test data.
These types do things such as restricting the kind of test data that can be generated.
They can be pattern-matched on in properties as a stylistic
alternative to using explicit quantification.
Examples:
-- Functions cannot be shown (but see Test.QuickCheck.Function)
prop_TakeDropWhile (Blind p) (xs :: [A]) =
takeWhile p xs ++ dropWhile p xs == xs
prop_TakeDrop (NonNegative n) (xs :: [A]) =
take n xs ++ drop n xs == xs
-- cycle does not work for empty lists
prop_Cycle (NonNegative n) (NonEmpty (xs :: [A])) =
take n (cycle xs) == take n (xs ++ cycle xs)
-- Instead of forAll orderedList
prop_Sort (Ordered (xs :: [OrdA])) =
sort xs == xs
|
|
| Synopsis |
|
|
|
|
| Type-level modifiers for changing generator behavior
|
|
|
| Blind x: as x, but x does not have to be in the Show class.
| | Constructors | |
|
|
|
| Fixed x: as x, but will not be shrunk.
| | Constructors | |
|
|
|
| Ordered xs: guarantees that xs is ordered.
| | Constructors | |
|
|
|
| NonEmpty xs: guarantees that xs is non-empty.
| | Constructors | |
|
|
|
| Positive x: guarantees that x > 0.
| | Constructors | |
|
|
|
| NonZero x: guarantees that x /= 0.
| | Constructors | |
|
|
|
| NonNegative x: guarantees that x >= 0.
| | Constructors | |
|
|
|
| Smart _ x: tries a different order when shrinking.
| | Constructors | |
|
|
|
| Shrink2 x: allows 2 shrinking steps at the same time when shrinking x
| | Constructors | |
|
|
|
| Shrinking _ x: allows for maintaining a state during shrinking.
| | Constructors | |
|
|
| class ShrinkState s a where | Source |
|
| | Methods | | | | shrinkState :: a -> s -> [(a, s)] | Source |
|
|
|
|
| Produced by Haddock version 2.6.0 |