Hello community,
here is the log from the commit of package ghc-hunit-dejafu for openSUSE:Factory checked in at 2017-08-31 20:56:28
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/ghc-hunit-dejafu (Old)
and /work/SRC/openSUSE:Factory/.ghc-hunit-dejafu.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "ghc-hunit-dejafu"
Thu Aug 31 20:56:28 2017 rev:2 rq:513395 version:0.6.0.0
Changes:
--------
--- /work/SRC/openSUSE:Factory/ghc-hunit-dejafu/ghc-hunit-dejafu.changes 2017-05-16 14:40:21.139619373 +0200
+++ /work/SRC/openSUSE:Factory/.ghc-hunit-dejafu.new/ghc-hunit-dejafu.changes 2017-08-31 20:56:29.687152749 +0200
@@ -1,0 +2,5 @@
+Thu Jul 27 14:05:46 UTC 2017 - psimons@suse.com
+
+- Update to version 0.6.0.0.
+
+-------------------------------------------------------------------
Old:
----
hunit-dejafu-0.3.0.3.tar.gz
New:
----
hunit-dejafu-0.6.0.0.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ ghc-hunit-dejafu.spec ++++++
--- /var/tmp/diff_new_pack.N466fs/_old 2017-08-31 20:56:30.735005522 +0200
+++ /var/tmp/diff_new_pack.N466fs/_new 2017-08-31 20:56:30.751003275 +0200
@@ -18,7 +18,7 @@
%global pkg_name hunit-dejafu
Name: ghc-%{pkg_name}
-Version: 0.3.0.3
+Version: 0.6.0.0
Release: 0
Summary: Deja Fu support for the HUnit test framework
License: MIT
@@ -38,8 +38,6 @@
HUnit>. This lets you easily incorporate concurrency testing into your existing
test suites.
-See the <https://github.com/barrucadu/dejafu README> for more details.
-
%package devel
Summary: Haskell %{pkg_name} library development files
Group: Development/Libraries/Other
@@ -72,5 +70,6 @@
%files devel -f %{name}-devel.files
%defattr(-,root,root,-)
+%doc CHANGELOG.markdown README.markdown
%changelog
++++++ hunit-dejafu-0.3.0.3.tar.gz -> hunit-dejafu-0.6.0.0.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hunit-dejafu-0.3.0.3/CHANGELOG.markdown new/hunit-dejafu-0.6.0.0/CHANGELOG.markdown
--- old/hunit-dejafu-0.3.0.3/CHANGELOG.markdown 1970-01-01 01:00:00.000000000 +0100
+++ new/hunit-dejafu-0.6.0.0/CHANGELOG.markdown 2017-06-07 18:06:17.000000000 +0200
@@ -0,0 +1,181 @@
+Release Notes
+=============
+
+All notable changes to this project will be documented in this file.
+
+This project is versioned according to the [Package Versioning Policy](https://pvp.haskell.org), the
+*de facto* standard Haskell versioning scheme.
+
+
+0.6.0.0 [2017-06-07] (git tag: [hunit-dejafu-0.6.0.0][])
+-------
+
+https://hackage.haskell.org/package/hunit-dejafu-0.6.0.0
+
+### Test.HUnit.DejaFu
+
+- The refinement property testing functionality of dejafu is exposed in the new `testProperty`
+ function, and re-exported values.
+- Due to changes in dejafu, the `Way` type is now abstract and exposes smart constructor functions:
+ - `systematically`, corresponding to the old `Systematically`.
+ - `randomly`, corresponding to the old `Randomly`.
+ - `uniformly`, a new uniform random (as opposed to weighted random) scheduler.
+ - `swarmy`, corresponding to the old `Randomly` and specifying how many executions to use the
+ same weights for.
+- The `defaultWay`, `defaultMemType`, and `defaultBounds` values are all now re-exported.
+
+### Miscellaneous
+
+- Only dejafu 0.7 is supported.
+
+[hunit-dejafu-0.6.0.0]: https://github.com/barrucadu/dejafu/releases/tag/hunit-dejafu-0.6.0.0
+
+
+---------------------------------------------------------------------------------------------------
+
+
+0.5.0.0 [2017-04-08] (git tag: [hunit-dejafu-0.5.0.0][])
+-------
+
+https://hackage.haskell.org/package/hunit-dejafu-0.5.0.0
+
+### Test.HUnit.DejaFu
+
+- Due to changes in dejafu, the `Way` type no longer takes a parameter; it is now a GADT.
+
+### Miscellaneous
+
+- There is now a changelog.
+- Every definition and instance now has a Haddock "@since" annotation.
+- Only dejafu 0.6 is supported.
+
+[hunit-dejafu-0.5.0.0]: https://github.com/barrucadu/dejafu/releases/tag/hunit-dejafu-0.5.0.0
+
+
+---------------------------------------------------------------------------------------------------
+
+
+0.4.0.1 [2017-03-20] (git tag: [hunit-dejafu-0.4.0.1][])
+-------
+
+https://hackage.haskell.org/package/hunit-dejafu-0.4.0.1
+
+### Miscellaneous
+
+- Now supports HUnit 1.6.
+
+[hunit-dejafu-0.4.0.1]: https://github.com/barrucadu/dejafu/releases/tag/hunit-dejafu-0.4.0.1
+
+
+---------------------------------------------------------------------------------------------------
+
+
+0.4.0.0 [2017-02-21] (git tag: [hunit-dejafu-0.4.0.0][])
+-------
+
+https://hackage.haskell.org/package/hunit-dejafu-0.4.0.0
+
+### Test.HUnit.DejaFu
+
+- All the functions which did take a `Bounds` now take a `Way` instead and support random scheduling
+ as well.
+- The `Way` type from dejafu is now re-exported.
+
+### Miscellaneous
+
+- The minimum supported version of dejafu has been increased to 0.5 (from 0.2)
+
+[hunit-dejafu-0.4.0.0]: https://github.com/barrucadu/dejafu/releases/tag/hunit-dejafu-0.4.0.0
+
+
+---------------------------------------------------------------------------------------------------
+
+
+0.3.0.3 [2016-10-22] (git tag: [hunit-dejafu-0.3.0.3][])
+-------
+
+https://hackage.haskell.org/package/hunit-dejafu-0.3.0.3
+
+### Miscellaneous
+
+- Now supports HUnit 1.4 and 1.5.
+
+[hunit-dejafu-0.3.0.3]: https://github.com/barrucadu/dejafu/releases/tag/hunit-dejafu-0.3.0.3
+
+
+---------------------------------------------------------------------------------------------------
+
+
+0.3.0.2 [2016-09-10] (git tag: [hunit-dejafu-0.3.0.2][])
+-------
+
+https://hackage.haskell.org/package/hunit-dejafu-0.3.0.2
+
+### Miscellaneous
+
+- Now supports concurrency 1.0.0.0 and dejafu 0.4.0.0
+
+[hunit-dejafu-0.3.0.2]: https://github.com/barrucadu/dejafu/releases/tag/hunit-dejafu-0.3.0.2
+
+
+---------------------------------------------------------------------------------------------------
+
+
+0.3.0.1 [2016-05-26] (git tag: [hunit-dejafu-0.3.0.1][])
+-------
+
+https://hackage.haskell.org/package/hunit-dejafu-0.3.0.1
+
+### Miscellaneous
+
+- Now supports GHC 8.
+
+[hunit-dejafu-0.3.0.1]: https://github.com/barrucadu/dejafu/releases/tag/hunit-dejafu-0.3.0.1
+
+
+---------------------------------------------------------------------------------------------------
+
+
+0.3.0.0 [2016-04-28] (git tag: [hunit-dejafu-0.3.0.0][])
+-------
+
+https://hackage.haskell.org/package/hunit-dejafu-0.3.0.0
+
+### Test.HUnit.DejaFu
+
+- New `Assertable` and `Testable` instances for `ConcST t ()` and `ConcIO ()`.
+- The `Bounds` type from dejafu is now re-exported.
+
+### Miscellaneous
+
+- Now supports dejafu 0.2 (again).
+
+[hunit-dejafu-0.3.0.0]: https://github.com/barrucadu/dejafu/releases/tag/hunit-dejafu-0.3.0.0
+
+
+---------------------------------------------------------------------------------------------------
+
+
+0.2.1.0 [2016-04-03] (git tag: [hunit-dejafu-0.2.1.0][])
+-------
+
+**This version was never pushed to hackage, whoops!**
+
+### Miscellaneous
+
+- Now supports dejafu 0.3, but drops support for dejafu 0.2.
+
+[hunit-dejafu-0.2.1.0]: https://github.com/barrucadu/dejafu/releases/tag/hunit-dejafu-0.2.1.0
+
+
+---------------------------------------------------------------------------------------------------
+
+
+0.2.0.0 [2015-12-01] (git tag: [0.2.0.0][])
+-------
+
+https://hackage.haskell.org/package/hunit-dejafu-0.2.0.0
+
+Initial release. Go read the API docs.
+
+[0.2.0.0]: https://github.com/barrucadu/dejafu/releases/tag/0.2.0.0
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hunit-dejafu-0.3.0.3/README.markdown new/hunit-dejafu-0.6.0.0/README.markdown
--- old/hunit-dejafu-0.3.0.3/README.markdown 1970-01-01 01:00:00.000000000 +0100
+++ new/hunit-dejafu-0.6.0.0/README.markdown 2016-05-26 17:52:10.000000000 +0200
@@ -0,0 +1,21 @@
+hunit-dejafu
+============
+
+Integration between the [dejafu][] library for concurrency testing and
+[HUnit][]. This lets you easily incorporate concurrency testing into
+your existing test suites.
+
+The documentation of the latest developmental version is
+[available online][docs].
+
+Contributing
+------------
+
+Bug reports, pull requests, and comments are very welcome!
+
+Feel free to contact me on GitHub, through IRC (#haskell on freenode),
+or email (mike@barrucadu.co.uk).
+
+[docs]: https://docs.barrucadu.co.uk/hunit-dejafu
+[dejafu]: https://hackage.haskell.org/package/dejafu
+[HUnit]: https://hackage.haskell.org/package/HUnit
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hunit-dejafu-0.3.0.3/Setup.hs new/hunit-dejafu-0.6.0.0/Setup.hs
--- old/hunit-dejafu-0.3.0.3/Setup.hs 2016-06-04 11:02:54.000000000 +0200
+++ new/hunit-dejafu-0.6.0.0/Setup.hs 2017-04-08 06:43:07.000000000 +0200
@@ -1,2 +1,2 @@
-import Distribution.Simple
+import Distribution.Simple
main = defaultMain
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hunit-dejafu-0.3.0.3/Test/HUnit/DejaFu.hs new/hunit-dejafu-0.6.0.0/Test/HUnit/DejaFu.hs
--- old/hunit-dejafu-0.3.0.3/Test/HUnit/DejaFu.hs 2016-10-22 15:23:28.000000000 +0200
+++ new/hunit-dejafu-0.6.0.0/Test/HUnit/DejaFu.hs 2017-06-07 18:07:28.000000000 +0200
@@ -1,4 +1,5 @@
{-# LANGUAGE CPP #-}
+{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE ScopedTypeVariables #-}
@@ -12,11 +13,11 @@
-- |
-- Module : Test.HUnit.DejaFu
--- Copyright : (c) 2016 Michael Walker
+-- Copyright : (c) 2017 Michael Walker
-- License : MIT
-- Maintainer : Michael Walker
-- Stability : stable
--- Portability : CPP, FlexibleInstances, ImpredicativeTypes, RankNTypes, ScopedTypeVariables, TypeSynonymInstances
+-- Portability : CPP, FlexibleContexts, FlexibleInstances, ImpredicativeTypes, RankNTypes, ScopedTypeVariables, TypeSynonymInstances
--
-- This module allows using Deja Fu predicates with HUnit to test the
-- behaviour of concurrent systems.
@@ -33,99 +34,112 @@
-- @instance Testable (ConcIO ())@
-- @instance Assertable (ConcIO ())@
--
- -- These instances use the default memory model and schedule bounds.
+ -- These instances use 'defaultWay' and 'defaultMemType'.
- -- * Property testing
+ -- * Unit testing
testAuto
, testDejafu
, testDejafus
- , testAuto'
- , testDejafu'
- , testDejafus'
+ , testAutoWay
+ , testDejafuWay
+ , testDejafusWay
-- ** @IO@
, testAutoIO
, testDejafuIO
, testDejafusIO
- , testAutoIO'
- , testDejafuIO'
- , testDejafusIO'
-
- -- * Re-exports
+ , testAutoWayIO
+ , testDejafuWayIO
+ , testDejafusWayIO
+
+ -- ** Re-exports
+ , Way
+ , defaultWay
+ , systematically
+ , randomly
+ , uniformly
+ , swarmy
, Bounds(..)
+ , defaultBounds
, MemType(..)
+ , defaultMemType
+
+ -- * Refinement property testing
+ , testProperty
+
+ -- ** Re-exports
+ , R.Sig(..)
+ , R.RefinementProperty
+ , R.Testable(..)
+ , R.Listable(..)
+ , R.expectFailure
+ , R.refines, (R.=>=)
+ , R.strictlyRefines, (R.->-)
+ , R.equivalentTo, (R.===)
) where
-import Control.Monad.Catch (try)
-import Control.Monad.ST (runST)
-import Data.List (intercalate, intersperse)
-import Test.DejaFu
-import qualified Test.DejaFu.SCT as SCT
-import Test.HUnit (Assertable(..), Test(..), Testable(..), assertString)
-import Test.HUnit.Lang (HUnitFailure(..))
-
-#if MIN_VERSION_dejafu(0,4,0)
-import qualified Test.DejaFu.Conc as Conc
-#else
-import qualified Test.DejaFu.Deterministic as Conc
-#endif
+import Control.Monad.Catch (try)
+import Control.Monad.ST (runST)
+import qualified Data.Foldable as F
+import Data.List (intercalate, intersperse)
+import Test.DejaFu hiding (Testable(..))
+import qualified Test.DejaFu.Conc as Conc
+import qualified Test.DejaFu.Refinement as R
+import qualified Test.DejaFu.SCT as SCT
+import Test.HUnit (Assertable(..), Test(..), Testable(..),
+ assertFailure, assertString)
+import Test.HUnit.Lang (HUnitFailure(..))
-- Can't put the necessary forall in the @Assertable Conc.ConcST t@
-- instance :(
-import Unsafe.Coerce (unsafeCoerce)
+import Unsafe.Coerce (unsafeCoerce)
-#if MIN_VERSION_dejafu(0,3,0)
-type Trc = Conc.Trace Conc.ThreadId Conc.ThreadAction Conc.Lookahead
-#else
-type Trc = Conc.Trace
-#endif
-
-sctBoundST :: MemType -> Bounds -> (forall t. Conc.ConcST t a) -> [(Either Failure a, Trc)]
-sctBoundIO :: MemType -> Bounds -> Conc.ConcIO a -> IO [(Either Failure a, Trc)]
+runSCTst :: Way -> MemType -> (forall t. Conc.ConcST t a) -> [(Either Failure a, Conc.Trace)]
+runSCTst way memtype conc = runST (SCT.runSCT way memtype conc)
-#if MIN_VERSION_dejafu(0,4,0)
-sctBoundST memtype cb conc = runST (SCT.sctBound memtype cb conc)
-sctBoundIO = SCT.sctBound
-#else
-sctBoundST = SCT.sctBound
-sctBoundIO = SCT.sctBoundIO
-#endif
+runSCTio :: Way -> MemType -> Conc.ConcIO a -> IO [(Either Failure a, Conc.Trace)]
+runSCTio = SCT.runSCT
--------------------------------------------------------------------------------
--- Unit testing
+-- HUnit-style unit testing
+-- | @since 0.3.0.0
instance Testable (Conc.ConcST t ()) where
test conc = TestCase (assert conc)
+-- | @since 0.3.0.0
instance Testable (Conc.ConcIO ()) where
test conc = TestCase (assert conc)
+-- | @since 0.3.0.0
instance Assertable (Conc.ConcST t ()) where
assert conc = do
- let traces = sctBound' conc'
+ let traces = runSCTst' conc'
assertString . showErr $ assertableP traces
where
conc' :: Conc.ConcST t (Either HUnitFailure ())
conc' = try conc
- sctBound' :: Conc.ConcST t (Either HUnitFailure ()) -> [(Either Failure (Either HUnitFailure ()), Trc)]
- sctBound' = unsafeCoerce $ sctBoundST defaultMemType defaultBounds
+ runSCTst' :: Conc.ConcST t (Either HUnitFailure ()) -> [(Either Failure (Either HUnitFailure ()), Conc.Trace)]
+ runSCTst' = unsafeCoerce $ runSCTst defaultWay defaultMemType
+-- | @since 0.3.0.0
instance Assertable (Conc.ConcIO ()) where
assert conc = do
- traces <- sctBoundIO defaultMemType defaultBounds (try conc)
+ traces <- runSCTio defaultWay defaultMemType (try conc)
assertString . showErr $ assertableP traces
assertableP :: Predicate (Either HUnitFailure ())
assertableP = alwaysTrue $ \r -> case r of
- Right (Left (HUnitFailure {})) -> False
+ Right (Left HUnitFailure {}) -> False
_ -> True
+
--------------------------------------------------------------------------------
--- Property testing
+-- DejaFu-style unit testing
-- | Automatically test a computation. In particular, look for
-- deadlocks, uncaught exceptions, and multiple return values.
@@ -133,29 +147,42 @@
-- This uses the 'Conc' monad for testing, which is an instance of
-- 'MonadConc'. If you need to test something which also uses
-- 'MonadIO', use 'testAutoIO'.
+--
+-- @since 0.2.0.0
testAuto :: (Eq a, Show a)
=> (forall t. Conc.ConcST t a)
-- ^ The computation to test
-> Test
-testAuto = testAuto' defaultMemType
+testAuto = testAutoWay defaultWay defaultMemType
-- | Variant of 'testAuto' which tests a computation under a given
--- memory model.
-testAuto' :: (Eq a, Show a)
- => MemType
+-- execution way and memory model.
+--
+-- @since 0.5.0.0
+testAutoWay :: (Eq a, Show a)
+ => Way
+ -- ^ How to execute the concurrent program.
+ -> MemType
-- ^ The memory model to use for non-synchronised @CRef@ operations.
-> (forall t. Conc.ConcST t a)
-- ^ The computation to test
-> Test
-testAuto' memtype conc = testDejafus' memtype defaultBounds conc autocheckCases
+testAutoWay way memtype conc =
+ testDejafusWay way memtype conc autocheckCases
-- | Variant of 'testAuto' for computations which do 'IO'.
+--
+-- @since 0.2.0.0
testAutoIO :: (Eq a, Show a) => Conc.ConcIO a -> Test
-testAutoIO = testAutoIO' defaultMemType
+testAutoIO = testAutoWayIO defaultWay defaultMemType
--- | Variant of 'testAuto'' for computations which do 'IO'.
-testAutoIO' :: (Eq a, Show a) => MemType -> Conc.ConcIO a -> Test
-testAutoIO' memtype concio = testDejafusIO' memtype defaultBounds concio autocheckCases
+-- | Variant of 'testAutoWay' for computations which do 'IO'.
+--
+-- @since 0.5.0.0
+testAutoWayIO :: (Eq a, Show a)
+ => Way -> MemType -> Conc.ConcIO a -> Test
+testAutoWayIO way memtype concio =
+ testDejafusWayIO way memtype concio autocheckCases
-- | Predicates for the various autocheck functions.
autocheckCases :: Eq a => [(String, Predicate a)]
@@ -166,6 +193,8 @@
]
-- | Check that a predicate holds.
+--
+-- @since 0.2.0.0
testDejafu :: Show a
=> (forall t. Conc.ConcST t a)
-- ^ The computation to test
@@ -174,15 +203,17 @@
-> Predicate a
-- ^ The predicate to check
-> Test
-testDejafu = testDejafu' defaultMemType defaultBounds
+testDejafu = testDejafuWay defaultWay defaultMemType
--- | Variant of 'testDejafu' which takes a memory model and
--- schedule bounds.
-testDejafu' :: Show a
- => MemType
+-- | Variant of 'testDejafu' which takes a way to execute the program
+-- and a memory model.
+--
+-- @since 0.5.0.0
+testDejafuWay :: Show a
+ => Way
+ -- ^ How to execute the concurrent program.
+ -> MemType
-- ^ The memory model to use for non-synchronised @CRef@ operations.
- -> Bounds
- -- ^ The schedule bound.
-> (forall t. Conc.ConcST t a)
-- ^ The computation to test
-> String
@@ -190,55 +221,89 @@
-> Predicate a
-- ^ The predicate to check
-> Test
-testDejafu' memtype cb conc name p = testDejafus' memtype cb conc [(name, p)]
+testDejafuWay way memtype conc name p =
+ testDejafusWay way memtype conc [(name, p)]
-- | Variant of 'testDejafu' which takes a collection of predicates to
-- test. This will share work between the predicates, rather than
-- running the concurrent computation many times for each predicate.
+--
+-- @since 0.2.0.0
testDejafus :: Show a
=> (forall t. Conc.ConcST t a)
-- ^ The computation to test
-> [(String, Predicate a)]
-- ^ The list of predicates (with names) to check
-> Test
-testDejafus = testDejafus' defaultMemType defaultBounds
+testDejafus = testDejafusWay defaultWay defaultMemType
--- | Variant of 'testDejafus' which takes a memory model and schedule
--- bounds.
-testDejafus' :: Show a
- => MemType
+-- | Variant of 'testDejafus' which takes a way to execute the program
+-- and a memory model.
+--
+-- @since 0.5.0.0
+testDejafusWay :: Show a
+ => Way
+ -- ^ How to execute the concurrent program.
+ -> MemType
-- ^ The memory model to use for non-synchronised @CRef@ operations.
- -> Bounds
- -- ^ The schedule bounds
-> (forall t. Conc.ConcST t a)
-- ^ The computation to test
-> [(String, Predicate a)]
-- ^ The list of predicates (with names) to check
-> Test
-testDejafus' = testst
+testDejafusWay = testst
-- | Variant of 'testDejafu' for computations which do 'IO'.
+--
+-- @since 0.2.0.0
testDejafuIO :: Show a => Conc.ConcIO a -> String -> Predicate a -> Test
-testDejafuIO = testDejafuIO' defaultMemType defaultBounds
+testDejafuIO = testDejafuWayIO defaultWay defaultMemType
--- | Variant of 'testDejafu'' for computations which do 'IO'.
-testDejafuIO' :: Show a => MemType -> Bounds -> Conc.ConcIO a -> String -> Predicate a -> Test
-testDejafuIO' memtype cb concio name p = testDejafusIO' memtype cb concio [(name, p)]
+-- | Variant of 'testDejafuWay' for computations which do 'IO'.
+--
+-- @since 0.5.0.0
+testDejafuWayIO :: Show a
+ => Way -> MemType -> Conc.ConcIO a -> String -> Predicate a -> Test
+testDejafuWayIO way memtype concio name p =
+ testDejafusWayIO way memtype concio [(name, p)]
-- | Variant of 'testDejafus' for computations which do 'IO'.
+--
+-- @since 0.2.0.0
testDejafusIO :: Show a => Conc.ConcIO a -> [(String, Predicate a)] -> Test
-testDejafusIO = testDejafusIO' defaultMemType defaultBounds
+testDejafusIO = testDejafusWayIO defaultWay defaultMemType
+
+-- | Variant of 'dejafusWay' for computations which do 'IO'.
+--
+-- @since 0.5.0.0
+testDejafusWayIO :: Show a
+ => Way -> MemType -> Conc.ConcIO a -> [(String, Predicate a)] -> Test
+testDejafusWayIO = testio
+
+
+-------------------------------------------------------------------------------
+-- Refinement property testing
+
+-- | Check a refinement property with a variety of seed values and
+-- variable assignments.
+--
+-- @since 0.6.0.0
+testProperty :: (R.Testable p, R.Listable (R.X p), Eq (R.X p), Show (R.X p), Show (R.O p))
+ => String
+ -- ^ The name of the test.
+ -> p
+ -- ^ The property to check.
+ -> Test
+testProperty = testprop
--- | Variant of 'dejafus'' for computations which do 'IO'.
-testDejafusIO' :: Show a => MemType -> Bounds -> Conc.ConcIO a -> [(String, Predicate a)] -> Test
-testDejafusIO' = testio
--------------------------------------------------------------------------------
-- HUnit integration
-- | Produce a HUnit 'Test' from a Deja Fu test.
-testst :: Show a => MemType -> Bounds -> (forall t. Conc.ConcST t a) -> [(String, Predicate a)] -> Test
-testst memtype cb conc tests = case map toTest tests of
+testst :: Show a
+ => Way -> MemType -> (forall t. Conc.ConcST t a) -> [(String, Predicate a)] -> Test
+testst way memtype conc tests = case map toTest tests of
[t] -> t
ts -> TestList ts
@@ -246,11 +311,12 @@
toTest (name, p) = TestLabel name . TestCase $
assertString . showErr $ p traces
- traces = sctBoundST memtype cb conc
+ traces = runSCTst way memtype conc
-- | Produce a HUnit 'Test' from an IO-using Deja Fu test.
-testio :: Show a => MemType -> Bounds -> Conc.ConcIO a -> [(String, Predicate a)] -> Test
-testio memtype cb concio tests = case map toTest tests of
+testio :: Show a
+ => Way -> MemType -> Conc.ConcIO a -> [(String, Predicate a)] -> Test
+testio way memtype concio tests = case map toTest tests of
[t] -> t
ts -> TestList ts
@@ -260,9 +326,25 @@
-- really unsafe) here, as 'test' doesn't allow side-effects
-- (eg, constructing an 'MVar' to share the traces after one
-- test computed them).
- traces <- sctBoundIO memtype cb concio
+ traces <- runSCTio way memtype concio
assertString . showErr $ p traces
+-- | 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
+ case ce of
+ Just c -> assertFailure . init $ unlines
+ [ "*** Failure: " ++
+ (if null (R.failingArgs c) then "" else unwords (R.failingArgs c) ++ " ") ++
+ "(seed " ++ show (R.failingSeed c) ++ ")"
+ , " left: " ++ show (F.toList $ R.leftResults c)
+ , " right: " ++ show (F.toList $ R.rightResults c)
+ ]
+ Nothing -> pure ()
+
+
--------------------------------------------------------------------------------
-- Utilities
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/hunit-dejafu-0.3.0.3/hunit-dejafu.cabal new/hunit-dejafu-0.6.0.0/hunit-dejafu.cabal
--- old/hunit-dejafu-0.3.0.3/hunit-dejafu.cabal 2016-10-22 15:33:42.000000000 +0200
+++ new/hunit-dejafu-0.6.0.0/hunit-dejafu.cabal 2017-06-07 18:05:36.000000000 +0200
@@ -2,7 +2,7 @@
-- documentation, see http://haskell.org/cabal/users-guide/
name: hunit-dejafu
-version: 0.3.0.3
+version: 0.6.0.0
synopsis: Deja Fu support for the HUnit test framework.
description:
@@ -11,9 +11,6 @@
<https://hackage.haskell.org/package/HUnit HUnit>. This lets you
easily incorporate concurrency testing into your existing test
suites.
- .
- See the <https://github.com/barrucadu/dejafu README> for more
- details.
homepage: https://github.com/barrucadu/dejafu
license: MIT
@@ -23,7 +20,7 @@
-- copyright:
category: Testing
build-type: Simple
--- extra-source-files:
+extra-source-files: README.markdown CHANGELOG.markdown
cabal-version: >=1.10
source-repository head
@@ -33,7 +30,7 @@
source-repository this
type: git
location: https://github.com/barrucadu/dejafu.git
- tag: hunit-dejafu-0.3.0.3
+ tag: hunit-dejafu-0.6.0.0
library
exposed-modules: Test.HUnit.DejaFu
@@ -41,7 +38,7 @@
-- other-extensions:
build-depends: base >=4.8 && <5
, exceptions >=0.7 && <0.9
- , dejafu >=0.2 && <0.5
- , HUnit >=1.2 && <1.6
+ , dejafu >=0.7 && <0.8
+ , HUnit >=1.2 && <1.7
-- hs-source-dirs:
default-language: Haskell2010