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
Additional expectations #77
Conversation
Thanks Jared - I'll take a look when I'm next working on testthat. |
Just added a quick additional test that allows the user to check actual value with a user specified tolerance toward the expected value. |
@@ -0,0 +1,5 @@ | |||
.Rproj.user |
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 you please remove this file from the pull request?
As well as the smaller changes described inline, can you please add success messages in line with the new expectation function? Thanks! |
I'm not sure this did it. I couldn't quite figure out how to re-run all the package tests after making changes. Testing the testthat package is a bit meta and it's been awhile since I made the last changes and figured it out. Hope this cleans things up a bit! |
I think it would be more convenient if three additional expectations were available for numeric values, chiefly:
is_less_than
is_more_than
andunequal
. I have coded these up and written test for them to ensure they work.I know this functionality is available by having the user write something like:
But to me this is unsatisfying and it would be preferable for the user to do the following:
This makes testing even simpler and more straightforward as it allows tests to be written with floor and ceiling values, which are often easier to think of than exact equalities in R.
But, I understand this might be considered cluttering up the code base unnecessarily. I use these functions in my own local
testthat
, but thought I would send them upstream and see if they are worth inclusion in the package.