mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-21 12:23:44 +00:00
Estimated hours taken : 250
qcheck is an autotesting tool similar to Haskell's Quickcheck.
A collection of web pages are written as a user guide for quickcheck.
It covers the syntax and features supported by the current version of
quickcheck.
RELEASE_NOTES:
compiler/notes/authors.html:
extras/README:
Modified to mention quickcheck.
extras/quickcheck/qcheck.m:
New file that contains the source code for qcheck.
extras/quickcheck/rnd.m:
New file written by conway. Its functions are similar
to those in library random.m. The random numbers generated
with random.m functions show strong correlation in lower
bits; rnd.m does not seem have such problems.
extras/quickcheck/tutes/T1.html:
extras/quickcheck/tutes/T2.html:
extras/quickcheck/tutes/T3.html:
extras/quickcheck/tutes/T4.html:
extras/quickcheck/tutes/T5.html:
extras/quickcheck/tutes/T6.html:
extras/quickcheck/tutes/T7.html:
extras/quickcheck/tutes/T8.html:
extras/quickcheck/tutes/T9.html:
extras/quickcheck/tutes/T10.html:
New files, each html covers a topic.
extras/quickcheck/tutes/index.html:
New file, the index.
extras/quickcheck/tutes/mymax.m:
extras/quickcheck/tutes/nrev.m:
extras/quickcheck/tutes/nrev2.m:
New files, contains mymax/2, nrev/1 and nrev/2.
extras/quickcheck/tutes/use.m:
extras/quickcheck/tutes/use1.m:
extras/quickcheck/tutes/use11.m:
extras/quickcheck/tutes/use20.m:
extras/quickcheck/tutes/use21.m:
extras/quickcheck/tutes/use22.m:
extras/quickcheck/tutes/use31.m:
extras/quickcheck/tutes/use33.m:
extras/quickcheck/tutes/use51.m:
extras/quickcheck/tutes/use62.m:
extras/quickcheck/tutes/use71.m:
extras/quickcheck/tutes/use81.m:
extras/quickcheck/tutes/use91.m:
New files, contains examples shown in each tutorial.
42 lines
1.3 KiB
Mathematica
42 lines
1.3 KiB
Mathematica
%---------------------------------------------------------------------------%
|
|
% Copyright (C) 2001 The University of Melbourne.
|
|
% This file may only be copied under the terms of the GNU General
|
|
% Public License - see the file COPYING in the Mercury distribution.
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- module use91.
|
|
|
|
:- interface.
|
|
|
|
:- use_module io.
|
|
|
|
:- pred main(io__state, io__state).
|
|
:- mode main(di, uo) is det.
|
|
|
|
%---------------------------------------------------------------------------%
|
|
|
|
:- implementation.
|
|
|
|
:- import_module int, list, std_util.
|
|
:- import_module qcheck, rnd.
|
|
|
|
main -->
|
|
qcheck(qcheck__f(prop1), "user function", 100, [], [],
|
|
[{type_of(some_function), gen_f}]),
|
|
qcheck(qcheck__f(prop1), "no user function", 100, [], [], []).
|
|
|
|
:- func gen_f(type_desc, list(frequency), list({type_desc, list(frequency)}),
|
|
list(user_gen_type), rnd, rnd) = univ.
|
|
:- mode gen_f(in, in, in, list_skel_in(user_gen_inst), in, out) = out is det.
|
|
gen_f(_, _, _, _, RS, RS) = Univ :-
|
|
Univ = univ(some_function).
|
|
|
|
:- func some_function(int) = int.
|
|
:- mode some_function(in) = out is det.
|
|
some_function(X) = Y :-
|
|
Y = 2 * X.
|
|
|
|
:- func prop1(func(int)=int) = property.
|
|
:- mode prop1(in(func(in)=out is det)) = out is det.
|
|
prop1(FFF) = FFF(8) `===` (8 * 2).
|