packages feed

chell-quickcheck 0.2.5.3 → 0.2.5.4

raw patch · 5 files changed

+118/−143 lines, 5 filesdep ~QuickCheckdep ~basedep ~chellsetup-changedPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: QuickCheck, base, chell, random

API changes (from Hackage documentation)

Files

− Setup.hs
@@ -1,2 +0,0 @@-import Distribution.Simple-main = defaultMain
Test/Chell/QuickCheck.hs view
@@ -1,140 +1,81 @@-{-# LANGUAGE CPP #-}--module Test.Chell.QuickCheck-  ( property-  ) where--import           Data.Monoid (mempty)-import           System.Random (mkStdGen)+module Test.Chell.QuickCheck (property) where -import qualified Test.Chell as Chell-import qualified Test.QuickCheck as QuickCheck-import qualified Test.QuickCheck.Gen as Gen-#if MIN_VERSION_QuickCheck(2,7,0)-import           Test.QuickCheck.Property (unProperty)-import qualified Test.QuickCheck.Random as QCRandom-#endif-import qualified Test.QuickCheck.State as State-import qualified Test.QuickCheck.Test as Test-import qualified Test.QuickCheck.Text as Text+import Test.Chell qualified as Chell+import Test.QuickCheck qualified as QuickCheck+import Test.QuickCheck.Random qualified as QCRandom+import Test.QuickCheck.State qualified as State+import Test.QuickCheck.Test qualified as Test+import Test.QuickCheck.Text qualified as Text  -- | Convert a QuickCheck property to a Chell 'Chell.Test'. -- -- @---import Test.Chell---import Test.Chell.QuickCheck---import Test.QuickCheck hiding (property)+-- import Test.Chell+-- import Test.Chell.QuickCheck+-- import Test.QuickCheck hiding (property) -----test_NullLength :: Test---test_NullLength = property \"null-length\"+-- test_NullLength :: Test+-- test_NullLength = property \"null-length\" --    (\xs -> not (null xs) ==> length xs > 0) -- @ property :: QuickCheck.Testable prop => String -> prop -> Chell.Test-#if MIN_VERSION_QuickCheck(2,6,0) property name prop = Chell.test name $ \opts -> Text.withNullTerminal $ \term ->   do-#else-property name prop = Chell.test name $ \opts ->-  do-    term <- Text.newNullTerminal-#endif--    let-        seed = Chell.testOptionSeed opts+    let seed = Chell.testOptionSeed opts          args = QuickCheck.stdArgs -        state = State.MkState-            { State.terminal = term-            , State.maxSuccessTests = QuickCheck.maxSuccess args-#if MIN_VERSION_QuickCheck(2,10,1)-            , State.maxDiscardedRatio = QuickCheck.maxDiscardRatio args-#else-            , State.maxDiscardedTests = maxDiscardedTests args prop-#endif--            , State.computeSize = computeSize (QuickCheck.maxSize args) (QuickCheck.maxSuccess args)-            , State.numSuccessTests = 0-            , State.numDiscardedTests = 0-#if MIN_VERSION_QuickCheck(2,12,0)-            , State.classes = mempty-            , State.tables = mempty-            , State.requiredCoverage = mempty-            , State.expected = True-            , State.coverageConfidence = Nothing-#else-            , State.collected = []-            , State.expectedFailure = False-#endif--#if MIN_VERSION_QuickCheck(2,7,0)-            , State.randomSeed = QCRandom.mkQCGen seed-#else-            , State.randomSeed = mkStdGen seed-#endif-            , State.numSuccessShrinks = 0-            , State.numTryShrinks = 0-#if MIN_VERSION_QuickCheck(2,5,0)-            , State.numTotTryShrinks = 0-#endif-#if MIN_VERSION_QuickCheck(2,5,1)-            , State.numRecentlyDiscardedTests = 0-#endif-#if MIN_VERSION_QuickCheck(2,8,0)-            , State.labels = mempty-#endif-#if MIN_VERSION_QuickCheck(2,10,0)-            , State.numTotMaxShrinks = QuickCheck.maxShrinks args-#endif+        state =+          State.MkState+            { State.terminal = term,+              State.maxSuccessTests = QuickCheck.maxSuccess args,+              State.maxDiscardedRatio = QuickCheck.maxDiscardRatio args,+              State.computeSize = computeSize (QuickCheck.maxSize args) (QuickCheck.maxSuccess args),+              State.numSuccessTests = 0,+              State.numDiscardedTests = 0,+              State.classes = mempty,+              State.tables = mempty,+              State.requiredCoverage = mempty,+              State.expected = True,+              State.coverageConfidence = Nothing,+              State.randomSeed = QCRandom.mkQCGen seed,+              State.numSuccessShrinks = 0,+              State.numTryShrinks = 0,+              State.numTotTryShrinks = 0,+              State.numRecentlyDiscardedTests = 0,+              State.labels = mempty,+              State.numTotMaxShrinks = QuickCheck.maxShrinks args             } -#if MIN_VERSION_QuickCheck(2,12,0)     result <- Test.test state (QuickCheck.property prop)-#else-#if MIN_VERSION_QuickCheck(2,7,0)-    let-        genProp = unProperty (QuickCheck.property prop)-#else-    let-        genProp = QuickCheck.property prop-#endif-    result <- Test.test state (Gen.unGen genProp)-#endif-    let-        output = Test.output result+    let output = Test.output result         notes = [("seed", show seed)]-        failure = Chell.failure { Chell.failureMessage = output }+        failure = Chell.failure {Chell.failureMessage = output}      return $-        case result of-            Test.Success{} -> Chell.TestPassed notes-            Test.Failure{} -> Chell.TestFailed notes [failure]-            Test.GaveUp{} -> Chell.TestAborted notes output-            Test.NoExpectedFailure{} -> Chell.TestFailed notes [failure]+      case result of+        Test.Success {} -> Chell.TestPassed notes+        Test.Failure {} -> Chell.TestFailed notes [failure]+        Test.GaveUp {} -> Chell.TestAborted notes output+        Test.NoExpectedFailure {} -> Chell.TestFailed notes [failure]  -- copied from quickcheck-2.4.1.1/src/Test/QuickCheck/Test.hs computeSize :: Int -> Int -> Int -> Int -> Int computeSize maxSize maxSuccess n d-    -- e.g. with maxSuccess = 250, maxSize = 100, goes like this:-    -- 0, 1, 2, ..., 99, 0, 1, 2, ..., 99, 0, 2, 4, ..., 98.-    | n `roundTo` maxSize + maxSize <= maxSuccess ||-      n >= maxSuccess ||-      maxSuccess `mod` maxSize == 0 =-          n `mod` maxSize + d `div` 10-    | otherwise =-          (n `mod` maxSize) * maxSize `div` (maxSuccess `mod` maxSize) + d `div` 10+  -- e.g. with maxSuccess = 250, maxSize = 100, goes like this:+  -- 0, 1, 2, ..., 99, 0, 1, 2, ..., 99, 0, 2, 4, ..., 98.+  | n+      `roundTo` maxSize+      + maxSize+      <= maxSuccess+      || n+      >= maxSuccess+      || maxSuccess+      `mod` maxSize+      == 0 =+      n `mod` maxSize + d `div` 10+  | otherwise =+      (n `mod` maxSize) * maxSize `div` (maxSuccess `mod` maxSize) + d `div` 10  roundTo :: Int -> Int -> Int roundTo n m = (n `div` m) * m--maxDiscardedTests :: QuickCheck.Testable prop => QuickCheck.Args -> prop -> Int-#if MIN_VERSION_QuickCheck(2,9,0)-maxDiscardedTests args _ = QuickCheck.maxDiscardRatio args-#elif MIN_VERSION_QuickCheck(2,5,0)-maxDiscardedTests args p =-    if QuickCheck.exhaustive p-        then QuickCheck.maxDiscardRatio args-        else QuickCheck.maxDiscardRatio args * QuickCheck.maxSuccess args-#else-maxDiscardedTests args _ = QuickCheck.maxDiscard args-#endif
changelog.md view
@@ -1,12 +1,31 @@-# Release history for `chell-quickcheck`+## 0.2.5.4 -0.2.5.3 - 2021 Jan 14+Miscellaneous updates and cleanup -  * Support up to GHC 9.2-  * Tighten various version bounds+Published by: Chris Martin -0.2.5.2 - 2019 Feb 16+Date: 2023-07-11 -  * Add support for `QuickCheck` 2.12+## 0.2.5.3 -0.2.5.1 - 2017 Dec 12+Support up to GHC 9.2++Tighten various version bounds++Published by: Chris Martin++Date: 2021-01-14++## 0.2.5.2++Add support for `QuickCheck` 2.12++Published by: Chris Martin++Date: 2019-02-16++## 0.2.5.1++Published by: John Millikin++Date: 2017-12-12
chell-quickcheck.cabal view
@@ -1,39 +1,32 @@ cabal-version: 3.0  name: chell-quickcheck-version: 0.2.5.3+version: 0.2.5.4 -synopsis: QuickCheck support for the Chell testing library+synopsis: QuickCheck support for Chell category: Testing  license: MIT license-file: license.txt author: John Millikin <john@john-millikin.com> maintainer: Chris Martin, Julie Moronuki-build-type: Simple -homepage:    https://github.com/typeclasses/chell-bug-reports: https://github.com/typeclasses/chell/issues+homepage: https://github.com/typeclasses/chell  description:-  QuickCheck support for the <https://hackage.haskell.org/package/chell Chell> testing library.--extra-source-files:-  changelog.md+    QuickCheck support for the Chell testing library. -source-repository head-  type: git-  location: https://github.com/typeclasses/chell.git+extra-source-files: *.md  library-  default-language: Haskell2010-  ghc-options: -Wall+    default-language: GHC2021+    ghc-options: -Wall -  build-depends:-      base >= 4.10 && < 4.17-    , chell >= 0.3 && < 0.6-    , QuickCheck >= 2.7 && < 2.15-    , random >= 1.1 && < 1.3+    build-depends:+      , base ^>= 4.16 || ^>= 4.17 || ^>= 4.18+      , chell ^>= 0.5+      , QuickCheck ^>= 2.14.2+      , random ^>= 1.2.1 -  exposed-modules:-    Test.Chell.QuickCheck+    exposed-modules:+        Test.Chell.QuickCheck
+ readme.md view
@@ -0,0 +1,24 @@+QuickCheck support for the [Chell] testing library.++  [Chell]: https://hackage.haskell.org/package/chell++```haskell+import Test.Chell+import Test.Chell.QuickCheck++tests :: Suite+tests =+  suite "tests"+      [ test_Equality+      , test_Increment+      ]++test_Equality :: Test+test_Equality = property "equality" (\x -> x == x)++test_Increment :: Test+test_Increment = property "equality" (\x -> x + 1 > x)++main :: IO ()+main = defaultMain [tests]+```