tests/local/test-crew_throttle.R

crew_test("throttle$poll() returns the right values at the right times", {
  x <- crew_throttle(seconds_max = 4, seconds_min = 4, seconds_start = 4)
  throttled <- 0L
  start <- proc.time()["elapsed"]
  while (proc.time()["elapsed"] - start < 10) {
    throttled <- throttled + x$poll()
  }
  expect_equal(throttled, 3L)
})

Try the crew package in your browser

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

crew documentation built on April 11, 2025, 6:17 p.m.