ANN: QuickCheck.jl, Specification-Based Testing

146 views
Skip to first unread message

Patrick O'Leary

unread,
Feb 22, 2013, 12:44:27 AM2/22/13
to julia...@googlegroups.com
Two days, two packages. I've cleaned up, updated, and packaged my Julia implementation of the QuickCheck specification-based randomized tester. If you're unfamiliar with QuickCheck, it's a unit test method which uses generated random inputs to try to indicate whether properties you state about your functions hold. For instance, a property of the zip() function is that it results in an iterator which is the length of the shorter of its input vectors:

    julia> property((x::Vector{Int}, y::Vector{Int}) -> length(zip(x,y)) == min(length(x), length(y)))
    OK, passed 100 tests.

If the specification is not met, the test case which violates the specification is printed:

    julia> property((x::Vector{Int}, y::Vector{Int}) -> length(zip(x,y)) == max(length(x), length(y)))
    ERROR: Falsifiable, after 1 tests:
    {[2, 1], [2]}



More information can be found in the documentation at https://quickcheckjl.readthedocs.org/en/latest/

The package is published to METADATA and can be downloaded via Pkg.

The source code is available at https://github.com/pao/QuickCheck.jl.

Tim Holy

unread,
Feb 22, 2013, 6:00:40 AM2/22/13
to julia...@googlegroups.com
This looks great, Patrick, many thanks!

--Tim

Jason Knight

unread,
Feb 28, 2013, 9:26:59 PM2/28/13
to julia...@googlegroups.com
Patrick :: Haskell -> Julia

...one package at a time. :). Though that type signature would imply that you are referentially transparent...

Awesome work!

Patrick O'Leary

unread,
Feb 28, 2013, 10:23:18 PM2/28/13
to julia...@googlegroups.com
On Thursday, February 28, 2013 8:26:59 PM UTC-6, Jason Knight wrote:
Patrick :: Haskell -> Julia

...one package at a time. :). Though that type signature would imply that you are referentially transparent...

Awesome work!

Thanks! I'm definitely not convinced I'm a pure function, though.

Dean Wampler

unread,
Mar 1, 2013, 10:27:19 AM3/1/13
to julia...@googlegroups.com
Awesome. The QuickCheck approach to testing has really benefited other language communities, too.
--
Dean Wampler, Ph.D.

Reply all
Reply to author
Forward
0 new messages