Skip to content

Commit 2c27ae6

Browse files
committed
additional tests
1 parent 8604a72 commit 2c27ae6

File tree

4 files changed

+52
-0
lines changed

4 files changed

+52
-0
lines changed

.Rbuildignore

+2
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,5 @@ debian
1111
^.editorconfig$
1212
^eigen-?\.?\.?
1313
^\.github
14+
^\.codecov.yml
15+
^\.covrignore

ChangeLog

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2021-06-07 Dirk Eddelbuettel <[email protected]>
2+
3+
* inst/tinytest/test_misc.R: New test file
4+
* inst/tinytest/test_fastLm.R: Added tests
5+
6+
* .Rbuildignore: Add .covignore and .codecov.yml
7+
18
2021-06-06 Dirk Eddelbuettel <[email protected]>
29

310
* README.md: Added coverage badge

inst/tinytest/test_fastLm.R

+9
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,12 @@ fit <- lm(log(Volume) ~ log(Girth), data=trees)
5454
expect_equal(flm$coefficients, coef(fit), info="fastLm.formula.coef")
5555
expect_equal(as.numeric(flm$se), as.numeric(coef(summary(fit))[,2]),
5656
info="fastLm.formula.stderr")
57+
58+
## also tickle print and predict methods
59+
expect_stdout(print(flm))
60+
expect_stdout(print(summary(flm)))
61+
vec <- predict(flm, newdata=data.frame(Girth=c(1,2,3), Volume=c(2,3,4)))
62+
expect_equal(class(vec), "numeric")
63+
expect_equal(length(vec), 3L)
64+
vec <- predict(flm, newdata=NULL)
65+
expect_equal(vec, fitted(flm))

inst/tinytest/test_misc.R

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/r -t
2+
#
3+
# Copyright (C) 2021 Dirk Eddelbuettel
4+
#
5+
# This file is part of RcppEigen
6+
#
7+
# RcppEigen is free software: you can redistribute it and/or modify it
8+
# under the terms of the GNU General Public License as published by
9+
# the Free Software Foundation, either version 2 of the License, or
10+
# (at your option) any later version.
11+
#
12+
# RcppEigen is distributed in the hope that it will be useful, but
13+
# WITHOUT ANY WARRANTY; without even the implied warranty of
14+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
# GNU General Public License for more details.
16+
#
17+
# You should have received a copy of the GNU General Public License
18+
# along with RcppEigen. If not, see <http://www.gnu.org/licenses/>.
19+
20+
library(RcppEigen)
21+
22+
## -- src/RcppEigen.cpp
23+
eig <- RcppEigen:::eigen_version(FALSE)
24+
expect_equal(length(eig), 3) # major minor patch
25+
expect_equal(names(eig), c("major","minor","patch"))
26+
eig <- RcppEigen:::eigen_version(TRUE)
27+
expect_equal(class(eig), "integer")
28+
expect_equal(length(eig), 1L)
29+
expect_equal(class(RcppEigen:::Eigen_SSE()), "logical")
30+
31+
## -- R/flags.R
32+
cxxflags <- RcppEigen:::RcppEigenCxxFlags()
33+
expect_true(is.character(cxxflags))
34+
expect_stdout(RcppEigen:::CxxFlags())

0 commit comments

Comments
 (0)