genvalidity-property 0.5.0.1 → 1.0.0.0
raw patch · 28 files changed
+1129/−1685 lines, 28 filesdep −directorydep −doctestdep −filepathdep ~basedep ~genvaliditydep ~hspecsetup-changedPVP ok
version bump matches the API change (PVP)
Dependencies removed: directory, doctest, filepath
Dependency ranges changed: base, genvalidity, hspec
API changes (from Hackage documentation)
- Test.Validity.Functions: equivalent :: (Show a, Eq a, GenUnchecked a, Show b, Eq b) => (a -> b) -> (a -> b) -> Property
- Test.Validity.Functions: equivalent2 :: (Show a, GenUnchecked a, Show b, GenUnchecked b, Show c, Eq c) => (a -> b -> c) -> (a -> b -> c) -> Property
- Test.Validity.Functions: equivalent3 :: (Show a, GenUnchecked a, Show b, GenUnchecked b, Show c, GenUnchecked c, Show d, Eq d) => (a -> b -> c -> d) -> (a -> b -> c -> d) -> Property
- Test.Validity.Functions: equivalentOnArbitrary :: (Show a, Eq a, Arbitrary a, Show b, Eq b) => (a -> b) -> (a -> b) -> Property
- Test.Validity.Functions: equivalentOnArbitrary2 :: (Show a, Arbitrary a, Show b, Arbitrary b, Show c, Eq c) => (a -> b -> c) -> (a -> b -> c) -> Property
- Test.Validity.Functions: equivalentOnArbitrary3 :: (Show a, Arbitrary a, Show b, Arbitrary b, Show c, Arbitrary c, Show d, Eq d) => (a -> b -> c -> d) -> (a -> b -> c -> d) -> Property
- Test.Validity.Functions: equivalentOnGen :: (Show a, Eq a, Show b, Eq b) => (a -> b) -> (a -> b) -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Functions: equivalentOnGens2 :: (Show a, Show b, Show c, Eq c) => (a -> b -> c) -> (a -> b -> c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property
- Test.Validity.Functions: equivalentOnGens3 :: (Show a, Show b, Show c, Show d, Eq d) => (a -> b -> c -> d) -> (a -> b -> c -> d) -> Gen (a, b, c) -> ((a, b, c) -> [(a, b, c)]) -> Property
- Test.Validity.Functions: equivalentOnValid :: (Show a, Eq a, GenValid a, Show b, Eq b) => (a -> b) -> (a -> b) -> Property
- Test.Validity.Functions: equivalentOnValids2 :: (Show a, GenValid a, Show b, GenValid b, Show c, Eq c) => (a -> b -> c) -> (a -> b -> c) -> Property
- Test.Validity.Functions: equivalentOnValids3 :: (Show a, GenValid a, Show b, GenValid b, Show c, GenValid c, Show d, Eq d) => (a -> b -> c -> d) -> (a -> b -> c -> d) -> Property
- Test.Validity.Functions: equivalentWhenFirstSucceeds :: (Show a, Eq a, GenUnchecked a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> b) -> Property
- Test.Validity.Functions: equivalentWhenFirstSucceeds2 :: (Show a, Eq a, GenUnchecked a, Show b, Eq b, GenUnchecked b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> c) -> Property
- Test.Validity.Functions: equivalentWhenFirstSucceedsOnArbitrary :: (Show a, Eq a, Arbitrary a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> b) -> Property
- Test.Validity.Functions: equivalentWhenFirstSucceedsOnArbitrary2 :: (Show a, Eq a, Arbitrary a, Show b, Eq b, Arbitrary b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> c) -> Property
- Test.Validity.Functions: equivalentWhenFirstSucceedsOnGen :: (Show a, Eq a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> b) -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Functions: 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) -> ((a, b) -> [(a, b)]) -> Property
- Test.Validity.Functions: equivalentWhenFirstSucceedsOnValid :: (Show a, Eq a, GenValid a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> b) -> Property
- Test.Validity.Functions: equivalentWhenFirstSucceedsOnValids2 :: (Show a, Eq a, GenValid a, Show b, Eq b, GenValid b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> c) -> Property
- Test.Validity.Functions: equivalentWhenSecondSucceeds :: (Show a, Eq a, GenUnchecked a, Show b, Eq b, CanFail f) => (a -> b) -> (a -> f b) -> Property
- Test.Validity.Functions: equivalentWhenSecondSucceeds2 :: (Show a, Eq a, GenUnchecked a, Show b, Eq b, GenUnchecked b, Show c, Eq c, CanFail f) => (a -> b -> c) -> (a -> b -> f c) -> Property
- Test.Validity.Functions: equivalentWhenSecondSucceedsOnArbitrary :: (Show a, Eq a, Arbitrary a, Show b, Eq b, CanFail f) => (a -> b) -> (a -> f b) -> Property
- Test.Validity.Functions: equivalentWhenSecondSucceedsOnArbitrary2 :: (Show a, Eq a, Arbitrary a, Show b, Eq b, Arbitrary b, Show c, Eq c, CanFail f) => (a -> b -> c) -> (a -> b -> f c) -> Property
- Test.Validity.Functions: equivalentWhenSecondSucceedsOnGen :: (Show a, Eq a, Show b, Eq b, CanFail f) => (a -> b) -> (a -> f b) -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Functions: 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) -> ((a, b) -> [(a, b)]) -> Property
- Test.Validity.Functions: equivalentWhenSecondSucceedsOnValid :: (Show a, Eq a, GenValid a, Show b, Eq b, CanFail f) => (a -> b) -> (a -> f b) -> Property
- Test.Validity.Functions: equivalentWhenSecondSucceedsOnValids2 :: (Show a, Eq a, GenValid a, Show b, Eq b, GenValid b, Show c, Eq c, CanFail f) => (a -> b -> c) -> (a -> b -> f c) -> Property
- Test.Validity.Functions: equivalentWhenSucceed :: (Show a, Eq a, GenUnchecked a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> f b) -> Property
- Test.Validity.Functions: equivalentWhenSucceed2 :: (Show a, Eq a, GenUnchecked a, Show b, Eq b, GenUnchecked b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> f c) -> Property
- Test.Validity.Functions: equivalentWhenSucceedOnArbitrary :: (Show a, Eq a, Arbitrary a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> f b) -> Property
- Test.Validity.Functions: equivalentWhenSucceedOnArbitrary2 :: (Show a, Eq a, Arbitrary a, Show b, Eq b, Arbitrary b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> f c) -> Property
- Test.Validity.Functions: equivalentWhenSucceedOnGen :: (Show a, Eq a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> f b) -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Functions: 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) -> ((a, b) -> [(a, b)]) -> Property
- Test.Validity.Functions: equivalentWhenSucceedOnValid :: (Show a, Eq a, GenValid a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> f b) -> Property
- Test.Validity.Functions: equivalentWhenSucceedOnValids2 :: (Show a, Eq a, GenValid a, Show b, Eq b, GenValid b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> f c) -> Property
- Test.Validity.Functions: failsOnGen :: (Show a, Show b, Show (f b), CanFail f) => (a -> f b) -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Functions: failsOnGens2 :: (Show a, Show b, Show c, Show (f c), CanFail f) => (a -> b -> f c) -> Gen a -> (a -> [a]) -> Gen b -> (b -> [b]) -> Property
- Test.Validity.Functions: failsOnInvalid :: (Show a, Show b, Show (f b), GenInvalid a, CanFail f) => (a -> f b) -> Property
- Test.Validity.Functions: failsOnInvalid2 :: (Show a, Show b, Show c, Show (f c), GenUnchecked a, GenUnchecked b, GenInvalid a, GenInvalid b, CanFail f) => (a -> b -> f c) -> Property
- Test.Validity.Functions: idempotent :: (Show a, Eq a, GenUnchecked a) => (a -> a) -> Property
- Test.Validity.Functions: idempotentOnArbitrary :: (Show a, Eq a, Arbitrary a) => (a -> a) -> Property
- Test.Validity.Functions: idempotentOnGen :: (Show a, Eq a) => (a -> a) -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Functions: idempotentOnValid :: (Show a, Eq a, GenValid a) => (a -> a) -> Property
- Test.Validity.Functions: inverseFunctions :: (Show a, Eq a, GenUnchecked a) => (a -> b) -> (b -> a) -> Property
- Test.Validity.Functions: inverseFunctionsIfFirstSucceeds :: (Show a, Eq a, GenUnchecked a, CanFail f) => (a -> f b) -> (b -> a) -> Property
- Test.Validity.Functions: inverseFunctionsIfFirstSucceedsOnArbitrary :: (Show a, Eq a, Arbitrary a, CanFail f) => (a -> f b) -> (b -> a) -> Property
- Test.Validity.Functions: inverseFunctionsIfFirstSucceedsOnGen :: (Show a, Eq a, CanFail f) => (a -> f b) -> (b -> a) -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Functions: inverseFunctionsIfFirstSucceedsOnValid :: (Show a, Eq a, GenValid a, CanFail f) => (a -> f b) -> (b -> a) -> Property
- Test.Validity.Functions: inverseFunctionsIfSecondSucceeds :: (Show a, Eq a, GenUnchecked a, CanFail f) => (a -> b) -> (b -> f a) -> Property
- Test.Validity.Functions: inverseFunctionsIfSecondSucceedsOnArbitrary :: (Show a, Eq a, Arbitrary a, CanFail f) => (a -> b) -> (b -> f a) -> Property
- Test.Validity.Functions: inverseFunctionsIfSecondSucceedsOnGen :: (Show a, Eq a, CanFail f) => (a -> b) -> (b -> f a) -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Functions: inverseFunctionsIfSecondSucceedsOnValid :: (Show a, Eq a, GenValid a, CanFail f) => (a -> b) -> (b -> f a) -> Property
- Test.Validity.Functions: inverseFunctionsIfSucceed :: (Show a, Eq a, GenUnchecked a, CanFail f, CanFail g) => (a -> f b) -> (b -> g a) -> Property
- Test.Validity.Functions: inverseFunctionsIfSucceedOnArbitrary :: (Show a, Eq a, Arbitrary a, CanFail f, CanFail g) => (a -> f b) -> (b -> g a) -> Property
- Test.Validity.Functions: inverseFunctionsIfSucceedOnGen :: (Show a, Eq a, CanFail f, CanFail g) => (a -> f b) -> (b -> g a) -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Functions: inverseFunctionsIfSucceedOnValid :: (Show a, Eq a, GenValid a, CanFail f, CanFail g) => (a -> f b) -> (b -> g a) -> Property
- Test.Validity.Functions: inverseFunctionsOnArbitrary :: (Show a, Eq a, Arbitrary a) => (a -> b) -> (b -> a) -> Property
- Test.Validity.Functions: inverseFunctionsOnGen :: (Show a, Eq a) => (a -> b) -> (b -> a) -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Functions: inverseFunctionsOnValid :: (Show a, Eq a, GenValid a) => (a -> b) -> (b -> a) -> Property
- Test.Validity.Functions: producesValid :: (Show a, Show b, GenUnchecked a, Validity b) => (a -> b) -> Property
- Test.Validity.Functions: producesValid2 :: (Show a, Show b, Show c, GenUnchecked a, GenUnchecked b, Validity c) => (a -> b -> c) -> Property
- Test.Validity.Functions: producesValid3 :: (Show a, Show b, Show c, Show d, GenUnchecked a, GenUnchecked b, GenUnchecked c, Validity d) => (a -> b -> c -> d) -> Property
- Test.Validity.Functions: producesValidsOnArbitrary :: (Show a, Show b, Arbitrary a, Validity b) => (a -> b) -> Property
- Test.Validity.Functions: producesValidsOnArbitrary2 :: (Show a, Show b, Show c, Arbitrary a, Arbitrary b, Validity c) => (a -> b -> c) -> Property
- Test.Validity.Functions: producesValidsOnArbitrary3 :: (Show a, Show b, Show c, Show d, Arbitrary a, Arbitrary b, Arbitrary c, Validity d) => (a -> b -> c -> d) -> Property
- Test.Validity.Functions: producesValidsOnGen :: forall a b. (Show a, Show b, Validity b) => (a -> b) -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Functions: producesValidsOnGens2 :: (Show a, Show b, Show c, Validity c) => (a -> b -> c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property
- Test.Validity.Functions: producesValidsOnGens3 :: (Show a, Show b, Show c, Show d, Validity d) => (a -> b -> c -> d) -> Gen (a, b, c) -> ((a, b, c) -> [(a, b, c)]) -> Property
- Test.Validity.Functions: producesValidsOnValids :: (Show a, Show b, GenValid a, Validity b) => (a -> b) -> Property
- Test.Validity.Functions: producesValidsOnValids2 :: (Show a, Show b, Show c, GenValid a, GenValid b, Validity c) => (a -> b -> c) -> Property
- Test.Validity.Functions: producesValidsOnValids3 :: (Show a, Show b, Show c, Show d, GenValid a, GenValid b, GenValid c, Validity d) => (a -> b -> c -> d) -> Property
- Test.Validity.Functions: succeeds :: (Show a, Show b, Show (f b), GenUnchecked a, CanFail f) => (a -> f b) -> Property
- Test.Validity.Functions: succeeds2 :: (Show a, Show b, Show c, Show (f c), GenUnchecked a, GenUnchecked b, CanFail f) => (a -> b -> f c) -> Property
- Test.Validity.Functions: succeedsOnArbitrary :: (Show a, Show b, Show (f b), Arbitrary a, CanFail f) => (a -> f b) -> Property
- Test.Validity.Functions: succeedsOnArbitrary2 :: (Show a, Show b, Show c, Show (f c), Arbitrary a, Arbitrary b, CanFail f) => (a -> b -> f c) -> Property
- Test.Validity.Functions: succeedsOnGen :: (Show a, Show b, Show (f b), CanFail f) => (a -> f b) -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Functions: succeedsOnGens2 :: (Show a, Show b, Show c, Show (f c), CanFail f) => (a -> b -> f c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property
- Test.Validity.Functions: succeedsOnValid :: (Show a, Show b, Show (f b), GenValid a, CanFail f) => (a -> f b) -> Property
- Test.Validity.Functions: succeedsOnValids2 :: (Show a, Show b, Show c, Show (f c), GenValid a, GenValid b, CanFail f) => (a -> b -> f c) -> Property
- Test.Validity.Functions: validIfSucceeds :: (Show a, Show b, Show (f b), GenUnchecked a, Validity b, CanFail f) => (a -> f b) -> Property
- Test.Validity.Functions: validIfSucceeds2 :: (Show a, Show b, Show c, Show (f c), GenUnchecked a, GenUnchecked b, Validity c, CanFail f) => (a -> b -> f c) -> Property
- Test.Validity.Functions: validIfSucceeds3 :: (Show a, Show b, Show c, Show d, Show (f d), GenUnchecked a, GenUnchecked b, GenUnchecked c, Validity d, CanFail f) => (a -> b -> c -> f d) -> Property
- Test.Validity.Functions: validIfSucceedsOnArbitrary :: (Show a, Show b, Show (f b), Arbitrary a, Validity b, CanFail f) => (a -> f b) -> Property
- Test.Validity.Functions: validIfSucceedsOnArbitrary2 :: (Show a, Show b, Show c, Show (f c), Arbitrary a, Arbitrary b, Validity c, CanFail f) => (a -> b -> f c) -> Property
- Test.Validity.Functions: validIfSucceedsOnArbitrary3 :: (Show a, Show b, Show c, Show d, Show (f d), Arbitrary a, Arbitrary b, Arbitrary c, Validity d, CanFail f) => (a -> b -> c -> f d) -> Property
- Test.Validity.Functions: validIfSucceedsOnGen :: (Show a, Show b, Show (f b), Validity b, CanFail f) => (a -> f b) -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Functions: validIfSucceedsOnGens2 :: (Show a, Show b, Show c, Show (f c), Validity c, CanFail f) => (a -> b -> f c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property
- Test.Validity.Functions: validIfSucceedsOnGens3 :: (Show a, Show b, Show c, Show d, Show (f d), Validity d, CanFail f) => (a -> b -> c -> f d) -> Gen (a, b, c) -> ((a, b, c) -> [(a, b, c)]) -> Property
- Test.Validity.Functions: validIfSucceedsOnValid :: (Show a, Show b, Show (f b), GenValid a, Validity b, CanFail f) => (a -> f b) -> Property
- Test.Validity.Functions: validIfSucceedsOnValids2 :: (Show a, Show b, Show c, Show (f c), GenValid a, GenValid b, Validity c, CanFail f) => (a -> b -> f c) -> Property
- Test.Validity.Functions: validIfSucceedsOnValids3 :: (Show a, Show b, Show c, Show d, Show (f d), GenValid a, GenValid b, GenValid c, Validity d, CanFail f) => (a -> b -> c -> f d) -> Property
- Test.Validity.Functions.CanFail: failsOnInvalid :: (Show a, Show b, Show (f b), GenInvalid a, CanFail f) => (a -> f b) -> Property
- Test.Validity.Functions.CanFail: failsOnInvalid2 :: (Show a, Show b, Show c, Show (f c), GenUnchecked a, GenUnchecked b, GenInvalid a, GenInvalid b, CanFail f) => (a -> b -> f c) -> Property
- Test.Validity.Functions.CanFail: succeedsOnValid :: (Show a, Show b, Show (f b), GenValid a, CanFail f) => (a -> f b) -> Property
- Test.Validity.Functions.CanFail: succeedsOnValids2 :: (Show a, Show b, Show c, Show (f c), GenValid a, GenValid b, CanFail f) => (a -> b -> f c) -> Property
- Test.Validity.Functions.CanFail: validIfSucceedsOnValid :: (Show a, Show b, Show (f b), GenValid a, Validity b, CanFail f) => (a -> f b) -> Property
- Test.Validity.Functions.CanFail: validIfSucceedsOnValids2 :: (Show a, Show b, Show c, Show (f c), GenValid a, GenValid b, Validity c, CanFail f) => (a -> b -> f c) -> Property
- Test.Validity.Functions.CanFail: validIfSucceedsOnValids3 :: (Show a, Show b, Show c, Show d, Show (f d), GenValid a, GenValid b, GenValid c, Validity d, CanFail f) => (a -> b -> c -> f d) -> Property
- Test.Validity.Functions.Equivalence: equivalentOnValid :: (Show a, Eq a, GenValid a, Show b, Eq b) => (a -> b) -> (a -> b) -> Property
- Test.Validity.Functions.Equivalence: equivalentOnValids2 :: (Show a, GenValid a, Show b, GenValid b, Show c, Eq c) => (a -> b -> c) -> (a -> b -> c) -> Property
- Test.Validity.Functions.Equivalence: equivalentOnValids3 :: (Show a, GenValid a, Show b, GenValid b, Show c, GenValid c, Show d, Eq d) => (a -> b -> c -> d) -> (a -> b -> c -> d) -> Property
- Test.Validity.Functions.Equivalence: equivalentWhenFirstSucceedsOnValid :: (Show a, Eq a, GenValid a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> b) -> Property
- Test.Validity.Functions.Equivalence: equivalentWhenFirstSucceedsOnValids2 :: (Show a, Eq a, GenValid a, Show b, Eq b, GenValid b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> c) -> Property
- Test.Validity.Functions.Equivalence: equivalentWhenSecondSucceedsOnValid :: (Show a, Eq a, GenValid a, Show b, Eq b, CanFail f) => (a -> b) -> (a -> f b) -> Property
- Test.Validity.Functions.Equivalence: equivalentWhenSecondSucceedsOnValids2 :: (Show a, Eq a, GenValid a, Show b, Eq b, GenValid b, Show c, Eq c, CanFail f) => (a -> b -> c) -> (a -> b -> f c) -> Property
- Test.Validity.Functions.Equivalence: equivalentWhenSucceedOnValid :: (Show a, Eq a, GenValid a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> f b) -> Property
- Test.Validity.Functions.Equivalence: equivalentWhenSucceedOnValids2 :: (Show a, Eq a, GenValid a, Show b, Eq b, GenValid b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> f c) -> Property
- Test.Validity.Functions.Idempotence: idempotentOnValid :: (Show a, Eq a, GenValid a) => (a -> a) -> Property
- Test.Validity.Functions.Inverse: inverseFunctionsIfFirstSucceedsOnValid :: (Show a, Eq a, GenValid a, CanFail f) => (a -> f b) -> (b -> a) -> Property
- Test.Validity.Functions.Inverse: inverseFunctionsIfSecondSucceedsOnValid :: (Show a, Eq a, GenValid a, CanFail f) => (a -> b) -> (b -> f a) -> Property
- Test.Validity.Functions.Inverse: inverseFunctionsIfSucceedOnValid :: (Show a, Eq a, GenValid a, CanFail f, CanFail g) => (a -> f b) -> (b -> g a) -> Property
- Test.Validity.Functions.Inverse: inverseFunctionsOnValid :: (Show a, Eq a, GenValid a) => (a -> b) -> (b -> a) -> Property
- Test.Validity.Functions.Validity: producesValidsOnValids :: (Show a, Show b, GenValid a, Validity b) => (a -> b) -> Property
- Test.Validity.Functions.Validity: producesValidsOnValids2 :: (Show a, Show b, Show c, GenValid a, GenValid b, Validity c) => (a -> b -> c) -> Property
- Test.Validity.Functions.Validity: producesValidsOnValids3 :: (Show a, Show b, Show c, Show d, GenValid a, GenValid b, GenValid c, Validity d) => (a -> b -> c -> d) -> Property
- Test.Validity.Operations: associative :: (Show a, Eq a, GenUnchecked a) => (a -> a -> a) -> Property
- Test.Validity.Operations: associativeOnArbitrary :: (Show a, Eq a, Arbitrary a) => (a -> a -> a) -> Property
- Test.Validity.Operations: associativeOnGens :: (Show a, Eq a) => (a -> a -> a) -> Gen (a, a, a) -> ((a, a, a) -> [(a, a, a)]) -> Property
- Test.Validity.Operations: associativeOnValids :: (Show a, Eq a, GenValid a) => (a -> a -> a) -> Property
- Test.Validity.Operations: commutative :: (Show a, Eq a, GenUnchecked a) => (a -> a -> a) -> Property
- Test.Validity.Operations: commutativeOnArbitrary :: (Show a, Eq a, Arbitrary a) => (a -> a -> a) -> Property
- Test.Validity.Operations: commutativeOnGens :: (Show a, Eq a) => (a -> a -> a) -> Gen (a, a) -> ((a, a) -> [(a, a)]) -> Property
- Test.Validity.Operations: commutativeOnValids :: (Show a, Eq a, GenValid a) => (a -> a -> a) -> Property
- Test.Validity.Operations: identity :: (Show a, Eq a, GenUnchecked a) => (a -> a -> a) -> a -> Property
- Test.Validity.Operations: identityOnArbitrary :: (Show a, Eq a, Arbitrary a) => (a -> a -> a) -> a -> Property
- Test.Validity.Operations: identityOnGen :: (Show a, Eq a) => (a -> a -> a) -> a -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Operations: identityOnValid :: (Show a, Eq a, GenValid a) => (a -> a -> a) -> a -> Property
- Test.Validity.Operations: leftIdentity :: (Show a, Eq a, GenUnchecked a) => (b -> a -> a) -> b -> Property
- Test.Validity.Operations: leftIdentityOnArbitrary :: (Show a, Eq a, Arbitrary a) => (b -> a -> a) -> b -> Property
- Test.Validity.Operations: leftIdentityOnElemWithEquality :: (b -> a -> a) -> (a -> a -> Bool) -> b -> a -> Bool
- Test.Validity.Operations: leftIdentityOnGen :: (Show a, Eq a) => (b -> a -> a) -> b -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Operations: leftIdentityOnGenWithEquality :: Show a => (b -> a -> a) -> (a -> a -> Bool) -> b -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Operations: leftIdentityOnValid :: (Show a, Eq a, GenValid a) => (b -> a -> a) -> b -> Property
- Test.Validity.Operations: rightIdentity :: (Show a, Eq a, GenUnchecked a) => (a -> b -> a) -> b -> Property
- Test.Validity.Operations: rightIdentityOnArbitrary :: (Show a, Eq a, Arbitrary a) => (a -> b -> a) -> b -> Property
- Test.Validity.Operations: rightIdentityOnElemWithEquality :: (a -> b -> a) -> (a -> a -> Bool) -> b -> a -> Bool
- Test.Validity.Operations: rightIdentityOnGen :: (Show a, Eq a) => (a -> b -> a) -> b -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Operations: rightIdentityOnGenWithEquality :: Show a => (a -> b -> a) -> (a -> a -> Bool) -> b -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Operations: rightIdentityOnValid :: (Show a, Eq a, GenValid a) => (a -> b -> a) -> b -> Property
- Test.Validity.Operations.Associativity: associativeOnValids :: (Show a, Eq a, GenValid a) => (a -> a -> a) -> Property
- Test.Validity.Operations.Commutativity: commutativeOnValids :: (Show a, Eq a, GenValid a) => (a -> a -> a) -> Property
- Test.Validity.Operations.Identity: identityOnValid :: (Show a, Eq a, GenValid a) => (a -> a -> a) -> a -> Property
- Test.Validity.Operations.Identity: leftIdentityOnValid :: (Show a, Eq a, GenValid a) => (b -> a -> a) -> b -> Property
- Test.Validity.Operations.Identity: rightIdentityOnValid :: (Show a, Eq a, GenValid a) => (a -> b -> a) -> b -> Property
- Test.Validity.Property: antireflexivityOnValid :: (Show a, GenValid a) => (a -> a -> Bool) -> Property
- Test.Validity.Property: antisymmetryOnValid :: (Show a, Eq a, GenValid a) => (a -> a -> Bool) -> Property
- Test.Validity.Property: associativeOnValids :: (Show a, Eq a, GenValid a) => (a -> a -> a) -> Property
- Test.Validity.Property: commutativeOnValids :: (Show a, Eq a, GenValid a) => (a -> a -> a) -> Property
- Test.Validity.Property: equivalentOnValid :: (Show a, Eq a, GenValid a, Show b, Eq b) => (a -> b) -> (a -> b) -> Property
- Test.Validity.Property: equivalentOnValids2 :: (Show a, GenValid a, Show b, GenValid b, Show c, Eq c) => (a -> b -> c) -> (a -> b -> c) -> Property
- Test.Validity.Property: equivalentOnValids3 :: (Show a, GenValid a, Show b, GenValid b, Show c, GenValid c, Show d, Eq d) => (a -> b -> c -> d) -> (a -> b -> c -> d) -> Property
- Test.Validity.Property: equivalentWhenFirstSucceedsOnValid :: (Show a, Eq a, GenValid a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> b) -> Property
- Test.Validity.Property: equivalentWhenFirstSucceedsOnValids2 :: (Show a, Eq a, GenValid a, Show b, Eq b, GenValid b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> c) -> Property
- Test.Validity.Property: equivalentWhenSecondSucceedsOnValid :: (Show a, Eq a, GenValid a, Show b, Eq b, CanFail f) => (a -> b) -> (a -> f b) -> Property
- Test.Validity.Property: equivalentWhenSecondSucceedsOnValids2 :: (Show a, Eq a, GenValid a, Show b, Eq b, GenValid b, Show c, Eq c, CanFail f) => (a -> b -> c) -> (a -> b -> f c) -> Property
- Test.Validity.Property: equivalentWhenSucceedOnValid :: (Show a, Eq a, GenValid a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> f b) -> Property
- Test.Validity.Property: equivalentWhenSucceedOnValids2 :: (Show a, Eq a, GenValid a, Show b, Eq b, GenValid b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> f c) -> Property
- Test.Validity.Property: failsOnInvalid :: (Show a, Show b, Show (f b), GenInvalid a, CanFail f) => (a -> f b) -> Property
- Test.Validity.Property: failsOnInvalid2 :: (Show a, Show b, Show c, Show (f c), GenUnchecked a, GenUnchecked b, GenInvalid a, GenInvalid b, CanFail f) => (a -> b -> f c) -> Property
- Test.Validity.Property: forAllInvalid :: (Show a, GenInvalid a, Testable prop) => (a -> prop) -> Property
- Test.Validity.Property: forAllUnchecked :: (Show a, GenUnchecked a, Testable prop) => (a -> prop) -> Property
- Test.Validity.Property: genGeneratesInvalid :: forall a. (Show a, Validity a) => Gen a -> Property
- Test.Validity.Property: idempotentOnValid :: (Show a, Eq a, GenValid a) => (a -> a) -> Property
- Test.Validity.Property: identityOnValid :: (Show a, Eq a, GenValid a) => (a -> a -> a) -> a -> Property
- Test.Validity.Property: inverseFunctionsIfFirstSucceedsOnValid :: (Show a, Eq a, GenValid a, CanFail f) => (a -> f b) -> (b -> a) -> Property
- Test.Validity.Property: inverseFunctionsIfSecondSucceedsOnValid :: (Show a, Eq a, GenValid a, CanFail f) => (a -> b) -> (b -> f a) -> Property
- Test.Validity.Property: inverseFunctionsIfSucceedOnValid :: (Show a, Eq a, GenValid a, CanFail f, CanFail g) => (a -> f b) -> (b -> g a) -> Property
- Test.Validity.Property: inverseFunctionsOnValid :: (Show a, Eq a, GenValid a) => (a -> b) -> (b -> a) -> Property
- Test.Validity.Property: leftIdentityOnValid :: (Show a, Eq a, GenValid a) => (b -> a -> a) -> b -> Property
- Test.Validity.Property: producesValidsOnValids :: (Show a, Show b, GenValid a, Validity b) => (a -> b) -> Property
- Test.Validity.Property: producesValidsOnValids2 :: (Show a, Show b, Show c, GenValid a, GenValid b, Validity c) => (a -> b -> c) -> Property
- Test.Validity.Property: producesValidsOnValids3 :: (Show a, Show b, Show c, Show d, GenValid a, GenValid b, GenValid c, Validity d) => (a -> b -> c -> d) -> Property
- Test.Validity.Property: reflexivityOnValid :: (Show a, GenValid a) => (a -> a -> Bool) -> Property
- Test.Validity.Property: rightIdentityOnValid :: (Show a, Eq a, GenValid a) => (a -> b -> a) -> b -> Property
- Test.Validity.Property: succeedsOnValid :: (Show a, Show b, Show (f b), GenValid a, CanFail f) => (a -> f b) -> Property
- Test.Validity.Property: succeedsOnValids2 :: (Show a, Show b, Show c, Show (f c), GenValid a, GenValid b, CanFail f) => (a -> b -> f c) -> Property
- Test.Validity.Property: symmetryOnValid :: (Show a, GenValid a) => (a -> a -> Bool) -> Property
- Test.Validity.Property: transitivityOnValid :: (Show a, GenValid a) => (a -> a -> Bool) -> Property
- Test.Validity.Property: validIfSucceedsOnValid :: (Show a, Show b, Show (f b), GenValid a, Validity b, CanFail f) => (a -> f b) -> Property
- Test.Validity.Property: validIfSucceedsOnValids2 :: (Show a, Show b, Show c, Show (f c), GenValid a, GenValid b, Validity c, CanFail f) => (a -> b -> f c) -> Property
- Test.Validity.Property: validIfSucceedsOnValids3 :: (Show a, Show b, Show c, Show d, Show (f d), GenValid a, GenValid b, GenValid c, Validity d, CanFail f) => (a -> b -> c -> f d) -> Property
- Test.Validity.Property.Utils: forAllInvalid :: (Show a, GenInvalid a, Testable prop) => (a -> prop) -> Property
- Test.Validity.Property.Utils: forAllUnchecked :: (Show a, GenUnchecked a, Testable prop) => (a -> prop) -> Property
- Test.Validity.Relations: antireflexiveOnElem :: (a -> a -> Bool) -> a -> Bool
- Test.Validity.Relations: antireflexivity :: (Show a, GenUnchecked a) => (a -> a -> Bool) -> Property
- Test.Validity.Relations: antireflexivityOnArbitrary :: (Show a, Arbitrary a) => (a -> a -> Bool) -> Property
- Test.Validity.Relations: antireflexivityOnGen :: Show a => (a -> a -> Bool) -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Relations: antireflexivityOnValid :: (Show a, GenValid a) => (a -> a -> Bool) -> Property
- Test.Validity.Relations: antisymmetricOnElemsWithEquality :: (a -> a -> Bool) -> (a -> a -> Bool) -> a -> a -> Bool
- Test.Validity.Relations: antisymmetry :: (Show a, Eq a, GenUnchecked a) => (a -> a -> Bool) -> Property
- Test.Validity.Relations: antisymmetryOnArbitrary :: (Show a, Eq a, Arbitrary a) => (a -> a -> Bool) -> Property
- Test.Validity.Relations: antisymmetryOnGens :: (Show a, Eq a) => (a -> a -> Bool) -> Gen (a, a) -> (a -> [a]) -> Property
- Test.Validity.Relations: antisymmetryOnGensWithEquality :: Show a => (a -> a -> Bool) -> Gen (a, a) -> (a -> a -> Bool) -> (a -> [a]) -> Property
- Test.Validity.Relations: antisymmetryOnValid :: (Show a, Eq a, GenValid a) => (a -> a -> Bool) -> Property
- Test.Validity.Relations: reflexiveOnElem :: (a -> a -> Bool) -> a -> Bool
- Test.Validity.Relations: reflexivity :: (Show a, GenUnchecked a) => (a -> a -> Bool) -> Property
- Test.Validity.Relations: reflexivityOnArbitrary :: (Show a, Arbitrary a) => (a -> a -> Bool) -> Property
- Test.Validity.Relations: reflexivityOnGen :: Show a => (a -> a -> Bool) -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Relations: reflexivityOnValid :: (Show a, GenValid a) => (a -> a -> Bool) -> Property
- Test.Validity.Relations: symmetricOnElems :: (a -> a -> Bool) -> a -> a -> Bool
- Test.Validity.Relations: symmetry :: (Show a, GenUnchecked a) => (a -> a -> Bool) -> Property
- Test.Validity.Relations: symmetryOnArbitrary :: (Show a, Arbitrary a) => (a -> a -> Bool) -> Property
- Test.Validity.Relations: symmetryOnGens :: Show a => (a -> a -> Bool) -> Gen (a, a) -> (a -> [a]) -> Property
- Test.Validity.Relations: symmetryOnValid :: (Show a, GenValid a) => (a -> a -> Bool) -> Property
- Test.Validity.Relations: transitiveOnElems :: (a -> a -> Bool) -> a -> a -> a -> Bool
- Test.Validity.Relations: transitivity :: (Show a, GenUnchecked a) => (a -> a -> Bool) -> Property
- Test.Validity.Relations: transitivityOnArbitrary :: (Show a, Arbitrary a) => (a -> a -> Bool) -> Property
- Test.Validity.Relations: transitivityOnGens :: Show a => (a -> a -> Bool) -> Gen (a, a, a) -> (a -> [a]) -> Property
- Test.Validity.Relations: transitivityOnValid :: (Show a, GenValid a) => (a -> a -> Bool) -> Property
- Test.Validity.Relations.Antireflexivity: antireflexivityOnValid :: (Show a, GenValid a) => (a -> a -> Bool) -> Property
- Test.Validity.Relations.Antisymmetry: antisymmetryOnValid :: (Show a, Eq a, GenValid a) => (a -> a -> Bool) -> Property
- Test.Validity.Relations.Reflexivity: reflexivityOnValid :: (Show a, GenValid a) => (a -> a -> Bool) -> Property
- Test.Validity.Relations.Symmetry: symmetryOnValid :: (Show a, GenValid a) => (a -> a -> Bool) -> Property
- Test.Validity.Relations.Transitivity: transitivityOnValid :: (Show a, GenValid a) => (a -> a -> Bool) -> Property
- Test.Validity.Shrinking.Property: shrinkDoesNotShrinkToItselfOnInvalid :: forall a. (Show a, Eq a, GenInvalid a) => (a -> [a]) -> Property
- Test.Validity.Shrinking.Property: shrinkDoesNotShrinkToItselfOnInvalidWithLimit :: forall a. (Show a, Eq a, GenInvalid a) => (a -> [a]) -> Int -> Property
- Test.Validity.Shrinking.Property: shrinkInvalidPreservesInvalid :: forall a. (Show a, GenInvalid a) => Gen a -> Property
- Test.Validity.Shrinking.Property: shrinkPreservesInvalidOnGenInvalid :: forall a. (Show a, GenInvalid a) => (a -> [a]) -> Property
- Test.Validity.Shrinking.Property: shrinkingStaysInvalid :: forall a. (Show a, Validity a) => Gen a -> (a -> [a]) -> Property
- Test.Validity.Functions.CanFail: failsOnGen :: (Show a, Show b, Show (f b), CanFail f) => (a -> f b) -> Gen a -> (a -> [a]) -> Property
+ Test.Validity.Functions.CanFail: failsOnGen :: (Show a, Show (f b), CanFail f) => (a -> f b) -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Functions.CanFail: failsOnGens2 :: (Show a, Show b, Show c, Show (f c), CanFail f) => (a -> b -> f c) -> Gen a -> (a -> [a]) -> Gen b -> (b -> [b]) -> Property
+ Test.Validity.Functions.CanFail: failsOnGens2 :: (Show a, Show b, Show (f c), CanFail f) => (a -> b -> f c) -> Gen a -> (a -> [a]) -> Gen b -> (b -> [b]) -> Property
- Test.Validity.Functions.CanFail: succeeds :: (Show a, Show b, Show (f b), GenUnchecked a, CanFail f) => (a -> f b) -> Property
+ Test.Validity.Functions.CanFail: succeeds :: (Show a, Show (f b), GenValid a, CanFail f) => (a -> f b) -> Property
- Test.Validity.Functions.CanFail: succeeds2 :: (Show a, Show b, Show c, Show (f c), GenUnchecked a, GenUnchecked b, CanFail f) => (a -> b -> f c) -> Property
+ Test.Validity.Functions.CanFail: succeeds2 :: (Show a, Show b, Show (f c), GenValid a, GenValid b, CanFail f) => (a -> b -> f c) -> Property
- Test.Validity.Functions.CanFail: succeedsOnArbitrary :: (Show a, Show b, Show (f b), Arbitrary a, CanFail f) => (a -> f b) -> Property
+ Test.Validity.Functions.CanFail: succeedsOnArbitrary :: (Show a, Show (f b), Arbitrary a, CanFail f) => (a -> f b) -> Property
- Test.Validity.Functions.CanFail: succeedsOnArbitrary2 :: (Show a, Show b, Show c, Show (f c), Arbitrary a, Arbitrary b, CanFail f) => (a -> b -> f c) -> Property
+ Test.Validity.Functions.CanFail: succeedsOnArbitrary2 :: (Show a, Show b, Show (f c), Arbitrary a, Arbitrary b, CanFail f) => (a -> b -> f c) -> Property
- Test.Validity.Functions.CanFail: succeedsOnGen :: (Show a, Show b, Show (f b), CanFail f) => (a -> f b) -> Gen a -> (a -> [a]) -> Property
+ Test.Validity.Functions.CanFail: succeedsOnGen :: (Show a, Show (f b), CanFail f) => (a -> f b) -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Functions.CanFail: succeedsOnGens2 :: (Show a, Show b, Show c, Show (f c), CanFail f) => (a -> b -> f c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property
+ Test.Validity.Functions.CanFail: succeedsOnGens2 :: (Show a, Show b, Show (f c), CanFail f) => (a -> b -> f c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property
- Test.Validity.Functions.CanFail: validIfSucceeds :: (Show a, Show b, Show (f b), GenUnchecked a, Validity b, CanFail f) => (a -> f b) -> Property
+ Test.Validity.Functions.CanFail: validIfSucceeds :: (Show a, Show b, GenValid a, Validity b, CanFail f) => (a -> f b) -> Property
- Test.Validity.Functions.CanFail: validIfSucceeds2 :: (Show a, Show b, Show c, Show (f c), GenUnchecked a, GenUnchecked b, Validity c, CanFail f) => (a -> b -> f c) -> Property
+ Test.Validity.Functions.CanFail: validIfSucceeds2 :: (Show a, Show b, Show c, GenValid a, GenValid b, Validity c, CanFail f) => (a -> b -> f c) -> Property
- Test.Validity.Functions.CanFail: validIfSucceeds3 :: (Show a, Show b, Show c, Show d, Show (f d), GenUnchecked a, GenUnchecked b, GenUnchecked c, Validity d, CanFail f) => (a -> b -> c -> f d) -> Property
+ Test.Validity.Functions.CanFail: validIfSucceeds3 :: (Show a, Show b, Show c, Show d, GenValid a, GenValid b, GenValid c, Validity d, CanFail f) => (a -> b -> c -> f d) -> Property
- Test.Validity.Functions.CanFail: validIfSucceedsOnArbitrary :: (Show a, Show b, Show (f b), Arbitrary a, Validity b, CanFail f) => (a -> f b) -> Property
+ Test.Validity.Functions.CanFail: validIfSucceedsOnArbitrary :: (Show a, Show b, Arbitrary a, Validity b, CanFail f) => (a -> f b) -> Property
- Test.Validity.Functions.CanFail: validIfSucceedsOnArbitrary2 :: (Show a, Show b, Show c, Show (f c), Arbitrary a, Arbitrary b, Validity c, CanFail f) => (a -> b -> f c) -> Property
+ Test.Validity.Functions.CanFail: validIfSucceedsOnArbitrary2 :: (Show a, Show b, Show c, Arbitrary a, Arbitrary b, Validity c, CanFail f) => (a -> b -> f c) -> Property
- Test.Validity.Functions.CanFail: validIfSucceedsOnArbitrary3 :: (Show a, Show b, Show c, Show d, Show (f d), Arbitrary a, Arbitrary b, Arbitrary c, Validity d, CanFail f) => (a -> b -> c -> f d) -> Property
+ Test.Validity.Functions.CanFail: validIfSucceedsOnArbitrary3 :: (Show a, Show b, Show c, Show d, Arbitrary a, Arbitrary b, Arbitrary c, Validity d, CanFail f) => (a -> b -> c -> f d) -> Property
- Test.Validity.Functions.CanFail: validIfSucceedsOnGen :: (Show a, Show b, Show (f b), Validity b, CanFail f) => (a -> f b) -> Gen a -> (a -> [a]) -> Property
+ Test.Validity.Functions.CanFail: validIfSucceedsOnGen :: (Show a, Show b, Validity b, CanFail f) => (a -> f b) -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Functions.CanFail: validIfSucceedsOnGens2 :: (Show a, Show b, Show c, Show (f c), Validity c, CanFail f) => (a -> b -> f c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property
+ Test.Validity.Functions.CanFail: validIfSucceedsOnGens2 :: (Show a, Show b, Show c, Validity c, CanFail f) => (a -> b -> f c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property
- Test.Validity.Functions.CanFail: validIfSucceedsOnGens3 :: (Show a, Show b, Show c, Show d, Show (f d), Validity d, CanFail f) => (a -> b -> c -> f d) -> Gen (a, b, c) -> ((a, b, c) -> [(a, b, c)]) -> Property
+ Test.Validity.Functions.CanFail: validIfSucceedsOnGens3 :: (Show a, Show b, Show c, Show d, Validity d, CanFail f) => (a -> b -> c -> f d) -> Gen (a, b, c) -> ((a, b, c) -> [(a, b, c)]) -> Property
- Test.Validity.Functions.Equivalence: equivalent :: (Show a, Eq a, GenUnchecked a, Show b, Eq b) => (a -> b) -> (a -> b) -> Property
+ Test.Validity.Functions.Equivalence: equivalent :: (Show a, GenValid a, Show b, Eq b) => (a -> b) -> (a -> b) -> Property
- Test.Validity.Functions.Equivalence: equivalent2 :: (Show a, GenUnchecked a, Show b, GenUnchecked b, Show c, Eq c) => (a -> b -> c) -> (a -> b -> c) -> Property
+ Test.Validity.Functions.Equivalence: equivalent2 :: (Show a, GenValid a, Show b, GenValid b, Show c, Eq c) => (a -> b -> c) -> (a -> b -> c) -> Property
- Test.Validity.Functions.Equivalence: equivalent3 :: (Show a, GenUnchecked a, Show b, GenUnchecked b, Show c, GenUnchecked c, Show d, Eq d) => (a -> b -> c -> d) -> (a -> b -> c -> d) -> Property
+ Test.Validity.Functions.Equivalence: equivalent3 :: (Show a, GenValid a, Show b, GenValid b, Show c, GenValid c, Show d, Eq d) => (a -> b -> c -> d) -> (a -> b -> c -> d) -> Property
- Test.Validity.Functions.Equivalence: equivalentOnArbitrary :: (Show a, Eq a, Arbitrary a, Show b, Eq b) => (a -> b) -> (a -> b) -> Property
+ Test.Validity.Functions.Equivalence: equivalentOnArbitrary :: (Show a, Arbitrary a, Show b, Eq b) => (a -> b) -> (a -> b) -> Property
- Test.Validity.Functions.Equivalence: equivalentOnGen :: (Show a, Eq a, Show b, Eq b) => (a -> b) -> (a -> b) -> Gen a -> (a -> [a]) -> Property
+ Test.Validity.Functions.Equivalence: equivalentOnGen :: (Show a, Show b, Eq b) => (a -> b) -> (a -> b) -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Functions.Equivalence: equivalentWhenFirstSucceeds :: (Show a, Eq a, GenUnchecked a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> b) -> Property
+ Test.Validity.Functions.Equivalence: equivalentWhenFirstSucceeds :: (Show a, GenValid a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> b) -> Property
- Test.Validity.Functions.Equivalence: equivalentWhenFirstSucceeds2 :: (Show a, Eq a, GenUnchecked a, Show b, Eq b, GenUnchecked b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> c) -> Property
+ Test.Validity.Functions.Equivalence: equivalentWhenFirstSucceeds2 :: (Show a, GenValid a, Show b, GenValid b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> c) -> Property
- Test.Validity.Functions.Equivalence: equivalentWhenFirstSucceedsOnArbitrary :: (Show a, Eq a, Arbitrary a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> b) -> Property
+ Test.Validity.Functions.Equivalence: equivalentWhenFirstSucceedsOnArbitrary :: (Show a, Arbitrary a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> b) -> Property
- Test.Validity.Functions.Equivalence: equivalentWhenFirstSucceedsOnArbitrary2 :: (Show a, Eq a, Arbitrary a, Show b, Eq b, Arbitrary b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> c) -> Property
+ Test.Validity.Functions.Equivalence: equivalentWhenFirstSucceedsOnArbitrary2 :: (Show a, Arbitrary a, Show b, Arbitrary b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> c) -> Property
- Test.Validity.Functions.Equivalence: equivalentWhenFirstSucceedsOnGen :: (Show a, Eq a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> b) -> Gen a -> (a -> [a]) -> Property
+ Test.Validity.Functions.Equivalence: equivalentWhenFirstSucceedsOnGen :: (Show a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> b) -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Functions.Equivalence: 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) -> ((a, b) -> [(a, b)]) -> Property
+ Test.Validity.Functions.Equivalence: equivalentWhenFirstSucceedsOnGens2 :: (Show a, Show b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property
- Test.Validity.Functions.Equivalence: equivalentWhenSecondSucceeds :: (Show a, Eq a, GenUnchecked a, Show b, Eq b, CanFail f) => (a -> b) -> (a -> f b) -> Property
+ Test.Validity.Functions.Equivalence: equivalentWhenSecondSucceeds :: (Show a, GenValid a, Show b, Eq b, CanFail f) => (a -> b) -> (a -> f b) -> Property
- Test.Validity.Functions.Equivalence: equivalentWhenSecondSucceeds2 :: (Show a, Eq a, GenUnchecked a, Show b, Eq b, GenUnchecked b, Show c, Eq c, CanFail f) => (a -> b -> c) -> (a -> b -> f c) -> Property
+ Test.Validity.Functions.Equivalence: equivalentWhenSecondSucceeds2 :: (Show a, GenValid a, Show b, GenValid b, Show c, Eq c, CanFail f) => (a -> b -> c) -> (a -> b -> f c) -> Property
- Test.Validity.Functions.Equivalence: equivalentWhenSecondSucceedsOnArbitrary :: (Show a, Eq a, Arbitrary a, Show b, Eq b, CanFail f) => (a -> b) -> (a -> f b) -> Property
+ Test.Validity.Functions.Equivalence: equivalentWhenSecondSucceedsOnArbitrary :: (Show a, Arbitrary a, Show b, Eq b, CanFail f) => (a -> b) -> (a -> f b) -> Property
- Test.Validity.Functions.Equivalence: equivalentWhenSecondSucceedsOnArbitrary2 :: (Show a, Eq a, Arbitrary a, Show b, Eq b, Arbitrary b, Show c, Eq c, CanFail f) => (a -> b -> c) -> (a -> b -> f c) -> Property
+ Test.Validity.Functions.Equivalence: equivalentWhenSecondSucceedsOnArbitrary2 :: (Show a, Arbitrary a, Show b, Arbitrary b, Show c, Eq c, CanFail f) => (a -> b -> c) -> (a -> b -> f c) -> Property
- Test.Validity.Functions.Equivalence: equivalentWhenSecondSucceedsOnGen :: (Show a, Eq a, Show b, Eq b, CanFail f) => (a -> b) -> (a -> f b) -> Gen a -> (a -> [a]) -> Property
+ Test.Validity.Functions.Equivalence: equivalentWhenSecondSucceedsOnGen :: (Show a, Show b, Eq b, CanFail f) => (a -> b) -> (a -> f b) -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Functions.Equivalence: 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) -> ((a, b) -> [(a, b)]) -> Property
+ Test.Validity.Functions.Equivalence: equivalentWhenSecondSucceedsOnGens2 :: (Show a, Show b, Show c, Eq c, CanFail f) => (a -> b -> c) -> (a -> b -> f c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property
- Test.Validity.Functions.Equivalence: equivalentWhenSucceed :: (Show a, Eq a, GenUnchecked a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> f b) -> Property
+ Test.Validity.Functions.Equivalence: equivalentWhenSucceed :: (Show a, GenValid a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> f b) -> Property
- Test.Validity.Functions.Equivalence: equivalentWhenSucceed2 :: (Show a, Eq a, GenUnchecked a, Show b, Eq b, GenUnchecked b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> f c) -> Property
+ Test.Validity.Functions.Equivalence: equivalentWhenSucceed2 :: (Show a, GenValid a, Show b, GenValid b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> f c) -> Property
- Test.Validity.Functions.Equivalence: equivalentWhenSucceedOnArbitrary :: (Show a, Eq a, Arbitrary a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> f b) -> Property
+ Test.Validity.Functions.Equivalence: equivalentWhenSucceedOnArbitrary :: (Show a, Arbitrary a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> f b) -> Property
- Test.Validity.Functions.Equivalence: equivalentWhenSucceedOnArbitrary2 :: (Show a, Eq a, Arbitrary a, Show b, Eq b, Arbitrary b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> f c) -> Property
+ Test.Validity.Functions.Equivalence: equivalentWhenSucceedOnArbitrary2 :: (Show a, Arbitrary a, Show b, Arbitrary b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> f c) -> Property
- Test.Validity.Functions.Equivalence: equivalentWhenSucceedOnGen :: (Show a, Eq a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> f b) -> Gen a -> (a -> [a]) -> Property
+ Test.Validity.Functions.Equivalence: equivalentWhenSucceedOnGen :: (Show a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> f b) -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Functions.Equivalence: 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) -> ((a, b) -> [(a, b)]) -> Property
+ Test.Validity.Functions.Equivalence: equivalentWhenSucceedOnGens2 :: (Show a, Show b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> f c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property
- Test.Validity.Functions.Idempotence: idempotent :: (Show a, Eq a, GenUnchecked a) => (a -> a) -> Property
+ Test.Validity.Functions.Idempotence: idempotent :: (Show a, Eq a, GenValid a) => (a -> a) -> Property
- Test.Validity.Functions.Inverse: inverseFunctions :: (Show a, Eq a, GenUnchecked a) => (a -> b) -> (b -> a) -> Property
+ Test.Validity.Functions.Inverse: inverseFunctions :: (Show a, Eq a, GenValid a) => (a -> b) -> (b -> a) -> Property
- Test.Validity.Functions.Inverse: inverseFunctionsIfFirstSucceeds :: (Show a, Eq a, GenUnchecked a, CanFail f) => (a -> f b) -> (b -> a) -> Property
+ Test.Validity.Functions.Inverse: inverseFunctionsIfFirstSucceeds :: (Show a, Eq a, GenValid a, CanFail f) => (a -> f b) -> (b -> a) -> Property
- Test.Validity.Functions.Inverse: inverseFunctionsIfSecondSucceeds :: (Show a, Eq a, GenUnchecked a, CanFail f) => (a -> b) -> (b -> f a) -> Property
+ Test.Validity.Functions.Inverse: inverseFunctionsIfSecondSucceeds :: (Show a, Eq a, GenValid a, CanFail f) => (a -> b) -> (b -> f a) -> Property
- Test.Validity.Functions.Inverse: inverseFunctionsIfSucceed :: (Show a, Eq a, GenUnchecked a, CanFail f, CanFail g) => (a -> f b) -> (b -> g a) -> Property
+ Test.Validity.Functions.Inverse: inverseFunctionsIfSucceed :: (Show a, Eq a, GenValid a, CanFail f, CanFail g) => (a -> f b) -> (b -> g a) -> Property
- Test.Validity.Functions.Validity: producesValid :: (Show a, Show b, GenUnchecked a, Validity b) => (a -> b) -> Property
+ Test.Validity.Functions.Validity: producesValid :: (Show a, Show b, GenValid a, Validity b) => (a -> b) -> Property
- Test.Validity.Functions.Validity: producesValid2 :: (Show a, Show b, Show c, GenUnchecked a, GenUnchecked b, Validity c) => (a -> b -> c) -> Property
+ Test.Validity.Functions.Validity: producesValid2 :: (Show a, Show b, Show c, GenValid a, GenValid b, Validity c) => (a -> b -> c) -> Property
- Test.Validity.Functions.Validity: producesValid3 :: (Show a, Show b, Show c, Show d, GenUnchecked a, GenUnchecked b, GenUnchecked c, Validity d) => (a -> b -> c -> d) -> Property
+ Test.Validity.Functions.Validity: producesValid3 :: (Show a, Show b, Show c, Show d, GenValid a, GenValid b, GenValid c, Validity d) => (a -> b -> c -> d) -> Property
- Test.Validity.Operations.Associativity: associative :: (Show a, Eq a, GenUnchecked a) => (a -> a -> a) -> Property
+ Test.Validity.Operations.Associativity: associative :: (Show a, Eq a, GenValid a) => (a -> a -> a) -> Property
- Test.Validity.Operations.Commutativity: commutative :: (Show a, Eq a, GenUnchecked a) => (a -> a -> a) -> Property
+ Test.Validity.Operations.Commutativity: commutative :: (Show a, Show b, Eq b, GenValid a) => (a -> a -> b) -> Property
- Test.Validity.Operations.Commutativity: commutativeOnArbitrary :: (Show a, Eq a, Arbitrary a) => (a -> a -> a) -> Property
+ Test.Validity.Operations.Commutativity: commutativeOnArbitrary :: (Show a, Show b, Eq b, Arbitrary a) => (a -> a -> b) -> Property
- Test.Validity.Operations.Commutativity: commutativeOnGens :: (Show a, Eq a) => (a -> a -> a) -> Gen (a, a) -> ((a, a) -> [(a, a)]) -> Property
+ Test.Validity.Operations.Commutativity: commutativeOnGens :: (Show a, Show b, Eq b) => (a -> a -> b) -> Gen (a, a) -> ((a, a) -> [(a, a)]) -> Property
- Test.Validity.Operations.Identity: identity :: (Show a, Eq a, GenUnchecked a) => (a -> a -> a) -> a -> Property
+ Test.Validity.Operations.Identity: identity :: (Show a, Eq a, GenValid a) => (a -> a -> a) -> a -> Property
- Test.Validity.Operations.Identity: leftIdentity :: (Show a, Eq a, GenUnchecked a) => (b -> a -> a) -> b -> Property
+ Test.Validity.Operations.Identity: leftIdentity :: (Show a, Eq a, GenValid a) => (b -> a -> a) -> b -> Property
- Test.Validity.Operations.Identity: rightIdentity :: (Show a, Eq a, GenUnchecked a) => (a -> b -> a) -> b -> Property
+ Test.Validity.Operations.Identity: rightIdentity :: (Show a, Eq a, GenValid a) => (a -> b -> a) -> b -> Property
- Test.Validity.Property: antireflexivity :: (Show a, GenUnchecked a) => (a -> a -> Bool) -> Property
+ Test.Validity.Property: antireflexivity :: (Show a, GenValid a) => (a -> a -> Bool) -> Property
- Test.Validity.Property: antisymmetry :: (Show a, Eq a, GenUnchecked a) => (a -> a -> Bool) -> Property
+ Test.Validity.Property: antisymmetry :: (Show a, Eq a, GenValid a) => (a -> a -> Bool) -> Property
- Test.Validity.Property: associative :: (Show a, Eq a, GenUnchecked a) => (a -> a -> a) -> Property
+ Test.Validity.Property: associative :: (Show a, Eq a, GenValid a) => (a -> a -> a) -> Property
- Test.Validity.Property: commutative :: (Show a, Eq a, GenUnchecked a) => (a -> a -> a) -> Property
+ Test.Validity.Property: commutative :: (Show a, Show b, Eq b, GenValid a) => (a -> a -> b) -> Property
- Test.Validity.Property: commutativeOnArbitrary :: (Show a, Eq a, Arbitrary a) => (a -> a -> a) -> Property
+ Test.Validity.Property: commutativeOnArbitrary :: (Show a, Show b, Eq b, Arbitrary a) => (a -> a -> b) -> Property
- Test.Validity.Property: commutativeOnGens :: (Show a, Eq a) => (a -> a -> a) -> Gen (a, a) -> ((a, a) -> [(a, a)]) -> Property
+ Test.Validity.Property: commutativeOnGens :: (Show a, Show b, Eq b) => (a -> a -> b) -> Gen (a, a) -> ((a, a) -> [(a, a)]) -> Property
- Test.Validity.Property: equivalent :: (Show a, Eq a, GenUnchecked a, Show b, Eq b) => (a -> b) -> (a -> b) -> Property
+ Test.Validity.Property: equivalent :: (Show a, GenValid a, Show b, Eq b) => (a -> b) -> (a -> b) -> Property
- Test.Validity.Property: equivalent2 :: (Show a, GenUnchecked a, Show b, GenUnchecked b, Show c, Eq c) => (a -> b -> c) -> (a -> b -> c) -> Property
+ Test.Validity.Property: equivalent2 :: (Show a, GenValid a, Show b, GenValid b, Show c, Eq c) => (a -> b -> c) -> (a -> b -> c) -> Property
- Test.Validity.Property: equivalent3 :: (Show a, GenUnchecked a, Show b, GenUnchecked b, Show c, GenUnchecked c, Show d, Eq d) => (a -> b -> c -> d) -> (a -> b -> c -> d) -> Property
+ Test.Validity.Property: equivalent3 :: (Show a, GenValid a, Show b, GenValid b, Show c, GenValid c, Show d, Eq d) => (a -> b -> c -> d) -> (a -> b -> c -> d) -> Property
- Test.Validity.Property: equivalentOnArbitrary :: (Show a, Eq a, Arbitrary a, Show b, Eq b) => (a -> b) -> (a -> b) -> Property
+ Test.Validity.Property: equivalentOnArbitrary :: (Show a, Arbitrary a, Show b, Eq b) => (a -> b) -> (a -> b) -> Property
- Test.Validity.Property: equivalentOnGen :: (Show a, Eq a, Show b, Eq b) => (a -> b) -> (a -> b) -> Gen a -> (a -> [a]) -> Property
+ Test.Validity.Property: equivalentOnGen :: (Show a, Show b, Eq b) => (a -> b) -> (a -> b) -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Property: equivalentWhenFirstSucceeds :: (Show a, Eq a, GenUnchecked a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> b) -> Property
+ Test.Validity.Property: equivalentWhenFirstSucceeds :: (Show a, GenValid a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> b) -> Property
- Test.Validity.Property: equivalentWhenFirstSucceeds2 :: (Show a, Eq a, GenUnchecked a, Show b, Eq b, GenUnchecked b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> c) -> Property
+ Test.Validity.Property: equivalentWhenFirstSucceeds2 :: (Show a, GenValid a, Show b, GenValid b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> c) -> Property
- Test.Validity.Property: equivalentWhenFirstSucceedsOnArbitrary :: (Show a, Eq a, Arbitrary a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> b) -> Property
+ Test.Validity.Property: equivalentWhenFirstSucceedsOnArbitrary :: (Show a, Arbitrary a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> b) -> Property
- Test.Validity.Property: equivalentWhenFirstSucceedsOnArbitrary2 :: (Show a, Eq a, Arbitrary a, Show b, Eq b, Arbitrary b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> c) -> Property
+ Test.Validity.Property: equivalentWhenFirstSucceedsOnArbitrary2 :: (Show a, Arbitrary a, Show b, Arbitrary b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> c) -> Property
- Test.Validity.Property: equivalentWhenFirstSucceedsOnGen :: (Show a, Eq a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> b) -> Gen a -> (a -> [a]) -> Property
+ Test.Validity.Property: equivalentWhenFirstSucceedsOnGen :: (Show a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> b) -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Property: 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) -> ((a, b) -> [(a, b)]) -> Property
+ Test.Validity.Property: equivalentWhenFirstSucceedsOnGens2 :: (Show a, Show b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property
- Test.Validity.Property: equivalentWhenSecondSucceeds :: (Show a, Eq a, GenUnchecked a, Show b, Eq b, CanFail f) => (a -> b) -> (a -> f b) -> Property
+ Test.Validity.Property: equivalentWhenSecondSucceeds :: (Show a, GenValid a, Show b, Eq b, CanFail f) => (a -> b) -> (a -> f b) -> Property
- Test.Validity.Property: equivalentWhenSecondSucceeds2 :: (Show a, Eq a, GenUnchecked a, Show b, Eq b, GenUnchecked b, Show c, Eq c, CanFail f) => (a -> b -> c) -> (a -> b -> f c) -> Property
+ Test.Validity.Property: equivalentWhenSecondSucceeds2 :: (Show a, GenValid a, Show b, GenValid b, Show c, Eq c, CanFail f) => (a -> b -> c) -> (a -> b -> f c) -> Property
- Test.Validity.Property: equivalentWhenSecondSucceedsOnArbitrary :: (Show a, Eq a, Arbitrary a, Show b, Eq b, CanFail f) => (a -> b) -> (a -> f b) -> Property
+ Test.Validity.Property: equivalentWhenSecondSucceedsOnArbitrary :: (Show a, Arbitrary a, Show b, Eq b, CanFail f) => (a -> b) -> (a -> f b) -> Property
- Test.Validity.Property: equivalentWhenSecondSucceedsOnArbitrary2 :: (Show a, Eq a, Arbitrary a, Show b, Eq b, Arbitrary b, Show c, Eq c, CanFail f) => (a -> b -> c) -> (a -> b -> f c) -> Property
+ Test.Validity.Property: equivalentWhenSecondSucceedsOnArbitrary2 :: (Show a, Arbitrary a, Show b, Arbitrary b, Show c, Eq c, CanFail f) => (a -> b -> c) -> (a -> b -> f c) -> Property
- Test.Validity.Property: equivalentWhenSecondSucceedsOnGen :: (Show a, Eq a, Show b, Eq b, CanFail f) => (a -> b) -> (a -> f b) -> Gen a -> (a -> [a]) -> Property
+ Test.Validity.Property: equivalentWhenSecondSucceedsOnGen :: (Show a, Show b, Eq b, CanFail f) => (a -> b) -> (a -> f b) -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Property: 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) -> ((a, b) -> [(a, b)]) -> Property
+ Test.Validity.Property: equivalentWhenSecondSucceedsOnGens2 :: (Show a, Show b, Show c, Eq c, CanFail f) => (a -> b -> c) -> (a -> b -> f c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property
- Test.Validity.Property: equivalentWhenSucceed :: (Show a, Eq a, GenUnchecked a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> f b) -> Property
+ Test.Validity.Property: equivalentWhenSucceed :: (Show a, GenValid a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> f b) -> Property
- Test.Validity.Property: equivalentWhenSucceed2 :: (Show a, Eq a, GenUnchecked a, Show b, Eq b, GenUnchecked b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> f c) -> Property
+ Test.Validity.Property: equivalentWhenSucceed2 :: (Show a, GenValid a, Show b, GenValid b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> f c) -> Property
- Test.Validity.Property: equivalentWhenSucceedOnArbitrary :: (Show a, Eq a, Arbitrary a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> f b) -> Property
+ Test.Validity.Property: equivalentWhenSucceedOnArbitrary :: (Show a, Arbitrary a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> f b) -> Property
- Test.Validity.Property: equivalentWhenSucceedOnArbitrary2 :: (Show a, Eq a, Arbitrary a, Show b, Eq b, Arbitrary b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> f c) -> Property
+ Test.Validity.Property: equivalentWhenSucceedOnArbitrary2 :: (Show a, Arbitrary a, Show b, Arbitrary b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> f c) -> Property
- Test.Validity.Property: equivalentWhenSucceedOnGen :: (Show a, Eq a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> f b) -> Gen a -> (a -> [a]) -> Property
+ Test.Validity.Property: equivalentWhenSucceedOnGen :: (Show a, Show b, Eq b, CanFail f) => (a -> f b) -> (a -> f b) -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Property: 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) -> ((a, b) -> [(a, b)]) -> Property
+ Test.Validity.Property: equivalentWhenSucceedOnGens2 :: (Show a, Show b, Show c, Eq c, CanFail f) => (a -> b -> f c) -> (a -> b -> f c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property
- Test.Validity.Property: failsOnGen :: (Show a, Show b, Show (f b), CanFail f) => (a -> f b) -> Gen a -> (a -> [a]) -> Property
+ Test.Validity.Property: failsOnGen :: (Show a, Show (f b), CanFail f) => (a -> f b) -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Property: failsOnGens2 :: (Show a, Show b, Show c, Show (f c), CanFail f) => (a -> b -> f c) -> Gen a -> (a -> [a]) -> Gen b -> (b -> [b]) -> Property
+ Test.Validity.Property: failsOnGens2 :: (Show a, Show b, Show (f c), CanFail f) => (a -> b -> f c) -> Gen a -> (a -> [a]) -> Gen b -> (b -> [b]) -> Property
- Test.Validity.Property: idempotent :: (Show a, Eq a, GenUnchecked a) => (a -> a) -> Property
+ Test.Validity.Property: idempotent :: (Show a, Eq a, GenValid a) => (a -> a) -> Property
- Test.Validity.Property: identity :: (Show a, Eq a, GenUnchecked a) => (a -> a -> a) -> a -> Property
+ Test.Validity.Property: identity :: (Show a, Eq a, GenValid a) => (a -> a -> a) -> a -> Property
- Test.Validity.Property: inverseFunctions :: (Show a, Eq a, GenUnchecked a) => (a -> b) -> (b -> a) -> Property
+ Test.Validity.Property: inverseFunctions :: (Show a, Eq a, GenValid a) => (a -> b) -> (b -> a) -> Property
- Test.Validity.Property: inverseFunctionsIfFirstSucceeds :: (Show a, Eq a, GenUnchecked a, CanFail f) => (a -> f b) -> (b -> a) -> Property
+ Test.Validity.Property: inverseFunctionsIfFirstSucceeds :: (Show a, Eq a, GenValid a, CanFail f) => (a -> f b) -> (b -> a) -> Property
- Test.Validity.Property: inverseFunctionsIfSecondSucceeds :: (Show a, Eq a, GenUnchecked a, CanFail f) => (a -> b) -> (b -> f a) -> Property
+ Test.Validity.Property: inverseFunctionsIfSecondSucceeds :: (Show a, Eq a, GenValid a, CanFail f) => (a -> b) -> (b -> f a) -> Property
- Test.Validity.Property: inverseFunctionsIfSucceed :: (Show a, Eq a, GenUnchecked a, CanFail f, CanFail g) => (a -> f b) -> (b -> g a) -> Property
+ Test.Validity.Property: inverseFunctionsIfSucceed :: (Show a, Eq a, GenValid a, CanFail f, CanFail g) => (a -> f b) -> (b -> g a) -> Property
- Test.Validity.Property: leftIdentity :: (Show a, Eq a, GenUnchecked a) => (b -> a -> a) -> b -> Property
+ Test.Validity.Property: leftIdentity :: (Show a, Eq a, GenValid a) => (b -> a -> a) -> b -> Property
- Test.Validity.Property: producesValid :: (Show a, Show b, GenUnchecked a, Validity b) => (a -> b) -> Property
+ Test.Validity.Property: producesValid :: (Show a, Show b, GenValid a, Validity b) => (a -> b) -> Property
- Test.Validity.Property: producesValid2 :: (Show a, Show b, Show c, GenUnchecked a, GenUnchecked b, Validity c) => (a -> b -> c) -> Property
+ Test.Validity.Property: producesValid2 :: (Show a, Show b, Show c, GenValid a, GenValid b, Validity c) => (a -> b -> c) -> Property
- Test.Validity.Property: producesValid3 :: (Show a, Show b, Show c, Show d, GenUnchecked a, GenUnchecked b, GenUnchecked c, Validity d) => (a -> b -> c -> d) -> Property
+ Test.Validity.Property: producesValid3 :: (Show a, Show b, Show c, Show d, GenValid a, GenValid b, GenValid c, Validity d) => (a -> b -> c -> d) -> Property
- Test.Validity.Property: reflexivity :: (Show a, GenUnchecked a) => (a -> a -> Bool) -> Property
+ Test.Validity.Property: reflexivity :: (Show a, GenValid a) => (a -> a -> Bool) -> Property
- Test.Validity.Property: rightIdentity :: (Show a, Eq a, GenUnchecked a) => (a -> b -> a) -> b -> Property
+ Test.Validity.Property: rightIdentity :: (Show a, Eq a, GenValid a) => (a -> b -> a) -> b -> Property
- Test.Validity.Property: succeeds :: (Show a, Show b, Show (f b), GenUnchecked a, CanFail f) => (a -> f b) -> Property
+ Test.Validity.Property: succeeds :: (Show a, Show (f b), GenValid a, CanFail f) => (a -> f b) -> Property
- Test.Validity.Property: succeeds2 :: (Show a, Show b, Show c, Show (f c), GenUnchecked a, GenUnchecked b, CanFail f) => (a -> b -> f c) -> Property
+ Test.Validity.Property: succeeds2 :: (Show a, Show b, Show (f c), GenValid a, GenValid b, CanFail f) => (a -> b -> f c) -> Property
- Test.Validity.Property: succeedsOnArbitrary :: (Show a, Show b, Show (f b), Arbitrary a, CanFail f) => (a -> f b) -> Property
+ Test.Validity.Property: succeedsOnArbitrary :: (Show a, Show (f b), Arbitrary a, CanFail f) => (a -> f b) -> Property
- Test.Validity.Property: succeedsOnArbitrary2 :: (Show a, Show b, Show c, Show (f c), Arbitrary a, Arbitrary b, CanFail f) => (a -> b -> f c) -> Property
+ Test.Validity.Property: succeedsOnArbitrary2 :: (Show a, Show b, Show (f c), Arbitrary a, Arbitrary b, CanFail f) => (a -> b -> f c) -> Property
- Test.Validity.Property: succeedsOnGen :: (Show a, Show b, Show (f b), CanFail f) => (a -> f b) -> Gen a -> (a -> [a]) -> Property
+ Test.Validity.Property: succeedsOnGen :: (Show a, Show (f b), CanFail f) => (a -> f b) -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Property: succeedsOnGens2 :: (Show a, Show b, Show c, Show (f c), CanFail f) => (a -> b -> f c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property
+ Test.Validity.Property: succeedsOnGens2 :: (Show a, Show b, Show (f c), CanFail f) => (a -> b -> f c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property
- Test.Validity.Property: symmetry :: (Show a, GenUnchecked a) => (a -> a -> Bool) -> Property
+ Test.Validity.Property: symmetry :: (Show a, GenValid a) => (a -> a -> Bool) -> Property
- Test.Validity.Property: transitivity :: (Show a, GenUnchecked a) => (a -> a -> Bool) -> Property
+ Test.Validity.Property: transitivity :: (Show a, GenValid a) => (a -> a -> Bool) -> Property
- Test.Validity.Property: validIfSucceeds :: (Show a, Show b, Show (f b), GenUnchecked a, Validity b, CanFail f) => (a -> f b) -> Property
+ Test.Validity.Property: validIfSucceeds :: (Show a, Show b, GenValid a, Validity b, CanFail f) => (a -> f b) -> Property
- Test.Validity.Property: validIfSucceeds2 :: (Show a, Show b, Show c, Show (f c), GenUnchecked a, GenUnchecked b, Validity c, CanFail f) => (a -> b -> f c) -> Property
+ Test.Validity.Property: validIfSucceeds2 :: (Show a, Show b, Show c, GenValid a, GenValid b, Validity c, CanFail f) => (a -> b -> f c) -> Property
- Test.Validity.Property: validIfSucceeds3 :: (Show a, Show b, Show c, Show d, Show (f d), GenUnchecked a, GenUnchecked b, GenUnchecked c, Validity d, CanFail f) => (a -> b -> c -> f d) -> Property
+ Test.Validity.Property: validIfSucceeds3 :: (Show a, Show b, Show c, Show d, GenValid a, GenValid b, GenValid c, Validity d, CanFail f) => (a -> b -> c -> f d) -> Property
- Test.Validity.Property: validIfSucceedsOnArbitrary :: (Show a, Show b, Show (f b), Arbitrary a, Validity b, CanFail f) => (a -> f b) -> Property
+ Test.Validity.Property: validIfSucceedsOnArbitrary :: (Show a, Show b, Arbitrary a, Validity b, CanFail f) => (a -> f b) -> Property
- Test.Validity.Property: validIfSucceedsOnArbitrary2 :: (Show a, Show b, Show c, Show (f c), Arbitrary a, Arbitrary b, Validity c, CanFail f) => (a -> b -> f c) -> Property
+ Test.Validity.Property: validIfSucceedsOnArbitrary2 :: (Show a, Show b, Show c, Arbitrary a, Arbitrary b, Validity c, CanFail f) => (a -> b -> f c) -> Property
- Test.Validity.Property: validIfSucceedsOnArbitrary3 :: (Show a, Show b, Show c, Show d, Show (f d), Arbitrary a, Arbitrary b, Arbitrary c, Validity d, CanFail f) => (a -> b -> c -> f d) -> Property
+ Test.Validity.Property: validIfSucceedsOnArbitrary3 :: (Show a, Show b, Show c, Show d, Arbitrary a, Arbitrary b, Arbitrary c, Validity d, CanFail f) => (a -> b -> c -> f d) -> Property
- Test.Validity.Property: validIfSucceedsOnGen :: (Show a, Show b, Show (f b), Validity b, CanFail f) => (a -> f b) -> Gen a -> (a -> [a]) -> Property
+ Test.Validity.Property: validIfSucceedsOnGen :: (Show a, Show b, Validity b, CanFail f) => (a -> f b) -> Gen a -> (a -> [a]) -> Property
- Test.Validity.Property: validIfSucceedsOnGens2 :: (Show a, Show b, Show c, Show (f c), Validity c, CanFail f) => (a -> b -> f c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property
+ Test.Validity.Property: validIfSucceedsOnGens2 :: (Show a, Show b, Show c, Validity c, CanFail f) => (a -> b -> f c) -> Gen (a, b) -> ((a, b) -> [(a, b)]) -> Property
- Test.Validity.Property: validIfSucceedsOnGens3 :: (Show a, Show b, Show c, Show d, Show (f d), Validity d, CanFail f) => (a -> b -> c -> f d) -> Gen (a, b, c) -> ((a, b, c) -> [(a, b, c)]) -> Property
+ Test.Validity.Property: validIfSucceedsOnGens3 :: (Show a, Show b, Show c, Show d, Validity d, CanFail f) => (a -> b -> c -> f d) -> Gen (a, b, c) -> ((a, b, c) -> [(a, b, c)]) -> Property
- Test.Validity.Relations.Antireflexivity: antireflexivity :: (Show a, GenUnchecked a) => (a -> a -> Bool) -> Property
+ Test.Validity.Relations.Antireflexivity: antireflexivity :: (Show a, GenValid a) => (a -> a -> Bool) -> Property
- Test.Validity.Relations.Antisymmetry: antisymmetry :: (Show a, Eq a, GenUnchecked a) => (a -> a -> Bool) -> Property
+ Test.Validity.Relations.Antisymmetry: antisymmetry :: (Show a, Eq a, GenValid a) => (a -> a -> Bool) -> Property
- Test.Validity.Relations.Reflexivity: reflexivity :: (Show a, GenUnchecked a) => (a -> a -> Bool) -> Property
+ Test.Validity.Relations.Reflexivity: reflexivity :: (Show a, GenValid a) => (a -> a -> Bool) -> Property
- Test.Validity.Relations.Symmetry: symmetry :: (Show a, GenUnchecked a) => (a -> a -> Bool) -> Property
+ Test.Validity.Relations.Symmetry: symmetry :: (Show a, GenValid a) => (a -> a -> Bool) -> Property
- Test.Validity.Relations.Transitivity: transitivity :: (Show a, GenUnchecked a) => (a -> a -> Bool) -> Property
+ Test.Validity.Relations.Transitivity: transitivity :: (Show a, GenValid a) => (a -> a -> Bool) -> Property
- Test.Validity.Shrinking.Property: shrinkDoesNotShrinkToItself :: forall a. (Show a, Eq a, GenUnchecked a) => (a -> [a]) -> Property
+ Test.Validity.Shrinking.Property: shrinkDoesNotShrinkToItself :: forall a. (Show a, Eq a, GenValid a) => (a -> [a]) -> Property
- Test.Validity.Shrinking.Property: shrinkDoesNotShrinkToItselfWithLimit :: forall a. (Show a, Eq a, GenUnchecked a) => (a -> [a]) -> Int -> Property
+ Test.Validity.Shrinking.Property: shrinkDoesNotShrinkToItselfWithLimit :: forall a. (Show a, Eq a, GenValid a) => (a -> [a]) -> Int -> Property
Files
- CHANGELOG.md +17/−1
- LICENSE +1/−1
- Setup.hs +0/−3
- doctest/DocTest.hs +0/−26
- genvalidity-property.cabal +16/−17
- src/Test/Validity/Functions.hs +7/−93
- src/Test/Validity/Functions/CanFail.hs +98/−240
- src/Test/Validity/Functions/Equivalence.hs +260/−384
- src/Test/Validity/Functions/Idempotence.hs +7/−11
- src/Test/Validity/Functions/Inverse.hs +81/−113
- src/Test/Validity/Functions/Validity.hs +62/−91
- src/Test/Validity/GenValidity/Property.hs +13/−12
- src/Test/Validity/Operations.hs +5/−25
- src/Test/Validity/Operations/Associativity.hs +15/−19
- src/Test/Validity/Operations/Commutativity.hs +21/−22
- src/Test/Validity/Operations/Identity.hs +82/−88
- src/Test/Validity/Property.hs +180/−184
- src/Test/Validity/Property/Utils.hs +31/−47
- src/Test/Validity/Relations.hs +7/−27
- src/Test/Validity/Relations/Antireflexivity.hs +15/−22
- src/Test/Validity/Relations/Antisymmetry.hs +31/−43
- src/Test/Validity/Relations/Reflexivity.hs +14/−24
- src/Test/Validity/Relations/Symmetry.hs +16/−23
- src/Test/Validity/Relations/Transitivity.hs +17/−30
- src/Test/Validity/Shrinking/Property.hs +87/−127
- src/Test/Validity/Types.hs +13/−12
- test/Spec.hs +1/−0
- test/Test/Validity/Operations/CommutativitySpec.hs +32/−0
CHANGELOG.md view
@@ -1,6 +1,22 @@ # Changelog -## [Unreleased]+## [1.0.0.0] - 2021-11-20++### Changed++* Compatibility with `genvalidity >= 1.0.0.0`+* Renamed every combinator that ends in `OnValid` (or similar) to not have that suffix anymore.++### Removed++* Every combinator that relates to unchecked or invalid values.++## [0.5.0.2] - 2020-02-10++### Changed++* Removed the doctests+* Improved the cabal file ## [0.5.0.1] - 2019-09-23
LICENSE view
@@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2016 Tom Sydney Kerckhove+Copyright (c) 2016-2021 Tom Sydney Kerckhove Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal
− Setup.hs
@@ -1,3 +0,0 @@-import Distribution.Simple--main = defaultMain
− doctest/DocTest.hs
@@ -1,26 +0,0 @@-{-# LANGUAGE CPP #-}-#if !MIN_VERSION_base(4,8,0)-import Data.Functor ((<$>))-#endif-import Test.DocTest--import Control.Monad--import System.Directory-import System.FilePath--main :: IO ()-main = do- fs <- listFilesRecur "src"- doctest $ "-isrc" : fs--listFilesRecur :: FilePath -> IO [FilePath]-listFilesRecur dir = do- entries <-- map (dir </>) .- filter (\f -> f /= "." && f /= ".." && takeExtension f /= ".swp") <$>- getDirectoryContents dir- dirs <- filterM doesDirectoryExist entries- files <- filterM doesFileExist entries- rests <- mapM listFilesRecur dirs- return $ concat $ files : rests
genvalidity-property.cabal view
@@ -1,26 +1,23 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.31.2.+-- This file has been generated from package.yaml by hpack version 0.34.4. -- -- see: https://github.com/sol/hpack------ hash: bf0625ee1fc51adb6e38bc0c3453b65fa0ced4b23d8c963772816ed4ae91bd06 name: genvalidity-property-version: 0.5.0.1+version: 1.0.0.0 synopsis: Standard properties for functions on `Validity` types-description: Standard properties for functions on `Validity` types category: Testing homepage: https://github.com/NorfairKing/validity#readme bug-reports: https://github.com/NorfairKing/validity/issues author: Tom Sydney Kerckhove-maintainer: syd.kerckhove@gmail.com,- nick.van.den.broeck666@gmail.com-copyright: Copyright: (c) 2016-2018 Tom Sydney Kerckhove+maintainer: syd@cs-syd.eu+copyright: Copyright: (c) 2016-2021 Tom Sydney Kerckhove license: MIT license-file: LICENSE build-type: Simple extra-source-files:+ LICENSE CHANGELOG.md source-repository head@@ -54,27 +51,29 @@ Paths_genvalidity_property hs-source-dirs: src+ ghc-options: -Wall -fwarn-redundant-constraints build-depends: QuickCheck , base >=4.7 && <5- , genvalidity >=0.7+ , genvalidity >=1.0 , hspec >=2.1 , pretty-show , validity >=0.9 default-language: Haskell2010 -test-suite genvalidity-property-doctests+test-suite genvalidity-property-test type: exitcode-stdio-1.0- main-is: DocTest.hs+ main-is: Spec.hs other-modules:+ Test.Validity.Operations.CommutativitySpec Paths_genvalidity_property hs-source-dirs:- doctest- ghc-options: -threaded+ test+ ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall build-depends:- base- , directory >=1.2- , doctest- , filepath >=1.3+ QuickCheck+ , base >=4.7 && <5+ , genvalidity , genvalidity-property+ , hspec default-language: Haskell2010
src/Test/Validity/Functions.hs view
@@ -3,99 +3,13 @@ -- | Validity tests involving functions module Test.Validity.Functions- ( producesValidsOnGen- , producesValidsOnValids- , producesValid- , producesValidsOnArbitrary- , producesValidsOnGens2- , producesValidsOnValids2- , producesValid2- , producesValidsOnArbitrary2- , producesValidsOnGens3- , producesValidsOnValids3- , producesValid3- , producesValidsOnArbitrary3- , succeedsOnGen- , succeedsOnValid- , succeeds- , succeedsOnArbitrary- , succeedsOnGens2- , succeedsOnValids2- , succeeds2- , succeedsOnArbitrary2- , failsOnGen- , failsOnInvalid- , failsOnGens2- , failsOnInvalid2- , validIfSucceedsOnGen- , validIfSucceedsOnValid- , validIfSucceedsOnArbitrary- , validIfSucceeds- , validIfSucceedsOnGens2- , validIfSucceedsOnValids2- , validIfSucceeds2- , validIfSucceedsOnArbitrary2- , validIfSucceedsOnGens3- , validIfSucceedsOnValids3- , validIfSucceeds3- , validIfSucceedsOnArbitrary3- , equivalentOnGen- , equivalentOnValid- , equivalent- , equivalentOnArbitrary- , equivalentOnGens2- , equivalentOnValids2- , equivalent2- , equivalentOnArbitrary2- , equivalentWhenFirstSucceedsOnGen- , equivalentWhenFirstSucceedsOnValid- , equivalentWhenFirstSucceeds- , equivalentWhenFirstSucceedsOnArbitrary- , equivalentWhenFirstSucceedsOnGens2- , equivalentWhenFirstSucceedsOnValids2- , equivalentWhenFirstSucceeds2- , equivalentWhenFirstSucceedsOnArbitrary2- , equivalentWhenSecondSucceedsOnGen- , equivalentWhenSecondSucceedsOnValid- , equivalentWhenSecondSucceeds- , equivalentWhenSecondSucceedsOnArbitrary- , equivalentWhenSecondSucceedsOnGens2- , equivalentWhenSecondSucceedsOnValids2- , equivalentWhenSecondSucceeds2- , equivalentWhenSecondSucceedsOnArbitrary2- , equivalentWhenSucceedOnGen- , equivalentWhenSucceedOnValid- , equivalentWhenSucceed- , equivalentWhenSucceedOnArbitrary- , equivalentWhenSucceedOnGens2- , equivalentWhenSucceedOnValids2- , equivalentWhenSucceed2- , equivalentWhenSucceedOnArbitrary2- , equivalentOnGens3- , equivalentOnValids3- , equivalent3- , equivalentOnArbitrary3- , inverseFunctionsOnGen- , inverseFunctionsOnValid- , inverseFunctions- , inverseFunctionsOnArbitrary- , inverseFunctionsIfFirstSucceedsOnGen- , inverseFunctionsIfFirstSucceedsOnValid- , inverseFunctionsIfFirstSucceeds- , inverseFunctionsIfFirstSucceedsOnArbitrary- , inverseFunctionsIfSecondSucceedsOnGen- , inverseFunctionsIfSecondSucceedsOnValid- , inverseFunctionsIfSecondSucceeds- , inverseFunctionsIfSecondSucceedsOnArbitrary- , inverseFunctionsIfSucceedOnGen- , inverseFunctionsIfSucceedOnValid- , inverseFunctionsIfSucceed- , inverseFunctionsIfSucceedOnArbitrary- , idempotentOnGen- , idempotentOnValid- , idempotent- , idempotentOnArbitrary- ) where+ ( module Test.Validity.Functions.CanFail,+ module Test.Validity.Functions.Equivalence,+ module Test.Validity.Functions.Idempotence,+ module Test.Validity.Functions.Inverse,+ module Test.Validity.Functions.Validity,+ )+where import Test.Validity.Functions.CanFail import Test.Validity.Functions.Equivalence
src/Test/Validity/Functions/CanFail.hs view
@@ -2,299 +2,157 @@ {-# LANGUAGE ScopedTypeVariables #-} module Test.Validity.Functions.CanFail- ( succeedsOnGen- , succeedsOnValid- , succeeds- , succeedsOnArbitrary- , succeedsOnGens2- , succeedsOnValids2- , succeeds2- , succeedsOnArbitrary2- , failsOnGen- , failsOnInvalid- , failsOnGens2- , failsOnInvalid2- , validIfSucceedsOnGen- , validIfSucceedsOnValid- , validIfSucceedsOnArbitrary- , validIfSucceeds- , validIfSucceedsOnGens2- , validIfSucceedsOnValids2- , validIfSucceeds2- , validIfSucceedsOnArbitrary2- , validIfSucceedsOnGens3- , validIfSucceedsOnValids3- , validIfSucceeds3- , validIfSucceedsOnArbitrary3- ) where+ ( succeedsOnGen,+ succeeds,+ succeedsOnArbitrary,+ succeedsOnGens2,+ succeeds2,+ succeedsOnArbitrary2,+ failsOnGen,+ failsOnGens2,+ validIfSucceedsOnGen,+ validIfSucceedsOnArbitrary,+ validIfSucceeds,+ validIfSucceedsOnGens2,+ validIfSucceeds2,+ validIfSucceedsOnArbitrary2,+ validIfSucceedsOnGens3,+ validIfSucceeds3,+ validIfSucceedsOnArbitrary3,+ )+where import Data.GenValidity- import Test.Hspec import Test.QuickCheck--import Test.Validity.Types import Test.Validity.Property.Utils+import Test.Validity.Types -- | The function succeeds if the input is generated by the given generator succeedsOnGen ::- (Show a, Show b, Show (f b), CanFail f)- => (a -> f b)- -> Gen a- -> (a -> [a])- -> Property-succeedsOnGen func gen s =- forAllShrink gen s $ \a -> func a `shouldSatisfy` (not . hasFailed)+ (Show a, Show (f b), CanFail f) => (a -> f b) -> Gen a -> (a -> [a]) -> Property+succeedsOnGen func gen s = forAllShrink gen s $ \a -> func a `shouldSatisfy` (not . hasFailed) -- | The function succeeds if the input is generated by @genValid@-succeedsOnValid ::- (Show a, Show b, Show (f b), GenValid a, CanFail f)- => (a -> f b)- -> Property-succeedsOnValid f = succeedsOnGen f genValid shrinkValid---- | The function succeeds if the input is generated by @genUnchecked@-succeeds ::- (Show a, Show b, Show (f b), GenUnchecked a, CanFail f)- => (a -> f b)- -> Property-succeeds f = succeedsOnGen f genUnchecked shrinkUnchecked+succeeds :: (Show a, Show (f b), GenValid a, CanFail f) => (a -> f b) -> Property+succeeds f = succeedsOnGen f genValid shrinkValid -- | The function succeeds if the input is generated by @arbitrary@ succeedsOnArbitrary ::- (Show a, Show b, Show (f b), Arbitrary a, CanFail f)- => (a -> f b)- -> Property+ (Show a, Show (f b), Arbitrary a, CanFail f) => (a -> f b) -> Property succeedsOnArbitrary f = succeedsOnGen f arbitrary shrink -- | The function fails if the input is generated by the given generator failsOnGen ::- (Show a, Show b, Show (f b), CanFail f)- => (a -> f b)- -> Gen a- -> (a -> [a])- -> Property-failsOnGen func gen s =- forAllShrink gen s $ \a -> func a `shouldSatisfy` hasFailed---- | The function fails if the input is generated by @genInvalid@-failsOnInvalid ::- (Show a, Show b, Show (f b), GenInvalid a, CanFail f)- => (a -> f b)- -> Property-failsOnInvalid f = failsOnGen f genInvalid shrinkInvalid+ (Show a, Show (f b), CanFail f) => (a -> f b) -> Gen a -> (a -> [a]) -> Property+failsOnGen func gen s = forAllShrink gen s $ \a -> func a `shouldSatisfy` hasFailed -- | The function produces output that satisfies @isValid@ if it is given input -- that is generated by the given generator. validIfSucceedsOnGen ::- (Show a, Show b, Show (f b), Validity b, CanFail f)- => (a -> f b)- -> Gen a- -> (a -> [a])- -> Property+ (Show a, Show b, Validity b, CanFail f) => (a -> f b) -> Gen a -> (a -> [a]) -> Property validIfSucceedsOnGen func gen s =- forAllShrink gen s $ \a ->- case resultIfSucceeded (func a) of- Nothing -> return () -- Can happen- Just res -> shouldBeValid res---- | The function produces output that satisfies @isValid@ if it is given input--- that is generated by @arbitrary@.-validIfSucceedsOnValid ::- (Show a, Show b, Show (f b), GenValid a, Validity b, CanFail f)- => (a -> f b)- -> Property-validIfSucceedsOnValid f = validIfSucceedsOnGen f genValid shrinkValid+ forAllShrink gen s $ \a ->+ case resultIfSucceeded (func a) of+ Nothing -> return () -- Can happen+ Just res -> shouldBeValid res -- | 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+ (Show a, Show b, Arbitrary a, Validity b, CanFail f) => (a -> f b) -> Property validIfSucceedsOnArbitrary f = validIfSucceedsOnGen f arbitrary shrink -- | The function produces output that satisfies @isValid@ if it is given input--- that is generated by @genUnchecked@.-validIfSucceeds ::- (Show a, Show b, Show (f b), GenUnchecked a, Validity b, CanFail f)- => (a -> f b)- -> Property-validIfSucceeds f = validIfSucceedsOnGen f genUnchecked shrinkUnchecked+-- that is generated by @genValid@.+validIfSucceeds :: (Show a, Show b, GenValid a, Validity b, CanFail f) => (a -> f b) -> Property+validIfSucceeds f = validIfSucceedsOnGen f genValid shrinkValid succeedsOnGens2 ::- (Show a, Show b, Show c, Show (f c), CanFail f)- => (a -> b -> f c)- -> Gen (a, b)- -> ((a, b) -> [(a, b)])- -> Property+ (Show a, Show b, Show (f c), CanFail f) =>+ (a -> b -> f c) ->+ Gen (a, b) ->+ ((a, b) -> [(a, b)]) ->+ Property succeedsOnGens2 func gen s =- forAllShrink gen s $ \(a, b) -> func a b `shouldSatisfy` (not . hasFailed)--succeedsOnValids2 ::- (Show a, Show b, Show c, Show (f c), GenValid a, GenValid b, CanFail f)- => (a -> b -> f c)- -> Property-succeedsOnValids2 func = succeedsOnGens2 func genValid shrinkValid+ forAllShrink gen s $ \(a, b) -> func a b `shouldSatisfy` (not . hasFailed) succeeds2 ::- ( Show a- , Show b- , Show c- , Show (f c)- , GenUnchecked a- , GenUnchecked b- , CanFail f- )- => (a -> b -> f c)- -> Property-succeeds2 func = succeedsOnGens2 func genUnchecked shrinkUnchecked+ (Show a, Show b, Show (f c), GenValid a, GenValid b, CanFail f) =>+ (a -> b -> f c) ->+ Property+succeeds2 func = succeedsOnGens2 func genValid shrinkValid succeedsOnArbitrary2 ::- (Show a, Show b, Show c, Show (f c), Arbitrary a, Arbitrary b, CanFail f)- => (a -> b -> f c)- -> Property+ (Show a, Show b, Show (f c), Arbitrary a, Arbitrary b, CanFail f) =>+ (a -> b -> f c) ->+ Property succeedsOnArbitrary2 func = succeedsOnGens2 func arbitrary shrink failsOnGens2 ::- (Show a, Show b, Show c, Show (f c), CanFail f)- => (a -> b -> f c)- -> Gen a- -> (a -> [a])- -> Gen b- -> (b -> [b])- -> Property+ (Show a, Show b, Show (f c), CanFail f) =>+ (a -> b -> f c) ->+ Gen a ->+ (a -> [a]) ->+ Gen b ->+ (b -> [b]) ->+ Property failsOnGens2 func genA sA genB sB =- forAllShrink genA sA $ \a ->- forAllShrink genB sB $ \b -> func a b `shouldSatisfy` hasFailed--failsOnInvalid2 ::- ( Show a- , Show b- , Show c- , Show (f c)- , GenUnchecked a- , GenUnchecked b- , GenInvalid a- , GenInvalid b- , CanFail f- )- => (a -> b -> f c)- -> Property-failsOnInvalid2 func =- failsOnGens2 func genInvalid shrinkInvalid genUnchecked shrinkUnchecked .&&.- failsOnGens2 func genUnchecked shrinkUnchecked genInvalid shrinkInvalid+ forAllShrink genA sA $ \a -> forAllShrink genB sB $ \b -> func a b `shouldSatisfy` hasFailed validIfSucceedsOnGens2 ::- (Show a, Show b, Show c, Show (f c), Validity c, CanFail f)- => (a -> b -> f c)- -> Gen (a, b)- -> ((a, b) -> [(a, b)])- -> Property+ (Show a, Show b, Show c, Validity c, CanFail f) =>+ (a -> b -> f c) ->+ Gen (a, b) ->+ ((a, b) -> [(a, b)]) ->+ Property validIfSucceedsOnGens2 func gen s =- forAllShrink gen s $ \(a, b) ->- case resultIfSucceeded (func a b) of- Nothing -> return () -- Can happen- Just res -> shouldBeValid res--validIfSucceedsOnValids2 ::- ( Show a- , Show b- , Show c- , Show (f c)- , GenValid a- , GenValid b- , Validity c- , CanFail f- )- => (a -> b -> f c)- -> Property-validIfSucceedsOnValids2 func = validIfSucceedsOnGens2 func genValid shrinkValid+ forAllShrink gen s $ \(a, b) ->+ case resultIfSucceeded (func a b) of+ Nothing -> return () -- Can happen+ Just res -> shouldBeValid res validIfSucceeds2 ::- ( Show a- , Show b- , Show c- , Show (f c)- , GenUnchecked a- , GenUnchecked b- , Validity c- , CanFail f- )- => (a -> b -> f c)- -> Property-validIfSucceeds2 func = validIfSucceedsOnGens2 func genUnchecked shrinkUnchecked+ (Show a, Show b, Show c, GenValid a, GenValid b, Validity c, CanFail f) =>+ (a -> b -> f c) ->+ Property+validIfSucceeds2 func = validIfSucceedsOnGens2 func genValid shrinkValid validIfSucceedsOnArbitrary2 ::- ( Show a- , Show b- , Show c- , Show (f c)- , Arbitrary a- , Arbitrary b- , Validity c- , CanFail f- )- => (a -> b -> f c)- -> Property+ (Show a, Show b, Show c, Arbitrary a, Arbitrary b, Validity c, CanFail f) =>+ (a -> b -> f c) ->+ Property validIfSucceedsOnArbitrary2 func = validIfSucceedsOnGens2 func arbitrary shrink validIfSucceedsOnGens3 ::- (Show a, Show b, Show c, Show d, Show (f d), Validity d, CanFail f)- => (a -> b -> c -> f d)- -> Gen (a, b, c)- -> ((a, b, c) -> [(a, b, c)])- -> Property+ (Show a, Show b, Show c, Show d, Validity d, CanFail f) =>+ (a -> b -> c -> f d) ->+ Gen (a, b, c) ->+ ((a, b, c) -> [(a, b, c)]) ->+ Property validIfSucceedsOnGens3 func gen s =- forAllShrink gen s $ \(a, b, c) ->- case resultIfSucceeded (func a b c) of- Nothing -> return () -- Can happen- Just res -> shouldBeValid res--validIfSucceedsOnValids3 ::- ( Show a- , Show b- , Show c- , Show d- , Show (f d)- , GenValid a- , GenValid b- , GenValid c- , Validity d- , CanFail f- )- => (a -> b -> c -> f d)- -> Property-validIfSucceedsOnValids3 func = validIfSucceedsOnGens3 func genValid shrinkValid+ forAllShrink gen s $ \(a, b, c) ->+ case resultIfSucceeded (func a b c) of+ Nothing -> return () -- Can happen+ Just res -> shouldBeValid res validIfSucceeds3 ::- ( Show a- , Show b- , Show c- , Show d- , Show (f d)- , GenUnchecked a- , GenUnchecked b- , GenUnchecked c- , Validity d- , CanFail f- )- => (a -> b -> c -> f d)- -> Property-validIfSucceeds3 func = validIfSucceedsOnGens3 func genUnchecked shrinkUnchecked+ ( Show a,+ Show b,+ Show c,+ Show d,+ GenValid a,+ GenValid b,+ GenValid c,+ Validity d,+ CanFail f+ ) =>+ (a -> b -> c -> f d) ->+ Property+validIfSucceeds3 func = validIfSucceedsOnGens3 func genValid shrinkValid validIfSucceedsOnArbitrary3 ::- ( Show a- , Show b- , Show c- , Show d- , Show (f d)- , Arbitrary a- , Arbitrary b- , Arbitrary c- , Validity d- , CanFail f- )- => (a -> b -> c -> f d)- -> Property+ (Show a, Show b, Show c, Show d, Arbitrary a, Arbitrary b, Arbitrary c, Validity d, CanFail f) =>+ (a -> b -> c -> f d) ->+ Property validIfSucceedsOnArbitrary3 func = validIfSucceedsOnGens3 func arbitrary shrink
src/Test/Validity/Functions/Equivalence.hs view
@@ -2,476 +2,352 @@ {-# LANGUAGE ScopedTypeVariables #-} module Test.Validity.Functions.Equivalence- ( equivalentOnGen- , equivalentOnValid- , equivalent- , equivalentOnArbitrary- , equivalentOnGens2- , equivalentOnValids2- , equivalent2- , equivalentOnArbitrary2- , equivalentWhenFirstSucceedsOnGen- , equivalentWhenFirstSucceedsOnValid- , equivalentWhenFirstSucceeds- , equivalentWhenFirstSucceedsOnArbitrary- , equivalentWhenFirstSucceedsOnGens2- , equivalentWhenFirstSucceedsOnValids2- , equivalentWhenFirstSucceeds2- , equivalentWhenFirstSucceedsOnArbitrary2- , equivalentWhenSecondSucceedsOnGen- , equivalentWhenSecondSucceedsOnValid- , equivalentWhenSecondSucceeds- , equivalentWhenSecondSucceedsOnArbitrary- , equivalentWhenSecondSucceedsOnGens2- , equivalentWhenSecondSucceedsOnValids2- , equivalentWhenSecondSucceeds2- , equivalentWhenSecondSucceedsOnArbitrary2- , equivalentWhenSucceedOnGen- , equivalentWhenSucceedOnValid- , equivalentWhenSucceed- , equivalentWhenSucceedOnArbitrary- , equivalentWhenSucceedOnGens2- , equivalentWhenSucceedOnValids2- , equivalentWhenSucceed2- , equivalentWhenSucceedOnArbitrary2- , equivalentOnGens3- , equivalentOnValids3- , equivalent3- , equivalentOnArbitrary3- ) where+ ( equivalentOnGen,+ equivalent,+ equivalentOnArbitrary,+ equivalentOnGens2,+ equivalent2,+ equivalentOnArbitrary2,+ equivalentWhenFirstSucceedsOnGen,+ equivalentWhenFirstSucceeds,+ equivalentWhenFirstSucceedsOnArbitrary,+ equivalentWhenFirstSucceedsOnGens2,+ equivalentWhenFirstSucceeds2,+ equivalentWhenFirstSucceedsOnArbitrary2,+ equivalentWhenSecondSucceedsOnGen,+ equivalentWhenSecondSucceeds,+ equivalentWhenSecondSucceedsOnArbitrary,+ equivalentWhenSecondSucceedsOnGens2,+ equivalentWhenSecondSucceeds2,+ equivalentWhenSecondSucceedsOnArbitrary2,+ equivalentWhenSucceedOnGen,+ equivalentWhenSucceed,+ equivalentWhenSucceedOnArbitrary,+ equivalentWhenSucceedOnGens2,+ equivalentWhenSucceed2,+ equivalentWhenSucceedOnArbitrary2,+ equivalentOnGens3,+ equivalent3,+ equivalentOnArbitrary3,+ )+where import Data.GenValidity- import Test.Hspec import Test.QuickCheck- import Test.Validity.Types equivalentOnGen ::- (Show a, Eq a, Show b, Eq b)- => (a -> b)- -> (a -> b)- -> Gen a- -> (a -> [a])- -> Property+ (Show a, Show b, Eq b) =>+ (a -> b) ->+ (a -> b) ->+ Gen a ->+ (a -> [a]) ->+ Property equivalentOnGen f g gen s = forAllShrink gen s $ \a -> f a `shouldBe` g a -equivalentOnValid ::- (Show a, Eq a, GenValid a, Show b, Eq b)- => (a -> b)- -> (a -> b)- -> Property-equivalentOnValid f g = equivalentOnGen f g genValid shrinkValid- equivalent ::- (Show a, Eq a, GenUnchecked a, Show b, Eq b)- => (a -> b)- -> (a -> b)- -> Property-equivalent f g = equivalentOnGen f g genUnchecked shrinkUnchecked+ (Show a, GenValid a, Show b, Eq b) =>+ (a -> b) ->+ (a -> b) ->+ Property+equivalent f g = equivalentOnGen f g genValid shrinkValid -- | -- -- prop> equivalentOnArbitrary ((* 2) . (+ 1)) ((+ 2) . (* 2) :: Int -> Int) equivalentOnArbitrary ::- (Show a, Eq a, Arbitrary a, Show b, Eq b)- => (a -> b)- -> (a -> b)- -> Property+ (Show a, Arbitrary a, Show b, Eq b) =>+ (a -> b) ->+ (a -> b) ->+ Property equivalentOnArbitrary f g = equivalentOnGen f g arbitrary shrink equivalentOnGens2 ::- (Show a, Show b, Show c, Eq c)- => (a -> b -> c)- -> (a -> b -> c)- -> Gen (a, b)- -> ((a, b) -> [(a, b)])- -> Property+ (Show a, Show b, Show c, Eq c) =>+ (a -> b -> c) ->+ (a -> b -> c) ->+ Gen (a, b) ->+ ((a, b) -> [(a, b)]) ->+ Property equivalentOnGens2 f g gen s =- forAllShrink gen s $ \(a, b) -> f a b `shouldBe` g a b--equivalentOnValids2 ::- (Show a, GenValid a, Show b, GenValid b, Show c, Eq c)- => (a -> b -> c)- -> (a -> b -> c)- -> Property-equivalentOnValids2 f g = equivalentOnGens2 f g genValid shrinkValid+ forAllShrink gen s $ \(a, b) -> f a b `shouldBe` g a b equivalent2 ::- (Show a, GenUnchecked a, Show b, GenUnchecked b, Show c, Eq c)- => (a -> b -> c)- -> (a -> b -> c)- -> Property-equivalent2 f g = equivalentOnGens2 f g genUnchecked shrinkUnchecked+ (Show a, GenValid a, Show b, GenValid b, Show c, Eq c) =>+ (a -> b -> c) ->+ (a -> b -> c) ->+ Property+equivalent2 f g = equivalentOnGens2 f g genValid shrinkValid -- | -- -- prop> equivalentOnArbitrary2 (+) ((+) :: Int -> Int -> Int) equivalentOnArbitrary2 ::- (Show a, Arbitrary a, Show b, Arbitrary b, Show c, Eq c)- => (a -> b -> c)- -> (a -> b -> c)- -> Property+ (Show a, Arbitrary a, Show b, Arbitrary b, Show c, Eq c) =>+ (a -> b -> c) ->+ (a -> b -> c) ->+ Property equivalentOnArbitrary2 f g = equivalentOnGens2 f g arbitrary shrink equivalentWhenFirstSucceedsOnGen ::- (Show a, Eq a, Show b, Eq b, CanFail f)- => (a -> f b)- -> (a -> b)- -> Gen a- -> (a -> [a])- -> Property+ (Show a, Show b, Eq b, CanFail f) =>+ (a -> f b) ->+ (a -> b) ->+ Gen a ->+ (a -> [a]) ->+ Property equivalentWhenFirstSucceedsOnGen f g gen s =- forAllShrink gen s $ \a ->- case resultIfSucceeded (f a) of- Nothing -> return () -- fine- Just r -> r `shouldBe` g a--equivalentWhenFirstSucceedsOnValid ::- (Show a, Eq a, GenValid a, Show b, Eq b, CanFail f)- => (a -> f b)- -> (a -> b)- -> Property-equivalentWhenFirstSucceedsOnValid f g =- equivalentWhenFirstSucceedsOnGen f g genValid shrinkValid+ forAllShrink gen s $ \a ->+ case resultIfSucceeded (f a) of+ Nothing -> return () -- fine+ Just r -> r `shouldBe` g a equivalentWhenFirstSucceedsOnArbitrary ::- (Show a, Eq a, Arbitrary a, Show b, Eq b, CanFail f)- => (a -> f b)- -> (a -> b)- -> Property+ (Show a, Arbitrary a, Show b, Eq b, CanFail f) =>+ (a -> f b) ->+ (a -> b) ->+ Property equivalentWhenFirstSucceedsOnArbitrary f g =- equivalentWhenFirstSucceedsOnGen f g arbitrary shrink+ equivalentWhenFirstSucceedsOnGen f g arbitrary shrink equivalentWhenFirstSucceeds ::- (Show a, Eq a, GenUnchecked a, Show b, Eq b, CanFail f)- => (a -> f b)- -> (a -> b)- -> Property+ (Show a, GenValid a, Show b, Eq b, CanFail f) =>+ (a -> f b) ->+ (a -> b) ->+ Property equivalentWhenFirstSucceeds f g =- equivalentWhenFirstSucceedsOnGen f g genUnchecked shrinkUnchecked+ equivalentWhenFirstSucceedsOnGen f g genValid shrinkValid 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)- -> ((a, b) -> [(a, b)])- -> Property+ (Show a, Show b, Show c, Eq c, CanFail f) =>+ (a -> b -> f c) ->+ (a -> b -> c) ->+ Gen (a, b) ->+ ((a, b) -> [(a, b)]) ->+ Property equivalentWhenFirstSucceedsOnGens2 f g gen s =- forAllShrink gen s $ \(a, b) ->- case resultIfSucceeded (f a b) of- Nothing -> return () -- fine- Just rs -> rs `shouldBe` g a b--equivalentWhenFirstSucceedsOnValids2 ::- ( Show a- , Eq a- , GenValid a- , Show b- , Eq b- , GenValid b- , Show c- , Eq c- , CanFail f- )- => (a -> b -> f c)- -> (a -> b -> c)- -> Property-equivalentWhenFirstSucceedsOnValids2 f g =- equivalentWhenFirstSucceedsOnGens2 f g genValid shrinkValid+ forAllShrink gen s $ \(a, b) ->+ case resultIfSucceeded (f a b) of+ Nothing -> return () -- fine+ Just rs -> rs `shouldBe` g a b equivalentWhenFirstSucceedsOnArbitrary2 ::- ( Show a- , Eq a- , Arbitrary a- , Show b- , Eq b- , Arbitrary b- , Show c- , Eq c- , CanFail f- )- => (a -> b -> f c)- -> (a -> b -> c)- -> Property+ ( Show a,+ Arbitrary a,+ Show b,+ Arbitrary b,+ Show c,+ Eq c,+ CanFail f+ ) =>+ (a -> b -> f c) ->+ (a -> b -> c) ->+ Property equivalentWhenFirstSucceedsOnArbitrary2 f g =- equivalentWhenFirstSucceedsOnGens2 f g arbitrary shrink+ equivalentWhenFirstSucceedsOnGens2 f g arbitrary shrink equivalentWhenFirstSucceeds2 ::- ( Show a- , Eq a- , GenUnchecked a- , Show b- , Eq b- , GenUnchecked b- , Show c- , Eq c- , CanFail f- )- => (a -> b -> f c)- -> (a -> b -> c)- -> Property+ ( Show a,+ GenValid a,+ Show b,+ GenValid b,+ Show c,+ Eq c,+ CanFail f+ ) =>+ (a -> b -> f c) ->+ (a -> b -> c) ->+ Property equivalentWhenFirstSucceeds2 f g =- equivalentWhenFirstSucceedsOnGens2 f g genUnchecked shrinkUnchecked+ equivalentWhenFirstSucceedsOnGens2 f g genValid shrinkValid equivalentWhenSecondSucceedsOnGen ::- (Show a, Eq a, Show b, Eq b, CanFail f)- => (a -> b)- -> (a -> f b)- -> Gen a- -> (a -> [a])- -> Property+ (Show a, Show b, Eq b, CanFail f) =>+ (a -> b) ->+ (a -> f b) ->+ Gen a ->+ (a -> [a]) ->+ Property equivalentWhenSecondSucceedsOnGen f g gen s =- forAllShrink gen s $ \a ->- case resultIfSucceeded (g a) of- Nothing -> return () -- fine- Just r -> r `shouldBe` f a--equivalentWhenSecondSucceedsOnValid ::- (Show a, Eq a, GenValid a, Show b, Eq b, CanFail f)- => (a -> b)- -> (a -> f b)- -> Property-equivalentWhenSecondSucceedsOnValid f g =- equivalentWhenSecondSucceedsOnGen f g genValid shrinkValid+ forAllShrink gen s $ \a ->+ case resultIfSucceeded (g a) of+ Nothing -> return () -- fine+ Just r -> r `shouldBe` f a equivalentWhenSecondSucceedsOnArbitrary ::- (Show a, Eq a, Arbitrary a, Show b, Eq b, CanFail f)- => (a -> b)- -> (a -> f b)- -> Property+ (Show a, Arbitrary a, Show b, Eq b, CanFail f) =>+ (a -> b) ->+ (a -> f b) ->+ Property equivalentWhenSecondSucceedsOnArbitrary f g =- equivalentWhenSecondSucceedsOnGen f g arbitrary shrink+ equivalentWhenSecondSucceedsOnGen f g arbitrary shrink equivalentWhenSecondSucceeds ::- (Show a, Eq a, GenUnchecked a, Show b, Eq b, CanFail f)- => (a -> b)- -> (a -> f b)- -> Property+ (Show a, GenValid a, Show b, Eq b, CanFail f) =>+ (a -> b) ->+ (a -> f b) ->+ Property equivalentWhenSecondSucceeds f g =- equivalentWhenSecondSucceedsOnGen f g genUnchecked shrinkUnchecked+ equivalentWhenSecondSucceedsOnGen f g genValid shrinkValid 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)- -> ((a, b) -> [(a, b)])- -> Property+ (Show a, Show b, Show c, Eq c, CanFail f) =>+ (a -> b -> c) ->+ (a -> b -> f c) ->+ Gen (a, b) ->+ ((a, b) -> [(a, b)]) ->+ Property equivalentWhenSecondSucceedsOnGens2 f g gen s =- forAllShrink gen s $ \(a, b) ->- case resultIfSucceeded (g a b) of- Nothing -> return () -- fine- Just rs -> rs `shouldBe` f a b--equivalentWhenSecondSucceedsOnValids2 ::- ( Show a- , Eq a- , GenValid a- , Show b- , Eq b- , GenValid b- , Show c- , Eq c- , CanFail f- )- => (a -> b -> c)- -> (a -> b -> f c)- -> Property-equivalentWhenSecondSucceedsOnValids2 f g =- equivalentWhenSecondSucceedsOnGens2 f g genValid shrinkValid+ forAllShrink gen s $ \(a, b) ->+ case resultIfSucceeded (g a b) of+ Nothing -> return () -- fine+ Just rs -> rs `shouldBe` f a b equivalentWhenSecondSucceedsOnArbitrary2 ::- ( Show a- , Eq a- , Arbitrary a- , Show b- , Eq b- , Arbitrary b- , Show c- , Eq c- , CanFail f- )- => (a -> b -> c)- -> (a -> b -> f c)- -> Property+ ( Show a,+ Arbitrary a,+ Show b,+ Arbitrary b,+ Show c,+ Eq c,+ CanFail f+ ) =>+ (a -> b -> c) ->+ (a -> b -> f c) ->+ Property equivalentWhenSecondSucceedsOnArbitrary2 f g =- equivalentWhenSecondSucceedsOnGens2 f g arbitrary shrink+ equivalentWhenSecondSucceedsOnGens2 f g arbitrary shrink equivalentWhenSecondSucceeds2 ::- ( Show a- , Eq a- , GenUnchecked a- , Show b- , Eq b- , GenUnchecked b- , Show c- , Eq c- , CanFail f- )- => (a -> b -> c)- -> (a -> b -> f c)- -> Property+ ( Show a,+ GenValid a,+ Show b,+ GenValid b,+ Show c,+ Eq c,+ CanFail f+ ) =>+ (a -> b -> c) ->+ (a -> b -> f c) ->+ Property equivalentWhenSecondSucceeds2 f g =- equivalentWhenSecondSucceedsOnGens2 f g genUnchecked shrinkUnchecked+ equivalentWhenSecondSucceedsOnGens2 f g genValid shrinkValid equivalentWhenSucceedOnGen ::- (Show a, Eq a, Show b, Eq b, CanFail f)- => (a -> f b)- -> (a -> f b)- -> Gen a- -> (a -> [a])- -> Property+ (Show a, Show b, Eq b, CanFail f) =>+ (a -> f b) ->+ (a -> f b) ->+ Gen a ->+ (a -> [a]) ->+ Property equivalentWhenSucceedOnGen f g gen s =- forAllShrink gen s $ \a ->- case do fa <- resultIfSucceeded $ f a- ga <- resultIfSucceeded $ g a- return (fa, ga) of- Nothing -> return () -- fine- Just (fa, ga) -> fa `shouldBe` ga--equivalentWhenSucceedOnValid ::- (Show a, Eq a, GenValid a, Show b, Eq b, CanFail f)- => (a -> f b)- -> (a -> f b)- -> Property-equivalentWhenSucceedOnValid f g =- equivalentWhenSucceedOnGen f g genValid shrinkValid+ forAllShrink gen s $ \a ->+ case do+ fa <- resultIfSucceeded $ f a+ ga <- resultIfSucceeded $ g a+ return (fa, ga) of+ Nothing -> return () -- fine+ Just (fa, ga) -> fa `shouldBe` ga equivalentWhenSucceed ::- (Show a, Eq a, GenUnchecked a, Show b, Eq b, CanFail f)- => (a -> f b)- -> (a -> f b)- -> Property+ (Show a, GenValid a, Show b, Eq b, CanFail f) =>+ (a -> f b) ->+ (a -> f b) ->+ Property equivalentWhenSucceed f g =- equivalentWhenSucceedOnGen f g genUnchecked shrinkUnchecked+ equivalentWhenSucceedOnGen f g genValid shrinkValid equivalentWhenSucceedOnArbitrary ::- (Show a, Eq a, Arbitrary a, Show b, Eq b, CanFail f)- => (a -> f b)- -> (a -> f b)- -> Property+ (Show a, Arbitrary a, Show b, Eq b, CanFail f) =>+ (a -> f b) ->+ (a -> f b) ->+ Property equivalentWhenSucceedOnArbitrary f g =- equivalentWhenSucceedOnGen f g arbitrary shrink+ equivalentWhenSucceedOnGen f g arbitrary shrink 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)- -> ((a, b) -> [(a, b)])- -> Property+ (Show a, Show b, Show c, Eq c, CanFail f) =>+ (a -> b -> f c) ->+ (a -> b -> f c) ->+ Gen (a, b) ->+ ((a, b) -> [(a, b)]) ->+ Property equivalentWhenSucceedOnGens2 f g gen s =- forAllShrink gen s $ \(a, b) ->- case do fab <- resultIfSucceeded $ f a b- gab <- resultIfSucceeded $ g a b- return (fab, gab) of- Nothing -> return () -- fine- Just (fab, gab) -> fab `shouldBe` gab--equivalentWhenSucceedOnValids2 ::- ( Show a- , Eq a- , GenValid a- , Show b- , Eq b- , GenValid b- , Show c- , Eq c- , CanFail f- )- => (a -> b -> f c)- -> (a -> b -> f c)- -> Property-equivalentWhenSucceedOnValids2 f g =- equivalentWhenSucceedOnGens2 f g genValid shrinkValid+ forAllShrink gen s $ \(a, b) ->+ case do+ fab <- resultIfSucceeded $ f a b+ gab <- resultIfSucceeded $ g a b+ return (fab, gab) of+ Nothing -> return () -- fine+ Just (fab, gab) -> fab `shouldBe` gab equivalentWhenSucceedOnArbitrary2 ::- ( Show a- , Eq a- , Arbitrary a- , Show b- , Eq b- , Arbitrary b- , Show c- , Eq c- , CanFail f- )- => (a -> b -> f c)- -> (a -> b -> f c)- -> Property+ ( Show a,+ Arbitrary a,+ Show b,+ Arbitrary b,+ Show c,+ Eq c,+ CanFail f+ ) =>+ (a -> b -> f c) ->+ (a -> b -> f c) ->+ Property equivalentWhenSucceedOnArbitrary2 f g =- equivalentWhenSucceedOnGens2 f g arbitrary shrink+ equivalentWhenSucceedOnGens2 f g arbitrary shrink equivalentWhenSucceed2 ::- ( Show a- , Eq a- , GenUnchecked a- , Show b- , Eq b- , GenUnchecked b- , Show c- , Eq c- , CanFail f- )- => (a -> b -> f c)- -> (a -> b -> f c)- -> Property+ ( Show a,+ GenValid a,+ Show b,+ GenValid b,+ Show c,+ Eq c,+ CanFail f+ ) =>+ (a -> b -> f c) ->+ (a -> b -> f c) ->+ Property equivalentWhenSucceed2 f g =- equivalentWhenSucceedOnGens2 f g genUnchecked shrinkUnchecked+ equivalentWhenSucceedOnGens2 f g genValid shrinkValid equivalentOnGens3 ::- (Show a, Show b, Show c, Show d, Eq d)- => (a -> b -> c -> d)- -> (a -> b -> c -> d)- -> Gen (a, b, c)- -> ((a, b, c) -> [(a, b, c)])- -> Property+ (Show a, Show b, Show c, Show d, Eq d) =>+ (a -> b -> c -> d) ->+ (a -> b -> c -> d) ->+ Gen (a, b, c) ->+ ((a, b, c) -> [(a, b, c)]) ->+ Property equivalentOnGens3 f g gen s =- forAllShrink gen s $ \(a, b, c) -> f a b c `shouldBe` g a b c--equivalentOnValids3 ::- ( Show a- , GenValid a- , Show b- , GenValid b- , Show c- , GenValid c- , Show d- , Eq d- )- => (a -> b -> c -> d)- -> (a -> b -> c -> d)- -> Property-equivalentOnValids3 f g = equivalentOnGens3 f g genValid shrinkValid+ forAllShrink gen s $ \(a, b, c) -> f a b c `shouldBe` g a b c equivalent3 ::- ( Show a- , GenUnchecked a- , Show b- , GenUnchecked b- , Show c- , GenUnchecked c- , Show d- , Eq d- )- => (a -> b -> c -> d)- -> (a -> b -> c -> d)- -> Property-equivalent3 f g = equivalentOnGens3 f g genUnchecked shrinkUnchecked+ ( Show a,+ GenValid a,+ Show b,+ GenValid b,+ Show c,+ GenValid c,+ Show d,+ Eq d+ ) =>+ (a -> b -> c -> d) ->+ (a -> b -> c -> d) ->+ Property+equivalent3 f g = equivalentOnGens3 f g genValid shrinkValid equivalentOnArbitrary3 ::- ( Show a- , Arbitrary a- , Show b- , Arbitrary b- , Show c- , Arbitrary c- , Show d- , Eq d- )- => (a -> b -> c -> d)- -> (a -> b -> c -> d)- -> Property+ ( Show a,+ Arbitrary a,+ Show b,+ Arbitrary b,+ Show c,+ Arbitrary c,+ Show d,+ Eq d+ ) =>+ (a -> b -> c -> d) ->+ (a -> b -> c -> d) ->+ Property equivalentOnArbitrary3 f g = equivalentOnGens3 f g arbitrary shrink
src/Test/Validity/Functions/Idempotence.hs view
@@ -3,25 +3,21 @@ -- | Standard tests involving validity module Test.Validity.Functions.Idempotence- ( idempotentOnGen- , idempotentOnValid- , idempotent- , idempotentOnArbitrary- ) where+ ( idempotentOnGen,+ idempotent,+ idempotentOnArbitrary,+ )+where import Data.GenValidity- import Test.Hspec import Test.QuickCheck idempotentOnGen :: (Show a, Eq a) => (a -> a) -> Gen a -> (a -> [a]) -> Property idempotentOnGen f gen s = forAllShrink gen s $ \a -> f (f a) `shouldBe` f a -idempotentOnValid :: (Show a, Eq a, GenValid a) => (a -> a) -> Property-idempotentOnValid func = idempotentOnGen func genValid shrinkValid--idempotent :: (Show a, Eq a, GenUnchecked a) => (a -> a) -> Property-idempotent func = idempotentOnGen func genUnchecked shrinkUnchecked+idempotent :: (Show a, Eq a, GenValid a) => (a -> a) -> Property+idempotent func = idempotentOnGen func genValid shrinkValid -- | --
src/Test/Validity/Functions/Inverse.hs view
@@ -3,159 +3,127 @@ -- | Standard tests involving inverse functions module Test.Validity.Functions.Inverse- ( inverseFunctionsOnGen- , inverseFunctionsOnValid- , inverseFunctions- , inverseFunctionsOnArbitrary- , inverseFunctionsIfFirstSucceedsOnGen- , inverseFunctionsIfFirstSucceedsOnValid- , inverseFunctionsIfFirstSucceeds- , inverseFunctionsIfFirstSucceedsOnArbitrary- , inverseFunctionsIfSecondSucceedsOnGen- , inverseFunctionsIfSecondSucceedsOnValid- , inverseFunctionsIfSecondSucceeds- , inverseFunctionsIfSecondSucceedsOnArbitrary- , inverseFunctionsIfSucceedOnGen- , inverseFunctionsIfSucceedOnValid- , inverseFunctionsIfSucceed- , inverseFunctionsIfSucceedOnArbitrary- ) where+ ( inverseFunctionsOnGen,+ inverseFunctions,+ inverseFunctionsOnArbitrary,+ inverseFunctionsIfFirstSucceedsOnGen,+ inverseFunctionsIfFirstSucceeds,+ inverseFunctionsIfFirstSucceedsOnArbitrary,+ inverseFunctionsIfSecondSucceedsOnGen,+ inverseFunctionsIfSecondSucceeds,+ inverseFunctionsIfSecondSucceedsOnArbitrary,+ inverseFunctionsIfSucceedOnGen,+ inverseFunctionsIfSucceed,+ inverseFunctionsIfSucceedOnArbitrary,+ )+where import Data.GenValidity- import Test.Hspec import Test.QuickCheck- import Test.Validity.Types inverseFunctionsOnGen ::- (Show a, Eq a) => (a -> b) -> (b -> a) -> Gen a -> (a -> [a]) -> Property+ (Show a, Eq a) => (a -> b) -> (b -> a) -> Gen a -> (a -> [a]) -> Property inverseFunctionsOnGen f g gen s =- forAllShrink gen s $ \a -> g (f a) `shouldBe` a--inverseFunctionsOnValid ::- (Show a, Eq a, GenValid a) => (a -> b) -> (b -> a) -> Property-inverseFunctionsOnValid f g = inverseFunctionsOnGen f g genValid shrinkValid+ forAllShrink gen s $ \a -> g (f a) `shouldBe` a inverseFunctions ::- (Show a, Eq a, GenUnchecked a) => (a -> b) -> (b -> a) -> Property-inverseFunctions f g = inverseFunctionsOnGen f g genUnchecked shrinkUnchecked+ (Show a, Eq a, GenValid a) => (a -> b) -> (b -> a) -> Property+inverseFunctions f g = inverseFunctionsOnGen f g genValid shrinkValid -- | -- 'id' is its own inverse function for every type: -- prop> inverseFunctionsOnArbitrary id (id :: Int -> Int) inverseFunctionsOnArbitrary ::- (Show a, Eq a, Arbitrary a) => (a -> b) -> (b -> a) -> Property+ (Show a, Eq a, Arbitrary a) => (a -> b) -> (b -> a) -> Property inverseFunctionsOnArbitrary f g = inverseFunctionsOnGen f g arbitrary shrink inverseFunctionsIfFirstSucceedsOnGen ::- (Show a, Eq a, CanFail f)- => (a -> f b)- -> (b -> a)- -> Gen a- -> (a -> [a])- -> Property+ (Show a, Eq a, CanFail f) =>+ (a -> f b) ->+ (b -> a) ->+ Gen a ->+ (a -> [a]) ->+ Property inverseFunctionsIfFirstSucceedsOnGen f g gen s =- forAllShrink gen s $ \a ->- case resultIfSucceeded (f a) of- Nothing -> return () -- fine- Just b -> g b `shouldBe` a--inverseFunctionsIfFirstSucceedsOnValid ::- (Show a, Eq a, GenValid a, CanFail f)- => (a -> f b)- -> (b -> a)- -> Property-inverseFunctionsIfFirstSucceedsOnValid f g =- inverseFunctionsIfFirstSucceedsOnGen f g genValid shrinkValid+ forAllShrink gen s $ \a ->+ case resultIfSucceeded (f a) of+ Nothing -> return () -- fine+ Just b -> g b `shouldBe` a inverseFunctionsIfFirstSucceeds ::- (Show a, Eq a, GenUnchecked a, CanFail f)- => (a -> f b)- -> (b -> a)- -> Property+ (Show a, Eq a, GenValid a, CanFail f) =>+ (a -> f b) ->+ (b -> a) ->+ Property inverseFunctionsIfFirstSucceeds f g =- inverseFunctionsIfFirstSucceedsOnGen f g genUnchecked shrinkUnchecked+ inverseFunctionsIfFirstSucceedsOnGen f g genValid shrinkValid inverseFunctionsIfFirstSucceedsOnArbitrary ::- (Show a, Eq a, Arbitrary a, CanFail f)- => (a -> f b)- -> (b -> a)- -> Property+ (Show a, Eq a, Arbitrary a, CanFail f) =>+ (a -> f b) ->+ (b -> a) ->+ Property inverseFunctionsIfFirstSucceedsOnArbitrary f g =- inverseFunctionsIfFirstSucceedsOnGen f g arbitrary shrink+ inverseFunctionsIfFirstSucceedsOnGen f g arbitrary shrink inverseFunctionsIfSecondSucceedsOnGen ::- (Show a, Eq a, CanFail f)- => (a -> b)- -> (b -> f a)- -> Gen a- -> (a -> [a])- -> Property+ (Show a, Eq a, CanFail f) =>+ (a -> b) ->+ (b -> f a) ->+ Gen a ->+ (a -> [a]) ->+ Property inverseFunctionsIfSecondSucceedsOnGen f g gen s =- forAllShrink gen s $ \a ->- case resultIfSucceeded (g (f a)) of- Nothing -> return () -- fine- Just r -> r `shouldBe` a--inverseFunctionsIfSecondSucceedsOnValid ::- (Show a, Eq a, GenValid a, CanFail f)- => (a -> b)- -> (b -> f a)- -> Property-inverseFunctionsIfSecondSucceedsOnValid f g =- inverseFunctionsIfSecondSucceedsOnGen f g genValid shrinkValid+ forAllShrink gen s $ \a ->+ case resultIfSucceeded (g (f a)) of+ Nothing -> return () -- fine+ Just r -> r `shouldBe` a inverseFunctionsIfSecondSucceeds ::- (Show a, Eq a, GenUnchecked a, CanFail f)- => (a -> b)- -> (b -> f a)- -> Property+ (Show a, Eq a, GenValid a, CanFail f) =>+ (a -> b) ->+ (b -> f a) ->+ Property inverseFunctionsIfSecondSucceeds f g =- inverseFunctionsIfSecondSucceedsOnGen f g genUnchecked shrinkUnchecked+ inverseFunctionsIfSecondSucceedsOnGen f g genValid shrinkValid inverseFunctionsIfSecondSucceedsOnArbitrary ::- (Show a, Eq a, Arbitrary a, CanFail f)- => (a -> b)- -> (b -> f a)- -> Property+ (Show a, Eq a, Arbitrary a, CanFail f) =>+ (a -> b) ->+ (b -> f a) ->+ Property inverseFunctionsIfSecondSucceedsOnArbitrary f g =- inverseFunctionsIfSecondSucceedsOnGen f g arbitrary shrink+ inverseFunctionsIfSecondSucceedsOnGen f g arbitrary shrink inverseFunctionsIfSucceedOnGen ::- (Show a, Eq a, CanFail f, CanFail g)- => (a -> f b)- -> (b -> g a)- -> Gen a- -> (a -> [a])- -> Property+ (Show a, Eq a, CanFail f, CanFail g) =>+ (a -> f b) ->+ (b -> g a) ->+ Gen a ->+ (a -> [a]) ->+ Property inverseFunctionsIfSucceedOnGen f g gen s =- forAllShrink gen s $ \a ->- case do fa <- resultIfSucceeded $ f a- resultIfSucceeded $ g fa of- Nothing -> return () -- fine- Just r -> r `shouldBe` a--inverseFunctionsIfSucceedOnValid ::- (Show a, Eq a, GenValid a, CanFail f, CanFail g)- => (a -> f b)- -> (b -> g a)- -> Property-inverseFunctionsIfSucceedOnValid f g =- inverseFunctionsIfSucceedOnGen f g genValid shrinkValid+ forAllShrink gen s $ \a ->+ case do+ fa <- resultIfSucceeded $ f a+ resultIfSucceeded $ g fa of+ Nothing -> return () -- fine+ Just r -> r `shouldBe` a inverseFunctionsIfSucceed ::- (Show a, Eq a, GenUnchecked a, CanFail f, CanFail g)- => (a -> f b)- -> (b -> g a)- -> Property+ (Show a, Eq a, GenValid a, CanFail f, CanFail g) =>+ (a -> f b) ->+ (b -> g a) ->+ Property inverseFunctionsIfSucceed f g =- inverseFunctionsIfSucceedOnGen f g genUnchecked shrinkUnchecked+ inverseFunctionsIfSucceedOnGen f g genValid shrinkValid inverseFunctionsIfSucceedOnArbitrary ::- (Show a, Eq a, Arbitrary a, CanFail f, CanFail g)- => (a -> f b)- -> (b -> g a)- -> Property+ (Show a, Eq a, Arbitrary a, CanFail f, CanFail g) =>+ (a -> f b) ->+ (b -> g a) ->+ Property inverseFunctionsIfSucceedOnArbitrary f g =- inverseFunctionsIfSucceedOnGen f g arbitrary shrink+ inverseFunctionsIfSucceedOnGen f g arbitrary shrink
src/Test/Validity/Functions/Validity.hs view
@@ -3,128 +3,99 @@ -- | Standard tests involving validity module Test.Validity.Functions.Validity- ( producesValidsOnGen- , producesValidsOnValids- , producesValid- , producesValidsOnArbitrary- , producesValidsOnGens2- , producesValidsOnValids2- , producesValid2- , producesValidsOnArbitrary2- , producesValidsOnGens3- , producesValidsOnValids3- , producesValid3- , producesValidsOnArbitrary3- ) where+ ( producesValidsOnGen,+ producesValid,+ producesValidsOnArbitrary,+ producesValidsOnGens2,+ producesValid2,+ producesValidsOnArbitrary2,+ producesValidsOnGens3,+ producesValid3,+ producesValidsOnArbitrary3,+ )+where import Data.GenValidity- import Test.QuickCheck- import Test.Validity.Property.Utils -- | The function produces valid output when the input is generated as -- specified by the given generator. producesValidsOnGen ::- forall a b. (Show a, Show b, Validity b)- => (a -> b)- -> Gen a- -> (a -> [a])- -> Property+ forall a b.+ (Show a, Show b, Validity b) =>+ (a -> b) ->+ Gen a ->+ (a -> [a]) ->+ Property producesValidsOnGen func gen s = forAllShrink gen s $ shouldBeValid . func -- | The function produces valid output when the input is generated by -- @genValid@-producesValidsOnValids ::- (Show a, Show b, GenValid a, Validity b) => (a -> b) -> Property-producesValidsOnValids f = producesValidsOnGen f genValid shrinkValid---- | The function produces valid output when the input is generated by--- @genUnchecked@ producesValid ::- (Show a, Show b, GenUnchecked a, Validity b) => (a -> b) -> Property-producesValid f = producesValidsOnGen f genUnchecked shrinkUnchecked+ (Show a, Show b, GenValid a, Validity b) => (a -> b) -> Property+producesValid f = producesValidsOnGen f genValid shrinkValid -- | The function produces valid output when the input is generated by -- @arbitrary@ producesValidsOnArbitrary ::- (Show a, Show b, Arbitrary a, Validity b) => (a -> b) -> Property+ (Show a, Show b, Arbitrary a, Validity b) => (a -> b) -> Property producesValidsOnArbitrary f = producesValidsOnGen f arbitrary shrink producesValidsOnGens2 ::- (Show a, Show b, Show c, Validity c)- => (a -> b -> c)- -> Gen (a, b)- -> ((a, b) -> [(a, b)])- -> Property+ (Show a, Show b, Show c, Validity c) =>+ (a -> b -> c) ->+ Gen (a, b) ->+ ((a, b) -> [(a, b)]) ->+ Property producesValidsOnGens2 func gen s =- forAllShrink gen s $ \(a, b) -> shouldBeValid $ func a b--producesValidsOnValids2 ::- (Show a, Show b, Show c, GenValid a, GenValid b, Validity c)- => (a -> b -> c)- -> Property-producesValidsOnValids2 func = producesValidsOnGens2 func genValid shrinkValid+ forAllShrink gen s $ \(a, b) -> shouldBeValid $ func a b producesValid2 ::- (Show a, Show b, Show c, GenUnchecked a, GenUnchecked b, Validity c)- => (a -> b -> c)- -> Property-producesValid2 func = producesValidsOnGens2 func genUnchecked shrinkUnchecked+ (Show a, Show b, Show c, GenValid a, GenValid b, Validity c) =>+ (a -> b -> c) ->+ Property+producesValid2 func = producesValidsOnGens2 func genValid shrinkValid producesValidsOnArbitrary2 ::- (Show a, Show b, Show c, Arbitrary a, Arbitrary b, Validity c)- => (a -> b -> c)- -> Property+ (Show a, Show b, Show c, Arbitrary a, Arbitrary b, Validity c) =>+ (a -> b -> c) ->+ Property producesValidsOnArbitrary2 func = producesValidsOnGens2 func arbitrary shrink producesValidsOnGens3 ::- (Show a, Show b, Show c, Show d, Validity d)- => (a -> b -> c -> d)- -> Gen (a, b, c)- -> ((a, b, c) -> [(a, b, c)])- -> Property+ (Show a, Show b, Show c, Show d, Validity d) =>+ (a -> b -> c -> d) ->+ Gen (a, b, c) ->+ ((a, b, c) -> [(a, b, c)]) ->+ Property producesValidsOnGens3 func gen s =- forAllShrink gen s $ \(a, b, c) -> shouldBeValid $ func a b c--producesValidsOnValids3 ::- ( Show a- , Show b- , Show c- , Show d- , GenValid a- , GenValid b- , GenValid c- , Validity d- )- => (a -> b -> c -> d)- -> Property-producesValidsOnValids3 func = producesValidsOnGens3 func genValid shrinkValid+ forAllShrink gen s $ \(a, b, c) -> shouldBeValid $ func a b c producesValid3 ::- ( Show a- , Show b- , Show c- , Show d- , GenUnchecked a- , GenUnchecked b- , GenUnchecked c- , Validity d- )- => (a -> b -> c -> d)- -> Property-producesValid3 func = producesValidsOnGens3 func genUnchecked shrinkUnchecked+ ( Show a,+ Show b,+ Show c,+ Show d,+ GenValid a,+ GenValid b,+ GenValid c,+ Validity d+ ) =>+ (a -> b -> c -> d) ->+ Property+producesValid3 func = producesValidsOnGens3 func genValid shrinkValid producesValidsOnArbitrary3 ::- ( Show a- , Show b- , Show c- , Show d- , Arbitrary a- , Arbitrary b- , Arbitrary c- , Validity d- )- => (a -> b -> c -> d)- -> Property+ ( Show a,+ Show b,+ Show c,+ Show d,+ Arbitrary a,+ Arbitrary b,+ Arbitrary c,+ Validity d+ ) =>+ (a -> b -> c -> d) ->+ Property producesValidsOnArbitrary3 func = producesValidsOnGens3 func arbitrary shrink
src/Test/Validity/GenValidity/Property.hs view
@@ -1,29 +1,30 @@-{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE AllowAmbiguousTypes #-}+{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE ScopedTypeVariables #-} -- | Tests for GenValidity instances module Test.Validity.GenValidity.Property- ( genGeneratesValid- , genGeneratesInvalid- ) where+ ( genGeneratesValid,+ genGeneratesInvalid,+ )+where import Data.GenValidity- import Test.QuickCheck- import Test.Validity.Property.Utils -- | The given generator generates only valid data points genGeneratesValid ::- forall a. (Show a, Validity a)- => Gen a- -> Property+ forall a.+ (Show a, Validity a) =>+ Gen a ->+ Property genGeneratesValid gen = forAll gen shouldBeValid -- | The given generator generates only invalid data points genGeneratesInvalid ::- forall a. (Show a, Validity a)- => Gen a- -> Property+ forall a.+ (Show a, Validity a) =>+ Gen a ->+ Property genGeneratesInvalid gen = forAll gen shouldBeInvalid
src/Test/Validity/Operations.hs view
@@ -3,31 +3,11 @@ -- | Properties of operations module Test.Validity.Operations- ( leftIdentityOnElemWithEquality- , leftIdentityOnGenWithEquality- , leftIdentityOnGen- , leftIdentityOnValid- , leftIdentity- , leftIdentityOnArbitrary- , rightIdentityOnElemWithEquality- , rightIdentityOnGenWithEquality- , rightIdentityOnGen- , rightIdentityOnValid- , rightIdentity- , rightIdentityOnArbitrary- , identityOnGen- , identityOnValid- , identity- , identityOnArbitrary- , associativeOnGens- , associativeOnValids- , associative- , associativeOnArbitrary- , commutativeOnGens- , commutativeOnValids- , commutative- , commutativeOnArbitrary- ) where+ ( module Test.Validity.Operations.Associativity,+ module Test.Validity.Operations.Commutativity,+ module Test.Validity.Operations.Identity,+ )+where import Test.Validity.Operations.Associativity import Test.Validity.Operations.Commutativity
src/Test/Validity/Operations/Associativity.hs view
@@ -2,14 +2,13 @@ {-# LANGUAGE ScopedTypeVariables #-} module Test.Validity.Operations.Associativity- ( associativeOnGens- , associativeOnValids- , associative- , associativeOnArbitrary- ) where+ ( associativeOnGens,+ associative,+ associativeOnArbitrary,+ )+where import Data.GenValidity- import Test.Hspec import Test.QuickCheck @@ -22,29 +21,26 @@ -- (a \star b) \star c = a \star (b \star c) -- \] associativeOnGens ::- (Show a, Eq a)- => (a -> a -> a)- -> Gen (a, a, a)- -> ((a, a, a) -> [(a, a, a)])- -> Property+ (Show a, Eq a) =>+ (a -> a -> a) ->+ Gen (a, a, a) ->+ ((a, a, a) -> [(a, a, a)]) ->+ Property associativeOnGens op gen s =- forAllShrink gen s $ \(a, b, c) ->- ((a `op` b) `op` c) `shouldBe` (a `op` (b `op` c))--associativeOnValids :: (Show a, Eq a, GenValid a) => (a -> a -> a) -> Property-associativeOnValids op = associativeOnGens op genValid shrinkValid+ forAllShrink gen s $ \(a, b, c) ->+ ((a `op` b) `op` c) `shouldBe` (a `op` (b `op` c)) -- | -- -- prop> associative ((*) :: Int -> Int -> Int) -- prop> associative ((+) :: Int -> Int -> Int)-associative :: (Show a, Eq a, GenUnchecked a) => (a -> a -> a) -> Property-associative op = associativeOnGens op genUnchecked shrinkUnchecked+associative :: (Show a, Eq a, GenValid a) => (a -> a -> a) -> Property+associative op = associativeOnGens op genValid shrinkValid -- | -- -- prop> associativeOnArbitrary ((*) :: Int -> Int -> Int) -- prop> associativeOnArbitrary ((+) :: Int -> Int -> Int) associativeOnArbitrary ::- (Show a, Eq a, Arbitrary a) => (a -> a -> a) -> Property+ (Show a, Eq a, Arbitrary a) => (a -> a -> a) -> Property associativeOnArbitrary op = associativeOnGens op arbitrary shrink
src/Test/Validity/Operations/Commutativity.hs view
@@ -2,14 +2,13 @@ {-# LANGUAGE ScopedTypeVariables #-} module Test.Validity.Operations.Commutativity- ( commutativeOnGens- , commutativeOnValids- , commutative- , commutativeOnArbitrary- ) where+ ( commutativeOnGens,+ commutative,+ commutativeOnArbitrary,+ )+where import Data.GenValidity- import Test.Hspec import Test.QuickCheck @@ -22,32 +21,32 @@ -- a \star b = b \star a -- \] commutativeOnGens ::- (Show a, Eq a)- => (a -> a -> a)- -> Gen (a, a)- -> ((a, a) -> [(a, a)])- -> Property+ (Show a, Show b, Eq b) =>+ (a -> a -> b) ->+ Gen (a, a) ->+ ((a, a) -> [(a, a)]) ->+ Property commutativeOnGens op gen s =- forAllShrink gen s $ \(a, b) -> (a `op` b) `shouldBe` (b `op` a)---- |------ prop> commutativeOnValids ((+) :: Rational -> Rational -> Rational)--- prop> commutativeOnValids ((*) :: Rational -> Rational -> Rational)-commutativeOnValids :: (Show a, Eq a, GenValid a) => (a -> a -> a) -> Property-commutativeOnValids op = commutativeOnGens op genValid shrinkValid+ forAllShrink gen s $ \(a, b) -> (a `op` b) `shouldBe` (b `op` a) -- | -- -- prop> commutative ((+) :: Int -> Int -> Int) -- prop> commutative ((*) :: Int -> Int -> Int)-commutative :: (Show a, Eq a, GenUnchecked a) => (a -> a -> a) -> Property-commutative op = commutativeOnGens op genUnchecked shrinkUnchecked+commutative ::+ (Show a, Show b, Eq b, GenValid a) =>+ (a -> a -> b) ->+ Property+commutative op = commutativeOnGens op genValid shrinkValid -- | -- -- prop> commutativeOnArbitrary ((+) :: Int -> Int -> Int) -- prop> commutativeOnArbitrary ((*) :: Int -> Int -> Int)+-- commutativeOnArbitrary ::+-- (Show a, Eq a, Arbitrary a) => (a -> a -> a) -> Property commutativeOnArbitrary ::- (Show a, Eq a, Arbitrary a) => (a -> a -> a) -> Property+ (Show a, Show b, Eq b, Arbitrary a) =>+ (a -> a -> b) ->+ Property commutativeOnArbitrary op = commutativeOnGens op arbitrary shrink
src/Test/Validity/Operations/Identity.hs view
@@ -2,26 +2,23 @@ {-# LANGUAGE ScopedTypeVariables #-} module Test.Validity.Operations.Identity- ( leftIdentityOnElemWithEquality- , leftIdentityOnGenWithEquality- , leftIdentityOnGen- , leftIdentityOnValid- , leftIdentity- , leftIdentityOnArbitrary- , rightIdentityOnElemWithEquality- , rightIdentityOnGenWithEquality- , rightIdentityOnGen- , rightIdentityOnValid- , rightIdentity- , rightIdentityOnArbitrary- , identityOnGen- , identityOnValid- , identity- , identityOnArbitrary- ) where+ ( leftIdentityOnElemWithEquality,+ leftIdentityOnGenWithEquality,+ leftIdentityOnGen,+ leftIdentity,+ leftIdentityOnArbitrary,+ rightIdentityOnElemWithEquality,+ rightIdentityOnGenWithEquality,+ rightIdentityOnGen,+ rightIdentity,+ rightIdentityOnArbitrary,+ identityOnGen,+ identity,+ identityOnArbitrary,+ )+where import Data.GenValidity- import Test.QuickCheck -- |@@ -32,51 +29,53 @@ -- \forall a: (b \star a) \doteq a -- \] leftIdentityOnElemWithEquality ::- (b -> a -> a) -- ^ A binary operation- -> (a -> a -> Bool) -- ^ An equality- -> b -- ^ A candidate left-identity- -> a -- ^ An element- -> Bool+ -- | A binary operation+ (b -> a -> a) ->+ -- | An equality+ (a -> a -> Bool) ->+ -- | A candidate left-identity+ b ->+ -- | An element+ a ->+ Bool leftIdentityOnElemWithEquality op eq b a = (b `op` a) `eq` a leftIdentityOnGenWithEquality ::- Show a- => (b -> a -> a) -- ^ A binary operation- -> (a -> a -> Bool) -- ^ An equality- -> b -- ^ A candidate left-identity- -> Gen a- -> (a -> [a])- -> Property+ Show a =>+ -- | A binary operation+ (b -> a -> a) ->+ -- | An equality+ (a -> a -> Bool) ->+ -- | A candidate left-identity+ b ->+ Gen a ->+ (a -> [a]) ->+ Property leftIdentityOnGenWithEquality op eq b gen s =- forAllShrink gen s $ leftIdentityOnElemWithEquality op eq b+ forAllShrink gen s $ leftIdentityOnElemWithEquality op eq b leftIdentityOnGen ::- (Show a, Eq a)- => (b -> a -> a) -- ^ A binary operation- -> b -- ^ A candidate left-identity- -> Gen a- -> (a -> [a])- -> Property+ (Show a, Eq a) =>+ -- | A binary operation+ (b -> a -> a) ->+ -- | A candidate left-identity+ b ->+ Gen a ->+ (a -> [a]) ->+ Property leftIdentityOnGen op = leftIdentityOnGenWithEquality op (==) -- | ----- prop> leftIdentityOnValid (flip ((^) :: Rational -> Int -> Rational)) 1-leftIdentityOnValid ::- (Show a, Eq a, GenValid a) => (b -> a -> a) -> b -> Property-leftIdentityOnValid op b = leftIdentityOnGen op b genValid shrinkValid---- |--- -- prop> leftIdentity (flip ((^) :: Int -> Int -> Int)) 1-leftIdentity :: (Show a, Eq a, GenUnchecked a) => (b -> a -> a) -> b -> Property-leftIdentity op b = leftIdentityOnGen op b genUnchecked shrinkUnchecked+leftIdentity :: (Show a, Eq a, GenValid a) => (b -> a -> a) -> b -> Property+leftIdentity op b = leftIdentityOnGen op b genValid shrinkValid -- | -- -- prop> leftIdentityOnArbitrary (flip ((^) :: Int -> Int -> Int)) 1 leftIdentityOnArbitrary ::- (Show a, Eq a, Arbitrary a) => (b -> a -> a) -> b -> Property+ (Show a, Eq a, Arbitrary a) => (b -> a -> a) -> b -> Property leftIdentityOnArbitrary op b = leftIdentityOnGen op b arbitrary shrink -- |@@ -87,52 +86,54 @@ -- \forall a: (a \star b) \doteq a -- \] rightIdentityOnElemWithEquality ::- (a -> b -> a) -- ^ A binary operation- -> (a -> a -> Bool) -- ^ An equality- -> b -- ^ A candidate right-identity- -> a -- ^ An element- -> Bool+ -- | A binary operation+ (a -> b -> a) ->+ -- | An equality+ (a -> a -> Bool) ->+ -- | A candidate right-identity+ b ->+ -- | An element+ a ->+ Bool rightIdentityOnElemWithEquality op eq b a = (a `op` b) `eq` a rightIdentityOnGenWithEquality ::- Show a- => (a -> b -> a) -- ^ A binary operation- -> (a -> a -> Bool) -- ^ An equality- -> b -- ^ A candidate right-identity- -> Gen a- -> (a -> [a])- -> Property+ Show a =>+ -- | A binary operation+ (a -> b -> a) ->+ -- | An equality+ (a -> a -> Bool) ->+ -- | A candidate right-identity+ b ->+ Gen a ->+ (a -> [a]) ->+ Property rightIdentityOnGenWithEquality op eq b gen s =- forAllShrink gen s $ rightIdentityOnElemWithEquality op eq b+ forAllShrink gen s $ rightIdentityOnElemWithEquality op eq b rightIdentityOnGen ::- (Show a, Eq a)- => (a -> b -> a) -- ^ A binary operation- -> b -- ^ A candidate right-identity- -> Gen a- -> (a -> [a])- -> Property+ (Show a, Eq a) =>+ -- | A binary operation+ (a -> b -> a) ->+ -- | A candidate right-identity+ b ->+ Gen a ->+ (a -> [a]) ->+ Property rightIdentityOnGen op = rightIdentityOnGenWithEquality op (==) -- | ----- prop> rightIdentityOnValid ((^) :: Rational -> Int -> Rational) 1-rightIdentityOnValid ::- (Show a, Eq a, GenValid a) => (a -> b -> a) -> b -> Property-rightIdentityOnValid op b = rightIdentityOnGen op b genValid shrinkValid---- |--- -- prop> rightIdentity ((^) :: Int -> Int -> Int) 1 rightIdentity ::- (Show a, Eq a, GenUnchecked a) => (a -> b -> a) -> b -> Property-rightIdentity op b = rightIdentityOnGen op b genUnchecked shrinkUnchecked+ (Show a, Eq a, GenValid a) => (a -> b -> a) -> b -> Property+rightIdentity op b = rightIdentityOnGen op b genValid shrinkValid -- | -- -- prop> rightIdentityOnArbitrary ((^) :: Int -> Int -> Int) 1 rightIdentityOnArbitrary ::- (Show a, Eq a, Arbitrary a) => (a -> b -> a) -> b -> Property+ (Show a, Eq a, Arbitrary a) => (a -> b -> a) -> b -> Property rightIdentityOnArbitrary op b = rightIdentityOnGen op b arbitrary shrink -- |@@ -143,28 +144,21 @@ -- LeftIdentity(\star, \doteq, b) \wedge RightIdentity(\star, \doteq, b) -- \] identityOnGen ::- (Show a, Eq a) => (a -> a -> a) -> a -> Gen a -> (a -> [a]) -> Property+ (Show a, Eq a) => (a -> a -> a) -> a -> Gen a -> (a -> [a]) -> Property identityOnGen op e gen s =- leftIdentityOnGen op e gen s .&&. rightIdentityOnGen op e gen s---- |------ prop> identityOnValid ((*) :: Rational -> Rational -> Rational) 1--- prop> identityOnValid ((+) :: Rational -> Rational -> Rational) 0-identityOnValid :: (Show a, Eq a, GenValid a) => (a -> a -> a) -> a -> Property-identityOnValid op a = identityOnGen op a genValid shrinkValid+ leftIdentityOnGen op e gen s .&&. rightIdentityOnGen op e gen s -- | -- -- prop> identity ((*) :: Int -> Int -> Int) 1 -- prop> identity ((+) :: Int -> Int -> Int) 0-identity :: (Show a, Eq a, GenUnchecked a) => (a -> a -> a) -> a -> Property-identity op e = identityOnGen op e genUnchecked shrinkUnchecked+identity :: (Show a, Eq a, GenValid a) => (a -> a -> a) -> a -> Property+identity op e = identityOnGen op e genValid shrinkValid -- | -- -- prop> identityOnArbitrary ((*) :: Int -> Int -> Int) 1 -- prop> identityOnArbitrary ((+) :: Int -> Int -> Int) 0 identityOnArbitrary ::- (Show a, Eq a, Arbitrary a) => (a -> a -> a) -> a -> Property+ (Show a, Eq a, Arbitrary a) => (a -> a -> a) -> a -> Property identityOnArbitrary op a = identityOnGen op a arbitrary shrink
src/Test/Validity/Property.hs view
@@ -2,192 +2,188 @@ {-# LANGUAGE ScopedTypeVariables #-} module Test.Validity.Property- ( module Data.GenValidity- , forAllUnchecked- , forAllValid- , forAllInvalid- -- * Tests for GenValidity instances- , genGeneratesValid- , genGeneratesInvalid- -- * Standard tests involving functions- -- ** Standard tests involving validity- , producesValidsOnGen- , producesValidsOnValids- , producesValid- , producesValidsOnArbitrary- , producesValidsOnGens2- , producesValidsOnValids2- , producesValid2- , producesValidsOnArbitrary2- , producesValidsOnGens3- , producesValidsOnValids3- , producesValid3- , producesValidsOnArbitrary3- -- ** Standard tests involving functions that can fail- , CanFail(..)- , succeedsOnGen- , succeedsOnValid- , succeeds- , succeedsOnArbitrary- , succeedsOnGens2- , succeedsOnValids2- , succeeds2- , succeedsOnArbitrary2- , failsOnGen- , failsOnInvalid- , failsOnGens2- , failsOnInvalid2- , validIfSucceedsOnGen- , validIfSucceedsOnValid- , validIfSucceedsOnArbitrary- , validIfSucceeds- , validIfSucceedsOnGens2- , validIfSucceedsOnValids2- , validIfSucceeds2- , validIfSucceedsOnArbitrary2- , validIfSucceedsOnGens3- , validIfSucceedsOnValids3- , validIfSucceeds3- , validIfSucceedsOnArbitrary3- -- ** Standard tests involving equivalence of functions- -- *** Simple functions- -- **** One argument- , equivalentOnGen- , equivalentOnValid- , equivalent- , equivalentOnArbitrary- -- **** Two arguments- , equivalentOnGens2- , equivalentOnValids2- , equivalent2- , equivalentOnArbitrary2- -- **** Three arguments- , equivalentOnGens3- , equivalentOnValids3- , equivalent3- , equivalentOnArbitrary3- -- *** First function can fail- -- **** One argument- , equivalentWhenFirstSucceedsOnGen- , equivalentWhenFirstSucceedsOnValid- , equivalentWhenFirstSucceeds- , equivalentWhenFirstSucceedsOnArbitrary- -- **** Two arguments- , equivalentWhenFirstSucceedsOnGens2- , equivalentWhenFirstSucceedsOnValids2- , equivalentWhenFirstSucceeds2- , equivalentWhenFirstSucceedsOnArbitrary2- -- *** Second function can fail- -- **** One argument- , equivalentWhenSecondSucceedsOnGen- , equivalentWhenSecondSucceedsOnValid- , equivalentWhenSecondSucceeds- , equivalentWhenSecondSucceedsOnArbitrary- -- **** Two arguments- , equivalentWhenSecondSucceedsOnGens2- , equivalentWhenSecondSucceedsOnValids2- , equivalentWhenSecondSucceeds2- , equivalentWhenSecondSucceedsOnArbitrary2- -- *** Both functions can fail- -- **** One argument- , equivalentWhenSucceedOnGen- , equivalentWhenSucceedOnValid- , equivalentWhenSucceed- , equivalentWhenSucceedOnArbitrary- -- **** Two arguments- , equivalentWhenSucceedOnGens2- , equivalentWhenSucceedOnValids2- , equivalentWhenSucceed2- , equivalentWhenSucceedOnArbitrary2- -- ** Standard tests involving inverse functions- , inverseFunctionsOnGen- , inverseFunctionsOnValid- , inverseFunctions- , inverseFunctionsOnArbitrary- , inverseFunctionsIfFirstSucceedsOnGen- , inverseFunctionsIfFirstSucceedsOnValid- , inverseFunctionsIfFirstSucceeds- , inverseFunctionsIfFirstSucceedsOnArbitrary- , inverseFunctionsIfSecondSucceedsOnGen- , inverseFunctionsIfSecondSucceedsOnValid- , inverseFunctionsIfSecondSucceeds- , inverseFunctionsIfSecondSucceedsOnArbitrary- , inverseFunctionsIfSucceedOnGen- , inverseFunctionsIfSucceedOnValid- , inverseFunctionsIfSucceed- , inverseFunctionsIfSucceedOnArbitrary- -- ** Properties involving idempotence- , idempotentOnGen- , idempotentOnValid- , idempotent- , idempotentOnArbitrary- -- * Properties of relations- -- ** Reflexivity- , reflexiveOnElem- , reflexivityOnGen- , reflexivityOnValid- , reflexivity- , reflexivityOnArbitrary- -- ** Transitivity- , transitiveOnElems- , transitivityOnGens- , transitivityOnValid- , transitivity- , transitivityOnArbitrary- -- ** Antisymmetry- , antisymmetricOnElemsWithEquality- , antisymmetryOnGensWithEquality- , antisymmetryOnGens- , antisymmetryOnValid- , antisymmetry- , antisymmetryOnArbitrary- -- ** Antireflexivity- , antireflexiveOnElem- , antireflexivityOnGen- , antireflexivityOnValid- , antireflexivity- , antireflexivityOnArbitrary- -- ** Symmetry- , symmetricOnElems- , symmetryOnGens- , symmetryOnValid- , symmetry- , symmetryOnArbitrary- -- * Properties of operations- -- ** Identity element- -- *** Left Identity- , leftIdentityOnElemWithEquality- , leftIdentityOnGenWithEquality- , leftIdentityOnGen- , leftIdentityOnValid- , leftIdentity- , leftIdentityOnArbitrary- -- *** Right Identity- , rightIdentityOnElemWithEquality- , rightIdentityOnGenWithEquality- , rightIdentityOnGen- , rightIdentityOnValid- , rightIdentity- , rightIdentityOnArbitrary- -- *** Identity- , identityOnGen- , identityOnValid- , identity- , identityOnArbitrary- -- ** Associativity- , associativeOnGens- , associativeOnValids- , associative- , associativeOnArbitrary- -- ** Commutativity- , commutativeOnGens- , commutativeOnValids- , commutative- , commutativeOnArbitrary- ) where+ ( module Data.GenValidity,+ forAllValid, -import Data.GenValidity+ -- * Tests for GenValidity instances+ genGeneratesValid, + -- * Standard tests involving functions++ -- ** Standard tests involving validity+ producesValidsOnGen,+ producesValid,+ producesValidsOnArbitrary,+ producesValidsOnGens2,+ producesValid2,+ producesValidsOnArbitrary2,+ producesValidsOnGens3,+ producesValid3,+ producesValidsOnArbitrary3,++ -- ** Standard tests involving functions that can fail+ CanFail (..),+ succeedsOnGen,+ succeeds,+ succeedsOnArbitrary,+ succeedsOnGens2,+ succeeds2,+ succeedsOnArbitrary2,+ failsOnGen,+ failsOnGens2,+ validIfSucceedsOnGen,+ validIfSucceedsOnArbitrary,+ validIfSucceeds,+ validIfSucceedsOnGens2,+ validIfSucceeds2,+ validIfSucceedsOnArbitrary2,+ validIfSucceedsOnGens3,+ validIfSucceeds3,+ validIfSucceedsOnArbitrary3,++ -- ** Standard tests involving equivalence of functions++ -- *** Simple functions++ -- **** One argument+ equivalentOnGen,+ equivalent,+ equivalentOnArbitrary,++ -- **** Two arguments+ equivalentOnGens2,+ equivalent2,+ equivalentOnArbitrary2,++ -- **** Three arguments+ equivalentOnGens3,+ equivalent3,+ equivalentOnArbitrary3,++ -- *** First function can fail++ -- **** One argument+ equivalentWhenFirstSucceedsOnGen,+ equivalentWhenFirstSucceeds,+ equivalentWhenFirstSucceedsOnArbitrary,++ -- **** Two arguments+ equivalentWhenFirstSucceedsOnGens2,+ equivalentWhenFirstSucceeds2,+ equivalentWhenFirstSucceedsOnArbitrary2,++ -- *** Second function can fail++ -- **** One argument+ equivalentWhenSecondSucceedsOnGen,+ equivalentWhenSecondSucceeds,+ equivalentWhenSecondSucceedsOnArbitrary,++ -- **** Two arguments+ equivalentWhenSecondSucceedsOnGens2,+ equivalentWhenSecondSucceeds2,+ equivalentWhenSecondSucceedsOnArbitrary2,++ -- *** Both functions can fail++ -- **** One argument+ equivalentWhenSucceedOnGen,+ equivalentWhenSucceed,+ equivalentWhenSucceedOnArbitrary,++ -- **** Two arguments+ equivalentWhenSucceedOnGens2,+ equivalentWhenSucceed2,+ equivalentWhenSucceedOnArbitrary2,++ -- ** Standard tests involving inverse functions+ inverseFunctionsOnGen,+ inverseFunctions,+ inverseFunctionsOnArbitrary,+ inverseFunctionsIfFirstSucceedsOnGen,+ inverseFunctionsIfFirstSucceeds,+ inverseFunctionsIfFirstSucceedsOnArbitrary,+ inverseFunctionsIfSecondSucceedsOnGen,+ inverseFunctionsIfSecondSucceeds,+ inverseFunctionsIfSecondSucceedsOnArbitrary,+ inverseFunctionsIfSucceedOnGen,+ inverseFunctionsIfSucceed,+ inverseFunctionsIfSucceedOnArbitrary,++ -- ** Properties involving idempotence+ idempotentOnGen,+ idempotent,+ idempotentOnArbitrary,++ -- * Properties of relations++ -- ** Reflexivity+ reflexiveOnElem,+ reflexivityOnGen,+ reflexivity,+ reflexivityOnArbitrary,++ -- ** Transitivity+ transitiveOnElems,+ transitivityOnGens,+ transitivity,+ transitivityOnArbitrary,++ -- ** Antisymmetry+ antisymmetricOnElemsWithEquality,+ antisymmetryOnGensWithEquality,+ antisymmetryOnGens,+ antisymmetry,+ antisymmetryOnArbitrary,++ -- ** Antireflexivity+ antireflexiveOnElem,+ antireflexivityOnGen,+ antireflexivity,+ antireflexivityOnArbitrary,++ -- ** Symmetry+ symmetricOnElems,+ symmetryOnGens,+ symmetry,+ symmetryOnArbitrary,++ -- * Properties of operations++ -- ** Identity element++ -- *** Left Identity+ leftIdentityOnElemWithEquality,+ leftIdentityOnGenWithEquality,+ leftIdentityOnGen,+ leftIdentity,+ leftIdentityOnArbitrary,++ -- *** Right Identity+ rightIdentityOnElemWithEquality,+ rightIdentityOnGenWithEquality,+ rightIdentityOnGen,+ rightIdentity,+ rightIdentityOnArbitrary,++ -- *** Identity+ identityOnGen,+ identity,+ identityOnArbitrary,++ -- ** Associativity+ associativeOnGens,+ associative,+ associativeOnArbitrary,++ -- ** Commutativity+ commutativeOnGens,+ commutative,+ commutativeOnArbitrary,+ )+where++import Data.GenValidity import Test.Validity.Functions import Test.Validity.GenValidity.Property import Test.Validity.Operations
src/Test/Validity/Property/Utils.hs view
@@ -1,36 +1,20 @@-{-# LANGUAGE CPP #-}- module Test.Validity.Property.Utils- ( forAllUnchecked- , forAllValid- , forAllInvalid- , shouldBeValid- , shouldBeInvalid- , (<==>)- , (===>)- ) where+ ( forAllValid,+ shouldBeValid,+ shouldBeInvalid,+ (<==>),+ (===>),+ )+where import Data.GenValidity import Test.Hspec import Test.QuickCheck--#if !MIN_VERSION_base(4,8,0)-import Control.Applicative (pure)-#endif- import Text.Show.Pretty (ppShow) -forAllUnchecked ::- (Show a, GenUnchecked a, Testable prop) => (a -> prop) -> Property-forAllUnchecked = forAllShrink genUnchecked shrinkUnchecked- forAllValid :: (Show a, GenValid a, Testable prop) => (a -> prop) -> Property forAllValid = forAllShrink genValid shrinkValid -forAllInvalid ::- (Show a, GenInvalid a, Testable prop) => (a -> prop) -> Property-forAllInvalid = forAllShrink genInvalid shrinkInvalid- (===>) :: Bool -> Bool -> Bool (===>) a b = not a || b @@ -39,30 +23,30 @@ shouldBeValid :: (Show a, Validity a) => a -> Expectation shouldBeValid a =- case prettyValidate a of- Right _ -> pure ()- Left err ->- expectationFailure $- unlines- [ "'validate' reported this value to be invalid: "- , show a- , "pretty version:"- , ppShow a- , "with explanation:"- , err- , ""- ]+ case prettyValidate a of+ Right _ -> pure ()+ Left err ->+ expectationFailure $+ unlines+ [ "'validate' reported this value to be invalid: ",+ show a,+ "pretty version:",+ ppShow a,+ "with explanation:",+ err,+ ""+ ] shouldBeInvalid :: (Show a, Validity a) => a -> Expectation shouldBeInvalid a =- case prettyValidate a of- Right _ ->- expectationFailure $- unlines- [ "'validate' reported this value to be valid: "- , show a- , "pretty version:"- , ppShow a- , "where we expected it to be invalid"- ]- Left _ -> pure ()+ case prettyValidate a of+ Right _ ->+ expectationFailure $+ unlines+ [ "'validate' reported this value to be valid: ",+ show a,+ "pretty version:",+ ppShow a,+ "where we expected it to be invalid"+ ]+ Left _ -> pure ()
src/Test/Validity/Relations.hs view
@@ -3,33 +3,13 @@ -- | Properties of relations module Test.Validity.Relations- ( reflexiveOnElem- , reflexivityOnGen- , reflexivityOnValid- , reflexivity- , reflexivityOnArbitrary- , transitiveOnElems- , transitivityOnGens- , transitivityOnValid- , transitivity- , transitivityOnArbitrary- , antisymmetricOnElemsWithEquality- , antisymmetryOnGensWithEquality- , antisymmetryOnGens- , antisymmetryOnValid- , antisymmetry- , antisymmetryOnArbitrary- , antireflexiveOnElem- , antireflexivityOnGen- , antireflexivityOnValid- , antireflexivity- , antireflexivityOnArbitrary- , symmetricOnElems- , symmetryOnGens- , symmetryOnValid- , symmetry- , symmetryOnArbitrary- ) where+ ( module Test.Validity.Relations.Antireflexivity,+ module Test.Validity.Relations.Antisymmetry,+ module Test.Validity.Relations.Reflexivity,+ module Test.Validity.Relations.Symmetry,+ module Test.Validity.Relations.Transitivity,+ )+where import Test.Validity.Relations.Antireflexivity import Test.Validity.Relations.Antisymmetry
src/Test/Validity/Relations/Antireflexivity.hs view
@@ -2,15 +2,14 @@ {-# LANGUAGE ScopedTypeVariables #-} module Test.Validity.Relations.Antireflexivity- ( antireflexiveOnElem- , antireflexivityOnGen- , antireflexivityOnValid- , antireflexivity- , antireflexivityOnArbitrary- ) where+ ( antireflexiveOnElem,+ antireflexivityOnGen,+ antireflexivity,+ antireflexivityOnArbitrary,+ )+where import Data.GenValidity- import Test.QuickCheck -- |@@ -21,30 +20,24 @@ -- \forall a: \neg (a \prec a) -- \] antireflexiveOnElem ::- (a -> a -> Bool) -- ^ A relation- -> a -- ^ An element- -> Bool+ -- | A relation+ (a -> a -> Bool) ->+ -- | An element+ a ->+ Bool antireflexiveOnElem func a = not $ func a a antireflexivityOnGen ::- Show a => (a -> a -> Bool) -> Gen a -> (a -> [a]) -> Property+ Show a => (a -> a -> Bool) -> Gen a -> (a -> [a]) -> Property antireflexivityOnGen func gen s = forAllShrink gen s $ antireflexiveOnElem func -- | ----- prop> antireflexivityOnValid ((<) :: Rational -> Rational -> Bool)--- prop> antireflexivityOnValid ((/=) :: Rational -> Rational -> Bool)--- prop> antireflexivityOnValid ((>) :: Rational -> Rational -> Bool)-antireflexivityOnValid :: (Show a, GenValid a) => (a -> a -> Bool) -> Property-antireflexivityOnValid func = antireflexivityOnGen func genValid shrinkValid---- |--- -- prop> antireflexivity ((<) :: Int -> Int -> Bool) -- prop> antireflexivity ((/=) :: Int -> Int -> Bool) -- prop> antireflexivity ((>) :: Int -> Int -> Bool)-antireflexivity :: (Show a, GenUnchecked a) => (a -> a -> Bool) -> Property-antireflexivity func = antireflexivityOnGen func genUnchecked shrinkUnchecked+antireflexivity :: (Show a, GenValid a) => (a -> a -> Bool) -> Property+antireflexivity func = antireflexivityOnGen func genValid shrinkValid -- | --@@ -52,5 +45,5 @@ -- prop> antireflexivityOnArbitrary ((/=) :: Int -> Int -> Bool) -- prop> antireflexivityOnArbitrary ((>) :: Int -> Int -> Bool) antireflexivityOnArbitrary ::- (Show a, Arbitrary a) => (a -> a -> Bool) -> Property+ (Show a, Arbitrary a) => (a -> a -> Bool) -> Property antireflexivityOnArbitrary func = antireflexivityOnGen func arbitrary shrink
src/Test/Validity/Relations/Antisymmetry.hs view
@@ -2,18 +2,16 @@ {-# LANGUAGE ScopedTypeVariables #-} module Test.Validity.Relations.Antisymmetry- ( antisymmetricOnElemsWithEquality- , antisymmetryOnGensWithEquality- , antisymmetryOnGens- , antisymmetryOnValid- , antisymmetry- , antisymmetryOnArbitrary- ) where+ ( antisymmetricOnElemsWithEquality,+ antisymmetryOnGensWithEquality,+ antisymmetryOnGens,+ antisymmetry,+ antisymmetryOnArbitrary,+ )+where import Data.GenValidity- import Test.QuickCheck- import Test.Validity.Property.Utils -- |@@ -24,48 +22,38 @@ -- \forall a, b: ((a \prec b) \wedge (b \prec a)) \Rightarrow (a \doteq b) -- \] antisymmetricOnElemsWithEquality ::- (a -> a -> Bool) -- ^ A relation- -> (a -> a -> Bool) -- ^ An equivalence relation- -> a- -> a -- ^ Two elements- -> Bool+ -- | A relation+ (a -> a -> Bool) ->+ -- | An equivalence relation+ (a -> a -> Bool) ->+ a ->+ -- | Two elements+ a ->+ Bool antisymmetricOnElemsWithEquality func eq a b =- (func a b && func b a) ===> (a `eq` b)+ (func a b && func b a) ===> (a `eq` b) antisymmetryOnGensWithEquality ::- Show a- => (a -> a -> Bool)- -> Gen (a, a)- -> (a -> a -> Bool)- -> (a -> [a])- -> Property+ Show a =>+ (a -> a -> Bool) ->+ Gen (a, a) ->+ (a -> a -> Bool) ->+ (a -> [a]) ->+ Property antisymmetryOnGensWithEquality func gen eq s =- forAllShrink gen (shrinkT2 s) $+ forAllShrink gen (shrinkT2 s) $ uncurry $ antisymmetricOnElemsWithEquality func eq antisymmetryOnGens ::- (Show a, Eq a)- => (a -> a -> Bool)- -> Gen (a, a)- -> (a -> [a])- -> Property+ (Show a, Eq a) =>+ (a -> a -> Bool) ->+ Gen (a, a) ->+ (a -> [a]) ->+ Property antisymmetryOnGens func gen = antisymmetryOnGensWithEquality func gen (==) -- | ----- prop> antisymmetryOnValid ((>) :: Double -> Double -> Bool)--- prop> antisymmetryOnValid ((>=) :: Double -> Double -> Bool)--- prop> antisymmetryOnValid ((<=) :: Double -> Double -> Bool)--- prop> antisymmetryOnValid ((<) :: Double -> Double -> Bool)--- prop> antisymmetryOnValid (Data.List.isPrefixOf :: [Double] -> [Double] -> Bool)--- prop> antisymmetryOnValid (Data.List.isSuffixOf :: [Double] -> [Double] -> Bool)--- prop> antisymmetryOnValid (Data.List.isInfixOf :: [Double] -> [Double] -> Bool)-antisymmetryOnValid ::- (Show a, Eq a, GenValid a) => (a -> a -> Bool) -> Property-antisymmetryOnValid func = antisymmetryOnGens func genValid shrinkValid---- |--- -- prop> antisymmetry ((>) :: Int -> Int -> Bool) -- prop> antisymmetry ((>=) :: Int -> Int -> Bool) -- prop> antisymmetry ((<=) :: Int -> Int -> Bool)@@ -74,8 +62,8 @@ -- prop> antisymmetry (Data.List.isSuffixOf :: [Int] -> [Int] -> Bool) -- prop> antisymmetry (Data.List.isInfixOf :: [Int] -> [Int] -> Bool) -- prop> antisymmetry ((\x y -> even x && odd y) :: Int -> Int -> Bool)-antisymmetry :: (Show a, Eq a, GenUnchecked a) => (a -> a -> Bool) -> Property-antisymmetry func = antisymmetryOnGens func genUnchecked shrinkUnchecked+antisymmetry :: (Show a, Eq a, GenValid a) => (a -> a -> Bool) -> Property+antisymmetry func = antisymmetryOnGens func genValid shrinkValid -- | --@@ -88,5 +76,5 @@ -- prop> antisymmetryOnArbitrary (Data.List.isInfixOf :: [Int] -> [Int] -> Bool) -- prop> antisymmetryOnArbitrary ((\x y -> even x && odd y) :: Int -> Int -> Bool) antisymmetryOnArbitrary ::- (Show a, Eq a, Arbitrary a) => (a -> a -> Bool) -> Property+ (Show a, Eq a, Arbitrary a) => (a -> a -> Bool) -> Property antisymmetryOnArbitrary func = antisymmetryOnGens func arbitrary shrink
src/Test/Validity/Relations/Reflexivity.hs view
@@ -2,15 +2,14 @@ {-# LANGUAGE ScopedTypeVariables #-} module Test.Validity.Relations.Reflexivity- ( reflexiveOnElem- , reflexivityOnGen- , reflexivityOnValid- , reflexivity- , reflexivityOnArbitrary- ) where+ ( reflexiveOnElem,+ reflexivityOnGen,+ reflexivity,+ reflexivityOnArbitrary,+ )+where import Data.GenValidity- import Test.QuickCheck -- |@@ -21,36 +20,27 @@ -- \forall a: (a \prec a) -- \] reflexiveOnElem ::- (a -> a -> Bool) -- ^ A relation- -> a -- ^ An element- -> Bool+ -- | A relation+ (a -> a -> Bool) ->+ -- | An element+ a ->+ Bool reflexiveOnElem func a = func a a reflexivityOnGen ::- Show a => (a -> a -> Bool) -> Gen a -> (a -> [a]) -> Property+ Show a => (a -> a -> Bool) -> Gen a -> (a -> [a]) -> Property reflexivityOnGen func gen s = forAllShrink gen s $ reflexiveOnElem func -- | ----- prop> reflexivityOnValid ((<=) :: Rational -> Rational -> Bool)--- prop> reflexivityOnValid ((==) :: Rational -> Rational -> Bool)--- prop> reflexivityOnValid ((>=) :: Rational -> Rational -> Bool)--- prop> reflexivityOnValid (Data.List.isPrefixOf :: [Rational] -> [Rational] -> Bool)--- prop> reflexivityOnValid (Data.List.isSuffixOf :: [Rational] -> [Rational] -> Bool)--- prop> reflexivityOnValid (Data.List.isInfixOf :: [Rational] -> [Rational] -> Bool)-reflexivityOnValid :: (Show a, GenValid a) => (a -> a -> Bool) -> Property-reflexivityOnValid func = reflexivityOnGen func genValid shrinkValid---- |--- -- prop> reflexivity ((<=) :: Int -> Int -> Bool) -- prop> reflexivity ((==) :: Int -> Int -> Bool) -- prop> reflexivity ((>=) :: Int -> Int -> Bool) -- prop> reflexivity (Data.List.isPrefixOf :: [Int] -> [Int] -> Bool) -- prop> reflexivity (Data.List.isSuffixOf :: [Int] -> [Int] -> Bool) -- prop> reflexivity (Data.List.isInfixOf :: [Int] -> [Int] -> Bool)-reflexivity :: (Show a, GenUnchecked a) => (a -> a -> Bool) -> Property-reflexivity func = reflexivityOnGen func genUnchecked shrinkUnchecked+reflexivity :: (Show a, GenValid a) => (a -> a -> Bool) -> Property+reflexivity func = reflexivityOnGen func genValid shrinkValid -- | --
src/Test/Validity/Relations/Symmetry.hs view
@@ -2,17 +2,15 @@ {-# LANGUAGE ScopedTypeVariables #-} module Test.Validity.Relations.Symmetry- ( symmetricOnElems- , symmetryOnGens- , symmetryOnValid- , symmetry- , symmetryOnArbitrary- ) where+ ( symmetricOnElems,+ symmetryOnGens,+ symmetry,+ symmetryOnArbitrary,+ )+where import Data.GenValidity- import Test.QuickCheck- import Test.Validity.Property.Utils -- |@@ -23,30 +21,25 @@ -- \forall a, b: (a \prec b) \Leftrightarrow (b \prec a) -- \] symmetricOnElems ::- (a -> a -> Bool) -- ^ A relation- -> a- -> a -- ^ Two elements- -> Bool+ -- | A relation+ (a -> a -> Bool) ->+ a ->+ -- | Two elements+ a ->+ Bool symmetricOnElems func a b = func a b <==> func b a symmetryOnGens ::- Show a => (a -> a -> Bool) -> Gen (a, a) -> (a -> [a]) -> Property+ Show a => (a -> a -> Bool) -> Gen (a, a) -> (a -> [a]) -> Property symmetryOnGens func gen s =- forAllShrink gen (shrinkT2 s) $ uncurry $ symmetricOnElems func---- |------ prop> symmetryOnValid ((==) :: Double -> Double -> Bool)--- prop> symmetryOnValid ((/=) :: Double -> Double -> Bool)-symmetryOnValid :: (Show a, GenValid a) => (a -> a -> Bool) -> Property-symmetryOnValid func = symmetryOnGens func genValid shrinkValid+ forAllShrink gen (shrinkT2 s) $ uncurry $ symmetricOnElems func -- | -- -- prop> symmetry ((==) :: Int -> Int -> Bool) -- prop> symmetry ((/=) :: Int -> Int -> Bool)-symmetry :: (Show a, GenUnchecked a) => (a -> a -> Bool) -> Property-symmetry func = symmetryOnGens func genUnchecked shrinkUnchecked+symmetry :: (Show a, GenValid a) => (a -> a -> Bool) -> Property+symmetry func = symmetryOnGens func genValid shrinkValid -- | --
src/Test/Validity/Relations/Transitivity.hs view
@@ -2,17 +2,15 @@ {-# LANGUAGE ScopedTypeVariables #-} module Test.Validity.Relations.Transitivity- ( transitiveOnElems- , transitivityOnGens- , transitivityOnValid- , transitivity- , transitivityOnArbitrary- ) where+ ( transitiveOnElems,+ transitivityOnGens,+ transitivity,+ transitivityOnArbitrary,+ )+where import Data.GenValidity- import Test.QuickCheck- import Test.Validity.Property.Utils -- |@@ -23,30 +21,19 @@ -- \forall a, b, c: ((a \prec b) \wedge (b \prec c)) \Rightarrow (a \prec c) -- \] transitiveOnElems ::- (a -> a -> Bool) -- ^ A relation- -> a- -> a- -> a -- ^ Three elements- -> Bool+ -- | A relation+ (a -> a -> Bool) ->+ a ->+ a ->+ -- | Three elements+ a ->+ Bool transitiveOnElems func a b c = (func a b && func b c) ===> func a c transitivityOnGens ::- Show a => (a -> a -> Bool) -> Gen (a, a, a) -> (a -> [a]) -> Property+ Show a => (a -> a -> Bool) -> Gen (a, a, a) -> (a -> [a]) -> Property transitivityOnGens func gen s =- forAllShrink gen (shrinkT3 s) $ \(a, b, c) -> transitiveOnElems func a b c---- |------ prop> transitivityOnValid ((>) :: Double -> Double -> Bool)--- prop> transitivityOnValid ((>=) :: Double -> Double -> Bool)--- prop> transitivityOnValid ((==) :: Double -> Double -> Bool)--- prop> transitivityOnValid ((<=) :: Double -> Double -> Bool)--- prop> transitivityOnValid ((<) :: Double -> Double -> Bool)--- prop> transitivityOnValid (Data.List.isPrefixOf :: [Double] -> [Double] -> Bool)--- prop> transitivityOnValid (Data.List.isSuffixOf :: [Double] -> [Double] -> Bool)--- prop> transitivityOnValid (Data.List.isInfixOf :: [Double] -> [Double] -> Bool)-transitivityOnValid :: (Show a, GenValid a) => (a -> a -> Bool) -> Property-transitivityOnValid func = transitivityOnGens func genValid shrinkValid+ forAllShrink gen (shrinkT3 s) $ \(a, b, c) -> transitiveOnElems func a b c -- | --@@ -58,8 +45,8 @@ -- prop> transitivity (Data.List.isPrefixOf :: [Int] -> [Int] -> Bool) -- prop> transitivity (Data.List.isSuffixOf :: [Int] -> [Int] -> Bool) -- prop> transitivity (Data.List.isInfixOf :: [Int] -> [Int] -> Bool)-transitivity :: (Show a, GenUnchecked a) => (a -> a -> Bool) -> Property-transitivity func = transitivityOnGens func genUnchecked shrinkUnchecked+transitivity :: (Show a, GenValid a) => (a -> a -> Bool) -> Property+transitivity func = transitivityOnGens func genValid shrinkValid -- | --
src/Test/Validity/Shrinking/Property.hs view
@@ -1,201 +1,161 @@-{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE AllowAmbiguousTypes #-}+{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE ScopedTypeVariables #-} -- | Tests for shrinking functions module Test.Validity.Shrinking.Property- ( shrinkPreservesValidOnGenValid- , shrinkPreservesInvalidOnGenInvalid- , shrinkValidPreservesValid- , shrinkInvalidPreservesInvalid- , shrinkingStaysValid- , shrinkingStaysValidWithLimit- , shrinkingStaysInvalid- , shrinkingPreserves- , shrinkingPreservesWithLimit- , shrinkDoesNotShrinkToItself- , shrinkDoesNotShrinkToItselfWithLimit- , shrinkDoesNotShrinkToItselfOnValid- , shrinkDoesNotShrinkToItselfOnValidWithLimit- , shrinkDoesNotShrinkToItselfOnInvalid- , shrinkDoesNotShrinkToItselfOnInvalidWithLimit- , doesNotShrinkToItself- , doesNotShrinkToItselfWithLimit- ) where+ ( shrinkPreservesValidOnGenValid,+ shrinkValidPreservesValid,+ shrinkingStaysValid,+ shrinkingStaysValidWithLimit,+ shrinkingPreserves,+ shrinkingPreservesWithLimit,+ shrinkDoesNotShrinkToItself,+ shrinkDoesNotShrinkToItselfWithLimit,+ shrinkDoesNotShrinkToItselfOnValid,+ shrinkDoesNotShrinkToItselfOnValidWithLimit,+ doesNotShrinkToItself,+ doesNotShrinkToItselfWithLimit,+ )+where import Data.GenValidity- import Test.QuickCheck -- | -- -- prop> shrinkPreservesValidOnGenValid ((:[]) :: Int -> [Int]) shrinkPreservesValidOnGenValid ::- forall a. (Show a, GenValid a)- => (a -> [a])- -> Property+ forall a.+ (Show a, GenValid a) =>+ (a -> [a]) ->+ Property shrinkPreservesValidOnGenValid = shrinkingStaysValid genValid -- | ----- prop> shrinkPreservesInvalidOnGenInvalid ((:[]) :: Rational -> [Rational])-shrinkPreservesInvalidOnGenInvalid ::- forall a. (Show a, GenInvalid a)- => (a -> [a])- -> Property-shrinkPreservesInvalidOnGenInvalid = shrinkingStaysValid genInvalid---- |--- -- prop> shrinkValidPreservesValid (pure 5 :: Gen Rational) shrinkValidPreservesValid ::- forall a. (Show a, GenValid a)- => Gen a- -> Property+ forall a.+ (Show a, GenValid a) =>+ Gen a ->+ Property shrinkValidPreservesValid gen = shrinkingStaysValid gen shrinkValid -- | ---shrinkInvalidPreservesInvalid ::- forall a. (Show a, GenInvalid a)- => Gen a- -> Property-shrinkInvalidPreservesInvalid gen = shrinkingStaysValid gen shrinkInvalid---- |--- -- prop> shrinkingStaysValid (pure 5 :: Gen Double) (\d -> [d - 1, d - 2]) shrinkingStaysValid ::- forall a. (Show a, Validity a)- => Gen a- -> (a -> [a])- -> Property+ forall a.+ (Show a, Validity a) =>+ Gen a ->+ (a -> [a]) ->+ Property shrinkingStaysValid gen s = shrinkingPreserves gen s isValid -- | -- -- prop> shrinkingStaysValidWithLimit (pure 5 :: Gen Double) (\d -> [d - 1, read "NaN"]) 1 shrinkingStaysValidWithLimit ::- forall a. (Show a, Validity a)- => Gen a- -> (a -> [a])- -> Int- -> Property+ forall a.+ (Show a, Validity a) =>+ Gen a ->+ (a -> [a]) ->+ Int ->+ Property shrinkingStaysValidWithLimit gen s l =- shrinkingPreservesWithLimit gen s l isValid---- |------ prop> shrinkingStaysInvalid (pure (1/0) :: Gen Double) (:[])-shrinkingStaysInvalid ::- forall a. (Show a, Validity a)- => Gen a- -> (a -> [a])- -> Property-shrinkingStaysInvalid gen s = shrinkingPreserves gen s isInvalid+ shrinkingPreservesWithLimit gen s l isValid -- | -- -- prop> shrinkingPreserves (pure 5 :: Gen Int) (:[]) (== 5) shrinkingPreserves ::- forall a. Show a- => Gen a- -> (a -> [a])- -> (a -> Bool)- -> Property+ forall a.+ Show a =>+ Gen a ->+ (a -> [a]) ->+ (a -> Bool) ->+ Property shrinkingPreserves gen s p = forAll gen $ \d -> not (p d) || all p (s d) -- | -- -- prop> shrinkingPreservesWithLimit (pure 4) (:[]) 100 (== 4) shrinkingPreservesWithLimit ::- forall a. Show a- => Gen a- -> (a -> [a])- -> Int- -> (a -> Bool)- -> Property+ forall a.+ Show a =>+ Gen a ->+ (a -> [a]) ->+ Int ->+ (a -> Bool) ->+ Property shrinkingPreservesWithLimit gen s l p =- forAll gen $ \d -> not (p d) || all p (take l $ s d)+ forAll gen $ \d -> not (p d) || all p (take l $ s d) -- | ----- prop> shrinkDoesNotShrinkToItself (shrinkUnchecked :: Double -> [Double])+-- prop> shrinkDoesNotShrinkToItself (shrinkValid :: Double -> [Double]) shrinkDoesNotShrinkToItself ::- forall a. (Show a, Eq a, GenUnchecked a)- => (a -> [a])- -> Property-shrinkDoesNotShrinkToItself = doesNotShrinkToItself genUnchecked+ forall a.+ (Show a, Eq a, GenValid a) =>+ (a -> [a]) ->+ Property+shrinkDoesNotShrinkToItself = doesNotShrinkToItself genValid -- | ----- prop> shrinkDoesNotShrinkToItselfWithLimit (shrinkUnchecked :: Double -> [Double]) 100+-- prop> shrinkDoesNotShrinkToItselfWithLimit (shrinkValid :: Double -> [Double]) 100 shrinkDoesNotShrinkToItselfWithLimit ::- forall a. (Show a, Eq a, GenUnchecked a)- => (a -> [a])- -> Int- -> Property+ forall a.+ (Show a, Eq a, GenValid a) =>+ (a -> [a]) ->+ Int ->+ Property shrinkDoesNotShrinkToItselfWithLimit =- doesNotShrinkToItselfWithLimit genUnchecked+ doesNotShrinkToItselfWithLimit genValid -- | -- -- prop> shrinkDoesNotShrinkToItselfOnValid (shrinkValid :: Rational -> [Rational]) shrinkDoesNotShrinkToItselfOnValid ::- forall a. (Show a, Eq a, GenValid a)- => (a -> [a])- -> Property+ forall a.+ (Show a, Eq a, GenValid a) =>+ (a -> [a]) ->+ Property shrinkDoesNotShrinkToItselfOnValid = doesNotShrinkToItself genValid -- | -- -- prop> shrinkDoesNotShrinkToItselfOnValidWithLimit (shrinkValid :: Rational -> [Rational]) 100 shrinkDoesNotShrinkToItselfOnValidWithLimit ::- forall a. (Show a, Eq a, GenValid a)- => (a -> [a])- -> Int- -> Property+ forall a.+ (Show a, Eq a, GenValid a) =>+ (a -> [a]) ->+ Int ->+ Property shrinkDoesNotShrinkToItselfOnValidWithLimit =- doesNotShrinkToItselfWithLimit genValid---- |------ prop> shrinkDoesNotShrinkToItselfOnInvalid (shrinkInvalid :: Rational -> [Rational])-shrinkDoesNotShrinkToItselfOnInvalid ::- forall a. (Show a, Eq a, GenInvalid a)- => (a -> [a])- -> Property-shrinkDoesNotShrinkToItselfOnInvalid = doesNotShrinkToItself genInvalid---- |------ prop> shrinkDoesNotShrinkToItselfOnInvalidWithLimit (shrinkInvalid :: Rational -> [Rational]) 100-shrinkDoesNotShrinkToItselfOnInvalidWithLimit ::- forall a. (Show a, Eq a, GenInvalid a)- => (a -> [a])- -> Int- -> Property-shrinkDoesNotShrinkToItselfOnInvalidWithLimit =- doesNotShrinkToItselfWithLimit genInvalid+ doesNotShrinkToItselfWithLimit genValid -- | ----- prop> doesNotShrinkToItself (pure 5 :: Gen Double) shrinkUnchecked+-- prop> doesNotShrinkToItself (pure 5 :: Gen Double) shrinkValid doesNotShrinkToItself ::- forall a. (Show a, Eq a)- => Gen a- -> (a -> [a])- -> Property-doesNotShrinkToItself gen s = forAll gen $ \a -> all (/= a) $ s a+ forall a.+ (Show a, Eq a) =>+ Gen a ->+ (a -> [a]) ->+ Property+doesNotShrinkToItself gen s = forAll gen $ \a -> notElem a $ s a -- | ----- prop> doesNotShrinkToItselfWithLimit (pure 5 :: Gen Double) shrinkUnchecked 100+-- prop> doesNotShrinkToItselfWithLimit (pure 5 :: Gen Double) shrinkValid 100 doesNotShrinkToItselfWithLimit ::- forall a. (Show a, Eq a)- => Gen a- -> (a -> [a])- -> Int- -> Property+ forall a.+ (Show a, Eq a) =>+ Gen a ->+ (a -> [a]) ->+ Int ->+ Property doesNotShrinkToItselfWithLimit gen s l =- forAll gen $ \a -> all (/= a) $ take l $ s a+ forAll gen $ \a -> notElem a $ take l $ s a
src/Test/Validity/Types.hs view
@@ -2,22 +2,23 @@ {-# LANGUAGE ScopedTypeVariables #-} module Test.Validity.Types- ( CanFail(..)- ) where+ ( CanFail (..),+ )+where -- | A class of types that are the result of functions that can fail class CanFail f where- hasFailed :: f a -> Bool- resultIfSucceeded :: f a -> Maybe a+ hasFailed :: f a -> Bool+ resultIfSucceeded :: f a -> Maybe a instance CanFail Maybe where- hasFailed Nothing = True- hasFailed _ = False- resultIfSucceeded Nothing = Nothing- resultIfSucceeded (Just r) = Just r+ hasFailed Nothing = True+ hasFailed _ = False+ resultIfSucceeded Nothing = Nothing+ resultIfSucceeded (Just r) = Just r instance CanFail (Either e) where- hasFailed (Left _) = True- hasFailed _ = False- resultIfSucceeded (Left _) = Nothing- resultIfSucceeded (Right r) = Just r+ hasFailed (Left _) = True+ hasFailed _ = False+ resultIfSucceeded (Left _) = Nothing+ resultIfSucceeded (Right r) = Just r
+ test/Spec.hs view
@@ -0,0 +1,1 @@+{-# OPTIONS_GHC -F -pgmF hspec-discover #-}
+ test/Test/Validity/Operations/CommutativitySpec.hs view
@@ -0,0 +1,32 @@+{-# LANGUAGE TypeApplications #-}++module Test.Validity.Operations.CommutativitySpec+ ( spec,+ )+where++import Data.GenValidity (GenValid)+import Test.Hspec+import Test.QuickCheck+import Test.Validity.Operations.Commutativity (commutative)++spec :: Spec+spec = do+ describe "commutative" $ do+ specify "+ is commutative" $ commutative @Int (+)+ specify "* is commutative" $ commutative @Int (*)+ specify "dot product is commutative" $ commutative dotProduct++ specify "- is not commutative" $ notCommmutative @Int (-)+ specify "cross product is not commutative" $ notCommmutative crossProduct++notCommmutative :: (Show a, Show b, Eq b, GenValid a) => (a -> a -> b) -> Property+notCommmutative op = expectFailure (commutative op)++type Point = (Int, Int)++dotProduct :: Point -> Point -> Int+dotProduct (x1, y1) (x2, y2) = x1 * x2 + y1 * y2++crossProduct :: Point -> Point -> Int+crossProduct (x1, y1) (x2, y2) = x1 * y2 - x2 * y1