diff --git a/R/leak-Ex.R b/R/leak-Ex.R new file mode 100644 index 00000000..8e8f172c --- /dev/null +++ b/R/leak-Ex.R @@ -0,0 +1,51 @@ +pkgname <- "phreeqc" +source(file.path(R.home("share"), "R", "examples-header.R")) +options(warn = 1) +base::assign(".ExTimings", "phreeqc-Ex.timings", pos = 'CheckExEnv') +base::cat("name\tuser\tsystem\telapsed\n", file=base::get(".ExTimings", pos = 'CheckExEnv')) +base::assign(".format_ptime", +function(x) { + if(!is.na(x[4L])) x[1L] <- x[1L] + x[4L] + if(!is.na(x[5L])) x[2L] <- x[2L] + x[5L] + options(OutDec = '.') + format(x[1L:3L], digits = 7L) +}, +pos = 'CheckExEnv') + +### * +library('phreeqc') + +base::assign(".oldSearch", base::search(), pos = 'CheckExEnv') +cleanEx() +nameEx("phrGetErrorStrings") +### * phrGetErrorStrings + +flush(stderr()); flush(stdout()) + +base::assign(".ptime", proc.time(), pos = "CheckExEnv") +### Name: phrGetErrorStrings +### Title: Retrieve error string messages. +### Aliases: phrGetErrorStrings + +### ** Examples + +# loaddatabase should fail +n <- try(phrLoadDatabase("missing.dat"), silent = TRUE) +# if n is non-NULL display error string +if (!is.null(n)) phrGetErrorStrings() + + + +base::assign(".dptime", (proc.time() - get(".ptime", pos = "CheckExEnv")), pos = "CheckExEnv") +base::cat("phrGetErrorStrings", base::get(".format_ptime", pos = 'CheckExEnv')(get(".dptime", pos = "CheckExEnv")), "\n", file=base::get(".ExTimings", pos = 'CheckExEnv'), append=TRUE, sep="\t") +### *