-
Notifications
You must be signed in to change notification settings - Fork 139
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 library(testing) #2827
base: master
Are you sure you want to change the base?
Add library(testing) #2827
Conversation
Nice! Finally it is a separate library and not hidden in a test code :) I already have a wish list of additional features that are useful:
|
I think quad based tests are complimentary to this more general test framework. Things that are easy in one system are hard in the other. For example, I think filtering (which is an extremely useful feature to have) would be much harder in quads, but testing individual queries (and communicating them with others) is much more convenient. I intend to build a property based testing framework on top of this one, and I think it's much more fitting than quads for that.
Apart from the skipping, all of these can already be done manually with wrappers. I plan on adding support for test("name of test", [
expect(error),
skip,
num_solutions(3),
other_option
], (
test_body
)
). For now I just implemented the 20% that gives 80% of the value. |
Please reconsider this direction: A testing framework that requires specifying test cases in such a different way compared to what the toplevel emits will pose very serious challenges and mental overhead every time it is used. |
Assuming you're referring to https://en.wikipedia.org/wiki/Software_testing#Property_testing, and that the essence of the approach is its generative aspect, then I believe I've accomplished something of this sort quite naturally in quads-based tests for some numerics functions: https://github.com/dcnorris/scryer-prolog/blob/ea714f13fb5ebba99004fd11abd481210ee7b864/src/lib/numerics/special_functions.pl#L49C1-L59C10 To be sure, I've had to introduce domain-specific predicates — such as |
I'm confused -- would like to invite a discussion on the semantics of testing. Also, quads. |
This is a polished version of the testing framework that I made for
library(dif)
and was eventually adapted to be used for internal library tests. This makes it convenient enough to be used as a general purpose testing framework. Features include:Here's an image of the tests in action:
This PR also ports all the internal tests that were using the old framework to this one. It deletes the
.stdout
files so that stdout isn't checked. If any test fails the status code will change,trycmd
will treat that as a failure, and then it will show the rich test description making it easier to find the problem. An example of what would be shown bycargo test
if a test oflibrary(dif)
regressed: