1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
## Run unit tests
## Charlie Redmon
## 20170802
if (!require("RUnit", quietly = TRUE)) {
warning("Cannot run unit tests. Package RUnit is not available.")
q('no')
}
library(kutils)
path <- system.file(package="kutils", "unitTests")
stopifnot(file.exists(path), file.info(path.expand(path))$isdir)
testsuite.variableKey <- defineTestSuite("VariableKey",
dirs=path,
testFileRegexp="^runit.+\\.R",
testFuncRegexp="^test.+",
rngKind="Marsaglia-Multicarry",
rngNormalKind="Kinderman-Ramage")
testResult <- runTestSuite(testsuite.variableKey)
printTextProtocol(testResult, showDetails=TRUE)
tmp <- getErrors(testResult)
if (tmp$nFail > 0 | tmp$nErr > 0) {
stop(paste0("\n\nUnit testing failed (", tmp$nFail, " test failures), ",
tmp$nErr, " R errors)\n\n"))
}
|