[Rcpp-commits] r1161 - pkg/RcppArmadillo/inst/unitTests
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Tue May 4 13:39:30 CEST 2010
Author: edd
Date: 2010-05-04 13:39:30 +0200 (Tue, 04 May 2010)
New Revision: 1161
Modified:
pkg/RcppArmadillo/inst/unitTests/runit.RcppArmadillo.R
Log:
load library(datasets) for data(trees)
reindentation to ESS defaults
Modified: pkg/RcppArmadillo/inst/unitTests/runit.RcppArmadillo.R
===================================================================
--- pkg/RcppArmadillo/inst/unitTests/runit.RcppArmadillo.R 2010-05-04 09:37:02 UTC (rev 1160)
+++ pkg/RcppArmadillo/inst/unitTests/runit.RcppArmadillo.R 2010-05-04 11:39:30 UTC (rev 1161)
@@ -17,56 +17,59 @@
# You should have received a copy of the GNU General Public License
# along with RcppArmadillo. If not, see <http://www.gnu.org/licenses/>.
+.setUp <- function(){
+ suppressMessages(require(datasets))
+}
+
test.wrap.R <- function(){
- res <- .Call( "RcppArmadillo_wrap", PACKAGE = "RcppArmadillo" )
+ res <- .Call( "RcppArmadillo_wrap", PACKAGE = "RcppArmadillo" )
- checkEquals( res[[1]][[1]], matrix(as.integer((diag(3))),nr=3), msg = "eye<imat>(3,3)" )
- checkEquals( res[[1]][[2]], diag(3), msg = "eye<mat>(3,3)" )
- checkEquals( res[[1]][[3]], diag(3), msg = "eye<fmat>(3,3)" )
- checkEquals( res[[1]][[4]], matrix(as.integer((diag(3))),nr=3), msg = "eye<umat>(3,3)" )
+ checkEquals( res[[1]][[1]], matrix(as.integer((diag(3))),nr=3), msg = "eye<imat>(3,3)" )
+ checkEquals( res[[1]][[2]], diag(3), msg = "eye<mat>(3,3)" )
+ checkEquals( res[[1]][[3]], diag(3), msg = "eye<fmat>(3,3)" )
+ checkEquals( res[[1]][[4]], matrix(as.integer((diag(3))),nr=3), msg = "eye<umat>(3,3)" )
- checkEquals( res[[2]][[1]], matrix(0, ncol = 5, nrow=1), msg = "zeros<mat>(5,1)" )
- checkEquals( res[[2]][[2]], matrix(0, ncol = 5, nrow=1), msg = "zeros<fmat>(5,1)" )
+ checkEquals( res[[2]][[1]], matrix(0, ncol = 5, nrow=1), msg = "zeros<mat>(5,1)" )
+ checkEquals( res[[2]][[2]], matrix(0, ncol = 5, nrow=1), msg = "zeros<fmat>(5,1)" )
- checkEquals( res[[3]][[1]], matrix(0, ncol = 1, nrow=5), msg = "zeros<mat>(1,5)" )
- checkEquals( res[[3]][[2]], matrix(0, ncol = 1, nrow=5), msg = "zeros<mat>(1,5)" )
+ checkEquals( res[[3]][[1]], matrix(0, ncol = 1, nrow=5), msg = "zeros<mat>(1,5)" )
+ checkEquals( res[[3]][[2]], matrix(0, ncol = 1, nrow=5), msg = "zeros<mat>(1,5)" )
- checkEquals( res[[4]][[1]], matrix(0:3, ncol = 2, nrow=2), msg = "field<int>" )
- checkEquals( res[[4]][[2]], matrix(letters[1:4], ncol = 2, nrow=2), msg = "field<std::string>" )
+ checkEquals( res[[4]][[1]], matrix(0:3, ncol = 2, nrow=2), msg = "field<int>" )
+ checkEquals( res[[4]][[2]], matrix(letters[1:4], ncol = 2, nrow=2), msg = "field<std::string>" )
}
test.wrap.Glue <- function(){
- res <- .Call( "RcppArmadillo_wrap_Glue", PACKAGE = "RcppArmadillo" )
- checkEquals( res[[1]], 2*diag(3), msg = "wrap(Glue)" )
+ res <- .Call( "RcppArmadillo_wrap_Glue", PACKAGE = "RcppArmadillo" )
+ checkEquals( res[[1]], 2*diag(3), msg = "wrap(Glue)" )
}
test.wrap.Op <- function(){
- res <- .Call( "RcppArmadillo_wrap_Op", PACKAGE = "RcppArmadillo" )
- checkEquals( res[[1]], -1*diag(3), msg = "wrap(Op)" )
+ res <- .Call( "RcppArmadillo_wrap_Op", PACKAGE = "RcppArmadillo" )
+ checkEquals( res[[1]], -1*diag(3), msg = "wrap(Op)" )
}
test.as.Mat <- function(){
-
- integer_mat <- matrix( as.integer(diag(4)), ncol = 4, nrow = 4 )
- numeric_mat <- diag(5)
- res <- .Call( "RcppArmadillo_as_Mat",
- list( integer_mat, numeric_mat ),
- PACKAGE = "RcppArmadillo" )
- checkEquals( unlist( res), c(4L, 5L, 4L, 5L ), msg = "as<Mat>" )
+ integer_mat <- matrix( as.integer(diag(4)), ncol = 4, nrow = 4 )
+ numeric_mat <- diag(5)
+ res <- .Call( "RcppArmadillo_as_Mat",
+ list( integer_mat, numeric_mat ),
+ PACKAGE = "RcppArmadillo" )
+ checkEquals( unlist( res), c(4L, 5L, 4L, 5L ), msg = "as<Mat>" )
}
test.as.Col <- function(){
- res <- .Call( "RcppArmadillo_as_Col",
- list( 1:10, as.numeric(1:10) ),
- PACKAGE = "RcppArmadillo" )
- checkEquals( unlist( res ), rep(55.0, 4 ), msg = "as<Col>" )
+ res <- .Call( "RcppArmadillo_as_Col",
+ list( 1:10, as.numeric(1:10) ),
+ PACKAGE = "RcppArmadillo" )
+ checkEquals( unlist( res ), rep(55.0, 4 ), msg = "as<Col>" )
}
test.as.Row <- function(){
- res <- .Call( "RcppArmadillo_as_Row",
- list( 1:10, as.numeric(1:10) ),
- PACKAGE = "RcppArmadillo" )
- checkEquals( unlist( res ), rep(55.0, 4 ), msg = "as<Row>" )
+ res <- .Call( "RcppArmadillo_as_Row",
+ list( 1:10, as.numeric(1:10) ),
+ PACKAGE = "RcppArmadillo" )
+ checkEquals( unlist( res ), rep(55.0, 4 ), msg = "as<Row>" )
}
test.fastLm <- function() {
More information about the Rcpp-commits
mailing list