-
Notifications
You must be signed in to change notification settings - Fork 36
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 within assertion helper #65
base: master
Are you sure you want to change the base?
Conversation
d1547b3
to
f3166ea
Compare
This seems overkill. Why not |
I think that has two problems. 1) The error messages are noisy.@fact 9.0 in 10.0:12.0 --> true
versus @fact 9.0 --> within(10.0, 12.0)
The printed expectation violation is wrong, but I wanted to do as little surgery to FactCheck's special cases as possible. And, the Expression print is very clear. 2) It's doubly confusing with inclusive bounds.@fact 1 in (1-1):(2+1) --> true I think I'd tend to agree with you in that special cases don't belong in FactCheck. But, I think this style of test comes up a lot. Future Work...I think someting like an |
I would support
|
Hrm. I made a mistake with the example. The non-inclusive I think you are right -- a |
Reimplemented, as per discussion with @jakebolewski. It does feel cleaner than my original implementation. The failure presentation is mostly better. It shows |
Actually, no. That's not right either. It doesn't work for |
Given the preponderance of statistical and scientific Julia code, I think this pair of assertion helpers are very useful. I use them for unit-testing statistical expectations of stochastic functions. For example,
Seeing the expected lower and upper bound in the failing test output makes my life easier.