Skip to content

nicoabie/quickcheck

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

quickcheck logo


Randomized testing of program properties in the spirit of QuickCheck.
Describe properties of your predicates and let library(quickheck) generate test cases for you.

CircleCI SemVer PRs Welcome License

Example

:- 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.

Installation

To install as a package:

?- pack_install(quickcheck).

Tested with Swi-Prolog 8.0.x but should work with earlier versions too.

Running tests

In the package root, insert into swipl:

[tests/tests].
run_tests.

Or if you cloned the repo:

make test

Built With

Bug reports/feature requests

Please send bug reports/feature request through the GitHub project page.

Contributing

Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

Authors

See also the list of contributors who participated in this project.

License

The UNLICENSE license. See the LICENSE file for details.