[Rcpp-commits] r4390 - in pkg/Rcpp: . inst/doc/unitTests inst/unitTests inst/unitTests/cpp

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jul 3 11:42:34 CEST 2013


Author: romain
Date: 2013-07-03 11:42:33 +0200 (Wed, 03 Jul 2013)
New Revision: 4390

Modified:
   pkg/Rcpp/ChangeLog
   pkg/Rcpp/inst/doc/unitTests/Rcpp-unitTests.R
   pkg/Rcpp/inst/unitTests/cpp/Vector.cpp
   pkg/Rcpp/inst/unitTests/runTests.R
   pkg/Rcpp/inst/unitTests/runit.Vector.R
Log:
no need for inline anymore for testing

Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog	2013-07-03 09:29:27 UTC (rev 4389)
+++ pkg/Rcpp/ChangeLog	2013-07-03 09:42:33 UTC (rev 4390)
@@ -2,7 +2,10 @@
 
         * unitTests/runit.modref.R: using sourceCpp
         * unitTests/runit.Module.R: using sourceCpp
-
+        * unitTests/runit.Vector.R: no more uses of inline
+        * unitTests/runTests.R: we don't need inline no more for testing
+        * doc/unitTests/Rcpp-unitTests.R: idem
+        
 2013-07-02  Romain Francois <romain at r-enthusiasts.com>
 
         * include/Rcpp/vector/Vector.h: fill__dispatch was mispelled (as

Modified: pkg/Rcpp/inst/doc/unitTests/Rcpp-unitTests.R
===================================================================
--- pkg/Rcpp/inst/doc/unitTests/Rcpp-unitTests.R	2013-07-03 09:29:27 UTC (rev 4389)
+++ pkg/Rcpp/inst/doc/unitTests/Rcpp-unitTests.R	2013-07-03 09:42:33 UTC (rev 4390)
@@ -2,16 +2,7 @@
 
 # load this package
 require( pkg, character.only = TRUE )
-require( inline )
 
-if( compareVersion( packageDescription( "inline" )[["Version"]], "0.3.4.4" ) < 0 ){
-	stop( "Rcpp unit tests need at least the version 0.3.4.4 of inline" )
-}
-
-cppfunction <- function( ... ){
-	cxxfunction( ..., plugin = "Rcpp" )
-}
-
 ## Make sure we run all tests for the vignette
 Sys.setenv("RunAllRcppTests"="yes")
 

Modified: pkg/Rcpp/inst/unitTests/cpp/Vector.cpp
===================================================================
--- pkg/Rcpp/inst/unitTests/cpp/Vector.cpp	2013-07-03 09:29:27 UTC (rev 4389)
+++ pkg/Rcpp/inst/unitTests/cpp/Vector.cpp	2013-07-03 09:42:33 UTC (rev 4390)
@@ -720,5 +720,12 @@
         CharacterVector x = {"foo", "bar"} ;
         return x ;
     }
+    
+    List List_insert(){
+        List list(x) ;
+        list.insert( list.begin(), 10 ) ;
+        list.insert( list.end(), Named("foo", "bar" ) ) ;
+        return list ;
+	}
 #endif
 

Modified: pkg/Rcpp/inst/unitTests/runTests.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runTests.R	2013-07-03 09:29:27 UTC (rev 4389)
+++ pkg/Rcpp/inst/unitTests/runTests.R	2013-07-03 09:42:33 UTC (rev 4390)
@@ -1,6 +1,6 @@
 ## -*- mode: R; tab-width: 4; -*-
 ##
-## Copyright (C) 2009 - 2012  Dirk Eddelbuettel and Romain Francois
+## Copyright (C) 2009 - 2013  Dirk Eddelbuettel and Romain Francois
 ##
 ## This file is part of Rcpp.
 ##
@@ -27,20 +27,12 @@
 
 pkg <- "Rcpp"
 
-if ( ! require( "inline", character.only = TRUE, quietly = TRUE ) ){
-    stop( "The inline package is required to run Rcpp unit tests" )
-}
-
-if ( compareVersion( packageDescription( "inline" )[["Version"]], "0.3.4.4" ) < 0 ){
-    stop( "Rcpp unit tests need at least the version 0.3.4.4 of inline" )
-}
-
 if (require("RUnit", quietly = TRUE)) {
 
     is_local <- function(){
-    	if( exists( "argv", globalenv() ) && "--local" %in% argv ) return(TRUE)
-    	if( "--local" %in% commandArgs(TRUE) ) return(TRUE)
-    	FALSE
+        if( exists( "argv", globalenv() ) && "--local" %in% argv ) return(TRUE)
+        if( "--local" %in% commandArgs(TRUE) ) return(TRUE)
+        FALSE
     }
     if (is_local() ) path <- getwd()
 

Modified: pkg/Rcpp/inst/unitTests/runit.Vector.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runit.Vector.R	2013-07-03 09:29:27 UTC (rev 4389)
+++ pkg/Rcpp/inst/unitTests/runit.Vector.R	2013-07-03 09:42:33 UTC (rev 4390)
@@ -604,65 +604,42 @@
     checkEquals( res, expected, msg = "List rep constructor" )
 }
 
+if( Rcpp:::capabilities()[["initializer lists"]] ){
 
-# test graveyard. Might come back when we can use C++11
+	test.RawVector.initializer.list <- function(){
+		checkEquals( raw_initializer_list(), as.raw(2*0:3), msg = "RawVector( initializer list) " )
+	}
 
-# if( Rcpp:::capabilities()[["initializer lists"]] ){
-# 	test.RawVector.initializer.list <- function(){
-# 		funx <- raw_initializer_list
-# 		checkEquals( funx(), as.raw(2*0:3), msg = "RawVector( initializer list) " )
-# 	}
-# }
+	test.ComplexVector.initializer.list <- function(){
+		checkEquals( complex_initializer_list(), c( 0:1*(1+1i)), msg = "ComplexVector( initializer list) " )
+	}
 
-# if( Rcpp:::capabilities()[["initializer lists"]] ){
-# 	test.ComplexVector.initializer.list <- function(){
-# 		funx <- complex_initializer_list
-# 		checkEquals( funx(), c( 0:1*(1+1i)), msg = "ComplexVector( initializer list) " )
-# 	}
-# }
+    test.IntegerVector.initializer.list <- function() {
+        checkEquals( integer_initializer_list(), 2*0:3, msg = "IntegerVector( initializer list) " )
+    }
 
-# if (Rcpp:::capabilities()[["initializer lists"]]) {
-#     test.IntegerVector.initializer.list <- function() {
-#         fun <- integer_initializer_list
-#         checkEquals( fun(), 2*0:3, msg = "IntegerVector( initializer list) " )
-#     }
-# }
+	test.NumericVector.initializer.list <- function(){
+		checkEquals( numeric_initlist(), as.numeric(2*0:3), msg = "NumericVector( initializer list) " )
+	}
 
-# if( Rcpp:::capabilities()[["initializer lists"]] ){
-# 	test.NumericVector.initializer.list <- function(){
-# 		funx <- numeric_initlist
-# 		checkEquals( funx(), as.numeric(2*0:3), msg = "NumericVector( initializer list) " )
-# 	}
-# }
+    test.List.initializer.list <- function(){
+        checkEquals( list_initializer_list(), as.list(0:2), 
+            msg = "List( initializer list) " )
+    }
 
-# if( Rcpp:::capabilities()[["initializer lists"]] ){
-#     test.List.initializer.list <- function(){
-#         fun <- list_initializer_list
-#         checkEquals( fun(), as.list(0:2), msg = "List( initializer list) " )
-#     }
-# }
+    test.List.insert <- function(){
+	    d <- list( x = 1:10, y = letters[1:10] )
+	    res <- List_insert( d )
+	    checkEquals( res,
+	        	list( 10L, x = 1:10, y = letters[1:10], foo = "bar" ),
+	        	msg = "List.insert" )
+    }
 
-# test.List.insert <- function(){
-#
-# 	funx <- cxxfunction( signature(x = "list"),
-# 	'
-# 	List list(x) ;
-# 	list.insert( list.begin(), 10 ) ;
-# 	list.insert( list.end(), Named("foo", "bar" ) ) ;
-# 	return list ;
-# 	' , plugin = "Rcpp" )
-# 	d <- list( x = 1:10, y = letters[1:10] )
-# 	res <- funx( d )
-# 	checkEquals( res,
-# 		list( 10L, x = 1:10, y = letters[1:10], foo = "bar" ),
-# 		msg = "List.insert" )
-# }
+    test.CharacterVector.initializer.list <- function() {
+        checkEquals( character_initializer_list(), c("foo","bar"),
+            msg = "CharacterVector( initializer list) " )
+    }
 
-# if (Rcpp:::capabilities()[["initializer lists"]]) {
-#     test.CharacterVector.initializer.list <- function() {
-#         fun <- character_initializer_list
-#         checkEquals( fun(), c("foo","bar"), msg = "CharacterVector( initializer list) " )
-#     }
-# }
+}
 
 }



More information about the Rcpp-commits mailing list