Hello community, here is the log from the commit of package ghc-genvalidity for openSUSE:Factory checked in at 2017-04-14 13:37:52 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/ghc-genvalidity (Old) and /work/SRC/openSUSE:Factory/.ghc-genvalidity.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-genvalidity" Fri Apr 14 13:37:52 2017 rev:2 rq:485128 version:0.3.2.0 Changes: -------- --- /work/SRC/openSUSE:Factory/ghc-genvalidity/ghc-genvalidity.changes 2017-03-24 02:06:37.231710306 +0100 +++ /work/SRC/openSUSE:Factory/.ghc-genvalidity.new/ghc-genvalidity.changes 2017-04-14 13:37:53.997874330 +0200 @@ -1,0 +2,10 @@ +Wed Mar 22 09:14:59 UTC 2017 - psim...@suse.com + +- Update to version 0.3.2.0 revision 1 with cabal2obs. + +------------------------------------------------------------------- +Fri Feb 24 10:30:11 UTC 2017 - psim...@suse.com + +- Update to version 0.3.1.0 with cabal2obs. + +------------------------------------------------------------------- Old: ---- genvalidity-0.2.0.4.tar.gz New: ---- genvalidity-0.3.2.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ ghc-genvalidity.spec ++++++ --- /var/tmp/diff_new_pack.nOpiIU/_old 2017-04-14 13:37:54.621786154 +0200 +++ /var/tmp/diff_new_pack.nOpiIU/_new 2017-04-14 13:37:54.625785588 +0200 @@ -1,7 +1,7 @@ # # spec file for package ghc-genvalidity # -# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,14 +19,14 @@ %global pkg_name genvalidity %bcond_with tests Name: ghc-%{pkg_name} -Version: 0.2.0.4 +Version: 0.3.2.0 Release: 0 Summary: Testing utilities for the validity library License: MIT Group: Development/Languages/Other Url: https://hackage.haskell.org/package/%{pkg_name} Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz -Source1: https://hackage.haskell.org/package/%{pkg_name}-%{version}/revision/2.cabal#/%{pkg_name}.cabal +Source1: https://hackage.haskell.org/package/%{pkg_name}-%{version}/revision/1.cabal#/%{pkg_name}.cabal BuildRequires: ghc-Cabal-devel BuildRequires: ghc-QuickCheck-devel BuildRequires: ghc-rpm-macros @@ -41,8 +41,12 @@ * <https://hackage.haskell.org/package/genvalidity-text genvalidity-text> +* <https://hackage.haskell.org/package/genvalidity-time genvalidity-time> + * <https://hackage.haskell.org/package/genvalidity-containers -genvalidity-containers>. +genvalidity-containers> + +* <https://hackage.haskell.org/package/genvalidity-path genvalidity-path>. %package devel Summary: Haskell %{pkg_name} library development files ++++++ genvalidity-0.2.0.4.tar.gz -> genvalidity-0.3.2.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/genvalidity-0.2.0.4/Setup.hs new/genvalidity-0.3.2.0/Setup.hs --- old/genvalidity-0.2.0.4/Setup.hs 2016-09-30 10:49:08.000000000 +0200 +++ new/genvalidity-0.3.2.0/Setup.hs 2017-02-19 22:34:59.000000000 +0100 @@ -1,2 +1,3 @@ import Distribution.Simple + main = defaultMain diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/genvalidity-0.2.0.4/genvalidity.cabal new/genvalidity-0.3.2.0/genvalidity.cabal --- old/genvalidity-0.2.0.4/genvalidity.cabal 2016-09-30 10:50:06.000000000 +0200 +++ new/genvalidity-0.3.2.0/genvalidity.cabal 2017-03-17 16:47:32.000000000 +0100 @@ -1,56 +1,53 @@ -name: genvalidity -version: 0.2.0.4 -synopsis: Testing utilities for the validity library +name: genvalidity +version: 0.3.2.0 +cabal-version: >=1.10 +build-type: Simple +license: MIT +license-file: LICENSE +copyright: Copyright: (c) 2016 Tom Sydney Kerckhove +maintainer: syd.kerckh...@gmail.com +homepage: https://github.com/NorfairKing/validity#readme +synopsis: Testing utilities for the validity library description: - Note: There are companion instance packages for this library: - . - * <https://hackage.haskell.org/package/genvalidity-text genvalidity-text> - . - * <https://hackage.haskell.org/package/genvalidity-containers genvalidity-containers> + Note: There are companion instance packages for this library: + . + * <https://hackage.haskell.org/package/genvalidity-text genvalidity-text> + . + * <https://hackage.haskell.org/package/genvalidity-time genvalidity-time> + . + * <https://hackage.haskell.org/package/genvalidity-containers genvalidity-containers> + . + * <https://hackage.haskell.org/package/genvalidity-path genvalidity-path> +category: Testing +author: Tom Sydney Kerckhove -homepage: https://github.com/NorfairKing/validity#readme -license: MIT -license-file: LICENSE -author: Tom Sydney Kerckhove -maintainer: syd.kerckh...@gmail.com -copyright: Copyright: (c) 2016 Tom Sydney Kerckhove -category: Testing -build-type: Simple --- extra-source-files: -cabal-version: >=1.10 +source-repository head + type: git + location: https://github.com/NorfairKing/validity library - hs-source-dirs: src - exposed-modules: Data.GenValidity - , Data.GenRelativeValidity - build-depends: base < 5 - , validity >= 0.3 && < 0.4 - , QuickCheck >= 2.8 && < 2.10 - default-language: Haskell2010 + exposed-modules: + Data.GenValidity + Data.GenRelativeValidity + build-depends: + base >= 4.7 && <5, + validity >=0.3 && <0.4, + QuickCheck >=2.7 && <2.10 + default-language: Haskell2010 + hs-source-dirs: src + if impl(ghc >= 8.0.0) + ghc-options: -Wno-redundant-constraints test-suite genvalidity-test - type: - exitcode-stdio-1.0 - default-language: - Haskell2010 - hs-source-dirs: - test - main-is: - Spec.hs - other-modules: - Data.GenValiditySpec - ghc-options: - -threaded -rtsopts -with-rtsopts=-N - -Wall - -fno-warn-name-shadowing - build-depends: - base - - , hspec - , QuickCheck >= 2.8 && < 2.9 - - , genvalidity - -source-repository head - type: git - location: https://github.com/NorfairKing/validity + type: exitcode-stdio-1.0 + main-is: Spec.hs + build-depends: + base -any, + hspec -any, + QuickCheck, + genvalidity -any + default-language: Haskell2010 + hs-source-dirs: test + other-modules: + Data.GenValiditySpec + ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -fno-warn-name-shadowing diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/genvalidity-0.2.0.4/src/Data/GenRelativeValidity.hs new/genvalidity-0.3.2.0/src/Data/GenRelativeValidity.hs --- old/genvalidity-0.2.0.4/src/Data/GenRelativeValidity.hs 2016-09-30 10:49:08.000000000 +0200 +++ new/genvalidity-0.3.2.0/src/Data/GenRelativeValidity.hs 2017-03-17 15:18:14.000000000 +0100 @@ -1,20 +1,26 @@ {-# LANGUAGE MultiParamTypeClasses #-} + module Data.GenRelativeValidity ( module Data.RelativeValidity , module Data.GenRelativeValidity ) where -import Data.RelativeValidity -import Data.GenValidity +import Data.GenValidity +import Data.RelativeValidity -import Test.QuickCheck +import Test.QuickCheck -class (GenValidity a, RelativeValidity a b) => GenRelativeValidity a b where +class (GenUnchecked a, RelativeValidity a b) => + GenRelativeUnchecked a b where genUncheckedFor :: b -> Gen a genUncheckedFor _ = genUnchecked +class (GenValid a, RelativeValidity a b) => + GenRelativeValid a b where genValidFor :: b -> Gen a genValidFor b = genValid `suchThat` (`isValidFor` b) +class (GenUnchecked a, RelativeValidity a b, GenRelativeUnchecked a b) => + GenRelativeInvalid a b where genInvalidFor :: b -> Gen a genInvalidFor b = genUncheckedFor b `suchThat` (not . (`isValidFor` b)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/genvalidity-0.2.0.4/src/Data/GenValidity.hs new/genvalidity-0.3.2.0/src/Data/GenValidity.hs --- old/genvalidity-0.2.0.4/src/Data/GenValidity.hs 2016-09-30 10:49:08.000000000 +0200 +++ new/genvalidity-0.3.2.0/src/Data/GenValidity.hs 2017-03-17 16:47:32.000000000 +0100 @@ -10,21 +10,23 @@ @(Prime <$> arbitrary) `suchThat` isValid@ but this is tedious and inefficient. - The @GenValidity@ type class allows you to specify how to (efficiently) - generate data of the given type to allow for easier and quicker testing. - Just implementing @genUnchecked@ already gives you access to @genValid@ and - @genInvalid@ but writing custom implementations of these functions may speed - up the generation of data. + The @GenValid@ type class allows you to specify how to (efficiently) + generate valid data of the given type to allow for easier and quicker testing. + Just instantiating @GenUnchecked@ already gives you access to a default instance + of @GenValid@ and @GenInvalid@ but writing custom implementations of these functions + may speed up the generation of data. For example, to generate primes, we don't have to consider even numbers other than 2. A more efficient implementation could then look as follows: - > instance GenValidity Prime where + > instance GenUnchecked Prime where > genUnchecked = Prime <$> arbitrary + + > instance GenValid Prime where > genValid = Prime <$> > (oneof > [ pure 2 - > , (\y -> 2 * y + 1) <$> (arbitrary `suchThat` (> 0) `suchThat` isPrime) + > , ((\y -> 2 * abs y + 1) <$> arbitrary) `suchThat` isPrime) > ]) @@ -40,27 +42,42 @@ > Nothing -> return () -- Can happen > Just output -> output `shouldSatisfy` isValid -} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE DefaultSignatures #-} module Data.GenValidity ( module Data.Validity , module Data.GenValidity ) where -import Data.Validity +import Data.Validity -import Test.QuickCheck +import Data.Fixed (Fixed(..), HasResolution) +import Data.Word (Word, Word8, Word16) +import GHC.Generics +import GHC.Real (Ratio(..)) -import Control.Monad (forM) +import Test.QuickCheck hiding (Fixed) --- | A class of types for which @Validity@-related values can be generated. --- --- If you also write @Arbitrary@ instances for @GenValidity@ types, it may be --- best to simply write @arbitrary = genValid@. -class Validity a => GenValidity a where - -- | Generate a truly arbitrary datum, this should cover all possible - -- values in the type +import Control.Applicative ((<$>), pure) +import Control.Monad (forM) + +-- | A class of types for which truly arbitrary values can be generated. +class GenUnchecked a where genUnchecked :: Gen a + default genUnchecked :: (Generic a, GGenUnchecked (Rep a)) => + Gen a + genUnchecked = to <$> gGenUnchecked +-- | A class of types for which valid values can be generated. +-- +-- If you also write @Arbitrary@ instances for @GenValid@ types, it may be +-- best to simply write @arbitrary = genValid@. +class (Validity a, GenUnchecked a) => + GenValid a where + genValid :: Gen a -- | Generate a valid datum, this should cover all possible valid values in -- the type -- @@ -71,9 +88,12 @@ -- To speed up testing, it may be a good idea to implement this yourself. -- If you do, make sure that it is possible to generate all possible valid -- data, otherwise your testing may not cover all cases. - genValid :: Gen a genValid = genUnchecked `suchThat` isValid +-- | A class of types for which invalid values can be generated. +class (Validity a, GenUnchecked a) => + GenInvalid a where + genInvalid :: Gen a -- | Generate an invalid datum, this should cover all possible invalid -- values -- @@ -82,125 +102,266 @@ -- To speed up testing, it may be a good idea to implement this yourself. -- If you do, make sure that it is possible to generate all possible -- invalid data, otherwise your testing may not cover all cases. - genInvalid :: Gen a genInvalid = genUnchecked `suchThat` (not . isValid) - {-# MINIMAL genUnchecked #-} -instance (GenValidity a, GenValidity b) => GenValidity (a, b) where - genUnchecked = sized $ \n -> do - (r, s) <- genSplit n - a <- resize r genUnchecked - b <- resize s genUnchecked - return (a, b) - - genValid = sized $ \n -> do - (r, s) <- genSplit n - a <- resize r genValid - b <- resize s genValid - return (a, b) - - genInvalid = sized $ \n -> do - (r, s) <- genSplit n - oneof - [ do - a <- resize r genUnchecked - b <- resize s genInvalid - return (a, b) - , do - a <- resize r genInvalid - b <- resize s genUnchecked - return (a, b) - ] - -instance (GenValidity a, GenValidity b, GenValidity c) => GenValidity (a, b, c) where - genUnchecked = sized $ \n -> do - (r, s, t) <- genSplit3 n - a <- resize r genUnchecked - b <- resize s genUnchecked - c <- resize t genUnchecked - return (a, b, c) +instance (GenUnchecked a, GenUnchecked b) => + GenUnchecked (a, b) where + genUnchecked = + sized $ \n -> do + (r, s) <- genSplit n + a <- resize r genUnchecked + b <- resize s genUnchecked + return (a, b) + +instance (GenValid a, GenValid b) => + GenValid (a, b) where + genValid = + sized $ \n -> do + (r, s) <- genSplit n + a <- resize r genValid + b <- resize s genValid + return (a, b) + +instance (GenInvalid a, GenInvalid b) => + GenInvalid (a, b) where + genInvalid = + sized $ \n -> do + (r, s) <- genSplit n + oneof + [ do a <- resize r genUnchecked + b <- resize s genInvalid + return (a, b) + , do a <- resize r genInvalid + b <- resize s genUnchecked + return (a, b) + ] + +instance (GenUnchecked a, GenUnchecked b) => + GenUnchecked (Either a b) where + genUnchecked = oneof [Left <$> genUnchecked, Right <$> genUnchecked] + +instance (GenValid a, GenValid b) => + GenValid (Either a b) where + genValid = oneof [Left <$> genValid, Right <$> genValid] + +-- | This instance ensures that the generated tupse contains at least one invalid element. The other element is unchecked. +instance (GenInvalid a, GenInvalid b) => + GenInvalid (Either a b) where + genInvalid = oneof [Left <$> genInvalid, Right <$> genInvalid] + +instance (GenUnchecked a, GenUnchecked b, GenUnchecked c) => + GenUnchecked (a, b, c) where + genUnchecked = + sized $ \n -> do + (r, s, t) <- genSplit3 n + a <- resize r genUnchecked + b <- resize s genUnchecked + c <- resize t genUnchecked + return (a, b, c) + +instance (GenValid a, GenValid b, GenValid c) => + GenValid (a, b, c) where + genValid = + sized $ \n -> do + (r, s, t) <- genSplit3 n + a <- resize r genValid + b <- resize s genValid + c <- resize t genValid + return (a, b, c) + +-- | This instance ensures that the generated triple contains at least one invalid element. The other two are unchecked. +instance (GenInvalid a, GenInvalid b, GenInvalid c) => + GenInvalid (a, b, c) where + genInvalid = + sized $ \n -> do + (r, s, t) <- genSplit3 n + oneof + [ do a <- resize r genInvalid + b <- resize s genUnchecked + c <- resize t genUnchecked + return (a, b, c) + , do a <- resize r genUnchecked + b <- resize s genInvalid + c <- resize t genUnchecked + return (a, b, c) + , do a <- resize r genUnchecked + b <- resize s genUnchecked + c <- resize t genInvalid + return (a, b, c) + ] - genValid = sized $ \n -> do - (r, s, t) <- genSplit3 n - a <- resize r genValid - b <- resize s genValid - c <- resize t genValid - return (a, b, c) - - genInvalid = sized $ \n -> do - (r, s, t) <- genSplit3 n - oneof - [ do - a <- resize r genInvalid - b <- resize s genUnchecked - c <- resize t genUnchecked - return (a, b, c) - , do - a <- resize r genUnchecked - b <- resize s genInvalid - c <- resize t genUnchecked - return (a, b, c) - , do - a <- resize r genUnchecked - b <- resize s genUnchecked - c <- resize t genInvalid - return (a, b, c) - ] - -instance GenValidity a => GenValidity (Maybe a) where +instance GenUnchecked a => + GenUnchecked (Maybe a) where genUnchecked = oneof [pure Nothing, Just <$> genUnchecked] - genValid = oneof [pure Nothing, Just <$> genValid] - genInvalid = Just <$> genInvalid +instance GenValid a => + GenValid (Maybe a) where + genValid = oneof [pure Nothing, Just <$> genValid] + +instance GenInvalid a => + GenInvalid (Maybe a) where + genInvalid = Just <$> genInvalid + +instance GenUnchecked a => + GenUnchecked [a] where + genUnchecked = genListOf genUnchecked -- | If we can generate values of a certain type, we can also generate lists of -- them. --- This instance ensures that @genValid@ generates only lists of valid data and --- that @genInvalid@ generates lists of data such that there is at least one --- value in there that does not satisfy @isValid@, the rest is unchecked. -instance GenValidity a => GenValidity [a] where - genUnchecked = genListOf genUnchecked +instance GenValid a => + GenValid [a] where + genValid = genListOf genValid + +-- | This instance ensures that the generated list contains at least one element +-- that satisfies 'isInvalid'. The rest is unchecked. +instance GenInvalid a => + GenInvalid [a] where + genInvalid = + sized $ \n -> do + (x, y, z) <- genSplit3 n + before <- resize x $ genListOf genUnchecked + middle <- resize y genInvalid + after <- resize z $ genListOf genUnchecked + return $ before ++ [middle] ++ after + +instance GenUnchecked () where + genUnchecked = arbitrary + +instance GenValid () + +instance GenUnchecked Bool where + genUnchecked = arbitrary + +instance GenValid Bool + +instance GenUnchecked Ordering where + genUnchecked = arbitrary - genValid = genListOf genValid +instance GenValid Ordering - -- | At least one invalid value in the list, the rest could be either. - genInvalid = sized $ \n -> do - (x, y, z) <- genSplit3 n - before <- resize x $ genListOf genUnchecked - middle <- resize y genInvalid - after <- resize z $ genListOf genUnchecked - return $ before ++ [middle] ++ after +instance GenUnchecked Char where + genUnchecked = arbitrary +instance GenValid Char + +instance GenUnchecked Int where + genUnchecked = arbitrary + +instance GenValid Int + +instance GenUnchecked Word where + genUnchecked = arbitrary + +instance GenValid Word + +instance GenUnchecked Word8 where + genUnchecked = arbitrary + +instance GenValid Word8 + +instance GenUnchecked Word16 where + genUnchecked = arbitrary + +instance GenValid Word16 + +instance GenUnchecked Float where + genUnchecked = arbitrary + +instance GenValid Float where + genValid = arbitrary + +-- | Either 'NaN' or 'Infinity'. +instance GenInvalid Float where + genInvalid = elements [read "NaN", read "Infinity"] + +instance GenUnchecked Double where + genUnchecked = arbitrary + +instance GenValid Double + +-- | Either 'NaN' or 'Infinity'. +instance GenInvalid Double where + genInvalid = elements [read "NaN", read "Infinity"] + +instance GenUnchecked Integer where + genUnchecked = arbitrary + +instance GenValid Integer + +instance GenUnchecked (Ratio Integer) where + genUnchecked = do + n <- genUnchecked + d <- genUnchecked + pure $ n :% d + +instance GenValid (Ratio Integer) + +instance HasResolution a => + GenUnchecked (Fixed a) where + genUnchecked = MkFixed <$> genUnchecked + +instance HasResolution a => + GenValid (Fixed a) + +-- | 'upTo' generates an integer between 0 (inclusive) and 'n'. upTo :: Int -> Gen Int upTo n | n <= 0 = pure 0 | otherwise = elements [0 .. n] +-- | 'genSplit a' generates a tuple '(b, c)' such that 'b + c' equals 'a'. genSplit :: Int -> Gen (Int, Int) genSplit n - | n < 0 = pure (0, 0) - | otherwise = elements [ (i, n - i) | i <- [0..n] ] + | n < 0 = pure (0, 0) + | otherwise = elements [(i, n - i) | i <- [0 .. n]] +-- | 'genSplit a' generates a triple '(b, c, d)' such that 'b + c + d' equals 'a'. genSplit3 :: Int -> Gen (Int, Int, Int) genSplit3 n - | n < 0 = pure (0, 0, 0) + | n < 0 = pure (0, 0, 0) | otherwise = do - (a, z) <- genSplit n - (b, c) <- genSplit z - return (a, b, c) + (a, z) <- genSplit n + (b, c) <- genSplit z + return (a, b, c) +-- | 'arbPartition n' generates a list 'ls' such that 'sum ls' equals 'n'. arbPartition :: Int -> Gen [Int] arbPartition k | k <= 0 = pure [] | otherwise = do - first <- elements [1..k] - rest <- arbPartition $ k - first - return $ first : rest + first <- elements [1 .. k] + rest <- arbPartition $ k - first + return $ first : rest -- | A version of @listOf@ that takes size into account more accurately. genListOf :: Gen a -> Gen [a] -genListOf func = sized $ \n -> do - size <- upTo n - pars <- arbPartition size - forM pars $ \i -> resize i func - +genListOf func = + sized $ \n -> do + size <- upTo n + pars <- arbPartition size + forM pars $ \i -> resize i func + +class GGenUnchecked f where + gGenUnchecked :: Gen (f a) + +instance GGenUnchecked U1 where + gGenUnchecked = pure U1 + +instance (GGenUnchecked a, GGenUnchecked b) => + GGenUnchecked (a :*: b) where + gGenUnchecked = do + g1 <- gGenUnchecked + g2 <- gGenUnchecked + pure $ g1 :*: g2 + +instance (GGenUnchecked a, GGenUnchecked b) => + GGenUnchecked (a :+: b) where + gGenUnchecked = oneof [L1 <$> gGenUnchecked, R1 <$> gGenUnchecked] + +instance (GGenUnchecked a) => + GGenUnchecked (M1 i c a) where + gGenUnchecked = M1 <$> gGenUnchecked + +instance (GenUnchecked a) => + GGenUnchecked (K1 i a) where + gGenUnchecked = K1 <$> genUnchecked diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/genvalidity-0.2.0.4/test/Data/GenValiditySpec.hs new/genvalidity-0.3.2.0/test/Data/GenValiditySpec.hs --- old/genvalidity-0.2.0.4/test/Data/GenValiditySpec.hs 2016-09-30 10:49:08.000000000 +0200 +++ new/genvalidity-0.3.2.0/test/Data/GenValiditySpec.hs 2017-03-17 15:18:14.000000000 +0100 @@ -1,43 +1,34 @@ -module Data.GenValiditySpec (spec) where +module Data.GenValiditySpec + ( spec + ) where -import Test.Hspec -import Test.QuickCheck +import Test.Hspec +import Test.QuickCheck -import Data.GenValidity +import Data.GenValidity spec :: Spec spec = do describe "upTo" $ do it "returns only positive integers" $ do - forAll arbitrary $ \n -> - forAll (upTo n) (`shouldSatisfy` (>= 0)) - + forAll arbitrary $ \n -> forAll (upTo n) (`shouldSatisfy` (>= 0)) describe "genSplit" $ do it "returns positive integers" $ do forAll arbitrary $ \i -> forAll (genSplit i) $ \(a, b) -> do a `shouldSatisfy` (>= 0) b `shouldSatisfy` (>= 0) - it "returns two integers such that the sum is the original integer" $ do forAll (arbitrary `suchThat` (>= 0)) $ \i -> - forAll (genSplit i) $ \(a, b) -> - a + b `shouldBe` i - + forAll (genSplit i) $ \(a, b) -> a + b `shouldBe` i describe "arbPartition" $ do it "returns an empty list upon strictly negative input" $ do forAll (arbitrary `suchThat` (< 0)) $ \n -> forAll (arbPartition n) (`shouldBe` []) - it "returns a list of strictly positive integers" $ do forAll arbitrary $ \n -> - forAll (arbPartition n) $ \p -> - p `shouldSatisfy` all (> 0) - - it "returns a list of integers that sum to the original positive integer" $ do + forAll (arbPartition n) $ \p -> p `shouldSatisfy` all (> 0) + it + "returns a list of integers that sum to the original positive integer" $ do forAll (arbitrary `suchThat` (>= 0)) $ \n -> - forAll (arbPartition n) $ \p -> - sum p `shouldBe` n - - - + forAll (arbPartition n) $ \p -> sum p `shouldBe` n ++++++ genvalidity.cabal ++++++ --- /var/tmp/diff_new_pack.nOpiIU/_old 2017-04-14 13:37:54.729770892 +0200 +++ /var/tmp/diff_new_pack.nOpiIU/_new 2017-04-14 13:37:54.733770327 +0200 @@ -1,57 +1,54 @@ -name: genvalidity -version: 0.2.0.4 -x-revision: 2 -synopsis: Testing utilities for the validity library +name: genvalidity +version: 0.3.2.0 +x-revision: 1 +cabal-version: >=1.10 +build-type: Simple +license: MIT +license-file: LICENSE +copyright: Copyright: (c) 2016 Tom Sydney Kerckhove +maintainer: syd.kerckh...@gmail.com +homepage: https://github.com/NorfairKing/validity#readme +synopsis: Testing utilities for the validity library description: - Note: There are companion instance packages for this library: - . - * <https://hackage.haskell.org/package/genvalidity-text genvalidity-text> - . - * <https://hackage.haskell.org/package/genvalidity-containers genvalidity-containers> + Note: There are companion instance packages for this library: + . + * <https://hackage.haskell.org/package/genvalidity-text genvalidity-text> + . + * <https://hackage.haskell.org/package/genvalidity-time genvalidity-time> + . + * <https://hackage.haskell.org/package/genvalidity-containers genvalidity-containers> + . + * <https://hackage.haskell.org/package/genvalidity-path genvalidity-path> +category: Testing +author: Tom Sydney Kerckhove -homepage: https://github.com/NorfairKing/validity#readme -license: MIT -license-file: LICENSE -author: Tom Sydney Kerckhove -maintainer: syd.kerckh...@gmail.com -copyright: Copyright: (c) 2016 Tom Sydney Kerckhove -category: Testing -build-type: Simple --- extra-source-files: -cabal-version: >=1.10 +source-repository head + type: git + location: https://github.com/NorfairKing/validity library - hs-source-dirs: src - exposed-modules: Data.GenValidity - , Data.GenRelativeValidity - build-depends: base < 5 - , validity >= 0.3 && < 0.4 - , QuickCheck >= 2.8 - default-language: Haskell2010 + exposed-modules: + Data.GenValidity + Data.GenRelativeValidity + build-depends: + base >= 4.7 && <5, + validity >=0.3.3 && <0.4, + QuickCheck >=2.7 && <2.10 + default-language: Haskell2010 + hs-source-dirs: src + if impl(ghc >= 8.0.0) + ghc-options: -Wno-redundant-constraints test-suite genvalidity-test - type: - exitcode-stdio-1.0 - default-language: - Haskell2010 - hs-source-dirs: - test - main-is: - Spec.hs - other-modules: - Data.GenValiditySpec - ghc-options: - -threaded -rtsopts -with-rtsopts=-N - -Wall - -fno-warn-name-shadowing - build-depends: - base - - , hspec - , QuickCheck >= 2.8 - - , genvalidity - -source-repository head - type: git - location: https://github.com/NorfairKing/validity + type: exitcode-stdio-1.0 + main-is: Spec.hs + build-depends: + base -any, + hspec -any, + QuickCheck, + genvalidity -any + default-language: Haskell2010 + hs-source-dirs: test + other-modules: + Data.GenValiditySpec + ghc-options: -threaded -rtsopts -with-rtsopts=-N -Wall -fno-warn-name-shadowing