local_testthat {inlabru}R Documentation

Unit test helpers

Description

Local helper functions for package unit tests

Usage

local_bru_testthat_assign(x, values, envir = parent.frame())

local_bru_testthat_tolerances(
  tolerances = c(0.0001, 0.01, 0.1),
  envir = parent.frame()
)

local_bru_options_set(..., .reset = FALSE, envir = parent.frame())

local_basic_intercept_testdata()

local_basic_fixed_effect_testdata()

local_mrsea_convert(x, use_km = FALSE)

local_bru_safe_inla(multicore = FALSE, quietly = TRUE, envir = parent.frame())

local_bru_testthat_setup(envir = parent.frame())

Arguments

x

character; Name of variable to assign to

values

the object to assign to x

envir

environment for exit handlers

tolerances

numeric vector of length 3; ⁠[lowtol, midtol, hitol]⁠

.reset

For local_bru_options_set, logical indicating if the global override options list should be emptied before setting the new option(s).

multicore

logical; if TRUE, multiple cores are allowed, and the INLA num.threads option is not checked or altered. Default: FALSE, multicore not allowed (used for examples and unit tests).

quietly

logical; if TRUE, prints diagnostic messages. A message is always printed if the INLA num.threads option is altered, regardless of the quietly argument. Default: TRUE.

Details

local_bru_options_set() is used to set global package options.

Value

local_bru_options_set() returns a copy of the global override options (not including the defaults), invisibly.

Functions

See Also

bru_options_set(), bru_options_default(), bru_options_get()

Examples

my_fun <- function(val) {
  local_bru_options_set(bru_verbose = val)
  bru_options_get("bru_verbose")
}
# Inside the function, the bru_verbose option is changed.
# Outside the function, the bru_verbose option is unchanged.
print(my_fun(TRUE))
print(bru_options_get("bru_verbose"))
print(my_fun(FALSE))
print(bru_options_get("bru_verbose"))

[Package inlabru version 2.11.1 Index]