% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/local_testthat.R
\name{local_testthat}
\alias{local_testthat}
\alias{local_bru_testthat_assign}
\alias{local_bru_testthat_tolerances}
\alias{local_bru_options_set}
\alias{local_basic_intercept_testdata}
\alias{local_basic_fixed_effect_testdata}
\alias{local_bru_safe_inla}
\alias{local_bru_testthat_setup}
\title{Unit test helpers}
\usage{
local_bru_testthat_assign(x, values, envir = parent.frame())

local_bru_testthat_tolerances(
  tolerances = c(1e-04, 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_bru_safe_inla(multicore = FALSE, quietly = TRUE, envir = parent.frame())

local_bru_testthat_setup(envir = parent.frame())
}
\arguments{
\item{x}{character; Name of variable to assign to}

\item{values}{the object to assign to \code{x}}

\item{envir}{environment for exit handlers}

\item{tolerances}{numeric vector of length 3; \verb{[lowtol, midtol, hitol]}}

\item{.reset}{For \code{local_bru_options_set}, logical indicating if the global
override options list should be emptied before setting the new option(s).}

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

\item{quietly}{logical; if \code{TRUE}, prints diagnostic messages. A message is
always printed if the INLA \code{num.threads} option is altered, regardless of
the \code{quietly} argument. Default: TRUE.}
}
\value{
\code{local_bru_options_set()} returns a copy of the global override
options (not including the defaults), invisibly.
}
\description{
Local helper functions for package unit tests
}
\section{Functions}{
\itemize{
\item \code{local_bru_testthat_assign()}: Assign local variable. Useful for easy cleanup
of global workspace with \code{withr::deferred_run()} when running tests
interactively.

\item \code{local_bru_testthat_tolerances()}: Assign test tolerances
Assign local tolerance variables. Useful for easy cleanup
of global workspace with \code{withr::deferred_run()} when running tests
interactively.

\item \code{local_bru_options_set()}: Wrapper for \code{\link[=bru_options_set_local]{bru_options_set_local()}},
to locally override the global package options.

\item \code{local_bru_safe_inla()}: Tests should set num.threads = "1:1:1" to ensure
within-system repeatability by calling \code{local_bru_safe_inla()}; see also
\code{\link[=bru_safe_inla]{bru_safe_inla()}}

\item \code{local_bru_testthat_setup()}: Initialise environment for tests.
Assigns tolerance variables.
To be called either at the top of a testfile, or inside tests.
Does \emph{not} call \code{\link[=local_bru_safe_inla]{local_bru_safe_inla()}}, since that may invoke a skip and
should be called inside each test that relies on INLA.

}}
\seealso{
\code{\link[=bru_options_set_local]{bru_options_set_local()}}, \code{\link[=bru_options_default]{bru_options_default()}},
\code{\link[=bru_options_get]{bru_options_get()}}
}
\keyword{internal}
