ouroboros-consensus-test-0.3.1.0: Tests of the consensus layer
Safe HaskellNone
LanguageHaskell2010

Test.Util.QuickCheck

Description

QuickCheck utilities

Synopsis

Generic QuickCheck utilities

checkGenerator ∷ (Arbitrary a, Show a) ⇒ (a → Property) → Property Source #

Test the generator

Uses explicit forAll as we don't want to assume a correct shrinker.

checkInvariant ∷ (a → Except String ()) → a → Property Source #

Check invariant

checkShrinker ∷ ∀ a. (Arbitrary a, Show a) ⇒ (a → Property) → Property Source #

Test the shrinker

Comparison functions

expectRight ∷ (Show a, Show b, Eq b) ⇒ b → Either a b → Property Source #

Check that we have the expected Right value

expectRight b ab is roughly equivalent to Right b === ab, but avoids an equality constraint on a.

ge ∷ (Ord a, Show a) ⇒ a → a → Property infix 4 Source #

Like >=, but prints a counterexample when it fails.

gt ∷ (Ord a, Show a) ⇒ a → a → Property infix 4 Source #

Like >, but prints a counterexample when it fails.

le ∷ (Ord a, Show a) ⇒ a → a → Property infix 4 Source #

Like <=, but prints a counterexample when it fails.

lt ∷ (Ord a, Show a) ⇒ a → a → Property infix 4 Source #

Like <, but prints a counterexample when it fails.

strictlyIncreasing ∷ ∀ a. (Show a, Ord a) ⇒ [a] → Property Source #

Comparing maps

isSubmapOfBy ∷ (Ord k, Show k, Show a, Show b) ⇒ (a → b → Property) → Map k a → Map k b → Property Source #

Improved variants

elementsHasCallStack ⇒ [a] → Gen a Source #

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

NOTE unlike the standard elements, this variant has a HasCallStack constraint, which makes debugging the error much easier.

(=:=) ∷ (Eq a, Condense a) ⇒ a → a → Property infix 4 Source #

Like ===, but uses Condense instead of Show when it fails.

SOP

cshrinkNP ∷ ∀ proxy c f g xs. All c xs ⇒ proxy c → (∀ a. c a ⇒ f a → g a) → (∀ a. c a ⇒ f a → [g a]) → NP f xs → [NP g xs] Source #

shrinkNP ∷ (∀ a. f a → g a) → (∀ a. f a → [g a]) → NP f xs → [NP g xs] Source #

Convenience

collectsShow a ⇒ [a] → Property → Property Source #