mirror of
https://github.com/barrucadu/dejafu.git
synced 2024-12-18 11:01:50 +03:00
Test case doesn't actually need three preemptions
This commit is contained in:
parent
2a15549d97
commit
b39200ab7e
@ -43,20 +43,21 @@ import Control.Monad
|
|||||||
import Control.Monad.Conc.Class
|
import Control.Monad.Conc.Class
|
||||||
|
|
||||||
-- test imports
|
-- test imports
|
||||||
import Test.DejaFu (Bounds(..), Failure(..), defaultBounds, gives)
|
import Test.DejaFu (Failure(..), gives)
|
||||||
import Utils
|
import Utils
|
||||||
|
|
||||||
tests :: [T]
|
tests :: [T]
|
||||||
tests =
|
tests =
|
||||||
[ T "deadlocks" deadlocks (gives [Left Deadlock, Right ()])
|
[ T "deadlocks" deadlocks (gives [Left Deadlock, Right ()])
|
||||||
, BT "nondeterministic" nondeterministic (gives [Left Deadlock, Right 0, Right 1]) (defaultBounds { boundPreemp = Just 3 })
|
, T "nondeterministic" nondeterministic (gives [Left Deadlock, Right 0, Right 1])
|
||||||
]
|
]
|
||||||
|
|
||||||
-- This exhibits a deadlock with no preemptions.
|
-- This exhibits a deadlock with no preemptions.
|
||||||
deadlocks :: MonadConc m => m ()
|
deadlocks :: MonadConc m => m ()
|
||||||
deadlocks = join (mkAutoUpdate defaultUpdateSettings)
|
deadlocks = join (mkAutoUpdate defaultUpdateSettings)
|
||||||
|
|
||||||
-- This exhibits nondeterminism with three preemptions.
|
-- This exhibits nondeterminism with three preemptions. However, as
|
||||||
|
-- the program explicitly yields, the bounds don't need changing.
|
||||||
nondeterministic :: forall m. MonadConc m => m Int
|
nondeterministic :: forall m. MonadConc m => m Int
|
||||||
nondeterministic = do
|
nondeterministic = do
|
||||||
var <- newCRef 0
|
var <- newCRef 0
|
||||||
|
Loading…
Reference in New Issue
Block a user