genvalidity-hspec-0.2.0.5: Standard spec's for GenValidity instances

Safe HaskellNone
LanguageHaskell2010

Test.Validity.Functions

Contents

Synopsis

Validity tests involving functions

Standard tests involving validity

producesValidsOnGen :: (Show a, Show b, Validity b) => (a -> b) -> Gen a -> Property Source #

The function produces valid output when the input is generated as specified by the given generator.

producesValidsOnValids :: (Show a, Show b, GenValidity a, Validity b) => (a -> b) -> Property Source #

The function produces valid output when the input is generated by genValid

producesValid :: (Show a, Show b, GenValidity a, Validity b) => (a -> b) -> Property Source #

The function produces valid output when the input is generated by genUnchecked

producesValidsOnArbitrary :: (Show a, Show b, Arbitrary a, Validity b) => (a -> b) -> Property Source #

The function produces valid output when the input is generated by arbitrary

producesValidsOnGens2 :: (Show a, Show b, Show c, Validity c) => (a -> b -> c) -> Gen (a, b) -> Property Source #

producesValid2 :: (Show a, Show b, Show c, GenValidity a, GenValidity b, Validity c) => (a -> b -> c) -> Property Source #

producesValidsOnGens3 :: (Show a, Show b, Show c, Show d, Validity d) => (a -> b -> c -> d) -> Gen (a, b, c) -> Property Source #

producesValidsOnValids3 :: (Show a, Show b, Show c, Show d, GenValidity a, GenValidity b, GenValidity c, Validity d) => (a -> b -> c -> d) -> Property Source #

producesValid3 :: (Show a, Show b, Show c, Show d, GenValidity a, GenValidity b, GenValidity c, Validity d) => (a -> b -> c -> d) -> Property Source #

producesValidsOnArbitrary3 :: (Show a, Show b, Show c, Show d, Arbitrary a, Arbitrary b, Arbitrary c, Validity d) => (a -> b -> c -> d) -> Property Source #

Standard tests involving functions that can fail

succeedsOnGen :: (Show a, Show b, Show (f b), CanFail f) => (a -> f b) -> Gen a -> Property Source #

The function succeeds if the input is generated by the given generator

succeedsOnValid :: (Show a, Show b, Show (f b), GenValidity a, CanFail f) => (a -> f b) -> Property Source #

The function succeeds if the input is generated by genValid

succeeds :: (Show a, Show b, Show (f b), GenValidity a, CanFail f) => (a -> f b) -> Property Source #

The function succeeds if the input is generated by genUnchecked

succeedsOnArbitrary :: (Show a, Show b, Show (f b), Arbitrary a, CanFail f) => (a -> f b) -> Property Source #

The function succeeds if the input is generated by arbitrary

succeedsOnGens2 :: (Show a, Show b, Show c, Show (f c), CanFail f) => (a -> b -> f c) -> Gen (a, b) -> Property Source #

succeedsOnValids2 :: (Show a, Show b, Show c, Show (f c), GenValidity a, GenValidity b, CanFail f) => (a -> b -> f c) -> Property Source #

succeeds2 :: (Show a, Show b, Show c, Show (f c), GenValidity a, GenValidity b, CanFail f) => (a -> b -> f c) -> Property Source #

succeedsOnArbitrary2 :: (Show a, Show b, Show c, Show (f c), Arbitrary a, Arbitrary b, CanFail f) => (a -> b -> f c) -> Property Source #

failsOnGen :: (Show a, Show b, Show (f b), CanFail f) => (a -> f b) -> Gen a -> Property Source #

The function fails if the input is generated by the given generator

failsOnInvalid :: (Show a, Show b, Show (f b), GenValidity a, CanFail f) => (a -> f b) -> Property Source #

The function fails if the input is generated by genInvalid

failsOnGens2 :: (Show a, Show b, Show c, Show (f c), CanFail f) => (a -> b -> f c) -> Gen a -> Gen b -> Property Source #

failsOnInvalid2 :: (Show a, Show b, Show c, Show (f c), GenValidity a, GenValidity b, CanFail f) => (a -> b -> f c) -> Property Source #

validIfSucceedsOnGen :: (Show a, Show b, Show (f b), Validity b, CanFail f) => (a -> f b) -> Gen a -> Property Source #

The function produces output that satisfies isValid if it is given input that is generated by the given generator.

validIfSucceedsOnValid :: (Show a, Show b, Show (f b), GenValidity a, Validity b, CanFail f) => (a -> f b) -> Property Source #

The function produces output that satisfies isValid if it is given input that is generated by arbitrary.

validIfSucceedsOnArbitrary :: (Show a, Show b, Show (f b), Arbitrary a, Validity b, CanFail f) => (a -> f b) -> Property Source #

The function produces output that satisfies isValid if it is given input that is generated by arbitrary.

validIfSucceeds :: (Show a, Show b, Show (f b), GenValidity a, Validity b, CanFail f) => (a -> f b) -> Property Source #

The function produces output that satisfies isValid if it is given input that is generated by genUnchecked.

validIfSucceedsOnGens2 :: (Show a, Show b, Show c, Show (f c), Validity c, CanFail f) => (a -> b -> f c) -> Gen (a, b) -> Property Source #

validIfSucceedsOnValids2 :: (Show a, Show b, Show c, Show (f c), GenValidity a, GenValidity b, Validity c, CanFail f) => (a -> b -> f c) -> Property Source #

validIfSucceeds2 :: (Show a, Show b, Show c, Show (f c), GenValidity a, GenValidity b, Validity c, CanFail f) => (a -> b -> f c) -> Property Source #

validIfSucceedsOnArbitrary2 :: (Show a, Show b, Show c, Show (f c), Arbitrary a, Arbitrary b, Validity c, CanFail f) => (a -> b -> f c) -> Property Source #

Standard tests involving equivalence of functions

equivalentOnGen :: (Show a, Eq a, Show b, Eq b) => (a -> b) -> (a -> b) -> Gen a -> Property Source #

equivalentOnValid :: (Show a, Eq a, GenValidity a, Show b, Eq b) => (a -> b) -> (a -> b) -> Property Source #

equivalent :: (Show a, Eq a, GenValidity a, Show b, Eq b) => (a -> b) -> (a -> b) -> Property Source #

equivalentOnGens2 :: (Show a, Eq a, Show b, Eq b, Show c, Eq c) => (a -> b -> c) -> (a -> b -> c) -> Gen (a, b) -> Property Source #

equivalentOnValids2 :: (Show a, Eq a, GenValidity a, Show b, Eq b, GenValidity b, Show c, Eq c) => (a -> b -> c) -> (a -> b -> c) -> Property Source #

equivalent2 :: (Show a, Eq a, GenValidity a, Show b, Eq b, GenValidity b, Show c, Eq c) => (a -> b -> c) -> (a -> b -> c) -> Property Source #

equivalentWhenFirstSucceedsOnGen :: (Show a, Eq a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> b) -> Gen a -> Property Source #

equivalentWhenFirstSucceedsOnValid :: (Show a, Eq a, GenValidity a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> b) -> Property Source #

equivalentWhenFirstSucceeds :: (Show a, Eq a, GenValidity a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> b) -> Property Source #

equivalentWhenFirstSucceedsOnGens2 :: (Show a, Eq a, Show b, Eq b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> c) -> Gen (a, b) -> Property Source #

equivalentWhenFirstSucceedsOnValids2 :: (Show a, Eq a, GenValidity a, Show b, Eq b, GenValidity b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> c) -> Property Source #

equivalentWhenFirstSucceeds2 :: (Show a, Eq a, GenValidity a, Show b, Eq b, GenValidity b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> c) -> Property Source #

equivalentWhenSecondSucceedsOnGen :: (Show a, Eq a, Show b, Eq b, CanFail f) => (a -> b) -> (a -> f b) -> Gen a -> Property Source #

equivalentWhenSecondSucceedsOnValid :: (Show a, Eq a, GenValidity a, Show b, Eq b, CanFail f) => (a -> b) -> (a -> f b) -> Property Source #

equivalentWhenSecondSucceeds :: (Show a, Eq a, GenValidity a, Show b, Eq b, CanFail f) => (a -> b) -> (a -> f b) -> Property Source #

equivalentWhenSecondSucceedsOnGens2 :: (Show a, Eq a, Show b, Eq b, Show c, Eq c, CanFail f) => (a -> b -> c) -> (a -> b -> f c) -> Gen (a, b) -> Property Source #

equivalentWhenSecondSucceedsOnValids2 :: (Show a, Eq a, GenValidity a, Show b, Eq b, GenValidity b, Show c, Eq c, CanFail f) => (a -> b -> c) -> (a -> b -> f c) -> Property Source #

equivalentWhenSecondSucceeds2 :: (Show a, Eq a, GenValidity a, Show b, Eq b, GenValidity b, Show c, Eq c, CanFail f) => (a -> b -> c) -> (a -> b -> f c) -> Property Source #

equivalentWhenSucceedOnGen :: (Show a, Eq a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> f b) -> Gen a -> Property Source #

equivalentWhenSucceedOnValid :: (Show a, Eq a, GenValidity a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> f b) -> Property Source #

equivalentWhenSucceed :: (Show a, Eq a, GenValidity a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> f b) -> Property Source #

equivalentWhenSucceedOnGens2 :: (Show a, Eq a, Show b, Eq b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> f c) -> Gen (a, b) -> Property Source #

equivalentWhenSucceedOnValids2 :: (Show a, Eq a, GenValidity a, Show b, Eq b, GenValidity b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> f c) -> Property Source #

equivalentWhenSucceed2 :: (Show a, Eq a, GenValidity a, Show b, Eq b, GenValidity b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> f c) -> Property Source #

Standard tests involving inverse functions

inverseFunctionsOnGen :: (Show a, Eq a) => (a -> b) -> (b -> a) -> Gen a -> Property Source #

inverseFunctionsOnValid :: (Show a, Eq a, GenValidity a) => (a -> b) -> (b -> a) -> Property Source #

inverseFunctions :: (Show a, Eq a, GenValidity a) => (a -> b) -> (b -> a) -> Property Source #

inverseFunctionsOnArbitrary :: (Show a, Eq a, Arbitrary a) => (a -> b) -> (b -> a) -> Property Source #

id is its own inverse function for every type: prop> inverseFunctionsOnArbitrary id (id :: Int -> Int)

inverseFunctionsIfFirstSucceedsOnGen :: (Show a, Eq a, CanFail f) => (a -> f b) -> (b -> a) -> Gen a -> Property Source #

inverseFunctionsIfFirstSucceedsOnValid :: (Show a, Eq a, GenValidity a, CanFail f) => (a -> f b) -> (b -> a) -> Property Source #

inverseFunctionsIfFirstSucceeds :: (Show a, Eq a, GenValidity a, CanFail f) => (a -> f b) -> (b -> a) -> Property Source #

inverseFunctionsIfSecondSucceedsOnGen :: (Show a, Eq a, CanFail f) => (a -> b) -> (b -> f a) -> Gen a -> Property Source #

inverseFunctionsIfSecondSucceedsOnValid :: (Show a, Eq a, GenValidity a, CanFail f) => (a -> b) -> (b -> f a) -> Property Source #

inverseFunctionsIfSecondSucceeds :: (Show a, Eq a, GenValidity a, CanFail f) => (a -> b) -> (b -> f a) -> Property Source #

inverseFunctionsIfSucceedOnGen :: (Show a, Eq a, CanFail f, CanFail g) => (a -> f b) -> (b -> g a) -> Gen a -> Property Source #

inverseFunctionsIfSucceedOnValid :: (Show a, Eq a, GenValidity a, CanFail f, CanFail g) => (a -> f b) -> (b -> g a) -> Property Source #

inverseFunctionsIfSucceed :: (Show a, Eq a, GenValidity a, CanFail f, CanFail g) => (a -> f b) -> (b -> g a) -> Property Source #

inverseFunctionsIfSucceedOnArbitrary :: (Show a, Eq a, Arbitrary a, CanFail f, CanFail g) => (a -> f b) -> (b -> g a) -> Property Source #

Properties involving idempotence

idempotentOnGen :: (Show a, Eq a) => (a -> a) -> Gen a -> Property Source #

idempotentOnValid :: (Show a, Eq a, GenValidity a) => (a -> a) -> Property Source #

idempotent :: (Show a, Eq a, GenValidity a) => (a -> a) -> Property Source #

idempotentOnArbitrary :: (Show a, Eq a, Arbitrary a) => (a -> a) -> Property Source #

id is idempotent for any type:

idempotentOnArbitrary (id :: Int -> Int)

const, given any input, is idempotent for any type as well:

\int -> idempotentOnArbitrary (const int :: Int -> Int)