eqc_ex v1.4.2 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-2016.
Summary
Functions
Equivalent to block(SELF)
Specify a blocking operation
Call a command from a callout
Specify a callout
A choice between two different callout specifications
A choice between two different callout specifications where every choice with the same tag has to go the same way (left or right)
Model failure
An optional callout specification. Equivalent to either(c, :empty)
A list of callout specications arbitrarily interleaved
Specify the result of an operation
Model sending a message
A list of callout specifications in sequence
Unblocking a blocked operation
Macros
Access the pid of the process executing an operation
Get access to (part of) an argument to a callout. For instance,
Convenient syntax for assert
Run-time assertion
Convenient syntax for call
Call a local command from a callout
Convenient syntax for callout
Indicate that the following code is using the callout specification language
Exception return value. Can be used as the return value for a callout to make it throw an exception
Conditional callout specification
Bind the result of a callout or generator
Functions
A choice between two different callout specifications.
In Erlang: ?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)
An optional callout specification. Equivalent to either(c, :empty)
.
In Erlang: ?OPTIONAL(C)
Macros
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
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])
Convenient syntax for callout
.
callout m.f(e1, .., en), return: res
is equivalent to
callout(m, f, [e1, .., en], res)
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)
Exception return value. Can be used as the return value for a callout to make it throw an exception.
In Erlang: ?EXCEPTION(e)
.
Conditional callout specification.
Usage:
guard g, do: c
Equivalent to:
case g do
true -> c
false -> :empty
end
In Erlang: ?WHEN(G, C)