quickcheck-dynamic-3.2.0: A library for stateful property-based testing
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.QuickCheck.DynamicLogic

Description

Monadic interface for writing Dynamic Logic properties.

This interface offers a much nicer experience than manipulating the expressions it is implemented on top of, especially as it improves readability. It's still possible to express properties as pure expressions using the Internal module and it might make sense depending on the context and the kind of properties one wants to express.

Synopsis

Documentation

data DL s a Source #

The DL monad provides a nicer interface to dynamic logic formulae than the plain API. It's a continuation monad producing a DynFormula formula, with a state component (with variable context) threaded through.

Instances

Instances details
MonadFail (DL s) Source # 
Instance details

Defined in Test.QuickCheck.DynamicLogic

Methods

fail :: String -> DL s a #

Alternative (DL s) Source # 
Instance details

Defined in Test.QuickCheck.DynamicLogic

Methods

empty :: DL s a #

(<|>) :: DL s a -> DL s a -> DL s a #

some :: DL s a -> DL s [a] #

many :: DL s a -> DL s [a] #

Applicative (DL s) Source # 
Instance details

Defined in Test.QuickCheck.DynamicLogic

Methods

pure :: a -> DL s a #

(<*>) :: DL s (a -> b) -> DL s a -> DL s b #

liftA2 :: (a -> b -> c) -> DL s a -> DL s b -> DL s c #

(*>) :: DL s a -> DL s b -> DL s b #

(<*) :: DL s a -> DL s b -> DL s a #

Functor (DL s) Source # 
Instance details

Defined in Test.QuickCheck.DynamicLogic

Methods

fmap :: (a -> b) -> DL s a -> DL s b #

(<$) :: a -> DL s b -> DL s a #

Monad (DL s) Source # 
Instance details

Defined in Test.QuickCheck.DynamicLogic

Methods

(>>=) :: DL s a -> (a -> DL s b) -> DL s b #

(>>) :: DL s a -> DL s b -> DL s b #

return :: a -> DL s a #

action :: (Typeable a, Eq (Action s a), Show (Action s a)) => Action s a -> DL s (Var a) Source #

failingAction :: (Typeable a, Eq (Action s a), Show (Action s a)) => Action s a -> DL s () Source #

anyActions :: Int -> DL s () Source #

weight :: Double -> DL s () Source #

forAllVar :: forall a s. Typeable a => DL s (Var a) Source #

assert :: String -> Bool -> DL s () Source #

Fail if the boolean is False.

Equivalent to

assert msg b = unless b (fail msg)

assertModel :: String -> (s -> Bool) -> DL s () Source #

forAllQ :: Quantifiable q => q -> DL s (Quantifies q) Source #

Generate a random value using the given Quantification (or list/tuple of quantifications). Generated values will only shrink to smaller values that could also have been generated.

forAllNonVariableQ :: QuantifyConstraints (HasNoVariables a) => Quantification a -> DL s a Source #

Generate a random value using the given Quantification (or list/tuple of quantifications). Generated values will only shrink to smaller values that could also have been generated.

forAllDL :: (DynLogicModel s, Testable a) => DL s () -> (Actions s -> a) -> Property Source #

forAllMappedDL :: (DynLogicModel s, Testable a) => (rep -> DynLogicTest s) -> (DynLogicTest s -> rep) -> (Actions s -> srep) -> DL s () -> (srep -> a) -> Property Source #

forAllUniqueDL :: (DynLogicModel s, Testable a) => Annotated s -> DL s () -> (Actions s -> a) -> Property Source #

class StateModel s => DynLogicModel s where Source #

Restricted calls are not generated by AfterAny; they are included in tests explicitly using After in order to check specific properties at controlled times, so they are likely to fail if invoked at other times.

Minimal complete definition

Nothing

Methods

restricted :: Action s a -> Bool Source #