Running ‘test-all.R’ [7m/10m]
Running the tests in ‘tests/test-all.R’ failed.
Complete output:
  > library(testthat)
  > test_check("SpaDES.core")
  Loading required package: SpaDES.core
  Loading required package: quickPlot
  Loading required package: reproducible
  
  Attaching package: 'SpaDES.core'
  
  The following objects are masked from 'package:stats':
  
      end, start
  
  1. Failure: experiment does not work correctly (@test-experiment.R#65) ---------
  outputs(sims[[x]])$file not equal to `%>%`(...).
  2/2 mismatches
  x[1]: "/tmp/RtmpJ0aG.a/testParallel/rep1/landscape_year2"
  y[1]: "/tmp/RtmpJ0aG.a/testParallel/rep1/landscape_year2.rds"
  
  x[2]: "/tmp/RtmpJ0aG.a/testParallel/rep1/caribou_year2"
  y[2]: "/tmp/RtmpJ0aG.a/testParallel/rep1/caribou_year2.rds"
  
  
  2. Failure: experiment does not work correctly (@test-experiment.R#65) ---------
  outputs(sims[[x]])$file not equal to `%>%`(...).
  2/2 mismatches
  x[1]: "/tmp/RtmpJ0aG.a/testParallel/rep2/landscape_year2"
  y[1]: "/tmp/RtmpJ0aG.a/testParallel/rep2/landscape_year2.rds"
  
  x[2]: "/tmp/RtmpJ0aG.a/testParallel/rep2/caribou_year2"
  y[2]: "/tmp/RtmpJ0aG.a/testParallel/rep2/caribou_year2.rds"
  
  
  3. Failure: experiment does not work correctly (@test-experiment.R#65) ---------
  outputs(sims[[x]])$file not equal to `%>%`(...).
  2/2 mismatches
  x[1]: "/tmp/RtmpJ0aG.a/testParallel/rep3/landscape_year2"
  y[1]: "/tmp/RtmpJ0aG.a/testParallel/rep3/landscape_year2.rds"
  
  x[2]: "/tmp/RtmpJ0aG.a/testParallel/rep3/caribou_year2"
  y[2]: "/tmp/RtmpJ0aG.a/testParallel/rep3/caribou_year2.rds"
  
  
  4. Error: experiment does not work correctly (@test-experiment.R#107) ----------
  replacement has length zero
  1: experiment(mySimNoRL, replicates = 2, inputs = lapply(landscapeFiles, function(filenames) {
         data.frame(file = filenames, loadTime = 0, objectName = "landscape", stringsAsFactors = FALSE)
     })) at testthat/test-experiment.R:107
  2: experiment(mySimNoRL, replicates = 2, inputs = lapply(landscapeFiles, function(filenames) {
         data.frame(file = filenames, loadTime = 0, objectName = "landscape", stringsAsFactors = FALSE)
     }))
  3: do.call(get(parFun), args)
  4: (function (X, FUN, ...) 
     {
         FUN <- match.fun(FUN)
         if (!is.vector(X) || is.object(X)) 
             X <- as.list(X)
         .Internal(lapply(X, FUN))
     })(X = 1:4, FUN = function (ind, ...) 
     {
         mod <- strsplit(names(factorialExp), split = "\\.") %>% sapply(function(x) x[1])
         param <- strsplit(names(factorialExp), split = "\\.") %>% sapply(function(x) x[2])
         param[is.na(param)] <- ""
         paramValues <- factorialExp[ind, ]
         whNotExpLevel <- which(colnames(paramValues) != "expLevel")
         if (length(whNotExpLevel) < length(paramValues)) {
             mod <- mod[whNotExpLevel]
             param <- param[whNotExpLevel]
             paramValues <- paramValues[whNotExpLevel]
         }
         whNotRepl <- which(colnames(paramValues) != "replicate")
         if (length(whNotRepl) < length(paramValues)) {
             repl <- paramValues$replicate
             mod <- mod[whNotRepl]
             param <- param[whNotRepl]
             paramValues <- paramValues[whNotRepl]
         }
         notNA <- which(!is.na(paramValues))
         if (length(notNA) < length(mod)) {
             mod <- mod[notNA]
             param <- param[notNA]
             paramValues <- paramValues[notNA]
         }
         sim_ <- Copy(sim)
         experimentDF <- data.frame(module = character(0), param = character(0), val = I(list()), 
             modules = character(0), input = data.frame(), object = character(0), expLevel = numeric(0), 
             stringsAsFactors = FALSE)
         for (x in seq_along(mod)) {
             if (any(mod != "modules")) {
                 y <- factorialExp[ind, names(paramValues)[x]]
                 if (!is.na(y) & (mod[x] != "modules")) {
                     val <- params[[mod[x]]][[param[[x]]]][[y]]
                     params(sim_)[[mod[x]]][[param[[x]]]] <- val
                     experimentDF <- rbindlist(l = list(experimentDF, data.frame(module = if (!(mod[x] %in% 
                       c("input", "object"))) mod[x] else NA, param = if (!(mod[x] %in% 
                       c("input", "object"))) param[x] else NA, val = if (!(mod[x] %in% 
                       c("input", "object"))) I(list(val)) else list(NA), modules = paste0(unlist(modules[factorialExp[ind, 
                       "modules"]]), collapse = ","), input = if (mod[x] %in% c("input")) inputs[[factorialExp[ind, 
                       "input"]]] else NA, object = if (mod[x] %in% c("object")) names(objects)[[factorialExp[ind, 
                       "object"]]] else NA, expLevel = factorialExp[ind, "expLevel"], 
                       stringsAsFactors = FALSE)), use.names = TRUE, fill = TRUE)
                 }
             }
             else {
                 experimentDF <- rbindlist(l = list(experimentDF, data.frame(modules = paste0(unlist(modules[factorialExp[ind, 
                     "modules"]]), collapse = ","), expLevel = factorialExp[ind, "expLevel"], 
                     stringsAsFactors = FALSE)), use.names = TRUE, fill = TRUE)
             }
             if ("modules" %in% names(factorialExp)) {
                 if (!identical(sort(unlist(modules[factorialExp[ind, "modules"]])), sort(unlist(SpaDES.core::modules(sim))))) {
                     sim_ <- simInit(params = params(sim_), modules = as.list(unlist(modules[factorialExp[ind, 
                       "modules"]])), times = append(lapply(times(sim_)[2:3], as.numeric), 
                       times(sim_)[4]), paths = paths(sim_), outputs = outputs(sim_))
                 }
             }
         }
         if (any(dirPrefix == "simNum")) {
             exptNum <- paddedFloatToChar(factorialExp$expLevel[ind], ceiling(log10(numExpLevels + 
                 1)))
         }
         dirPrefixTmp <- paste0(dirPrefix, collapse = "")
         if ((numExpLevels > 1) & (substrLength > 0)) {
             dirName <- paste(collapse = "-", substr(mod, 1, substrLength), substr(param, 
                 1, substrLength), paramValues, sep = "_")
             dirName <- gsub(dirName, pattern = "__", replacement = "_")
             if (any(dirPrefix == "simNum")) {
                 dirPrefix <- gsub(dirPrefixTmp, pattern = "simNum", replacement = exptNum)
             }
             if (any(dirPrefix != "")) {
                 dirName <- paste(paste(dirPrefix, collapse = ""), dirName, sep = "_")
             }
         }
         else if (substrLength == 0) {
             if (any(dirPrefix != "")) {
                 simplePrefix <- if (any(dirPrefix == "simNum")) 
                     exptNum
                 else ""
                 dirName <- gsub(dirPrefixTmp, pattern = "simNum", replacement = simplePrefix)
             }
         }
         else {
             if (any(dirPrefix != "")) {
                 dirName <- gsub(dirPrefixTmp, pattern = "simNum", replacement = "")
             }
         }
         if (exists("repl", inherits = FALSE)) {
             nn <- paste0("rep", paddedFloatToChar(repl, ceiling(log10(length(replicates) + 
                 1))))
             dirName <- if (!is.null(dirName)) {
                 file.path(dirName, nn)
             }
             else {
                 file.path(nn)
             }
         }
         newOutputPath <- file.path(paths(sim_)$outputPath, dirName) %>% gsub(pattern = "/$", 
             replacement = "") %>% gsub(pattern = "//", replacement = "/")
         if (!dir.exists(newOutputPath)) 
             dir.create(newOutputPath, recursive = TRUE)
         paths(sim_)$outputPath <- newOutputPath
         if (NROW(outputs(sim_))) {
             outputs(sim_)$file <- file.path(newOutputPath, basename(outputs(sim_)$file))
         }
         if (length(inputs) > 0) {
             SpaDES.core::inputs(sim_) <- inputs[[factorialExp[ind, "input"]]]
         }
         if (length(objects) > 0) {
             replaceObjName <- strsplit(names(objects)[[factorialExp[ind, "object"]]], 
                 split = "\\.")[[1]][1]
             sim_[[replaceObjName]] <- objects[[factorialExp[ind, "object"]]]
         }
         dots <- list(...)
         if (is.null(dots$cache)) 
             dots$cache <- FALSE
         sim3 <- spades(sim_, replicate = ind, ...)
         return(list(sim3, experimentDF))
     }, notOlderThan = NULL)
  5: FUN(X[[i]], ...)
  6: SpaDES.core::`inputs<-`(`*tmp*`, value = inputs[[factorialExp[ind, "input"]]])
  7: SpaDES.core::`inputs<-`(`*tmp*`, value = inputs[[factorialExp[ind, "input"]]])
  8: .fillInputRows(value, start(sim))
  
  5. Failure: saving files does not work correctly (@test-save.R#31) -------------
  file.exists(file.path(savePath, "caribou_month1.rds")) isn't true.
  
  
  6. Failure: saving files does not work correctly (@test-save.R#35) -------------
  file.exists(file.path(savePath, "caribou_month3.rds")) isn't true.
  
  
  7. Failure: saving files does not work correctly (@test-save.R#36) -------------
  file.exists(file.path(savePath, "caribou_month5.rds")) isn't true.
  
  
  8. Failure: saving files does not work correctly (@test-save.R#54) -------------
  file.exists(file.path(savePath, "caribou_month7.rds")) isn't true.
  
  
  9. Failure: saving files does not work correctly (@test-save.R#55) -------------
  file.exists(file.path(savePath, "landscape_month7.rds")) isn't true.
  
  
  10. Error: saving csv files does not work correctly (@test-save.R#87) ----------
  invalid 'description' argument
  1: read.csv(dir(savePath, pattern = "second10.csv", full.name = TRUE)) at testthat/test-save.R:87
  2: read.table(file = file, header = header, sep = sep, quote = quote, dec = dec, fill = fill, 
         comment.char = comment.char, ...)
  3: file(file, "rt")
  
  testthat results ================================================================
  OK: 272 SKIPPED: 6 FAILED: 10
  1.  Failure: experiment does not work correctly (@test-experiment.R#65) 
  2.  Failure: experiment does not work correctly (@test-experiment.R#65) 
  3.  Failure: experiment does not work correctly (@test-experiment.R#65) 
  4.  Error: experiment does not work correctly (@test-experiment.R#107) 
  5.  Failure: saving files does not work correctly (@test-save.R#31) 
  6.  Failure: saving files does not work correctly (@test-save.R#35) 
  7.  Failure: saving files does not work correctly (@test-save.R#36) 
  8.  Failure: saving files does not work correctly (@test-save.R#54) 
  9.  Failure: saving files does not work correctly (@test-save.R#55) 
  10. Error: saving csv files does not work correctly (@test-save.R#87) 
  
  Error: testthat unit tests failed
  Execution halted