[Rcpp-commits] r391 - in pkg: inst inst/unitTests src src/Rcpp

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Jan 17 12:12:02 CET 2010


Author: romain
Date: 2010-01-17 12:12:02 +0100 (Sun, 17 Jan 2010)
New Revision: 391

Modified:
   pkg/inst/ChangeLog
   pkg/inst/unitTests/runit.CharacterVector.R
   pkg/inst/unitTests/runit.ComplexVector.R
   pkg/inst/unitTests/runit.ExpressionVector.R
   pkg/inst/unitTests/runit.Function.R
   pkg/inst/unitTests/runit.GenericVector.R
   pkg/inst/unitTests/runit.IntegerVector.R
   pkg/inst/unitTests/runit.Language.R
   pkg/inst/unitTests/runit.NumericVector.R
   pkg/inst/unitTests/runit.Pairlist.R
   pkg/inst/unitTests/runit.RawVector.R
   pkg/inst/unitTests/runit.wrap.R
   pkg/src/Pairlist.cpp
   pkg/src/Rcpp/Pairlist.h
Log:
adapt unit test to absence of c++0x in Rcpp:::CxxFlags()

Modified: pkg/inst/ChangeLog
===================================================================
--- pkg/inst/ChangeLog	2010-01-17 10:46:17 UTC (rev 390)
+++ pkg/inst/ChangeLog	2010-01-17 11:12:02 UTC (rev 391)
@@ -1,5 +1,11 @@
 2010-01-16  Romain Francois <francoisromain at free.fr>
 
+	* src/Rcpp/Pairlist.h: Pairlist lacked a default constructor
+	which is needed when the variadic templates are not 
+	available
+
+	* inst/unitTests/*: add -std=c++0x in inline when necessary
+
 	* R/RcppLdPath.R : new script RcppCxx0xFlags() and Cxx0xFlags()
 	that compile, load and call a simple C file in order to check 
 	the compiler version and add the -std=c++0x flag

Modified: pkg/inst/unitTests/runit.CharacterVector.R
===================================================================
--- pkg/inst/unitTests/runit.CharacterVector.R	2010-01-17 10:46:17 UTC (rev 390)
+++ pkg/inst/unitTests/runit.CharacterVector.R	2010-01-17 11:12:02 UTC (rev 391)
@@ -48,7 +48,9 @@
 		funx <- cfunction(signature(), '
 		CharacterVector x = {"foo", "bar"} ;
 		return x ;', 
-			Rcpp=TRUE, verbose=FALSE, includes = "using namespace Rcpp;" )
+			Rcpp=TRUE, verbose=FALSE, 
+			includes = "using namespace Rcpp;",
+			cxxargs = "-std=c++0x" )
 		checkEquals( funx(), c("foo","bar"), msg = "CharacterVector( initializer list) " )
 	}
 }

Modified: pkg/inst/unitTests/runit.ComplexVector.R
===================================================================
--- pkg/inst/unitTests/runit.ComplexVector.R	2010-01-17 10:46:17 UTC (rev 390)
+++ pkg/inst/unitTests/runit.ComplexVector.R	2010-01-17 11:12:02 UTC (rev 391)
@@ -53,7 +53,9 @@
 		Rcomplex c2 ; c2.r = c2.i = 1.0 ;
 		ComplexVector x = { c1, c2 } ;
 		return x ;', 
-			Rcpp=TRUE, verbose=FALSE, includes = "using namespace Rcpp;" )
+			Rcpp=TRUE, verbose=FALSE, 
+			includes = "using namespace Rcpp;", 
+			cxxargs = "-std=c++0x" )
 		checkEquals( funx(), c( 0:1*(1+1i)), msg = "ComplexVector( initializer list) " )
 	}
 }

Modified: pkg/inst/unitTests/runit.ExpressionVector.R
===================================================================
--- pkg/inst/unitTests/runit.ExpressionVector.R	2010-01-17 10:46:17 UTC (rev 390)
+++ pkg/inst/unitTests/runit.ExpressionVector.R	2010-01-17 11:12:02 UTC (rev 391)
@@ -42,7 +42,9 @@
 		x[0] = Symbol( "rnorm" ) ;
 		x[1] = Language( "rnorm", 10.0 ) ;
 		return x ;', 
-			Rcpp=TRUE, verbose=FALSE, includes = "using namespace Rcpp;" )
+			Rcpp=TRUE, verbose=FALSE, 
+			includes = "using namespace Rcpp;",
+			cxxargs = "-std=c++0x" )
 		ex <- parse( text = "rnorm; rnorm(10)" )
 		attributes(ex) <- NULL
 		checkEquals( funx(),  ex , msg = "ExpressionVector (using variadic templates) " )

Modified: pkg/inst/unitTests/runit.Function.R
===================================================================
--- pkg/inst/unitTests/runit.Function.R	2010-01-17 10:46:17 UTC (rev 390)
+++ pkg/inst/unitTests/runit.Function.R	2010-01-17 11:12:02 UTC (rev 391)
@@ -41,7 +41,8 @@
 		funx <- cfunction(signature(x="function", y = "ANY"), '
 		Function sort(x) ;
 		return sort( y, Named("decreasing", true) ) ;
-		', Rcpp=TRUE, verbose=FALSE, includes = "using namespace Rcpp;" )
+		', Rcpp=TRUE, verbose=FALSE, includes = "using namespace Rcpp;",
+			cxxargs = "-std=c++0x" )
 		checkEquals( funx( sort, sample(1:20) ), 
 			20:1, msg = "calling function" )
 		checkException( funx(sort, sort), msg = "Function, R error -> exception" )

Modified: pkg/inst/unitTests/runit.GenericVector.R
===================================================================
--- pkg/inst/unitTests/runit.GenericVector.R	2010-01-17 10:46:17 UTC (rev 390)
+++ pkg/inst/unitTests/runit.GenericVector.R	2010-01-17 11:12:02 UTC (rev 391)
@@ -52,7 +52,7 @@
 	checkEquals( funx(list(1,2)), list(1,2), msg = "GenericVector( VECSXP) " )
 }
 
-test.IntegerVector.initializer.list <- function(){
+test.List.initializer.list <- function(){
 	if( Rcpp:::capabilities()[["initializer lists"]] ){
 		funx <- cfunction(signature(), '
 		SEXP x0 = PROTECT( Rf_ScalarInteger( 0 ) ) ;
@@ -61,7 +61,7 @@
 		List x = { x0, x1, x2} ;
 		UNPROTECT(3) ;
 		return x ;', 
-			Rcpp=TRUE, verbose=FALSE, includes = "using namespace Rcpp;" )
+			Rcpp=TRUE, verbose=FALSE, includes = "using namespace Rcpp;", cxxargs="-std=c++0x" )
 		checkEquals( funx(), as.list(0:2), msg = "List( initializer list) " )
 	}
 }

Modified: pkg/inst/unitTests/runit.IntegerVector.R
===================================================================
--- pkg/inst/unitTests/runit.IntegerVector.R	2010-01-17 10:46:17 UTC (rev 390)
+++ pkg/inst/unitTests/runit.IntegerVector.R	2010-01-17 11:12:02 UTC (rev 391)
@@ -47,7 +47,9 @@
 		IntegerVector x = {0,1,2,3} ;
 		for( int i=0; i<x.size(); i++) x[i] = x[i]*2 ;
 		return x ;', 
-			Rcpp=TRUE, verbose=FALSE, includes = "using namespace Rcpp;" )
+			Rcpp=TRUE, verbose=FALSE, 
+			includes = "using namespace Rcpp;",
+			cxxargs = "-std=c++0x" )
 		checkEquals( funx(), 2*0:3, msg = "IntegerVector( initializer list) " )
 	}
 }

Modified: pkg/inst/unitTests/runit.Language.R
===================================================================
--- pkg/inst/unitTests/runit.Language.R	2010-01-17 10:46:17 UTC (rev 390)
+++ pkg/inst/unitTests/runit.Language.R	2010-01-17 11:12:02 UTC (rev 391)
@@ -35,16 +35,18 @@
 }
 
 test.Language.variadic <- function(){
-	if( Rcpp:::canUseCXX0X() ){
+	if( Rcpp:::capabilities()[["variadic templates"]] ){
 		funx <- cfunction(signature(), '
 		return Language( "rnorm", 10, 0.0, 2.0 ) ;
-		', Rcpp=TRUE, verbose=FALSE, includes = "using namespace Rcpp;" )
+		', Rcpp=TRUE, verbose=FALSE, includes = "using namespace Rcpp;",
+			cxxargs = "-std=c++0x" )
 		checkEquals( funx(), call("rnorm", 10L, 0.0, 2.0 ), 
 			msg = "variadic templates" )
 			
 		funx <- cfunction(signature(), '
 		return Language( "rnorm", 10, Named("mean",0.0), 2.0 ) ;
-		', Rcpp=TRUE, verbose=FALSE, includes = "using namespace Rcpp;" )
+		', Rcpp=TRUE, verbose=FALSE, includes = "using namespace Rcpp;",
+			cxxargs = "-std=c++0x" )
 		checkEquals( funx(), call("rnorm", 10L, mean = 0.0, 2.0 ), 
 			msg = "variadic templates (with names)" )
 	}

Modified: pkg/inst/unitTests/runit.NumericVector.R
===================================================================
--- pkg/inst/unitTests/runit.NumericVector.R	2010-01-17 10:46:17 UTC (rev 390)
+++ pkg/inst/unitTests/runit.NumericVector.R	2010-01-17 11:12:02 UTC (rev 391)
@@ -47,7 +47,8 @@
 		NumericVector x = {0.0,1.0,2.0,3.0} ;
 		for( int i=0; i<x.size(); i++) x[i] = x[i]*2 ;
 		return x ;', 
-			Rcpp=TRUE, verbose=FALSE, includes = "using namespace Rcpp;" )
+			Rcpp=TRUE, verbose=FALSE, includes = "using namespace Rcpp;",
+			cxxargs = "-std=c++0x" )
 		checkEquals( funx(), as.numeric(2*0:3), msg = "NumericVector( initializer list) " )
 	}
 }

Modified: pkg/inst/unitTests/runit.Pairlist.R
===================================================================
--- pkg/inst/unitTests/runit.Pairlist.R	2010-01-17 10:46:17 UTC (rev 390)
+++ pkg/inst/unitTests/runit.Pairlist.R	2010-01-17 11:12:02 UTC (rev 391)
@@ -40,13 +40,15 @@
 	if( Rcpp:::canUseCXX0X() ){
 		funx <- cfunction(signature(), '
 		return Pairlist( "rnorm", 10, 0.0, 2.0 ) ;
-		', Rcpp=TRUE, verbose=FALSE, includes = "using namespace Rcpp;" )
+		', Rcpp=TRUE, verbose=FALSE, includes = "using namespace Rcpp;",
+			cxxargs = "-std=c++0x" )
 		checkEquals( funx(), pairlist("rnorm", 10L, 0.0, 2.0 ), 
 			msg = "variadic templates" )
 			
 		funx <- cfunction(signature(), '
 		return Pairlist( "rnorm", 10, Named("mean",0.0), 2.0 ) ;
-		', Rcpp=TRUE, verbose=FALSE, includes = "using namespace Rcpp;" )
+		', Rcpp=TRUE, verbose=FALSE, includes = "using namespace Rcpp;",
+			cxxargs = "-std=c++0x" )
 		checkEquals( funx(), pairlist("rnorm", 10L, mean = 0.0, 2.0 ), 
 			msg = "variadic templates (with names)" )
 	}

Modified: pkg/inst/unitTests/runit.RawVector.R
===================================================================
--- pkg/inst/unitTests/runit.RawVector.R	2010-01-17 10:46:17 UTC (rev 390)
+++ pkg/inst/unitTests/runit.RawVector.R	2010-01-17 11:12:02 UTC (rev 391)
@@ -47,7 +47,8 @@
 		RawVector x = {0,1,2,3} ;
 		for( int i=0; i<x.size(); i++) x[i] = x[i]*2 ;
 		return x ;', 
-			Rcpp=TRUE, verbose=FALSE, includes = "using namespace Rcpp;" )
+			Rcpp=TRUE, verbose=FALSE, includes = "using namespace Rcpp;",
+			cxxargs = "-std=c++0x" )
 		checkEquals( funx(), as.raw(2*0:3), msg = "RawVector( initializer list) " )
 	}
 }

Modified: pkg/inst/unitTests/runit.wrap.R
===================================================================
--- pkg/inst/unitTests/runit.wrap.R	2010-01-17 10:46:17 UTC (rev 390)
+++ pkg/inst/unitTests/runit.wrap.R	2010-01-17 11:12:02 UTC (rev 391)
@@ -26,7 +26,8 @@
 	test.wrap.initializerlist.int <- function(){
 		funx <- cfunction(signature(), '
 		return Rcpp::wrap( {0,1,2} ); 
-		', Rcpp=TRUE, verbose=FALSE)
+		', Rcpp=TRUE, verbose=FALSE,
+			cxxargs = "-std=c++0x")
 		checkEquals( funx(), 0:2, 
 			msg = "wrap( initializer_list<int> )" )
 	}
@@ -34,7 +35,8 @@
 	test.wrap.initializerlist.double <- function(){
 		funx <- cfunction(signature(), '
 		return Rcpp::wrap( {0.0,1.0,2.0} ); 
-		', Rcpp=TRUE, verbose=FALSE)
+		', Rcpp=TRUE, verbose=FALSE,
+			cxxargs = "-std=c++0x")
 		checkEquals( funx(), as.numeric(0:2), 
 			msg = "wrap( initializer_list<double> )" )
 	}
@@ -42,7 +44,8 @@
 	test.wrap.initializerlist.bool <- function(){
 		funx <- cfunction(signature(), '
 		return Rcpp::wrap( {false, true, false} ); 
-		', Rcpp=TRUE, verbose=FALSE)
+		', Rcpp=TRUE, verbose=FALSE,
+			cxxargs = "-std=c++0x")
 		checkEquals( funx(), c(FALSE, TRUE, FALSE), 
 			msg = "wrap( initializer_list<bool> )" )
 	}
@@ -50,7 +53,8 @@
 	test.wrap.initializerlist.Rbyte <- function(){
 		funx <- cfunction(signature(), '
 		return Rcpp::wrap( { (Rbyte)0, (Rbyte)1 } ); 
-		', Rcpp=TRUE, verbose=FALSE)
+		', Rcpp=TRUE, verbose=FALSE,
+			cxxargs = "-std=c++0x")
 		checkEquals( funx(), as.raw(0:1), 
 			msg = "wrap( initializer_list<Rbyte> )" )
 	}

Modified: pkg/src/Pairlist.cpp
===================================================================
--- pkg/src/Pairlist.cpp	2010-01-17 10:46:17 UTC (rev 390)
+++ pkg/src/Pairlist.cpp	2010-01-17 11:12:02 UTC (rev 391)
@@ -27,6 +27,8 @@
 
 namespace Rcpp {
 
+	Pairlist::Pairlist( ): RObject::RObject(){}
+	
 	Pairlist::Pairlist( SEXP x = R_NilValue ) throw(not_compatible) : RObject::RObject( ){
 		if( x != R_NilValue ){
 			switch( TYPEOF(x) ){

Modified: pkg/src/Rcpp/Pairlist.h
===================================================================
--- pkg/src/Rcpp/Pairlist.h	2010-01-17 10:46:17 UTC (rev 390)
+++ pkg/src/Rcpp/Pairlist.h	2010-01-17 11:12:02 UTC (rev 391)
@@ -44,6 +44,9 @@
 	 */
 	Pairlist(SEXP lang) throw(not_compatible) ;
 	
+	
+	Pairlist() ;
+	
 	/**
 	 * Creates a pairlist by wrapping the variable number of arguments
 	 * using the pairlist template



More information about the Rcpp-commits mailing list