[Rcpp-commits] r1804 - pkg/Rcpp/inst/unitTests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Wed Jul 7 14:16:58 CEST 2010
Author: romain
Date: 2010-07-07 14:16:57 +0200 (Wed, 07 Jul 2010)
New Revision: 1804
Removed:
pkg/Rcpp/inst/unitTests/runit.clone.R
Modified:
pkg/Rcpp/inst/unitTests/runit.IntegerVector.R
Log:
move runit.clone into runit.IntegerVector
Modified: pkg/Rcpp/inst/unitTests/runit.IntegerVector.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runit.IntegerVector.R 2010-07-07 12:12:04 UTC (rev 1803)
+++ pkg/Rcpp/inst/unitTests/runit.IntegerVector.R 2010-07-07 12:16:57 UTC (rev 1804)
@@ -157,6 +157,17 @@
_["bar"] = 30 ) ;
return output ;
'
+ ),
+ "clone_" = list(
+ signature(x="integer"),
+ '
+ IntegerVector vec(x) ;
+ IntegerVector dolly = clone( vec ) ;
+ for( size_t i=0; i<10; i++){
+ dolly[i] = 10 - i ;
+ }
+ return dolly ;
+ '
)
)
@@ -345,4 +356,11 @@
msg = "IntegerVector::create" )
}
+test.IntegerVector.clone <- function(){
+ x <- 1:10
+ fun <- .rcpp.IntegerVector$clone_
+ y <- fun(x)
+ checkEquals( x, 1:10, msg = "clone" )
+ checkEquals( y, 10:1, msg = "clone" )
+}
Deleted: pkg/Rcpp/inst/unitTests/runit.clone.R
===================================================================
--- pkg/Rcpp/inst/unitTests/runit.clone.R 2010-07-07 12:12:04 UTC (rev 1803)
+++ pkg/Rcpp/inst/unitTests/runit.clone.R 2010-07-07 12:16:57 UTC (rev 1804)
@@ -1,38 +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.clone <- function(){
-
- x <- 1:10
- funx <- cppfunction(signature(x="integer"), '
- IntegerVector vec(x) ;
- IntegerVector dolly = clone( vec ) ;
- for( size_t i=0; i<10; i++){
- dolly[i] = 10 - i ;
- }
- return dolly ;
- ' )
- y <- funx(x)
- checkEquals( x, 1:10, msg = "clone" )
- checkEquals( y, 10:1, msg = "clone" )
-
- # TODO: add more
-
-}
-
More information about the Rcpp-commits
mailing list