EQC.Pulse

This module defines macros for using Quviq PULSE with Elixir. For more information about the compiler options see the QuickCheck documentation.

See also the pulse_libs package for instrumented versions of some of the Elixir standard libraries.

Copyright (C) Quviq AB, 2014.

Summary

instrument()

Instrument the current file with PULSE

no_side_effect(es)

Declare functions to not be effectful

replace_module(old, opts)

Replace a module when instrumenting

side_effect(es)

Declare side effects

skip_function(funs)

Skip instrumentation of the given functions

with_pulse(opts)

Define a QuickCheck property that uses PULSE

Macros

instrument()

Instrument the current file with PULSE.

Equivalent to

@compile {:parse_transform, :pulse_instrument}
no_side_effect(es)

Declare functions to not be effectful.

Useful to override side_effect/1. For instance,

side_effect    :ets._/_
no_side_effect :ets.is_compiled_ms/1

The latter line is quivalent to

@compile {:pulse_no_side_effect, [{:ets, :is_compiled_ms, 1}]}
replace_module(old, opts)

Replace a module when instrumenting.

Usage:

replace_module old, with: new

This will replace calls old.f(args) by new.f(args). Note: it will not replace instances of old used as an atom. For instance spawn old, :f, args will not be changed.

Equivalent to

@compile {:pulse_replace_module, [{old, new}]}
side_effect(es)

Declare side effects.

Example:

side_effect [Mod.fun/2, :ets._/_]

Equivalent to

@compile {:pulse_side_effect, [{Mod, :fun, 2}, {:ets, :_, :_}]}
skip_function(funs)

Skip instrumentation of the given functions.

Example:

skip_function [f/2, g/0]

Equivalent to

@compile {:pulse_skip, [{:f, 2}, {:g, 0}]}
with_pulse(opts)

Define a QuickCheck property that uses PULSE.

Usage:

with_pulse do
  action
after res ->
  prop
end

Equivalent to

forall seed <- :pulse.seed do
  case :pulse.run_with_seed(fn -> action end, seed) do
    res -> prop
  end
end