1
1
# !/usr/bin/env r
2
2
#
3
- # Copyright (C) 2010 - 2015 Dirk Eddelbuettel and Romain Francois
3
+ # Copyright (C) 2010 - 2017 Dirk Eddelbuettel and Romain Francois
4
4
#
5
5
# This file is part of Rcpp.
6
6
#
@@ -98,78 +98,78 @@ if (.runThisTest) {
98
98
}
99
99
100
100
test.AreMacrosDefined <- function (){
101
- checkTrue( Rcpp ::: areMacrosDefined( " __cplusplus" ) )
101
+ checkTrue( Rcpp ::: areMacrosDefined( " __cplusplus" ) )
102
102
}
103
-
103
+
104
104
test.rcout <- function (){
105
105
# # define test string that is written to two files
106
106
teststr <- " First line.\n Second line."
107
107
108
108
rcppfile <- tempfile()
109
109
rfile <- tempfile()
110
-
110
+
111
111
# # write to test_rcpp.txt from Rcpp
112
112
test_rcout(rcppfile , teststr )
113
-
113
+
114
114
# # write to test_r.txt from R
115
115
cat( teststr , file = rfile , sep = ' \n ' )
116
-
116
+
117
117
# # 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" )
119
119
}
120
120
121
121
test.rcout.complex <- function (){
122
122
123
123
rcppfile <- tempfile()
124
124
rfile <- tempfile()
125
-
125
+
126
126
z <- complex (real = sample(1 : 10 , 1 ), imaginary = sample(1 : 10 , 1 ))
127
-
127
+
128
128
# # write to test_rcpp.txt from Rcpp
129
129
test_rcout_rcomplex(rcppfile , z )
130
-
130
+
131
131
# # write to test_r.txt from R
132
132
cat( z , file = rfile , sep = ' \n ' )
133
-
133
+
134
134
# # 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" )
136
136
}
137
137
138
138
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 ),
142
142
msg = " Na_Proxy NA == handling"
143
- )
143
+ )
144
144
}
145
145
146
146
test.StretchyList <- function (){
147
- checkEquals(
147
+ checkEquals(
148
148
stretchy_list(),
149
149
pairlist( " foo" , 1L , 3.2 )
150
150
)
151
151
}
152
152
153
153
test.named_StretchyList <- function (){
154
- checkEquals(
154
+ checkEquals(
155
155
named_stretchy_list(),
156
156
pairlist( a = " foo" , b = 1L , c = 3.2 )
157
157
)
158
158
}
159
-
159
+
160
160
test.stop.variadic <- function (){
161
161
m <- tryCatch( test_stop_variadic(), error = function (e ){
162
- conditionMessage(e )
162
+ conditionMessage(e )
163
163
})
164
- checkEquals( m , " foo 3" )
164
+ checkEquals( m , " foo 3" )
165
165
}
166
166
167
167
test.NullableForNull <- function () {
168
168
M <- matrix (1 : 4 , 2 , 2 )
169
169
checkTrue( testNullableForNull(NULL ) )
170
170
checkTrue( ! testNullableForNull(M ) )
171
171
}
172
-
172
+
173
173
test.NullableForNotNull <- function () {
174
174
M <- matrix (1 : 4 , 2 , 2 )
175
175
checkTrue( ! testNullableForNotNull(NULL ) )
@@ -180,7 +180,7 @@ if (.runThisTest) {
180
180
M <- matrix (1 : 4 , 2 , 2 )
181
181
checkEquals( testNullableOperator(M ), M )
182
182
}
183
-
183
+
184
184
test.NullableAccessGet <- function () {
185
185
M <- matrix (1 : 4 , 2 , 2 )
186
186
checkEquals( testNullableGet(M ), M )
@@ -209,4 +209,10 @@ if (.runThisTest) {
209
209
checkEquals(testNullableString(), " " )
210
210
checkEquals(testNullableString(" blah" ), " blah" )
211
211
}
212
+
213
+ test.bib <- function () {
214
+ checkTrue(nchar(system.file(" bib" , " Rcpp.bib" , package = " Rcpp" )) > 0 ,
215
+ msg = " bib file" )
216
+ }
217
+
212
218
}
0 commit comments