assertionTest-package
Tools for running Splus-like assertionTest based tests
Description
This contains a version of assertionTest() along
with helper functions that you can put in a test script.
The test script consists of S expressions that are expected
to evaluate to TRUE, with no warnings, if all goes well.
Any expressions that don't evaluate to TRUE or that cause
warnings or that change the random number seed will be flagged.
Details
Package: | assertionTest |
Version: | 0.0-3 |
Date: | 2009-05-14 |
License: | TIBCO Internal Use Only |
Packaged: | 2009-05-19 18:36:12 UTC; wdunlap |
Built: | R 2.10.0; ; 2009-05-22 00:50:45 UTC; windows |
|
Index:
assertionTest Test expressions
atExpectStop Verify that an expression causes an error.
atExpectWarnings Check that expression causes expected warnings
atOnExit Register an expression to be run at the end of
a call to assertionTest.
atOnlyIf Evaluate an expression only if condition is
TRUE.
atSource Allow a test file to run commands in another
file using relative file paths
atAbort Stop a assertionTest() run.
atUsesRandom Encapsulate use of random numbers in tests run
by assertionTest.
assertionTest("file.t") will parse the text in file.t and evaluate
the R expressions found in it. Each expression should evaluate
to TRUE if things are running as expected. The expressions should
not cause warnings, call stop(), nor change the random number generator
seed; if assertionTest detects any discrepency it will print the offending
expression and the problem.
A typical expression uses all.equal(), or
sometimes identical(), to compare actual outputs with expected ones.
all.equal(x,y) returns TRUE if x and y are the same "for practical purposes"
but returns something else, typically a character vector describing
the discrapencies, otherwise. identical(x,y) returns TRUE if x and y
are exactly the same and FALSE otherwise.
There are some helper functions, atExpectWarnings and atExpectStop, that
allow you to test that the functions being tested produce expected
warning or error messages. atUsesRandom is a helper function
that hides from assertionTest the fact that the expression is uses random numbers
(hence changes the random number generator seed): it restores the seed
to its previous value so a test may be repeated.
Author
Bill Dunlap
Maintainer: Bill Dunlap <wdunlap@tibco.com>