The R Project SVN R

Rev

Rev 61876 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 61876 Rev 64894
Line 28... Line 28...
28
##--- producing the real R script:
28
##--- producing the real R script:
29
sink("isas-tests.R")
29
sink("isas-tests.R")
30
 
30
 
31
cat(".proctime00 <- proc.time()\n",
31
cat(".proctime00 <- proc.time()\n",
32
    "isall.equal <- function(x,y)",
32
    "isall.equal <- function(x,y)",
33
    "typeof(x) == typeof(y) && is.logical(r <- all.equal(x,y, tol=0)) && r \n",
33
    "typeof(x) == typeof(y) && is.logical(r <- all.equal(x,y, tolerance=0)) && r \n",
34
    sep="\n")
34
    sep="\n")
35
 
35
 
36
cat("report <- function(x) {print(x); stopifnot(x)}\n")
36
cat("report <- function(x) {print(x); stopifnot(x)}\n")
37
 
37
 
38
cat("options(error = expression(NULL))",
38
cat("options(error = expression(NULL))",
Line 47... Line 47...
47
    cat("\n")
47
    cat("\n")
48
    ## if(is.foo(bar))  bar ``=='' as.foo(bar) :
48
    ## if(is.foo(bar))  bar ``=='' as.foo(bar) :
49
    for(r in root) {
49
    for(r in root) {
50
        cat("res <- try(as.", r, "( x ), silent = TRUE)\n", sep="")
50
        cat("res <- try(as.", r, "( x ), silent = TRUE)\n", sep="")
51
        cat("if(!inherits(res, 'try-error'))\n   report({if(is.",r,"(x)) { ",
51
        cat("if(!inherits(res, 'try-error'))\n   report({if(is.",r,"(x)) { ",
52
            "cat('IS: ');all.equal(x, res, tol=0)\n",
52
            "cat('IS: ');all.equal(x, res, tolerance=0)\n",
53
            "   } else   !isall.equal(x, res)})\n", sep="")
53
            "   } else   !isall.equal(x, res)})\n", sep="")
54
    }
54
    }
55
 
55
 
56
    ## f <- as.foo(x)  ==>  as.foo(f) == f :
56
    ## f <- as.foo(x)  ==>  as.foo(f) == f :
57
    for(r in aroot)
57
    for(r in aroot)