Skip to content

Commit fd0b205

Browse files
authored
Merge pull request #601 from RcppCore/feature/more_tests
more tests, and some #nocov tags
2 parents 0c3d0b1 + 5620275 commit fd0b205

File tree

7 files changed

+76
-12
lines changed

7 files changed

+76
-12
lines changed

.codecov.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,7 @@
1-
comment: false
1+
comment:
2+
layout: "header, diff, tree, changes"
3+
behavior: default
4+
require_changes: false # if true: only post the comment if coverage changes
5+
branches: null
6+
flags: null
7+
paths: null

ChangeLog

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
1+
2016-12-04 Dirk Eddelbuettel <[email protected]>
2+
3+
* .codecov.yml (comment): Enable more verbose codecov.io reports
4+
15
2016-12-03 Dirk Eddelbuettel <[email protected]>
26

37
* inst/unitTests/cpp/dates.cpp (Datetime_format): Additional ostream tests
48
* inst/unitTests/runit.Date.R (test.Date.formating): Ditto
59

10+
* inst/unitTests/runit.system.R (test.RcppCxx): New tests
11+
12+
* R/RcppLdpath.R (canUseCXX0X): Simplified as we can now rely on more
13+
modern compilers; underlying C++ code has not been present for a while
14+
15+
* R/compilerCheck.R (compilerCheck): Added some #nocov tags
16+
* R/unit.tests.R (test, gctortureRUnitTest): Ditto
17+
* R/zzz.R (.onLoad): Ditto
18+
619
2016-11-29 Dirk Eddelbuettel <[email protected]>
720

821
* DESCRIPTION (Version, Date): Roll minor version to 0.12.8.2

R/RcppLdpath.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ RcppLdPath <- function() {
3737
RcppLdFlags <- function() { "" }
3838

3939
# indicates if Rcpp was compiled with GCC >= 4.3
40-
canUseCXX0X <- function() .Call( "canUseCXX0X", PACKAGE = "Rcpp" )
40+
canUseCXX0X <- function() { TRUE } # .Call( "canUseCXX0X", PACKAGE = "Rcpp" )
4141

4242
## Provide compiler flags -- i.e. -I/path/to/Rcpp.h
4343
RcppCxxFlags <- function(cxx0x=FALSE) {

R/compilerCheck.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
##' @return A boolean value is returned, indicating if the minimal version is
1313
##' being met
1414
##' @author Dirk Eddelbuettel
15-
compilerCheck <- function(minVersion=package_version("4.6.0")) {
15+
compilerCheck <- function(minVersion=package_version("4.6.0")) { # nocov start
1616

1717
binaries <- c("g++", Sys.getenv("CXX", unset=""), Sys.getenv("CXX1X", unset=""))
1818
binpaths <- lapply(binaries, function(b) { if (b=="") NULL else Sys.which(b) })
@@ -29,7 +29,7 @@ compilerCheck <- function(minVersion=package_version("4.6.0")) {
2929
package_version(ver) >= minVersion
3030
})
3131
all(do.call(c, rl)) # drops NULLs
32-
}
32+
} # nocov end
3333

3434
## TODO: maybe not limit to gcc/g++
3535
## TODO: maybe be smarter about combination of path, CXX and CXX1X ?

R/unit.tests.R

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2010 - 2015 Dirk Eddelbuettel, Romain Francois and Kevin Ushey
1+
# Copyright (C) 2010 - 2016 Dirk Eddelbuettel, Romain Francois and Kevin Ushey
22
#
33
# This file is part of Rcpp.
44
#
@@ -19,7 +19,7 @@ test <- function(output=if(file.exists("/tmp")) "/tmp" else getwd(),
1919
gctorture=FALSE,
2020
gctorture.exclude="runit.Module.client.package.R") {
2121

22-
if (requireNamespace("RUnit")) {
22+
if (requireNamespace("RUnit")) { # nocov start
2323

2424
if (gctorture) {
2525

@@ -82,7 +82,7 @@ test <- function(output=if(file.exists("/tmp")) "/tmp" else getwd(),
8282
RUnit::printTextProtocol(tests)
8383

8484
return(tests)
85-
}
85+
} # nocov end
8686

8787
stop("Running unit tests requires the 'RUnit' package.")
8888
}
@@ -101,9 +101,9 @@ unitTestSetup <- function(file, packages=NULL,
101101

102102
gctortureRUnitTest <- function(file) {
103103

104-
test <- readLines(file)
104+
test <- readLines(file) # nocov start
105105

106-
## TODO: handle '{', '}' within quotes
106+
## todo: handle '{', '}' within quotes
107107
findMatchingBrace <- function(test, start, balance=1) {
108108
line <- test[start]
109109
if (start > length(test)) {
@@ -135,6 +135,6 @@ gctortureRUnitTest <- function(file) {
135135
test[end] <- paste("gctorture(FALSE); }")
136136
}
137137

138-
cat(test, file=file, sep="\n")
138+
cat(test, file=file, sep="\n") # nocov end
139139

140140
}

R/zzz.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (C) 2009 - 2013 Dirk Eddelbuettel and Romain Francois
1+
# Copyright (C) 2009 - 2016 Dirk Eddelbuettel and Romain Francois
22
#
33
# This file is part of Rcpp.
44
#
@@ -20,7 +20,7 @@
2020
.classes_map <- new.env()
2121

2222
.onLoad <- function(libname, pkgname){
23-
new_dummyObject(.dummyInstancePointer);
23+
new_dummyObject(.dummyInstancePointer) # nocov
2424
}
2525

2626

inst/unitTests/runit.system.R

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env r
2+
# -*- mode: R; tab-width: 4; -*-
3+
#
4+
# Copyright (C) 2016 Dirk Eddelbuettel
5+
#
6+
# This file is part of Rcpp.
7+
#
8+
# Rcpp is free software: you can redistribute it and/or modify it
9+
# under the terms of the GNU General Public License as published by
10+
# the Free Software Foundation, either version 2 of the License, or
11+
# (at your option) any later version.
12+
#
13+
# Rcpp is distributed in the hope that it will be useful, but
14+
# WITHOUT ANY WARRANTY; without even the implied warranty of
15+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+
# GNU General Public License for more details.
17+
#
18+
# You should have received a copy of the GNU General Public License
19+
# along with Rcpp. If not, see <http://www.gnu.org/licenses/>.
20+
21+
.runThisTest <- Sys.getenv("RunAllRcppTests") == "yes"
22+
23+
if (.runThisTest) {
24+
25+
test.Rcpp.system.file <- function() {
26+
inc_rcpp <- Rcpp:::Rcpp.system.file("include")
27+
inc_sys <- tools::file_path_as_absolute( base::system.file("include", package = "Rcpp"))
28+
checkEquals(inc_rcpp, inc_sys, msg = "Rcpp.system.file")
29+
30+
}
31+
32+
test.RcppLd <- function() {
33+
checkTrue(Rcpp:::RcppLdPath() == "", msg = "RcppLdPath")
34+
checkTrue(Rcpp:::RcppLdFlags() == "", msg = "RcppLdFlags")
35+
checkEquals(Rcpp:::LdFlags(), NULL, msg = "LdFlags")
36+
}
37+
38+
test.RcppCxx <- function() {
39+
checkTrue(Rcpp:::canUseCXX0X(), msg = "canUseCXX0X")
40+
checkTrue(Rcpp:::RcppCxxFlags() != "", msg = "RcppCxxFlags()")
41+
checkEquals(Rcpp:::CxxFlags(), NULL, msg = "CxxFlags()")
42+
43+
checkTrue(length(Rcpp:::RcppCapabilities()) >= 13, msg = "RcppCapabilities()")
44+
}
45+
}

0 commit comments

Comments
 (0)