mirror of
https://git.gfz-potsdam.de/naaice/iphreeqc.git
synced 2025-12-15 16:18:22 +01:00
'make check' -> 'R CMD check --as-cran' which produces (cran/)phreeqc.Rcheck/phreeqc-Ex.R and is checked in as leak-Ex.R (only includes the phrGetErrorStrings example). run using: R -d "valgrind --tool=memcheck --leak-check=full" --vanilla < leak-Ex.R and running the full set of examples: R -d "valgrind --tool=memcheck --leak-check=full" --vanilla < (cran/)phreeqc.Rcheck/phreeqc-Ex.R git-svn-id: svn://136.177.114.72/svn_GW/IPhreeqc/trunk@8844 1feff8c3-07ed-0310-ac33-dd36852eb9cd
52 lines
1.5 KiB
R
52 lines
1.5 KiB
R
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')
|
|
|
|
### * </HEADER>
|
|
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")
|
|
### * <FOOTER>
|
|
###
|
|
options(digits = 7L)
|
|
base::cat("Time elapsed: ", proc.time() - base::get("ptime", pos = 'CheckExEnv'),"\n")
|
|
grDevices::dev.off()
|
|
###
|
|
### Local variables: ***
|
|
### mode: outline-minor ***
|
|
### outline-regexp: "\\(> \\)?### [*]+" ***
|
|
### End: ***
|
|
quit('no')
|