Skip to contents

Convert a hedgehog generator to a quickcheck generator

Usage

from_hedgehog(generator)

Arguments

generator

A hedgehog.internal.gen object.

Value

A quickcheck_generator object.

Examples

is_even <-
  function(a) a %% 2L == 0L

gen_powers_of_two <-
  hedgehog::gen.element(1:10) %>% hedgehog::gen.with(function(a) 2 ^ a)

for_all(
  a = from_hedgehog(gen_powers_of_two),
  property = function(a) is_even(a) %>% testthat::expect_true()
)