Skip to content

Commit ab25ba0

Browse files
committed
streamlined initial test and sourceCpp
1 parent a7bf066 commit ab25ba0

13 files changed

+25
-61
lines changed

inst/tinytest/test_internal_function.R

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,9 @@
1616
## You should have received a copy of the GNU General Public License
1717
## along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
1818

19-
.runThisTest <- Sys.getenv("RunAllRcppTests") == "yes"
19+
if (Sys.getenv("RunAllRcppTests") != "yes") exit_file("Set 'RunAllRcppTests' to 'yes' to run.")
2020

21-
if (!.runThisTest) exit_file("Skipping 'test_internal_function.R'")
22-
23-
library(Rcpp)
24-
sourceCpp("cpp/InternalFunction.cpp")
21+
Rcpp::sourceCpp("cpp/InternalFunction.cpp")
2522

2623
# test.internal_function_add <- function(){
2724
fun <- getAdd()

inst/tinytest/test_internal_function_cpp11.R

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,11 @@
1616
## You should have received a copy of the GNU General Public License
1717
## along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
1818

19-
.runThisTest <- Sys.getenv("RunAllRcppTests") == "yes"
20-
21-
if (!.runThisTest) exit_file("Skipping 'test_internal_function.R'")
19+
if (Sys.getenv("RunAllRcppTests") != "yes") exit_file("Set 'RunAllRcppTests' to 'yes' to run.")
2220

2321
if (!Rcpp:::capabilities()[["Full C++11 support"]]) exit_file("No C++11 support")
2422

25-
library(Rcpp)
26-
sourceCpp("cpp/InternalFunctionCPP11.cpp")
23+
Rcpp::sourceCpp("cpp/InternalFunctionCPP11.cpp")
2724

2825
# test.internal_function_add <- function(){
2926
fun <- getAdd4()

inst/tinytest/test_language.R

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,9 @@
1616
## You should have received a copy of the GNU General Public License
1717
## along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
1818

19-
.runThisTest <- Sys.getenv("RunAllRcppTests") == "yes"
19+
if (Sys.getenv("RunAllRcppTests") != "yes") exit_file("Set 'RunAllRcppTests' to 'yes' to run.")
2020

21-
if (!.runThisTest) exit_file("Skipping, set 'RunAllRcppTests=yes' to run.")
22-
23-
library(Rcpp)
24-
sourceCpp("cpp/language.cpp")
21+
Rcpp::sourceCpp("cpp/language.cpp")
2522

2623
# test.Language <- function(){
2724
expect_equal( runit_language( call("rnorm") ), call("rnorm" ), info = "Language( LANGSXP )" )

inst/tinytest/test_listof.R

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,9 @@
1616
## You should have received a copy of the GNU General Public License
1717
## along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
1818

19-
.runThisTest <- Sys.getenv("RunAllRcppTests") == "yes"
19+
if (Sys.getenv("RunAllRcppTests") != "yes") exit_file("Set 'RunAllRcppTests' to 'yes' to run.")
2020

21-
if (!.runThisTest) exit_file("Skipping, set 'RunAllRcppTests=yes' to run.")
22-
23-
library(Rcpp)
24-
sourceCpp("cpp/ListOf.cpp")
21+
Rcpp::sourceCpp("cpp/ListOf.cpp")
2522

2623
x <- list( c(1, 5), c(2, 6), c(3, 7) )
2724

inst/tinytest/test_matrix.R

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,9 @@
1616
## You should have received a copy of the GNU General Public License
1717
## along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
1818

19-
.runThisTest <- Sys.getenv("RunAllRcppTests") == "yes"
19+
if (Sys.getenv("RunAllRcppTests") != "yes") exit_file("Set 'RunAllRcppTests' to 'yes' to run.")
2020

21-
if (!.runThisTest) exit_file("Skipping, set 'RunAllRcppTests=yes' to run.")
22-
23-
library(Rcpp)
24-
sourceCpp("cpp/Matrix.cpp")
21+
Rcpp::sourceCpp("cpp/Matrix.cpp")
2522

2623
# test.List.column <- function() {
2724
x <- matrix( 1:16+.5, nc = 4 )

inst/tinytest/test_misc.R

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,9 @@
1616
## You should have received a copy of the GNU General Public License
1717
## along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
1818

19-
.runThisTest <- Sys.getenv("RunAllRcppTests") == "yes"
19+
if (Sys.getenv("RunAllRcppTests") != "yes") exit_file("Set 'RunAllRcppTests' to 'yes' to run.")
2020

21-
if (!.runThisTest) exit_file("Skipping, set 'RunAllRcppTests=yes' to run.")
22-
23-
library(Rcpp)
24-
sourceCpp("cpp/misc.cpp")
21+
Rcpp::sourceCpp("cpp/misc.cpp")
2522

2623
# test.Symbol <- function(){
2724
res <- symbol_()

inst/tinytest/test_modref.R

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,9 @@
1616
## You should have received a copy of the GNU General Public License
1717
## along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
1818

19-
.runThisTest <- Sys.getenv("RunAllRcppTests") == "yes"
19+
if (Sys.getenv("RunAllRcppTests") != "yes") exit_file("Set 'RunAllRcppTests' to 'yes' to run.")
2020

21-
if (!.runThisTest) exit_file("Skipping, set 'RunAllRcppTests=yes' to run.")
22-
23-
library(Rcpp)
24-
sourceCpp("cpp/modref.cpp")
21+
Rcpp::sourceCpp("cpp/modref.cpp")
2522

2623
# test.modRef <- function() {
2724
ww <- new(ModRefWorld)

inst/tinytest/test_module.R

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,11 @@
1616
# You should have received a copy of the GNU General Public License
1717
# along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
1818

19-
.runThisTest <- Sys.getenv("RunAllRcppTests") == "yes"
20-
21-
if (!.runThisTest) exit_file("Skipping, set 'RunAllRcppTests=yes' to run.")
19+
if (Sys.getenv("RunAllRcppTests") != "yes") exit_file("Set 'RunAllRcppTests' to 'yes' to run.")
2220

2321
if( ! Rcpp:::capabilities()[["Rcpp modules"]] ) exit_file("Skipping as no Modules capability.")
2422

25-
library(Rcpp)
26-
sourceCpp("cpp/Module.cpp")
23+
Rcpp::sourceCpp("cpp/Module.cpp")
2724

2825
# test.Module <- function(){
2926
expect_equal( bar( 2L ), 4L )

inst/tinytest/test_na.R

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,9 @@
1616
## You should have received a copy of the GNU General Public License
1717
## along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
1818

19-
.runThisTest <- Sys.getenv("RunAllRcppTests") == "yes"
19+
if (Sys.getenv("RunAllRcppTests") != "yes") exit_file("Set 'RunAllRcppTests' to 'yes' to run.")
2020

21-
if (!.runThisTest) exit_file("Skipping, set 'RunAllRcppTests=yes' to run.")
22-
23-
library(Rcpp)
24-
sourceCpp("cpp/na.cpp")
21+
Rcpp::sourceCpp("cpp/na.cpp")
2522

2623
#test.na <- function() {
2724
expect_identical( R_IsNA_(NA_real_), Rcpp_IsNA(NA_real_) )

inst/tinytest/test_packageversion.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
## You should have received a copy of the GNU General Public License
1717
## along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
1818

19-
library(Rcpp)
19+
if (Sys.getenv("RunAllRcppTests") != "yes") exit_file("Set 'RunAllRcppTests' to 'yes' to run.")
2020

2121
Rcpp::sourceCpp("cpp/rcppversion.cpp")
2222

0 commit comments

Comments
 (0)