[Rcpp-commits] r3614 - in pkg/Rcpp: . inst/unitTests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Thu May 24 17:20:29 CEST 2012


Author: edd
Date: 2012-05-24 17:20:29 +0200 (Thu, 24 May 2012)
New Revision: 3614

Modified:
   pkg/Rcpp/ChangeLog
   pkg/Rcpp/inst/unitTests/runit.Module.client.package.R
Log:
added four simple tests already supported in the code


Modified: pkg/Rcpp/ChangeLog
===================================================================
--- pkg/Rcpp/ChangeLog	2012-05-24 15:19:14 UTC (rev 3613)
+++ pkg/Rcpp/ChangeLog	2012-05-24 15:20:29 UTC (rev 3614)
@@ -1,5 +1,9 @@
 2012-05-24  Dirk Eddelbuettel  <edd at debian.org>
 
+	* inst/skeleton/Num.cpp: Added to Rcpp.package.skeleton(); will be
+	added when module=TRUE in call
+	* inst/skeleton/stdVector.cpp: Idem
+
 	* inst/unitTests/testRcppModule/src/rcpp_module.cpp: added more
 	comments, added copyright header, corrected output of example
 	functions by not escaping "backslash-n" twice
@@ -7,6 +11,9 @@
 	comments, added copyright header
 	* inst/unitTests/testRcppModule/src/Num.cpp: Idem
 
+	* inst/unitTests/runit.Module.client.package.R: Added four simple
+	tests for Rcpp Modules
+
 2012-05-13  Dirk Eddelbuettel  <edd at debian.org>
 
 	* inst/include/Rcpp/iostream/Rostream.h: Added Rstreambuf.h include

Modified: pkg/Rcpp/inst/unitTests/runit.Module.client.package.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runit.Module.client.package.R	2012-05-24 15:19:14 UTC (rev 3613)
+++ pkg/Rcpp/inst/unitTests/runit.Module.client.package.R	2012-05-24 15:20:29 UTC (rev 3614)
@@ -1,7 +1,7 @@
 #!/usr/bin/r -t
 #       hey emacs, please make this use  -*- tab-width: 4 -*-
 #
-# Copyright (C) 2010 - 2011	 John Chambers, Dirk Eddelbuettel and Romain Francois
+# Copyright (C) 2010 - 2012	 John Chambers, Dirk Eddelbuettel and Romain Francois
 #
 # This file is part of Rcpp.
 #
@@ -46,25 +46,29 @@
         on.exit( { setwd( cwd) ; unlink( td, recursive = TRUE ) } )
         R <- shQuote( file.path( R.home( component = "bin" ), "R" ))
         cmd <- paste( R , "CMD build testRcppModule" )
-        system( cmd )
+        system( cmd )  # quieten this by suppressing output
         dir.create( "templib" )
-        install.packages( "testRcppModule_0.1.tar.gz", "templib", repos = NULL, type = "source" )
+        install.packages( "testRcppModule_0.1.tar.gz",
+                         "templib", repos = NULL, type = "source" )
         require( "testRcppModule", "templib", character.only = TRUE )
 
-        v <- new(vec)
-
+        v <- new(vec)                   # stdVector module
         data <- 1:10
         v$assign(data)
         v[[3]] <- v[[3]] + 1
-
         data[[4]] <- data[[4]] +1
-
         checkEquals( v$as.vector(), data )
 
-        ## a few function calls
-        checkEquals( bar(2), 4)
-        checkEquals( foo(2,3), 6)
+        y <- new(World)                 # Yada module
+        y$set("quick brown fox")        # which y$greet() would
+        checkEquals(y$greet(), "quick brown fox")
 
+        checkEquals(bar(2), 4)
+        checkEquals(foo(2,3), 6)
+
+        nm <- new(Num)                  # NumEx module
+        nm$x <- 3.14
+        checkEquals(nm$x, 3.14)
     }
 
     ## ## added test for 'testRcppClass' example of extending C++ classes via R



More information about the Rcpp-commits mailing list