validate.package
function runs validation tests included in a package.
validate(file="", test.loc="", verbose=F, outfile="", help=F) validate.package(package, verbose=F, outfile="", lib.loc=NULL, allFiles=F)
validate.package
function.
file
is not specified,
all of the files located in the default
test.loc
directory will be executed.
This argument is required if
test.loc
specifies
a directory other than the default.
test.loc
is specified,
one or more file names must be specified with
the
file
argument.
TRUE
,
each test expression will be printed, regardless of whether a test fails.
Otherwise, only test expressions for failed tests will be printed.
The default is
FALSE
.
test.loc
is used to specify
an alternate test directory.
When
help=T
, a list of valid test files
and their corresponding descriptions is displayed for the default
test.loc
directory.
TRUE
, all files in the validate directory
will be run.
The default is to only run files with a
.t
file extension.
TRUE
if all test pass,
FALSE
if any tests fail.
Each test file contains a set of expressions that are evaluated
and return a value of either
TRUE
or
FALSE
.
The default test files are organized by related functions.
Use
validate
with
help=T
to display a list of test files for
the default
test.loc
directory.
Each test is self-documenting in that it identifies the high-level function(s) being tested, the source of data, applicable references to published results, and a short description of the test case. All necessary data is also included as part of the test.
A test is considered to pass when each of the values being compared to published or otherwise known results are within a specified tolerance. The tolerance values vary among the tests---the tolerances used for a given test are specified immediately following the description. If one or more comparisons fail, the test fails.
The
validate.package
function is a front end for
the
validate
function
(Note it is not an SV3 method for
validate.
)
It finds the validation files included with the specified package and
then calls the main
validate
function with appropriate
values for
file
and
test.loc.
The function looks for validation test files in the
validate
directory under the package directory.
Unless
allFiles=TRUE
, only files with a
.t
file extension in the
validate
directory are run.
# Perform analysis of variance and regression validation tests validate(file=c("anova","regress")) # Validate hypothesis testing and print all test expressions as # they are executed validate("hypotest", verbose=T) # Execute all validation tests, print text expressions that # failed and redirect output to the file all.out validate(outfile ="all.out")