Skip to content

Commit f5d900c

Browse files
committed
additional unit test
1 parent 3166829 commit f5d900c

File tree

3 files changed

+33
-23
lines changed

3 files changed

+33
-23
lines changed

ChangeLog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
* vignettes/Rcpp-packages.Rnw: Idem
1212
* vignettes/Rcpp-sugar.Rnw: Idem
1313

14+
* inst/unitTests/runit.misc.R (test.bib): New test
15+
1416
2017-01-11 Dirk Eddelbuettel <[email protected]>
1517

1618
* vignettes/Rcpp.bib: Updated references

inst/NEWS.Rd

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232
\itemize{
3333
\item Exposed pointers macros were included in the Rcpp Extending vignette
3434
(MathurinD; James Balamuta in \ghpr{592} addressing \ghit{418}).
35+
\item The file \code{Rcpp.bib} move to directory \code{bib} which is
36+
guaranteed to be present.
3537
}
3638
\item Changes in Rcpp build system
3739
\itemize{

inst/unitTests/runit.misc.R

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env r
22
#
3-
# Copyright (C) 2010 - 2015 Dirk Eddelbuettel and Romain Francois
3+
# Copyright (C) 2010 - 2017 Dirk Eddelbuettel and Romain Francois
44
#
55
# This file is part of Rcpp.
66
#
@@ -98,78 +98,78 @@ if (.runThisTest) {
9898
}
9999

100100
test.AreMacrosDefined <- function(){
101-
checkTrue( Rcpp:::areMacrosDefined( "__cplusplus" ) )
101+
checkTrue( Rcpp:::areMacrosDefined( "__cplusplus" ) )
102102
}
103-
103+
104104
test.rcout <- function(){
105105
## define test string that is written to two files
106106
teststr <- "First line.\nSecond line."
107107

108108
rcppfile <- tempfile()
109109
rfile <- tempfile()
110-
110+
111111
## write to test_rcpp.txt from Rcpp
112112
test_rcout(rcppfile, teststr )
113-
113+
114114
## write to test_r.txt from R
115115
cat( teststr, file=rfile, sep='\n' )
116-
116+
117117
## compare whether the two files have the same data
118-
checkEquals( readLines(rcppfile), readLines(rfile), msg="Rcout output")
118+
checkEquals( readLines(rcppfile), readLines(rfile), msg="Rcout output")
119119
}
120120

121121
test.rcout.complex <- function(){
122122

123123
rcppfile <- tempfile()
124124
rfile <- tempfile()
125-
125+
126126
z <- complex(real=sample(1:10, 1), imaginary=sample(1:10, 1))
127-
127+
128128
## write to test_rcpp.txt from Rcpp
129129
test_rcout_rcomplex(rcppfile, z )
130-
130+
131131
## write to test_r.txt from R
132132
cat( z, file=rfile, sep='\n' )
133-
133+
134134
## compare whether the two files have the same data
135-
checkEquals( readLines(rcppfile), readLines(rfile), msg="Rcout Rcomplex")
135+
checkEquals( readLines(rcppfile), readLines(rfile), msg="Rcout Rcomplex")
136136
}
137137

138138
test.na_proxy <- function(){
139-
checkEquals(
140-
na_proxy(),
141-
rep(c(TRUE,TRUE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE) , 2),
139+
checkEquals(
140+
na_proxy(),
141+
rep(c(TRUE,TRUE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE) , 2),
142142
msg = "Na_Proxy NA == handling"
143-
)
143+
)
144144
}
145145

146146
test.StretchyList <- function(){
147-
checkEquals(
147+
checkEquals(
148148
stretchy_list(),
149149
pairlist( "foo", 1L, 3.2 )
150150
)
151151
}
152152

153153
test.named_StretchyList <- function(){
154-
checkEquals(
154+
checkEquals(
155155
named_stretchy_list(),
156156
pairlist( a = "foo", b = 1L, c = 3.2 )
157157
)
158158
}
159-
159+
160160
test.stop.variadic <- function(){
161161
m <- tryCatch( test_stop_variadic(), error = function(e){
162-
conditionMessage(e)
162+
conditionMessage(e)
163163
})
164-
checkEquals( m, "foo 3" )
164+
checkEquals( m, "foo 3" )
165165
}
166166

167167
test.NullableForNull <- function() {
168168
M <- matrix(1:4, 2, 2)
169169
checkTrue( testNullableForNull(NULL) )
170170
checkTrue( ! testNullableForNull(M) )
171171
}
172-
172+
173173
test.NullableForNotNull <- function() {
174174
M <- matrix(1:4, 2, 2)
175175
checkTrue( ! testNullableForNotNull(NULL) )
@@ -180,7 +180,7 @@ if (.runThisTest) {
180180
M <- matrix(1:4, 2, 2)
181181
checkEquals( testNullableOperator(M), M )
182182
}
183-
183+
184184
test.NullableAccessGet <- function() {
185185
M <- matrix(1:4, 2, 2)
186186
checkEquals( testNullableGet(M), M )
@@ -209,4 +209,10 @@ if (.runThisTest) {
209209
checkEquals(testNullableString(), "")
210210
checkEquals(testNullableString("blah"), "blah")
211211
}
212+
213+
test.bib <- function() {
214+
checkTrue(nchar(system.file("bib", "Rcpp.bib", package="Rcpp")) > 0,
215+
msg="bib file")
216+
}
217+
212218
}

0 commit comments

Comments
 (0)