hunit-dejafu 0.4.0.1 → 0.5.0.0
raw patch · 5 files changed
+237/−38 lines, 5 filesdep −randomdep ~dejafusetup-changedPVP ok
version bump matches the API change (PVP)
Dependencies removed: random
Dependency ranges changed: dejafu
API changes (from Hackage documentation)
- Test.HUnit.DejaFu: Randomly :: g -> Int -> Way g
- Test.HUnit.DejaFu: Systematically :: Bounds -> Way g
+ Test.HUnit.DejaFu: [Randomly] :: Way
+ Test.HUnit.DejaFu: [Systematically] :: Way
- Test.HUnit.DejaFu: data Way g :: * -> *
+ Test.HUnit.DejaFu: data Way :: *
- Test.HUnit.DejaFu: testAutoWay :: (Eq a, Show a, RandomGen g) => Way g -> MemType -> (forall t. ConcST t a) -> Test
+ Test.HUnit.DejaFu: testAutoWay :: (Eq a, Show a) => Way -> MemType -> (forall t. ConcST t a) -> Test
- Test.HUnit.DejaFu: testAutoWayIO :: (Eq a, Show a, RandomGen g) => Way g -> MemType -> ConcIO a -> Test
+ Test.HUnit.DejaFu: testAutoWayIO :: (Eq a, Show a) => Way -> MemType -> ConcIO a -> Test
- Test.HUnit.DejaFu: testDejafuWay :: (Show a, RandomGen g) => Way g -> MemType -> (forall t. ConcST t a) -> String -> Predicate a -> Test
+ Test.HUnit.DejaFu: testDejafuWay :: Show a => Way -> MemType -> (forall t. ConcST t a) -> String -> Predicate a -> Test
- Test.HUnit.DejaFu: testDejafuWayIO :: (Show a, RandomGen g) => Way g -> MemType -> ConcIO a -> String -> Predicate a -> Test
+ Test.HUnit.DejaFu: testDejafuWayIO :: Show a => Way -> MemType -> ConcIO a -> String -> Predicate a -> Test
- Test.HUnit.DejaFu: testDejafusWay :: (Show a, RandomGen g) => Way g -> MemType -> (forall t. ConcST t a) -> [(String, Predicate a)] -> Test
+ Test.HUnit.DejaFu: testDejafusWay :: Show a => Way -> MemType -> (forall t. ConcST t a) -> [(String, Predicate a)] -> Test
- Test.HUnit.DejaFu: testDejafusWayIO :: (Show a, RandomGen g) => Way g -> MemType -> ConcIO a -> [(String, Predicate a)] -> Test
+ Test.HUnit.DejaFu: testDejafusWayIO :: Show a => Way -> MemType -> ConcIO a -> [(String, Predicate a)] -> Test
Files
- CHANGELOG.markdown +154/−0
- README.markdown +21/−0
- Setup.hs +1/−1
- Test/HUnit/DejaFu.hs +57/−29
- hunit-dejafu.cabal +4/−8
+ CHANGELOG.markdown view
@@ -0,0 +1,154 @@+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.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
+ README.markdown view
@@ -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
Setup.hs view
@@ -1,2 +1,2 @@-import Distribution.Simple+import Distribution.Simple main = defaultMain
Test/HUnit/DejaFu.hs view
@@ -59,35 +59,38 @@ , MemType(..) ) where -import Control.Monad.Catch (try)-import Control.Monad.ST (runST)-import Data.List (intercalate, intersperse)-import System.Random (RandomGen)-import Test.HUnit (Assertable(..), Test(..), Testable(..), assertString)-import Test.HUnit.Lang (HUnitFailure(..))-import Test.DejaFu-import qualified Test.DejaFu.Conc as Conc-import qualified Test.DejaFu.SCT as SCT+import Control.Monad.Catch (try)+import Control.Monad.ST (runST)+import Data.List (intercalate, intersperse)+import Test.DejaFu+import qualified Test.DejaFu.Conc as Conc+import qualified Test.DejaFu.SCT as SCT+import Test.HUnit (Assertable(..), Test(..), Testable(..),+ 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) -runSCTst :: RandomGen g => Way g -> MemType -> (forall t. Conc.ConcST t a) -> [(Either Failure a, Conc.Trace)]+runSCTst :: Way -> MemType -> (forall t. Conc.ConcST t a) -> [(Either Failure a, Conc.Trace)] runSCTst way memtype conc = runST (SCT.runSCT way memtype conc) -runSCTio :: RandomGen g => Way g -> MemType -> Conc.ConcIO a -> IO [(Either Failure a, Conc.Trace)]+runSCTio :: Way -> MemType -> Conc.ConcIO a -> IO [(Either Failure a, Conc.Trace)] runSCTio = SCT.runSCT -------------------------------------------------------------------------------- -- 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 = runSCTst' conc'@@ -100,6 +103,7 @@ 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 <- runSCTio defaultWay defaultMemType (try conc)@@ -107,7 +111,7 @@ assertableP :: Predicate (Either HUnitFailure ()) assertableP = alwaysTrue $ \r -> case r of- Right (Left (HUnitFailure {})) -> False+ Right (Left HUnitFailure {}) -> False _ -> True --------------------------------------------------------------------------------@@ -119,6 +123,8 @@ -- 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@@ -127,8 +133,10 @@ -- | Variant of 'testAuto' which tests a computation under a given -- execution way and memory model.-testAutoWay :: (Eq a, Show a, RandomGen g)- => Way g+--+-- @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.@@ -139,12 +147,16 @@ 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 = testAutoWayIO defaultWay defaultMemType -- | Variant of 'testAutoWay' for computations which do 'IO'.-testAutoWayIO :: (Eq a, Show a, RandomGen g)- => Way g -> MemType -> Conc.ConcIO a -> Test+--+-- @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 @@ -157,6 +169,8 @@ ] -- | Check that a predicate holds.+--+-- @since 0.2.0.0 testDejafu :: Show a => (forall t. Conc.ConcST t a) -- ^ The computation to test@@ -169,8 +183,10 @@ -- | Variant of 'testDejafu' which takes a way to execute the program -- and a memory model.-testDejafuWay :: (Show a, RandomGen g)- => Way g+--+-- @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.@@ -187,6 +203,8 @@ -- | 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@@ -197,8 +215,10 @@ -- | Variant of 'testDejafus' which takes a way to execute the program -- and a memory model.-testDejafusWay :: (Show a, RandomGen g)- => Way g+--+-- @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.@@ -210,30 +230,38 @@ 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 = testDejafuWayIO defaultWay defaultMemType -- | Variant of 'testDejafuWay' for computations which do 'IO'.-testDejafuWayIO :: (Show a, RandomGen g)- => Way g -> MemType -> Conc.ConcIO a -> String -> Predicate a -> Test+--+-- @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 = testDejafusWayIO defaultWay defaultMemType -- | Variant of 'dejafusWay' for computations which do 'IO'.-testDejafusWayIO :: (Show a, RandomGen g)- => Way g -> MemType -> Conc.ConcIO a -> [(String, Predicate a)] -> Test+--+-- @since 0.5.0.0+testDejafusWayIO :: Show a+ => Way -> MemType -> Conc.ConcIO a -> [(String, Predicate a)] -> Test testDejafusWayIO = testio -------------------------------------------------------------------------------- -- HUnit integration -- | Produce a HUnit 'Test' from a Deja Fu test.-testst :: (Show a, RandomGen g)- => Way g -> MemType -> (forall t. Conc.ConcST t a) -> [(String, Predicate a)] -> Test+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@@ -245,8 +273,8 @@ traces = runSCTst way memtype conc -- | Produce a HUnit 'Test' from an IO-using Deja Fu test.-testio :: (Show a, RandomGen g)- => Way g -> MemType -> Conc.ConcIO a -> [(String, Predicate a)] -> Test+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
hunit-dejafu.cabal view
@@ -2,7 +2,7 @@ -- documentation, see http://haskell.org/cabal/users-guide/ name: hunit-dejafu-version: 0.4.0.1+version: 0.5.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.4.0.1+ tag: hunit-dejafu-0.5.0.0 library exposed-modules: Test.HUnit.DejaFu@@ -41,8 +38,7 @@ -- other-extensions: build-depends: base >=4.8 && <5 , exceptions >=0.7 && <0.9- , dejafu >=0.5 && <0.6+ , dejafu >=0.6 && <0.7 , HUnit >=1.2 && <1.7- , random >=1.0 && <1.2 -- hs-source-dirs: default-language: Haskell2010