Skip to content
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

Please add test cases to the distribution #19

Open
triska opened this issue Jun 12, 2016 · 4 comments
Open

Please add test cases to the distribution #19

triska opened this issue Jun 12, 2016 · 4 comments

Comments

@triska
Copy link
Contributor

triska commented Jun 12, 2016

Please add a set of test cases to the distribution, so that it is easier to verify changes in the compiler.

The PlUnit framework may come in handy for this. With run_tests/0, one can simply run all test cases and gets a report of what has worked.

@JCumin
Copy link
Owner

JCumin commented Jun 12, 2016

@triska I just commited unit test for brachylog_reverse. I'm not sure if I'm doing this right so I'll stop for now.
They are testing in a non-deterministic way with findall/3 because almost all brachylog_predicates have branch points from the different type cases that are usually not useful. However I don't want to remove them because a) it would take a lot of effort and b) they can be useful when backtracking if we are interested in answers with possibly different types

@triska
Copy link
Contributor Author

triska commented Jun 29, 2016

For inspiration, here is an example of unit tests, written by Ulrich Neumerkel: test_clpfd_tier2.pl

Note that they are using the PlUnit testing framework of SWI-Prolog. To run them, use:

?- run_tests.

PlUnit is quite flexible and also lets you state properties about all solutions. It's completely OK to have redundant choice points, but it is not OK to either omit valid solutions, or report invalid solutions. Using PlUnit is more convenient than rolling your own logic to test such properties.

@JCumin
Copy link
Owner

JCumin commented Mar 1, 2017

I'm finally starting on this, months after this was requested...
It's lacking a lot of predicates/metapredicates right now but here's the current existing unit tests.

@triska
Copy link
Contributor Author

triska commented Mar 1, 2017

Awesome work, thank you for working on this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants