packages feed

tasty-dejafu 1.0.1.1 → 1.1.0.0

raw patch · 3 files changed

+103/−38 lines, 3 filesdep ~dejafu

Dependency ranges changed: dejafu

Files

CHANGELOG.rst view
@@ -6,6 +6,40 @@  .. _PVP: https://pvp.haskell.org/ +1.1.0.0 - The Settings Release (2018-03-06)+-------------------------------------------++* Git: :tag:`tasty-dejafu-1.1.0.0`+* Hackage: :hackage:`tasty-dejafu-1.1.0.0`++Added+~~~~~++* (:pull:`238`) Settings-based test functions:++    * ``Test.Tasty.DejaFu.testAutoWithSettings``+    * ``Test.Tasty.DejaFu.testDejafuWithSettings``+    * ``Test.Tasty.DejaFu.testDejafusWithSettings``++* (:pull:`238`) Re-export of ``Test.DejaFu.Settings``.++Deprecated+~~~~~~~~~~++* (:pull:`238`) ``Test.Tasty.DejaFu.testDejafuDiscard`` and+  ``testDejafusDiscard``.++Removed+~~~~~~~++* (:pull:`238`) The re-export of+  ``Test.DejaFu.Defaults.defaultDiscarder``.++Miscellaneous+~~~~~~~~~~~~~++* The version bounds on :hackage:`dejafu` are >=1.2 && <1.3.+  1.0.1.1 (2018-02-22) --------------------
Test/Tasty/DejaFu.hs view
@@ -6,7 +6,7 @@  -- | -- Module      : Test.Tasty.DejaFu--- Copyright   : (c) 2015--2017 Michael Walker+-- Copyright   : (c) 2015--2018 Michael Walker -- License     : MIT -- Maintainer  : Michael Walker <mike@barrucadu.co.uk> -- Stability   : stable@@ -34,24 +34,14 @@   , testDejafuWay   , testDejafusWay -  , testDejafuDiscard-  , testDejafusDiscard+  , testAutoWithSettings+  , testDejafuWithSettings+  , testDejafusWithSettings    -- ** Re-exports   , Predicate   , ProPredicate(..)-  , Way-  , defaultWay-  , systematically-  , randomly-  , uniformly-  , swarmy-  , Bounds(..)-  , defaultBounds-  , MemType(..)-  , defaultMemType-  , Discard(..)-  , defaultDiscarder+  , module Test.DejaFu.Settings    -- * Refinement property testing   , testProperty@@ -66,8 +56,12 @@   , R.refines, (R.=>=)   , R.strictlyRefines, (R.->-)   , R.equivalentTo, (R.===)-  ) where +    -- * Deprecated+  , testDejafuDiscard+  , testDejafusDiscard+) where+ import           Data.Char              (toUpper) import qualified Data.Foldable          as F import           Data.List              (intercalate, intersperse)@@ -79,6 +73,7 @@ import qualified Test.DejaFu.Conc       as Conc import qualified Test.DejaFu.Refinement as R import qualified Test.DejaFu.SCT        as SCT+import qualified Test.DejaFu.Settings import qualified Test.DejaFu.Types      as D import           Test.Tasty             (TestName, TestTree, testGroup) import           Test.Tasty.Options     (IsOption(..), OptionDescription(..),@@ -96,7 +91,7 @@   run options conc callback = do     let memtype = lookupOption options     let way     = lookupOption options-    let traces  = SCT.runSCTDiscard (pdiscard assertableP) way memtype conc+    let traces  = SCT.runSCTWithSettings (set ldiscard (Just (pdiscard assertableP)) (fromWayAndMemType way memtype)) conc     run options (ConcTest traces (peval assertableP)) callback  concOptions :: [OptionDescription]@@ -143,7 +138,7 @@   => Conc.ConcIO a   -- ^ The computation to test.   -> TestTree-testAuto = testAutoWay defaultWay defaultMemType+testAuto = testAutoWithSettings defaultSettings  -- | Variant of 'testAuto' which tests a computation under a given -- execution way and memory model.@@ -157,11 +152,18 @@   -> Conc.ConcIO a   -- ^ The computation to test.   -> TestTree-testAutoWay way memtype = testDejafusWay way memtype autocheckCases+testAutoWay way = testAutoWithSettings . fromWayAndMemType way --- | Predicates for the various autocheck functions.-autocheckCases :: Eq a => [(TestName, Predicate a)]-autocheckCases =+-- | Variant of 'testAuto' which takes a settings record.+--+-- @since 1.1.0.0+testAutoWithSettings :: (Eq a, Show a)+  => Settings IO a+  -- ^ The SCT settings.+  -> Conc.ConcIO a+  -- ^ The computation to test.+  -> TestTree+testAutoWithSettings settings = testDejafusWithSettings settings   [("Never Deadlocks", representative deadlocksNever)   , ("No Exceptions", representative exceptionsNever)   , ("Consistent Result", alwaysSame)@@ -178,7 +180,7 @@   -> Conc.ConcIO a   -- ^ The computation to test.   -> TestTree-testDejafu = testDejafuWay defaultWay defaultMemType+testDejafu = testDejafuWithSettings defaultSettings  -- | Variant of 'testDejafu' which takes a way to execute the program -- and a memory model.@@ -196,8 +198,23 @@   -> Conc.ConcIO a   -- ^ The computation to test.   -> TestTree-testDejafuWay = testDejafuDiscard (const Nothing)+testDejafuWay way = testDejafuWithSettings . fromWayAndMemType way +-- | Variant of 'testDejafu' which takes a settings record.+--+-- @since 1.1.0.0+testDejafuWithSettings :: Show b+  => Settings IO a+  -- ^ The settings record+  -> TestName+  -- ^ The name of the test.+  -> ProPredicate a b+  -- ^ The predicate to check.+  -> Conc.ConcIO a+  -- ^ The computation to test.+  -> TestTree+testDejafuWithSettings settings name p = testDejafusWithSettings settings [(name, p)]+ -- | Variant of 'testDejafuWay' which can selectively discard results. -- -- @since 1.0.0.0@@ -215,8 +232,9 @@   -> Conc.ConcIO a   -- ^ The computation to test.   -> TestTree-testDejafuDiscard discard way memtype name test =-  testconc discard way memtype [(name, test)]+testDejafuDiscard discard way =+  testDejafuWithSettings . set ldiscard (Just discard) . fromWayAndMemType way+{-# DEPRECATED testDejafuDiscard "Use testDejafuWithSettings instead" #-}  -- | Variant of 'testDejafu' which takes a collection of predicates to -- test. This will share work between the predicates, rather than@@ -229,7 +247,7 @@   -> Conc.ConcIO a   -- ^ The computation to test.   -> TestTree-testDejafus = testDejafusWay defaultWay defaultMemType+testDejafus = testDejafusWithSettings defaultSettings  -- | Variant of 'testDejafus' which takes a way to execute the program -- and a memory model.@@ -245,8 +263,21 @@   -> Conc.ConcIO a   -- ^ The computation to test.   -> TestTree-testDejafusWay = testconc (const Nothing)+testDejafusWay way = testDejafusWithSettings . fromWayAndMemType way +-- | Variant of 'testDejafus' which takes a settings record.+--+-- @since 1.1.0.0+testDejafusWithSettings :: Show b+  => Settings IO a+  -- ^ The SCT settings.+  -> [(TestName, ProPredicate a b)]+  -- ^ The list of predicates (with names) to check.+  -> Conc.ConcIO a+  -- ^ The computation to test.+  -> TestTree+testDejafusWithSettings = testconc+ -- | Variant of 'testDejafusWay' which can selectively discard -- results, beyond what each predicate already discards. --@@ -263,7 +294,9 @@   -> Conc.ConcIO a   -- ^ The computation to test.   -> TestTree-testDejafusDiscard = testconc+testDejafusDiscard discard way =+  testDejafusWithSettings . set ldiscard (Just discard) . fromWayAndMemType way+{-# DEPRECATED testDejafusDiscard "Use testDejafusWithSettings instead" #-}   -------------------------------------------------------------------------------@@ -336,20 +369,18 @@  -- | Produce a Tasty 'Test' from a Deja Fu unit test. testconc :: Show b-  => (Either Failure a -> Maybe Discard)-  -> Way-  -> MemType+  => Settings IO a   -> [(TestName, ProPredicate a b)]   -> Conc.ConcIO a   -> TestTree-testconc discard way memtype tests concio = case map toTest tests of+testconc settings tests concio = case map toTest tests of   [t] -> t   ts  -> testGroup "Deja Fu Tests" ts    where     toTest (name, p) =-      let discarder = D.strengthenDiscard discard (pdiscard p)-          traces    = SCT.runSCTDiscard discarder way memtype concio+      let discarder = maybe id D.strengthenDiscard (get ldiscard settings) (pdiscard p)+          traces    = SCT.runSCTWithSettings (set ldiscard (Just discarder) settings) concio       in singleTest name $ ConcTest traces (peval p)  -- | Produce a Tasty 'TestTree' from a Deja Fu refinement property test.
tasty-dejafu.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/  name:                tasty-dejafu-version:             1.0.1.1+version:             1.1.0.0 synopsis:            Deja Fu support for the Tasty test framework.  description:@@ -30,14 +30,14 @@ source-repository this   type:     git   location: https://github.com/barrucadu/dejafu.git-  tag:      tasty-dejafu-1.0.1.1+  tag:      tasty-dejafu-1.1.0.0  library   exposed-modules:     Test.Tasty.DejaFu   -- other-modules:          -- other-extensions:       build-depends:       base   >=4.8  && <5-                     , dejafu >=1.0  && <1.2+                     , dejafu >=1.2  && <1.3                      , random >=1.0  && <1.2                      , tagged >=0.8  && <0.9                      , tasty  >=0.10 && <1.1