Generate flat lists with all values coming from a single generator. In a flat list all items will be scalars.
Usage
flat_list_of(generator, len = c(1L, 10L))
Arguments
- generator
A
quickcheck_generator
object.- len
Length of the generated vectors. If
len
is a single number all vectors will have this length. Iflen
is a numeric vector of length 2 it will produce vectors with lengths between a minimum and maximum, inclusive. For examplelen = c(1L, 10L)
would produce vectors with lengths between 1 and 10. To produce empty vectors setlen = 0L
or a range likelen = c(0L, 10L)
.
Examples
flat_list_of(integer_(), len = 10L) %>% show_example()
#> [[1]]
#> [1] -6124
#>
#> [[2]]
#> [1] 1844
#>
#> [[3]]
#> [1] -1422
#>
#> [[4]]
#> [1] 5448
#>
#> [[5]]
#> [1] 8265
#>
#> [[6]]
#> [1] -3365
#>
#> [[7]]
#> [1] -5059
#>
#> [[8]]
#> [1] 5332
#>
#> [[9]]
#> [1] 7695
#>
#> [[10]]
#> [1] -2672
#>