SCM

SCM Repository

[matrix] Diff of /branches/Matrix-mer2/tests/validObj.R
ViewVC logotype

Diff of /branches/Matrix-mer2/tests/validObj.R

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 873, Sat Aug 27 21:26:23 2005 UTC revision 907, Thu Sep 8 15:28:48 2005 UTC
# Line 2  Line 2 
2    
3  ### Do all kinds of object creation and coercion  ### Do all kinds of object creation and coercion
4    
5  chk.matrix <- function(M) {  source(system.file("test-tools.R", package = "Matrix"))
     ## check object; including coercion to "matrix" :  
     cl <- class(M)  
     cat("class ", dQuote(cl), " [",nrow(M)," x ",ncol(M),"]; slots (",  
         paste(slotNames(M), collapse=","), ")\n", sep='')  
     stopifnot(validObject(M),  
               dim(M) == c(nrow(M), ncol(M)),  
               identical(dim(m <- as(M, "matrix")), dim(M))  
               )  
 }  
   
 ## Make sure errors are signaled  
 assertError <- function(expr) {  
     d.expr <- deparse(substitute(expr))  
     t.res <- try(expr, silent = TRUE)  
     if(!inherits(t.res, "try-error"))  
         stop(d.expr, "\n\t did not give an error", call. = FALSE)  
     invisible(t.res)  
 }  
6    
7  ## the empty ones:  ## the empty ones:
8  chk.matrix(new("dgeMatrix"))  chk.matrix(new("dgeMatrix"))

Legend:
Removed from v.873  
changed lines
  Added in v.907

root@r-forge.r-project.org
ViewVC Help
Powered by ViewVC 1.0.0  
Thanks to:
Vienna University of Economics and Business Powered By FusionForge