Description Usage Arguments Details Value Note See Also Examples
Evaluate how a function responds to unexpected or non-standard inputs.
1 2 3 4 | fuzz_function(fun, arg_name, ..., tests = test_all(), check_args = TRUE,
progress = interactive())
p_fuzz_function(fun, .l, check_args = TRUE, progress = interactive())
|
fun |
A function. |
arg_name |
Quoted name of the argument to fuzz test. |
... |
Other non-dynamic arguments to pass to |
tests |
Which fuzz tests to run. Accepts a named list of inputs,
defaulting to |
check_args |
Check if |
progress |
Show a progress bar while running tests? |
.l |
A named list of tests. |
fuzz_function
provides a simple interface to fuzz test a single
argument of a function by passing the function, name of the argument, static
values of other required arguments, and a named list of test values.
p_fuzz_function
takes a nested list of arguments paired with lists of
tests to run on each argument, and will evaluate every combination of
argument and provided test.
A fuzz_results
object.
The user will be asked to confirm before proceeding if the combinations of potential tests exceeds 500,000.
fuzz_results
and
as.data.frame.fuzz_results
to access fuzz test results.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # Evaluate the 'formula' argument of lm, passing additional required variables
fr <- fuzz_function(lm, "formula", data = iris)
# When evaluating a function that takes ..., set check_args to FALSE
fr <- fuzz_function(paste, "x", check_args = FALSE)
# Pass tests to multiple arguments via a named list
test_args <- list(
data = test_df(),
subset = test_all(),
# Specify custom tests with a new named list
formula = list(all_vars = Sepal.Length ~ ., one_var = mpg ~ .))
fr <- p_fuzz_function(lm, test_args)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.