Validation checks to test if given elements are contained in a set.

testContains(
  object,
  elements,
  errormsg = "elements are not contained in the set"
)

checkContains(
  object,
  elements,
  errormsg = "elements are not contained in the set"
)

assertContains(
  object,
  elements,
  errormsg = "elements are not contained in the set"
)

Arguments

object

object to test

elements

elements to check

errormsg

error message to overwrite default if check fails

Value

If check passes then assert returns object invisibly and test/check return TRUE. If check fails, assert stops code with error, check returns an error message as string, and test returns FALSE.

Examples

testContains(Set$new(1,2,3), c(1,2))
#> [1] TRUE
testContains(Set$new(1,2,3), c(3,4))
#> [1] FALSE