-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from well-typed/jdral/monitor-all-responses
Print all responses in counterexamples
- Loading branch information
Showing
12 changed files
with
357 additions
and
33 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.golden -text |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
dist-newstyle | ||
.envrc | ||
_tmp | ||
haddocks/ | ||
|
||
# Haskell.gitignore | ||
dist | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
module Main (main) where | ||
|
||
import Test.Tasty | ||
import Test.Tasty | ||
|
||
import Test.IORef.Full qualified | ||
import Test.IORef.Simple qualified | ||
import Test.MockFS qualified | ||
import Test.Golden | ||
import Test.IORef.Full | ||
import Test.IORef.Simple | ||
import Test.MockFS | ||
|
||
main :: IO () | ||
main = defaultMain $ testGroup "quickcheck-lockstep" [ | ||
Test.IORef.Simple.tests | ||
Test.Golden.tests | ||
, Test.IORef.Simple.tests | ||
, Test.IORef.Full.tests | ||
, Test.MockFS.tests | ||
] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
{- HLINT ignore "Use camelCase" -} | ||
|
||
module Test.Golden where | ||
|
||
import Control.Exception (bracket_) | ||
import System.Directory | ||
import System.FilePath | ||
import Test.MockFS as MockFS | ||
import Test.QuickCheck | ||
import Test.QuickCheck.Random (mkQCGen) | ||
import Test.Tasty | ||
import Test.Tasty.Golden | ||
|
||
tests :: TestTree | ||
tests = testGroup "Test.Golden" [ | ||
golden_success_propLockstep_MockFS | ||
, golden_failure_default_propLockstep_MockFS | ||
, golden_failure_nonVerbose_propLockstep_MockFS | ||
, golden_failure_verbose_propLockstep_MockFS | ||
] | ||
|
||
goldenDir :: FilePath | ||
goldenDir = "test" </> "golden" | ||
|
||
tmpDir :: FilePath | ||
tmpDir = "_tmp" | ||
|
||
-- | Golden test for a successful lockstep test | ||
golden_success_propLockstep_MockFS :: TestTree | ||
golden_success_propLockstep_MockFS = | ||
goldenVsFile testName goldenPath outputPath $ do | ||
createDirectoryIfMissing False tmpDir | ||
r <- quickCheckWithResult args MockFS.propLockstep | ||
writeFile outputPath (output r) | ||
where | ||
testName = "golden_success_propLockstep_MockFS" | ||
goldenPath = goldenDir </> testName <.> "golden" | ||
outputPath = tmpDir </> testName <.> "golden" | ||
|
||
args = stdArgs { | ||
replay = Just (mkQCGen 17, 32) | ||
, chatty = False | ||
} | ||
|
||
-- | Golden test for a failing lockstep test that produces a counterexample | ||
-- using the default postcondition. | ||
golden_failure_default_propLockstep_MockFS :: TestTree | ||
golden_failure_default_propLockstep_MockFS = | ||
goldenVsFile testName goldenPath outputPath $ do | ||
createDirectoryIfMissing False tmpDir | ||
r <- | ||
bracket_ | ||
MockFS.setInduceFault | ||
MockFS.setNoInduceFault | ||
(quickCheckWithResult args MockFS.propLockstep) | ||
writeFile outputPath (output r) | ||
where | ||
testName = "golden_failure_default_propLockstep_MockFS" | ||
goldenPath = goldenDir </> testName <.> "golden" | ||
outputPath = tmpDir </> testName <.> "golden" | ||
|
||
args = stdArgs { | ||
replay = Just (mkQCGen 17, 32) | ||
, chatty = False | ||
} | ||
|
||
-- | Golden test for a failing lockstep test that produces a /non-verbose/ counterexample | ||
golden_failure_nonVerbose_propLockstep_MockFS :: TestTree | ||
golden_failure_nonVerbose_propLockstep_MockFS = | ||
goldenVsFile testName goldenPath outputPath $ do | ||
createDirectoryIfMissing False tmpDir | ||
r <- | ||
bracket_ | ||
(MockFS.setInduceFault >> MockFS.setPostconditionNonVerbose) | ||
(MockFS.setNoInduceFault >> MockFS.setPostconditionDefault) | ||
(quickCheckWithResult args MockFS.propLockstep) | ||
writeFile outputPath (output r) | ||
where | ||
testName = "golden_failure_nonVerbose_propLockstep_MockFS" | ||
goldenPath = goldenDir </> testName <.> "golden" | ||
outputPath = tmpDir </> testName <.> "golden" | ||
|
||
args = stdArgs { | ||
replay = Just (mkQCGen 17, 32) | ||
, chatty = False | ||
} | ||
|
||
-- | Golden test for a failing lockstep test that produces a /verbose/ counterexample | ||
golden_failure_verbose_propLockstep_MockFS :: TestTree | ||
golden_failure_verbose_propLockstep_MockFS = | ||
goldenVsFile testName goldenPath outputPath $ do | ||
createDirectoryIfMissing False tmpDir | ||
r <- | ||
bracket_ | ||
(MockFS.setInduceFault >> MockFS.setPostconditionVerbose) | ||
(MockFS.setNoInduceFault >> MockFS.setPostconditionDefault) | ||
(quickCheckWithResult args MockFS.propLockstep) | ||
writeFile outputPath (output r) | ||
where | ||
testName = "golden_failure_verbose_propLockstep_MockFS" | ||
goldenPath = goldenDir </> testName <.> "golden" | ||
outputPath = tmpDir </> testName <.> "golden" | ||
|
||
args = stdArgs { | ||
replay = Just (mkQCGen 17, 32) | ||
, chatty = False | ||
} |
Oops, something went wrong.