Fork me on GitHub

Triq: Trifork QuickCheck

Triq is The Free QuickCheck for Erlang

Contact

Kresten Krab Thorup (krab@trifork.com).

To follow updates, check the commit log here.

I often write about triq at my blog.

Introduction

By and large, the triq API is modeled closely after QuviQ eqc, except you want to replace any occurrenct of eqc with triq. The main supporting module is called triq_dom, corresponding to eqc's eqc_gen.

-module(my_module).
-include("triq.hrl").

prop_delete() ->
     ?FORALL(L,list(int()), 
        ?IMPLIES(L /= [],
            ?FORALL(I,elements(L), 
                ?WHENFAIL(io:format("L=~p, I=~p~n", [L,I]),
                    not lists:member(I,lists:delete(I,L)))))).

To test a property, use triq:check thus:

1> triq:check( my_module:prop_delete() )

Triq also automatically adds a ?MODULE:check/0 function to any module including triq.hrl, and auto-exports any function named prop_.../0. The generated ?MODULE:check/0 will test all properties defined as the result of calling functions named prop_.../0, in a fashion similar to eunit.

EDoc

Generated documentation available here. At present it is rather uncomplete; the interesting modules are triq and triq_dom.

Download

You can download this project in either zip or tar formats.

You can also clone the project with Git by running:

$ git clone git://github.com/krestenkrab/triq