Running 'doExtras.R' [159s]
  Running 'getArray-swap.R' [164s]
  Running 'tst-wrongs.R' [25s]
  Running 'tstTGforecasts.R' [8s]
  Running 'tstVaRsuperadd.R' [9s]
  Running 'varlist.R' [177s]
Running the tests in 'tests/doExtras.R' failed.
Complete output:
  > cat("doExtras is    ", simsalapar:::doExtras(), "\n",
  +     "nCores4test(): ", simsalapar:::nCores4test(), "\n", sep="")
  doExtras is    FALSE
  nCores4test(): 2
  > 
  > proc.time()
     user  system elapsed 
     0.31    0.07    0.37 
Running the tests in 'tests/getArray-swap.R' failed.
Complete output:
  > require(simsalapar)
  Loading required package: simsalapar
  > 
  > vl <- varlist(n.sim = list(type="N", expr = quote(N[sim]), value = 7),
  +               b     = list(type="grid", value = 1:3),
  +               a     = list(type="grid", value = 1:2),
  +               ii    = list(type="inner", value = 1:5))
  > (gr <- data.matrix(mkGrid(vl)))
       b a
  [1,] 1 1
  [2,] 2 1
  [3,] 3 1
  [4,] 1 2
  [5,] 2 2
  [6,] 3 2
  > 
  > do.one <- function(a,b, ii) {
  +     ## ii with names that are propagated (!) :
  +     names(ii) <- paste("I", ii, sep=".")
  +     t <- 10*(10*a + b) + round(runif(1), 1)/4
  +     ii + t
  + }
  > 
  > set.seed(17)
  > rL  <- doLapply(vl, doOne=do.one, repFirst=TRUE)
  > rL2 <- doLapply(vl, doOne=do.one, repFirst=FALSE)
  > 
  > va  <- getArray(rL , "value")
  > str(va)
   num [1:5, 1:3, 1:2, 1:7] 111 112 113 114 115 ...
   - attr(*, "dimnames")=List of 4
    ..$ ii   : chr [1:5] "I.1" "I.2" "I.3" "I.4" ...
    ..$ b    : chr [1:3] "1" "2" "3"
    ..$ a    : chr [1:2] "1" "2"
    ..$ n.sim: NULL
  > va2 <- getArray(rL2, "value")
  > str(va2)
   num [1:5, 1:3, 1:2, 1:7] 111 112 113 114 115 ...
   - attr(*, "dimnames")=List of 4
    ..$ ii   : chr [1:5] "I.1" "I.2" "I.3" "I.4" ...
    ..$ b    : chr [1:3] "1" "2" "3"
    ..$ a    : chr [1:2] "1" "2"
    ..$ n.sim: NULL
  > 
  > stopifnot( all.equal(va, va2, tol = .001) )
  > 
  > 
  > ## approximate mean result
  > am <- outer(1:5, 10*outer(1:3, 10*(1:2), "+"), "+")
  > 
  > ## Test 'repFirst=TRUE' :
  > 
  > m1 <- apply(va, 1:3, mean)
  > stopifnot(unname(dim(m1)) == dim(am)) # dim() match {apart from names}
  > dim     (am) <- dim     (m1)
  > dimnames(am) <- dimnames(m1)
  > stopifnot(all.equal(m1, am, tol = .001),
  +           apply(va, 1:3, sd) < 0.1)
  > 
  > ## Test 'repFirst=FALSE' :
  > 
  > m2 <- apply(va2, 1:3, mean)
  > stopifnot(unname(dim(m2)) == dim(am)) # dim() match {apart from names}
  > stopifnot(all.equal(m2, am, tol = .001),
  +           apply(va2, 1:3, sd) < 0.1)
  > 
  > 
  > proc.time()
     user  system elapsed 
     0.42    0.18    0.60 
Running the tests in 'tests/varlist.R' failed.
Complete output:
  > require("simsalapar")
  Loading required package: simsalapar
  > 
  > ## as long as R <= 3.0.1 is possible:
  > source(system.file("xtraR/assertErr-etc.R", package="simsalapar", mustWork=TRUE))
  > 
  > vli <- varlist(
  +     ## replications
  +     ## suposed to be 500, choosen 2 here for performance purposes
  +     n.sim=list(expr=quote(N[sim]),type="N", value=1),
  +     ## sample size
  +     n = list(type="grid", value = c(50,100)),
  +     ## Beta
  +     beta = list(type="grid",value=list(beta1=0:1, beta2=c(3,5), beta3=c(1,10))),
  +     # Method
  +     method = list(type="grid",value=list(g1= function(x,y) x+y)),
  +     # formula
  +     formula = list(type="frozen", value= y~x.1+x.2+x.3+x.4+x.5),
  +     ## outlier locations
  +     kstep = list(type="inner",value=seq(0,100,by=20))
  +     )
  Warning message:
  In varlist(n.sim = list(expr = quote(N[sim]), type = "N", value = 1),  :
    "grid" and "inner" variables should have length(value) > 1,
  But these do not:
  method
  > vl <- vli
  > vl $ kstep $type <- "grid"
  > 
  > ws <- warnings()
  > ##-> Warning should end in " :..method"
  > stopifnot(inherits(ws, "warnings"),
  + 	  grepl("method", sub(".*:", "",
  + 			      names(ws)[[1]])))## wrongly had "beta"
  > 
  > ## now works without error:
  > toLatex(vl, label = "tab:var", caption = "varlist 'vl' - regression")
  \begin{table}[htbp]
    \centering
    \begin{tabular}{l*{2}{c}r}
      \toprule
      \multicolumn{1}{c}{Variable} & \multicolumn{1}{c}{expression} & \multicolumn{1}{c}{type} & \multicolumn{1}{c}{value} \\
      \midrule
      \texttt{n.sim} & \( N_{sim} \) & N & 1 \\
      \texttt{n} & \( n \) & grid & 50, 100 \\
      \texttt{beta} & \( \beta \) & grid & 0, 1, 3, 5, 1, 10 \\
      \texttt{method} & method & grid & g1 \\
      \texttt{formula} & formula & frozen & y ~ x.1 + x.2 + x.3 + x.4 + x.5 \\
      \texttt{kstep} & kstep & grid & 0, 20, 40, 60, 80, 100 \\
      \bottomrule
    \end{tabular}
    \caption{varlist 'vl' - regression}
    \label{tab:var}
  \end{table}
  > ## TODO MM: 1) formula  2) extra "," in  "function (x, y) , x + y"
  > 
  > 
  > doNil <- function(...) rpois(3, lambda=10)
  > 
  > doNamed <- function(...) setNames(rpois(4, lambda=10), LETTERS[1:4])
  > 
  > doMatr	 <- function(...) matrix(rpois(6, lambda=10), 2,3)
  > doMat.wrong <- function(n, method, beta, kstep, formula)
  +     matrix(rpois(6, lambda=10), length(kstep), 11)
  > doMat.i	 <- function(n, method, beta, kstep, formula)
  +     matrix(rpois(6, lambda=10), 11, length(kstep))
  > 
  > doMat.n <- function(...)
  +     matrix(rpois(6, lambda=10), 2,3,
  + 	   dimnames=list(paste0("r", 1:2), paste0("C.",1:3)))
  > doMat.in <- function(n, method, beta, kstep, formula) {
  +     nr <- length(kstep)
  +     matrix(rpois(6, lambda=10), 2, nr,
  + 	   dimnames=list(paste0("r", 1:2), paste0("C.",1:nr)))
  + }
  > 
  > doArr1 <- function(...) array(rpois(7, lambda=10), 7)
  > doArr1n <- function(...) array(rpois(7, lambda=10), 7, dimnames=list(letters[1:7]))
  > doArr1.i <- function(n, method, beta, kstep, formula) {
  +     n <- length(kstep); array(rpois(n, lambda=10), n) }
  > doArr3n <- function(...)
  +   array(rpois(24, lambda=10), c(3,4,2), dimnames=
  + 	list(letters[1:3],paste0("d",1:4), paste0("D",1:2)))
  > 
  > doArr3 <- function(...) array(rpois(24, lambda=10), c(3,4,2))
  > doArr3.n <- function(...)
  +     array(rpois(30, lambda=10), c(3,5,2), dimnames=
  + 	  list(letters[1:3],NULL, paste0("D",1:2)))
  > doArr3.i <- function(n, method, beta, kstep, formula)  {
  +     n <- length(kstep)
  +     array(rpois(2*4*n, lambda=10), c(2,4,n)) }
  > 
  > ##' basic structural check or do*Apply() result 'array-list' {as made by mkAL() }
  > chkArray <- function(res) {
  +     stopifnot(is.list(res), !is.null(d <- dim(res)), prod(d) == length(res))
  +     v1 <- res[[1]]$value
  + 
  +     val   <- getArray(res) # array of values
  +     err   <- getArray(res, "error") # array of error indicators
  +     pwarn <- getArray(res, "warning") # array of warning indicators
  +     time  <- getArray(res, "time") # array of user times in ms
  +     Dim <- function(x) if(is.null(d <- dim(x))) length(x) else d
  +     stopifnot(is.numeric(val),
  + 	      all.equal(c(Dim(v1), dim(err)), dim(val), tol=0),
  + 	      identical(dim(err), dim(pwarn)),
  + 	      identical(dim(err), dim(time)))
  + }
  > 
  > ###--------- n.sim missing ( = 1 ) : -----------------------------------------
  > 
  > ## 1. "Nil": unnamed vector ------------------------------
  > chkArray(ra1   <- doLapply(vl, seed="seq", sfile=NULL, doOne= doNil))
  > ## 2. "Named": *named* vector ------------------------------ had bug
  > chkArray(raN   <- doLapply(vl, seed="seq", sfile=NULL, doOne= doNamed))
  > ## 3. Arrays (including matrices)
  > ##   1D
  > chkArray(raA1  <- doLapply(vl, seed="seq", sfile=NULL, doOne= doArr1))
  > chkArray(raA1n <- doLapply(vl, seed="seq", sfile=NULL, doOne= doArr1n))
  > chkArray(raA1.i<- doLapply(vli,seed="seq", sfile=NULL, doOne= doArr1.i))
  > ##   2D
  > chkArray(raM   <- doLapply(vl, seed="seq", sfile=NULL, doOne= doMatr))
  > chkArray(raM.  <- doLapply(vl, seed="seq", sfile=NULL, doOne= doMat.n))
  > assertError(doLapply(vli,seed="seq", sfile=NULL, doOne= doMat.wrong))
  > chkArray(raM.i <- doLapply(vli,seed="seq", sfile=NULL, doOne= doMat.i))
  > chkArray(raMin <- doLapply(vli,seed="seq", sfile=NULL, doOne= doMat.in))
  > 
  > ##   3D
  > chkArray(raA3  <- doLapply(vl, seed="seq", sfile=NULL, doOne= doArr3))
  > chkArray(raA3n <- doLapply(vl, seed="seq", sfile=NULL, doOne= doArr3n))
  > chkArray(raA3n.<- doLapply(vl, seed="seq", sfile=NULL, doOne= doArr3.n))
  > chkArray(raA3.i<- doLapply(vli,seed="seq", sfile=NULL, doOne= doArr3.i))
  > 
  > ###--------- n.sim = 3 : -----------------------------------------
  > vl3 <- set.n.sim(vl, 3)
  > 
  > ## 1. "Nil": unnamed vector ------------------------------
  > chkArray(sa1   <- doLapply(vl3, seed="seq", sfile=NULL, doOne= doNil))
  > ## 2. "Named": *named* vector ------------------------------ had bug
  > chkArray(saN   <- doLapply(vl3, seed="seq", sfile=NULL, doOne= doNamed))
  > ## 3. Arrays (including matrices)
  > ##   1D
  > chkArray(saA1  <- doLapply(vl3, seed="seq", sfile=NULL, doOne= doArr1))
  > chkArray(saA1n <- doLapply(vl3, seed="seq", sfile=NULL, doOne= doArr1n))
  > ##   2D
  > chkArray(saM   <- doLapply(vl3, seed="seq", sfile=NULL, doOne= doMatr))
  > chkArray(saM.  <- doLapply(vl3, seed="seq", sfile=NULL, doOne= doMat.n))
  > ##   3D
  > chkArray(saA3  <- doLapply(vl3, seed="seq", sfile=NULL, doOne= doArr3))
  > chkArray(saA3n <- doLapply(vl3, seed="seq", sfile=NULL, doOne= doArr3n))
  > chkArray(saA3n.<- doLapply(vl3, seed="seq", sfile=NULL, doOne= doArr3.n))
  > 
  > proc.time()
     user  system elapsed 
     0.95    0.17    1.11