hunit-dejafu 0.7.0.2 → 0.7.1.0
raw patch · 3 files changed
+47/−9 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Test.HUnit.DejaFu: testPropertyFor :: (Testable p, Listable (X p), Eq (X p), Show (X p), Show (O p)) => Int -> Int -> String -> p -> Test
Files
- CHANGELOG.markdown +18/−0
- Test/HUnit/DejaFu.hs +27/−7
- hunit-dejafu.cabal +2/−2
CHANGELOG.markdown view
@@ -7,6 +7,24 @@ *de facto* standard Haskell versioning scheme. +0.7.1.0+-------++- **Date** 2017-11-30+- **Git tag** [hunit-dejafu-0.7.1.0][]+- **Hackage** https://hackage.haskell.org/package/hunit-dejafu-0.7.1.0++### Test.HUnit.DejaFu++- A new `testPropertyFor` function for checking refinement properties with a custom number of seed+ values and variable assignments.++[hunit-dejafu-0.7.1.0]: https://github.com/barrucadu/dejafu/releases/tag/hunit-dejafu-0.7.1.0+++---------------------------------------------------------------------------------------------------++ 0.7.0.2 -------
Test/HUnit/DejaFu.hs view
@@ -1,11 +1,12 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-}+{-# LANGUAGE LambdaCase #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeSynonymInstances #-} -#if __GLASGOW_HASKELL__ >= 800+#if MIN_TOOL_VERSION_ghc(8,0,0) -- Impredicative polymorphism checks got stronger in GHC 8, breaking -- the use of 'unsafeCoerce' below. {-# LANGUAGE ImpredicativeTypes #-}@@ -17,7 +18,7 @@ -- License : MIT -- Maintainer : Michael Walker <mike@barrucadu.co.uk> -- Stability : stable--- Portability : CPP, FlexibleContexts, FlexibleInstances, ImpredicativeTypes, RankNTypes, ScopedTypeVariables, TypeSynonymInstances+-- Portability : CPP, FlexibleContexts, FlexibleInstances, ImpredicativeTypes, LambdaCase, RankNTypes, ScopedTypeVariables, TypeSynonymInstances -- -- This module allows using Deja Fu predicates with HUnit to test the -- behaviour of concurrent systems.@@ -74,6 +75,7 @@ -- * Refinement property testing , testProperty+ , testPropertyFor -- ** Re-exports , R.Sig(..)@@ -139,7 +141,7 @@ assertString . showErr $ assertableP traces assertableP :: Predicate (Either HUnitFailure ())-assertableP = alwaysTrue $ \r -> case r of+assertableP = alwaysTrue $ \case Right (Left HUnitFailure {}) -> False _ -> True @@ -325,9 +327,27 @@ -> p -- ^ The property to check. -> Test-testProperty = testprop+testProperty = testPropertyFor 10 100 +-- | Like 'testProperty', but takes a number of cases to check.+--+-- The maximum number of cases tried by @testPropertyFor n m@ will be+-- @n * m@.+--+-- @since unreleased+testPropertyFor :: (R.Testable p, R.Listable (R.X p), Eq (R.X p), Show (R.X p), Show (R.O p))+ => Int+ -- ^ The number of seed values to try.+ -> Int+ -- ^ The number of variable assignments per seed value to try.+ -> String+ -- ^ The name of the test.+ -> p+ -- ^ The property to check.+ -> Test+testPropertyFor = testprop + -------------------------------------------------------------------------------- -- HUnit integration @@ -372,9 +392,9 @@ -- | Produce a HUnit 'Test' from a Deja Fu refinement property test. testprop :: (R.Testable p, R.Listable (R.X p), Eq (R.X p), Show (R.X p), Show (R.O p))- => String -> p -> Test-testprop name p = TestLabel name . TestCase $ do- ce <- R.check' p+ => Int -> Int -> String -> p -> Test+testprop sn vn name p = TestLabel name . TestCase $ do+ ce <- R.checkFor sn vn p case ce of Just c -> assertFailure . init $ unlines [ "*** Failure: " ++
hunit-dejafu.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: hunit-dejafu-version: 0.7.0.2+version: 0.7.1.0 synopsis: Deja Fu support for the HUnit test framework. description:@@ -30,7 +30,7 @@ source-repository this type: git location: https://github.com/barrucadu/dejafu.git- tag: hunit-dejafu-0.7.0.2+ tag: hunit-dejafu-0.7.1.0 library exposed-modules: Test.HUnit.DejaFu