-
Notifications
You must be signed in to change notification settings - Fork 109
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
Add option for printing the number of QuickCheck tests and shrinks #431
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -283,8 +283,31 @@ quickCheck yieldProgress args | |
= (.) (QC.quickCheckWithResult args) | ||
$ QCP.callback | ||
$ QCP.PostTest QCP.NotCounterexample | ||
$ \QC.MkState {QC.maxSuccessTests, QC.numSuccessTests} _ -> | ||
yieldProgress $ emptyProgress {progressPercent = fromIntegral numSuccessTests / fromIntegral maxSuccessTests} | ||
$ \st@QC.MkState {QC.maxSuccessTests, QC.numSuccessTests} _ -> | ||
yieldProgress $ | ||
if QC.numTotTryShrinks st > 0 then | ||
emptyProgress { | ||
progressText = showShrinkCount st True | ||
} | ||
else | ||
emptyProgress { | ||
progressPercent = fromIntegral numSuccessTests / fromIntegral maxSuccessTests | ||
} | ||
|
||
-- Based on 'QuickCheck.Test.failureSummaryAndReason'. | ||
showShrinkCount :: QC.State -> Bool -> String | ||
showShrinkCount st full = count | ||
where | ||
count :: String | ||
count = | ||
concat [ | ||
show (QC.numSuccessShrinks st) ++ | ||
concat [ "." ++ show (QC.numTryShrinks st) | showNumTryShrinks ] ++ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I spent quite some time deciphering that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The intermediate output seems to be something like I understand that you adapted |
||
" shrink" ++ | ||
(if QC.numSuccessShrinks st == 1 && not showNumTryShrinks then "" else "s") | ||
| QC.numSuccessShrinks st > 0 || showNumTryShrinks ] | ||
where | ||
showNumTryShrinks = full && QC.numTryShrinks st > 0 | ||
|
||
successful :: QC.Result -> Bool | ||
successful r = | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we just
showShrinkCount st full = concat [...]
?