Generate lists with all values coming from a single generator.
Usage
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
list_of(integer_(), len = 10L) %>% show_example()
#> [[1]]
#> [1] -803 -3166 -7883 0 3424
#>
#> [[2]]
#> [1] -9338 -621 -4407 5157 4610 -922 8510 9625
#>
#> [[3]]
#> [1] 4752
#>
#> [[4]]
#> [1] 8503 -3192 3774 -5593 0 -3412 5888 -8190 1995 -5924
#>
#> [[5]]
#> [1] 0 9072
#>
#> [[6]]
#> [1] 5377 -8290 -2109 5076
#>
#> [[7]]
#> [1] 2917 8628 9247 2150 3511
#>
#> [[8]]
#> [1] 2562 0 3020 -739 495 1265 -9556 -9663 1433
#>
#> [[9]]
#> [1] -9784 5045 -1547 -5398 5280 -1526
#>
#> [[10]]
#> [1] 370 0 0 0 -9664 5433 -4517 -7685
#>