You are looking at historical revision 25388 of this page. It may differ significantly from its current revision.

Description

cluckcheck is a Chicken Scheme port of the QuickCheck unit test framework.

cluckcheck is a different kind of unit test framework. Rather than using a bunch of manual assert-assert-assert statements, cluckcheck tests properties. For an overview of the QuickCheck methodology, see the homepage.

Homepage

YelloSoft QuickCheck

Source

GitHub

Authors

Andrew Pennebaker (Homepage)

Requirements

No egg requirements.

API

[procedure] (gen-int)

Generate a random integer.

> (use (prefix cluckcheck cluckcheck:))
> (cluckcheck:gen-int)
180
[procedure] (gen-bool)

Generate a random boolean.

> (cluckcheck:gen-bool)
#t
[procedure] (gen-char)

Generate a random character.

> (cluckcheck:gen-char)
#\g
[procedure] (gen-list gen)

Generate a random list populated by gen.

> (cluckcheck:gen-list cluckcheck:gen-int)
(103 24 45 253 227 28 92 45 235 193 212 27 9 195 224 228 103 255)

gen-list can be combined with other generators, including custom generators, to create generators for complex data structures. See gen-string.

[procedure] (gen-string)

Generate a random string. gen-string is a wrapper around (gen-list gen-char).

> (cluckcheck:gen-string)
"\x05&o@\by\x00J &\x00\v\x1691\x05\x19\x14z\r<VxU\x1b\x06~(wE\x05\x03LB&T\x1fLl-\x15\x06"
[procedure] (for-all property gen1 gen2 gen3...)

Tests a property function with values generated by the generator functions. If the property returns false, testing halts and the offending input values are printed to the screen.

> (define (is-even n)
	(= 0 (modulo n 2)))
> (cluckcheck:for-all is-even cluckcheck:gen-int)
*** Failed!
(57)

For more examples, see example.scm.

License

BSD

Version History

cluckcheck 0.0 - First release