@@ -262,11 +262,49 @@ test_that("validates `seed`", {
262262# ------------------------------------------------------------------------------
263263# furrr_options(scheduling =)
264264
265+ test_that(" can specify `scheduling`" , {
266+ x <- furrr_options(scheduling = TRUE )
267+ expect_identical(x $ scheduling , TRUE )
268+
269+ x <- furrr_options(scheduling = FALSE )
270+ expect_identical(x $ scheduling , FALSE )
271+
272+ x <- furrr_options(scheduling = 0 )
273+ expect_identical(x $ scheduling , 0L )
274+
275+ x <- furrr_options(scheduling = 5 )
276+ expect_identical(x $ scheduling , 5L )
277+
278+ x <- furrr_options(scheduling = Inf )
279+ expect_identical(x $ scheduling , Inf )
280+ })
281+
265282test_that(" validates `scheduling`" , {
266283 expect_error(furrr_options(scheduling = c(1 , 2 )))
284+ expect_error(furrr_options(scheduling = c(TRUE , FALSE )))
267285 expect_error(furrr_options(scheduling = " x" ))
268286 expect_error(furrr_options(scheduling = 1.5 ))
269287 expect_error(furrr_options(scheduling = NA ))
288+ expect_error(furrr_options(scheduling = - Inf ))
289+ expect_error(furrr_options(scheduling = lm(1 ~ 1 )))
290+ })
291+
292+ test_that(" `scheduling` supports an `ordering` attribute (#289)" , {
293+ # Integer `scheduling`
294+ x <- furrr_options(scheduling = structure(2L , ordering = " random" ))
295+ expect_identical(x $ scheduling , structure(2L , ordering = " random" ))
296+
297+ # Double `scheduling`
298+ x <- furrr_options(scheduling = structure(2 , ordering = " random" ))
299+ expect_identical(x $ scheduling , structure(2L , ordering = " random" ))
300+
301+ # Inf `scheduling`
302+ x <- furrr_options(scheduling = structure(Inf , ordering = " random" ))
303+ expect_identical(x $ scheduling , structure(Inf , ordering = " random" ))
304+
305+ # Logical `scheduling`
306+ x <- furrr_options(scheduling = structure(TRUE , ordering = " random" ))
307+ expect_identical(x $ scheduling , structure(TRUE , ordering = " random" ))
270308})
271309
272310# ------------------------------------------------------------------------------
@@ -275,13 +313,33 @@ test_that("validates `scheduling`", {
275313test_that(" can specify `chunk_size`" , {
276314 x <- furrr_options(chunk_size = 2 )
277315 expect_identical(x $ chunk_size , 2L )
316+
317+ x <- furrr_options(chunk_size = Inf )
318+ expect_identical(x $ chunk_size , Inf )
278319})
279320
280321test_that(" validates `chunk_size`" , {
322+ expect_error(furrr_options(chunk_size = 0 ))
281323 expect_error(furrr_options(chunk_size = c(1 , 2 )))
282324 expect_error(furrr_options(chunk_size = " x" ))
283325 expect_error(furrr_options(chunk_size = 1.5 ))
284326 expect_error(furrr_options(chunk_size = NA ))
327+ expect_error(furrr_options(chunk_size = - Inf ))
328+ expect_error(furrr_options(chunk_size = lm(1 ~ 1 )))
329+ })
330+
331+ test_that(" `chunk_size` supports an `ordering` attribute (#290)" , {
332+ # Integer `chunk_size`
333+ x <- furrr_options(chunk_size = structure(2L , ordering = " random" ))
334+ expect_identical(x $ chunk_size , structure(2L , ordering = " random" ))
335+
336+ # Double `chunk_size`
337+ x <- furrr_options(chunk_size = structure(2 , ordering = " random" ))
338+ expect_identical(x $ chunk_size , structure(2L , ordering = " random" ))
339+
340+ # Inf `chunk_size`
341+ x <- furrr_options(chunk_size = structure(Inf , ordering = " random" ))
342+ expect_identical(x $ chunk_size , structure(Inf , ordering = " random" ))
285343})
286344
287345# ------------------------------------------------------------------------------
0 commit comments