eqc_ex v1.4.2 EQC.StateM

This module contains macros to be used with Quviq QuickCheck. It defines Elixir versions of Erlang functions found in eqc/include/eqc_statem.hrl. For detailed documentation of the functions, please refer to the QuickCheck documentation.

Copyright (C) Quviq AB, 2014-2016.

Summary

Functions

Same as :eqc_statem.command_names/1 but replaces the module name to Elixir style

When a test case fails, this pretty prints the failing test case

Runs a state machine generated command sequence and returns a keyword list with :history, :state, and :result instead of a tuple

Runs a state machine generated command sequence where vairables in this sequence are substituted by a Keyword list defined context. Returns a keyword list with :history, :state, and :result instead of a tuple

Runs a state machine generated parallel command sequenceand returns a keyword list with :history, :state, and :result instead of a tuple. Note that there is no actual final state in this case

Runs a state machine generated parallel command sequence where vairables in this sequence are substituted by a Keyword list defined context. Returns a keyword list with :history, :state, and :result instead of a tuple. Note that there is no actual final state in this case

Macros

Translates test cases of a specific format into a list of commands that is compatible with EQC.StateM

Converts the given call expression into a symbolic call

Add weights to the commands in a statem specification

Functions

command_names(cmds)

Same as :eqc_statem.command_names/1 but replaces the module name to Elixir style.

pretty_commands(cmds, res, bool)

When a test case fails, this pretty prints the failing test case.

run_commands(cmds)

Runs a state machine generated command sequence and returns a keyword list with :history, :state, and :result instead of a tuple.

run_commands(cmds, env)

Runs a state machine generated command sequence where vairables in this sequence are substituted by a Keyword list defined context. Returns a keyword list with :history, :state, and :result instead of a tuple.

run_parallel_commands(cmds)

Runs a state machine generated parallel command sequenceand returns a keyword list with :history, :state, and :result instead of a tuple. Note that there is no actual final state in this case.

run_parallel_commands(cmds, env)

Runs a state machine generated parallel command sequence where vairables in this sequence are substituted by a Keyword list defined context. Returns a keyword list with :history, :state, and :result instead of a tuple. Note that there is no actual final state in this case.

Macros

eqc_test(list)

Translates test cases of a specific format into a list of commands that is compatible with EQC.StateM.

Examples

  @check same_seat: [
             eqc_test do
                v1 = book("business")
                book("economy")
                checkin(2, v1)
                bookings()
             end ]
symcall(arg)

Converts the given call expression into a symbolic call.

Examples

symcall extract_pid(result)
# {:call, __MODULE__, :extract_pid, [result]}

symcall OtherModule.do_something(result, args)
# {:call, OtherModule, :do_something, [result, args]}
weight(state, cmds)

Add weights to the commands in a statem specification

Example

weight _, take: 10, reset: 1
# Choose 10 times more 'take' than 'reset'

weight s, take: 10, reset: s
# The more tickets taken, the more likely reset becomes