cardano-ledger-test-9.9.9.9: Testing harness, tests and benchmarks for Shelley style cardano ledgers
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Cardano.Ledger.Constrained.Spec

Description

A Spec is a first order data structure that denotes a random generator For example (MapSpec era dom rng) denotes Gen(Map dom rng) (RngSpec era t) denotes Gen[t] where the [t] has some Summing properties (RelSep era t) denotes Gen(Set t) where the set meets some relational properties (Size) denotes Gen Int, the size of some Map, Set, List etc. (PairSpec era d r) denotes (([d],[r]) -> ([d],[r])) a transformer

Synopsis

Documentation

data SomeLens era t where Source #

Constructors

SomeLensAdds c ⇒ Lens' t c → SomeLens era t 

genSizeGen Size Source #

Generate a Size with all positive numbers, This is used where we want Size to denote things that must be >= 0. Coin, Word64, Natural

genSizeRangeGen Size Source #

Generate a Size denoting an Int range, across both positive and negative numbers. DeltaCoin, Int, Rational. This is used when we use Size to denote OrdCond on types with negative values

genSizeByRep ∷ ∀ t era. Adds t ⇒ Rep era t → Gen Size Source #

genFromSizeByRep ∷ ∀ t era. Adds t ⇒ Rep era t → SizeGen Int Source #

data SomeAdd era where Source #

Constructors

SomeAdds t ⇒ Rep era t → SomeAdd era 

Instances

Instances details
Show (SomeAdd era) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

Methods

showsPrecIntSomeAdd era → ShowS Source #

showSomeAdd era → String Source #

showList ∷ [SomeAdd era] → ShowS Source #

data RelSpec era dom where Source #

Constructors

RelAny 

Fields

  • RelSpec era dom

    There is no restriction on the set. Denotes the universe.

RelNever 

Fields

RelOper

Denotes things like: (x == y) equality, (x ⊆ y) subset, ( x ∩ y = ∅) disjointness, (x ⊇ y) superset. Invariants of r@(RepOper must (Just may) cant) 1) must is a subset of may 2) must and may are disjoint from cant 3) (sizeFromRel r) is realizable E.g. (SzRng 10 3) is NOT realizable

Fields

RelLensOrd b ⇒ Lens' dom b → Rep era dom → Rep era b → RelSpec era b → RelSpec era dom 

Instances

Instances details
Monoid (RelSpec era dom) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

Methods

memptyRelSpec era dom Source #

mappendRelSpec era dom → RelSpec era dom → RelSpec era dom Source #

mconcat ∷ [RelSpec era dom] → RelSpec era dom Source #

Semigroup (RelSpec era dom) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

Methods

(<>)RelSpec era dom → RelSpec era dom → RelSpec era dom Source #

sconcatNonEmpty (RelSpec era dom) → RelSpec era dom Source #

stimesIntegral b ⇒ b → RelSpec era dom → RelSpec era dom Source #

Show (RelSpec era dom) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

Methods

showsPrecIntRelSpec era dom → ShowS Source #

showRelSpec era dom → String Source #

showList ∷ [RelSpec era dom] → ShowS Source #

LiftT (RelSpec era a) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

Methods

liftTRelSpec era a → Typed (RelSpec era a) Source #

dropTTyped (RelSpec era a) → RelSpec era a Source #

(Era era, Ord dom, HasRep dom) ⇒ Specification (RelSpec era dom) (Set dom) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

Associated Types

type Count (RelSpec era dom) Source #

type Generators (RelSpec era dom) Source #

type Reps (RelSpec era dom) Source #

type Lenses (RelSpec era dom) Source #

Methods

runSSet dom → RelSpec era dom → Bool Source #

genS ∷ [String] → Count (RelSpec era dom) → Generators (RelSpec era dom) → Reps (RelSpec era dom) → Lenses (RelSpec era dom) → Gen (RelSpec era dom) Source #

sizeForSRelSpec era dom → Size Source #

genFromS ∷ [String] → IntGenerators (RelSpec era dom) → RelSpec era dom → Gen (Set dom) Source #

type Count (RelSpec era dom) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

type Count (RelSpec era dom) = Int
type Generators (RelSpec era dom) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

type Generators (RelSpec era dom) = Gen dom
type Lenses (RelSpec era dom) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

type Lenses (RelSpec era dom) = ()
type Reps (RelSpec era dom) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

type Reps (RelSpec era dom) = ()

relSubsetOrd t ⇒ Rep era t → Set t → RelSpec era t Source #

relSupersetOrd t ⇒ Rep era t → Set t → RelSpec era t Source #

relDisjointOrd t ⇒ Rep era t → Set t → RelSpec era t Source #

relEqualOrd t ⇒ Rep era t → Set t → RelSpec era t Source #

mergeRelSpecRelSpec era d → RelSpec era d → RelSpec era d Source #

interSectMOrd a ⇒ Maybe (Set a) → Maybe (Set a) → Maybe (Set a) Source #

The interpretation of (Just set) is set, and of Nothing is the universe (all possible sets)

univSubsetOrd a ⇒ Set a → Maybe (Set a) → Bool Source #

Test if s1 is a subset of s2 Recall, if s2==Nothing, then it denotes the universe and every set is a subset of the universe.

okSizeRelSpec era d → Bool Source #

sizeForRelRelSpec era dom → Size Source #

Compute the Size that bounds the Size of a set generated from a RelSpec

maybeSynopsisRep e t → Maybe t → String Source #

synSetOrd t ⇒ Rep era t → Set t → String Source #

relOperOrd d ⇒ Rep era d → Set d → Maybe (Set d) → Set d → Typed (RelSpec era d) Source #

Check that RelSpec invariants on the constructor RelOper hold on: spec@(RelOper must may cant) 1) must ⊆ may, checked by 'univSubset must may' 2) (must ∩ cant = ∅), checked by 'Set.disjoint must cant' 3) Set.size must <= Set.size (Set.difference may cant), checked by 'okSize spec'

runRelSpecOrd t ⇒ Set t → RelSpec era t → Bool Source #

test that a set s meets the RelSpec

genFromRelSpec ∷ ∀ era t. (Era era, Ord t) ⇒ [String] → Gen t → IntRelSpec era t → Gen (Set t) Source #

return a generator that always generates things that meet the RelSpec

genRelSpecOrd dom ⇒ [String] → Gen dom → Rep era dom → IntGen (RelSpec era dom) Source #

Generate a random RelSpec We deliberately do NOT generate RelLens, as it is inconsistent with everything.

genDisjointOrd a ⇒ Set a → Gen a → Gen (Set a) Source #

Generate another set which is disjoint from the input set Note that the empty set is always a solution. These sets tend to be rather small (size <= atLeastDelta)

genConsistentRelSpec ∷ [String] → Gen dom → RelSpec era dom → Gen (RelSpec era dom) Source #

Generate another RelSpec, guaranteed to be consistent with the input Where (consistent a b) means: (a <> b) =/= (RelNever _) See the property test genConsistent

consistent ∷ (LiftT a, Semigroup a) ⇒ a → a → Maybe a Source #

data RngSpec era rng where Source #

Indicates which constraints (if any) the range of a Map must adhere to There are 3 cases RngSum, RngProj, and RngRel. They are all mutually inconsistent. So while any Map may constrain its range, it can only choose ONE of the cases.

Constructors

RngSumAdds rng ⇒ rng → SizeRngSpec era rng

The set must have Adds instance and add up to rng

RngProjAdds c ⇒ c → Rep era x → Lens' x c → SizeRngSpec era x 
RngElemEq r ⇒ Rep era r → [r] → RngSpec era r

The range has exactly these elements

RngRelOrd x ⇒ RelSpec era x → RngSpec era x

The range must hold on the relation specified

RngAnyRngSpec era rng

There are no constraints on the range (random generator will do)

RngNever ∷ [String] → RngSpec era rng

Something was inconsistent

Instances

Instances details
Era era ⇒ Monoid (RngSpec era rng) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

Methods

memptyRngSpec era rng Source #

mappendRngSpec era rng → RngSpec era rng → RngSpec era rng Source #

mconcat ∷ [RngSpec era rng] → RngSpec era rng Source #

Era era ⇒ Semigroup (RngSpec era rng) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

Methods

(<>)RngSpec era rng → RngSpec era rng → RngSpec era rng Source #

sconcatNonEmpty (RngSpec era rng) → RngSpec era rng Source #

stimesIntegral b ⇒ b → RngSpec era rng → RngSpec era rng Source #

Show (RngSpec era t) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

Methods

showsPrecIntRngSpec era t → ShowS Source #

showRngSpec era t → String Source #

showList ∷ [RngSpec era t] → ShowS Source #

LiftT (RngSpec era a) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

Methods

liftTRngSpec era a → Typed (RngSpec era a) Source #

dropTTyped (RngSpec era a) → RngSpec era a Source #

(Era era, Adds rng, Ord rng) ⇒ Specification (RngSpec era rng) [rng] Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

Associated Types

type Count (RngSpec era rng) Source #

type Generators (RngSpec era rng) Source #

type Reps (RngSpec era rng) Source #

type Lenses (RngSpec era rng) Source #

Methods

runS ∷ [rng] → RngSpec era rng → Bool Source #

genS ∷ [String] → Count (RngSpec era rng) → Generators (RngSpec era rng) → Reps (RngSpec era rng) → Lenses (RngSpec era rng) → Gen (RngSpec era rng) Source #

sizeForSRngSpec era rng → Size Source #

genFromS ∷ [String] → IntGenerators (RngSpec era rng) → RngSpec era rng → Gen [rng] Source #

type Count (RngSpec era rng) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

type Count (RngSpec era rng) = Int
type Generators (RngSpec era rng) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

type Generators (RngSpec era rng) = Gen rng
type Lenses (RngSpec era rng) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

type Lenses (RngSpec era rng) = SomeLens era rng
type Reps (RngSpec era rng) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

type Reps (RngSpec era rng) = Rep era rng

mergeRngSpec ∷ ∀ r era. RngSpec era r → RngSpec era r → RngSpec era r Source #

sizeForRng ∷ ∀ dom era. RngSpec era dom → Size Source #

Compute the Size that is appropriate for a RngSpec

genFromRngSpec ∷ ∀ era r. Era era ⇒ [String] → Gen r → IntRngSpec era r → Gen [r] Source #

Generate an arbitrary size [r] for a particular size n The generated list is consistent with the RngSpec given as input.

genRngSpec ∷ ∀ w era. (Ord w, Adds w) ⇒ Gen w → Rep era w → SomeLens era w → IntGen (RngSpec era w) Source #

Generate a random RngSpec, appropriate for a given size. In order to accomodate any OrdCond (EQL, LTH, LTE, GTE, GTH) in RngSum and RngProj, we make the total a bit larger than n

runRngSpec ∷ [r] → RngSpec era r → Bool Source #

genConsistentRngSpec ∷ ∀ era w c. (Ord w, Adds w) ⇒ IntGen w → Rep era w → Rep era c → SomeLens era w → Gen (RngSpec era w, RngSpec era w) Source #

data MapSpec era dom rng where Source #

Indicates which constraints (if any) a Map must adhere to

Constructors

MapSpecSizeRelSpec era dom → PairSpec era dom rng → RngSpec era rng → MapSpec era dom rng

The map may be constrained 3 ways. 1) Its size(Size) 2) its domain(RelSpec) 3) its range(RngSpec)

MapNever ∷ [String] → MapSpec era dom rng

Something is inconsistent

Instances

Instances details
(Ord dom, Era era) ⇒ Monoid (MapSpec era dom rng) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

Methods

memptyMapSpec era dom rng Source #

mappendMapSpec era dom rng → MapSpec era dom rng → MapSpec era dom rng Source #

mconcat ∷ [MapSpec era dom rng] → MapSpec era dom rng Source #

(Ord dom, Era era) ⇒ Semigroup (MapSpec era dom rng) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

Methods

(<>)MapSpec era dom rng → MapSpec era dom rng → MapSpec era dom rng Source #

sconcatNonEmpty (MapSpec era dom rng) → MapSpec era dom rng Source #

stimesIntegral b ⇒ b → MapSpec era dom rng → MapSpec era dom rng Source #

Ord d ⇒ Show (MapSpec w d r) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

Methods

showsPrecIntMapSpec w d r → ShowS Source #

showMapSpec w d r → String Source #

showList ∷ [MapSpec w d r] → ShowS Source #

LiftT (MapSpec era a b) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

Methods

liftTMapSpec era a b → Typed (MapSpec era a b) Source #

dropTTyped (MapSpec era a b) → MapSpec era a b Source #

(Era era, Ord dom, Ord rng, Adds rng) ⇒ Specification (MapSpec era dom rng) (Map dom rng) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

Associated Types

type Count (MapSpec era dom rng) Source #

type Generators (MapSpec era dom rng) Source #

type Reps (MapSpec era dom rng) Source #

type Lenses (MapSpec era dom rng) Source #

Methods

runSMap dom rng → MapSpec era dom rng → Bool Source #

genS ∷ [String] → Count (MapSpec era dom rng) → Generators (MapSpec era dom rng) → Reps (MapSpec era dom rng) → Lenses (MapSpec era dom rng) → Gen (MapSpec era dom rng) Source #

sizeForSMapSpec era dom rng → Size Source #

genFromS ∷ [String] → IntGenerators (MapSpec era dom rng) → MapSpec era dom rng → Gen (Map dom rng) Source #

type Count (MapSpec era dom rng) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

type Count (MapSpec era dom rng) = Int
type Generators (MapSpec era dom rng) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

type Generators (MapSpec era dom rng) = (Gen dom, Gen rng)
type Lenses (MapSpec era dom rng) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

type Lenses (MapSpec era dom rng) = SomeLens era rng
type Reps (MapSpec era dom rng) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

type Reps (MapSpec era dom rng) = (Rep era dom, Rep era rng)

showMapSpecMapSpec era dom rng → String Source #

mergeMapSpecOrd dom ⇒ MapSpec era dom rng → MapSpec era dom rng → MapSpec era dom rng Source #

mapSpecOrd d ⇒ SizeRelSpec era d → PairSpec era d r → RngSpec era r → Typed (MapSpec era d r) Source #

Use mapSpec instead of MapSpec to check size and PairSpec consistency at creation time. Runs in the type monad, so errors are caught and reported as Solver-time errors. This should avoid many Gen-time errors, as many of those are cause by size inconsistencies. We can also use this in mergeMapSpec, to catch size inconsistencies there as well as ( a b c -> dropT (mapSpec a b c)) has the same type as MapSpec, but pushes the reports of inconsistencies into MapNever.

runMapSpec ∷ (Ord d, Eq r) ⇒ Map d r → MapSpec era d r → Bool Source #

test a Map against a MapSpec

sizeForMapSpecMapSpec era d r → Size Source #

compute a Size that bounds a MapSpec

genMapSpec ∷ ∀ era dom w. (Ord dom, Era era, Ord w, Adds w) ⇒ Gen dom → Rep era dom → Rep era w → SomeLens era w → IntGen (MapSpec era dom w) Source #

Generate a random MapSpec

genFromMapSpec ∷ ∀ era w dom. (Era era, Ord dom) ⇒ String → [String] → Gen dom → Gen w → MapSpec era dom w → Gen (Map dom w) Source #

Generate a (Map d t) from a (MapSpec era d r) genFromMapSpec :: forall era w dom. (Era era, Ord dom) => (V era (Map dom w)) -> [String] -> Gen dom -> Gen w -> MapSpec era dom w -> Gen (Map dom w) genFromMapSpec nm _ _ _ (MapNever xs) = errorMess ("genFromMapSpec " ++ (show nm) ++ " (MapNever _) fails") xs genFromMapSpec nm msgs genD genR ms@(MapSpec size rel pair rng) = do n <- genFromSize size dom <- genFromRelSpec (("GenFromMapSpec " ++ (show nm) ++ "n " ++ show ms) : msgs) genD n rel rangelist <- genFromRngSpec (("genFromMapSpec " ++ (show nm) ++ "n " ++ show ms) : msgs) genR n rng pure (Map.fromList (zip (Set.toList dom) rangelist))

pairSpecTransform ∷ (Ord d, Eq r) ⇒ PairSideRep era d → Rep era r → Map d r → ([d], [r]) → [(d, r)] Source #

Transform the domain and range lists by removing the (domain,range) pairs from m. for each pair (domain,range) remove domain from dlist and range from rlist, then zip together the two remaining lists. The pairs in this list are extra pairs which might me useful. Strategy depends on which term to (SubMap t1 t2) are variables. (SubMap xvar yexp) Break value of yexp into (x + extra), then answer: xvar = x (SubMap xexp yvar) Break value of xexp into (x + extra), then answer: yvar == x + extra

removeEq a ⇒ PairSideStringRep era a → a → [a] → [a] Source #

data SetSpec era a where Source #

Constructors

SetSpecOrd a ⇒ SizeRelSpec era a → SetSpec era a 
SetNever ∷ [String] → SetSpec era a 

Instances

Instances details
Ord a ⇒ Monoid (SetSpec era a) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

Methods

memptySetSpec era a Source #

mappendSetSpec era a → SetSpec era a → SetSpec era a Source #

mconcat ∷ [SetSpec era a] → SetSpec era a Source #

Ord a ⇒ Semigroup (SetSpec era a) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

Methods

(<>)SetSpec era a → SetSpec era a → SetSpec era a Source #

sconcatNonEmpty (SetSpec era a) → SetSpec era a Source #

stimesIntegral b ⇒ b → SetSpec era a → SetSpec era a Source #

Show (SetSpec era a) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

Methods

showsPrecIntSetSpec era a → ShowS Source #

showSetSpec era a → String Source #

showList ∷ [SetSpec era a] → ShowS Source #

LiftT (SetSpec era t) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

Methods

liftTSetSpec era t → Typed (SetSpec era t) Source #

dropTTyped (SetSpec era t) → SetSpec era t Source #

(Era era, Ord a, HasRep a) ⇒ Specification (SetSpec era a) (Set a) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

Associated Types

type Count (SetSpec era a) Source #

type Generators (SetSpec era a) Source #

type Reps (SetSpec era a) Source #

type Lenses (SetSpec era a) Source #

Methods

runSSet a → SetSpec era a → Bool Source #

genS ∷ [String] → Count (SetSpec era a) → Generators (SetSpec era a) → Reps (SetSpec era a) → Lenses (SetSpec era a) → Gen (SetSpec era a) Source #

sizeForSSetSpec era a → Size Source #

genFromS ∷ [String] → IntGenerators (SetSpec era a) → SetSpec era a → Gen (Set a) Source #

type Count (SetSpec era a) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

type Count (SetSpec era a) = Int
type Generators (SetSpec era a) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

type Generators (SetSpec era a) = Gen a
type Lenses (SetSpec era a) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

type Lenses (SetSpec era a) = ()
type Reps (SetSpec era a) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

type Reps (SetSpec era a) = ()

mergeSetSpecOrd a ⇒ SetSpec era a → SetSpec era a → SetSpec era a Source #

setSpecOrd t ⇒ SizeRelSpec era t → Typed (SetSpec era t) Source #

Test the size consistency while building a SetSpec

runSetSpecSet a → SetSpec era a → Bool Source #

genSetSpecOrd s ⇒ [String] → Gen s → Rep era s → IntGen (SetSpec era s) Source #

genFromSetSpec ∷ ∀ era a. Era era ⇒ [String] → Gen a → SetSpec era a → Gen (Set a) Source #

data ElemSpec era t where Source #

Constructors

ElemSumAdds t ⇒ t → SizeElemSpec era t

The set must add up to tot, which is any number in the scope of Size

ElemProjAdds c ⇒ c → Rep era x → Lens' x c → SizeElemSpec era x

The range must sum upto c, which is any number in the scope of Size, through the projection witnessed by the (Sums t c) class

ElemEqualEq t ⇒ Rep era t → [t] → ElemSpec era t

The range has exactly these elements

ElemNever ∷ [String] → ElemSpec era t 
ElemAnyElemSpec era t 

Instances

Instances details
Era era ⇒ Monoid (ElemSpec era a) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

Methods

memptyElemSpec era a Source #

mappendElemSpec era a → ElemSpec era a → ElemSpec era a Source #

mconcat ∷ [ElemSpec era a] → ElemSpec era a Source #

Era era ⇒ Semigroup (ElemSpec era a) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

Methods

(<>)ElemSpec era a → ElemSpec era a → ElemSpec era a Source #

sconcatNonEmpty (ElemSpec era a) → ElemSpec era a Source #

stimesIntegral b ⇒ b → ElemSpec era a → ElemSpec era a Source #

Show (ElemSpec era a) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

Methods

showsPrecIntElemSpec era a → ShowS Source #

showElemSpec era a → String Source #

showList ∷ [ElemSpec era a] → ShowS Source #

LiftT (ElemSpec era t) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

Methods

liftTElemSpec era t → Typed (ElemSpec era t) Source #

dropTTyped (ElemSpec era t) → ElemSpec era t Source #

(Era era, HasRep a, Adds a) ⇒ Specification (ElemSpec era a) [a] Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

Associated Types

type Count (ElemSpec era a) Source #

type Generators (ElemSpec era a) Source #

type Reps (ElemSpec era a) Source #

type Lenses (ElemSpec era a) Source #

Methods

runS ∷ [a] → ElemSpec era a → Bool Source #

genS ∷ [String] → Count (ElemSpec era a) → Generators (ElemSpec era a) → Reps (ElemSpec era a) → Lenses (ElemSpec era a) → Gen (ElemSpec era a) Source #

sizeForSElemSpec era a → Size Source #

genFromS ∷ [String] → IntGenerators (ElemSpec era a) → ElemSpec era a → Gen [a] Source #

type Count (ElemSpec era a) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

type Count (ElemSpec era a) = Size
type Generators (ElemSpec era a) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

type Generators (ElemSpec era a) = Gen a
type Lenses (ElemSpec era a) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

type Lenses (ElemSpec era a) = SomeLens era a
type Reps (ElemSpec era a) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

type Reps (ElemSpec era a) = ()

mergeElemSpecEra era ⇒ ElemSpec era a → ElemSpec era a → ElemSpec era a Source #

sizeForElemSpec ∷ ∀ a era. ElemSpec era a → Size Source #

runElemSpec ∷ [a] → ElemSpec era a → Bool Source #

genElemSpec ∷ ∀ w era. Adds w ⇒ Rep era w → SomeLens era w → SizeGen (ElemSpec era w) Source #

genFromElemSpec ∷ ∀ era r. [String] → Gen r → IntElemSpec era r → Gen [r] Source #

data ListSpec era t where Source #

Specs for lists have two parts, the Size, and the elements

Constructors

ListSpecSizeElemSpec era t → ListSpec era t 
ListNever ∷ [String] → ListSpec era t 

Instances

Instances details
Era era ⇒ Monoid (ListSpec era a) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

Methods

memptyListSpec era a Source #

mappendListSpec era a → ListSpec era a → ListSpec era a Source #

mconcat ∷ [ListSpec era a] → ListSpec era a Source #

Era era ⇒ Semigroup (ListSpec era a) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

Methods

(<>)ListSpec era a → ListSpec era a → ListSpec era a Source #

sconcatNonEmpty (ListSpec era a) → ListSpec era a Source #

stimesIntegral b ⇒ b → ListSpec era a → ListSpec era a Source #

Show (ListSpec era a) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

Methods

showsPrecIntListSpec era a → ShowS Source #

showListSpec era a → String Source #

showList ∷ [ListSpec era a] → ShowS Source #

LiftT (ListSpec era t) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

Methods

liftTListSpec era t → Typed (ListSpec era t) Source #

dropTTyped (ListSpec era t) → ListSpec era t Source #

(Era era, HasRep a, Adds a) ⇒ Specification (ListSpec era a) [a] Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

Associated Types

type Count (ListSpec era a) Source #

type Generators (ListSpec era a) Source #

type Reps (ListSpec era a) Source #

type Lenses (ListSpec era a) Source #

Methods

runS ∷ [a] → ListSpec era a → Bool Source #

genS ∷ [String] → Count (ListSpec era a) → Generators (ListSpec era a) → Reps (ListSpec era a) → Lenses (ListSpec era a) → Gen (ListSpec era a) Source #

sizeForSListSpec era a → Size Source #

genFromS ∷ [String] → IntGenerators (ListSpec era a) → ListSpec era a → Gen [a] Source #

type Count (ListSpec era a) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

type Count (ListSpec era a) = Size
type Generators (ListSpec era a) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

type Generators (ListSpec era a) = Gen a
type Lenses (ListSpec era a) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

type Lenses (ListSpec era a) = SomeLens era a
type Reps (ListSpec era a) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

type Reps (ListSpec era a) = ()

mergeListSpecEra era ⇒ ListSpec era a → ListSpec era a → ListSpec era a Source #

listSpecSizeElemSpec era t → Typed (ListSpec era t) Source #

Test the size consistency while building a ListSpec

runListSpec ∷ [a] → ListSpec era a → Bool Source #

genListSpec ∷ ∀ w era. Adds w ⇒ Rep era w → SomeLens era w → SizeGen (ListSpec era w) Source #

genFromListSpec ∷ ∀ era r. [String] → Gen r → ListSpec era r → Gen [r] Source #

class (Arbitrary t, Adds t) ⇒ TestAdd t where Source #

Methods

anyAddsGen t Source #

posGen t Source #

Instances

Instances details
TestAdd Word64 Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

TestAdd Coin Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

TestAdd Int Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

genSetOrd t ⇒ IntGen t → Gen (Set t) Source #

Only the size of the set uses TestAdd

testSet ∷ (Ord t, TestAdd t) ⇒ Gen (Set t) Source #

someSetOrd t ⇒ Gen t → Gen (Set t) Source #

someMap ∷ ∀ era t d. (Ord d, TestAdd t) ⇒ Rep era d → Gen (Map d t) Source #

aMapEra era ⇒ Gen (MapSpec era Int Word64) Source #

testVEra era ⇒ V era DeltaCoin Source #

genSumsToEra era ⇒ Gen (Pred era) Source #

genAddsSpec ∷ ∀ c. Adds c ⇒ Gen (AddsSpec c) Source #

genNonNegAddsSpec ∷ ∀ c. Adds c ⇒ Gen (AddsSpec c) Source #

runAddsSpec ∷ ∀ c. Adds c ⇒ c → AddsSpec c → Bool Source #

sizeForAddsSpecAddsSpec c → Size Source #

Not sure how to interpret this? As the possible totals that make the implicit OrdCond True?

mainIO () Source #

data PairSide Source #

Constructors

VarOnLeft 
VarOnRight 

Instances

Instances details
Show PairSide Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

Eq PairSide Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

data PairSpec era a b where Source #

A map m1 meets the '(PairSpec _ _ m2)' specification if every (key,value) pair in m2 is in m1.

Constructors

PairSpec ∷ (Ord a, Eq b) ⇒ Rep era a → Rep era b → PairSideMap a b → PairSpec era a b 
PairNever ∷ [String] → PairSpec era a b 
PairAnyPairSpec era a b 

Instances

Instances details
Monoid (PairSpec era a b) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

Methods

memptyPairSpec era a b Source #

mappendPairSpec era a b → PairSpec era a b → PairSpec era a b Source #

mconcat ∷ [PairSpec era a b] → PairSpec era a b Source #

Semigroup (PairSpec era dom rng) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

Methods

(<>)PairSpec era dom rng → PairSpec era dom rng → PairSpec era dom rng Source #

sconcatNonEmpty (PairSpec era dom rng) → PairSpec era dom rng Source #

stimesIntegral b ⇒ b → PairSpec era dom rng → PairSpec era dom rng Source #

Show (PairSpec era dom rng) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

Methods

showsPrecIntPairSpec era dom rng → ShowS Source #

showPairSpec era dom rng → String Source #

showList ∷ [PairSpec era dom rng] → ShowS Source #

LiftT (PairSpec era dom rng) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.Spec

Methods

liftTPairSpec era dom rng → Typed (PairSpec era dom rng) Source #

dropTTyped (PairSpec era dom rng) → PairSpec era dom rng Source #

(Era era, Ord dom, Eq rng, HasRep dom, HasRep rng) ⇒ Specification (PairSpec era dom rng) (Map dom rng) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

Associated Types

type Count (PairSpec era dom rng) Source #

type Generators (PairSpec era dom rng) Source #

type Reps (PairSpec era dom rng) Source #

type Lenses (PairSpec era dom rng) Source #

Methods

runSMap dom rng → PairSpec era dom rng → Bool Source #

genS ∷ [String] → Count (PairSpec era dom rng) → Generators (PairSpec era dom rng) → Reps (PairSpec era dom rng) → Lenses (PairSpec era dom rng) → Gen (PairSpec era dom rng) Source #

sizeForSPairSpec era dom rng → Size Source #

genFromS ∷ [String] → IntGenerators (PairSpec era dom rng) → PairSpec era dom rng → Gen (Map dom rng) Source #

type Count (PairSpec era dom rng) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

type Count (PairSpec era dom rng) = Int
type Generators (PairSpec era dom rng) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

type Generators (PairSpec era dom rng) = ()
type Lenses (PairSpec era dom rng) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

type Lenses (PairSpec era dom rng) = ()
type Reps (PairSpec era dom rng) Source # 
Instance details

Defined in Test.Cardano.Ledger.Constrained.SpecClass

type Reps (PairSpec era dom rng) = ()

anyPairSpecPairSpec era d r → Bool Source #

showPairSpecPairSpec era dom rng → String Source #

mergePairSpecPairSpec era a b → PairSpec era a b → PairSpec era a b Source #

sizeForPairSpecPairSpec era dom rng → Size Source #

runPairSpec ∷ (Ord dom, Eq rng) ⇒ Map dom rng → PairSpec era dom rng → Bool Source #

genPairSpec ∷ ∀ era dom rng. (Ord dom, Eq rng) ⇒ Rep era dom → Rep era rng → Gen (PairSpec era dom rng) Source #

fixSidePairSidePairSpec era a b → PairSpec era a b Source #

genConsistentPairSpec ∷ (Ord dom, Eq rng) ⇒ Rep era dom → Rep era rng → PairSpec era dom rng → Gen (PairSpec era dom rng) Source #

genFromPairSpec ∷ ∀ era dom rng. Ord dom ⇒ [String] → PairSpec era dom rng → Gen (Map dom rng) Source #