[Rcpp-commits] r1030 - in pkg/Rcpp/inst: skeleton unitTests unitTests/RcppTestA unitTests/RcppTestA/R unitTests/RcppTestA/man unitTests/RcppTestA/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Apr 10 12:13:48 CEST 2010


Author: romain
Date: 2010-04-10 12:13:44 +0200 (Sat, 10 Apr 2010)
New Revision: 1030

Added:
   pkg/Rcpp/inst/unitTests/RcppTestA/
   pkg/Rcpp/inst/unitTests/RcppTestA/DESCRIPTION
   pkg/Rcpp/inst/unitTests/RcppTestA/NAMESPACE
   pkg/Rcpp/inst/unitTests/RcppTestA/R/
   pkg/Rcpp/inst/unitTests/RcppTestA/R/rcpp_hello_world.R
   pkg/Rcpp/inst/unitTests/RcppTestA/man/
   pkg/Rcpp/inst/unitTests/RcppTestA/man/RcppTestA-package.Rd
   pkg/Rcpp/inst/unitTests/RcppTestA/src/
   pkg/Rcpp/inst/unitTests/RcppTestA/src/Makevars
   pkg/Rcpp/inst/unitTests/RcppTestA/src/Makevars.win
   pkg/Rcpp/inst/unitTests/RcppTestA/src/rcpp_hello_world.cpp
   pkg/Rcpp/inst/unitTests/RcppTestA/src/rcpp_hello_world.h
   pkg/Rcpp/inst/unitTests/RcppTestA_1.0.tar.gz
   pkg/Rcpp/inst/unitTests/runit.client.package.R
Modified:
   pkg/Rcpp/inst/skeleton/rcpp_hello_world.cpp
Log:
testing client package

Modified: pkg/Rcpp/inst/skeleton/rcpp_hello_world.cpp
===================================================================
--- pkg/Rcpp/inst/skeleton/rcpp_hello_world.cpp	2010-04-07 11:21:49 UTC (rev 1029)
+++ pkg/Rcpp/inst/skeleton/rcpp_hello_world.cpp	2010-04-10 10:13:44 UTC (rev 1030)
@@ -1,19 +1,11 @@
-#include <rcpp_hello_world.h>
+#include "rcpp_hello_world.h"
 
 SEXP rcpp_hello_world(){
 	using namespace Rcpp ;
 	
-	CharacterVector x(2) ;
-	x[0] = "foo" ; 
-	x[1] = "bar" ;
+	CharacterVector x = CharacterVector::create( "foo", "bar" )  ;
+	NumericVector y   = NumericVector::create( 0.0, 1.0 ) ;
+	List z            = List::create( x, y ) ;
 	
-	NumericVector y(2) ;
-	y[0] = 0.0 ;
-	y[1] = 1.0 ;
-	
-	List z(2) ; 
-	z[0] = x ; 
-	z[1] = y ;
-	
 	return z ;
 }

Added: pkg/Rcpp/inst/unitTests/RcppTestA/DESCRIPTION
===================================================================
--- pkg/Rcpp/inst/unitTests/RcppTestA/DESCRIPTION	                        (rev 0)
+++ pkg/Rcpp/inst/unitTests/RcppTestA/DESCRIPTION	2010-04-10 10:13:44 UTC (rev 1030)
@@ -0,0 +1,12 @@
+Package: RcppTestA
+Type: Package
+Title: Dummy package part of Rcpp unit tests
+Version: 1.0
+Date: 2010-04-10
+Author: Romain Francois and Dirk Eddelbuettel
+Maintainer: Romain and Dirk <RomainAndDirk at r-enthusiasts.com>
+Description: Dummy package part of Rcpp uni tests
+License: GPL (>= 2)
+LazyLoad: yes
+Depends: Rcpp (>= 0.7.11.4)
+LinkingTo: Rcpp

Added: pkg/Rcpp/inst/unitTests/RcppTestA/NAMESPACE
===================================================================
--- pkg/Rcpp/inst/unitTests/RcppTestA/NAMESPACE	                        (rev 0)
+++ pkg/Rcpp/inst/unitTests/RcppTestA/NAMESPACE	2010-04-10 10:13:44 UTC (rev 1030)
@@ -0,0 +1 @@
+useDynLib(RcppTestA)

Added: pkg/Rcpp/inst/unitTests/RcppTestA/R/rcpp_hello_world.R
===================================================================
--- pkg/Rcpp/inst/unitTests/RcppTestA/R/rcpp_hello_world.R	                        (rev 0)
+++ pkg/Rcpp/inst/unitTests/RcppTestA/R/rcpp_hello_world.R	2010-04-10 10:13:44 UTC (rev 1030)
@@ -0,0 +1,3 @@
+rcpp_hello_world <- function(){
+	.Call( "rcpp_hello_world", PACKAGE = "RcppTestA" )
+}

Added: pkg/Rcpp/inst/unitTests/RcppTestA/man/RcppTestA-package.Rd
===================================================================
--- pkg/Rcpp/inst/unitTests/RcppTestA/man/RcppTestA-package.Rd	                        (rev 0)
+++ pkg/Rcpp/inst/unitTests/RcppTestA/man/RcppTestA-package.Rd	2010-04-10 10:13:44 UTC (rev 1030)
@@ -0,0 +1,20 @@
+\name{RcppTestA-package}
+\alias{RcppTestA-package}
+\alias{RcppTestA}
+\docType{package}
+\title{
+Dummy package part of Rcpp unit tests
+}
+\description{
+Dummy package part of Rcpp unit tests
+}
+\details{
+\tabular{ll}{
+Package: \tab RcppTestA\cr
+Type: \tab Package\cr
+Version: \tab 1.0\cr
+Date: \tab 2010-04-10\cr
+License: \tab GPL (>= 2)\cr
+LazyLoad: \tab yes\cr
+}
+}

Added: pkg/Rcpp/inst/unitTests/RcppTestA/src/Makevars
===================================================================
--- pkg/Rcpp/inst/unitTests/RcppTestA/src/Makevars	                        (rev 0)
+++ pkg/Rcpp/inst/unitTests/RcppTestA/src/Makevars	2010-04-10 10:13:44 UTC (rev 1030)
@@ -0,0 +1,2 @@
+## Use the R_HOME indirection to support installations of multiple R version
+PKG_LIBS = $(shell $(R_HOME)/bin/Rscript --vanilla -e "Rcpp:::LdFlags()" )

Added: pkg/Rcpp/inst/unitTests/RcppTestA/src/Makevars.win
===================================================================
--- pkg/Rcpp/inst/unitTests/RcppTestA/src/Makevars.win	                        (rev 0)
+++ pkg/Rcpp/inst/unitTests/RcppTestA/src/Makevars.win	2010-04-10 10:13:44 UTC (rev 1030)
@@ -0,0 +1,5 @@
+
+## This assume that we can call Rscript to ask Rcpp about its locations
+## Use the R_HOME indirection to support installations of multiple R version
+PKG_LIBS = $(shell Rscript.exe --vanilla -e "Rcpp:::LdFlags()")
+

Added: pkg/Rcpp/inst/unitTests/RcppTestA/src/rcpp_hello_world.cpp
===================================================================
--- pkg/Rcpp/inst/unitTests/RcppTestA/src/rcpp_hello_world.cpp	                        (rev 0)
+++ pkg/Rcpp/inst/unitTests/RcppTestA/src/rcpp_hello_world.cpp	2010-04-10 10:13:44 UTC (rev 1030)
@@ -0,0 +1,9 @@
+#include "rcpp_hello_world.h"
+
+SEXP rcpp_hello_world(){
+	using namespace Rcpp ;
+	CharacterVector x = CharacterVector::create( "foo", "bar" )  ;
+	NumericVector y   = NumericVector::create( 0.0, 1.0 ) ;
+	List z = List::create( x, y ) ;
+	return z ;
+}

Added: pkg/Rcpp/inst/unitTests/RcppTestA/src/rcpp_hello_world.h
===================================================================
--- pkg/Rcpp/inst/unitTests/RcppTestA/src/rcpp_hello_world.h	                        (rev 0)
+++ pkg/Rcpp/inst/unitTests/RcppTestA/src/rcpp_hello_world.h	2010-04-10 10:13:44 UTC (rev 1030)
@@ -0,0 +1,8 @@
+#ifndef _RcppTestA_RCPP_HELLO_WORLD_H
+#define _RcppTestA_RCPP_HELLO_WORLD_H
+
+#include <Rcpp.h>
+
+RcppExport SEXP rcpp_hello_world() ;
+
+#endif

Added: pkg/Rcpp/inst/unitTests/RcppTestA_1.0.tar.gz
===================================================================
(Binary files differ)


Property changes on: pkg/Rcpp/inst/unitTests/RcppTestA_1.0.tar.gz
___________________________________________________________________
Name: svn:mime-type
   + application/octet-stream

Added: pkg/Rcpp/inst/unitTests/runit.client.package.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runit.client.package.R	                        (rev 0)
+++ pkg/Rcpp/inst/unitTests/runit.client.package.R	2010-04-10 10:13:44 UTC (rev 1030)
@@ -0,0 +1,37 @@
+#!/usr/bin/r -t
+#
+# Copyright (C) 2010	Dirk Eddelbuettel and Romain Francois
+#
+# This file is part of Rcpp.
+#
+# Rcpp 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.
+#
+# Rcpp 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 Rcpp.  If not, see <http://www.gnu.org/licenses/>.
+
+.setUp <- function(){
+	suppressMessages( require( inline ) )
+}
+
+test.client.package <- function(){
+	td <- tempfile()
+	cwd <- getwd()
+	dir.create( td )
+	file.copy( system.file( "unitTests", "RcppTestA_1.0.tar.gz", package = "Rcpp" ) , td ) 
+	setwd( td )
+	on.exit( { setwd( cwd) ; unlink( td, recursive = TRUE ) } )
+	dir.create( "templib" )
+	install.packages( "RcppTestA_1.0.tar.gz", "templib", repos = NULL, type = "source" )
+	require( "RcppTestA", "templib" )
+	res <- RcppTestA:::rcpp_hello_world( )
+	checkEquals( res, list( c("foo", "bar"), c(0.0, 1.0) ), msg = "code from client package" )
+}
+



More information about the Rcpp-commits mailing list