tests/testthat/test-run_time.R

test_that("test running time", {

  sleeping <- function(x, y = 0){

    Sys.sleep(x)
    x + y

  }

  r_sleep <- record(sleeping)

  result_pipe <- r_sleep(1) %>=%
    r_sleep(2)

  expect_equal(sum(as.integer(result_pipe$log_df$run_time)), 2)
})

Try the chronicler package in your browser

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

chronicler documentation built on June 22, 2024, 11:30 a.m.