checkChoice: Check if an object is an element of a given set
Description
Check if an object is an element of a given set
Usage
checkChoice(x, choices)
assertChoice(x, choices, .var.name)
testChoice(x, choices)
expect_choice(x, choices, info = NULL, label = NULL)
Arguments
x
[any]
Object to check.
choices
[atomic]
Set of possible values.
.var.name
[character(1)]
Name for x. Defaults to a heuristic to determine
the name using deparse and substitute.
info
[character(1)]
Extra information to be included in the message for the testthat reporter.
See expect_that.
label
[character(1)]
Same as .var.name, but passed down to expect_that.
Value
Depending on the function prefix:
If the check is successful, all functions return TRUE.
If the check is not successful, assertChoice throws an error message,
testChoice returns FALSE, checkChoice returns
a string with the error message. The function expect_choice will
return an expectation.