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

noSideEffect(es)

Declare functions to not be effectful

replaceModule(old, opts)

Replace a module when instrumenting

sideEffect(es)

Declare side effects

skipFunction(funs)

Skip instrumentation of the given functions

withPulse(opts)

Define a QuickCheck property that uses PULSE

Macros

instrument()

Instrument the current file with PULSE.

Equivalent to

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

Declare functions to not be effectful.

Useful to override sideEffect/1. For instance,

sideEffect   :ets._/_
noSideEffect :ets.is_compiled_ms/1

The latter line is quivalent to

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

Replace a module when instrumenting.

Usage:

replaceModule 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}]}
sideEffect(es)

Declare side effects.

Example:

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

Equivalent to

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

Skip instrumentation of the given functions.

Example:

skipFunctions [f/2, g/0]

Equivalent to

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

Define a QuickCheck property that uses PULSE.

Usage:

withPulse 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