-
Notifications
You must be signed in to change notification settings - Fork 55
/
Copy pathtest_misc.R
45 lines (39 loc) · 1.65 KB
/
test_misc.R
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/r -t
#
# Copyright (C) 2021-2023 Dirk Eddelbuettel
#
# This file is part of RcppArmadillo.
#
# RcppArmadillo is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# RcppArmadillo is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with RcppArmadillo. If not, see <http://www.gnu.org/licenses/>.
library(RcppArmadillo)
## -- src/RcppArmadillo.cpp
arma <- armadillo_version(FALSE)
expect_equal(length(arma), 3) # major minor patch
expect_equal(names(arma), c("major","minor","patch"))
arma <- armadillo_version(TRUE)
expect_equal(class(arma), "integer")
expect_equal(length(arma), 1L)
## no tests as we have no (current) accessor as we prefer R RNGs
expect_warning(armadillo_set_seed_random())
armadillo_set_seed(42L) # no test as we have no (current) accessor as we prefer R RNGs
## -- R/flags.R
cxxflags <- RcppArmadillo:::RcppArmadilloCxxFlags()
expect_true(is.character(cxxflags))
expect_stdout(RcppArmadillo:::CxxFlags())
## 'set number of threads' helper -- adding simple test
expect_true(is.integer(armadillo_get_number_of_omp_threads()))
expect_silent(armadillo_set_number_of_omp_threads(2))
## startup throttle/restore helpers
expect_silent(armadillo_throttle_cores())
expect_silent(armadillo_reset_cores())