Re-export Test.DejaFu.Refinement from Test.DejaFu

This commit is contained in:
Michael Walker 2017-06-07 14:08:34 +01:00
parent 94e22a765e
commit 748a55d813
4 changed files with 41 additions and 10 deletions

View File

@ -10,6 +10,10 @@ This project is versioned according to the [Package Versioning Policy](https://p
unreleased unreleased
---------- ----------
### Test.DejaFu
- The new Test.DejaFu.Defaults and Test.DejaFu.Refinement modules are re-exported.
### Test.DejaFu.Defaults ### Test.DejaFu.Defaults
- The `default*` values are now defined in the new Test.DejaFu.Defaults module. There is no breaking - The `default*` values are now defined in the new Test.DejaFu.Defaults module. There is no breaking

View File

@ -240,20 +240,47 @@ module Test.DejaFu
, somewhereTrue , somewhereTrue
, gives , gives
, gives' , gives'
-- * Refinement property testing
-- | Consider this statement about @MVar@s: \"using @readMVar@ is
-- better than @takeMVar@ followed by @putMVar@ because the former
-- is atomic but the latter is not.\"
--
-- Deja Fu can test properties like that:
--
-- @
-- sig e = Sig
-- { initialise = maybe newEmptyMVar newMVar
-- , observe = \\v _ -> tryReadMVar v
-- , interfere = \\v s -> tryTakeMVar v >> maybe (pure ()) (void . tryPutMVar v) s
-- , expression = e
-- }
--
-- > check $ sig (void . readMVar) \`equivalentTo\` sig (\\v -> takeMVar v >>= putMVar v)
-- *** Failure: (seed Just ())
-- left: [(Nothing,Just ())]
-- right: [(Nothing,Just ()),(Just Deadlock,Just ())]
-- @
--
-- The two expressions are not equivalent, and we get given the
-- counterexample!
, module Test.DejaFu.Refinement
) where ) where
import Control.Arrow (first) import Control.Arrow (first)
import Control.DeepSeq (NFData(..)) import Control.DeepSeq (NFData(..))
import Control.Monad (unless, when) import Control.Monad (unless, when)
import Control.Monad.Ref (MonadRef) import Control.Monad.Ref (MonadRef)
import Control.Monad.ST (runST) import Control.Monad.ST (runST)
import Data.Function (on) import Data.Function (on)
import Data.List (intercalate, intersperse, minimumBy) import Data.List (intercalate, intersperse, minimumBy)
import Data.Ord (comparing) import Data.Ord (comparing)
import Test.DejaFu.Common import Test.DejaFu.Common
import Test.DejaFu.Conc import Test.DejaFu.Conc
import Test.DejaFu.Defaults import Test.DejaFu.Defaults
import Test.DejaFu.Refinement
import Test.DejaFu.SCT import Test.DejaFu.SCT

View File

@ -77,7 +77,7 @@ import Control.Monad.Catch (try)
import Control.Monad.ST (runST) import Control.Monad.ST (runST)
import qualified Data.Foldable as F import qualified Data.Foldable as F
import Data.List (intercalate, intersperse) import Data.List (intercalate, intersperse)
import Test.DejaFu import Test.DejaFu hiding (Testable(..))
import qualified Test.DejaFu.Conc as Conc import qualified Test.DejaFu.Conc as Conc
import qualified Test.DejaFu.Refinement as R import qualified Test.DejaFu.Refinement as R
import qualified Test.DejaFu.SCT as SCT import qualified Test.DejaFu.SCT as SCT

View File

@ -78,7 +78,7 @@ import Data.Proxy (Proxy(..))
import Data.Tagged (Tagged(..)) import Data.Tagged (Tagged(..))
import Data.Typeable (Typeable) import Data.Typeable (Typeable)
import System.Random (StdGen, mkStdGen) import System.Random (StdGen, mkStdGen)
import Test.DejaFu import Test.DejaFu hiding (Testable(..))
import qualified Test.DejaFu.Conc as Conc import qualified Test.DejaFu.Conc as Conc
import qualified Test.DejaFu.Refinement as R import qualified Test.DejaFu.Refinement as R
import qualified Test.DejaFu.SCT as SCT import qualified Test.DejaFu.SCT as SCT