| Did you know ... | Search Documentation: |
| Packs (add-ons) for SWI-Prolog |
| Title: | QuickCheck randomized testing |
|---|---|
| Rating: | Not rated. Create the first rating! |
| Latest version: | 0.3.0 |
| SHA1 sum: | cde06a0417eb26b23d3a55b5202a4beb769194b5 |
| Author: | Michael Hendricks <michael@ndrix.org> |
| Maintainer: | Nico Gallinal <nicoabie@gmail.com> |
| Packager: | Nico Gallinal <nicoabie@gmail.com> |
| Home page: | https://github.com/nicoabie/quickcheck |
| Download URL: | https://github.com/nicoabie/quickcheck/archive/v0.3.0.zip |
No reviews. Create the first review!.
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 listlibrary(error) - Error generating supportlibrary(random) - Random numberslibrary(settings) - Setting managementPlease 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.
The UNLICENSE license. See the [LICENSE](LICENSE) file for details.
Pack contains 27 files holding a total of 28.9K bytes.