chickadee » cluckcheck

Outdated egg!

This is an egg for CHICKEN 4, the unsupported old release. You're almost certainly looking for the CHICKEN 5 version of this egg, if it exists.

If it does not exist, there may be equivalent functionality provided by another egg; have a look at the egg index. Otherwise, please consider porting this egg to the current version of CHICKEN.

Cluckcheck

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

gen-intprocedure

Generate a random integer.

> (use cluckcheck)
> (gen-int)
180
gen-boolprocedure

Generate a random boolean.

> (gen-bool)
#t
gen-charprocedure

Generate a random character.

> (gen-char)
#\g
gen-list genprocedure

Generate a random list populated by gen.

> (gen-list 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.

gen-stringprocedure

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

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

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.

> (for-all even? gen-int)
*** Failed!
(57)

Here, the test fails because an integer (57) is found, that is not even.

For more examples, see example.scm.

License

BSD

Version History

cluckcheck 0.0 - First release

Contents »