cleveland-0.3.0: Testing framework for Morley.
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Cleveland.Michelson.Internal.Entrypoints

Description

Internal utilities for unit testing.

Synopsis

Documentation

type EPList = [(EpName, Ty)] Source #

Convenience type synonym for a list of pairs of entrypoint names and types

data EPMismatch Source #

Entrypoint comparison mismatch report

Constructors

EPMismatch 

Fields

  • epmmExtra :: EPList

    Extraneous entrypoints, i.e. those that exist in the actual contract, but not in the specification

  • epmmMissing :: EPList

    Missing entrypoints, i.e. those that exist in the specification, but not the actual contract

  • epmmTypeMismatch :: [(EpName, MismatchError Ty)]

    Entrypoints that exist in both the contract and the specification, but types do not match.

Bundled Patterns

pattern EPComparisonResultOK :: EPMismatch

A pattern syononym for no mismatches

Instances

Instances details
Buildable EPMismatch Source # 
Instance details

Defined in Test.Cleveland.Michelson.Internal.Entrypoints

Methods

build :: EPMismatch -> Builder #

ignoreExtraEntrypoints :: EPMismatch -> EPMismatch Source #

Ignore extraneous entrypoint names in EPMismatch. Essentially sets epmmExtra to [].

compareEntrypoints :: ("expected" :! Map EpName Ty) -> ("actual" :! Map EpName Ty) -> EPMismatch Source #

Compare two sets of entrypoints. Accepts ordered Maps to enforce sorting order.

contractMatchesEntrypoints :: Contract -> Map EpName Ty -> Either TcTypeError EPMismatch Source #

Check if the contract exactly matches the given entrypoints. Will report both missing and extraneous entrypoint names, and type mismatches.

contractCoversEntrypoints :: Contract -> Map EpName Ty -> Either TcTypeError EPMismatch Source #

Check if the contract contains the entrypoints given in spec (with matching types). Ignores any additional entrypoints present in the contract.

testContractEntrypoints :: (EPMismatch -> EPMismatch) -> TestName -> Contract -> Map EpName Ty -> TestTree Source #

Expect the contract to match with the entrypoints given in spec (with matching types). Comparison is defined by the first argument; use ignoreExtraEntrypoints for cover test, id for match test.

Also tests if the same holds after Michelson and Micheline roundtrips of the contract.

michelsonRoundtripContract :: HasCallStack => Contract -> Contract Source #

Round-trip the contract through Michelson text representation.

This is useful if you're intending to use the contract with Michelson text output and want to check if that output satisfies tests (which should be the same for internal representation and output, but bugs happen)

michelineRoundtripContract :: HasCallStack => Contract -> Contract Source #

Round-trip the contract through Micheline JSON representation.

This is useful if you're intending to use the contract with Micheline JSON output and want to check if that output satisfies tests (which should be the same for internal representation and output, but bugs happen)