[Rcpp-commits] r2632 - pkg/RcppGSL/inst/unitTests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue Nov 30 21:03:27 CET 2010
Author: romain
Date: 2010-11-30 21:03:27 +0100 (Tue, 30 Nov 2010)
New Revision: 2632
Added:
pkg/RcppGSL/inst/unitTests/runit.client.package.R
Log:
testing a client package
Added: pkg/RcppGSL/inst/unitTests/runit.client.package.R
===================================================================
--- pkg/RcppGSL/inst/unitTests/runit.client.package.R (rev 0)
+++ pkg/RcppGSL/inst/unitTests/runit.client.package.R 2010-11-30 20:03:27 UTC (rev 2632)
@@ -0,0 +1,43 @@
+#!/usr/bin/r -t
+# Emacs make this -*- mode: R; tab-width: 4 -*-
+#
+# Copyright (C) 2010 Romain Francois and Dirk Eddelbuettel
+#
+# This file is part of RcppGSL.
+#
+# RcppGSL is free software: you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# RcppGSL is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with RcppGSL. If not, see <http://www.gnu.org/licenses/>.
+
+test.client.package <- function(){
+ pkg <- "RcppGSLExample"
+ td <- tempfile()
+ cwd <- getwd()
+ dir.create( td )
+ file.copy( system.file( "examples", pkg, package = "RcppGSL" ) , td, recursive = TRUE)
+ Sys.chmod( file.path( td, "RcppGSLExample", "configure"), "0755")
+ setwd( td )
+ on.exit( {
+ setwd( cwd)
+ unlink( td, recursive = TRUE )
+ } )
+ R <- shQuote( file.path( R.home( component = "bin" ), "R" ))
+ cmd <- paste( R , "CMD build", pkg )
+ system( cmd )
+ dir.create( "templib" )
+ install.packages( paste( pkg, "_0.0.1.tar.gz", sep = "" ), "templib", repos = NULL, type = "source" )
+ require( pkg, "templib", character.only = TRUE )
+ m <- matrix( 1:16, nc = 4 )
+ res <- colNorm( m )
+ #TODO [Dirk]: include an actual test
+ unlink( "templib", recursive = TRUE )
+}
More information about the Rcpp-commits
mailing list