genvalidity-hspec 0.6.0.3 → 0.6.1.0
raw patch · 5 files changed
+33/−12 lines, 5 files
Files
- genvalidity-hspec.cabal +5/−4
- src/Test/Validity.hs +1/−0
- src/Test/Validity/Eq.hs +6/−6
- src/Test/Validity/Monad.hs +4/−2
- src/Test/Validity/Shrinking.hs +17/−0
genvalidity-hspec.cabal view
@@ -1,11 +1,11 @@--- This file has been generated from package.yaml by hpack version 0.20.0.+-- This file has been generated from package.yaml by hpack version 0.28.2. -- -- see: https://github.com/sol/hpack ----- hash: 7ef2d28c83276414e6f8b35d7b5532f3a301da3d4fa6921c757bc541357f41bd+-- hash: 963ec860fbcd5ff6bc1148b8abc7c91d1bf7a7ef77e0ed0181ffc136b6e37005 name: genvalidity-hspec-version: 0.6.0.3+version: 0.6.1.0 synopsis: Standard spec's for GenValidity instances description: Note: There are companion packages for this library: .@@ -20,7 +20,8 @@ homepage: https://github.com/NorfairKing/validity#readme bug-reports: https://github.com/NorfairKing/validity/issues author: Tom Sydney Kerckhove-maintainer: syd.kerckhove@gmail.com+maintainer: syd.kerckhove@gmail.com,+ nick.van.den.broeck666@gmail.com copyright: Copyright: (c) 2016-2018 Tom Sydney Kerckhove license: MIT license-file: LICENSE
src/Test/Validity.hs view
@@ -22,6 +22,7 @@ , genGeneratesInvalid , shrinkValiditySpec , shrinkValidSpec+ , shrinkValidSpecWithLimit , shrinkInvalidSpec , shrinkValidPreservesValidOnGenValid , shrinkInvalidPreservesInvalidOnGenInvalid
src/Test/Validity/Eq.hs view
@@ -102,28 +102,28 @@ (unwords [ "is reflexive for" , "\"" ++ genname- , name ++ "\"" ++ "'s"+ , name ++ "\"" ++ "s" ]) $ reflexivityOnGen eq gen s it (unwords [ "is symmetric for" , "\"" ++ genname- , name ++ "\"" ++ "'s"+ , name ++ "\"" ++ "s" ]) $ symmetryOnGens eq gen2 s it (unwords [ "is transitive for" , "\"" ++ genname- , name ++ "\"" ++ "'s"+ , name ++ "\"" ++ "s" ]) $ transitivityOnGens eq gen3 s it (unwords [ "is equivalent to (\\a b -> not $ a /= b) for" , "\"" ++ genname- , name ++ "\"" ++ "'s"+ , name ++ "\"" ++ "s" ]) $ equivalentOnGens2 eq (\a b -> not $ a `neq` b) gen2 s2 describe funneqstr $ do@@ -131,13 +131,13 @@ (unwords [ "is antireflexive for" , "\"" ++ genname- , name ++ "\"" ++ "'s"+ , name ++ "\"" ++ "s" ]) $ antireflexivityOnGen neq gen s it (unwords [ "is equivalent to (\\a b -> not $ a == b) for" , "\"" ++ genname- , name ++ "\"" ++ "'s"+ , name ++ "\"" ++ "s" ]) $ equivalentOnGens2 neq (\a b -> not $ a `eq` b) gen2 s2
src/Test/Validity/Monad.hs view
@@ -29,6 +29,8 @@ {-# ANN module "HLint: ignore Use fmap" #-} +{-# ANN module "HLint: ignore Use <$>" #-}+ {-# ANN module "HLint: ignore Use >=>" #-} {-# ANN module "HLint: ignore Use id" #-}@@ -69,7 +71,7 @@ -- -- Example usage: ----- > monadSpecOnArbitrary @[]+-- > monadSpecOnValid @[] monadSpecOnValid :: forall (f :: * -> *). (Eq (f Int), Show (f Int), Monad f, Typeable f, GenValid (f Int))@@ -80,7 +82,7 @@ -- -- Example usage: ----- > monadSpecOnArbitrary @[]+-- > monadSpec @[] monadSpec :: forall (f :: * -> *). (Eq (f Int), Show (f Int), Monad f, Typeable f, GenUnchecked (f Int))
src/Test/Validity/Shrinking.hs view
@@ -9,6 +9,7 @@ module Test.Validity.Shrinking ( shrinkValiditySpec , shrinkValidSpec+ , shrinkValidSpecWithLimit , shrinkInvalidSpec , shrinkValidPreservesValidOnGenValid , shrinkInvalidPreservesInvalidOnGenInvalid@@ -45,6 +46,15 @@ describe ("shrinkValid :: " ++ nameOf @(a -> [a])) $ it "preserves validity" $ shrinkValidPreservesValidOnGenValid @a +shrinkValidSpecWithLimit ::+ forall a. (Show a, Typeable a, GenValid a)+ => Int+ -> Spec+shrinkValidSpecWithLimit l =+ describe ("shrinkValid :: " ++ nameOf @(a -> [a])) $+ it (unwords ["preserves validity for the first", show l, "elements"]) $+ shrinkValidPreservesValidOnGenValidWithLimit @a l+ shrinkInvalidSpec :: forall a. (Show a, Typeable a, GenInvalid a) => Spec@@ -57,6 +67,13 @@ => Property shrinkValidPreservesValidOnGenValid = shrinkingStaysValid @a genValid shrinkValid++shrinkValidPreservesValidOnGenValidWithLimit ::+ forall a. (Show a, GenValid a)+ => Int+ -> Property+shrinkValidPreservesValidOnGenValidWithLimit =+ shrinkingStaysValidWithLimit @a genValid shrinkValid shrinkInvalidPreservesInvalidOnGenInvalid :: forall a. (Show a, GenInvalid a)