Skip to contents

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. If len is a numeric vector of length 2 it will produce vectors with lengths between a minimum and maximum, inclusive. For example len = c(1L, 10L) would produce vectors with lengths between 1 and 10. To produce empty vectors set len = 0L or a range like len = c(0L, 10L).

Value

A quickcheck_generator object.

Examples

list_of(integer_(), len = 10L) %>% show_example()
#> [[1]]
#> [1]     0  9155  8822 -8460 -8421     0
#> 
#> [[2]]
#> [1] -2948
#> 
#> [[3]]
#> [1]     0 -7876 -8680 -6033 -2368  2060
#> 
#> [[4]]
#> [1] -1442 -7610 -1489  5858
#> 
#> [[5]]
#> [1] 4310
#> 
#> [[6]]
#> [1] -3385 -5248 -2283
#> 
#> [[7]]
#> [1]  6524 -5021 -1283 -3807  8839     0
#> 
#> [[8]]
#> [1]   483  7879 -6753  7068   -87 -6836 -7690
#> 
#> [[9]]
#> [1]  9370  3047 -1392 -4576  -516   505
#> 
#> [[10]]
#> [1] -1086 -3091  6562  8453   600 -2467  3854
#>