Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module allows to use SmallCheck properties in tasty.
Synopsis
- testProperty :: Testable IO a => TestName -> a -> TestTree
- newtype SmallCheckDepth = SmallCheckDepth Int
- changeDepth1 :: forall a (m :: Type -> Type) b. (Show a, Serial m a, Testable m b) => (Depth -> Depth) -> (a -> b) -> Property m
- changeDepth :: forall (m :: Type -> Type) a. Testable m a => (Depth -> Depth) -> a -> Property m
- (==>) :: forall (m :: Type -> Type) c a. (Testable m c, Testable m a) => c -> a -> Property m
- existsUnique :: forall (m :: Type -> Type) a. Testable m a => a -> Property m
- exists :: forall (m :: Type -> Type) a. Testable m a => a -> Property m
- forAll :: forall (m :: Type -> Type) a. Testable m a => a -> Property m
- monadic :: Testable m a => m a -> Property m
- over :: forall a (m :: Type -> Type) b. (Show a, Testable m b) => Series m a -> (a -> b) -> Property m
- data Property (m :: Type -> Type)
- class Monad m => Testable (m :: Type -> Type) a where
- type Depth = Int
- type Reason = String
Documentation
testProperty :: Testable IO a => TestName -> a -> TestTree Source #
Create a Test
for a SmallCheck Testable
property
newtype SmallCheckDepth Source #
The "depth" parameter for SmallCheck
Instances
changeDepth1 :: forall a (m :: Type -> Type) b. (Show a, Serial m a, Testable m b) => (Depth -> Depth) -> (a -> b) -> Property m #
Quantify the function's argument over its series
, but adjust the
depth. This doesn't affect any subsequent variables.
changeDepth :: forall (m :: Type -> Type) a. Testable m a => (Depth -> Depth) -> a -> Property m #
Run property with a modified depth. Affects all quantified variables in the property.
(==>) :: forall (m :: Type -> Type) c a. (Testable m c, Testable m a) => c -> a -> Property m infixr 0 #
existsUnique :: forall (m :: Type -> Type) a. Testable m a => a -> Property m #
Set the uniqueness quantification context.
Bear in mind that ∃! (x, y): p x y is not the same as ∃! x: ∃! y: p x y.
For example, ∃! x: ∃! y: |x| = |y| is true (it holds only when x=0), but ∃! (x,y): |x| = |y| is false (there are many such pairs).
As is customary in mathematics,
is equivalent to
existsUnique
$ \x y -> p x y
and not to
existsUnique
$ \(x,y) -> p x y
(the latter, of course, may be explicitly written when desired).existsUnique
$ \x -> existsUnique
$ \y -> p x y
That is, all the variables affected by the same uniqueness context are quantified simultaneously as a tuple.
exists :: forall (m :: Type -> Type) a. Testable m a => a -> Property m #
Set the existential quantification context
forAll :: forall (m :: Type -> Type) a. Testable m a => a -> Property m #
Set the universal quantification context
over :: forall a (m :: Type -> Type) b. (Show a, Testable m b) => Series m a -> (a -> b) -> Property m #
data Property (m :: Type -> Type) #
The type of properties over the monad m
class Monad m => Testable (m :: Type -> Type) a where #
Class of tests that can be run in a monad. For pure tests, it is
recommended to keep their types polymorphic in m
rather than
specialising it to Identity
.
Instances
Monad m => Testable m Bool | |
Defined in Test.SmallCheck.Property | |
(Monad m, m ~ n) => Testable n (Property m) | |
Defined in Test.SmallCheck.Property | |
Monad m => Testable m (Either Reason Reason) | Works like the
|
(Serial m a, Show a, Testable m b) => Testable m (a -> b) | |
Defined in Test.SmallCheck.Property |
Maximum depth of generated test values.
For data values, it is the depth of nested constructor applications.
For functional values, it is both the depth of nested case analysis and the depth of results.