-
Notifications
You must be signed in to change notification settings - Fork 30
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
Adding recheck method and seed reporting #233
Conversation
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.
This would be nice to have 👍 I haven't looked into the implementation yet, but I checked out the branch and run a test and left you some feedback.
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.
We could have this into this release 👍 I just left two small suggestions/nitpicks. Thank you for your work on this, @adam-becker 💯
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.
I was adding some tests before merging and came across an issue with recheck
where the message we show differs from the way the recheck
function is defined.
Co-authored-by: Nikos Baxevanis <[email protected]>
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.
@adam-becker, I've passed the size to the message (which is basically tests + discards). One last thing, I'd like to see if we can have
> Property.recheck (Size 1) (Seed 2244935751425070623UL 5562567424033617363UL) <property>
instead of
> Property.recheck (Size 1) ({ Value = 2244935751425070623UL; Gamma = 5562567424033617363UL }) <property>
FWIW, I've converted this into a draft; we're rendering the size in the output message and what's left is to also pass the size in. For example, |
@willsam100, @adam-becker, would you care trying this branch on your local? |
I will also try this branch out later today |
I don't think it is working. Maybe I am doing it wrong though. A second issue is that when calling Here is the test I wrote to see if let mutable failFlag = true
[<Fact>]
let ``only fail first check`` () =
Property.check <| property {
let! n = Range.constant System.Int64.MinValue System.Int64.MaxValue |> Gen.int64
if failFlag then
failFlag <- false
failwith "failFlag was true"
} Here is the output from one of my executions.
Now I expect executing the next test will cause let mutable failFlag = true
[<Fact>]
let ``only fail first check`` () =
Property.recheck (1 : Size) ({ Value = 1343219580531722066UL; Gamma = 6719782976908311835UL }) <| property {
let! n = Range.constant System.Int64.MinValue System.Int64.MaxValue |> Gen.int64
if failFlag then
failFlag <- false
failwith "failFlag was true"
} But this is not the case. Instead,
Now, I don't think On the other hand, at least that test is deterministic now: running that test will always generate First, I recommend automating this manual testing that I have done. I would do this by having an internal function that returns the Second, I recommend getting that test to pass. Third, I recommend excluding the |
@TysonMN I've fixed the issue you pointed out, though The function is a little clunky to use, however. Since the size parameter in the message is always going to be |
Great! Did you push that change? I don't see it.
It is not always let mutable testsToPass = 1
[<Fact>]
let ``fail after first test`` () =
Property.check <| property {
let! n = Range.constant System.Int64.MinValue System.Int64.MaxValue |> Gen.int64
if testsToPass = 0 then
failwith "now always failing"
else
testsToPass <- testsToPass - 1
} Sample output:
At the "top level", |
Size shouldn't be hardcoded to 1 because size = tests + discards |
I'm on my phone right now (hence the brevity) but here's a property worth testing on this branch property {
let! x = Gen.int <| Range.constantBounded ()
let! y = Gen.int <| Range.constantBounded ()
where (x > 0 && y > 0)
counterexample (sprintf "x * y = %d" <| x * y)
return x * y > 0
} |
Sorry, I thought I had.
Not sure how I was under that impression, thanks for clarifying. |
I tested that commit. It works correctly now. Great work :) |
Great progress so far 👀 @adam-becker🏅@TysonMN 💯 |
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.
Awesome! Getting really close. Left a comment which I think makes sense specially for F# Interactive users.
Done. |
🎊 |
Fixes #179