Skip to content

MartinNowak/qcheck

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

60 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

qcheck Build Status Coverage Dub

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

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])();
}