Skip to contents

Convert a quickcheck generator to a hedgehog generator

Usage

as_hedgehog(generator)

Arguments

generator

A quickcheck_generator object.

Value

A quickcheck_generator object.

Examples

is_even <-
  function(a) a %% 2L == 0L
gen_powers_of_two <-
  integer_bounded(1L, 10L, len = 1L) %>%
    as_hedgehog() %>%
    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()
)