Randomized testing of program properties in the spirit of QuickCheck.
Describe properties of your predicates and let library(quickheck)
generate test cases for you.
:- use_module(library(quickcheck)).
% reversing a list twice gives back the same list
prop_reverse_twice(L:list) :-
reverse(L, R),
reverse(R, L).
prop_silly_list(L:list(integer)) :-
length(L, Len),
Len =:= 3. % nonsense!
?- quickcheck(prop_reverse_twice/1).
100 tests OK
true.
?- quickcheck(prop_silly_list/1).
Shrinking to depth 1
Failed test prop_silly_list([]:list(integer))
false.
To install as a package:
?- pack_install(quickcheck).
Tested with Swi-Prolog 8.0.x but should work with earlier versions too.
In the package root, insert into swipl:
[tests/tests].
run_tests.
Or if you cloned the repo:
make test
- library(apply) - Apply predicates on a list
- library(error) - Error generating support
- library(random) - Random numbers
- library(settings) - Setting management
Please send bug reports/feature request through the GitHub project page.
Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
We use SemVer for versioning. For the versions available, see the tags on this repository.
- Michael Hendricks - Initial work - quickcheck for prolog
See also the list of contributors who participated in this project.
The UNLICENSE license. See the LICENSE file for details.