mirror of
https://github.com/barrucadu/dejafu.git
synced 2024-11-23 22:23:18 +03:00
Re-export Test.DejaFu.Refinement from Test.DejaFu
This commit is contained in:
parent
94e22a765e
commit
748a55d813
@ -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
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user