Skip to content
Erlang Shell Makefile
Branch: master
Clone or download
Pull request Compare This branch is 21 commits ahead, 3 commits behind krestenkrab:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Welcome to Triq -- Trifork QuickCheck for Erlang

Triq (pronounced "Trick Check") is a free alternative to QuviQ eqc. Triq's API is modelled closely after eqc, so I recommend their tutorials and slides for an introduction to QuickCheck. Notice that QuviQ eqc has many features not found in triq, but it is open source licensed under the Apache license. For instance, eqc has features for reporting, management, probably a much better shrinking mechanism, cool C integration, and professional support.


To use triq, you download the latest version from here, and untar it into your erlang lib directory (typically /usr/local/lib/erlang/lib):

prompt$ cd /usr/local/lib/erlang/lib
propmt$ tar xvzf triq-0.1.0.tgz

And you're all set.

Or, checkout the triq source code and soft link / copy into your Erlang lib directory:

prompt$ git clone git://
prompt$ cd triq
prompt$ ln -s . /usr/local/lib/erlang/lib/triq-0.1.0

Next, to use triq, include the header file:


And you're ready to write property tests. An example property could be:

prop_append() ->
            lists:reverse(Ys) ++ lists:reverse(Xs)).

To test this property, run triq:check/1, thus:

1> triq:check(prop_append()).
Ran 100 tests

If the test fails, it will try to shrink the result; here is an example:

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

Which runs like this:

1> triq:check(triq_tests:prop_delete()).
L=[4,5,5], I=5

Failed after 5 tests with false
        L = [0,0]
        I = 0

You can get the values used for the failing test with counterexample, and reuse the same test values with check/2:

3> A = triq:counterexample(triq_tests:xprop_delete()).
L=[3,2,1,1,1], I=1

Failed after 101 tests with false
	L = [0,0]
	I = 0
4> A.
5> triq:check(triq_tests:xprop_delete(), A).
L=[0,0], I=0

Failed after 1 tests with false
	L = [0,0]
	I = 0

Modules compiled with the triq.hrl header, auto-export all functions named prop_*, and have a function added called check/0 which runs triq:check/1 on all the properties in the module.

1> mymodule:check().

A handy addition that I use is to also add an eunit test, which tests it:

property_test() -> true == check().

Which can then automatically be run using your favourite eunit runner.

Good luck!

This repository is copyright by Triq Contributors (as enumerated in AUTHORS). It is licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
   or in the file LICENSE

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

This repository also includes build scripts from Erlang Solutions, Ltd. made available under the Apache License, Version 2.0.

You can’t perform that action at this time.