-
Notifications
You must be signed in to change notification settings - Fork 59
Expand file tree
/
Copy pathdoRUnit.R
More file actions
30 lines (24 loc) · 748 Bytes
/
doRUnit.R
File metadata and controls
30 lines (24 loc) · 748 Bytes
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
30
stopifnot(require(RUnit, quietly=TRUE))
stopifnot(require(Rcpp, quietly=TRUE))
stopifnot(require(RcppParallel, quietly=TRUE))
## Set a seed to make the test deterministic
set.seed(42)
## Define tests
suite <- defineTestSuite(name="RcppParallel Unit Tests",
dirs=system.file("tests", package = "RcppParallel"))
## Based on practice in Rcpp to avoid some test failures
Sys.setenv("R_TESTS"="")
## Run tests
tests <- runTestSuite(suite)
## Print results
printTextProtocol(tests)
## Return success or failure to R CMD CHECK
if (getErrors(tests)$nFail > 0) {
stop("TEST FAILED!")
}
if (getErrors(tests)$nErr > 0) {
stop("TEST HAD ERRORS!")
}
if (getErrors(tests)$nTestFunc < 1) {
stop("NO TEST FUNCTIONS RUN!")
}