Skip to content

Commit 25e223f

Browse files
committed
tinytest conversion step three: convert runner, use tinytest
1 parent e4afb2d commit 25e223f

File tree

4 files changed

+17
-30
lines changed

4 files changed

+17
-30
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ before_install:
1111
- ./run.sh bootstrap
1212

1313
install:
14-
- ./run.sh install_aptget r-cran-rcpp r-cran-matrix r-cran-inline r-cran-runit r-cran-pkgkitten r-cran-microbenchmark
14+
- ./run.sh install_aptget r-cran-rcpp r-cran-matrix r-cran-inline r-cran-tinytest r-cran-pkgkitten r-cran-microbenchmark
1515

1616
script:
1717
- ./run.sh run_tests

ChangeLog

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
2019-10-30 Dirk Eddelbuettel <[email protected]>
22

3+
* DESCRIPTION (Suggests): Switch from RUnit to tinytest
4+
* .travis.yml (install): Ditto
5+
6+
* tests/tinytest.R: Converted to tinytest
7+
38
* test_sparse.R: Converted to tinytest
49
* cpp/sparse.cpp: Added
510

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,6 @@ Depends: R (>= 2.15.1)
2525
LazyLoad: yes
2626
LinkingTo: Rcpp
2727
Imports: Matrix (>= 1.1-0), Rcpp (>= 0.11.0), stats, utils
28-
Suggests: inline, RUnit, pkgKitten, microbenchmark
28+
Suggests: inline, tinytest, pkgKitten, microbenchmark
2929
URL: http://dirk.eddelbuettel.com/code/rcpp.eigen.html
3030
BugReports: https://github.com/RcppCore/RcppEigen/issues

tests/tinytest.R

+10-28
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,15 @@
1-
#### doRUnit.R --- Run RUnit tests
2-
####------------------------------------------------------------------------
31

4-
### borrowed from package fUtilities in RMetrics
5-
### http://r-forge.r-project.org/plugins/scmsvn/viewcvs.php/pkg/fUtilities/tests/doRUnit.R?rev=1958&root=rmetrics&view=markup
2+
if (requireNamespace("tinytest", quietly=TRUE) &&
3+
utils::packageVersion("tinytest") >= "1.0.0") {
64

7-
### Originally follows Gregor Gojanc's example in CRAN package 'gdata'
8-
### and the corresponding section in the R Wiki:
9-
### http://wiki.r-project.org/rwiki/doku.php?id=developers:runit
5+
## Set a seed to make the test deterministic
6+
set.seed(42)
107

11-
### MM: Vastly changed: This should also be "runnable" for *installed*
12-
## package which has no ./tests/
13-
## ----> put the bulk of the code e.g. in ../inst/unitTests/runTests.R :
8+
## R makes us to this
9+
Sys.setenv("R_TESTS"="")
1410

15-
if(require("RUnit", quietly = TRUE)) {
16-
pkg <- "RcppEigen"
17-
18-
require( pkg, character.only=TRUE)
19-
20-
path <- system.file("unitTests", package = pkg)
21-
22-
stopifnot(file.exists(path), file.info(path.expand(path))$isdir)
23-
24-
## without this, we get unit test failures
25-
Sys.setenv( R_TESTS = "" )
26-
27-
RcppEigen.unit.test.output.dir <- getwd()
28-
29-
source(file.path(path, "runTests.R"), echo = TRUE)
30-
31-
} else {
32-
print( "package RUnit not available, cannot run unit tests" )
11+
## there are several more granular ways to test files in a tinytest directory,
12+
## see its package vignette; tests can also run once the package is installed
13+
## using the same command `test_package(pkgName)`, or by director or file
14+
tinytest::test_package("RcppEigen", ncpu=getOption("Ncpus", 1))
3315
}

0 commit comments

Comments
 (0)