verify {verify}R Documentation

Test Suite

Description

verify is a generic function that creates or uses an object of class "verify" to check returned values of R functions.

Usage

verify(x, ...)
verify.default(x, data = list(), ...)
verify.verify(x, ...)

Arguments

x either a vector of character strings that are commands to be tested, or an object of class "verify".
If a character vector is given, it is often useful if it has names that summarize the commands.
data a named list of data to use in the commands.
... generic arguments.

Details

The commands may include the output from previous commands in the object. The result of any previous command is available as `Test.' plus the name of the test. The index number is used if there are no names.

verify is valuable to insure that changes in the code, the R version, the operating system or the hardware do not change (substantially) the results of the tested commands.

There is a print method for the "verify" class of objects. There is also a method for [.

Value

an object of class "verify" that is a list of the results of the commands. In addition to class and possibly names, it has the following attributes:

data the input or default value of data.
passed a logical vector, or a list that is the result of all.equal on the new versus original results for each command.
random.seed the random seed needed to reproduce results that depend on the random number generator.
specifics a list providing the details of how and when the object was created.

Note

If any of the commands require random numbers, then .Random.seed is created or changed in the current directory.

Author(s)

Nick Efthymiou

References

S Poetry, Patrick J. Burns, Section 3.6, p. 52–58, www.seanet.com/~pburns/Spoetry

See Also

print.verify, all.equal

Examples

## Not run: 
jjverif <- dget(file.path("tests", "jjverif"))
print(verify(jjverif),short=TRUE)
jjdig <- dget(file.path("tests", "jjdig"))
jjg <- dget(file.path("tests", "jjg"))
save(list = ls(pattern="jj"), 
     file=file.path("tests", "jjverifgraph.rda"), 
     ascii=TRUE, compress=TRUE)
load(file.path("tests", "jjverifgraph.rda"))
verify(jjverifgraph)
# Exclude two tests that use empty mathgraph()
print(verify(jjverifgraph[c(-4,-13)]), short = TRUE)
## End(Not run)

[Package verify version 0.8-4 Index]