Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Define showDefaultValue for QuickCheckTests, QuickCheckMaxSize and QuickCheckMaxRatio #428

Merged
merged 1 commit into from
Sep 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions quickcheck/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Version 0.11.1
--------------

* Add timeouts for individual tests within a property.
* Define `showDefaultValue` for `QuickCheckTests`, `QuickCheckMaxSize` and `QuickCheckMaxRatio`.

Version 0.11
--------------
Expand Down
3 changes: 3 additions & 0 deletions quickcheck/Test/Tasty/QuickCheck.hs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ newtype QuickCheckTimeout = QuickCheckTimeout Timeout

instance IsOption QuickCheckTests where
defaultValue = 100
showDefaultValue (QuickCheckTests n) = Just (show n)
parseValue =
-- We allow numeric underscores for readability; see
-- https://github.com/UnkindPartition/tasty/issues/263
Expand Down Expand Up @@ -156,13 +157,15 @@ defaultMaxSize = QC.maxSize QC.stdArgs

instance IsOption QuickCheckMaxSize where
defaultValue = fromIntegral defaultMaxSize
showDefaultValue (QuickCheckMaxSize n) = Just (show n)
parseValue = fmap QuickCheckMaxSize . safeRead
optionName = return "quickcheck-max-size"
optionHelp = return "Size of the biggest test cases quickcheck generates"
optionCLParser = mkOptionCLParser $ metavar "NUMBER"

instance IsOption QuickCheckMaxRatio where
defaultValue = fromIntegral $ QC.maxDiscardRatio QC.stdArgs
showDefaultValue (QuickCheckMaxRatio n) = Just (show n)
parseValue = fmap QuickCheckMaxRatio . safeRead
optionName = return "quickcheck-max-ratio"
optionHelp = return "Maximum number of discared tests per successful test before giving up"
Expand Down
Loading