Special properties for testing

Author(s): Edison Mera, Pedro López, Manuel Hermenegildo.

Stability: [beta] Most of the functionality is there but it is still missing some testing and/or verification.


This module defines special properties and commands to be used in test declarations. They are called in general ``test commands.'' This includes some that are random generators.

Usage and interface

Documentation on exports

PROPERTYtry_sols/2

Usage:try_sols(G,N)

For this test of G get at most N solutions (normally 2 solutions are generated, just enough to detect non-determinism).

Meta-predicate with arguments: try_sols(goal,?).

PROPERTYsetup/2

Usage:setup(G,SetupGoal)

For this test of G, execute the necessary setup procedures specified in SetupGoal.

Meta-predicate with arguments: setup(goal,goal).

PROPERTYcleanup/2

Usage:cleanup(G,CleanupGoal)

For this test of G, execute the necessary cleanup procedures specified in CleanupGoal.

Meta-predicate with arguments: cleanup(goal,goal).

Usage:generate_from_calls_n(G,N)

For this test of G generate (at most) N initial test states from the calls field (normally only the first solution is generated).

Meta-predicate with arguments: generate_from_calls_n(goal,?).

PROPERTYtimeout/2

Usage:timeout(G,N)

For this test of G abort if runtime exceeds N milliseconds (normally the default timeout is 600000 milliseconds, and can be altered using the 'unittest_default_timeout' flag). A timeout of 0 means no timeout

Meta-predicate with arguments: timeout(goal,?).

PROPERTYnear/3

Usage:near(A,B,Eps)

Verifies that abs(B - A)/(abs(B) + abs(A)) =< Eps.

    PROPERTYuser_error/2
    Not implemented yet.

    Usage:

    The predicate should write to the current error stream the specified string.

      Usage:test_command(X)

      X is a test command.

      Meta-predicate with arguments: test_command(goal).

      Usage:

      Similar to the predicate random:random/3

        Usage:

        Similar to the predicate random:random/1

          Usage:

          Generates any floating point random number.

            Usage:

            Generates any floating point random number including special cases like infinite, nan or zero whith sign.

              Documentation on imports

              This module has the following direct dependencies: