| Safe Haskell | Trustworthy | 
|---|---|
| Language | Haskell98 | 
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 (Blindp) (xs :: [A]) = takeWhile p xs ++ dropWhile p xs == xs
prop_TakeDrop (NonNegativen) (xs :: [A]) = take n xs ++ drop n xs == xs
-- cycle does not work for empty lists prop_Cycle (NonNegativen) (NonEmpty(xs :: [A])) = take n (cycle xs) == take n (xs ++ cycle xs)
-- Instead offorAllorderedListprop_Sort (Ordered(xs :: [OrdA])) = sort xs == xs
- newtype Blind a = Blind {- getBlind :: a
 
- newtype Fixed a = Fixed {- getFixed :: a
 
- newtype OrderedList a = Ordered {- getOrdered :: [a]
 
- newtype NonEmptyList a = NonEmpty {- getNonEmpty :: [a]
 
- newtype Positive a = Positive {- getPositive :: a
 
- newtype NonZero a = NonZero {- getNonZero :: a
 
- newtype NonNegative a = NonNegative {- getNonNegative :: a
 
- newtype Large a = Large {- getLarge :: a
 
- newtype Small a = Small {- getSmall :: a
 
- data Smart a = Smart Int a
- newtype Shrink2 a = Shrink2 {- getShrink2 :: a
 
- data Shrinking s a = Shrinking s a
- class ShrinkState s a where
- newtype ASCIIString = ASCIIString {}
- newtype UnicodeString = UnicodeString {}
- newtype PrintableString = PrintableString {}
Type-level modifiers for changing generator behavior
Blind x: as x, but x does not have to be in the Show class.
Instances
Fixed x: as x, but will not be shrunk.
Instances
| Functor Fixed Source # | |
| Enum a => Enum (Fixed a) Source # | |
| Eq a => Eq (Fixed a) Source # | |
| Integral a => Integral (Fixed a) Source # | |
| Num a => Num (Fixed a) Source # | |
| Ord a => Ord (Fixed a) Source # | |
| Read a => Read (Fixed a) Source # | |
| Real a => Real (Fixed a) Source # | |
| Show a => Show (Fixed a) Source # | |
| Arbitrary a => Arbitrary (Fixed a) Source # | |
newtype OrderedList a Source #
Ordered xs: guarantees that xs is ordered.
Constructors
| Ordered | |
| Fields 
 | |
Instances
| Functor OrderedList Source # | |
| Eq a => Eq (OrderedList a) Source # | |
| Ord a => Ord (OrderedList a) Source # | |
| Read a => Read (OrderedList a) Source # | |
| Show a => Show (OrderedList a) Source # | |
| (Ord a, Arbitrary a) => Arbitrary (OrderedList a) Source # | |
newtype NonEmptyList a Source #
NonEmpty xs: guarantees that xs is non-empty.
Constructors
| NonEmpty | |
| Fields 
 | |
Instances
| Functor NonEmptyList Source # | |
| Eq a => Eq (NonEmptyList a) Source # | |
| Ord a => Ord (NonEmptyList a) Source # | |
| Read a => Read (NonEmptyList a) Source # | |
| Show a => Show (NonEmptyList a) Source # | |
| Arbitrary a => Arbitrary (NonEmptyList a) Source # | |
Positive x: guarantees that x > 0.
Constructors
| Positive | |
| Fields 
 | |
NonZero x: guarantees that x /= 0.
Constructors
| NonZero | |
| Fields 
 | |
newtype NonNegative a Source #
NonNegative x: guarantees that x >= 0.
Constructors
| NonNegative | |
| Fields 
 | |
Large x: by default, QuickCheck generates Ints drawn from a small
 range. Large Int gives you values drawn from the entire range instead.
Instances
| Functor Large Source # | |
| Enum a => Enum (Large a) Source # | |
| Eq a => Eq (Large a) Source # | |
| Integral a => Integral (Large a) Source # | |
| Num a => Num (Large a) Source # | |
| Ord a => Ord (Large a) Source # | |
| Read a => Read (Large a) Source # | |
| Real a => Real (Large a) Source # | |
| Show a => Show (Large a) Source # | |
| Ix a => Ix (Large a) Source # | |
| (Integral a, Bounded a) => Arbitrary (Large a) Source # | |
Small x: generates values of x drawn from a small range.
 The opposite of Large.
Instances
| Functor Small Source # | |
| Enum a => Enum (Small a) Source # | |
| Eq a => Eq (Small a) Source # | |
| Integral a => Integral (Small a) Source # | |
| Num a => Num (Small a) Source # | |
| Ord a => Ord (Small a) Source # | |
| Read a => Read (Small a) Source # | |
| Real a => Real (Small a) Source # | |
| Show a => Show (Small a) Source # | |
| Ix a => Ix (Small a) Source # | |
| Integral a => Arbitrary (Small a) Source # | |
Smart _ x: tries a different order when shrinking.
Shrink2 x: allows 2 shrinking steps at the same time when shrinking x
Constructors
| Shrink2 | |
| Fields 
 | |
Instances
| Functor Shrink2 Source # | |
| Enum a => Enum (Shrink2 a) Source # | |
| Eq a => Eq (Shrink2 a) Source # | |
| Integral a => Integral (Shrink2 a) Source # | |
| Num a => Num (Shrink2 a) Source # | |
| Ord a => Ord (Shrink2 a) Source # | |
| Read a => Read (Shrink2 a) Source # | |
| Real a => Real (Shrink2 a) Source # | |
| Show a => Show (Shrink2 a) Source # | |
| Arbitrary a => Arbitrary (Shrink2 a) Source # | |
Shrinking _ x: allows for maintaining a state during shrinking.
Constructors
| Shrinking s a | 
class ShrinkState s a where Source #
Minimal complete definition
newtype ASCIIString Source #
ASCIIString: generates an ASCII string.
Constructors
| ASCIIString | |
| Fields | |
Instances
newtype UnicodeString Source #
UnicodeString: generates a unicode String.
 The string will not contain surrogate pairs.
Constructors
| UnicodeString | |
| Fields | |
newtype PrintableString Source #
PrintableString: generates a printable unicode String.
 The string will not contain surrogate pairs.
Constructors
| PrintableString | |
| Fields | |