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

Safe Haskell | None
Language | Haskell2010

Test.Validity.Shrinking

Description

Tests for Shrinking functions

You will need `TypeApplications` to use these.

Synopsis

- shrinkValiditySpec :: forall a. (Show a, Eq a, Typeable a, GenValid a, GenInvalid a) => Spec
- shrinkValidSpec :: forall a. (Show a, Eq a, Typeable a, GenValid a) => Spec
- shrinkValidSpecWithLimit :: forall a. (Show a, Eq a, Typeable a, GenValid a) => Int -> Spec
- shrinkInvalidSpec :: forall a. (Show a, Typeable a, GenInvalid a) => Spec
- shrinkValidPreservesValidOnGenValid :: forall a. (Show a, GenValid a) => Property
- shrinkValidPreservesValidOnGenValidWithLimit :: forall a. (Show a, GenValid a) => Int -> Property
- shrinkInvalidPreservesInvalidOnGenInvalid :: forall a. (Show a, GenInvalid a) => Property
- shrinkPreservesValidOnGenValid :: (Show a, GenValid a) => (a -> [a]) -> Property
- shrinkPreservesInvalidOnGenInvalid :: (Show a, GenInvalid a) => (a -> [a]) -> Property
- shrinkValidPreservesValid :: (Show a, GenValid a) => Gen a -> Property
- shrinkInvalidPreservesInvalid :: (Show a, GenInvalid a) => Gen a -> Property
- shrinkingStaysValid :: (Show a, Validity a) => Gen a -> (a -> [a]) -> Property
- shrinkingStaysInvalid :: (Show a, Validity a) => Gen a -> (a -> [a]) -> Property
- shrinkingPreserves :: Show a => Gen a -> (a -> [a]) -> (a -> Bool) -> Property
- shrinkUncheckedDoesNotShrinkToItself :: forall a. (Show a, Eq a, GenUnchecked a) => Property
- shrinkUncheckedDoesNotShrinkToItselfWithLimit :: forall a. (Show a, Eq a, GenUnchecked a) => Int -> Property
- shrinkValidDoesNotShrinkToItself :: forall a. (Show a, Eq a, GenValid a) => Property
- shrinkValidDoesNotShrinkToItselfWithLimit :: forall a. (Show a, Eq a, GenValid a) => Int -> Property
- shrinkInvalidDoesNotShrinkToItself :: forall a. (Show a, Eq a, GenInvalid a) => Property
- shrinkInvalidDoesNotShrinkToItselfWithLimit :: forall a. (Show a, Eq a, GenInvalid a) => Int -> Property

# Documentation

shrinkValiditySpec :: forall a. (Show a, Eq a, Typeable a, GenValid a, GenInvalid a) => Spec Source #

shrinkValidSpec :: forall a. (Show a, Eq a, Typeable a, GenValid a) => Spec Source #

shrinkValidSpecWithLimit :: forall a. (Show a, Eq a, Typeable a, GenValid a) => Int -> Spec Source #

shrinkInvalidSpec :: forall a. (Show a, Typeable a, GenInvalid a) => Spec Source #

shrinkValidPreservesValidOnGenValid :: forall a. (Show a, GenValid a) => Property Source #

shrinkValidPreservesValidOnGenValidWithLimit :: forall a. (Show a, GenValid a) => Int -> Property Source #

shrinkInvalidPreservesInvalidOnGenInvalid :: forall a. (Show a, GenInvalid a) => Property Source #

shrinkPreservesValidOnGenValid :: (Show a, GenValid a) => (a -> [a]) -> Property Source #

    shrinkPreservesValidOnGenValid ((:[]) :: Int -> [Int])

shrinkPreservesInvalidOnGenInvalid :: (Show a, GenInvalid a) => (a -> [a]) -> Property Source #

    shrinkPreservesInvalidOnGenInvalid ((:[]) :: Rational -> [Rational])

shrinkValidPreservesValid :: (Show a, GenValid a) => Gen a -> Property Source #

    shrinkValidPreservesValid (pure 5 :: Gen Rational)

shrinkInvalidPreservesInvalid :: (Show a, GenInvalid a) => Gen a -> Property Source #

shrinkingStaysValid :: (Show a, Validity a) => Gen a -> (a -> [a]) -> Property Source #

    shrinkingStaysValid (pure 5 :: Gen Double) (\d -> [d - 1, d - 2])

shrinkingStaysInvalid :: (Show a, Validity a) => Gen a -> (a -> [a]) -> Property Source #

    shrinkingStaysInvalid (pure (1/0) :: Gen Double) (:[])

shrinkingPreserves :: Show a => Gen a -> (a -> [a]) -> (a -> Bool) -> Property Source #

    shrinkingPreserves (pure 5 :: Gen Int) (:[]) (== 5)

shrinkUncheckedDoesNotShrinkToItself :: forall a. (Show a, Eq a, GenUnchecked a) => Property Source #

shrinkUncheckedDoesNotShrinkToItselfWithLimit :: forall a. (Show a, Eq a, GenUnchecked a) => Int -> Property Source #

shrinkValidDoesNotShrinkToItself :: forall a. (Show a, Eq a, GenValid a) => Property Source #

shrinkValidDoesNotShrinkToItselfWithLimit :: forall a. (Show a, Eq a, GenValid a) => Int -> Property Source #

shrinkInvalidDoesNotShrinkToItself :: forall a. (Show a, Eq a, GenInvalid a) => Property Source #

shrinkInvalidDoesNotShrinkToItselfWithLimit :: forall a. (Show a, Eq a, GenInvalid a) => Int -> Property Source #