Brachylog
Brachylog copied to clipboard
Please add test cases to the distribution
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.
@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
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.
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.
Awesome work, thank you for working on this!