[Rcpp-devel] [Rcpp-commits] r261 - in pkg: inst/unitTests src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Jan 3 13:24:50 CET 2010
Author: romain
Date: 2010-01-03 13:24:50 +0100 (Sun, 03 Jan 2010)
New Revision: 261
Modified:
pkg/inst/unitTests/runit.Symbol.R
pkg/src/Symbol.cpp
Log:
fixed Symbol( SYMSXP ) constructor
Modified: pkg/inst/unitTests/runit.Symbol.R
===================================================================
--- pkg/inst/unitTests/runit.Symbol.R 2010-01-03 11:30:08 UTC (rev 260)
+++ pkg/inst/unitTests/runit.Symbol.R 2010-01-03 12:24:50 UTC (rev 261)
@@ -39,7 +39,11 @@
UNPROTECT(1) ; /* res */
return res ;
', Rcpp=TRUE, verbose=FALSE, includes = "using namespace Rcpp;" )
- checkTrue( all( funx() ), msg = "Symbol creation" )
+ res <- funx()
+ checkTrue( res[1L], msg = "Symbol creation - SYMSXP " )
+ checkTrue( res[2L], msg = "Symbol creation - CHARSXP " )
+ checkTrue( res[3L], msg = "Symbol creation - STRSXP " )
+ checkTrue( res[4L], msg = "Symbol creation - std::string " )
}
test.Symbol.notcompatible <- function(){
Modified: pkg/src/Symbol.cpp
===================================================================
--- pkg/src/Symbol.cpp 2010-01-03 11:30:08 UTC (rev 260)
+++ pkg/src/Symbol.cpp 2010-01-03 12:24:50 UTC (rev 261)
@@ -29,11 +29,12 @@
return "not compatible with Symbol, excepting SYMSXP, CHARSXP or STRSXP" ;
}
- Symbol::Symbol( SEXP x = R_NilValue ) throw(not_compatible) : RObject::RObject() {
+ Symbol::Symbol( SEXP x ) throw(not_compatible) : RObject::RObject() {
if( x != R_NilValue ){
int type = TYPEOF(x) ;
switch( type ){
case SYMSXP:
+ setSEXP( x ) ;
break; /* nothing to do */
case CHARSXP:
setSEXP( Rf_install(CHAR(x)) ) ;
_______________________________________________
Rcpp-commits mailing list
Rcpp-commits at lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-commits
More information about the Rcpp-devel
mailing list