qcheck

A library for automatic randomized testing.


Keywords
application, desktop, development, d, fuzz-testing, quickcheck, unit-testing
License
MIT
Install
dub fetch qcheck --version 0.1.1

Documentation

qcheck Build Status Coverage Dub

A library for automatic random testing, inspired by Haskell's excellent QuickCheck.

Documentation

Example Usage

int[] mysort(int[] arr)
{
    // ...
    return arr;
}

unittest
{
    import qcheck;
    import std.algorithm;

    quickCheck!((int[] a) => mysort(a.dup).equal(a.sort()));
}

Generate Random data

The library can also just be used to generate random data, see getArbitrary.

unittest
{
    import qcheck.arbitrary;

    auto sarray = getArbitrary!(int[4])();
    auto array = getArbitrary!(float[])();
    auto aarray = getArbitrary!(int[string])();
}