[Rcpp-commits] r3596 - pkg/Rcpp/inst/unitTests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Fri May 4 15:43:19 CEST 2012
Author: edd
Date: 2012-05-04 15:43:19 +0200 (Fri, 04 May 2012)
New Revision: 3596
Modified:
pkg/Rcpp/inst/unitTests/runit.Module.client.package.R
Log:
added new test, uncommented for now (and posted TODO to rcpp-core)
Modified: pkg/Rcpp/inst/unitTests/runit.Module.client.package.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runit.Module.client.package.R 2012-05-04 11:57:55 UTC (rev 3595)
+++ pkg/Rcpp/inst/unitTests/runit.Module.client.package.R 2012-05-04 13:43:19 UTC (rev 3596)
@@ -67,4 +67,35 @@
}
+ ## ## added test for 'testRcppClass' example of extending C++ classes via R
+ ## test.Class.package <- function( ){
+
+ ## td <- tempfile()
+ ## cwd <- getwd()
+ ## dir.create( td )
+ ## file.copy( system.file( "unitTests", "testRcppClass", package = "Rcpp" ) , td, recursive = TRUE)
+ ## setwd( td )
+ ## on.exit( { setwd( cwd) ; unlink( td, recursive = TRUE ) } )
+ ## R <- shQuote( file.path( R.home( component = "bin" ), "R" ))
+ ## cmd <- paste( R , "CMD build testRcppClass" )
+ ## system( cmd )
+ ## dir.create( "templib" )
+ ## install.packages( "testRcppClass_0.1.tar.gz", "templib", repos = NULL, type = "source" )
+ ## require( "testRcppClass", "templib", character.only = TRUE )
+
+ ## v <- stdNumeric$new()
+ ## data <- 1:10
+ ## v$assign(data)
+ ## v$set(3L, v$at(3L) + 1)
+
+ ## data[[4]] <- data[[4]] +1
+
+ ## checkEquals( v$as.vector(), data )
+
+ ## ## a few function calls
+ ## checkEquals( bar(2), 4)
+ ## checkEquals( foo(2,3), 6)
+
+ ## }
+
}
More information about the Rcpp-commits
mailing list