tasty-dejafu 0.7.0.3 → 0.7.1.0
raw patch · 3 files changed
+48/−10 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Test.Tasty.DejaFu: testPropertyFor :: (Testable p, Listable (X p), Eq (X p), Show (X p), Show (O p)) => Int -> Int -> TestName -> p -> TestTree
Files
- CHANGELOG.markdown +18/−0
- Test/Tasty/DejaFu.hs +28/−8
- tasty-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** [tasty-dejafu-0.7.1.0][]+- **Hackage** https://hackage.haskell.org/package/tasty-dejafu-0.7.1.0++### Test.Tasty.DejaFu++- A new `testPropertyFor` function for checking refinement properties with a custom number of seed+ values and variable assignments.++[tasty-dejafu-0.7.1.0]: https://github.com/barrucadu/dejafu/releases/tag/tasty-dejafu-0.7.1.0+++---------------------------------------------------------------------------------------------------++ 0.7.0.3 -------
Test/Tasty/DejaFu.hs view
@@ -2,6 +2,7 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GADTs #-}+{-# LANGUAGE LambdaCase #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeSynonymInstances #-} @@ -17,7 +18,7 @@ -- License : MIT -- Maintainer : Michael Walker <mike@barrucadu.co.uk> -- Stability : stable--- Portability : CPP, FlexibleContexts, FlexibleInstances, GADTs, ImpredicativeTypes, RankNTypes, TypeSynonymInstances+-- Portability : CPP, FlexibleContexts, FlexibleInstances, GADTs, ImpredicativeTypes, LambdaCase, RankNTypes, TypeSynonymInstances -- -- This module allows using Deja Fu predicates with Tasty to test the -- behaviour of concurrent systems.@@ -71,6 +72,7 @@ -- * Refinement property testing , testProperty+ , testPropertyFor -- ** Re-exports , R.Sig(..)@@ -143,7 +145,7 @@ ] assertableP :: Predicate (Maybe String)-assertableP = alwaysTrue $ \r -> case r of+assertableP = alwaysTrue $ \case Right (Just _) -> False _ -> True @@ -349,9 +351,27 @@ -> p -- ^ The property to check. -> TestTree-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.+ -> TestName+ -- ^ The name of the test.+ -> p+ -- ^ The property to check.+ -> TestTree+testPropertyFor = testprop + -------------------------------------------------------------------------------- -- Tasty integration @@ -364,7 +384,7 @@ deriving Typeable data PropTest where- PropTest :: (R.Testable p, R.Listable (R.X p), Eq (R.X p), Show (R.X p), Show (R.O p)) => p -> PropTest+ PropTest :: (R.Testable p, R.Listable (R.X p), Eq (R.X p), Show (R.X p), Show (R.O p)) => Int -> Int -> p -> PropTest deriving Typeable instance IsTest ConcTest where@@ -385,8 +405,8 @@ instance IsTest PropTest where testOptions = pure [] - run _ (PropTest p) _ = do- ce <- R.check' p+ run _ (PropTest sn vn p) _ = do+ ce <- R.checkFor sn vn p pure $ case ce of Just c -> testFailed . init $ unlines [ "*** Failure: " ++@@ -435,8 +455,8 @@ -- | Produce a Tasty 'TestTree' 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))- => TestName -> p -> TestTree-testprop name = singleTest name . PropTest+ => Int -> Int -> TestName -> p -> TestTree+testprop sn vn name = singleTest name . PropTest sn vn -- | Convert a test result into an error message on failure (empty -- string on success).
tasty-dejafu.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: tasty-dejafu-version: 0.7.0.3+version: 0.7.1.0 synopsis: Deja Fu support for the Tasty test framework. description:@@ -30,7 +30,7 @@ source-repository this type: git location: https://github.com/barrucadu/dejafu.git- tag: tasty-dejafu-0.7.0.3+ tag: tasty-dejafu-0.7.1.0 library exposed-modules: Test.Tasty.DejaFu