Safe Haskell | None |
---|---|
Language | Haskell2010 |
Deprecated: Use the new Test.Cleveland interface instead. Entrypoint utilities are moved to Test.Cleveland.Michelson.Entrypoints
Utility functions for unit testing.
Synopsis
- type ContractReturn (st :: T) = (Either MichelsonFailureWithStack ([Operation], Value st), (InterpreterState, MorleyLogs))
- type ContractPropValidator st prop = ContractReturn st -> prop
- data EPMismatch
- contractProp :: (IsoValue param, IsoValue storage, ToT param ~ cp, ToT storage ~ st, ParameterScope cp) => Contract cp st -> ContractPropValidator st prop -> ContractEnv -> param -> storage -> prop
- contractPropVal :: ParameterScope cp => Contract cp st -> ContractPropValidator st prop -> ContractEnv -> Value cp -> Value st -> prop
- validateSuccess :: HasCallStack => ContractPropValidator st Expectation
- validateStorageIs :: IsoValue st => st -> ContractPropValidator (ToT st) Assertion
- validateMichelsonFailsWith :: forall v st. NiceConstant v => v -> ContractPropValidator st Expectation
Documentation
type ContractReturn (st :: T) = (Either MichelsonFailureWithStack ([Operation], Value st), (InterpreterState, MorleyLogs)) #
type ContractPropValidator st prop = ContractReturn st -> prop Source #
Type for contract execution validation.
It's a function which is supplied with contract execution output (failure or new storage with operation list).
Function returns a property which type is designated by type variable prop
and might be Test.QuickCheck.Property
or Expectation
or anything else relevant.
data EPMismatch Source #
Entrypoint comparison mismatch report
Instances
Buildable EPMismatch Source # | |
Defined in Test.Cleveland.Michelson.Internal.Entrypoints build :: EPMismatch -> Builder # |
contractProp :: (IsoValue param, IsoValue storage, ToT param ~ cp, ToT storage ~ st, ParameterScope cp) => Contract cp st -> ContractPropValidator st prop -> ContractEnv -> param -> storage -> prop Source #
ContractCode's property tester against given input. Takes contract environment, initial storage and parameter, interprets contract on this input and invokes validation function.
contractPropVal :: ParameterScope cp => Contract cp st -> ContractPropValidator st prop -> ContractEnv -> Value cp -> Value st -> prop Source #
Version of contractProp
which takes Value
as arguments instead
of regular Haskell values.
This function assumes that contract has no explicit default entrypoints and you always have to construct parameter manually; if you need to test contract calling specific entrypoints, use integrational testing defined by Test.Cleveland.Michelson.Integrational module.
validateSuccess :: HasCallStack => ContractPropValidator st Expectation Source #
ContractPropValidator
that expects a successful termination.
validateStorageIs :: IsoValue st => st -> ContractPropValidator (ToT st) Assertion Source #
ContractPropValidator
that expects contract execution to
succeed and update storage to a particular constant value.
validateMichelsonFailsWith :: forall v st. NiceConstant v => v -> ContractPropValidator st Expectation Source #
ContractPropValidator
that expects a given failure.