Skip to contents

Test properties of a function

Usage

for_all(
  ...,
  property,
  tests = getOption("quickcheck.tests", 100L),
  shrinks = getOption("quickcheck.shrinks", 100L),
  discards = getOption("quickcheck.discards", 100L)
)

Arguments

...

Named generators

property

A function which takes values from from the generator and calls an expectation on it. This function must have parameters matching the generator names.

tests

The number of tests to run.

shrinks

The maximum number of shrinks to run when shrinking a value to find the smallest counterexample.

discards

The maximum number of discards to permit when running the property.

Value

A testthat expectation object.

Examples

for_all(
  a = numeric_(len = 1L),
  b = numeric_(len = 1L),
  property = function(a, b) testthat::expect_equal(a + b, b + a),
  tests = 10L
)