convex-testing-interface
Safe HaskellSafe-Inferred
LanguageHaskell2010

Convex.TestingInterface

Synopsis

Testing interface

class (Show state, Eq state, Show (Action state), ToJSON state) => TestingInterface state where Source #

A testing interface defines the state and behavior of one or more smart contracts.

The type parameter state represents the model's view of the world. It should track all relevant information needed to validate that the contract is behaving correctly.

Minimal complete definition: Action, initialize, arbitraryAction, perform

Minimal complete definition

initialize, arbitraryAction, perform

Associated Types

data Action state Source #

Actions that can be performed on the contract. This is typically a data type with one constructor per contract operation.

Methods

initialize :: MonadIO m => TestingMonadT m state Source #

The initial state of the model, before any actions are performed.

arbitraryAction :: state -> Gen (Action state) Source #

Generate a random action given the current state. The generated action should be appropriate for the current state.

precondition :: state -> Action state -> Bool Source #

Precondition that must hold before an action can be executed. Return False to indicate that an action is not valid in the current state. Default: all actions are always valid.

perform :: MonadIO m => state -> Action state -> TestingMonadT m state Source #

Perform the action on the real blockchain (mockchain). This should execute the actual transaction(s) that implement the action. The current model state is provided to allow access to tracked blockchain state. The returned state should reflect the expected effect of the action on the contract state.

validate :: MonadIO m => state -> TestingMonadT m Bool Source #

Validate that the blockchain state matches the model state. Default: no validation (always succeeds).

monitoring :: state -> Action state -> Property -> Property Source #

Called after each successful action to wrap the enclosing QuickCheck property. This hook runs only after perform and validate succeed. Use it for property-level checks, labels, and counterexamples that should be attached to valid state transitions. Default: no additional checks.

discardNegativeTestForUserExceptions :: Bool Source #

Whether to discard (skip) test cases where the invalid action fails due to a user-level error (e.g., off-chain balancing failure) rather than an on-chain validator rejection during negative testing.

When True, negative tests that throw user exceptions are discarded (via QuickCheck's discard), so only on-chain rejections count as successful negative tests.

When False (the default), user exceptions also cause the test case to be discarded — meaning both off-chain and on-chain failures are treated the same way.

Override this in your TestingInterface instance if you need finer control over which failure modes are accepted in negative testing.

data ModelState state Source #

Opaque wrapper for model state

Instances

Instances details
Show state => Show (ModelState state) Source # 
Instance details

Defined in Convex.TestingInterface

Methods

showsPrec :: Int -> ModelState state -> ShowS #

show :: ModelState state -> String #

showList :: [ModelState state] -> ShowS #

Eq state => Eq (ModelState state) Source # 
Instance details

Defined in Convex.TestingInterface

Methods

(==) :: ModelState state -> ModelState state -> Bool #

(/=) :: ModelState state -> ModelState state -> Bool #

class TestingInterface state => ThreatModelsFor state where Source #

Minimal complete definition

Nothing

Methods

threatModels :: [ThreatModel ()] Source #

Threat models to run against the transactions. Each threat model will be evaluated against the transaction generated by a succesful test run with the UTxO state captured before each transaction executed. Default: the list of all threat models that don't take parameters.

expectedVulnerabilities :: [ThreatModel ()] Source #

Threat models that are expected to find vulnerabilities. These are run like threatModels but with inverted pass/fail semantics:

  • OK when a vulnerability IS detected
  • FAIL when a vulnerability is NOT detected

Output is quiet — no verbose transaction dumps. Default: empty, backward compatible.

Running Tests

propRunActions :: forall state. ThreatModelsFor state => String -> TestTree Source #

Main property for testing a testing interface. Generates random action sequences and checks that the implementation matches the model.

propRunActionsWithOptions :: forall state. ThreatModelsFor state => String -> RunOptions -> TestTree Source #

Run testing interface tests with custom options

data RunOptions Source #

Options for running property tests

Constructors

RunOptions 

Fields

genAction :: (TestingInterface state, Monad m) => state -> PropertyM m (Maybe (Action state)) Source #

Generate a valid actions

runActions :: (TestingInterface state, MonadIO m) => RunOptions -> Int -> state -> TestingMonadT (PropertyM m) state Source #

Generate a number of actions (with a given maximum) and run them.

Trace recording

data TraceRecorder Source #

Callback for recording iteration traces as pre-serialized JSON. Arguments: group name, category ("positive"/"negative"), pre-serialized trace JSON. Default is a no-op (zero overhead when streaming is not active).

When trEnabled returns True, test bodies use the expensive traced code path (building IterationTrace values with UTxO snapshots, transaction summaries, and JSON serialisation). When it returns False (the IsOption default), the cheap runActions path is used instead, avoiding all that work.

trEnabled is an IO action so that the decision can be deferred until the streaming reporter has parsed --no-trace and written the shared IORef.

Constructors

TraceRecorder 

Fields

The Testing Monad

newtype TestingMonadT m a Source #

Tests run in the mockchain monad extended with balancing error handling.

Leaving handling of balancing errors to the testing interface is important because the errors can contain data for code coverage.

Instances

Instances details
MonadTrans TestingMonadT Source # 
Instance details

Defined in Convex.TestingInterface

Methods

lift :: Monad m => m a -> TestingMonadT m a #

Monad m => MonadBlockchain ConwayEra (TestingMonadT m) Source # 
Instance details

Defined in Convex.TestingInterface

Monad m => MonadMockchain ConwayEra (TestingMonadT m) Source # 
Instance details

Defined in Convex.TestingInterface

MonadIO m => MonadFail (TestingMonadT m) Source # 
Instance details

Defined in Convex.TestingInterface

Methods

fail :: String -> TestingMonadT m a #

MonadIO m => MonadIO (TestingMonadT m) Source # 
Instance details

Defined in Convex.TestingInterface

Methods

liftIO :: IO a -> TestingMonadT m a #

Monad m => Applicative (TestingMonadT m) Source # 
Instance details

Defined in Convex.TestingInterface

Methods

pure :: a -> TestingMonadT m a #

(<*>) :: TestingMonadT m (a -> b) -> TestingMonadT m a -> TestingMonadT m b #

liftA2 :: (a -> b -> c) -> TestingMonadT m a -> TestingMonadT m b -> TestingMonadT m c #

(*>) :: TestingMonadT m a -> TestingMonadT m b -> TestingMonadT m b #

(<*) :: TestingMonadT m a -> TestingMonadT m b -> TestingMonadT m a #

Functor m => Functor (TestingMonadT m) Source # 
Instance details

Defined in Convex.TestingInterface

Methods

fmap :: (a -> b) -> TestingMonadT m a -> TestingMonadT m b #

(<$) :: a -> TestingMonadT m b -> TestingMonadT m a #

Monad m => Monad (TestingMonadT m) Source # 
Instance details

Defined in Convex.TestingInterface

Methods

(>>=) :: TestingMonadT m a -> (a -> TestingMonadT m b) -> TestingMonadT m b #

(>>) :: TestingMonadT m a -> TestingMonadT m b -> TestingMonadT m b #

return :: a -> TestingMonadT m a #

MonadLog m => MonadLog (TestingMonadT m) Source # 
Instance details

Defined in Convex.TestingInterface

Monad m => MonadError (BalanceTxError ConwayEra) (TestingMonadT m) Source # 
Instance details

Defined in Convex.TestingInterface

mockchainSucceedsWithOptions :: Options ConwayEra -> TestingMonadT IO a -> Assertion Source #

Run the TestingMonadT action with the given options and fail if there is an error

mockchainFailsWithOptions :: Options ConwayEra -> TestingMonadT IO a -> (BalanceTxError ConwayEra -> Assertion) -> Assertion Source #

Run the TestingMonadT action with the given options, fail if it succeeds, and handle the error appropriately.

data Options era Source #

Options for running the testing monad.

Constructors

Options 

modifyTransactionLimits :: Options ConwayEra -> Word32 -> Options ConwayEra Source #

Modify the maximum transaction size in the protocol parameters of the given options

Coverage helpers

withCoverage :: CoverageConfig -> (Options ConwayEra -> RunOptions -> IO ()) -> IO () Source #

Run a test suite with Plutus script coverage collection.

Creates the coverage IORef, wires it into Options and RunOptions, runs the user's action, and on exit produces a CoverageReport from the accumulated data.

The report is generated when the inner action throws an ExitCode exception (which is how tasty's defaultMain signals completion). The original exception is re-thrown after the report action runs.

main :: IO ()
main = withCoverage config $ \opts runOpts ->
  defaultMain $ testGroup "my tests"
    [ testCase "t1" (mockchainSucceedsWithOptions opts myTest)
    , myPropertyTests runOpts
    ]
 where
  config = CoverageConfig
    { coverageIndices = [myScriptCovIdx]
    , coverageReport  = printCoverageReport
    }

data CoverageConfig Source #

Configuration for coverage collection and reporting.

Use with withCoverage to set up coverage tracking for your test suite.

Constructors

CoverageConfig 

Fields

printCoverageReport :: CoverageReport -> IO () Source #

Print a coverage report to stdout using prettyprinter.

writeCoverageReport :: FilePath -> CoverageReport -> IO () Source #

Write a coverage report to a file.

silentCoverageReport :: CoverageReport -> IO () Source #

Collect coverage data but discard the report.

printCoverageJSON :: CoverageReport -> IO () Source #

Print a coverage report as compact JSON to stdout.

writeCoverageJSON :: FilePath -> CoverageReport -> IO () Source #

Write a coverage report as compact JSON to a file.

printCoverageJSONPretty :: CoverageReport -> IO () Source #

Print a coverage report as pretty-printed JSON to stdout.

writeCoverageJSONPretty :: FilePath -> CoverageReport -> IO () Source #

Write a coverage report as pretty-printed JSON to a file.

data CoverageSummary Source #

Minimal coverage summary matching what Pretty.pretty shows.

Constructors

CoverageSummary 

Fields

coverageSummary :: CoverageReport -> CoverageSummary Source #

Convert a CoverageReport to a compact summary (same info as Pretty.pretty shows).

Re-exports from QuickCheck

data Gen a Source #

A generator for values of type a.

The third-party packages QuickCheck-GenT and quickcheck-transformer provide monad transformer versions of Gen.

Instances

Instances details
MonadFix Gen 
Instance details

Defined in Test.QuickCheck.Gen

Methods

mfix :: (a -> Gen a) -> Gen a #

Applicative Gen 
Instance details

Defined in Test.QuickCheck.Gen

Methods

pure :: a -> Gen a #

(<*>) :: Gen (a -> b) -> Gen a -> Gen b #

liftA2 :: (a -> b -> c) -> Gen a -> Gen b -> Gen c #

(*>) :: Gen a -> Gen b -> Gen b #

(<*) :: Gen a -> Gen b -> Gen a #

Functor Gen 
Instance details

Defined in Test.QuickCheck.Gen

Methods

fmap :: (a -> b) -> Gen a -> Gen b #

(<$) :: a -> Gen b -> Gen a #

Monad Gen 
Instance details

Defined in Test.QuickCheck.Gen

Methods

(>>=) :: Gen a -> (a -> Gen b) -> Gen b #

(>>) :: Gen a -> Gen b -> Gen b #

return :: a -> Gen a #

Testable prop => Testable (Gen prop) 
Instance details

Defined in Test.QuickCheck.Property

Methods

property :: Gen prop -> Property Source #

propertyForAllShrinkShow :: Gen a -> (a -> [a]) -> (a -> [String]) -> (a -> Gen prop) -> Property Source #

class Arbitrary a where Source #

Random generation and shrinking of values.

QuickCheck provides Arbitrary instances for most types in base, except those which incur extra dependencies. For a wider range of Arbitrary instances see the quickcheck-instances package.

Minimal complete definition

arbitrary

Methods

arbitrary :: Gen a Source #

A generator for values of the given type.

It is worth spending time thinking about what sort of test data you want - good generators are often the difference between finding bugs and not finding them. You can use sample, label and classify to check the quality of your test data.

There is no generic arbitrary implementation included because we don't know how to make a high-quality one. If you want one, consider using the testing-feat or generic-random packages.

The QuickCheck manual goes into detail on how to write good generators. Make sure to look at it, especially if your type is recursive!

shrink :: a -> [a] Source #

Produces a (possibly) empty list of all the possible immediate shrinks of the given value.

The default implementation returns the empty list, so will not try to shrink the value. If your data type has no special invariants, you can enable shrinking by defining shrink = genericShrink, but by customising the behaviour of shrink you can often get simpler counterexamples.

Most implementations of shrink should try at least three things:

  1. Shrink a term to any of its immediate subterms. You can use subterms to do this.
  2. Recursively apply shrink to all immediate subterms. You can use recursivelyShrink to do this.
  3. Type-specific shrinkings such as replacing a constructor by a simpler constructor.

For example, suppose we have the following implementation of binary trees:

data Tree a = Nil | Branch a (Tree a) (Tree a)

We can then define shrink as follows:

shrink Nil = []
shrink (Branch x l r) =
  -- shrink Branch to Nil
  [Nil] ++
  -- shrink to subterms
  [l, r] ++
  -- recursively shrink subterms
  [Branch x' l' r' | (x', l', r') <- shrink (x, l, r)]

There are a couple of subtleties here:

  • QuickCheck tries the shrinking candidates in the order they appear in the list, so we put more aggressive shrinking steps (such as replacing the whole tree by Nil) before smaller ones (such as recursively shrinking the subtrees).
  • It is tempting to write the last line as [Branch x' l' r' | x' <- shrink x, l' <- shrink l, r' <- shrink r] but this is the wrong thing! It will force QuickCheck to shrink x, l and r in tandem, and shrinking will stop once one of the three is fully shrunk.

There is a fair bit of boilerplate in the code above. We can avoid it with the help of some generic functions. The function genericShrink tries shrinking a term to all of its subterms and, failing that, recursively shrinks the subterms. Using it, we can define shrink as:

shrink x = shrinkToNil x ++ genericShrink x
  where
    shrinkToNil Nil = []
    shrinkToNil (Branch _ l r) = [Nil]

genericShrink is a combination of subterms, which shrinks a term to any of its subterms, and recursivelyShrink, which shrinks all subterms of a term. These may be useful if you need a bit more control over shrinking than genericShrink gives you.

A final gotcha: we cannot define shrink as simply shrink x = Nil:genericShrink x as this shrinks Nil to Nil, and shrinking will go into an infinite loop.

If all this leaves you bewildered, you might try shrink = genericShrink to begin with, after deriving Generic for your type. However, if your data type has any special invariants, you will need to check that genericShrink can't break those invariants.

Instances

Instances details
Arbitrary ASCIIString 
Instance details

Defined in Test.QuickCheck.Modifiers

Arbitrary PrintableString 
Instance details

Defined in Test.QuickCheck.Modifiers

Arbitrary UnicodeString 
Instance details

Defined in Test.QuickCheck.Modifiers

Arbitrary QCGen 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen QCGen Source #

shrink :: QCGen -> [QCGen] Source #

Arbitrary Key

Since: aeson-2.0.3.0

Instance details

Defined in Data.Aeson.Key

Arbitrary Value

Since: aeson-2.0.3.0

Instance details

Defined in Data.Aeson.Types.Internal

Arbitrary All 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Any 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Version

Generates Version with non-empty non-negative versionBranch, and empty versionTags

Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CChar 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CClock 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CDouble 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CFloat 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CInt 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CIntMax 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CIntPtr 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CLLong 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CLong 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CPtrdiff 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CSChar 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CSUSeconds 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CShort 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CSigAtomic 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CSize 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CTime 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CUChar 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CUInt 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CUIntMax 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CUIntPtr 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CULLong 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CULong 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CUSeconds 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CUShort 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary CWchar 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary ExitCode 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Newline 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary NewlineMode 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Int16 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Int32 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Int64 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Int8 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Word16 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Word32 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Word64 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Word8 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary ByteString64 
Instance details

Defined in Data.ByteString.Base64.Type

Arbitrary IntSet

WARNING: The same warning as for Arbitrary (Set a) applies here.

Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Ordering 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Integer 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary () 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen () Source #

shrink :: () -> [()] Source #

Arbitrary Bool 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Char 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Double 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Float 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Int 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary Word 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary a => Arbitrary (Blind a) 
Instance details

Defined in Test.QuickCheck.Modifiers

Methods

arbitrary :: Gen (Blind a) Source #

shrink :: Blind a -> [Blind a] Source #

Arbitrary a => Arbitrary (Fixed a) 
Instance details

Defined in Test.QuickCheck.Modifiers

Methods

arbitrary :: Gen (Fixed a) Source #

shrink :: Fixed a -> [Fixed a] Source #

Arbitrary a => Arbitrary (InfiniteList a) 
Instance details

Defined in Test.QuickCheck.Modifiers

Arbitrary a => Arbitrary (InfiniteListInternalData a) 
Instance details

Defined in Test.QuickCheck.Modifiers

Methods

arbitrary :: Gen (InfiniteListInternalData a) Source #

shrink :: InfiniteListInternalData a -> [InfiniteListInternalData a] Source #

(Integral a, Bounded a) => Arbitrary (Large a) 
Instance details

Defined in Test.QuickCheck.Modifiers

Methods

arbitrary :: Gen (Large a) Source #

shrink :: Large a -> [Large a] Source #

(Num a, Ord a, Arbitrary a) => Arbitrary (Negative a) 
Instance details

Defined in Test.QuickCheck.Modifiers

Arbitrary a => Arbitrary (NonEmptyList a) 
Instance details

Defined in Test.QuickCheck.Modifiers

(Num a, Ord a, Arbitrary a) => Arbitrary (NonNegative a) 
Instance details

Defined in Test.QuickCheck.Modifiers

(Num a, Ord a, Arbitrary a) => Arbitrary (NonPositive a) 
Instance details

Defined in Test.QuickCheck.Modifiers

(Num a, Eq a, Arbitrary a) => Arbitrary (NonZero a) 
Instance details

Defined in Test.QuickCheck.Modifiers

(Ord a, Arbitrary a) => Arbitrary (OrderedList a) 
Instance details

Defined in Test.QuickCheck.Modifiers

(Num a, Ord a, Arbitrary a) => Arbitrary (Positive a) 
Instance details

Defined in Test.QuickCheck.Modifiers

Arbitrary a => Arbitrary (Shrink2 a) 
Instance details

Defined in Test.QuickCheck.Modifiers

Integral a => Arbitrary (Small a) 
Instance details

Defined in Test.QuickCheck.Modifiers

Methods

arbitrary :: Gen (Small a) Source #

shrink :: Small a -> [Small a] Source #

Arbitrary a => Arbitrary (Smart a) 
Instance details

Defined in Test.QuickCheck.Modifiers

Methods

arbitrary :: Gen (Smart a) Source #

shrink :: Smart a -> [Smart a] Source #

(Arbitrary a, Ord a) => Arbitrary (SortedList a) 
Instance details

Defined in Test.QuickCheck.Modifiers

Arbitrary v => Arbitrary (KeyMap v)

Since: aeson-2.0.3.0

Instance details

Defined in Data.Aeson.KeyMap

Methods

arbitrary :: Gen (KeyMap v) Source #

shrink :: KeyMap v -> [KeyMap v] Source #

Arbitrary a => Arbitrary (ZipList a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary a => Arbitrary (Complex a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary a => Arbitrary (Identity a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary a => Arbitrary (First a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen (First a) Source #

shrink :: First a -> [First a] Source #

Arbitrary a => Arbitrary (Last a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen (Last a) Source #

shrink :: Last a -> [Last a] Source #

Arbitrary a => Arbitrary (Dual a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen (Dual a) Source #

shrink :: Dual a -> [Dual a] Source #

(Arbitrary a, CoArbitrary a) => Arbitrary (Endo a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen (Endo a) Source #

shrink :: Endo a -> [Endo a] Source #

Arbitrary a => Arbitrary (Product a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Arbitrary a => Arbitrary (Sum a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen (Sum a) Source #

shrink :: Sum a -> [Sum a] Source #

Integral a => Arbitrary (Ratio a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen (Ratio a) Source #

shrink :: Ratio a -> [Ratio a] Source #

Arbitrary a => Arbitrary (IntMap a)

WARNING: The same warning as for Arbitrary (Set a) applies here.

Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen (IntMap a) Source #

shrink :: IntMap a -> [IntMap a] Source #

Arbitrary a => Arbitrary (Seq a)

WARNING: The same warning as for Arbitrary (Set a) applies here.

Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen (Seq a) Source #

shrink :: Seq a -> [Seq a] Source #

(Ord a, Arbitrary a) => Arbitrary (Set a)

WARNING: Users working on the internals of the Set type via e.g. Data.Set.Internal should be aware that this instance aims to give a good representation of Set a as mathematical sets but *does not* aim to provide a varied distribution over the underlying representation.

Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen (Set a) Source #

shrink :: Set a -> [Set a] Source #

Arbitrary a => Arbitrary (Tree a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen (Tree a) Source #

shrink :: Tree a -> [Tree a] Source #

Arbitrary a => Arbitrary (Maybe a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen (Maybe a) Source #

shrink :: Maybe a -> [Maybe a] Source #

Arbitrary a => Arbitrary [a] 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen [a] Source #

shrink :: [a] -> [[a]] Source #

(Function a, CoArbitrary a, Arbitrary b) => Arbitrary (a :-> b) 
Instance details

Defined in Test.QuickCheck.Function

Methods

arbitrary :: Gen (a :-> b) Source #

shrink :: (a :-> b) -> [a :-> b] Source #

(Function a, CoArbitrary a, Arbitrary b) => Arbitrary (Fun a b) 
Instance details

Defined in Test.QuickCheck.Function

Methods

arbitrary :: Gen (Fun a b) Source #

shrink :: Fun a b -> [Fun a b] Source #

(Arbitrary a, ShrinkState s a) => Arbitrary (Shrinking s a) 
Instance details

Defined in Test.QuickCheck.Modifiers

Methods

arbitrary :: Gen (Shrinking s a) Source #

shrink :: Shrinking s a -> [Shrinking s a] Source #

Arbitrary (m a) => Arbitrary (WrappedMonad m a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

(Arbitrary a, Arbitrary b) => Arbitrary (Either a b) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen (Either a b) Source #

shrink :: Either a b -> [Either a b] Source #

HasResolution a => Arbitrary (Fixed a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen (Fixed a) Source #

shrink :: Fixed a -> [Fixed a] Source #

(Ord k, Arbitrary k, Arbitrary v) => Arbitrary (Map k v)

WARNING: The same warning as for Arbitrary (Set a) applies here.

Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen (Map k v) Source #

shrink :: Map k v -> [Map k v] Source #

(Arbitrary a, Arbitrary b) => Arbitrary (a, b) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen (a, b) Source #

shrink :: (a, b) -> [(a, b)] Source #

(CoArbitrary a, Arbitrary b) => Arbitrary (a -> b) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen (a -> b) Source #

shrink :: (a -> b) -> [a -> b] Source #

Arbitrary (a b c) => Arbitrary (WrappedArrow a b c) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen (WrappedArrow a b c) Source #

shrink :: WrappedArrow a b c -> [WrappedArrow a b c] Source #

Arbitrary a => Arbitrary (Const a b) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen (Const a b) Source #

shrink :: Const a b -> [Const a b] Source #

Arbitrary (f a) => Arbitrary (Alt f a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen (Alt f a) Source #

shrink :: Alt f a -> [Alt f a] Source #

Arbitrary a => Arbitrary (Constant a b) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen (Constant a b) Source #

shrink :: Constant a b -> [Constant a b] Source #

(Arbitrary a, Arbitrary b, Arbitrary c) => Arbitrary (a, b, c) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen (a, b, c) Source #

shrink :: (a, b, c) -> [(a, b, c)] Source #

(Arbitrary1 f, Arbitrary1 g, Arbitrary a) => Arbitrary (Product f g a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen (Product f g a) Source #

shrink :: Product f g a -> [Product f g a] Source #

(Arbitrary a, Arbitrary b, Arbitrary c, Arbitrary d) => Arbitrary (a, b, c, d) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen (a, b, c, d) Source #

shrink :: (a, b, c, d) -> [(a, b, c, d)] Source #

(Arbitrary1 f, Arbitrary1 g, Arbitrary a) => Arbitrary (Compose f g a) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen (Compose f g a) Source #

shrink :: Compose f g a -> [Compose f g a] Source #

(Arbitrary a, Arbitrary b, Arbitrary c, Arbitrary d, Arbitrary e) => Arbitrary (a, b, c, d, e) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen (a, b, c, d, e) Source #

shrink :: (a, b, c, d, e) -> [(a, b, c, d, e)] Source #

(Arbitrary a, Arbitrary b, Arbitrary c, Arbitrary d, Arbitrary e, Arbitrary f) => Arbitrary (a, b, c, d, e, f) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen (a, b, c, d, e, f) Source #

shrink :: (a, b, c, d, e, f) -> [(a, b, c, d, e, f)] Source #

(Arbitrary a, Arbitrary b, Arbitrary c, Arbitrary d, Arbitrary e, Arbitrary f, Arbitrary g) => Arbitrary (a, b, c, d, e, f, g) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen (a, b, c, d, e, f, g) Source #

shrink :: (a, b, c, d, e, f, g) -> [(a, b, c, d, e, f, g)] Source #

(Arbitrary a, Arbitrary b, Arbitrary c, Arbitrary d, Arbitrary e, Arbitrary f, Arbitrary g, Arbitrary h) => Arbitrary (a, b, c, d, e, f, g, h) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen (a, b, c, d, e, f, g, h) Source #

shrink :: (a, b, c, d, e, f, g, h) -> [(a, b, c, d, e, f, g, h)] Source #

(Arbitrary a, Arbitrary b, Arbitrary c, Arbitrary d, Arbitrary e, Arbitrary f, Arbitrary g, Arbitrary h, Arbitrary i) => Arbitrary (a, b, c, d, e, f, g, h, i) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen (a, b, c, d, e, f, g, h, i) Source #

shrink :: (a, b, c, d, e, f, g, h, i) -> [(a, b, c, d, e, f, g, h, i)] Source #

(Arbitrary a, Arbitrary b, Arbitrary c, Arbitrary d, Arbitrary e, Arbitrary f, Arbitrary g, Arbitrary h, Arbitrary i, Arbitrary j) => Arbitrary (a, b, c, d, e, f, g, h, i, j) 
Instance details

Defined in Test.QuickCheck.Arbitrary

Methods

arbitrary :: Gen (a, b, c, d, e, f, g, h, i, j) Source #

shrink :: (a, b, c, d, e, f, g, h, i, j) -> [(a, b, c, d, e, f, g, h, i, j)] Source #

frequency :: HasCallStack => [(Int, Gen a)] -> Gen a Source #

Chooses one of the given generators, with a weighted random distribution. The input list must be non-empty.

oneof :: HasCallStack => [Gen a] -> Gen a Source #

Randomly uses one of the given generators. The input list must be non-empty.

elements :: HasCallStack => [a] -> Gen a Source #

Generates one of the given values. The input list must be non-empty.

Re-exports from Tasty

data TestTree Source #

The main data structure defining a test suite.

It consists of individual test cases and properties, organized in named groups which form a tree-like hierarchy.

There is no generic way to create a test case. Instead, every test provider (tasty-hunit, tasty-smallcheck etc.) provides a function to turn a test case into a TestTree.

Groups can be created using testGroup.

Since: tasty-0.1