Created
April 26, 2015 21:20
-
-
Save bohde/57f4a5295f29ded4bf82 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LogEntry Nothing (Variable (Fresh 0)) [] | |
LogEntry Nothing (Spawn 0) [] | |
LogEntry (Just 0) (Variable (Write 0)) [BlockedOn Nothing 0] | |
LogEntry (Just 0) (Variable (Read 0)) [] | |
LogEntry (Just 0) Halt [BlockedOn Nothing 0] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
blocking program | |
should not block FAILED [1] | |
Failures: | |
1) blocking program should not block | |
predicate failed on: Left [LogEntry Nothing (Variable (Fresh 0)) [],LogEntry Nothing (Spawn 0) [],LogEntry (Just 0) (Variable (Write 0)) [BlockedOn Nothing 0],LogEntry (Just 0) (Variable (Read 0)) [],LogEntry (Just 0) Halt [BlockedOn Nothing 0]] (after 2 tests): | |
nothing | |
Randomized with seed 161312233 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
raceCondition :: MVarM s () | |
raceCondition = do | |
v <- newMVar :: MVarM s (MVar s ()) | |
fork $ do | |
putMVar v () | |
takeMVar v | |
takeMVar v | |
main :: IO () | |
main = hspec $ do | |
describe "blocking program" $ do | |
it "should not block" $ property $ \s -> do | |
res <- interpret s raceCondition | |
res `shouldSatisfy` (isRight) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment