[Rcpp-commits] r1819 - pkg/Rcpp/inst/unitTests

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jul 7 16:31:27 CEST 2010


Author: romain
Date: 2010-07-07 16:31:27 +0200 (Wed, 07 Jul 2010)
New Revision: 1819

Removed:
   pkg/Rcpp/inst/unitTests/runit.Formula.R
Modified:
   pkg/Rcpp/inst/unitTests/runit.Language.R
Log:
merge runit.Formula into runit.Language

Deleted: pkg/Rcpp/inst/unitTests/runit.Formula.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runit.Formula.R	2010-07-07 14:27:59 UTC (rev 1818)
+++ pkg/Rcpp/inst/unitTests/runit.Formula.R	2010-07-07 14:31:27 UTC (rev 1819)
@@ -1,39 +0,0 @@
-#!/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/>.
-
-test.Formula <- function(){
-	funx <- cppfunction(signature(), '
-	Formula f( "x ~ y + z" ) ;
-	return f;
-	' )
-	checkEquals( funx(), x ~ y + z, msg = "Formula( string )" )
-}
-
-test.Formula.SEXP <- function(){
-	funx <- cppfunction(signature( form = "ANY" ), '
-	Formula f(form) ;
-	return f;
-	' )
-	checkEquals( funx( x ~ y + z), x ~ y + z, msg = "Formula( SEXP = formula )" )
-	checkEquals( funx( "x ~ y + z" ), x ~ y + z, msg = "Formula( SEXP = STRSXP )" )
-	checkEquals( funx( parse( text = "x ~ y + z") ), x ~ y + z, msg = "Formula( SEXP = EXPRSXP )" )
-	checkEquals( funx( list( "x ~ y + z") ), x ~ y + z, msg = "Formula( SEXP = VECSXP(1 = STRSXP) )" )
-	checkEquals( funx( list( x ~ y + z) ), x ~ y + z, msg = "Formula( SEXP = VECSXP(1 = formula) )" )
-	
-}

Modified: pkg/Rcpp/inst/unitTests/runit.Language.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runit.Language.R	2010-07-07 14:27:59 UTC (rev 1818)
+++ pkg/Rcpp/inst/unitTests/runit.Language.R	2010-07-07 14:31:27 UTC (rev 1819)
@@ -274,6 +274,19 @@
 					p[2] = p[0] ;
 					return p ;
 				'
+			), 
+			
+			"runit_formula_" = list( 
+				signature(), '
+					Formula f( "x ~ y + z" ) ;
+					return f;
+				' 
+			), 
+			"runit_formula_SEXP" = list( 
+				signature( form = "ANY" ), '
+					Formula f(form) ;
+					return f;
+				'
 			)
 			
 		)
@@ -453,3 +466,18 @@
 	checkEquals( funx(), pairlist(1L, "foobar", 1L) , msg = "Pairlist::operator[] used as lvalue" )
 }
 
+
+test.Formula <- function(){
+	funx <- .rcpp.language$runit_formula_
+	checkEquals( funx(), x ~ y + z, msg = "Formula( string )" )
+}
+
+test.Formula.SEXP <- function(){
+	funx <- .rcpp.language$runit_formula_SEXP
+	checkEquals( funx( x ~ y + z), x ~ y + z, msg = "Formula( SEXP = formula )" )
+	checkEquals( funx( "x ~ y + z" ), x ~ y + z, msg = "Formula( SEXP = STRSXP )" )
+	checkEquals( funx( parse( text = "x ~ y + z") ), x ~ y + z, msg = "Formula( SEXP = EXPRSXP )" )
+	checkEquals( funx( list( "x ~ y + z") ), x ~ y + z, msg = "Formula( SEXP = VECSXP(1 = STRSXP) )" )
+	checkEquals( funx( list( x ~ y + z) ), x ~ y + z, msg = "Formula( SEXP = VECSXP(1 = formula) )" )
+}
+



More information about the Rcpp-commits mailing list