next | previous | forward | backward | up | top | index | toc | Macaulay2 web site
Macaulay2Doc > The Macaulay2 language > packages > creating a package > check

check -- perform tests of a package

Synopsis

Description

It is important for package authors to provide tests to ensure that the package is functioning properly. One provides tests using TEST in the beginDocumentation section.

Synopsis

  • Usage:
    check P
  • Inputs:
    • P, a package or a string
    • UserMode => default value null, if true, then do not give the -q option to M2 when running tests, thereby allowing it to load the user's initialization file, allowing it to load packages previously installed in the user's application directory, and allowing packages it loads to read their configuration files from the the user's application directory. If false, then do give the option. If null, then propagate the option from the current commandLine, if one occurs there.
  • Consequences:
    • The tests in the package P are run (in separate Macaulay2 processes, with the random number seed initialized to 0), and any errors are reported.

For example, to run the tests for the LLLBases package (Lenstra-Lenstra-Lovasz bases) do the following.

installPackage "LLLBases"
check LLLBases

Alternatively, if the package is already installed somewhere accessible, one can do the following.

check "LLLBases"

Synopsis

  • Usage:
    check(i,P)
  • Inputs:
    • i, an integer, the number of the test to run
    • P, a package or a string
    • UserMode => default value null, if true, then do not give the -q option to M2 when running tests, thereby allowing it to load the user's initialization file, allowing it to load packages previously installed in the user's application directory, and allowing packages it loads to read their configuration files from the the user's application directory. If false, then do give the option. If null, then propagate the option from the current commandLine, if one occurs there.
  • Consequences:
    • The i-th test in the package P is run (in separate Macaulay 2 processes), and any errors are reported.

For example, to run the tests for the LLLBases package (Lenstra-Lenstra-Lovasz bases) do the following.

installPackage "LLLBases"
check LLLBases

Alternatively, if the package is already installed somewhere accessible, one can do the following.

check "LLLBases"

Caveat

Currently, if the package was only partially loaded because the documentation was obtainable from a database (see beginDocumentation), then the package will be reloaded, this time completely, to ensure that all tests are considered; this may affect user objects of types declared by the package, as they may be not usable by the new instance of the package. In a future version, either the tests and the documentation will both be cached, or neither will.

See also

Ways to use check :