Learn R Programming

quickcheck (version 0.1.3)

for_all: Test properties of a function

Description

Test properties of a function

Usage

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

Value

A testthat expectation object.

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.

Examples

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

Run the code above in your browser using DataLab