EQC.Component.Callouts

This module contains functions to be used with Quviq QuickCheck. It defines an Elixir version of the callout language found in eqc/include/eqc_component.hrl. For detailed documentation of the macros, please refer to the QuickCheck documentation.

Copyright (C) Quviq AB, 2014-2015.

Source

Summary

__SELF__()

Access the pid of the process executing an operation

__VAR__()

Get access to (part of) an argument to a callout. For instance,

assert(call)

Convenient syntax for assert

assert(mod, fun, args)

Run-time assertion

block()

Equivalent to block(SELF)

block(tag)

Specify a blocking operation

call(c)

Convenient syntax for call

call(fun, args)

Call a local command from a callout

call(mod, fun, args)

Call a command from a callout

callout(call, opts)

Convenient syntax for callout

callout(mod, fun, args, res)

Specify a callout

callouts(c)

Indicate that the following code is using the callout specification language

either(c1, c2)

A choice between two different callout specifications

either(tag, c1, c2)

A choice between two different callout specifications where every choice with the same tag has to go the same way (left or right)

exception(e)

Exception return value. Can be used as the return value for a callout to make it throw an exception

fail(e)

Model failure

guard(g, c)

Conditional callout specification

match(e)

Bind the result of a callout or generator

optional(c)

An optional callout specification. Equivalent to either(c, :empty)

par(list)

A list of callout specications arbitrarily interleaved

ret(x)

Specify the result of an operation

send(pid, msg)

Model sending a message

seq(list)

A list of callout specifications in sequence

unblock(tag, res)

Unblocking a blocked operation

Functions

block()

Equivalent to block(SELF).

In Erlang: ?BLOCK

Source
block(tag)

Specify a blocking operation.

In Erlang: ?BLOCK(Tag)

Source
call(mod, fun, args)

Call a command from a callout.

In Erlang: ?APPLY(Mod, Fun, Args).

Source
callout(mod, fun, args, res)

Specify a callout.

In Erlang: ?CALLOUT(Mod, Fun, Args, Res).

Source
either(c1, c2)

A choice between two different callout specifications.

In Erlang: ?EITHER(Tag, C1, C2)

Source
either(tag, c1, c2)

A choice between two different callout specifications where every choice with the same tag has to go the same way (left or right).

In Erlang: ?EITHER(Tag, C1, C2)

Source
fail(e)

Model failure.

In Erlang: ?FAIL(E).

Source
optional(c)

An optional callout specification. Equivalent to either(c, :empty).

In Erlang: ?OPTIONAL(C)

Source
par(list)

A list of callout specications arbitrarily interleaved.

In Erlang: ?PAR

Source
ret(x)

Specify the result of an operation.

In Erlang: ?RET(X)

Source
send(pid, msg)

Model sending a message.

In Erlang: ?SEND(Pid, Msg)

Source
seq(list)

A list of callout specifications in sequence.

In Erlang: ?SEQ

Source
unblock(tag, res)

Unblocking a blocked operation.

In Erlang: ?UNBLOCK(Tag, Res)

Source

Macros

__SELF__()

Access the pid of the process executing an operation.

In Erlang: ?SELF

Source
__VAR__()

Get access to (part of) an argument to a callout. For instance,

match {val, :ok} = callout :mock.foo(some_arg, __VAR__), return: :ok
...

Argument values are returned in a tuple with the return value.

Use :_ to ignore a callout argument.

In Erlang: ?VAR

Source
assert(call)

Convenient syntax for assert.

Usage:

assert mod.fun(e1, .., en)
Source
assert(mod, fun, args)

Run-time assertion.

In Erlang: ?ASSERT(Mod, Fun, Args)

Source
call(c)

Convenient syntax for call.

call m.f(e1, .., en)
call f(e1, .., en)

is equivalent to

call(m, f, [e1, .., en])
call(f, [e1, .., en])
Source
call(fun, args)

Call a local command from a callout.

In Erlang: ?APPLY(Fun, Args).

Source
callout(call, opts)

Convenient syntax for callout.

callout m.f(e1, .., en), return: res

is equivalent to

callout(m, f, [e1, .., en], res)
Source
callouts(c)

Indicate that the following code is using the callout specification language.

This is default for the _callouts callback, but this information is lost in some constructions like list comprehensions or par/1 calls.

Usage:

callouts do
  ...
end

In Erlang: ?CALLOUTS(C1, .., CN)

Source
exception(e)

Exception return value. Can be used as the return value for a callout to make it throw an exception.

In Erlang: ?EXCEPTION(e).

Source
guard(g, c)

Conditional callout specification.

Usage:

guard g, do: c

Equivalent to:

case g do
  true  -> c
  false -> :empty
end

In Erlang: ?WHEN(G, C)

Source
match(e)

Bind the result of a callout or generator.

Usage:

match pat = exp
match pat <- gen

In Erlang: ?MATCH(Pat, Exp) or ?MATCH_GEN(Pat, Gen).

Source