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.Combinators

Synopsis

Documentation

errorMessHasCallStackString → [String] → a Source #

Report a Gen-time error from the current message extra and the [messages] mess describing the path to this call site.

suchThatErr ∷ [String] → Gen a → (a → Bool) → Gen a Source #

suchThat version that tracks Gen-time errors

addUntilSizeOrd a ⇒ [String] → Set a → Set a → IntGen (Set a) Source #

add items from source to base until size n is reached.

setSizedOrd a ⇒ [String] → IntGen a → Gen (Set a) Source #

Generate a random set of a fixed size size, use gen to pick the elements.

fixSetOrd a ⇒ [String] → IntIntGen a → Set a → Gen (Set a) Source #

Fix a a set source that is supposed to have size elements, but because of duplicates may not. Fix it by adding random elements using genA, not currently in the set. If after numTries the set is still not fixed, report an error.

mapSizedOrd a ⇒ [String] → IntGen a → Gen b → Gen (Map a b) Source #

Generate a random Map with a fixed size n. use genA to pick the domain of the map, and genB to pick the range.

subsetFromSetWithSizeOrd a ⇒ [String] → Set a → IntGen (Set a) Source #

Generate a random subset of a set set with a fixed size n

mapFromSubsetOrd a ⇒ [String] → Map a b → IntGen a → Gen b → Gen (Map a b) Source #

Generate a larger map, from a smaller map subset. The new larger map, should have all the keys and values of the smaller map.

mapFromSetOrd a ⇒ Set a → Gen b → Gen (Map a b) Source #

Generate a map, from a set. The new map, should have all the elements of set in its keysSet.

itemFromSet ∷ [String] → Set a → Gen (a, Set a) Source #

Generate a random element from a set. Also return the set with that element removed

mapFromRange ∷ ∀ a b. Ord a ⇒ [String] → [b] → Gen a → Gen (Map a b) Source #

mapFromProjOrd a ⇒ [b] → Gen a → (b → Gen c) → Gen (Map a c) Source #

mapFromDomRangeOrd a ⇒ Set a → [b] → Map a b Source #

Generate a Map from a set dom and a list bs. They should have the same size but this is not checked. The result should have the properties (Map.keysSet result == dom) and (Map.elems result == bs)

subsetSizeSet a → Gen Int Source #

Generate an Int, that would be a valid size for a subset of a set s it should return 0 or the size of the set infrequently.

subsetFromSetOrd a ⇒ [String] → Set a → Gen (Set a) Source #

Generate a random subset of a set set

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

Generate a random superset of a set set. Use genA to pick random additional elements

superSetFromSetWithSizeOrd a ⇒ [String] → IntGen a → Set a → Gen (Set a) Source #

Generate a random superset of a set set with s fixed size n. Use genA to pick random additional elements.

superItemFromSetOrd a ⇒ Gen a → Set a → Gen a Source #

Generates things both in (Set a) and not in (Set a) with differing frequencies.

genFromMap ∷ [String] → Map k a → Gen (k, a) Source #

Pick a random (key,value) pair from a Map

subMapFromMapWithSizeOrd k ⇒ IntMap k a → Gen (Map k a) Source #