tests/async/test-replicate.R

test_that("0 times", {
  do <- function() async_replicate(0, function() stop("doh"))
  expect_equal(synchronise(do()), list())
})

test_that("async_replicate", {
  do <- function(limit) {
    async_replicate(10, function() runif(1), .limit = limit)
  }

  for (lim in c(1, 2, 5, 10, 20, Inf)) {
    res <- synchronise(do(limit = lim))
    expect_equal(length(res), 10)
  }
})

Try the pkgcache package in your browser

Any scripts or data that you put into this service are public.

pkgcache documentation built on July 26, 2023, 5:44 p.m.