Skip to content

Commit b5f81b1

Browse files
committed
streamlined initial test and sourceCpp
1 parent 4d8d89c commit b5f81b1

File tree

5 files changed

+10
-24
lines changed

5 files changed

+10
-24
lines changed

inst/tinytest/test_algorithm.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_algorithm.R'")
22-
23-
library(Rcpp)
24-
sourceCpp("cpp/algorithm.cpp")
21+
Rcpp::sourceCpp("cpp/algorithm.cpp")
2522

2623
# test.sum <- function() {
2724
v <- c(1.0, 2.0, 3.0, 4.0, 5.0)

inst/tinytest/test_as.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_as.R'")
22-
23-
library(Rcpp)
24-
sourceCpp("cpp/as.cpp")
21+
Rcpp::sourceCpp("cpp/as.cpp")
2522

2623
# test.as.int <- function(){
2724
expect_equal( as_int(10), 10L, info = "as<int>( REALSXP ) " )

inst/tinytest/test_attributes.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_attributes.R'")
22-
23-
library(Rcpp)
24-
sourceCpp("cpp/attributes.cpp")
21+
Rcpp::sourceCpp("cpp/attributes.cpp")
2522

2623
#test.attributes <- function() {
2724
expect_equal(comments_test(),

inst/tinytest/test_dataframe.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_dataframe.R'")
22-
23-
library(Rcpp)
24-
sourceCpp("cpp/DataFrame.cpp")
21+
Rcpp::sourceCpp("cpp/DataFrame.cpp")
2522

2623
#test.DataFrame.FromSEXP <- function() {
2724
DF <- data.frame(a=1:3, b=c("a","b","c"))

inst/tinytest/test_reference.R

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +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"
20-
if (! .runThisTest) exit_file("Set 'RunAllRcppTests' to 'yes' to run.")
19+
if (Sys.getenv("RunAllRcppTests") != "yes") exit_file("Set 'RunAllRcppTests' to 'yes' to run.")
2120

22-
library(Rcpp)
23-
sourceCpp("cpp/Reference.cpp")
21+
Rcpp::sourceCpp("cpp/Reference.cpp")
2422

2523
# test.Reference <- function(){
2624
Instrument <- setRefClass(Class="Instrument", fields=list("id"="character", "description"="character"))

0 commit comments

Comments
 (0)