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


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 YelloSoft QuickCheck.


YelloSoft QuickCheck


Andrew Pennebaker


No egg requirements.


[procedure] (gen-int)

Generate a random integer.

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

Generate a random boolean.

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

Generate a random character.

> (use (prefix cluckcheck cluckcheck:))
> (cluckcheck:gen-char)
[procedure] (gen-list gen)

Generate a random list populated by gen.

> (use (prefix cluckcheck cluckcheck:))
> (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).

> (use (prefix cluckcheck cluckcheck:))
> (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.

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

For more examples, see example.scm.



Version History

cluckcheck 0.0 - First release