Copyright © Quviq AB, 2015-2024
Version: 1.47.1
Function generators that shrink to printable functions.
prop_silly() -> ?FORALL(F, eqc_fun:function1(nat()), ?WHENFAIL(print_function("F =", F), F(foo) == F("foo") orelse F(bar) == F("bar"))).Running QuickCheck on it we get a nice counterexample:
1> eqc:quickcheck(example:prop_silly()). ........Failed! After 9 tests. #Fun<eqc_fun.38.83612070> F = #Fun<eqc_fun.38.83612070> Shrinking ... #Fun<eqc_fun.38.83612070> F = fun(foo) -> 1; ("bar") -> 1; (_) -> 0 end false
abstract datatype: gen(A)
QuickCheck generator type defined by eqc_gen:gen()
.
function0/1 | Generate a function of arity 0. |
function1/1 | Generate a function of arity 1. |
function1/2 | Generate a function of arity 1 where the result generator can depend on the argument. |
function2/1 | Generate a function of arity 2. |
function2/2 | Two-argument dependent function generator. |
function3/1 | Generate a function of arity 3. |
function3/2 | Three-argument dependent function generator. |
function4/1 | Generate a function of arity 4. |
function4/2 | Four-argument dependent function generator. |
function5/1 | Generate a function of arity 5. |
function5/2 | Five-argument dependent function generator. |
pretty_function/1 | Pretty print a function. |
print_function/1 | Print a function. |
print_function/2 | Print a function with a prefix. |
show_function/1 | Show a function as a string. |
show_function/2 | Show a function with a string prefix. |
Generate a function of arity 0.
Generate a function of arity 1.
Generate a function of arity 1 where the result generator can depend on the argument. The second argument is a non-dependent generator to use in the catch-all case.
Generate a function of arity 2.
Two-argument dependent function generator.
See also: function1/2.
Generate a function of arity 3.
Three-argument dependent function generator.
See also: function1/2.
Generate a function of arity 4.
Four-argument dependent function generator.
See also: function1/2.
Generate a function of arity 5.
Five-argument dependent function generator.
See also: function1/2.
pretty_function(Fun::function()) -> prettypr:document()
Pretty print a function. Uses the prettypr library.
print_function(Fun::function()) -> ok
Equivalent to print_function("", Fun).
Print a function.
print_function(Str::string(), Fun::function()) -> ok
Print a function with a prefix. Equivalent to
io:format("~s\n", [
show_function
(Str, Fun)])
.
show_function(Fun::function()) -> string()
Equivalent to show_function("", Fun).
Show a function as a string.
show_function(Str::string(), Fun::function()) -> string()
Show a function with a string prefix. Typical use 'show_function("Fun = ", Fun)'. Use instead of '"Fun =" ++ show_function(Fun)' to get the layout right.
Generated by EDoc