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)
})
wlandau/crew documentation built on Feb. 8, 2025, 10:12 a.m.