Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/martinnowak/qcheck
QuickCheck like test library
https://github.com/martinnowak/qcheck
d fuzz-testing quickcheck unit-testing
Last synced: 10 days ago
JSON representation
QuickCheck like test library
- Host: GitHub
- URL: https://github.com/martinnowak/qcheck
- Owner: MartinNowak
- License: mit
- Created: 2011-08-17T18:23:27.000Z (over 13 years ago)
- Default Branch: master
- Last Pushed: 2018-01-31T14:52:01.000Z (about 7 years ago)
- Last Synced: 2025-01-20T02:11:53.888Z (13 days ago)
- Topics: d, fuzz-testing, quickcheck, unit-testing
- Language: D
- Homepage:
- Size: 188 KB
- Stars: 8
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
qcheck [![Build Status](https://travis-ci.org/MartinNowak/qcheck.svg?branch=master)](https://travis-ci.org/MartinNowak/qcheck) [![Coverage](https://codecov.io/gh/MartinNowak/qcheck/branch/master/graph/badge.svg)](https://codecov.io/gh/MartinNowak/qcheck) [![Dub](https://img.shields.io/dub/v/qcheck.svg)](http://code.dlang.org/packages/qcheck)
=====A library for automatic random testing, inspired by Haskell's excellent [QuickCheck](http://www.cse.chalmers.se/~rjmh/QuickCheck/).
# [Documentation](http://martinnowak.github.io/qcheck)
# Example Usage
```d
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`](http://martinnowak.github.io/qcheck/qcheck/arbitrary/getArbitrary.html).
```d
unittest
{
import qcheck.arbitrary;auto sarray = getArbitrary!(int[4])();
auto array = getArbitrary!(float[])();
auto aarray = getArbitrary!(int[string])();
}
```