/exploring_quickcheck

Exploring QuickCheck by trying to implement a few QuickCheck examples using Rantly.

Primary LanguageRuby

About

Exploring QuickCheck by trying to implement a few QuickCheck examples using Rantly.

Some of the examples come from An introduction to QuickCheck with number theory and red black trees.

The red-black tree test is using the avl_tree gem, and 'state machine based' testing builds on finite_machine.

Note: Transition list for the state machine could be in theory generated using Rantly, which would automatically make it shrinkable. At the moment, its just random number - a probability weight used to determine which transition to perform. Also, one could do without a state machine, just calling the ops on the tree directly - otoh, state machine could provide a framework for multithreaded testing for free.

Usage

$ bundle
$ bundle exec rake test

See also

Property based testing

QuickCheck

Implementations

For Ruby, there are different implementations:

For other languages Nat Pryce has compiled a list of quickcheck-like ports.

Tools

  • There is a gem for random-data-generators called generatron. Especially the Generator module is an interesting read. Builds on Rantly.