Learn R Programming

jwutil (version 1.1.1)

expect_that_combine_all_args: alternative expect_that from testthat which permutes all the inputs to a function which should give the same result where n args >=2 and the function is commutative.

Description

This makes a lot of assumptions, needs more testing. It can't handle mixed error/no error outcomes after permutation, which is an important feature to consider. The command following this function attaches this function to the testthat namespace. This means that it can call internal testthat functions, but does not mean it appears as testthat::expect_that_combine

Usage

expect_that_combine_all_args(object, condition, info = NULL, label = NULL)

expect_that_combine_first_arg(object, condition, info = NULL, label = NULL)

Arguments

object

object to test

condition

a function that returns whether or not the condition is met, and if not, an error message to display.

info

extra information to be included in the message (useful when writing tests in loops).

label

object label. When NULL, computed from deparsed object.

Value

testthat result

Examples

Run this code
# NOT RUN {
 expect_that_combine_all_args(sum(1, 2, 3),
  testthat::equals(6))
# }

Run the code above in your browser using DataLab