# check -- perform tests of a package

## Synopsis

• Usage:
check pkg
check(i, pkg)
• Inputs:
• pkg, , or String, the package to test
• i, an integer, the index of the test to run or -1 to run all tests
• Optional inputs:
• UserMode => , default value null, if true, do not use the -q in arguments to the Macaulay2 executable 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 user's application directory. If false, the -q argument is added. If null, then add -q if it appears as an option in commandLine.
• Verbose => , default value false, if true, then print the output of all failing tests
• Consequences:
• the tests in the package pkg are run (in separate Macaulay2 processes, with the random number seed initialized to 0), and any errors are reported.
• if i is given, only the i-th test in the package is run and any errors are reported.

## Description

It is important for package authors to provide tests to ensure that the package is functioning properly. One provides tests using the TEST function following the beginDocumentation call in the source of the package.

Optionally, one can store all tests in a tests.m2 directory under the auxiliary subdirectory of the package and load the file from the main package source file.

For example, to run the tests for the LLLBases package (Lenstra-Lenstra-Lovasz bases), use:

 needsPackage "LLLBases" check_1 LLLBases check LLLBases

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

 check_1 "LLLBases" 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.

## Ways to use check :

• "check(Package)"
• "check(String)"
• "check(ZZ,Package)"
• "check(ZZ,String)"

## For the programmer

The object check is .